langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
changeset 21024 e1efbecefefa
parent 20249 93f8eae31092
child 21718 74a5882faf79
equal deleted inserted replaced
21023:1192bdc59d82 21024:e1efbecefefa
   422          *  @param c       The class where the access takes place
   422          *  @param c       The class where the access takes place
   423          *  @site          The type of the qualifier
   423          *  @site          The type of the qualifier
   424          */
   424          */
   425         private
   425         private
   426         boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) {
   426         boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) {
       
   427             Type newSite = site.hasTag(TYPEVAR) ? site.getUpperBound() : site;
   427             while (c != null &&
   428             while (c != null &&
   428                    !(c.isSubClass(sym.owner, types) &&
   429                    !(c.isSubClass(sym.owner, types) &&
   429                      (c.flags() & INTERFACE) == 0 &&
   430                      (c.flags() & INTERFACE) == 0 &&
   430                      // In JLS 2e 6.6.2.1, the subclass restriction applies
   431                      // In JLS 2e 6.6.2.1, the subclass restriction applies
   431                      // only to instance fields and methods -- types are excluded
   432                      // only to instance fields and methods -- types are excluded
   432                      // regardless of whether they are declared 'static' or not.
   433                      // regardless of whether they are declared 'static' or not.
   433                      ((sym.flags() & STATIC) != 0 || sym.kind == TYP || site.tsym.isSubClass(c, types))))
   434                      ((sym.flags() & STATIC) != 0 || sym.kind == TYP || newSite.tsym.isSubClass(c, types))))
   434                 c = c.owner.enclClass();
   435                 c = c.owner.enclClass();
   435             return c != null;
   436             return c != null;
   436         }
   437         }
   437 
   438 
   438     /**
   439     /**
  2708                                   boolean boxingAllowed,
  2709                                   boolean boxingAllowed,
  2709                                   MethodCheck methodCheck,
  2710                                   MethodCheck methodCheck,
  2710                                   InferenceContext inferenceContext) {
  2711                                   InferenceContext inferenceContext) {
  2711         MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC;
  2712         MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC;
  2712 
  2713 
  2713         if (site.hasTag(TYPEVAR)) {
       
  2714             return resolveMemberReference(pos, env, referenceTree, site.getUpperBound(),
       
  2715                     name, argtypes, typeargtypes, boxingAllowed, methodCheck, inferenceContext);
       
  2716         }
       
  2717 
       
  2718         site = types.capture(site);
  2714         site = types.capture(site);
  2719 
  2715 
  2720         ReferenceLookupHelper boundLookupHelper;
  2716         ReferenceLookupHelper boundLookupHelper;
  2721         if (!name.equals(names.init)) {
  2717         if (!name.equals(names.init)) {
  2722             //method reference
  2718             //method reference