-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from Anamorphosee/dev
release 2.3.6
- Loading branch information
Showing
7 changed files
with
43 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
rootProject.name = "stacktrace-decoroutinator" | ||
include( | ||
"stacktrace-decoroutinator-common", | ||
|
||
"stacktrace-decoroutinator-jvm-common", | ||
"stacktrace-decoroutinator-jvm-agent-common", | ||
"stacktrace-decoroutinator-jvm-legacy-common", | ||
"stacktrace-decoroutinator-jvm", | ||
"stacktrace-decoroutinator-jvm-agent", | ||
"stacktrace-decoroutinator-jvm-legacy", | ||
|
||
"stacktrace-decoroutinator-android", | ||
|
||
"stacktrace-decoroutinator-noop", | ||
|
||
"jvm-agent-tests", | ||
"stdlib", | ||
|
||
"jvm-agent-tests" | ||
) |
5 changes: 2 additions & 3 deletions
5
stacktrace-decoroutinator-jvm-agent-common/src/main/kotlin/registry-jvm-agent-common.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 25 additions & 5 deletions
30
stacktrace-decoroutinator-jvm-common/src/main/kotlin/utils-jvm-common.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
package dev.reformator.stacktracedecoroutinator.jvmcommon | ||
|
||
import dev.reformator.stacktracedecoroutinator.common.DecoroutinatorMarker | ||
import org.objectweb.asm.Type | ||
|
||
private val decoroutinatorMarkerClassDescriptor = Type.getDescriptor(DecoroutinatorMarker::class.java) | ||
@Suppress("ClassName") | ||
private class _jvmcommonStub | ||
|
||
fun loadDecoroutinatorBaseContinuationClassBody(): ByteArray = | ||
ClassLoader.getSystemResourceAsStream("decoroutinatorBaseContinuation.class").use { | ||
loadResource("decoroutinatorBaseContinuation.class")!! | ||
|
||
fun loadResource(name: String): ByteArray? { | ||
val classLoader = try { | ||
Thread.currentThread().contextClassLoader | ||
} catch (_: Throwable) { | ||
null | ||
} ?: try { | ||
_jvmcommonStub::class.java.classLoader | ||
} catch (_: Throwable) { | ||
null | ||
} ?: try { | ||
ClassLoader.getSystemClassLoader() | ||
} catch (_: Throwable) { | ||
null | ||
} | ||
val stream = if (classLoader != null) { | ||
classLoader.getResourceAsStream(name) | ||
} else { | ||
ClassLoader.getSystemResourceAsStream(name) | ||
} | ||
return stream?.use { | ||
it.readBytes() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters