Bug 327881 - [compiler] Eclipse Compiler compiles code, but Sun's javac does not
Summary: [compiler] Eclipse Compiler compiles code, but Sun's javac does not
Status: VERIFIED DUPLICATE of bug 324945
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-15 08:31 EDT by Mihhail Verhovtsov CLA
Modified: 2011-09-14 12:42 EDT (History)
2 users (show)

See Also:


Attachments
Test case (Eclipse project and classes) (9.55 KB, application/octet-stream)
2010-10-15 08:34 EDT, Mihhail Verhovtsov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mihhail Verhovtsov CLA 2010-10-15 08:31:06 EDT
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
Comment 1 Mihhail Verhovtsov CLA 2010-10-15 08:34:51 EDT
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.
Comment 2 Olivier Thomann CLA 2010-10-15 10:30:11 EDT
This might be related to the fact that A comes as a binary type binding.
Comment 3 Srikanth Sankaran CLA 2011-01-10 05:05:48 EST
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 ***
Comment 4 Olivier Thomann CLA 2011-01-25 09:35:09 EST
Verified for 3.7M5 using I20110124-1800