< prev index next >

src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java

Print this page

 985         java.util.Arrays.class,
 986         jdk.internal.misc.Unsafe.class
 987         //MethodHandle.class already covered
 988     };
 989 
 990     static boolean isStaticallyInvocable(NamedFunction ... functions) {
 991         for (NamedFunction nf : functions) {
 992             if (!isStaticallyInvocable(nf.member())) {
 993                 return false;
 994             }
 995         }
 996         return true;
 997     }
 998 
 999     static boolean isStaticallyInvocable(Name name) {
1000         return isStaticallyInvocable(name.function.member());
1001     }
1002 
1003     static boolean isStaticallyInvocable(MemberName member) {
1004         if (member == null)  return false;
1005         if (member.isConstructor())  return false;

1006         Class<?> cls = member.getDeclaringClass();
1007         // Fast-path non-private members declared by MethodHandles, which is a common
1008         // case
1009         if (MethodHandle.class.isAssignableFrom(cls) && !member.isPrivate()) {
1010             assert(isStaticallyInvocableType(member.getMethodOrFieldType()));
1011             return true;
1012         }
1013         if (cls.isArray() || cls.isPrimitive())
1014             return false;  // FIXME
1015         if (cls.isAnonymousClass() || cls.isLocalClass())
1016             return false;  // inner class of some sort
1017         if (cls.getClassLoader() != MethodHandle.class.getClassLoader())
1018             return false;  // not on BCP
1019         if (cls.isHidden())
1020             return false;
1021         if (!isStaticallyInvocableType(member.getMethodOrFieldType()))
1022             return false;
1023         if (!member.isPrivate() && VerifyAccess.isSamePackage(MethodHandle.class, cls))
1024             return true;   // in java.lang.invoke package
1025         if (member.isPublic() && isStaticallyNameable(cls))

 985         java.util.Arrays.class,
 986         jdk.internal.misc.Unsafe.class
 987         //MethodHandle.class already covered
 988     };
 989 
 990     static boolean isStaticallyInvocable(NamedFunction ... functions) {
 991         for (NamedFunction nf : functions) {
 992             if (!isStaticallyInvocable(nf.member())) {
 993                 return false;
 994             }
 995         }
 996         return true;
 997     }
 998 
 999     static boolean isStaticallyInvocable(Name name) {
1000         return isStaticallyInvocable(name.function.member());
1001     }
1002 
1003     static boolean isStaticallyInvocable(MemberName member) {
1004         if (member == null)  return false;
1005         if (member.isObjectConstructorOrStaticInitMethod())  return false;
1006 
1007         Class<?> cls = member.getDeclaringClass();
1008         // Fast-path non-private members declared by MethodHandles, which is a common
1009         // case
1010         if (MethodHandle.class.isAssignableFrom(cls) && !member.isPrivate()) {
1011             assert(isStaticallyInvocableType(member.getMethodOrFieldType()));
1012             return true;
1013         }
1014         if (cls.isArray() || cls.isPrimitive())
1015             return false;  // FIXME
1016         if (cls.isAnonymousClass() || cls.isLocalClass())
1017             return false;  // inner class of some sort
1018         if (cls.getClassLoader() != MethodHandle.class.getClassLoader())
1019             return false;  // not on BCP
1020         if (cls.isHidden())
1021             return false;
1022         if (!isStaticallyInvocableType(member.getMethodOrFieldType()))
1023             return false;
1024         if (!member.isPrivate() && VerifyAccess.isSamePackage(MethodHandle.class, cls))
1025             return true;   // in java.lang.invoke package
1026         if (member.isPublic() && isStaticallyNameable(cls))
< prev index next >