Bug 195802 - Name clash compile error generated if superclass is abstract
Summary: Name clash compile error generated if superclass is abstract
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.3.1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-09 05:39 EDT by Gunnar Wagenknecht CLA
Modified: 2013-08-27 04:15 EDT (History)
2 users (show)

See Also:


Attachments
test project demonstrating the problem (7.52 KB, application/x-zip-compressed)
2007-07-09 05:41 EDT, Gunnar Wagenknecht CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2007-07-09 05:39:43 EDT
3.3, JDK 1.6

// [case 1] the following does not compile
B b= new B() {
  @Override
  protected <S extends D> C<S> createC(Class<S> type) {
    return null;
  }
};

// [case 2] the following does compile
// the only difference is that B2 is not abstract
B2 b2= new B2() {
  @Override
  protected <S extends D> C<S> createC(Class<S> type) {
    return null;
  }
};


I'll attach a test project demonstrating the problem. I don't now the spec. Thus, the question is whether case 1 should compile fine or case 2 should also indicate an error somewhere.

Note, the test case was reproduced from an open source project which uses the Sun compiler. Case 1 seems to compile without a problem there.
Comment 1 Gunnar Wagenknecht CLA 2007-07-09 05:41:36 EDT
Created attachment 73299 [details]
test project demonstrating the problem
Comment 2 Kent Johnson CLA 2007-07-09 15:23:49 EDT
Likely related to bug 195468.

This problem also existed in 3.2.2.

Simplified testcase is :

class A<T> {
	void get(T t) {}
}
abstract class B extends A<C> {
	<S> void get(C<S> c) {}
}
class B2 extends A<C> {
	 <S> void get(C<S> c) {}
}

class AbstractB extends B {}
class NonBugB extends B2 {}
class C<T> {}
Comment 3 Gunnar Wagenknecht CLA 2007-07-10 01:28:14 EDT
(In reply to comment #2)
> Likely related to bug 195468.

Yes, looks like a dup.

Note that there are another compile errors reported when you call the method in later code (ambiguous reference).
Comment 4 Kent Johnson CLA 2007-07-16 15:22:44 EDT
Added MethodVerifyTest test146

Released into HEAD for 3.4M1

Released for 3.3.1
Comment 5 Kent Johnson CLA 2007-07-16 15:51:13 EDT
fixed & released into both streams
Comment 6 Frederic Fusier CLA 2007-08-03 11:38:59 EDT
Verified for 3.4M1 using build I20070802-0800.
Comment 7 Philipe Mulet CLA 2007-08-29 06:24:45 EDT
+1 for 3.3.1
Comment 8 Maxime Daniel CLA 2007-09-03 07:55:10 EDT
Verified for 3.3.1 using build M20070831-2000.
Comment 9 Stephan Herrmann CLA 2013-08-27 04:15:07 EDT
For posterity: during work on bug 410325 the test from this bug re-appeared.
The original solution could no longer be recognized in the code, due to lots of
changes in MethodVerifier15. Hence, bug 410325 implements a new special case check
in checkInheritedMethods() to re-fix this bug.