$collectionImplementation cannot be resolved to a type

22 views
Skip to first unread message

Asim

unread,
Jul 17, 2012, 12:02:44 PM7/17/12
to pir...@googlegroups.com
I have this class:

public class BaseNode{
private String name;
List<BaseNode> children;

public BaseNode() {
super();
}

public BaseNode(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}

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?







Asim

unread,
Jul 17, 2012, 12:57:28 PM7/17/12
to pir...@googlegroups.com
Ok it works in 1 project because it uses velocity 1.7 but the project in which it doesn't work uses velocity 1.5 even though 1.7 is specified in the maven pom

Harald Pehl

unread,
Jul 18, 2012, 5:00:08 AM7/18/12
to pir...@googlegroups.com
Velocity 1.7 is necessary for the code generation / deferred binding. Any chance that you can upgrade your project to Velocity 1.7?

- Harald

Asim Malik

unread,
Jul 19, 2012, 9:32:00 AM7/19/12
to pir...@googlegroups.com
I noticed the issue was only in eclipse so I configured the class path to pick up1.7 first.
Reply all
Reply to author
Forward
0 new messages