This is a really strange problem, I have never encountered anything like this. Below is a helper class that I declared in a larger class. It works fine as it is:
private static class Tree<String> {
private Node<String> root;
public Tree(String rootData) {
root = new Node<String>();
root.data = rootData;
root.children = new ArrayList<Node<String>>();
}
private static class Node<String> {
String data;
Node<String> parent;
ArrayList<Node<String>> children;
}
}
However, messing around, I found a confusing problem. Replacing this line:
root.data = rootData;
with:
root.data = "some string literal";
I get this error:
Type mismatch: cannot convert from java.lang.String to String
I tested some string literals in other classes and it seemed to work fine. I recently upgraded to Java 1.7.0_15 and recently downloaded and installed Eclipse 4.2. I suspect there might be some kind of confusion about the build path or something like that. Using Ubuntu 12.04
Any help would be greatly appreciated! I searched and searched and could not find anything close to this problem.