Home » Language IDEs » Java Development Tools (JDT) » Trying out External Annotations for null analysis, but Annotate does nothing
Trying out External Annotations for null analysis, but Annotate does nothing [message #1735525] |
Mon, 20 June 2016 15:21 |
Michael Vorburger Messages: 103 Registered: July 2009 |
Senior Member |
|
|
Hello,
I'd like to try out the External Annotations for null analysis, but the right-click Annotate context action does nothing for me.
Details: See my micro example project on https://github.com/vorburger/eclipse-null-eea-augments. So I have the "hello" and the "slf4j-api--eea-LATEST" projects open in Eclipse. The "hello" project is, for now, intentionally with hard-coded absolute path for its 2 JAR dependencies (annotations and slf4j); and the slfj4 JAR has a source JAR (hard-coded; I want to think about Maven integration as a next step), annotation based null analysis is enabled for that hello project, and an external annotation location is be defined for the slf4j library and that location is another project within the workspace ("slf4j-api--eea-LATEST", but it's completely empty).
As described e.g. on http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_external_null_annotations.htm (Mars instead of Neon, but I don't think this changed?), I now F3 Ctrl-Click on the LoggerFactory.getLogger in /hello/src/main/java/ch/vorburger/nulls/examples/hello/Hello.java, which has the "Null type safety (type annotations): The expression of type 'Logger' needs unchecked conversion to conform to '@NonNull Logger'", good, thanks, to jump into my e.g. /home/vorburger/.m2/repository/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21-sources.jar line 382, where I mark the Class<?> clazz argument of the public static Logger getLogger() method - and right-click and choose Annotate. But nothing happens! I expected it to prompt me with Q how to annotate as per the doc, and for it to then create an eea file in that "slf4j-api--eea-LATEST" project.
There is nothing in the Error Log.
I'm on a Neon 4.6.0RC3.
Thanks for guidance!
|
|
| | |
Re: Trying out External Annotations for null analysis, but Annotate does nothing [message #1736630 is a reply to message #1736103] |
Thu, 30 June 2016 16:34 |
Michael Vorburger Messages: 103 Registered: July 2009 |
Senior Member |
|
|
Given the silence here (Stephane?) I've now actually set up a JDT Dev Env WS (not too hard, thanks Oomph!) to attempt debugging why "Annotate" does nothing (for me) :
Starting with a BP in AnnotateClassFileAction, I can see that in org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant.collectQuickFixableAnnotations(ITextEditor, int, boolean, ArrayList<Annotation>) the IAnnotationModel model == null, bad start?
I'm interested in contributing to https://bugs.eclipse.org/bugs/show_bug.cgi?id=449653, but without being able to get even basic Annotate to work, I'm not going to go very far...
|
|
| | | |
Re: Trying out External Annotations for null analysis, but Annotate does nothing [message #1736714 is a reply to message #1736692] |
Fri, 01 July 2016 09:56 |
Michael Vorburger Messages: 103 Registered: July 2009 |
Senior Member |
|
|
> let me know if the (doc) could be improved.
Upon re-reading it, "select the type (method parameter or method return type)" is actually fairly clear...
> missing diagnostic popup informing about the inappropriate activation context
> a menu option is greyed out, we really should have a hover text to explain why
In an ideal world, that would be cool. Realizing that this is a volunteer driven effort, I wouldn't say it's a high priority though (compared to spending time on ironing out any remaining bugs in null analysis, if there are any).
Most importantly is probably finish up the tooling story, e.g. incl. (a) establishing a repository with null annotations for commonly used FLOSS libs, with an open culture inviting many to contribute; and (b) auto. loading and associating *.eea, through Maven (and, later, Gradle). IMHO these two points are maybe what's missing most now. I'll see if I can perhaps contribute to both of those in the coming weeks & months; and will let you know when I have something to show, or discuss.
|
|
|
Goto Forum:
Current Time: Sat Oct 05 10:28:06 GMT 2024
Powered by FUDForum. Page generated in 0.05043 seconds
|