Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Compile error: Eclipse confuses Type with Window.Type
Compile error: Eclipse confuses Type with Window.Type [message #1690953] Wed, 01 April 2015 05:13 Go to next message
Eclipse UserFriend
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


Re: Compile error: Eclipse confuses Type with Window.Type [message #1699815 is a reply to message #1690953] Fri, 26 June 2015 16:00 Go to previous message
Eclipse UserFriend
I just found that this question has never been answered, and from a cursory look I wasn't actually sure if this is a bug or not.

Turns out I already wrote a little "essay" on what seems to be the same issue, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=396378#c6

Bottom line: JLS doesn't seem to specify how to interpret / handle a conflict between an inherited member type and a same-named type parameter.

This seems to impliy that both implementations, javac and ecj - although different - are both valid wrt JLS.
Previous Topic:find references slow
Next Topic:Google plugin for Eclipse (Mars), 2 problems
Goto Forum:
  


Current Time: Sun Apr 20 04:00:49 EDT 2025

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

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

Back to the top