This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit ba1c1496e9b1e75b7c33ec15190c18abb2b5fb1a Author: aalmiray <[email protected]> AuthorDate: Fri Jun 7 10:50:37 2019 +0200 Apply changes suggested by review --- gradle/pomconfigurer.gradle | 5 ++++- .../groovy/generated/AbstractGeneratedAstTestCase.groovy | 8 ++++---- src/test/groovy/generated/AutoCloneGeneratedTest.groovy | 12 ++++-------- .../groovy/generated/AutoExternalizeGeneratedTest.groovy | 12 ++++-------- src/test/groovy/generated/CanonicalGeneratedTest.groovy | 12 ++++-------- src/test/groovy/generated/ConstructorsGeneratedTest.groovy | 12 ++++-------- src/test/groovy/generated/GroovyObjectGeneratedTest.groovy | 6 +----- src/test/groovy/generated/ImmutableGeneratedTest.groovy | 12 ++++-------- src/test/groovy/generated/PropertiesGeneratedTest.groovy | 12 ++++-------- src/test/groovy/generated/SortableGeneratedTest.groovy | 12 ++++-------- 10 files changed, 37 insertions(+), 66 deletions(-) diff --git a/gradle/pomconfigurer.gradle b/gradle/pomconfigurer.gradle index a387845..b9586cb 100644 --- a/gradle/pomconfigurer.gradle +++ b/gradle/pomconfigurer.gradle @@ -298,6 +298,7 @@ project.ext.pomConfigureClosureWithoutTweaks = { email '[email protected]' roles { role 'Developer' + role 'Despot' } } developer { @@ -346,7 +347,6 @@ project.ext.pomConfigureClosureWithoutTweaks = { email '[email protected]' roles { role 'Developer' - role 'Despot' } } developer { @@ -824,6 +824,9 @@ project.ext.pomConfigureClosureWithoutTweaks = { contributor { name 'Sean Timm' } + contributor { + name 'Dmitry Vyazelenko' + } } mailingLists { mailingList { diff --git a/src/test/groovy/generated/AbstractGeneratedAstTestCase.groovy b/src/test/groovy/generated/AbstractGeneratedAstTestCase.groovy index f96d2f0..b6f2fbb 100644 --- a/src/test/groovy/generated/AbstractGeneratedAstTestCase.groovy +++ b/src/test/groovy/generated/AbstractGeneratedAstTestCase.groovy @@ -6,12 +6,12 @@ import groovy.transform.Generated import java.lang.reflect.Constructor import java.lang.reflect.Method -/** - * @author Dmitry Vyazelenko - * @author Andres Almiray - */ @CompileStatic abstract class AbstractGeneratedAstTestCase { + protected final Class<?> parseClass(String str) { + new GroovyClassLoader().parseClass(str.stripMargin()) + } + protected final void assertConstructorIsAnnotated(Class<?> classUnderTest, Class... paramTypes) { assert findConstructor(classUnderTest, paramTypes).getAnnotation(Generated) } diff --git a/src/test/groovy/generated/AutoCloneGeneratedTest.groovy b/src/test/groovy/generated/AutoCloneGeneratedTest.groovy index a8aaab2..a18c329 100644 --- a/src/test/groovy/generated/AutoCloneGeneratedTest.groovy +++ b/src/test/groovy/generated/AutoCloneGeneratedTest.groovy @@ -4,20 +4,16 @@ import groovy.transform.CompileStatic import org.junit.Ignore import org.junit.Test -/** - * @author Dmitry Vyazelenko - * @author Andres Almiray - */ @CompileStatic class AutoCloneGeneratedTest extends AbstractGeneratedAstTestCase { - final Class<?> implicitAutoClone = new GroovyClassLoader().parseClass('''@groovy.transform.AutoClone + final Class<?> implicitAutoClone = parseClass('''@groovy.transform.AutoClone |class ClassUnderTest { - |}'''.stripMargin()) + |}''') - final Class<?> explicitAutoClone = new GroovyClassLoader().parseClass('''@groovy.transform.AutoClone + final Class<?> explicitAutoClone = parseClass('''@groovy.transform.AutoClone |class ClassUnderTest { | Object clone() throws java.lang.CloneNotSupportedException { null } - |}'''.stripMargin()) + |}''') @Test void test_clone_is_annotated() { diff --git a/src/test/groovy/generated/AutoExternalizeGeneratedTest.groovy b/src/test/groovy/generated/AutoExternalizeGeneratedTest.groovy index a9a90c0..e49d711 100644 --- a/src/test/groovy/generated/AutoExternalizeGeneratedTest.groovy +++ b/src/test/groovy/generated/AutoExternalizeGeneratedTest.groovy @@ -4,21 +4,17 @@ import groovy.transform.CompileStatic import org.junit.Ignore import org.junit.Test -/** - * @author Dmitry Vyazelenko - * @author Andres Almiray - */ @CompileStatic class AutoExternalizeGeneratedTest extends AbstractGeneratedAstTestCase { - final Class<?> implicitAutoExternalize = new GroovyClassLoader().parseClass('''@groovy.transform.AutoExternalize + final Class<?> implicitAutoExternalize = parseClass('''@groovy.transform.AutoExternalize |class ClassUnderTest { - |}'''.stripMargin()) + |}''') - final Class<?> explicitAutoExternalize = new GroovyClassLoader().parseClass('''@groovy.transform.AutoExternalize + final Class<?> explicitAutoExternalize = parseClass('''@groovy.transform.AutoExternalize |class ClassUnderTest { | void writeExternal(ObjectOutput out) throws IOException { } | void readExternal(ObjectInput oin) { } - |}'''.stripMargin()) + |}''') @Test void test_writeExternal_is_annotated() { diff --git a/src/test/groovy/generated/CanonicalGeneratedTest.groovy b/src/test/groovy/generated/CanonicalGeneratedTest.groovy index 6d20d3c..17f0f62 100644 --- a/src/test/groovy/generated/CanonicalGeneratedTest.groovy +++ b/src/test/groovy/generated/CanonicalGeneratedTest.groovy @@ -3,19 +3,15 @@ package groovy.generated import groovy.transform.CompileStatic import org.junit.Test -/** - * @author Dmitry Vyazelenko - * @author Andres Almiray - */ @CompileStatic class CanonicalGeneratedTest extends AbstractGeneratedAstTestCase { - final Class<?> implicitCanonical = new GroovyClassLoader().parseClass('''@groovy.transform.Canonical + final Class<?> implicitCanonical = parseClass('''@groovy.transform.Canonical |class ClassUnderTest { | String name | int age - |}'''.stripMargin()) + |}''') - final Class<?> explicitCanonical = new GroovyClassLoader().parseClass('''@groovy.transform.Canonical + final Class<?> explicitCanonical = parseClass('''@groovy.transform.Canonical |class ClassUnderTest { | String name | int age @@ -23,7 +19,7 @@ class CanonicalGeneratedTest extends AbstractGeneratedAstTestCase { | boolean equals(Object o) { false } | int hashCode() { 42 } | String toString() { '' } - |}'''.stripMargin()) + |}''') @Test void test_noArg_constructor_is_annotated() { diff --git a/src/test/groovy/generated/ConstructorsGeneratedTest.groovy b/src/test/groovy/generated/ConstructorsGeneratedTest.groovy index 7d350ea..e0fe9d0 100644 --- a/src/test/groovy/generated/ConstructorsGeneratedTest.groovy +++ b/src/test/groovy/generated/ConstructorsGeneratedTest.groovy @@ -3,18 +3,14 @@ package groovy.generated import groovy.transform.CompileStatic import org.junit.Test -/** - * @author Dmitry Vyazelenko - * @author Andres Almiray - */ @CompileStatic class ConstructorsGeneratedTest extends AbstractGeneratedAstTestCase { - final Class<?> noExplicitConstructors = new GroovyClassLoader().parseClass('''class ClassUnderTest { - |}'''.stripMargin()) + final Class<?> noExplicitConstructors = parseClass('''class ClassUnderTest { + |}''') - final Class<?> explicitNoArgConstructor = new GroovyClassLoader().parseClass('''class ClassUnderTest { + final Class<?> explicitNoArgConstructor = parseClass('''class ClassUnderTest { | ClassUnderTest() { } - |}'''.stripMargin()) + |}''') @Test void test_default_constructors_are_annotated() { diff --git a/src/test/groovy/generated/GroovyObjectGeneratedTest.groovy b/src/test/groovy/generated/GroovyObjectGeneratedTest.groovy index 7c473ef..936bc81 100644 --- a/src/test/groovy/generated/GroovyObjectGeneratedTest.groovy +++ b/src/test/groovy/generated/GroovyObjectGeneratedTest.groovy @@ -3,13 +3,9 @@ package groovy.generated import groovy.transform.CompileStatic import org.junit.Test -/** - * @author Dmitry Vyazelenko - * @author Andres Almiray - */ @CompileStatic class GroovyObjectGeneratedTest extends AbstractGeneratedAstTestCase { - final Class<?> classUnderTest = new GroovyClassLoader().parseClass('class MyClass { }') + final Class<?> classUnderTest = parseClass('class MyClass { }') @Test void test_invokeMethod_is_annotated() { diff --git a/src/test/groovy/generated/ImmutableGeneratedTest.groovy b/src/test/groovy/generated/ImmutableGeneratedTest.groovy index 09ae409..7af3052 100644 --- a/src/test/groovy/generated/ImmutableGeneratedTest.groovy +++ b/src/test/groovy/generated/ImmutableGeneratedTest.groovy @@ -3,26 +3,22 @@ package groovy.generated import groovy.transform.CompileStatic import org.junit.Test -/** - * @author Dmitry Vyazelenko - * @author Andres Almiray - */ @CompileStatic class ImmutableGeneratedTest extends AbstractGeneratedAstTestCase { - final Class<?> implicitImmutable = new GroovyClassLoader().parseClass('''@groovy.transform.Immutable + final Class<?> implicitImmutable = parseClass('''@groovy.transform.Immutable |class ClassUnderTest { | String name | int age - |}'''.stripMargin()) + |}''') - final Class<?> explicitImmutable = new GroovyClassLoader().parseClass('''@groovy.transform.Immutable + final Class<?> explicitImmutable = parseClass('''@groovy.transform.Immutable |class ClassUnderTest { | String name | int age | boolean equals(Object o) { false } | int hashCode() { 42 } | String toString() { '' } - |}'''.stripMargin()) + |}''') @Test void test_noArg_constructor_is_annotated() { diff --git a/src/test/groovy/generated/PropertiesGeneratedTest.groovy b/src/test/groovy/generated/PropertiesGeneratedTest.groovy index 07e90e8..8226a62 100644 --- a/src/test/groovy/generated/PropertiesGeneratedTest.groovy +++ b/src/test/groovy/generated/PropertiesGeneratedTest.groovy @@ -3,21 +3,17 @@ package groovy.generated import groovy.transform.CompileStatic import org.junit.Test -/** - * @author Dmitry Vyazelenko - * @author Andres Almiray - */ @CompileStatic class PropertiesGeneratedTest extends AbstractGeneratedAstTestCase { - final Class<?> withProps = new GroovyClassLoader().parseClass('''class WithProps { + final Class<?> withProps = parseClass('''class WithProps { | String name - |}'''.stripMargin()) + |}''') - final Class<?> withExplicitProps = new GroovyClassLoader().parseClass('''class WithExplicitProps { + final Class<?> withExplicitProps = parseClass('''class WithExplicitProps { | private String name | String getName() { name } | void setName(String n) { name = n } - |}'''.stripMargin()) + |}''') @Test void test_implicit_getName_is_annotated() { diff --git a/src/test/groovy/generated/SortableGeneratedTest.groovy b/src/test/groovy/generated/SortableGeneratedTest.groovy index 5019c15..120f710 100644 --- a/src/test/groovy/generated/SortableGeneratedTest.groovy +++ b/src/test/groovy/generated/SortableGeneratedTest.groovy @@ -4,25 +4,21 @@ import groovy.transform.CompileStatic import org.junit.Ignore import org.junit.Test -/** - * @author Dmitry Vyazelenko - * @author Andres Almiray - */ @CompileStatic class SortableGeneratedTest extends AbstractGeneratedAstTestCase { - final Class<?> implicitSortable = new GroovyClassLoader().parseClass('''@groovy.transform.Sortable + final Class<?> implicitSortable = parseClass('''@groovy.transform.Sortable |class ClassUnderTest { | String name | int age - |}'''.stripMargin()) + |}''') - final Class<?> explicitSortable = new GroovyClassLoader().parseClass('''@groovy.transform.Sortable + final Class<?> explicitSortable = parseClass('''@groovy.transform.Sortable |class ClassUnderTest { | String name | int age | int compareTo(Object o) { 42 } | int compareTo(ClassUnderTest o) { 42 } - |}'''.stripMargin()) + |}''') @Test void test_compareTo_is_annotated() {
