Bug 203587 - Improve messages consistency in case of generic methods having same erasure
Summary: Improve messages consistency in case of generic methods having same erasure
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.4 M3   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-17 09:13 EDT by Maxime Daniel CLA
Modified: 2007-10-29 05:25 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (7.55 KB, patch)
2007-09-28 11:27 EDT, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Daniel CLA 2007-09-17 09:13:17 EDT
I20070917-0010

While verifying bug 202624, I found that error messages are different in the two following cases:

// First case
public class Test {
    public <T> void func(Class<XX> cls){}; 
      // says 'Duplicate method func(Class<Test.XX>) in type Test'
    public <A, B> void func(Class<XX<A, B>> cls) {}
      // says 'Method func(Class<Test.XX<A,B>>) has the same erasure 
      //       func(Class<T>) as another method in type Test'
    class XX<A, B> {}
}

// Second case
public class Test {
    public <T> void func(Class<XX<T,T>> cls){}; // says same erasure
    public <A, B> void func(Class<XX<A, B>> cls) {} // says same erasure
    class XX<A, B> {}
}

JDK 6 does in both cases as Eclipse does in second case, which is what I would have expected in first case as well. Furthermore, Eclipse message do not cite the conflicting method, making the diagnostic harder.
Opening as minor though, since Eclipse still yields an error message that is related to the issue at hand.
Comment 1 Kent Johnson CLA 2007-09-28 11:27:22 EDT
Created attachment 79407 [details]
Proposed patch

Changed to pass along whether the parameters of the 2 methods are equal.

So we'll use the erasure error message for both methods when they are not equal.
Comment 2 Kent Johnson CLA 2007-09-28 14:25:51 EDT
Released into HEAD for 3.4M3

Added GenericTypeTest 1185
Comment 3 Frederic Fusier CLA 2007-10-29 05:25:35 EDT
Verified for 3.4M3 using I20071029-0010 build.