diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-03-05 07:55:40 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-03-05 08:06:46 +0100 |
commit | f8c16ed8ac69d0106a845ca96573557700b6f39d (patch) | |
tree | d4170a71775dbeb13e58aa87585dabc9ab9f6c4f | |
parent | eebc5f4e851a4ce6f2775ebaf6e74794480da0b9 (diff) | |
download | lombok-f8c16ed8ac69d0106a845ca96573557700b6f39d.tar.gz lombok-f8c16ed8ac69d0106a845ca96573557700b6f39d.tar.bz2 lombok-f8c16ed8ac69d0106a845ca96573557700b6f39d.zip |
[tests] fix tests on java6/7
41 files changed, 47 insertions, 5 deletions
diff --git a/buildScripts/tests.ant.xml b/buildScripts/tests.ant.xml index 0fc1cdb6..f250b340 100644 --- a/buildScripts/tests.ant.xml +++ b/buildScripts/tests.ant.xml @@ -81,6 +81,7 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn <jvmarg value="-Xbootclasspath/a:${jdk6-rt.loc}" /> <jvmarg line="${test.limitmodules}" /> <jvmarg value="-Ddelombok.bootclasspath=${jdk6-rt.loc}" /> + <jvmarg value="-Dsun.boot.class.path=${jdk6-rt.loc}" /> <formatter type="plain" usefile="false" unless="tests.quiet" /> <classpath refid="cp.test" /> <classpath refid="cp.stripe" /> @@ -97,6 +98,7 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn <jvmarg value="-Xbootclasspath/a:${jdk8-rt.loc}" /> <jvmarg line="${test.limitmodules}" /> <jvmarg value="-Ddelombok.bootclasspath=${jdk8-rt.loc}" /> + <jvmarg value="-Dsun.boot.class.path=${jdk8-rt.loc}" /> <formatter type="plain" usefile="false" unless="tests.quiet" /> <classpath refid="cp.test" /> <classpath refid="cp.stripe" /> diff --git a/test/bytecode/src/lombok/bytecode/TestClassFileMetaData.java b/test/bytecode/src/lombok/bytecode/TestClassFileMetaData.java index 335455fd..5ff7e93b 100644 --- a/test/bytecode/src/lombok/bytecode/TestClassFileMetaData.java +++ b/test/bytecode/src/lombok/bytecode/TestClassFileMetaData.java @@ -76,7 +76,7 @@ public class TestClassFileMetaData { } - + @Test public void testUsesClass() { assertTrue(foo.usesClass("java/lang/System")); @@ -199,7 +199,7 @@ public class TestClassFileMetaData { CompilationTask task = compiler.getTask(captureWarnings, null, diagnostics, options, null, Collections.singleton(new ContentBasedJavaFileObject(file.getPath(), readFileAsString(file)))); Boolean taskResult = task.call(); - assertTrue("Compilation task didn't succeed: \n<Warnings and Errors>\n" + compilerErrors.toString() + "\n</Warnings and Errors>", taskResult); + assertTrue("Compilation task didn't succeed: \n<Warnings and Errors>\n" + compilerErrors.toString() + "\n" + captureWarnings.toString() + "\n</Warnings and Errors>", taskResult); return PostCompilerApp.readFile(new File(tempDir, file.getName().replaceAll("\\.java$", ".class"))); } catch (Exception e) { throw Lombok.sneakyThrow(e); diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java index 1498e635..0326dee9 100644 --- a/test/core/src/lombok/LombokTestSource.java +++ b/test/core/src/lombok/LombokTestSource.java @@ -374,4 +374,8 @@ public class LombokTestSource { public int minVersion() { return Math.max(6, versionLowerLimit); } + + public int maxVersion() { + return versionUpperLimit; + } } diff --git a/test/transform/resource/after-delombok/BuilderSingularNullBehavior1.java b/test/transform/resource/after-delombok/BuilderSingularNullBehavior1.java index 32ad0a68..45ff97fa 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNullBehavior1.java +++ b/test/transform/resource/after-delombok/BuilderSingularNullBehavior1.java @@ -1,3 +1,4 @@ +//version 8: import java.util.List; import java.util.Collection; class BuilderSingularNullBehavior1 { diff --git a/test/transform/resource/after-delombok/BuilderWithNonNull.java b/test/transform/resource/after-delombok/BuilderWithNonNull.java index c9c37542..00728ea7 100644 --- a/test/transform/resource/after-delombok/BuilderWithNonNull.java +++ b/test/transform/resource/after-delombok/BuilderWithNonNull.java @@ -1,3 +1,4 @@ +//version 8: class BuilderWithNonNull { @lombok.NonNull private final String id; diff --git a/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java index ec8ed514..f6dfed67 100644 --- a/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java @@ -1,3 +1,4 @@ +//version 8: class BuilderWithNonNullWithSetterPrefix { @lombok.NonNull private final String id; diff --git a/test/transform/resource/after-delombok/ConstructorsWithAccessors.java b/test/transform/resource/after-delombok/ConstructorsWithAccessors.java index 3614d682..7097d5a2 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithAccessors.java +++ b/test/transform/resource/after-delombok/ConstructorsWithAccessors.java @@ -1,3 +1,4 @@ +//version 8: class ConstructorsWithAccessors { int plower; int pUpper; diff --git a/test/transform/resource/after-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java index 80f3ca83..0d863f4f 100644 --- a/test/transform/resource/after-delombok/DataOnLocalClass.java +++ b/test/transform/resource/after-delombok/DataOnLocalClass.java @@ -1,3 +1,4 @@ +//version 8: class DataOnLocalClass1 { public static void main(String[] args) { class Local { diff --git a/test/transform/resource/after-delombok/GetterOnClass.java b/test/transform/resource/after-delombok/GetterOnClass.java index f0025370..ae845e54 100644 --- a/test/transform/resource/after-delombok/GetterOnClass.java +++ b/test/transform/resource/after-delombok/GetterOnClass.java @@ -1,3 +1,4 @@ +//version 8: class GetterOnClass1 { boolean isNone; boolean isPublic; diff --git a/test/transform/resource/after-delombok/NonNullOnParameter.java b/test/transform/resource/after-delombok/NonNullOnParameter.java index 4f6df920..95fd13ec 100644 --- a/test/transform/resource/after-delombok/NonNullOnParameter.java +++ b/test/transform/resource/after-delombok/NonNullOnParameter.java @@ -1,3 +1,4 @@ +//version 8: class NonNullOnParameter extends Thread { NonNullOnParameter(@lombok.NonNull String arg) { this(arg, ""); diff --git a/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java b/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java index 88577f25..df496931 100644 --- a/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java +++ b/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java @@ -1,3 +1,4 @@ +//version 8: abstract class NonNullOnParameterAbstract { public void test(@lombok.NonNull String arg) { if (arg == null) { diff --git a/test/transform/resource/after-delombok/NonNullPlain.java b/test/transform/resource/after-delombok/NonNullPlain.java index 24377237..9fc29042 100644 --- a/test/transform/resource/after-delombok/NonNullPlain.java +++ b/test/transform/resource/after-delombok/NonNullPlain.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.*; class NonNullPlain { @lombok.NonNull diff --git a/test/transform/resource/after-delombok/NonNullWithAlternateException.java b/test/transform/resource/after-delombok/NonNullWithAlternateException.java index 7f30fd1f..e76feca2 100644 --- a/test/transform/resource/after-delombok/NonNullWithAlternateException.java +++ b/test/transform/resource/after-delombok/NonNullWithAlternateException.java @@ -1,3 +1,4 @@ +//version 8: public class NonNullWithAlternateException { @lombok.NonNull private String test; diff --git a/test/transform/resource/after-delombok/NonNullWithAssertion.java b/test/transform/resource/after-delombok/NonNullWithAssertion.java index 15dc0254..318d85b9 100644 --- a/test/transform/resource/after-delombok/NonNullWithAssertion.java +++ b/test/transform/resource/after-delombok/NonNullWithAssertion.java @@ -1,3 +1,4 @@ +//version 8: public class NonNullWithAssertion { @lombok.NonNull private String test; diff --git a/test/transform/resource/after-delombok/NonNullWithGuava.java b/test/transform/resource/after-delombok/NonNullWithGuava.java index b3c13d30..efa5878e 100644 --- a/test/transform/resource/after-delombok/NonNullWithGuava.java +++ b/test/transform/resource/after-delombok/NonNullWithGuava.java @@ -1,3 +1,4 @@ +//version 8: import static com.google.common.base.Preconditions.*; public class NonNullWithGuava { @lombok.NonNull diff --git a/test/transform/resource/after-delombok/NonNullWithJdk.java b/test/transform/resource/after-delombok/NonNullWithJdk.java index d7e2958c..725d90c7 100644 --- a/test/transform/resource/after-delombok/NonNullWithJdk.java +++ b/test/transform/resource/after-delombok/NonNullWithJdk.java @@ -1,4 +1,4 @@ -//version 7: +//version 8: import static java.util.Objects.*; public class NonNullWithJdk { @lombok.NonNull diff --git a/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java b/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java index 44640164..cd7f8092 100644 --- a/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java +++ b/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java @@ -1,3 +1,4 @@ +//version 8: class NonNullWithSneakyThrows { void test(@lombok.NonNull String in) { try { diff --git a/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java index 62af2cb4..25a76c6d 100644 --- a/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations = checkerframework import java.util.List; diff --git a/test/transform/resource/after-delombok/SetterOnClass.java b/test/transform/resource/after-delombok/SetterOnClass.java index 24f376cb..d95a280f 100644 --- a/test/transform/resource/after-delombok/SetterOnClass.java +++ b/test/transform/resource/after-delombok/SetterOnClass.java @@ -1,3 +1,4 @@ +//version 8: class SetterOnClass1 { boolean isNone; boolean isPublic; diff --git a/test/transform/resource/after-delombok/StaticConstructor.java b/test/transform/resource/after-delombok/StaticConstructor.java index f9c862d7..4de6dbe5 100644 --- a/test/transform/resource/after-delombok/StaticConstructor.java +++ b/test/transform/resource/after-delombok/StaticConstructor.java @@ -1,3 +1,4 @@ +//version 8: public class StaticConstructor { String name; @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java index 771e42f4..fe3e3173 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java @@ -1,3 +1,4 @@ +//version 8:
import java.util.List;
public class SuperBuilderWithNonNull {
public static class Parent {
diff --git a/test/transform/resource/after-delombok/WithOnClass.java b/test/transform/resource/after-delombok/WithOnClass.java index 34c6d811..0fa973eb 100644 --- a/test/transform/resource/after-delombok/WithOnClass.java +++ b/test/transform/resource/after-delombok/WithOnClass.java @@ -1,3 +1,4 @@ +//version 8: class WithOnClass1 { boolean isNone; boolean isPublic; diff --git a/test/transform/resource/before/BuilderSingularNullBehavior1.java b/test/transform/resource/before/BuilderSingularNullBehavior1.java index bcf473a4..add00ea7 100644 --- a/test/transform/resource/before/BuilderSingularNullBehavior1.java +++ b/test/transform/resource/before/BuilderSingularNullBehavior1.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations = checkerframework //CONF: lombok.nonNull.exceptionType = assertion import java.util.List; diff --git a/test/transform/resource/before/BuilderWithNonNull.java b/test/transform/resource/before/BuilderWithNonNull.java index 03a54326..b0c1d36a 100644 --- a/test/transform/resource/before/BuilderWithNonNull.java +++ b/test/transform/resource/before/BuilderWithNonNull.java @@ -1,3 +1,4 @@ +//version 8: @lombok.Builder class BuilderWithNonNull { @lombok.NonNull diff --git a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java index 8ef1f70e..7c1aa983 100644 --- a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java @@ -1,3 +1,4 @@ +//version 8: @lombok.Builder(setterPrefix = "with") class BuilderWithNonNullWithSetterPrefix { @lombok.NonNull diff --git a/test/transform/resource/before/ConstructorsWithAccessors.java b/test/transform/resource/before/ConstructorsWithAccessors.java index e67a47ce..fc72be55 100644 --- a/test/transform/resource/before/ConstructorsWithAccessors.java +++ b/test/transform/resource/before/ConstructorsWithAccessors.java @@ -1,3 +1,4 @@ +//version 8: @lombok.AllArgsConstructor @lombok.experimental.Accessors(prefix={"p", "_"}) class ConstructorsWithAccessors { int plower; int pUpper; @@ -11,4 +12,3 @@ @lombok.NonNull Integer _huh; @lombok.NonNull final Integer __huh2; } - diff --git a/test/transform/resource/before/DataOnLocalClass.java b/test/transform/resource/before/DataOnLocalClass.java index b1272b7e..e4fa4cd5 100644 --- a/test/transform/resource/before/DataOnLocalClass.java +++ b/test/transform/resource/before/DataOnLocalClass.java @@ -1,3 +1,4 @@ +//version 8: import lombok.Data; class DataOnLocalClass1 { public static void main(String[] args) { diff --git a/test/transform/resource/before/GetterOnClass.java b/test/transform/resource/before/GetterOnClass.java index 0a38b386..f44d2556 100644 --- a/test/transform/resource/before/GetterOnClass.java +++ b/test/transform/resource/before/GetterOnClass.java @@ -1,3 +1,4 @@ +//version 8: @lombok.Getter class GetterOnClass1 { @lombok.Getter(lombok.AccessLevel.NONE) diff --git a/test/transform/resource/before/NonNullOnParameter.java b/test/transform/resource/before/NonNullOnParameter.java index 22aceac7..43175832 100644 --- a/test/transform/resource/before/NonNullOnParameter.java +++ b/test/transform/resource/before/NonNullOnParameter.java @@ -1,3 +1,4 @@ +//version 8: class NonNullOnParameter extends Thread { NonNullOnParameter(@lombok.NonNull String arg) { this(arg, ""); diff --git a/test/transform/resource/before/NonNullOnParameterAbstract.java b/test/transform/resource/before/NonNullOnParameterAbstract.java index 16691184..0508be42 100644 --- a/test/transform/resource/before/NonNullOnParameterAbstract.java +++ b/test/transform/resource/before/NonNullOnParameterAbstract.java @@ -1,3 +1,4 @@ +//version 8: abstract class NonNullOnParameterAbstract { public void test(@lombok.NonNull String arg) { System.out.println("Hey"); diff --git a/test/transform/resource/before/NonNullPlain.java b/test/transform/resource/before/NonNullPlain.java index a438d1d4..1a016fb4 100644 --- a/test/transform/resource/before/NonNullPlain.java +++ b/test/transform/resource/before/NonNullPlain.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.*; @lombok.RequiredArgsConstructor diff --git a/test/transform/resource/before/NonNullWithAlternateException.java b/test/transform/resource/before/NonNullWithAlternateException.java index c47f5727..28b7be6d 100644 --- a/test/transform/resource/before/NonNullWithAlternateException.java +++ b/test/transform/resource/before/NonNullWithAlternateException.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.nonNull.exceptionType = IllegalArgumentException public class NonNullWithAlternateException { diff --git a/test/transform/resource/before/NonNullWithAssertion.java b/test/transform/resource/before/NonNullWithAssertion.java index c3d271a6..1e282ffa 100644 --- a/test/transform/resource/before/NonNullWithAssertion.java +++ b/test/transform/resource/before/NonNullWithAssertion.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.nonNull.exceptionType = Assertion public class NonNullWithAssertion { diff --git a/test/transform/resource/before/NonNullWithGuava.java b/test/transform/resource/before/NonNullWithGuava.java index dc877daa..e592ee14 100644 --- a/test/transform/resource/before/NonNullWithGuava.java +++ b/test/transform/resource/before/NonNullWithGuava.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.nonNull.exceptionType = Guava import static com.google.common.base.Preconditions.*; public class NonNullWithGuava { diff --git a/test/transform/resource/before/NonNullWithJdk.java b/test/transform/resource/before/NonNullWithJdk.java index c8cbf2ee..5c3d03a5 100644 --- a/test/transform/resource/before/NonNullWithJdk.java +++ b/test/transform/resource/before/NonNullWithJdk.java @@ -1,4 +1,4 @@ -//version 7: +//version 8: //CONF: lombok.nonNull.exceptionType = Jdk import static java.util.Objects.*; public class NonNullWithJdk { diff --git a/test/transform/resource/before/NonNullWithSneakyThrows.java b/test/transform/resource/before/NonNullWithSneakyThrows.java index 35f78a7f..00c03f04 100644 --- a/test/transform/resource/before/NonNullWithSneakyThrows.java +++ b/test/transform/resource/before/NonNullWithSneakyThrows.java @@ -1,3 +1,4 @@ +//version 8: class NonNullWithSneakyThrows { @lombok.SneakyThrows void test(@lombok.NonNull String in) { System.out.println(in); diff --git a/test/transform/resource/before/NullAnnotatedCheckerFrameworkSuperBuilder.java b/test/transform/resource/before/NullAnnotatedCheckerFrameworkSuperBuilder.java index 39bb0fcc..eea118cb 100644 --- a/test/transform/resource/before/NullAnnotatedCheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/before/NullAnnotatedCheckerFrameworkSuperBuilder.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations = checkerframework import java.util.List; import lombok.Singular; diff --git a/test/transform/resource/before/SetterOnClass.java b/test/transform/resource/before/SetterOnClass.java index a7629ff0..b7ab4177 100644 --- a/test/transform/resource/before/SetterOnClass.java +++ b/test/transform/resource/before/SetterOnClass.java @@ -1,3 +1,4 @@ +//version 8: @lombok.Setter class SetterOnClass1 { @lombok.Setter(lombok.AccessLevel.NONE) diff --git a/test/transform/resource/before/StaticConstructor.java b/test/transform/resource/before/StaticConstructor.java index eff1fa9b..7b720c6f 100644 --- a/test/transform/resource/before/StaticConstructor.java +++ b/test/transform/resource/before/StaticConstructor.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations = checkerframework import lombok.AllArgsConstructor; @AllArgsConstructor(staticName = "of") diff --git a/test/transform/resource/before/SuperBuilderWithNonNull.java b/test/transform/resource/before/SuperBuilderWithNonNull.java index 34668bbc..7287c688 100644 --- a/test/transform/resource/before/SuperBuilderWithNonNull.java +++ b/test/transform/resource/before/SuperBuilderWithNonNull.java @@ -1,3 +1,4 @@ +//version 8: import java.util.List; public class SuperBuilderWithNonNull { diff --git a/test/transform/resource/before/WithOnClass.java b/test/transform/resource/before/WithOnClass.java index a6215b54..fb6350e7 100644 --- a/test/transform/resource/before/WithOnClass.java +++ b/test/transform/resource/before/WithOnClass.java @@ -1,3 +1,5 @@ +//version 8: + @lombok.With class WithOnClass1 { @lombok.With(lombok.AccessLevel.NONE) |