I'm getting a ClassNotFoundException
using Class.forName()
passing the fully qualified name of a public static class that lives inside the same package. This is when running my tests.
Here's the full stacktrace.
In EntitySerializerTests.java
inside my tests
folder.
package com.badlogic.ashley.serialization;
public class EntitySerializerTests {
public static class TestComponentA implements Component {
public int value;
}
...
}
In my library code
package com.badlogic.ashley.serialization;
public class EntitySerializer implements Json.Serializer<Entity> {
...
private Component read(Json json, JsonValue componentValue) throws ClassNotFoundException {
String className = componentValue.name();
Class componentType = Class.forName(className); // THROWS
...
}
}
The exception message is:
java.lang.ClassNotFoundException: com.badlogic.ashley.serialization.EntitySerializerTests.TestComponentA
Library code is trying to get the Class
given the name for a class that's defined in a test file. Is that allowed? I would assume that, at runtime, all these classes are available in the class path.
Thanks.
Aucun commentaire:
Enregistrer un commentaire