< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java

Print this page




2173         public MethodHandleSymbol(Symbol msym, boolean getter) {
2174             super(msym.flags_field, msym.name, msym.type, msym.owner);
2175             this.refSym = msym;
2176             this.getter = getter;
2177         }
2178 
2179         /**
2180          * Returns the kind associated with this method handle.
2181          */
2182         public int referenceKind() {
2183             if (refSym.kind == VAR) {
2184                 return getter ?
2185                         refSym.isStatic() ? ClassFile.REF_getStatic : ClassFile.REF_getField :
2186                         refSym.isStatic() ? ClassFile.REF_putStatic : ClassFile.REF_putField;
2187             } else {
2188                 if (refSym.isConstructor()) {
2189                     return ClassFile.REF_newInvokeSpecial;
2190                 } else {
2191                     if (refSym.isStatic()) {
2192                         return ClassFile.REF_invokeStatic;
2193                     } else if ((refSym.flags() & PRIVATE) != 0) {
2194                         return ClassFile.REF_invokeSpecial;
2195                     } else if (refSym.enclClass().isInterface()) {
2196                         return ClassFile.REF_invokeInterface;
2197                     } else {
2198                         return ClassFile.REF_invokeVirtual;
2199                     }
2200                 }
2201             }
2202         }
2203 
2204         @Override
2205         public int poolTag() {
2206             return ClassFile.CONSTANT_MethodHandle;
2207         }
2208 
2209         @Override
2210         public Object poolKey(Types types) {
2211             return new Pair<>(baseSymbol(), referenceKind());
2212         }
2213 
2214         @Override




2173         public MethodHandleSymbol(Symbol msym, boolean getter) {
2174             super(msym.flags_field, msym.name, msym.type, msym.owner);
2175             this.refSym = msym;
2176             this.getter = getter;
2177         }
2178 
2179         /**
2180          * Returns the kind associated with this method handle.
2181          */
2182         public int referenceKind() {
2183             if (refSym.kind == VAR) {
2184                 return getter ?
2185                         refSym.isStatic() ? ClassFile.REF_getStatic : ClassFile.REF_getField :
2186                         refSym.isStatic() ? ClassFile.REF_putStatic : ClassFile.REF_putField;
2187             } else {
2188                 if (refSym.isConstructor()) {
2189                     return ClassFile.REF_newInvokeSpecial;
2190                 } else {
2191                     if (refSym.isStatic()) {
2192                         return ClassFile.REF_invokeStatic;


2193                     } else if (refSym.enclClass().isInterface()) {
2194                         return ClassFile.REF_invokeInterface;
2195                     } else {
2196                         return ClassFile.REF_invokeVirtual;
2197                     }
2198                 }
2199             }
2200         }
2201 
2202         @Override
2203         public int poolTag() {
2204             return ClassFile.CONSTANT_MethodHandle;
2205         }
2206 
2207         @Override
2208         public Object poolKey(Types types) {
2209             return new Pair<>(baseSymbol(), referenceKind());
2210         }
2211 
2212         @Override


< prev index next >