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

Remove IntrinsicCandidate annotation on non-native delegate methods. #393

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ class NativeWrappingClassFileTransformer implements ClassFileTransformer {

private final Map<String, Map<String, Set<String>>> blockingMethods;

public static final boolean IS_JDK_18_OR_NEWER;

static {
String javaVersion = System.getProperty("java.specification.version");
double version = Double.parseDouble(javaVersion);
IS_JDK_18_OR_NEWER = version >= 18.0;
}

NativeWrappingClassFileTransformer(final Map<String, Map<String, Set<String>>> blockingMethods) {
this.blockingMethods = blockingMethods;
}
Expand Down Expand Up @@ -105,6 +113,14 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str
delegatingMethodVisitor.visitCode();

return new MethodVisitor(ASM7, delegatingMethodVisitor) {
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
// See #392
if (IS_JDK_18_OR_NEWER && descriptor.equals("Ljdk/internal/vm/annotation/IntrinsicCandidate;")) {
return null; // remove the intrinsic annotation
}
return super.visitAnnotation(descriptor, visible);
}

@Override
public void visitEnd() {
Expand Down
Loading