javaparser-visited icon indicating copy to clipboard operation
javaparser-visited copied to clipboard

IllegalStateException when running the ResolveTypeInContext example from the book

Open abego opened this issue 3 years ago • 1 comments
trafficstars

When trying to run the ResolveTypeInContext example from the book I get an Exception:

java.lang.IllegalStateException: The parent of this TypeSolver cannot be itself.
    at com.github.javaparser.symbolsolver.resolution.typesolvers.ClassLoaderTypeSolver.setParent(ClassLoaderTypeSolver.java:60)

It occurs for this statement:

reflectionTypeSolver.setParent(reflectionTypeSolver);

(line 23 in https://github.com/javaparser/javaparser-visited/blob/master/src/main/java/org/javaparser/examples/chapter5/ResolveTypeInContext.java)

Removing the statement make the exception go away.

abego avatar Jul 16 '22 20:07 abego

May be a duplicate of https://github.com/javaparser/javaparser-visited/issues/28

abego avatar Jul 17 '22 21:07 abego

Thanks for the report.

Code samples and book should now reflect this.

SmiddyPence avatar Jul 21 '23 15:07 SmiddyPence