This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to refs/heads/master by this push:
     new 64f886b2f Account for Java 12+ class hierarchy.
64f886b2f is described below

commit 64f886b2f74770809db4960c02fbdfb845c41030
Author: Volker Lamp <vl...@apache.org>
AuthorDate: Mon May 30 22:40:17 2022 +0200

    Account for Java 12+ class hierarchy.
---
 .../groovy/ioc/specs/InheritanceSearchSpec.groovy  | 50 +++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git 
a/tapestry-ioc/src/test/groovy/ioc/specs/InheritanceSearchSpec.groovy 
b/tapestry-ioc/src/test/groovy/ioc/specs/InheritanceSearchSpec.groovy
index 993b657fb..eb7819d2a 100644
--- a/tapestry-ioc/src/test/groovy/ioc/specs/InheritanceSearchSpec.groovy
+++ b/tapestry-ioc/src/test/groovy/ioc/specs/InheritanceSearchSpec.groovy
@@ -9,6 +9,7 @@ import org.apache.tapestry5.ioc.test.internal.util.ToyTruck
 import org.apache.tapestry5.ioc.test.internal.util.ToyTruckImpl
 import org.apache.tapestry5.plastic.PlasticUtils
 
+import spock.lang.IgnoreIf
 import spock.lang.Specification
 import spock.lang.Unroll
 
@@ -57,7 +58,6 @@ class InheritanceSearchSpec extends Specification {
 
     clazz        | expected
     Object       | [Object]
-    String       | [String, Serializable, Comparable, CharSequence, Object]
     Comparable   | [Comparable, Object]
     ToyTruck     | [ToyTruck, Playable, Drivable, Object]
     ToyTruckImpl | [ToyTruckImpl, PlayableImpl, DrivableImpl, Drivable, 
ToyTruck, Playable, Object]
@@ -72,4 +72,52 @@ class InheritanceSearchSpec extends Specification {
     expectedNames = expected.collect { PlasticUtils.toTypeName(it) }.join(", ")
 
   }
+
+  @IgnoreIf(value = { jvm.java12Compatible })
+  @Unroll
+  def "inheritance of #className is #expectedNames (Java < 12)"() {
+       def search = new InheritanceSearch(clazz)
+       def result = []
+       while (search.hasNext()) {
+         result << search.next()
+       }
+
+       expect:
+
+       result == expected
+
+       where:
+
+       clazz        | expected
+       String       | [String, Serializable, Comparable, CharSequence, Object]
+
+       className = PlasticUtils.toTypeName(clazz)
+       expectedNames = expected.collect { PlasticUtils.toTypeName(it) 
}.join(", ")
+
+  }
+
+    
+  @IgnoreIf(value = { !jvm.java12Compatible })
+  @Unroll
+  def "inheritance of #className is #expectedNames (Java 12+)"() {
+       def search = new InheritanceSearch(clazz)
+       def result = []
+       while (search.hasNext()) {
+         result << search.next()
+       }
+
+       expect:
+
+       result == expected
+
+       where:
+
+       clazz        | expected
+       String       | [String, Serializable, Comparable, CharSequence, 
Constable, ConstantDesc, Object]
+
+       className = PlasticUtils.toTypeName(clazz)
+       expectedNames = expected.collect { PlasticUtils.toTypeName(it) 
}.join(", ")
+
+  }
+
 }
\ No newline at end of file

Reply via email to