equal
deleted
inserted
replaced
32 import java.util.HashMap; |
32 import java.util.HashMap; |
33 import sun.invoke.empty.Empty; |
33 import sun.invoke.empty.Empty; |
34 import sun.invoke.util.ValueConversions; |
34 import sun.invoke.util.ValueConversions; |
35 import sun.invoke.util.VerifyType; |
35 import sun.invoke.util.VerifyType; |
36 import sun.invoke.util.Wrapper; |
36 import sun.invoke.util.Wrapper; |
|
37 import sun.reflect.CallerSensitive; |
|
38 import sun.reflect.Reflection; |
37 import static java.lang.invoke.LambdaForm.*; |
39 import static java.lang.invoke.LambdaForm.*; |
38 import static java.lang.invoke.MethodHandleStatics.*; |
40 import static java.lang.invoke.MethodHandleStatics.*; |
39 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; |
41 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; |
40 |
42 |
41 /** |
43 /** |
889 } catch (Throwable ex) { |
891 } catch (Throwable ex) { |
890 throw new InternalError(ex); |
892 throw new InternalError(ex); |
891 } |
893 } |
892 } |
894 } |
893 |
895 |
|
896 @CallerSensitive |
894 private static boolean checkCallerClass(Class<?> expected, Class<?> expected2) { |
897 private static boolean checkCallerClass(Class<?> expected, Class<?> expected2) { |
895 final int FRAME_COUNT_ARG = 2; // [0] Reflection [1] BindCaller [2] Expected |
898 // This method is called via MH_checkCallerClass and so it's |
896 Class<?> actual = sun.reflect.Reflection.getCallerClass(FRAME_COUNT_ARG); |
899 // correct to ask for the immediate caller here. |
|
900 Class<?> actual = Reflection.getCallerClass(); |
897 if (actual != expected && actual != expected2) |
901 if (actual != expected && actual != expected2) |
898 throw new InternalError("found "+actual.getName()+", expected "+expected.getName() |
902 throw new InternalError("found "+actual.getName()+", expected "+expected.getName() |
899 +(expected == expected2 ? "" : ", or else "+expected2.getName())); |
903 +(expected == expected2 ? "" : ", or else "+expected2.getName())); |
900 return true; |
904 return true; |
901 } |
905 } |