New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending an inner interface can cause a bounds mismatch error #1069
Comments
|
I don't know about maven/pom parts, but compiling the test case in the top with javac produces identical errors: I don't see a compiler bug here - At the point (both) the compilers are complaining about the names are not in scope unless qualified with the enclosing types (which themselves are in scope) Unless further clarifications are offered that points to a real compiler problem, I will close this in a day or two with no action. Let me know if I misunderstand something in the picture. TIA |
|
I'm afraid I'm not following, or can't reproduce the error in javac as you have it. I've made a git repo to demonstrate this, with a simple profile to switch between jdt and javac. https://github.com/niloc132/9829-test-case Can also confirm with this that javac (tested 11.0.19+7), there are no errors: ➜ 9829-test-case git:(main) java -version
openjdk version "11.0.19" 2023-04-18
OpenJDK Runtime Environment (build 11.0.19+7)
OpenJDK 64-Bit Server VM (build 11.0.19+7, mixed mode)
➜ 9829-test-case git:(main) mkdir out
➜ 9829-test-case git:(main) javac -d out src/main/java/org/dominokit/test/*
➜ 9829-test-case git:(main) find out
out
out/org
out/org/dominokit
out/org/dominokit/test
out/org/dominokit/test/ChildInterface.class
out/org/dominokit/test/ParentInterface$ParentInterfaceHandler.class
out/org/dominokit/test/ParentInterface.class
out/org/dominokit/test/ChildInterface$ChildInterfaceHandler.class
|
|
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=577041 I am still not convinced there is an ECJ issue here. If you are able to show case a code snippet that compiles with javac and fails with ECJ that would help - outside of any scaffolds (such as maven) |
That's the second example I gave, please see the |
|
OK, the sources inside the github example project have import statements which are missing in the example in the top in this ticket. That is one source of confusion. I can observe the difference in behavior now, I'll investigate |
|
Glad you got it working - I'll try to avoid this confusion next time, by starting with a full example project. |
|
Minimal single file example that still illustrates the problem and compiles with javac and fails to compile with ECJ: |
Steps to reproduce:
Compile these two classes using the JDT compiler:
For example, using this maven pom.xml and running
mvn clean verify:Expected
Interfaces should compile to .class files with no errors
Actual
Workaround
Changing the
ChildInterfaceHandlerdefinition to beParentInterface.ParentInterfaceHandlerinstead of simplyParentInterfaceHandler(as inherited by being an inner type withinChildInterface extends ParentInterface<..>) seems to function as a workaround.The text was updated successfully, but these errors were encountered: