com.github.javaparser.symbolsolver.model.resolution.TypeSolver Java Examples

The following examples show how to use com.github.javaparser.symbolsolver.model.resolution.TypeSolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Context.java    From apigcc with MIT License 6 votes vote down vote up
/**
 * 构建TypeSolver
 * @return
 */
public TypeSolver buildTypeSolver(){
    CombinedTypeSolver typeSolver = new CombinedTypeSolver();
    for (Path dependency : dependencies) {
        typeSolver.add(new JavaParserTypeSolver(dependency));
    }
    for (Path jar : jars) {
        try {
            typeSolver.add(new JarTypeSolver(jar));
        } catch (IOException e) {
            log.warn("exception on {} {}", jar, e.getMessage());
        }
    }
    if (!codeTypeDeclarations.isEmpty()) {
        for (CodeTypeDeclaration codeTypeDeclaration : codeTypeDeclarations) {
            Path path = dependencyPath.resolve(codeTypeDeclaration.path());
            FileHelper.write(path, codeTypeDeclaration.code());
        }
        typeSolver.add(new JavaParserTypeSolver(dependencyPath));
    }
    typeSolver.add(new ReflectionTypeSolver());
    return typeSolver;
}
 
Example #2
Source File: Workspace.java    From Recaf with MIT License 5 votes vote down vote up
/**
 * Creates a source config with a type resolver that can access all types in the workspace.
 */
public void updateSourceConfig() {
	TypeSolver solver = new WorkspaceTypeResolver(this);
	config = new ParserConfiguration()
			.setSymbolResolver(new JavaSymbolSolver(solver))
			.setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_14);
}
 
Example #3
Source File: WorkspaceTypeResolver.java    From Recaf with MIT License 4 votes vote down vote up
@Override
public TypeSolver getParent() {
	return this.parent;
}
 
Example #4
Source File: WorkspaceTypeResolver.java    From Recaf with MIT License 4 votes vote down vote up
@Override
public void setParent(TypeSolver parent) {
	this.parent = parent;
}
 
Example #5
Source File: Input.java    From JRemapper with MIT License 4 votes vote down vote up
@Override
public TypeSolver getParent() {
	return this.parent;
}
 
Example #6
Source File: Input.java    From JRemapper with MIT License 4 votes vote down vote up
@Override
public void setParent(TypeSolver parent) {
	this.parent = parent;
}
 
Example #7
Source File: ClassloaderTypeSolver.java    From jeddict with Apache License 2.0 4 votes vote down vote up
@Override
public TypeSolver getParent() {
    return parent;
}
 
Example #8
Source File: ClassloaderTypeSolver.java    From jeddict with Apache License 2.0 4 votes vote down vote up
@Override
public void setParent(TypeSolver parent) {
    this.parent = parent;
}