Vasily Zakharov (JIRA) wrote:
> [classlib][luni][gut] EnumSet.elementType field doesn't exist
> -------------------------------------------------------------
>
> Key: HARMONY-5196
> URL: https://issues.apache.org/jira/browse/HARMONY-5196
> Project: Harmony
> Issue Type: Bug
> Components: App-Oriented Bug Reports, Classlib
> Reporter: Vasily Zakharov
>
>
> 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.
See
http://jira.codehaus.org/browse/XSTR-379
Regards,
Tim