Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6627362

javac generates code that uses array.clone, which is not available on JavaCard

XMLWordPrintable

    • b34
    • generic
    • generic
    • Not verified

        JavaCard does not support clone() for arrays, which causes problems for enums.
        It would be nice if javac could generate different code for the values() method that does not rely on array.clone().

        For example, replace the following:
            public static Color[] values() {
                return (Color[]) $VALUES.clone();
            }

        with this:
            public static Color[] values() {
              Color[] copy = new Color[$VALUES.length];
              System.arraycopy($VALUES, 0,
                               copy, 0,
                               $VALUES.length);
              return copy;
            }

              jjg Jonathan Gibbons
              jjg Jonathan Gibbons
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: