Blocks :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
The method Unsafe.defineAnonymousClass: public Class<?> defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches) { is used in a few areas to define anonymous classes such as LambdaMetaFactory (although only one use leverages the constant pool patch ing). The defining of a class (anonymous or otherwise) within the context of a hosted class can be referred to as defining a "nest mate" class. A subset of such functionality could be supported as a method on MethodHandle.Lookup: public Class<?> defineNestmate(boolean anonymous, byte[] bytes) Where the lookup class is the context for the nest, and where the method only functions if the lookup supports private access. Code in LambdaMethodFactory and StringConcatFactory could be updated to use the public method.
|