Bug 69554 - Eclipse Java compiler is not completely compliant to Javac
Summary: Eclipse Java compiler is not completely compliant to Javac
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-07 20:30 EDT by Yevgeny CLA
Modified: 2004-09-06 10:29 EDT (History)
0 users

See Also:


Attachments
Eclipse configuration (71.03 KB, text/plain)
2004-07-08 10:25 EDT, Yevgeny CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yevgeny CLA 2004-07-07 20:30:31 EDT
Eclipse Java compiler gives an error where Javac does not.
Example:

public class Test extends SuperTest
{
    public Test()
    {
        super();
    }
  
    static void print(Object obj)
    {
        System.out.println("Object:" + obj.toString());
    }
    
    public static void main(String[] args)
    {
        print("Hello world");
    }
}
class SuperTest
{
    SuperTest(){};
    static void print(String s)
    {
        System.out.println("String: " + s);
    }
}

Eclipse compiler gives an error:
The method print(Object) is ambigious for the type Test.

Javac does not give any error and in the runtime the right method print(String) 
is invoked.
I used j2sdk 1.4.2
Comment 1 Philipe Mulet CLA 2004-07-08 07:10:52 EDT
Cannot reproduce in R3.0. Which build are you using ?
Comment 2 Philipe Mulet CLA 2004-07-08 07:19:11 EDT
Would you have toggled Eclipse in 1.3 compliant mode ?
Comment 3 Philipe Mulet CLA 2004-07-08 07:46:57 EDT
Looks like javac 1.3.1 is not complaining either in this scenario.
Comment 4 Yevgeny CLA 2004-07-08 10:25:46 EDT
Created attachment 13056 [details]
Eclipse configuration

The attached file contains the Eclipse configuration that I use. Javac does not
complain about anything but Eclipse compiler does.
Comment 5 Philipe Mulet CLA 2004-07-08 10:51:12 EDT
You are indeed compiling in 1.3 mode. In previous version of JDK1.3, our 
behavior was the right one. Looks like this has changed in later 1.3 releases 
(without any JCK test revealing this).

Note: if trying to match a 1.4 behavior, make sure to switch the Eclipse 
compiler to 1.4 compliant mode.
Comment 6 Philipe Mulet CLA 2004-07-08 17:57:08 EDT
Our 1.3 diagnosis should not consider ambiguities amongst static methods.
Fixed. Added regression test: LookupTest#test047
Comment 7 David Audel CLA 2004-09-06 10:29:15 EDT
Verified for 3.0.1 RC1