| Summary: | Make it easier to setup null analysis | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Dani Megert <daniel_megert> |
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P2 | CC: | christoph, daniel_megert, deepakazad, loskutov, markus.kell.r, srikanth_sankaran, stephan.herrmann |
| Version: | 3.8 | ||
| Target Milestone: | 3.8 M7 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 366015 | ||
|
Description
Dani Megert
For normal Java projects we can't do much other than putting the JAR on the build path. Maybe generalize and reuse the JUnit library container.
But for PDE, we should only add it as compile-time dependency ("additional.bundles = org.eclipse.jdt.annotation" in build.properties), not as OSGi Require-Bundle.
*** Bug 366326 has been marked as a duplicate of this bug. *** Added quick fixes on the nullity annotations (only if the project uses the default annotation names). http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=b52baf374d7a2d8bfed5b4948fb8207b71526d9c - Quick fixes are shown even if the jar is on the build path. This can be confusing as once the jar is already added there is still an error because of the missing import statement. For plugin projects executing the Quick fix can result in multiple 'additional.bundles = org.eclipse.jdt.annotation' entries. - For plugin projects we show both 'Copy to build path..' and 'Add to build path..', shouldn't we show only 'Add to build path...' one? > Copy org.eclipse.jdt.annotation.jar to build path
The jar name should be in single quotes.
Follow-up commit with fixes for all problems: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=3fd4a3b1d5804b7987b3315b97d28ec8fd11fff7 > - For plugin projects we show both 'Copy to build path..' and 'Add to build > path..', shouldn't we show only 'Add to build path...' one? I originally intended it to show both options for maximal flexibility, but I agree it rarely happens that plug-in developers don't want to use a reference. You get an exception when additional.bundles already exists. org.eclipse.jface.text.BadLocationException at org.eclipse.jface.text.TreeLineTracker.fail(TreeLineTracker.java:1055) at org.eclipse.jface.text.TreeLineTracker.offsetByLine(TreeLineTracker.java:334) at org.eclipse.jface.text.TreeLineTracker.getLineOffset(TreeLineTracker.java:1122) at org.eclipse.jface.text.AbstractLineTracker.getLineOffset(AbstractLineTracker.java:169) at org.eclipse.jface.text.AbstractDocument.getLineOffset(AbstractDocument.java:922) at org.eclipse.core.internal.filebuffers.SynchronizableDocument.getLineOffset(SynchronizableDocument.java:382) at org.eclipse.jdt.internal.ui.text.correction.UnresolvedElementsSubProcessor$1.createChange(UnresolvedElementsSubProcessor.java:692) at org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal.getChange(ChangeCorrectionProposal.java:372) at org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal.performChange(ChangeCorrectionProposal.java:136) at org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal.apply Fixed with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=a918f74c71001dc67e1c502cfd21cb174a7199c4 Rest looks good. Verified in 4.2-I20120430-1800. (moved this from https://bugs.eclipse.org/bugs/show_bug.cgi?id=366327 . I don't know where the right place for this is , I am as more unsure as this Bug is taged as "fixed". Anyway, here is my problem:) This Bug is still active. Using java8 features like using a stream and converting that into a string array: (new ArrayList<>()).stream().toArray(String[]::new); results in "The type org.eclipse.jdt.annotation.NonNull cannot be resolved. It is indirectly referenced from required .class files" And with this the class cannot be compiled. Using cli javac everything compiles just fine. I am using eclipse Mars. The workaround I use is to disable the "annotation-based null analysis" in project->properties->java-compiler... (In reply to pascal christoph from comment #9) > (moved this from https://bugs.eclipse.org/bugs/show_bug.cgi?id=366327 . I > don't know where the right place for this is , I am as more unsure as this > Bug is taged as "fixed". Anyway, here is my problem:) > This Bug is still active. Using java8 features like using a stream and > converting that into a string array: > > (new ArrayList<>()).stream().toArray(String[]::new); > > results in > "The type org.eclipse.jdt.annotation.NonNull cannot be resolved. It is > indirectly referenced from required .class files" > And with this the class cannot be compiled. Using cli javac everything > compiles just fine. > > I am using eclipse Mars. > > The workaround I use is to disable the "annotation-based null analysis" in > project->properties->java-compiler... Now that I see your problem, I filed bug 479389 to follow up. This current (fixed) bug provided a quick fix to add null annotations to the build path, when they are referenced in source code but cannot be found. Your problem, by contrast, originates from implicit use of null annotations within the compiler. To be continued in the new bug. |