langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
changeset 3559 58cfcc0f1aa9
parent 3556 08a404c6ff0f
child 3661 104c425e96aa
equal deleted inserted replaced
3558:56be54d60f36 3559:58cfcc0f1aa9
  1237                         site = types.supertype(site);
  1237                         site = types.supertype(site);
  1238                     }
  1238                     }
  1239                 }
  1239                 }
  1240 
  1240 
  1241                 if (site.tag == CLASS) {
  1241                 if (site.tag == CLASS) {
  1242                     if (site.getEnclosingType().tag == CLASS) {
  1242                     Type encl = site.getEnclosingType();
       
  1243                     while (encl != null && encl.tag == TYPEVAR)
       
  1244                         encl = encl.getUpperBound();
       
  1245                     if (encl.tag == CLASS) {
  1243                         // we are calling a nested class
  1246                         // we are calling a nested class
  1244 
  1247 
  1245                         if (tree.meth.getTag() == JCTree.SELECT) {
  1248                         if (tree.meth.getTag() == JCTree.SELECT) {
  1246                             JCTree qualifier = ((JCFieldAccess) tree.meth).selected;
  1249                             JCTree qualifier = ((JCFieldAccess) tree.meth).selected;
  1247 
  1250 
  1249                             //     <expr>.super(...).
  1252                             //     <expr>.super(...).
  1250                             // Check that the prefix expression conforms
  1253                             // Check that the prefix expression conforms
  1251                             // to the outer instance type of the class.
  1254                             // to the outer instance type of the class.
  1252                             chk.checkRefType(qualifier.pos(),
  1255                             chk.checkRefType(qualifier.pos(),
  1253                                              attribExpr(qualifier, localEnv,
  1256                                              attribExpr(qualifier, localEnv,
  1254                                                         site.getEnclosingType()));
  1257                                                         encl));
  1255                         } else if (methName == names._super) {
  1258                         } else if (methName == names._super) {
  1256                             // qualifier omitted; check for existence
  1259                             // qualifier omitted; check for existence
  1257                             // of an appropriate implicit qualifier.
  1260                             // of an appropriate implicit qualifier.
  1258                             rs.resolveImplicitThis(tree.meth.pos(),
  1261                             rs.resolveImplicitThis(tree.meth.pos(),
  1259                                                    localEnv, site);
  1262                                                    localEnv, site);
  2040                 // other words, we are seeing this illegal program:
  2043                 // other words, we are seeing this illegal program:
  2041                 // class B<T> extends A<T.foo> {}
  2044                 // class B<T> extends A<T.foo> {}
  2042                 Symbol sym = (site.getUpperBound() != null)
  2045                 Symbol sym = (site.getUpperBound() != null)
  2043                     ? selectSym(tree, capture(site.getUpperBound()), env, pt, pkind)
  2046                     ? selectSym(tree, capture(site.getUpperBound()), env, pt, pkind)
  2044                     : null;
  2047                     : null;
  2045                 if (sym == null || isType(sym)) {
  2048                 if (sym == null) {
  2046                     log.error(pos, "type.var.cant.be.deref");
  2049                     log.error(pos, "type.var.cant.be.deref");
  2047                     return syms.errSymbol;
  2050                     return syms.errSymbol;
  2048                 } else {
  2051                 } else {
  2049                     Symbol sym2 = (sym.flags() & Flags.PRIVATE) != 0 ?
  2052                     Symbol sym2 = (sym.flags() & Flags.PRIVATE) != 0 ?
  2050                         rs.new AccessError(env, site, sym) :
  2053                         rs.new AccessError(env, site, sym) :