| Summary: | [compile] NullPointerException when importing deprecated class in Java 10 project | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Lukas Eder <lukas.eder> | ||||
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||
| Status: | VERIFIED DUPLICATE | QA Contact: | |||||
| Severity: | critical | ||||||
| Priority: | P3 | CC: | jarthana, manoj.palat, stephan.herrmann | ||||
| Version: | 4.7.3 | ||||||
| Target Milestone: | 4.9 M2 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 10 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Lukas Eder
The problem is located in:
------------------------
org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedType(TypeBinding type, ASTNode location, int index)
------------------------
The method call
------------------------
String sinceValue = deprecatedSinceValue(() -> leafType.getAnnotations());
------------------------
... resets ProblemReporter.referenceContext to null, just prior to the call to this.handle() thereafter, which needs the reference to the referenceContext to be present.
I've deactivated the feature by applying
------------------------
String deprecatedSinceValue(Supplier<AnnotationBinding[]> annotations) {
if (true)
return null;
------------------------
Effectively ignoring the functionality, and this "fixes" the NPE
(In reply to Lukas Eder from comment #0) > A related issue is this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=529176 Thanks for report and link. I believe this is the exact same issue. And in bug 534304 we already have the connection to deprecatedSinceValue() *** This bug has been marked as a duplicate of bug 534304 *** Thanks for linking. Yes, those issues look the same. I couldn't seem to find the duplicates prior to my report. Setting target milestone as the original bug has been fixed for 4.9 M2 @Lukas, it seems the bug is triggered by the combination of a deprecation warning and another problem on a sibling annotation next to @Deprecated. If you identify the second problem the NPE should be avoidable on your side. In your MVCE it's probably that @SW is detected to be unnecessary. As always it would be great if you test-drive the latest I-build from http://download.eclipse.org/eclipse/downloads/#4.8_Integration_Builds (once you see one newer than 2018-06-16). (In reply to Stephan Herrmann from comment #4) > @Lukas, it seems the bug is triggered by the combination of a deprecation > warning and another problem on a sibling annotation next to @Deprecated. If > you identify the second problem the NPE should be avoidable on your side. In > your MVCE it's probably that @SW is detected to be unnecessary. It's complicated... The real world code is generated by a code generator. It will not be that easy to avoid the @SW annotation. > As always it would be great if you test-drive the latest I-build from > http://download.eclipse.org/eclipse/downloads/#4.8_Integration_Builds (once > you see one newer than 2018-06-16). Cool, does that mean you'll expect a backport? I'll keep an eye out for new builds and will report here, again. (In reply to Lukas Eder from comment #5) > > As always it would be great if you test-drive the latest I-build from > > http://download.eclipse.org/eclipse/downloads/#4.8_Integration_Builds (once > > you see one newer than 2018-06-16). > > Cool, does that mean you'll expect a backport? I'll keep an eye out for new > builds and will report here, again. Sorry, here I was confused by the current strategy to (not) publish I-builds - see bug 534304 comment 13. Also note that 4.9 will be released only 3 months from now - cf. https://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg15021.html Verified for 4.9 M2 with build I20180731-2000 |