Fixes #2184: NPE on package-info.java without package declaration.

This commit is contained in:
Roel Spilker committed 2019-07-24 21:18:36 +02:00
1 parent 1f58c92e44
commit 867c3caf61
2 files changed
+7 -1

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ Lombok Changelog
* BUGFIX: Delombok would turn something like `List<byte[]>...` in a method parameter to `List<byte...>...` [Issue #2140](https://github.com/rzwitserloot/lombok/issues/2140)
* BUGFIX: Javac would generate the wrong equals and hashCode if a type-use annotation was put on an array type field [Issue #2165](https://github.com/rzwitserloot/lombok/issues/2165)
* BUGFIX: Eclipse 2019-06 + JDK-12 compatibility + an `@Singular` builder entry would produce a cascade of error dialogs. [Issue #2169](https://github.com/rzwitserloot/lombok/issues/2169)
* BUGFIX: Javac would throw a NullPointerException if the package-info.java did not contain a package declaration. [Issue #2184](https://github.com/rzwitserloot/lombok/issues/2184)
* IMPROBABLE BREAKING CHANGE: Stricter validation of configuration keys dealing with identifiers and types (`lombok.log.fieldName`, `lombok.fieldNameConstants.innerTypeName`, `lombok.copyableAnnotations`).
* IMPROBABLE BREAKING CHANGE: The fields generated inside builders for fields with defaults (with `@Builder` on a class with fields marked `@Default`) now have `$value` as the name; direct manipulation of these fields is not advised because there is an associated `$set` variable that also needs to be taken into account. [Issue #2115](https://github.com/rzwitserloot/lombok/issues/2115)
@@ -389,7 +389,12 @@ public class LombokProcessor extends AbstractProcessor {
}
private JCCompilationUnit toUnit(Element element) {
TreePath path = trees == null ? null : trees.getPath(element);
TreePath path = null;
if (trees != null) {
try {
path = trees.getPath(element);
} catch (NullPointerException ignore) {}
}
if (path == null) return null;
return (JCCompilationUnit) path.getCompilationUnit();