This is an automated email from the ASF dual-hosted git repository. benw pushed a commit to branch gradle-improvements-javax in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
commit c7e338116edf4b0dd01e5dc241782a52e2b8241b Author: Ben Weidig <[email protected]> AuthorDate: Sun Aug 24 12:01:04 2025 +0200 TAP5-2809: fix plastic tests that rely on Groovy quirks --- .../tapestry5/plastic/FieldPropertyMethodCreation.groovy | 14 +++++++++----- .../apache/tapestry5/plastic/MethodAnnotationAccess.groovy | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldPropertyMethodCreation.groovy b/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldPropertyMethodCreation.groovy index 62627d885..3a4fd3e3f 100644 --- a/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldPropertyMethodCreation.groovy +++ b/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldPropertyMethodCreation.groovy @@ -3,10 +3,12 @@ package org.apache.tapestry5.plastic import spock.lang.Issue import testannotations.Property import testsubjects.AccessorsAlreadyExistSubject -import testsubjects.AccessorsAlreadyExistSubject2; +import testsubjects.AccessorsAlreadyExistSubject2 import testsubjects.CreateAccessorsSubject import testsubjects.GenericCreateAccessorsSubject +import java.lang.invoke.MethodType +import java.lang.reflect.* import java.util.concurrent.atomic.AtomicReference class FieldPropertyMethodCreation extends AbstractPlasticSpecification @@ -70,12 +72,10 @@ class FieldPropertyMethodCreation extends AbstractPlasticSpecification assert o.refValue == "Plastic" def get = o.class.getMethod("getRef") - get.signature == "()Ljava/util/concurrent/atomic/AtomicReference<Ljava/lang/String;>;" - get.genericInfo != null + getSignature(get) == "()Ljava/util/concurrent/atomic/AtomicReference;" def set = o.class.getMethod("setRef", AtomicReference) - set.signature == "(Ljava/util/concurrent/atomic/AtomicReference<Ljava/lang/String;>;)V" - set.genericInfo != null + getSignature(set) == "(Ljava/util/concurrent/atomic/AtomicReference;)V" } def "create getter that already exists"() { @@ -114,4 +114,8 @@ class FieldPropertyMethodCreation extends AbstractPlasticSpecification assert e.message == "Unable to create new accessor method public void setValue(java.lang.String) on class testsubjects.AccessorsAlreadyExistSubject as the method is already implemented." } + + private def getSignature(Method m) { + MethodType.methodType(m.returnType, m.parameterTypes).toMethodDescriptorString() + } } diff --git a/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAnnotationAccess.groovy b/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAnnotationAccess.groovy index baa11488a..33b2c5b61 100644 --- a/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAnnotationAccess.groovy +++ b/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAnnotationAccess.groovy @@ -20,7 +20,7 @@ class MethodAnnotationAccess extends AbstractPlasticSpecification { then: - methods.size == 2 + methods.size() == 2 noMethod.description.methodName == "no" yesMethod.description.methodName == "yes" @@ -34,7 +34,7 @@ class MethodAnnotationAccess extends AbstractPlasticSpecification { def methods = pc.getMethodsWithAnnotation(PrimitiveValues) then: - methods.size == 1 + methods.size() == 1 when: def pv = methods[0].getAnnotation(PrimitiveValues)
