I know that in the past there were several questions regarding things that compiled in eclipse, but not on the command line, but I still could not find the answer to my problem.
In particular, I think I was able to install eclipse to use my system compiler, but this still did not solve the problem.
I am currently checking: "Preferences -> Java -> Installed JREs".
This contains only one JRE, which is my system.
Here are the specifics of the problem
I have a generic java class that takes an Enum type as an argument, for example:
public class MyClass<T extends Enum<T>>
Somewhere inside the class, I am comparing the known enum value with the values โโof T. So, for example, let's say I have this enumeration:
public enum OtherEnum{ a, b }
And then I test:
protected void foo(T enumVal){ if(enumVal == OtherEnum.a){ // do something } else if(enumVal == OtherEnum.b){ // do something else } }
This compiles without problems in eclipse, but on javac command line I get this error:
incomparable types: T and OtherEnum
I tried this on two systems that use the java 1.6 option (1.6.0_26 and 1.6.0_16). One is the Mac, the other is Linux. They both give the same error, while eclipse compiles without problems.
So:
Thanks!