langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
changeset 22167 e0ba35f27975
parent 22163 3651128c74eb
child 22440 d40c30326317
equal deleted inserted replaced
22166:adc980c0dbcc 22167:e0ba35f27975
    92     Types types;
    92     Types types;
    93     JCDiagnostic.Factory diags;
    93     JCDiagnostic.Factory diags;
    94     public final boolean boxingEnabled; // = source.allowBoxing();
    94     public final boolean boxingEnabled; // = source.allowBoxing();
    95     public final boolean varargsEnabled; // = source.allowVarargs();
    95     public final boolean varargsEnabled; // = source.allowVarargs();
    96     public final boolean allowMethodHandles;
    96     public final boolean allowMethodHandles;
    97     public final boolean allowDefaultMethods;
    97     public final boolean allowDefaultMethodsResolution;
    98     public final boolean allowStructuralMostSpecific;
    98     public final boolean allowStructuralMostSpecific;
    99     private final boolean debugResolve;
    99     private final boolean debugResolve;
   100     private final boolean compactMethodDiags;
   100     private final boolean compactMethodDiags;
   101     final EnumSet<VerboseResolutionMode> verboseResolutionMode;
   101     final EnumSet<VerboseResolutionMode> verboseResolutionMode;
   102 
   102 
   134         compactMethodDiags = options.isSet(Option.XDIAGS, "compact") ||
   134         compactMethodDiags = options.isSet(Option.XDIAGS, "compact") ||
   135                 options.isUnset(Option.XDIAGS) && options.isUnset("rawDiagnostics");
   135                 options.isUnset(Option.XDIAGS) && options.isUnset("rawDiagnostics");
   136         verboseResolutionMode = VerboseResolutionMode.getVerboseResolutionMode(options);
   136         verboseResolutionMode = VerboseResolutionMode.getVerboseResolutionMode(options);
   137         Target target = Target.instance(context);
   137         Target target = Target.instance(context);
   138         allowMethodHandles = target.hasMethodHandles();
   138         allowMethodHandles = target.hasMethodHandles();
   139         allowDefaultMethods = source.allowDefaultMethods();
   139         allowDefaultMethodsResolution = source.allowDefaultMethodsResolution();
   140         allowStructuralMostSpecific = source.allowStructuralMostSpecific();
   140         allowStructuralMostSpecific = source.allowStructuralMostSpecific();
   141         polymorphicSignatureScope = new Scope(syms.noSymbol);
   141         polymorphicSignatureScope = new Scope(syms.noSymbol);
   142 
   142 
   143         inapplicableMethodException = new InapplicableMethodException(diags);
   143         inapplicableMethodException = new InapplicableMethodException(diags);
   144     }
   144     }
  1678         Symbol concrete = bestSoFar.kind < ERR &&
  1678         Symbol concrete = bestSoFar.kind < ERR &&
  1679                 (bestSoFar.flags() & ABSTRACT) == 0 ?
  1679                 (bestSoFar.flags() & ABSTRACT) == 0 ?
  1680                 bestSoFar : methodNotFound;
  1680                 bestSoFar : methodNotFound;
  1681 
  1681 
  1682         for (InterfaceLookupPhase iphase2 : InterfaceLookupPhase.values()) {
  1682         for (InterfaceLookupPhase iphase2 : InterfaceLookupPhase.values()) {
  1683             if (iphase2 == InterfaceLookupPhase.DEFAULT_OK && !allowDefaultMethods) break;
  1683             if (iphase2 == InterfaceLookupPhase.DEFAULT_OK && !allowDefaultMethodsResolution) break;
  1684             //keep searching for abstract methods
  1684             //keep searching for abstract methods
  1685             for (Type itype : itypes[iphase2.ordinal()]) {
  1685             for (Type itype : itypes[iphase2.ordinal()]) {
  1686                 if (!itype.isInterface()) continue; //skip j.l.Object (included by Types.closure())
  1686                 if (!itype.isInterface()) continue; //skip j.l.Object (included by Types.closure())
  1687                 if (iphase2 == InterfaceLookupPhase.DEFAULT_OK &&
  1687                 if (iphase2 == InterfaceLookupPhase.DEFAULT_OK &&
  1688                         (itype.tsym.flags() & DEFAULT) == 0) continue;
  1688                         (itype.tsym.flags() & DEFAULT) == 0) continue;
  1711                 //We should not look for abstract methods if receiver is a concrete class
  1711                 //We should not look for abstract methods if receiver is a concrete class
  1712                 //(as concrete classes are expected to implement all abstracts coming
  1712                 //(as concrete classes are expected to implement all abstracts coming
  1713                 //from superinterfaces)
  1713                 //from superinterfaces)
  1714                 if ((s.flags() & (ABSTRACT | INTERFACE | ENUM)) != 0) {
  1714                 if ((s.flags() & (ABSTRACT | INTERFACE | ENUM)) != 0) {
  1715                     return this;
  1715                     return this;
  1716                 } else if (rs.allowDefaultMethods) {
  1716                 } else if (rs.allowDefaultMethodsResolution) {
  1717                     return DEFAULT_OK;
  1717                     return DEFAULT_OK;
  1718                 } else {
  1718                 } else {
  1719                     return null;
  1719                     return null;
  1720                 }
  1720                 }
  1721             }
  1721             }
  3338                 }
  3338                 }
  3339             }
  3339             }
  3340             if ((env1.enclClass.sym.flags() & STATIC) != 0) staticOnly = true;
  3340             if ((env1.enclClass.sym.flags() & STATIC) != 0) staticOnly = true;
  3341             env1 = env1.outer;
  3341             env1 = env1.outer;
  3342         }
  3342         }
  3343         if (allowDefaultMethods && c.isInterface() &&
  3343         if (allowDefaultMethodsResolution && c.isInterface() &&
  3344                 name == names._super && !isStatic(env) &&
  3344                 name == names._super && !isStatic(env) &&
  3345                 types.isDirectSuperInterface(c, env.enclClass.sym)) {
  3345                 types.isDirectSuperInterface(c, env.enclClass.sym)) {
  3346             //this might be a default super call if one of the superinterfaces is 'c'
  3346             //this might be a default super call if one of the superinterfaces is 'c'
  3347             for (Type t : pruneInterfaces(env.enclClass.type)) {
  3347             for (Type t : pruneInterfaces(env.enclClass.type)) {
  3348                 if (t.tsym == c) {
  3348                 if (t.tsym == c) {