94 JCDiagnostic.Factory diags; |
94 JCDiagnostic.Factory diags; |
95 public final boolean boxingEnabled; |
95 public final boolean boxingEnabled; |
96 public final boolean varargsEnabled; |
96 public final boolean varargsEnabled; |
97 public final boolean allowMethodHandles; |
97 public final boolean allowMethodHandles; |
98 public final boolean allowFunctionalInterfaceMostSpecific; |
98 public final boolean allowFunctionalInterfaceMostSpecific; |
99 public final boolean checkVarargsAccessDuringResolution; |
99 public final boolean checkVarargsAccessAfterResolution; |
100 private final boolean debugResolve; |
100 private final boolean debugResolve; |
101 private final boolean compactMethodDiags; |
101 private final boolean compactMethodDiags; |
102 final EnumSet<VerboseResolutionMode> verboseResolutionMode; |
102 final EnumSet<VerboseResolutionMode> verboseResolutionMode; |
103 |
103 |
104 Scope polymorphicSignatureScope; |
104 Scope polymorphicSignatureScope; |
136 options.isUnset(Option.XDIAGS) && options.isUnset("rawDiagnostics"); |
136 options.isUnset(Option.XDIAGS) && options.isUnset("rawDiagnostics"); |
137 verboseResolutionMode = VerboseResolutionMode.getVerboseResolutionMode(options); |
137 verboseResolutionMode = VerboseResolutionMode.getVerboseResolutionMode(options); |
138 Target target = Target.instance(context); |
138 Target target = Target.instance(context); |
139 allowMethodHandles = target.hasMethodHandles(); |
139 allowMethodHandles = target.hasMethodHandles(); |
140 allowFunctionalInterfaceMostSpecific = source.allowFunctionalInterfaceMostSpecific(); |
140 allowFunctionalInterfaceMostSpecific = source.allowFunctionalInterfaceMostSpecific(); |
141 checkVarargsAccessDuringResolution = |
141 checkVarargsAccessAfterResolution = |
142 source.allowPostApplicabilityVarargsAccessCheck(); |
142 source.allowPostApplicabilityVarargsAccessCheck(); |
143 polymorphicSignatureScope = new Scope(syms.noSymbol); |
143 polymorphicSignatureScope = new Scope(syms.noSymbol); |
144 |
144 |
145 inapplicableMethodException = new InapplicableMethodException(diags); |
145 inapplicableMethodException = new InapplicableMethodException(diags); |
146 } |
146 } |
835 List<Type> argtypes, |
835 List<Type> argtypes, |
836 List<Type> formals, |
836 List<Type> formals, |
837 Warner warn) { |
837 Warner warn) { |
838 super.argumentsAcceptable(env, deferredAttrContext, argtypes, formals, warn); |
838 super.argumentsAcceptable(env, deferredAttrContext, argtypes, formals, warn); |
839 //should we expand formals? |
839 //should we expand formals? |
840 if ((!checkVarargsAccessDuringResolution || |
840 if (deferredAttrContext.phase.isVarargsRequired()) { |
841 (checkVarargsAccessDuringResolution && |
841 Type typeToCheck = null; |
842 deferredAttrContext.mode == AttrMode.CHECK)) && |
842 if (!checkVarargsAccessAfterResolution) { |
843 deferredAttrContext.phase.isVarargsRequired()) { |
843 typeToCheck = types.elemtype(formals.last()); |
844 //check varargs element type accessibility |
844 } else if (deferredAttrContext.mode == AttrMode.CHECK) { |
845 varargsAccessible(env, types.elemtype(formals.last()), |
845 typeToCheck = types.erasure(types.elemtype(formals.last())); |
846 deferredAttrContext.inferenceContext); |
846 } |
|
847 if (typeToCheck != null) { |
|
848 varargsAccessible(env, typeToCheck, deferredAttrContext.inferenceContext); |
|
849 } |
847 } |
850 } |
848 } |
851 } |
849 |
852 |
850 private void varargsAccessible(final Env<AttrContext> env, final Type t, final InferenceContext inferenceContext) { |
853 private void varargsAccessible(final Env<AttrContext> env, final Type t, final InferenceContext inferenceContext) { |
851 if (inferenceContext.free(t)) { |
854 if (inferenceContext.free(t)) { |