use of com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver in project javaparser by javaparser.
the class JavassistClassDeclarationTest method setup.
@Before
public void setup() throws IOException {
String pathToJar = adaptPath("src/test/resources/javaparser-core-2.1.0.jar");
typeSolver = new CombinedTypeSolver(new JarTypeSolver(pathToJar), new ReflectionTypeSolver());
String newPathToJar = adaptPath("src/test/resources/javaparser-core-3.0.0-alpha.2.jar");
newTypeSolver = new CombinedTypeSolver(new JarTypeSolver(newPathToJar), new ReflectionTypeSolver());
String anotherPathToJar = adaptPath("src/test/resources/test-artifact-1.0.0.jar");
anotherTypeSolver = new CombinedTypeSolver(new JarTypeSolver(anotherPathToJar), new ReflectionTypeSolver());
}
use of com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver in project javaparser by javaparser.
the class JavassistInterfaceDeclarationTest method setup.
@Before
public void setup() throws IOException {
String pathToJar = adaptPath("src/test/resources/javaparser-core-3.0.0-alpha.2.jar");
typeSolver = new CombinedTypeSolver(new JarTypeSolver(pathToJar), new ReflectionTypeSolver());
String anotherPathToJar = adaptPath("src/test/resources/test-artifact-1.0.0.jar");
anotherTypeSolver = new CombinedTypeSolver(new JarTypeSolver(anotherPathToJar), new ReflectionTypeSolver());
}
use of com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver in project javaparser by javaparser.
the class Issue257 method setup.
@Before
public void setup() throws IOException {
String pathToJar = adaptPath("src/test/resources/issue257/issue257.jar");
File jar = new File(pathToJar);
typeSolver = new CombinedTypeSolver(new JarTypeSolver(jar.getAbsolutePath()), new ReflectionTypeSolver());
}
use of com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver in project javaparser by javaparser.
the class AnalyseJavaSymbolSolver060Test method getSourceFileInfoExtractor.
private static SourceFileInfoExtractor getSourceFileInfoExtractor() {
CombinedTypeSolver combinedTypeSolver = new CombinedTypeSolver();
combinedTypeSolver.add(new ReflectionTypeSolver());
combinedTypeSolver.add(new JavaParserTypeSolver(new File(src + "/java-symbol-solver-core")));
combinedTypeSolver.add(new JavaParserTypeSolver(new File(src + "/java-symbol-solver-logic")));
combinedTypeSolver.add(new JavaParserTypeSolver(new File(src + "/java-symbol-solver-model")));
try {
combinedTypeSolver.add(new JarTypeSolver(lib + "/guava-21.0.jar"));
combinedTypeSolver.add(new JarTypeSolver(lib + "/javaparser-core-3.3.0.jar"));
combinedTypeSolver.add(new JarTypeSolver(lib + "/javaslang-2.0.3.jar"));
combinedTypeSolver.add(new JarTypeSolver(lib + "/javassist-3.19.0-GA.jar"));
} catch (IOException e) {
Assert.fail("one or more jar dependencies could not be found.");
e.printStackTrace();
}
SourceFileInfoExtractor sourceFileInfoExtractor = new SourceFileInfoExtractor();
sourceFileInfoExtractor.setTypeSolver(combinedTypeSolver);
sourceFileInfoExtractor.setPrintFileName(false);
sourceFileInfoExtractor.setVerbose(true);
return sourceFileInfoExtractor;
}
use of com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver in project javaparser by javaparser.
the class CompilationUnitContextResolutionTest method solveTypeImported.
@Test
public void solveTypeImported() throws ParseException, IOException {
CompilationUnit cu = parseSample("CompilationUnitWithImports");
Context context = new CompilationUnitContext(cu, typeSolver);
SymbolReference<ResolvedTypeDeclaration> ref = context.solveType("Assert", new JarTypeSolver(adaptPath("src/test/resources/junit-4.8.1.jar")));
assertEquals(true, ref.isSolved());
assertEquals("org.junit.Assert", ref.getCorrespondingDeclaration().getQualifiedName());
}
Aggregations