| Summary: | [compiler] Eclipse Compiler compiles code, but Sun's javac does not | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Mihhail Verhovtsov <mihey77> | ||||
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> | ||||
| Status: | VERIFIED DUPLICATE | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | Olivier_Thomann, pwebster | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7 M4 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 180950 [details]
Test case (Eclipse project and classes)
TestBug folder is Eclipse project.
The other folder I used to create the JAR file.
This might be related to the fact that A comes as a binary type binding. This is the same bug as the one reported in https://bugs.eclipse.org/bugs/show_bug.cgi?id=324945. (In reply to comment #0) [...] > Eclipse compiles it without problems. Method someMethod() is usable. > > Sun's javac doesn't compile that code. Yes, it does. For a proper comparison, you need to delete A.java and A.class and ensure that A is presented to the compiler only in the incarnation available in the jar file when it compiles B. *** This bug has been marked as a duplicate of bug 324945 *** Verified for 3.7M5 using I20110124-1800 |
Build Identifier: 20100617-1415 Using Java 1.6. Suppose class A implements interface SomeInterface: A.java: package org.example; public class A implements SomeInterface { public String someMethod() { return "test someMethod"; } } SomeInterface.java: package org.example; public interface SomeInterface { public String someMethod(); } Compile it with javac and make a jar of it: javac org/example/A.java jar -cf testjar.jar org/example/*.class Now create a new Java project in Eclipse, create "lib" folder in it, copy testjar.jar into it. Go to Project options -> Java Build Path -> Libraries -> Add JARs and add testjar.jar. Now we create the same interface in our project, but with more methods: SomeInterface.java: package org.example; public interface SomeInterface { public String someMethod(); public String someOtherMethod(); } Now create empty class B, which extends A: SomeInterface.java: package org.example; public class B extends A { } Eclipse compiles it without problems. Method someMethod() is usable. Sun's javac doesn't compile that code. Reproducible: Always Steps to Reproduce: See above