Community
Participate
Working Groups
I'm running into a problem with an API that I'm developing that deals with generics and inner interfaces. A very simple example of the problem is the following: SuperInterface.java: package com.test.superint; public interface SuperInterface<G extends SuperInterface.SuperInterfaceGetter, S extends SuperInterface.SuperInterfaceSetter> { public interface SuperInterfaceGetter {} public interface SuperInterfaceSetter {} } SubInterface.java: package com.test.subint; import com.test.superint.SuperInterface; public interface SubInterface extends SuperInterface<SubInterface.SubInterfaceGetter, SubInterface.SubInterfaceSetter> { public interface SubInterfaceGetter extends SuperInterfaceGetter {} public interface SubInterfaceSetter extends SuperInterfaceSetter {} } These two classes compiles without a problem in eclipse jdt, but fails when compiling using javac or maven with the following error (using the complience level 1.5 in both environments): test\subint\SubInterface.java:6: cannot find symbol symbol : class SuperInterfaceGetter location: interface test.subint.SubInterface public interface SubInterfaceGetter extends SuperInterfaceGetter {} ^ test\subint\SubInterface.java:8: cannot find symbol symbol : class SuperInterfaceSetter location: interface test.subint.SubInterface public interface SubInterfaceSetter extends SuperInterfaceSetter {} ^ test\subint\SubInterface.java:5: type parameter test.subint.SubInterface.SubInterfaceGetter is not within its bound public interface SubInterface extends SuperInterface<SubInterface.SubInterfaceGetter, SubInterface.SubInterfaceSetter> { ^ test\subint\SubInterface.java:5: type parameter test.subint.SubInterface.SubInterfaceSetter is not within its bound public interface SubInterface extends SuperInterface<SubInterface.SubInterfaceGetter, SubInterface.SubInterfaceSetter> { ^ 4 errors To make it compile outside of eclipse, I have to add two imports to the interface SubInterface.java: import com.test.superint.SuperInterface.SuperInterfaceGetter; import com.test.superint.SuperInterface.SuperInterfaceSetter; But as soon as I do it, eclipse says these two imports are never used and remove them if the "Remove unused imports" is enabled The only way to make the code compile in eclipse as well as javac/maven is by referring to the inner interfaces through the outer interface class: package com.test.subint; import com.test.superint.SuperInterface; public interface SubInterface extends com.test.superint.SuperInterface<SubInterface.SubInterfaceGetter, SubInterface.SubInterfaceSetter> { public interface SubInterfaceGetter extends SuperInterface.SuperInterfaceGetter {} public interface SubInterfaceSetter extends SuperInterface.SuperInterfaceSetter {} } Additional information: I'm using Java SDK 1.6.0_11
What is your build id ?
Build id: I20090611-1540
Moving to M5.
Srikanth, Any update on this?
(In reply to comment #4) > Srikanth, > > Any update on this? Sorry, prior to leaving on vacation I had found out that this was a regression in behavior introduced by the fix to bug# 205235. After my return I didn't get a chance so far. I need to fix this without reintroducing bug# 205235. I'll get on this task now.
Retargetting for M6.
Created attachment 157765 [details] Possible patch This patch undoes the fix for bug#205235 and refixes it in a way that doesn't cause the current problem. This fixes both the problems and is under test.
Created attachment 157776 [details] Proposed patch I like this patch better.
Jay, can you please review ? Thanks.
The patch looks really good.(In reply to comment #8) > Created an attachment (id=157776) [details] > Proposed patch > > I like this patch better. The patch looks really good to me.
Released in HEAD for 3.6M6
verified for 3.6M6 using build I20100305-1011.
Verified.
*** Bug 322177 has been marked as a duplicate of this bug. ***