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

The following examples show how to use com.github.javaparser.symbolsolver.model.resolution.TypeSolver. These examples are extracted from open source projects. 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 Project: apigcc   Source File: Context.java    License: 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 Project: Recaf   Source File: Workspace.java    License: 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 Project: Recaf   Source File: WorkspaceTypeResolver.java    License: MIT License 4 votes vote down vote up
@Override
public TypeSolver getParent() {
	return this.parent;
}
 
Example 4
Source Project: Recaf   Source File: WorkspaceTypeResolver.java    License: MIT License 4 votes vote down vote up
@Override
public void setParent(TypeSolver parent) {
	this.parent = parent;
}
 
Example 5
Source Project: JRemapper   Source File: Input.java    License: MIT License 4 votes vote down vote up
@Override
public TypeSolver getParent() {
	return this.parent;
}
 
Example 6
Source Project: JRemapper   Source File: Input.java    License: MIT License 4 votes vote down vote up
@Override
public void setParent(TypeSolver parent) {
	this.parent = parent;
}
 
Example 7
Source Project: jeddict   Source File: ClassloaderTypeSolver.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public TypeSolver getParent() {
    return parent;
}
 
Example 8
Source Project: jeddict   Source File: ClassloaderTypeSolver.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setParent(TypeSolver parent) {
    this.parent = parent;
}