< prev index next >

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

Print this page

        

*** 1251,1276 **** } if (!pn.equals(lookupClass.getPackageName())) { throw new IllegalArgumentException(cn + " not in same package as lookup class: " + lookupClass.getName()); } - Class<?> host = lookupClass; - if ((flags & NESTMATE_CLASS) != 0) { - // cached in the Class object - host = lookupClass.getNestHost(); - } - if ((flags & NONFINDABLE_CLASS) != 0) { // assign a new name // cn = cn + "\\" + ++seq; cn = null; } // invoke the class loader's defineClass method ClassLoader loader = lookupClass.getClassLoader(); ProtectionDomain pd = (loader != null) ? lookupClassProtectionDomain() : null; ! Class<?> clazz = JLA.defineClass(loader, host, cn, bytes, pd, flags, classData); assert clazz.getClassLoader() == lookupClass.getClassLoader() && clazz.getPackageName().equals(lookupClass.getPackageName()); // ## TBD what if multiple threads defining this same class?? // may need VM to inject the classData in a Class itself at define class time --- 1251,1270 ---- } if (!pn.equals(lookupClass.getPackageName())) { throw new IllegalArgumentException(cn + " not in same package as lookup class: " + lookupClass.getName()); } if ((flags & NONFINDABLE_CLASS) != 0) { // assign a new name // cn = cn + "\\" + ++seq; cn = null; } // invoke the class loader's defineClass method ClassLoader loader = lookupClass.getClassLoader(); ProtectionDomain pd = (loader != null) ? lookupClassProtectionDomain() : null; ! Class<?> clazz = JLA.defineClass(loader, lookupClass, cn, bytes, pd, flags, classData); assert clazz.getClassLoader() == lookupClass.getClassLoader() && clazz.getPackageName().equals(lookupClass.getPackageName()); // ## TBD what if multiple threads defining this same class?? // may need VM to inject the classData in a Class itself at define class time
< prev index next >