简体   繁体   中英

Ant build fails because of generics - and only on linux

I'm trying to build a project of mine on debian (in fact, hudson builds it), and the build fails:

[javac] (...)/src/vbp/gui/GUI.java:1569: type javax.swing.DefaultListModel does not take parameters
[javac]     private javax.swing.DefaultListModel<String> listModelInput;
[javac]                                         ^

Well, problem is, DefaultListModel should be able to handle generics.

If i'm running the build on my windows-machine with ant, it compiles perfectly fine, only on debian it doesn't work. Ant version is 1.8.0, JDK is OpenJDK 1.6.

My first thought was that Ant somehow used jdk 1.4 or something to compile the code (because the compile error is about generics), and in fact it was written in the build-script generated by netbeans to do so, but when i've changed that to 1.5 or 1.6 nothing changed (and it would be really strange if it would have helped, because the only error i get is with this DefaultListModel class).

I really have no idea what this is about. Maybe I found a bug and the fix just isn't in the debian software repository...

You can check out the project here: https://github.com/Klamann/Video-Batch-Processor

Hope you can help :)


edit:

OK, this really is a bug in OpenJDK 6. It was solved in OpenJDK 7.

public class DefaultListModel extends AbstractListModel  // JDK6 implementation

public class DefaultListModel<E> extends AbstractListModel<E>  // JDK7 implementation

They just forgot the <E>...

Well, at least I found my first bug in my favourite programming language :D

您是否在构建命令行中指定了-target级别?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM