diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 31554a8691..83f8c941b0 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -2838,6 +2838,7 @@ public static void setDocComment(CompilationUnitDeclaration cud, TypeDeclaration if (doc == null) return; ICompilationUnit compilationUnit = cud.compilationResult.compilationUnit; + if (compilationUnit == null) return; if (compilationUnit.getClass().equals(COMPILATION_UNIT)) { try { compilationUnit = (ICompilationUnit) Permit.invoke(COMPILATION_UNIT_ORIGINAL_FROM_CLONE, compilationUnit); diff --git a/test/eclipse/resource/noerrors/builderJavadoc/BuilderJavadoc.java b/test/eclipse/resource/noerrors/builderJavadoc/BuilderJavadoc.java new file mode 100644 index 0000000000..745511a541 --- /dev/null +++ b/test/eclipse/resource/noerrors/builderJavadoc/BuilderJavadoc.java @@ -0,0 +1,14 @@ +package pkg; + +import lombok.Builder; + +@Builder +public class BuilderJavadoc { + /** + * Javadoc + * + * @param test ABC + * @return test + */ + private String test; +} \ No newline at end of file diff --git a/test/eclipse/resource/noerrors/builderJavadoc/Usage.java b/test/eclipse/resource/noerrors/builderJavadoc/Usage.java new file mode 100644 index 0000000000..edf3d53d0a --- /dev/null +++ b/test/eclipse/resource/noerrors/builderJavadoc/Usage.java @@ -0,0 +1,7 @@ +package pkg; + +public class Usage { + public void test() { + BuilderJavadoc.builder().test("test").build(); + } +} \ No newline at end of file diff --git a/test/eclipse/src/lombok/eclipse/compile/NoErrorsTest.java b/test/eclipse/src/lombok/eclipse/compile/NoErrorsTest.java index 6d81d3812d..d504967051 100644 --- a/test/eclipse/src/lombok/eclipse/compile/NoErrorsTest.java +++ b/test/eclipse/src/lombok/eclipse/compile/NoErrorsTest.java @@ -28,6 +28,7 @@ import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IProblemRequestor; +import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.WorkingCopyOwner; import org.eclipse.jdt.core.compiler.IProblem; import org.junit.Rule; @@ -47,6 +48,19 @@ public class NoErrorsTest { public void fieldNameConstantsInAnnotation() throws Exception { ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("Usage.java"); + List problems = collectProblems(cu); + assertTrue(problems.isEmpty()); + } + + @Test + public void builderJavadoc() throws Exception { + ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("Usage.java"); + + List problems = collectProblems(cu); + assertTrue(problems.isEmpty()); + } + + private List collectProblems(ICompilationUnit cu) throws JavaModelException { final List problems = new ArrayList(); final IProblemRequestor requestor = new IProblemRequestor() { @Override @@ -83,7 +97,6 @@ public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { workingCopy.discardWorkingCopy(); } - System.out.println(problems); - assertTrue(problems.isEmpty()); + return problems; } }