use of com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver in project javaparser by javaparser.
the class JavaParserClassDeclarationTest method setup.
@Before
public void setup() {
File src = adaptPath(new File("src/test/test_sourcecode/javaparser_src/proper_source"));
CombinedTypeSolver combinedTypeSolver = new CombinedTypeSolver();
combinedTypeSolver.add(new ReflectionTypeSolver());
combinedTypeSolver.add(new JavaParserTypeSolver(src));
combinedTypeSolver.add(new JavaParserTypeSolver(adaptPath(new File("src/test/test_sourcecode/javaparser_src/generated"))));
typeSolver = combinedTypeSolver;
File srcNewCode = adaptPath(new File("src/test/test_sourcecode/javaparser_new_src/javaparser-core"));
CombinedTypeSolver combinedTypeSolverNewCode = new CombinedTypeSolver();
combinedTypeSolverNewCode.add(new ReflectionTypeSolver());
combinedTypeSolverNewCode.add(new JavaParserTypeSolver(srcNewCode));
combinedTypeSolverNewCode.add(new JavaParserTypeSolver(adaptPath(new File("src/test/test_sourcecode/javaparser_new_src/javaparser-generated-sources"))));
typeSolverNewCode = combinedTypeSolverNewCode;
TypeSolver ts = new ReflectionTypeSolver();
string = new ReferenceTypeImpl(ts.solveType(String.class.getCanonicalName()), ts);
ResolvedReferenceType booleanC = new ReferenceTypeImpl(ts.solveType(Boolean.class.getCanonicalName()), ts);
listOfBoolean = new ReferenceTypeImpl(ts.solveType(List.class.getCanonicalName()), ImmutableList.of(booleanC), ts);
}
use of com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver in project javaparser by javaparser.
the class JavaParserEnumDeclarationTest method setup.
@Before
public void setup() {
File srcNewCode = adaptPath(new File("src/test/test_sourcecode/javaparser_new_src/javaparser-core"));
CombinedTypeSolver combinedtypeSolver = new CombinedTypeSolver();
combinedtypeSolver.add(new ReflectionTypeSolver());
combinedtypeSolver.add(new JavaParserTypeSolver(srcNewCode));
combinedtypeSolver.add(new JavaParserTypeSolver(adaptPath(new File("src/test/test_sourcecode/javaparser_new_src/javaparser-generated-sources"))));
typeSolver = combinedtypeSolver;
}
use of com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver in project javaparser by javaparser.
the class JavaParserInterfaceDeclarationTest method setup.
@Before
public void setup() {
File srcNewCode = adaptPath(new File("src/test/test_sourcecode/javaparser_new_src/javaparser-core"));
CombinedTypeSolver combinedtypeSolver = new CombinedTypeSolver();
combinedtypeSolver.add(new ReflectionTypeSolver());
combinedtypeSolver.add(new JavaParserTypeSolver(srcNewCode));
combinedtypeSolver.add(new JavaParserTypeSolver(adaptPath(new File("src/test/test_sourcecode/javaparser_new_src/javaparser-generated-sources"))));
typeSolver = combinedtypeSolver;
}
use of com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver in project javaparser by javaparser.
the class FieldsResolutionTest method accessClassFieldThroughThisWithCompetingSymbolInParentContext.
@Test
public void accessClassFieldThroughThisWithCompetingSymbolInParentContext() {
CompilationUnit cu = parseSample("AccessClassMemberThroughThis");
com.github.javaparser.ast.body.ClassOrInterfaceDeclaration clazz = Navigator.demandClass(cu, "AccessClassMemberThroughThis");
MethodDeclaration method = Navigator.demandMethod(clazz, "setLabel");
ExpressionStmt expressionStmt = (ExpressionStmt) method.getBody().get().getStatements().get(0);
AssignExpr assignExpr = (AssignExpr) expressionStmt.getExpression();
FieldAccessExpr fieldAccessExpr = (FieldAccessExpr) assignExpr.getTarget();
File src = adaptPath(new File("src/test/resources"));
CombinedTypeSolver typeSolver = new CombinedTypeSolver(new JavaParserTypeSolver(src), new ReflectionTypeSolver());
SymbolSolver symbolSolver = new SymbolSolver(typeSolver);
SymbolReference<? extends ResolvedValueDeclaration> ref = symbolSolver.solveSymbol(fieldAccessExpr.getName().getId(), fieldAccessExpr);
assertTrue(ref.isSolved());
assertTrue(ref.getCorrespondingDeclaration().isField());
}
use of com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver in project javaparser by javaparser.
the class MethodsResolutionLogicTest method setup.
@Before
public void setup() {
File srcNewCode = adaptPath(new File("src/test/test_sourcecode/javaparser_new_src/javaparser-core"));
CombinedTypeSolver combinedTypeSolverNewCode = new CombinedTypeSolver();
combinedTypeSolverNewCode.add(new ReflectionTypeSolver());
combinedTypeSolverNewCode.add(new JavaParserTypeSolver(srcNewCode));
combinedTypeSolverNewCode.add(new JavaParserTypeSolver(adaptPath(new File("src/test/test_sourcecode/javaparser_new_src/javaparser-generated-sources"))));
typeSolver = combinedTypeSolverNewCode;
}
Aggregations