diff options
Diffstat (limited to 'test')
8 files changed, 145 insertions, 1 deletions
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index 739d6316..5c29533c 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -43,6 +43,7 @@ import lombok.javac.CapturingDiagnosticListener.CompilerMessage; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.internal.compiler.CompilationResult; @@ -112,7 +113,7 @@ public class RunTestsViaEcj extends AbstractRunTests { String source = readFile(file); char[] sourceArray = source.toCharArray(); - final org.eclipse.jdt.internal.compiler.batch.CompilationUnit sourceUnit = new org.eclipse.jdt.internal.compiler.batch.CompilationUnit(sourceArray, file.getName(), encoding == null ? "UTF-8" : encoding); + final ICompilationUnit sourceUnit = new TestCompilationUnit(file.getName(), source); Compiler ecjCompiler = new Compiler(createFileSystem(file, minVersion), ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) { @Override protected synchronized void addCompilationUnit(ICompilationUnit inUnit, CompilationUnitDeclaration parsedUnit) { @@ -223,4 +224,42 @@ public class RunTestsViaEcj extends AbstractRunTests { } return new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8"); } + + private static final class TestCompilationUnit extends org.eclipse.jdt.internal.core.CompilationUnit { + private final char[] source; + private final char[] mainTypeName; + + private TestCompilationUnit(String name, String source) { + super(null, name, null); + this.source = source.toCharArray(); + + char[] fileNameCharArray = getFileName(); + int start = CharOperation.lastIndexOf(File.separatorChar, fileNameCharArray) + 1; + int end = CharOperation.lastIndexOf('.', fileNameCharArray); + if (end == -1) { + end = fileNameCharArray.length; + } + mainTypeName = CharOperation.subarray(fileNameCharArray, start, end); + } + + @Override public char[] getContents() { + return source; + } + + @Override public char[] getMainTypeName() { + return mainTypeName; + } + + @Override public boolean ignoreOptionalProblems() { + return false; + } + + @Override public char[][] getPackageName() { + return null; + } + + @Override public char[] getModuleName() { + return null; + } + } } diff --git a/test/transform/resource/after-ecj/BuilderJavadoc.java b/test/transform/resource/after-ecj/BuilderJavadoc.java index 445b5417..3afd3be2 100644 --- a/test/transform/resource/after-ecj/BuilderJavadoc.java +++ b/test/transform/resource/after-ecj/BuilderJavadoc.java @@ -16,10 +16,21 @@ import java.util.List; @java.lang.SuppressWarnings("all") BuilderJavadocBuilder() { super(); } + /** + * basic gets only a builder setter. + * @see #getsetwith + * @param tag is moved to the setter. + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderJavadoc.BuilderJavadocBuilder<T> basic(final int basic) { this.basic = basic; return this; } + /** + * getsetwith gets a builder setter, an instance getter and setter, and a wither. + * @param tag is moved to the setters and wither. + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderJavadoc.BuilderJavadocBuilder<T> getsetwith(final int getsetwith) { this.getsetwith = getsetwith; return this; @@ -45,12 +56,26 @@ import java.util.List; public static @java.lang.SuppressWarnings("all") <T>BuilderJavadoc.BuilderJavadocBuilder<T> builder() { return new BuilderJavadoc.BuilderJavadocBuilder<T>(); } + /** + * getsetwith gets a builder setter, an instance getter and setter, and a wither. + * + * @return tag is moved to the getter. + */ public @java.lang.SuppressWarnings("all") int getGetsetwith() { return this.getsetwith; } + /** + * getsetwith gets a builder setter, an instance getter and setter, and a wither. + * @param tag is moved to the setters and wither. + */ public @java.lang.SuppressWarnings("all") void setGetsetwith(final int getsetwith) { this.getsetwith = getsetwith; } + /** + * getsetwith gets a builder setter, an instance getter and setter, and a wither. + * @param tag is moved to the setters and wither. + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") BuilderJavadoc<T> withGetsetwith(final int getsetwith) { return ((this.getsetwith == getsetwith) ? this : new BuilderJavadoc<T>(this.basic, getsetwith, this.predef, this.predefWithJavadoc)); } diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecated.java b/test/transform/resource/after-ecj/BuilderWithDeprecated.java index 724a25e6..65326a66 100644 --- a/test/transform/resource/after-ecj/BuilderWithDeprecated.java +++ b/test/transform/resource/after-ecj/BuilderWithDeprecated.java @@ -10,6 +10,10 @@ public @Builder class BuilderWithDeprecated { @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder() { super(); } + /** + * @deprecated since always + * @return {@code this}. + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecated.BuilderWithDeprecatedBuilder dep1(final String dep1) { this.dep1 = dep1; return this; diff --git a/test/transform/resource/after-ecj/GetterDeprecated.java b/test/transform/resource/after-ecj/GetterDeprecated.java index 546f7fb7..087a60b8 100644 --- a/test/transform/resource/after-ecj/GetterDeprecated.java +++ b/test/transform/resource/after-ecj/GetterDeprecated.java @@ -8,6 +8,9 @@ class GetterDeprecated { public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getAnnotation() { return this.annotation; } + /** + * @deprecated + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getJavadoc() { return this.javadoc; } diff --git a/test/transform/resource/after-ecj/GetterSetterJavadoc.java b/test/transform/resource/after-ecj/GetterSetterJavadoc.java index 4923fd02..c3308c51 100644 --- a/test/transform/resource/after-ecj/GetterSetterJavadoc.java +++ b/test/transform/resource/after-ecj/GetterSetterJavadoc.java @@ -1,8 +1,18 @@ @lombok.Data class GetterSetterJavadoc1 { private int fieldName; + /** + * Getter section + * + * @return Sky is blue1 + */ public @java.lang.SuppressWarnings("all") int getFieldName() { return this.fieldName; } + /** + * Some text + * + * @param fieldName Hello, World1 + */ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) { this.fieldName = fieldName; } @@ -39,9 +49,19 @@ class GetterSetterJavadoc2 { GetterSetterJavadoc2() { super(); } + /** + * Some text + * + * @return Sky is blue2 + */ public @java.lang.SuppressWarnings("all") int getFieldName() { return this.fieldName; } + /** + * Some text + * + * @param fieldName Hello, World2 + */ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) { this.fieldName = fieldName; } @@ -51,9 +71,17 @@ class GetterSetterJavadoc3 { GetterSetterJavadoc3() { super(); } + /** + * Getter section + * @return Sky is blue3 + */ public @java.lang.SuppressWarnings("all") int getFieldName() { return this.fieldName; } + /** + * Setter section + * @param fieldName Hello, World3 + */ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) { this.fieldName = fieldName; } @@ -63,9 +91,20 @@ class GetterSetterJavadoc3 { GetterSetterJavadoc4() { super(); } + /** + * Some text + * + * @return Sky is blue4 + */ public @java.lang.SuppressWarnings("all") int fieldName() { return this.fieldName; } + /** + * Some text + * + * @param fieldName Hello, World4 + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") GetterSetterJavadoc4 fieldName(final int fieldName) { this.fieldName = fieldName; return this; @@ -76,9 +115,18 @@ class GetterSetterJavadoc3 { GetterSetterJavadoc5() { super(); } + /** + * Getter section + * @return Sky is blue5 + */ public @java.lang.SuppressWarnings("all") int fieldName() { return this.fieldName; } + /** + * Setter section + * @param fieldName Hello, World5 + * @return Sky is blue5 + */ public @java.lang.SuppressWarnings("all") GetterSetterJavadoc5 fieldName(final int fieldName) { this.fieldName = fieldName; return this; diff --git a/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java b/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java index dd64e358..c95b7bab 100644 --- a/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java +++ b/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java @@ -7,15 +7,33 @@ class SetterAndWithMethodJavadoc { this.i = i; this.j = j; } + /** + * Some value. + * @param the new value + */ public @java.lang.SuppressWarnings("all") void setI(final int i) { this.i = i; } + /** + * Some value. + * @param the new value + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") SetterAndWithMethodJavadoc withI(final int i) { return ((this.i == i) ? this : new SetterAndWithMethodJavadoc(i, this.j)); } + /** + * Set some other value. + * @param the new other value + */ public @java.lang.SuppressWarnings("all") void setJ(final int j) { this.j = j; } + /** + * Reinstantiate with some other value. + * @param the other new other value + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") SetterAndWithMethodJavadoc withJ(final int j) { return ((this.j == j) ? this : new SetterAndWithMethodJavadoc(this.i, j)); } diff --git a/test/transform/resource/after-ecj/SetterDeprecated.java b/test/transform/resource/after-ecj/SetterDeprecated.java index d76612b7..cc089566 100644 --- a/test/transform/resource/after-ecj/SetterDeprecated.java +++ b/test/transform/resource/after-ecj/SetterDeprecated.java @@ -8,6 +8,9 @@ class SetterDeprecated { public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setAnnotation(final int annotation) { this.annotation = annotation; } + /** + * @deprecated + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setJavadoc(final int javadoc) { this.javadoc = javadoc; } diff --git a/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java b/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java index cd123fe8..4220308c 100644 --- a/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java +++ b/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java @@ -8,6 +8,10 @@ class WithMethodMarkedDeprecated { public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WithMethodMarkedDeprecated withAnnotation(final int annotation) { return ((this.annotation == annotation) ? this : new WithMethodMarkedDeprecated(annotation, this.javadoc)); } + /** + * @deprecated + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WithMethodMarkedDeprecated withJavadoc(final int javadoc) { return ((this.javadoc == javadoc) ? this : new WithMethodMarkedDeprecated(this.annotation, javadoc)); } |