< prev index next >
src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
Print this page
rev 15107 : 8161379: Force inline methods calling Reflection.getCallerClass
Reviewed-by: TBD
@@ -28,10 +28,11 @@
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
import jdk.internal.vm.annotation.Stable;
import sun.invoke.empty.Empty;
import sun.invoke.util.ValueConversions;
import sun.invoke.util.VerifyType;
import sun.invoke.util.Wrapper;
@@ -42,11 +43,10 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.lang.invoke.LambdaForm.*;
import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
@@ -1244,10 +1244,11 @@
throw new InternalError(ex);
}
}
@CallerSensitive
+ @ForceInline
private static boolean checkCallerClass(Class<?> expected) {
// This method is called via MH_checkCallerClass and so it's correct to ask for the immediate caller here.
Class<?> actual = Reflection.getCallerClass();
if (actual != expected)
throw new InternalError("found " + actual.getName() + ", expected " + expected.getName());
< prev index next >