Bug 389671 - Compiler fails to identify overloaded methods with mildly ambiguous generic signatures
Summary: Compiler fails to identify overloaded methods with mildly ambiguous generic s...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-16 00:03 EDT by Hollis Waite CLA
Modified: 2023-01-10 12:41 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hollis Waite CLA 2012-09-16 00:03:32 EDT
The below classes generate an error in Eclipse despite compiling fine via javac:


public class Test {
  interface A<B> {
    void x(Test2 pType, B... mediaObject);
    void x(Test2 pType, String text, int offset);
  }
  void foo() {bar().x(Test2.X, "");}
  A<?> bar() {return null;}
}

public enum Test2 {X}
Comment 1 Srikanth Sankaran CLA 2012-09-16 02:19:41 EDT
This behavior seems to date back to quite a while to at least 3.6.2, 
perhaps even earlier.
Comment 2 Srikanth Sankaran CLA 2014-11-03 21:41:21 EST
I won't be able to finish this. Reverting to inbox so some one else may
pick it up.
Comment 3 Jens Lideström CLA 2018-07-11 07:00:44 EDT
The example code in this bug report does not compile any more with javac 1.8.0_92.

It seems like this was a bug in javac and that ecj was right all along.

I suggest that this bug report is closed.


### javac output

$ javac Test.java 
Test.java:8: error: method x in interface A<B> cannot be applied to given types;
        bar().x(Test2.X, "");
             ^
  required: Test2,CAP#1[]
  found: Test2,String
  reason: varargs mismatch; String cannot be converted to CAP#1
  where B is a type-variable:
    B extends Object declared in interface A
  where CAP#1 is a fresh type-variable:
    CAP#1 extends Object from capture of ?
1 error
Comment 4 Eclipse Genie CLA 2020-07-05 15:48:53 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.
Comment 5 Eclipse Genie CLA 2023-01-10 12:41:32 EST
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.