Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-file j2d/refs #1

Closed
wants to merge 1 commit into from
Closed

Cross-file j2d/refs #1

wants to merge 1 commit into from

Conversation

chrismwendt
Copy link
Contributor

(no intention to merge)

This is my attempt to see if cross-file j2d/refs would work by using SymbolSolverCollectionStrategy as shown in https://javaparser.org/setting-up-for-analysing-a-whole-project/

It currently doesn't work, and I seem to have hit a roadblock. Take for example this call to postIndex:

https://github.com/sourcegraph/lsif-java/blob/4cf52ba51fb1439afbb61e393c4e4cfafc3cd378/src/main/java/ProjectIndexer.java#L57

When I print out the value of System.out.println(n.resolve());, where n is a MethodCallExpr for postIndex, I get:

ReflectionMethodDeclaration{method=public void DocumentIndexer.postIndex()}

instead of a JavaParserMethodDeclaration. This is problematic because:

getWrappedNode is present only on the subclasses of the Resolved* declarations that derive from JP AST nodes (such as JavaParserClassDeclaration).

From https://static.javadoc.io/com.github.javaparser/javaparser-core/3.13.2/com/github/javaparser/resolution/declarations/AssociableToAST.html#toAst--

ReflectionMethodDeclaration cannot be cast to JavaParserMethodDeclaration. That means I can't call getWrappedNode on it.

I did a bunch of GitHub code searches for other uses of SymbolSolverCollectionStrategy, getWrappedNode, etc. and haven't found any workaround. It seems that Reflection* classes come from jars:

https://github.com/opensathishrtskumar/StaticAnalyzer/blob/cd889d4b9fd631ba13dccce1fce340005ea76e86/src/com/analyzer/visitor/GeneralVisitor.java#L75-L82

@chrismwendt
Copy link
Contributor Author

Subsumed by #2

Strum355 added a commit that referenced this pull request Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant