src/share/classes/com/sun/tools/javac/comp/Attr.java

Print this page




3160         int skind = 0;
3161         if (tree.name == names._this || tree.name == names._super ||
3162             tree.name == names._class)
3163         {
3164             skind = TYP;
3165         } else {
3166             if ((pkind() & PCK) != 0) skind = skind | PCK;
3167             if ((pkind() & TYP) != 0) skind = skind | TYP | PCK;
3168             if ((pkind() & (VAL | MTH)) != 0) skind = skind | VAL | TYP;
3169         }
3170 
3171         // Attribute the qualifier expression, and determine its symbol (if any).
3172         Type site = attribTree(tree.selected, env, new ResultInfo(skind, Infer.anyPoly));
3173         if ((pkind() & (PCK | TYP)) == 0)
3174             site = capture(site); // Capture field access
3175 
3176         // don't allow T.class T[].class, etc
3177         if (skind == TYP) {
3178             Type elt = site;
3179             while (elt.hasTag(ARRAY))
3180                 elt = ((ArrayType)elt).elemtype;
3181             if (elt.hasTag(TYPEVAR)) {
3182                 log.error(tree.pos(), "type.var.cant.be.deref");
3183                 result = types.createErrorType(tree.type);
3184                 return;
3185             }
3186         }
3187 
3188         // If qualifier symbol is a type or `super', assert `selectSuper'
3189         // for the selection. This is relevant for determining whether
3190         // protected symbols are accessible.
3191         Symbol sitesym = TreeInfo.symbol(tree.selected);
3192         boolean selectSuperPrev = env.info.selectSuper;
3193         env.info.selectSuper =
3194             sitesym != null &&
3195             sitesym.name == names._super;
3196 
3197         // Determine the symbol represented by the selection.
3198         env.info.pendingResolutionPhase = null;
3199         Symbol sym = selectSym(tree, sitesym, site, env, resultInfo);
3200         if (sym.exists() && !isType(sym) && (pkind() & (PCK | TYP)) != 0) {




3160         int skind = 0;
3161         if (tree.name == names._this || tree.name == names._super ||
3162             tree.name == names._class)
3163         {
3164             skind = TYP;
3165         } else {
3166             if ((pkind() & PCK) != 0) skind = skind | PCK;
3167             if ((pkind() & TYP) != 0) skind = skind | TYP | PCK;
3168             if ((pkind() & (VAL | MTH)) != 0) skind = skind | VAL | TYP;
3169         }
3170 
3171         // Attribute the qualifier expression, and determine its symbol (if any).
3172         Type site = attribTree(tree.selected, env, new ResultInfo(skind, Infer.anyPoly));
3173         if ((pkind() & (PCK | TYP)) == 0)
3174             site = capture(site); // Capture field access
3175 
3176         // don't allow T.class T[].class, etc
3177         if (skind == TYP) {
3178             Type elt = site;
3179             while (elt.hasTag(ARRAY))
3180                 elt = ((ArrayType)elt.unannotatedType()).elemtype;
3181             if (elt.hasTag(TYPEVAR)) {
3182                 log.error(tree.pos(), "type.var.cant.be.deref");
3183                 result = types.createErrorType(tree.type);
3184                 return;
3185             }
3186         }
3187 
3188         // If qualifier symbol is a type or `super', assert `selectSuper'
3189         // for the selection. This is relevant for determining whether
3190         // protected symbols are accessible.
3191         Symbol sitesym = TreeInfo.symbol(tree.selected);
3192         boolean selectSuperPrev = env.info.selectSuper;
3193         env.info.selectSuper =
3194             sitesym != null &&
3195             sitesym.name == names._super;
3196 
3197         // Determine the symbol represented by the selection.
3198         env.info.pendingResolutionPhase = null;
3199         Symbol sym = selectSym(tree, sitesym, site, env, resultInfo);
3200         if (sym.exists() && !isType(sym) && (pkind() & (PCK | TYP)) != 0) {