Swing generification changes in JDK 9 b24
Martijn Verburg
martijnverburg at gmail.com
Mon Jul 28 12:04:24 UTC 2014
Hi Joe,
Built PCGen (a ~750,000 LOC Swing project) with plenty of 'interesting'
extensions to Swing classes and generics etc. There are definitely some
breakages, some Swing related, others collections lib related:
To repeat you can clone/fork the following project:
https://github.com/karianna/pcgen. It builds with Gradle so you'll have to
manually edit:
build.gradle and change the source and target compatibility to 1.9
Then execute gradle with the jdk1.9_b24 and you should get the following
(Long stack trace follows):
=======================
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/pcgen/gui2/util/treeview/TreeViewTableModel.java:357:
error: no suitable method found for
binarySearch(java.util.Vector<javax.swing.tree.TreeNode>,pcgen.gui2.util.treeview.TreeViewTableModel<E>.TreeViewNode,java.util.Comparator<pcgen.gui2.util.treetable.TreeTableNode>)
int index = Collections.binarySearch(children, child,
mostRecentComparator);
^
method java.util.Collections.<T>binarySearch(java.util.List<? extends
java.lang.Comparable<? super T>>,T) is not applicable
(cannot infer type-variable(s) T
(actual and formal argument lists differ in length))
method java.util.Collections.<T>binarySearch(java.util.List<? extends
T>,T,java.util.Comparator<? super T>) is not applicable
(inferred type does not conform to upper bound(s)
inferred: javax.swing.tree.TreeNode
upper bound(s):
pcgen.gui2.util.treetable.TreeTableNode,java.lang.Object)
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/pcgen/gui2/util/treeview/TreeViewTableModel.java:454:
error: no suitable method found for
binarySearch(java.util.Vector<javax.swing.tree.TreeNode>,pcgen.gui2.util.treeview.TreeViewTableModel<E>.TreeViewNode,java.util.Comparator<pcgen.gui2.util.treetable.TreeTableNode>)
int index = Collections.binarySearch(children, newchild,
mostRecentComparator);
^
method java.util.Collections.<T>binarySearch(java.util.List<? extends
java.lang.Comparable<? super T>>,T) is not applicable
(cannot infer type-variable(s) T
(actual and formal argument lists differ in length))
method java.util.Collections.<T>binarySearch(java.util.List<? extends
T>,T,java.util.Comparator<? super T>) is not applicable
(inferred type does not conform to upper bound(s)
inferred: javax.swing.tree.TreeNode
upper bound(s):
pcgen.gui2.util.treetable.TreeTableNode,java.lang.Object)
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/pcgen/gui2/util/treeview/TreeViewTableModel.java:509:
error: no suitable method found for
sort(java.util.Vector<javax.swing.tree.TreeNode>,java.util.Comparator<pcgen.gui2.util.treetable.TreeTableNode>)
Collections.sort(children, comparator);
^
method java.util.Collections.<T>sort(java.util.List<T>) is not
applicable
(cannot infer type-variable(s) T
(actual and formal argument lists differ in length))
method
java.util.Collections.<T>sort(java.util.List<T>,java.util.Comparator<?
super T>) is not applicable
(inference variable T has incompatible bounds
equality constraints: javax.swing.tree.TreeNode
upper bounds:
pcgen.gui2.util.treetable.TreeTableNode,java.lang.Object)
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/pcgen/gui2/tabs/ability/AbilityTreeTableModel.java:189:
error: no suitable method found for
sort(java.util.Vector<javax.swing.tree.TreeNode>,java.util.Comparator<pcgen.gui2.util.treetable.TreeTableNode>)
Collections.sort(children, comparator);
^
method java.util.Collections.<T>sort(java.util.List<T>) is not
applicable
(cannot infer type-variable(s) T
(actual and formal argument lists differ in length))
method
java.util.Collections.<T>sort(java.util.List<T>,java.util.Comparator<?
super T>) is not applicable
(inference variable T has incompatible bounds
equality constraints: javax.swing.tree.TreeNode
upper bounds:
pcgen.gui2.util.treetable.TreeTableNode,java.lang.Object)
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/pcgen/gui2/util/treetable/DefaultSortableTreeTableNode.java:66:
error: no suitable method found for
sort(java.util.Vector<javax.swing.tree.TreeNode>,java.util.Comparator<pcgen.gui2.util.treetable.TreeTableNode>)
Collections.sort(children, comparator);
^
method java.util.Collections.<T>sort(java.util.List<T>) is not
applicable
(cannot infer type-variable(s) T
(actual and formal argument lists differ in length))
method
java.util.Collections.<T>sort(java.util.List<T>,java.util.Comparator<?
super T>) is not applicable
(inference variable T has incompatible bounds
equality constraints: javax.swing.tree.TreeNode
upper bounds:
pcgen.gui2.util.treetable.TreeTableNode,java.lang.Object)
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/pcgen/gui2/util/table/DefaultSortableTableModel.java:80:
error: no suitable constructor found for
DefaultTableModel(java.util.Vector<capture#1 of ?>,int)
super(columnNames, rowCount);
^
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(int,int) is not
applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to int)
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(java.util.Vector<java.lang.Object>,int)
is not applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to java.util.Vector<java.lang.Object>)
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(java.lang.Object[],int)
is not applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to java.lang.Object[])
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(java.util.Vector<java.util.Vector<java.lang.Object>>,java.util.Vector<java.lang.Object>)
is not applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to java.util.Vector<java.util.Vector<java.lang.Object>>)
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(java.lang.Object[][],java.lang.Object[])
is not applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to java.lang.Object[][])
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/pcgen/gui2/util/table/DefaultSortableTableModel.java:117:
error: no suitable constructor found for
DefaultTableModel(java.util.Vector<capture#1 of
?>,java.util.Vector<capture#2 of ?>)
super(data, columnNames);
^
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(int,int) is not
applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to int)
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(java.util.Vector<java.lang.Object>,int)
is not applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to java.util.Vector<java.lang.Object>)
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(java.lang.Object[],int)
is not applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to java.lang.Object[])
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(java.util.Vector<java.util.Vector<java.lang.Object>>,java.util.Vector<java.lang.Object>)
is not applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to java.util.Vector<java.util.Vector<java.lang.Object>>)
constructor
javax.swing.table.DefaultTableModel.DefaultTableModel(java.lang.Object[][],java.lang.Object[])
is not applicable
(argument mismatch; java.util.Vector<capture#1 of ?> cannot be
converted to java.lang.Object[][])
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/pcgen/gui2/util/table/DefaultSortableTableModel.java:152:
error: no suitable method found for
setColumnIdentifiers(java.util.Vector<java.lang.String>)
setColumnIdentifiers(titles);
^
method
javax.swing.table.DefaultTableModel.setColumnIdentifiers(java.util.Vector<java.lang.Object>)
is not applicable
(argument mismatch; java.util.Vector<java.lang.String> cannot be
converted to java.util.Vector<java.lang.Object>)
method
javax.swing.table.DefaultTableModel.setColumnIdentifiers(java.lang.Object[])
is not applicable
(argument mismatch; java.util.Vector<java.lang.String> cannot be
converted to java.lang.Object[])
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/plugin/notes/gui/NotesTreeNode.java:54:
error: plugin.notes.gui.NotesTreeNode is not abstract and does not override
abstract method children() in javax.swing.tree.TreeNode
public class NotesTreeNode implements MutableTreeNode, DocumentListener
^
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/plugin/notes/gui/NotesTreeNode.java:766:
error: children() in plugin.notes.gui.NotesTreeNode cannot implement
children() in javax.swing.tree.TreeNode
public Enumeration<MutableTreeNode> children()
^
return type java.util.Enumeration<javax.swing.tree.MutableTreeNode> is
not compatible with java.util.Enumeration<javax.swing.tree.TreeNode>
/Users/karianna/Documents/workspace/PCGen/pcgen/pcgen/code/src/java/plugin/notes/gui/NotesTreeNode.java:765:
error: method does not override or implement a method from a supertype
@Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to
get full output
Cheers,
Martijn
On 26 July 2014 21:53, Joe Darcy <joe.darcy at oracle.com> wrote:
> Hello,
>
> Swing developers, JDK 9 build 24 features many changes to generify the
> swing API. Please try recompiling your swing apps to help verify there are
> no unexpected source incompatibilities.
>
> Thanks,
>
> -Joe
>
More information about the jdk9-dev
mailing list