< prev index next >

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

Print this page

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

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

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