I configured the Maven build for the very small GWT project that I have. Compiling / starting from Eclipse does not cause problems, but when I build Maven, I have problems compiling in one place (this is the code on the client side of GWT, but I'm not sure if it is). Maven output / compilation:
[..]SmartTable.java:[63,52] ')' expected
[..]SmartTable.java:[63,53] ')' expected
[..]SmartTable.java:[63,69] ';' expected
[..]SmartTable.java:[63,71] not a statement
[..]SmartTable.java:[63,77] ';' expected
[..]SmartTable.java:[63,79] not a statement
.. where this particular line is defined as follows:
final Comparator<T> comparator = ((SmartTable<T>.ComparableColumn) column).comparator;
As you may have guessed, I repeat all the columns defined for this generics class (which I call "SmartTable") and get a comparator (of course, if the column instance is SmartTable.ComparableColumn) for further operations. The Column and ComparableColumn classes are nested in SmartTable, and their headers look like this:
public abstract class Column {
private String caption;
private int width;
private Filter<T> filter;
...
public class ComparableColumn extends Column {
private Comparator<T> comparator;
...
Eclipse, WAR ( "" - , , Eclipse .class , Maven) / .
maven-compiler-plugin ( 1.5, 1.6 1.4 - , , ), , Eclipse (1.6). , .
, , :)
EDIT:
public class SmartTable<T> extends FlexTable {
private List<Column> columns = new ArrayList<Column>();
...
private Comparator<T> currentComparator;
...
public void init(Comparator<T> defaultComparator) {
this.currentComparator = defaultComparator;
...
int index = 0;
for (Column column : columns) {
...
if (column instanceof SmartTable.ComparableColumn) {
@SuppressWarnings("unchecked")
final Comparator<T> comparator = ((SmartTable<T>.ComparableColumn) column).comparator;
...
}
...
public abstract class Column {
private String caption;
private int width;
private Filter<T> filter;
private List<WidgetCreator<T>> widgetCreators;
public Column(String caption, int width, Filter<T> filter, List<WidgetCreator<T>> widgetCreators) {
...
public class SimpleColumn extends Column {
public SimpleColumn(String caption, int width, Filter<T> filter, List<WidgetCreator<T>> widgetCreators) {
super(caption, width, filter, widgetCreators);
}
...
public class ComparableColumn extends Column {
private Comparator<T> comparator;
public ComparableColumn(String caption, int width, Filter<T> filter,
List<WidgetCreator<T>> widgetCreators, Comparator<T> comparator) {
super(caption, width, filter, widgetCreators);
this.comparator = comparator;
}
...
}
EDIT2: :)
public class SmartTable2<T> {
public void init() {
Column c = new ComparableColumn();
final Comparator<T> comparator = ((SmartTable2<T>.ComparableColumn) c).comparator;
}
class Column {
}
class ComparableColumn extends Column {
Comparator<T> comparator;
}
}
EDIT3: , ,
.. javac, . , : Eclipse Java - JDT (, ); , JDT Compiler , Sun JDK javac ??? (oops, Oracle not Sun)