Uploaded image for project: 'CDI TCK'
  1. CDI TCK
  2. CDITCK-626

EnvInjectionTest.testResourceBeanTypes() doesn't work with JDK12

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.1.0.Final, 2.0.6.Final
    • 2.0.5.SP1
    • Tests
    • None
    • Linux x86_64, Weblogic 12c with JDK12

      Error message is:
      >>>>
      java.lang.AssertionError
      at org.jboss.cdi.tck.tests.implementation.simple.resource.env.EnvInjectionTest.testResourceBeanTypes(EnvInjectionTest.java:83)
      <<<<

      The case fails in bean types counting:
      >>>>
      package org.jboss.cdi.tck.tests.implementation.simple.resource.env;
      ...
      public class EnvInjectionTest extends AbstractTest {
      ...
      public void testResourceBeanTypes() {
      @SuppressWarnings("serial")
      Bean<String> greeting = getBeans(String.class, new AnnotationLiteral<Greeting>() {
      }).iterator().next();
      assert greeting.getTypes().size() == 5; # Line83, assertionError occurs here
      assert rawTypeSetMatches(greeting.getTypes(), String.class, Object.class, Serializable.class, Comparable.class,
      CharSequence.class);
      }
      }
      <<<<

      The reason of the issue should be:
      Before JDK12, class java.lang.String in JavaDoc looks like:

      Class String
      java.lang.Object
      java.lang.String
      All Implemented Interfaces:
      Serializable, CharSequence, Comparable<String>

      But it changed in JDK12:

      Class String
      java.lang.Object
      java.lang.String
      All Implemented Interfaces:
      Serializable, CharSequence, Comparable<String>, Constable, ConstantDesc

      So with JDK12, "greeting.getTypes().size()" is 7 instead of 5, which causes the assertion. Could we add tolerance mechanic for this?

      Thanks.
      -X.O.

              nziakova@redhat.com Nikoleta Ziakova (Inactive)
              sunxiaoou sun xiaoou (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: