Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-5196

[classlib][luni][gut] EnumSet.elementType field doesn't exist

    XMLWordPrintableJSON

Details

    • Patch Available

    Description

      When running Geronimo Unit Tests v2.0.2, the following exception occurs:

      java.lang.RuntimeException: Could not access java.util.EnumSet.elementType field
      at com.thoughtworks.xstream.core.util.Fields.find(Fields.java:18)
      at com.thoughtworks.xstream.converters.enums.EnumSetConverter.<init>(EnumSetConverter.java:31)
      at java.lang.reflect.VMReflection.newClassInstance(VMReflection.java)

      Here's the simple code to reproduce:

      public class Test {
      public static void main(String[] args) {
      try

      { System.out.println("SUCCESS: " + java.util.EnumSet.class.getDeclaredField("elementType")); }

      catch (Exception e)

      { e.printStackTrace(System.out); }

      }
      }

      Output on RI:

      SUCCESS: final java.lang.Class java.util.EnumSet.elementType

      Output on Harmony:

      java.lang.NoSuchFieldException: elementType
      at java.lang.Class.getDeclaredField(Class.java:373)
      at Test.main(Test.java:4)

      Clearly enough, the mentioned field is package private, it's not covered by the spec, and probably it contains the element type of the EnumSet.

      Addressing such a field in an application is clearly a bug, and it should be reported to XStream developers (http://xstream.codehaus.org).

      However, as this issue occurred, I think it worths to behave compatibly. Harmony implementation of EnumSet has elementClass field that seems to be the equivalent of RI's elementType field. So my suggestion is to rename elementClass to elementType and thus become more compatible and move GUT v2.0 enabling forward.

      Attachments

        1. Harmony-5196.patch
          2 kB
          Vasily Zakharov

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vmz Vasily Zakharov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: