-
Notifications
You must be signed in to change notification settings - Fork 173
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
[gen.javaparser] reduced depth with lambda expression #237
Comments
Created PR #238 for fixing the reduced depth issue. FYI, a smaller code snippet that also exposes the same issue class Foo{
void foo(){
bar(foo1->bar1,foo2->bar2);
}
} |
Hi and thanks for the bug report and PR! However, is it normal that UnknownType has a null range or is it a bug from Javaparser? Cheers. |
I am a novice user of Javaparser, but if I understood correctly, it is normal for Class hierarchy of The Javadoc in
Since there is no lexical representation for
It seems that null range is the only case where we would get a |
Thanks for the explanation, very useful! I guess the next question is therefore : do we need this node in the tree or do we ignore it? If there is no associated range nor token, my best bet is to avoid putting it in the tree, no? Cheers. |
I agree, a node with no lexical representation is not of interest for an AST differencing tool. |
(Probably more appropriate to be discussed in a separate issue) gumtree/gen.javaparser/src/main/java/com/github/gumtreediff/gen/javaparser/JavaParserVisitor.java Lines 86 to 96 in 7c51bb8
Thanks! |
Do you want to try a PR ? Cheers! |
The PR #238 has already been created :) |
OK thanks, I was not sure that this PR was ignoring the UnknownType nodes! I will try it out. |
Hello,
Context
When parsing the following java source
I obtain the following Tree
It seems that
LambdaExpr [264,271]
andLambdaExpr [271,278]
should have same depth.Possible causes:
When processing node which is instance of
UnknownType
(thus node.range==null)(e.g. first child node of
Parameter [264,267]
orParameter [271,274]
):In class
gen/javaparser/JavaParserVisitor
methodpushNode(Node n, String label)
, line88 throws NoSuchElementException, thus the node is not pushed tothis.context
. However when return to methodvisitPreOrder(Node node)
line62this.trees
is still popped, causes all subsequent nodes to have reduced depth.Thanks!
The text was updated successfully, but these errors were encountered: