Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to find RuntimeHelpers when Asmble is loaded by a non-system class loader #40

Open
Hawk777 opened this issue May 30, 2021 · 0 comments

Comments

@Hawk777
Copy link

Hawk777 commented May 30, 2021

asmble.compile.jvm.SyntheticFuncBuilder.buildIndirectBootstrap calls ClassReader(RuntimeHelpers::class.java.name). Per the documentation:

The ClassFile structure is retrieved with the current class loader's ClassLoader.getSystemResourceAsStream(java.lang.String)

According to the documentation of that method in turn:

This method locates the resource through the system class loader (see getSystemClassLoader()).

That means that, if Asmble itself is loaded by something other than the system class loader, this call will fail. IMO it would be better to replace the ClassReader(RuntimeHelpers::class.java.name) call with something along the lines of ClassReader(RuntimeHelpers::class.java.getClassLoader().getResourceAsStream(RuntimeHelpers::class.java.name.replace('.', '/') + ".class")) (forgive me if I messed up the syntax; I don’t know Kotlin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant