-
Notifications
You must be signed in to change notification settings - Fork 1k
Make internal classloader instrumentation indy compatible #12242
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
Changes from 25 commits
0fd0e09
d28efde
18b9029
87f7d42
116daaa
106904e
f351043
e8a5ef2
67b1d40
57d73cd
b46acad
e54d881
393e3ef
cd7c0f9
7fc8277
33b6130
2456716
dc26c83
0154cd3
5f3f166
b01f387
712c70d
85beb7a
3e03153
05bc99f
492c968
6662850
1173824
43a4ae0
03932e4
add664a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,6 +142,15 @@ private static int getJavaVersion() { | |
| return Integer.parseInt(javaSpecVersion); | ||
| } | ||
|
|
||
| @Override | ||
| public Class<?> loadClass(String name) throws ClassNotFoundException { | ||
| // We explicitly override loadClass from ClassLoader to ensure | ||
| // that loadClass is properly excluded from our internal ClassLoader Instrumentations | ||
| // (e.g. LoadInjectedClassInstrumentation, BooDelegationInstrumentation) | ||
| // Otherwise this will cause recursion in invokedynamic linkage | ||
| return loadClass(name, false); | ||
| } | ||
|
|
||
| @Override | ||
| public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { | ||
| // ContextStorageOverride is meant for library instrumentation we don't want it to apply to our | ||
|
|
@@ -158,7 +167,14 @@ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundExce | |
| } | ||
| // search from parent and urls added to this loader | ||
| if (clazz == null) { | ||
| clazz = super.loadClass(name, false); | ||
| try { | ||
JonasKunz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| clazz = Class.forName(name, false, this.getParent()); | ||
| } catch (ClassNotFoundException e) { | ||
| // ignore | ||
| } | ||
| } | ||
| if (clazz == null) { | ||
| clazz = super.findClass(name); | ||
|
||
| } | ||
| if (resolve) { | ||
| resolveClass(clazz); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR but I think we need to add a method to the experimental interface that lets instrumentation module declare that it is compatible with non-inline advice so we could disable the advice rewriting for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of it but felt like this instrumentation was a special case where this was needed and that would only be temporary until we remove support for non-indy instrumentations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I was thinking that the main use for it would be to track the indy conversion progress and ensuring that modules that were made indy compatible once aren't broken by later changes. I'm pretty sure there was at least one more module that use the same trick to disable the advice rewriting.