public static JavaConstant ofVarHandle ( FieldDescription . InDefinedShape fieldDescription ) { return new Dynamic ( new ConstantDynamic ( fieldDescription . getInternalName ( ) , JavaType . VAR_HANDLE . getTypeStub ( ) . getDescriptor ( ) , new Handle ( Opcodes . H_INVOKESTATIC , CONSTANT_BOOTSTRAPS , fieldDescription . isStatic ( ) ? "staticFieldVarHandle" : "fieldVarHandle" , "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/invoke/VarHandle;" , false ) , Type . getType ( fieldDescription . getDeclaringType ( ) . getDescriptor ( ) ) , Type . getType ( fieldDescription . getType ( ) . asErasure ( ) . getDescriptor ( ) ) ) , JavaType . VAR_HANDLE . getTypeStub ( ) ) ; }
Resolves a var handle constant for a field .