Open martinlippert opened 3 hours ago
Using Javac parser and the converter from https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/tree/dom-with-javac , the annotation seems to remain:
{CompilationUnit: /eclipsecon-demo-jdt-with-javac/src/main/java/snippet/Snippet.java=package snippet;
public class Snippet {
public void TestDependsOnClass( @Qualifier(value=$missing$) Object mybean){
}
}
}
I am parsing (somewhat broken) Java source code using the ASTParser and came across several situations in which the parser seems to not include information about the parsed code anymore.
The concrete case here is this constructor (for example):
In this case, the value for the attribute
value
behind the=
is missing from the source code. As a result, the annotation gets removed from the AST altogether. TheMethodDeclaration
node in the parsed AST looks like this:Since I would like to implement some code completion based on the parsed AST, I somewhat depend some information being still around for the annotation.
This seems to happen for annotations on method parameters only. The same broken annotation code on a type declaration results in a DOM that got a
$missing$
node inserted nicely:(@mickaelistria, this is one of the cases that we talked about)