Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Difference between eclipse and javac
icon5.gif  Difference between eclipse and javac [message #531716] Wed, 05 May 2010 17:37 Go to next message
Eclipse UserFriend
The following code (in a file called Bad.java) compiles and runs in eclipse (in particular galileo with Build id: 20100218-1602):
public class Bad<T>  { 

    public abstract static class Base<S extends Base<S>> {
        public Base(Class<S> sClass) {
            Class<S> theClass = sClass;
            System.out.println(theClass);
            System.out.println(sClass);
        }
    }

    public class Arr extends Base<Arr> {
        public Arr() { 
            super(Arr.class);
            System.out.println(Arr.class);
        }
    }

    public static void main(String[] args) {
        Bad<Integer> bad = new Bad<Integer>();
        Bad<Integer>.Arr a = bad.new Arr();
        System.out.println(a);
    }
}


However, javac (I've tried 1.5, 1.6 and 1.7) gives this error:
Bad.java:13: cannot find symbol
symbol  : constructor Base(java.lang.Class<Bad.Arr>)
location: class Bad.Base<Bad<T>.Arr>
            super(Arr.class);
            ^
1 error


If I change the argument of the Base ctor to "Class sClass" (removing the <S>) javac is happy, though of course there are warnings in both eclipse and javac.

This is on various flavors of Linux if that matters.

Which compiler is correct? I'm wondering if I should I file a bug with eclipse or Sun.
Re: Difference between eclipse and javac [message #532215 is a reply to message #531716] Fri, 07 May 2010 10:48 Go to previous messageGo to next message
Eclipse UserFriend
I opened bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=312076 for investigation.

Olivier
icon7.gif  Re: Difference between eclipse and javac [message #532314 is a reply to message #532215] Fri, 07 May 2010 20:00 Go to previous message
Eclipse UserFriend
Thanks! I'll be watching that bug.
Previous Topic:Eclipse freezes often
Next Topic:Platform fails installing JDT
Goto Forum:
  


Current Time: Wed Mar 26 01:52:03 EDT 2025

Powered by FUDForum. Page generated in 0.03107 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top