2294 public MethodHandleSymbol(Symbol msym, boolean getter) {
2295 super(msym.flags_field, msym.name, msym.type, msym.owner);
2296 this.refSym = msym;
2297 this.getter = getter;
2298 }
2299
2300 /**
2301 * Returns the kind associated with this method handle.
2302 */
2303 public int referenceKind() {
2304 if (refSym.kind == VAR) {
2305 return getter ?
2306 refSym.isStatic() ? ClassFile.REF_getStatic : ClassFile.REF_getField :
2307 refSym.isStatic() ? ClassFile.REF_putStatic : ClassFile.REF_putField;
2308 } else {
2309 if (refSym.isConstructor()) {
2310 return ClassFile.REF_newInvokeSpecial;
2311 } else {
2312 if (refSym.isStatic()) {
2313 return ClassFile.REF_invokeStatic;
2314 } else if ((refSym.flags() & PRIVATE) != 0) {
2315 return ClassFile.REF_invokeSpecial;
2316 } else if (refSym.enclClass().isInterface()) {
2317 return ClassFile.REF_invokeInterface;
2318 } else {
2319 return ClassFile.REF_invokeVirtual;
2320 }
2321 }
2322 }
2323 }
2324
2325 @Override
2326 public int poolTag() {
2327 return ClassFile.CONSTANT_MethodHandle;
2328 }
2329
2330 @Override
2331 public Object poolKey(Types types) {
2332 return new Pair<>(baseSymbol(), referenceKind());
2333 }
2334
2335 @Override
|
2294 public MethodHandleSymbol(Symbol msym, boolean getter) {
2295 super(msym.flags_field, msym.name, msym.type, msym.owner);
2296 this.refSym = msym;
2297 this.getter = getter;
2298 }
2299
2300 /**
2301 * Returns the kind associated with this method handle.
2302 */
2303 public int referenceKind() {
2304 if (refSym.kind == VAR) {
2305 return getter ?
2306 refSym.isStatic() ? ClassFile.REF_getStatic : ClassFile.REF_getField :
2307 refSym.isStatic() ? ClassFile.REF_putStatic : ClassFile.REF_putField;
2308 } else {
2309 if (refSym.isConstructor()) {
2310 return ClassFile.REF_newInvokeSpecial;
2311 } else {
2312 if (refSym.isStatic()) {
2313 return ClassFile.REF_invokeStatic;
2314 } else if (refSym.enclClass().isInterface()) {
2315 return ClassFile.REF_invokeInterface;
2316 } else {
2317 return ClassFile.REF_invokeVirtual;
2318 }
2319 }
2320 }
2321 }
2322
2323 @Override
2324 public int poolTag() {
2325 return ClassFile.CONSTANT_MethodHandle;
2326 }
2327
2328 @Override
2329 public Object poolKey(Types types) {
2330 return new Pair<>(baseSymbol(), referenceKind());
2331 }
2332
2333 @Override
|