Skip to content

Commit 1c5c7ce

Browse files
author
Nicholas Smith
committed
#28 #34 Fix for exception being thrown and deprecated method usage
1 parent 9b555cf commit 1c5c7ce

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/java/org/javaparser/examples/chapter5/ResolveTypeInContext.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,19 @@ public class ResolveTypeInContext {
2020
public static void main(String[] args) throws Exception {
2121
TypeSolver reflectionTypeSolver = new ReflectionTypeSolver();
2222
TypeSolver javaParserTypeSolver = new JavaParserTypeSolver(new File(SRC_PATH));
23-
reflectionTypeSolver.setParent(reflectionTypeSolver);
2423

2524
CombinedTypeSolver combinedSolver = new CombinedTypeSolver();
2625
combinedSolver.add(reflectionTypeSolver);
2726
combinedSolver.add(javaParserTypeSolver);
2827

2928
JavaSymbolSolver symbolSolver = new JavaSymbolSolver(combinedSolver);
3029
StaticJavaParser
31-
.getConfiguration()
30+
.getParserConfiguration()
3231
.setSymbolResolver(symbolSolver);
3332

3433
CompilationUnit cu = StaticJavaParser.parse(new File(FILE_PATH));
3534

36-
FieldDeclaration fieldDeclaration = Navigator.findNodeOfGivenClass(cu, FieldDeclaration.class);
35+
FieldDeclaration fieldDeclaration = Navigator.demandNodeOfGivenClass(cu, FieldDeclaration.class);
3736

3837
System.out.println("Field type: " + fieldDeclaration.getVariables().get(0).getType()
3938
.resolve().asReferenceType().getQualifiedName());

0 commit comments

Comments
 (0)