I have this class:
public class BaseNode{
private String name;
List<BaseNode> children;
public BaseNode() {
super();
}
public BaseNode(String name) {
}
public void setName(String name) {
}
public String getName() {
}
public List<BaseNode> getChildren() {
return children;
}
public void setChildren(List<BaseNode> children) {
this.children = children;
}
public void addChildren(BaseNode node) {
if (children == null)
children = new ArrayList<BaseNode>();
children.add(node);
}
public boolean hasChildren() {
if (children !=null && !children.isEmpty())
return true;
return false;
}
}
And its reader writer is :
public class BaseNodeReaderWriter implements JsonReaderWriter<BaseNode> {
public interface BaseNodeJsonReader extends JsonReader<BaseNode> {}
public static final BaseNodeJsonReader JSON_READER = GWT.create(BaseNodeJsonReader.class);
public interface BaseNodeJsonWriter extends JsonWriter<BaseNode> {}
public static final BaseNodeJsonWriter JSON_WRITER = GWT.create(BaseNodeJsonWriter.class);
@Override
public JsonReader<BaseNode> getJsonReader() {
return JSON_READER;
}
@Override
public JsonWriter<BaseNode> getJsonWriter() {
return JSON_WRITER;
}
}
All is well it works for json such as:
{
"root":[
{
"name":"Tools",
"children":[
{
"name":"Stock Watcher"
},
{
"name":"Some Example"
}
]
},
{
"name":"Settings",
"children":[
{
"name":"Admin"
}
]
}
]
}
I am using piriti 0.8 and it works perfectly in one project. But i have it in another project along with some other json reader/writer and i keep getting this error when running in gwt hosted mode from eclipse:
[DEBUG] [Shell] - Validating newly compiled units
[DEBUG] [Shell] - Rebinding com.xxx.shared.data.model.BaseNodeReaderWriter.BaseNodeJsonReader
[ERROR] [Shell] - Errors in 'generated://916C55B688DF04289C7B16597D6195D5/com/xxx/shared/data/BaseNodeReaderWriter_BaseNodeJsonReaderImpl.java'
[ERROR] [Shell] - Line 94: $collectionImplementation cannot be resolved to a type
[INFO] [Shell] - See snapshot: C:\Users\xxx\AppData\Local\Temp\com.xxx.shared.data.BaseNodeReaderWriter_BaseNodeJsonReaderImpl3632771093224442866.java
And the exception is:
Caused by: java.lang.Error: Unresolved compilation problem:
$collectionImplementation cannot be resolved to a type
at com.xxx.shared.data.BaseNodeReaderWriter_BaseNodeJsonReaderImpl.readProperties(BaseNodeReaderWriter_BaseNodeJsonReaderImpl.java:94)
I am confused as to why it is rebinding since there is a perfectly valid BaseNodeReaderWriter_BaseNodeJsonReaderImpl.java generated in the targets directory. Any thoughts?