File tree 1 file changed +2
-3
lines changed
src/main/java/org/javaparser/examples/chapter5
1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -20,20 +20,19 @@ public class ResolveTypeInContext {
20
20
public static void main (String [] args ) throws Exception {
21
21
TypeSolver reflectionTypeSolver = new ReflectionTypeSolver ();
22
22
TypeSolver javaParserTypeSolver = new JavaParserTypeSolver (new File (SRC_PATH ));
23
- reflectionTypeSolver .setParent (reflectionTypeSolver );
24
23
25
24
CombinedTypeSolver combinedSolver = new CombinedTypeSolver ();
26
25
combinedSolver .add (reflectionTypeSolver );
27
26
combinedSolver .add (javaParserTypeSolver );
28
27
29
28
JavaSymbolSolver symbolSolver = new JavaSymbolSolver (combinedSolver );
30
29
StaticJavaParser
31
- .getConfiguration ()
30
+ .getParserConfiguration ()
32
31
.setSymbolResolver (symbolSolver );
33
32
34
33
CompilationUnit cu = StaticJavaParser .parse (new File (FILE_PATH ));
35
34
36
- FieldDeclaration fieldDeclaration = Navigator .findNodeOfGivenClass (cu , FieldDeclaration .class );
35
+ FieldDeclaration fieldDeclaration = Navigator .demandNodeOfGivenClass (cu , FieldDeclaration .class );
37
36
38
37
System .out .println ("Field type: " + fieldDeclaration .getVariables ().get (0 ).getType ()
39
38
.resolve ().asReferenceType ().getQualifiedName ());
You can’t perform that action at this time.
0 commit comments