Bug 497183

Summary: overload resolution wrongly applies erasure (?)
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: manoj.palat
Version: 4.6Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Stephan Herrmann CLA 2016-07-02 14:11:47 EDT
See https://bugs.openjdk.java.net/browse/JDK-8148464 for a situation that ecj accepts, while according to Dan ambiguity should be reported.

Here's the example:
//---
public interface GenericInterface<V> {
  void setValue(V value);
}
public interface TypedInterface {
  void setValue(Boolean value);
}
public interface CombinedInterface extends GenericInterface<Boolean>, TypedInterface {
  default void set(boolean value) {
    setValue(Boolean.valueOf(value));
  }
} 
//---

both methods *would* collapse to being the same method, if generic instantiations should be used. However, 15.12.2.5 requires comparison of erasures instead.
- more than one maximally specific method (both are setValue(Boolean)),
- different erasures (setValue(Boolean) vs. setValue(Object))
=> ambiguity

I don't have an intuitive explanation why this code is not kosher, but we should comply with JLS.
Comment 1 Manoj N Palat CLA 2018-05-17 03:24:17 EDT
bulk move out of 4.8
Comment 2 Manoj N Palat CLA 2018-08-16 00:07:13 EDT
Bulk move out of 4.9
Comment 3 Eclipse Genie CLA 2022-07-18 17:14:24 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.