Bug 497183 - overload resolution wrongly applies erasure (?)
Summary: overload resolution wrongly applies erasure (?)
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2016-07-02 14:11 EDT by Stephan Herrmann CLA
Modified: 2022-07-18 17:14 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.