开发者

Ant build fails because of generics - and only on linux

开发者 https://www.devze.com 2023-04-11 14:51 出处:网络
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

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-Pr开发者_StackOverflowocessor

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


Did you specify a -target level in the build command line?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号