I’m implementing a quadruple-linked list in Java as a matrix of Node objects, which I’ve implemented as an inner class:
public class Test {
private Node[][] Matrix;
class Node {
int data;
Node up;
Node down;
Node left;
Node right;
}
public Test() {
Matrix = new Node[10][10];
for (int col = 0; col < 10; col++) {
for (int row = 0; row < 10; row++) {
Matrix[row][col] = new Node();
}
}
}
public static void main(String[] args) {
Test test = new Test();
}
}
First of all, is this the right/best way to do it? Second, although it runs fine, when I debug line-by-line I get the error Test(Object).<init>() line: 37 [local variables unavailable] and also a Source not found window just before I would advance to the line Matrix = new Node[10][10];. It then gets stuck at that line and gives me a ClassNotFound exception:
owns: Object (id=28)
owns: Object (id=29)
ClassNotFoundException(Throwable).<init>(String, Throwable) line: 286
ClassNotFoundException(Exception).<init>(String, Throwable) line: not available
ClassNotFoundException(ReflectiveOperationException).<init>(String, Throwable) line: not available
ClassNotFoundException.<init>(String) line: not available
URLClassLoader$1.run() line: not available
URLClassLoader$1.run() line: not available
AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]
Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: not available
Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available
Launcher$AppClassLoader.loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available
Why is this happening?
Thanks!
On further thought, I don’t think this is actually a bug. It’s using the default constructor for Object, the source code for which Eclipse might very well not have access to (since it’s part of the Java library or whatever). Not sure, but that’s the best answer I have.
The best solution is just to step over, rather than stepping into, the construction of Node.