com.github.javaparser.symbolsolver.JavaSymbolSolver Java Examples
The following examples show how to use
com.github.javaparser.symbolsolver.JavaSymbolSolver.
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: SourceExplorer.java From jeddict with Apache License 2.0 | 7 votes |
private void configureJavaParser(FileObject sourceRoot) { // Set up a minimal type solver that only looks at the classes used to run this sample. CombinedTypeSolver combinedTypeSolver = new CombinedTypeSolver(); combinedTypeSolver.add(new JavaParserTypeSolver(FileUtil.toFile(sourceRoot))); combinedTypeSolver.add(new ReflectionTypeSolver()); SourceGroup sourceGroup = getFolderSourceGroup(sourceRoot); Project project = FileOwnerQuery.getOwner(sourceRoot); List<ClassLoader> classLoaders = getClassLoaders(project, sourceGroup); for (ClassLoader classLoader : classLoaders) { combinedTypeSolver.add(new ClassloaderTypeSolver(classLoader)); } // Configure JavaParser to use type resolution JavaSymbolSolver symbolSolver = new JavaSymbolSolver(combinedTypeSolver); javaParser.getParserConfiguration().setSymbolResolver(symbolSolver); }
Example #2
Source File: Apigcc.java From apigcc with MIT License | 5 votes |
/** * 初始化环境配置 * * @param context */ private void init(Context context) { INSTANCE = this; this.context = context; this.project.init(this.context); ParserStrategy strategy = this.loadParserStrategy(); strategy.onLoad(); this.visitorParser.setParserStrategy(strategy); this.parserConfiguration.setSymbolResolver(new JavaSymbolSolver(this.context.buildTypeSolver())); }
Example #3
Source File: RemoveMethodParameter.java From Refactoring-Bot with MIT License | 5 votes |
private void configureJavaParserForProject(BotIssue issue) { CombinedTypeSolver typeSolver = new CombinedTypeSolver(); for (String javaRoot : issue.getJavaRoots()) { typeSolver.add(new JavaParserTypeSolver(javaRoot)); } typeSolver.add(new ReflectionTypeSolver()); JavaSymbolSolver javaSymbolSolver = new JavaSymbolSolver(typeSolver); StaticJavaParser.getConfiguration().setSymbolResolver(javaSymbolSolver); }
Example #4
Source File: RenameMethod.java From Refactoring-Bot with MIT License | 5 votes |
private void configureJavaParserForProject(BotIssue issue) { CombinedTypeSolver typeSolver = new CombinedTypeSolver(); for (String javaRoot : issue.getJavaRoots()) { typeSolver.add(new JavaParserTypeSolver(javaRoot)); } typeSolver.add(new ReflectionTypeSolver()); JavaSymbolSolver javaSymbolSolver = new JavaSymbolSolver(typeSolver); StaticJavaParser.getConfiguration().setSymbolResolver(javaSymbolSolver); }
Example #5
Source File: RefactoringHelperTest.java From Refactoring-Bot with MIT License | 5 votes |
private void configureStaticJavaParserForResolving() { CombinedTypeSolver typeSolver = new CombinedTypeSolver(); String javaRoot = TestUtils.getAbsolutePathOfTestsFolder(); typeSolver.add(new JavaParserTypeSolver(javaRoot)); typeSolver.add(new ReflectionTypeSolver()); JavaSymbolSolver javaSymbolSolver = new JavaSymbolSolver(typeSolver); StaticJavaParser.getConfiguration().setSymbolResolver(javaSymbolSolver); }
Example #6
Source File: Workspace.java From Recaf with MIT License | 5 votes |
/** * 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 #7
Source File: OpenApiObjectGenerator.java From flow with Apache License 2.0 | 5 votes |
private ParserConfiguration createParserConfiguration() { CombinedTypeSolver combinedTypeSolver = new CombinedTypeSolver( new ReflectionTypeSolver(false)); if (typeResolverClassLoader != null) { combinedTypeSolver .add(new ClassLoaderTypeSolver(typeResolverClassLoader)); } return new ParserConfiguration() .setSymbolResolver(new JavaSymbolSolver(combinedTypeSolver)); }
Example #8
Source File: Input.java From JRemapper with MIT License | 4 votes |
/** * Creates a source config with a type resolver that can access all types in the workspace. */ public void updateSourceConfig() { config = new ParserConfiguration().setSymbolResolver(new JavaSymbolSolver(this)); }