Compile error: Eclipse confuses Type with Window.Type [message #1690953] |
Wed, 01 April 2015 05:13  |
Eclipse User |
|
|
|
Hi there,
I'm using Eclipse Luna (Version: Luna Service Release 1a (4.4.1)) and JDK 1.8.0_31.
Our projects are build with Maven. Maven build works without any problems and also our Netbeans users do not have any issues.
But Eclipse shows compile errors and it seems, that it confuses the generic Java Type with java.awt.Window.Type which was introduced with Java 1.7.
I created the following minimized example, which reproduces the compile problem.
This class creates a instance of MyDialog which uses the generic Java Type:
public class TypeTest {
public static void main(String[] args) {
String str = new String();
MyDialog<String> dialog = new MyDialog<String>();
String x = dialog.getValue(str);
}
}
And this is the implementation of the dialog of type Type:
import javax.swing.JDialog;
public class MyDialog<Type> extends JDialog {
public MyDialog() {
super();
}
public Type getValue(Type value) {
return value;
}
}
Eclipse persists that for getValue in MyDialog the Type is a Window.Type, which is wrong!
This is the compile error message:
The method getValue(Window.Type) in the type MyDialog<String> is not applicable for the arguments (String)
Since it works without any issues for the maven build and the netbeans users, it seems to me that this is an Eclipse issue or bug? Or can someone give me a hint, how this can be solved?
Thanks and kind regards,
Daniel
|
|
|
|
Powered by
FUDForum. Page generated in 0.02576 seconds