eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
160 stars 129 forks source link

revisit post-inference compatibility check #2768

Open stephan-herrmann opened 2 months ago

stephan-herrmann commented 2 months ago

Carried over from https://bugs.eclipse.org/506741 :

Dan claims ecj has a bug: https://bugs.openjdk.java.net/browse/JDK-8164611 (might be a future language enhancement though :) ).

A quick check reveals that we rule out one method in Scope.parameterCompatibilityLevel(MethodBinding, TypeBinding[], InvocationSite) by the code section commented thusly:

1.8+ Post inference compatibility check policy: For non-functional-type arguments, trust inference. For functional type arguments apply compatibility checks after inference has completed to ensure arguments that were not pertinent to applicability which have only seen potential compatibility checks are actually compatible.

@srikanth-sankaran it seems your strategy is better than allowed. OTOH, it may as well compensate for extra-constituational smartness in javac, just at a slightly different scope. So if removing that section causes a lot of harm we should probably prefer being "too smart" over "looking dumb" ;-P