< prev index next >

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

Print this page




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




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


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


< prev index next >