Bug 110103 - [1.5][compiler] annotation on enum value are not present in bytecode
Summary: [1.5][compiler] annotation on enum value are not present in bytecode
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.2 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-20 16:58 EDT by Rémi Forax CLA
Modified: 2005-09-23 14:31 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rémi Forax CLA 2005-09-20 16:58:25 EDT
The following code works with javac not with eclipse.

desired output (with javac as compiler):
public static final fr.umlv.annotation.Truc fr.umlv.annotation.Truc.machin
[@fr.umlv.annotation.Bidule(value=machin)]
public static final fr.umlv.annotation.Truc fr.umlv.annotation.Truc.muche
[@fr.umlv.annotation.Bidule(value=muche)]

current output (with eclipse as compiler):
public static final fr.umlv.annotation.Truc fr.umlv.annotation.Truc.machin []
public static final fr.umlv.annotation.Truc fr.umlv.annotation.Truc.muche []

It seems that eclipse forgets to add attributes corresponding
to annotation in the generated bytecode in case of enum values.

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface Bidule {
  String value();
}

import java.lang.reflect.Field;
import java.util.Arrays;

enum Truc {
  @Bidule("machin")machin,
  @Bidule("muche")muche;
  
  public static void main(String[] args) {
    for(Field f:Truc.class.getFields())
      System.out.println(f+" "+Arrays.toString(f.getAnnotations()));
  }
 } 

Rémi Forax
Comment 1 Olivier Thomann CLA 2005-09-20 19:23:09 EDT
I will investigate.
Comment 2 Olivier Thomann CLA 2005-09-20 20:18:35 EDT
I don't understand.
I tried with 3.1 and latest from HEAD and I could not reproduce.
I get:
public static final Truc Truc.machin [@Bidule(value=machin)]
public static final Truc Truc.muche [@Bidule(value=muche)]

So it seems to work fine.
Remi, could you please give me your build id?
Did you compile everything from source?
Thanks for your help.
Comment 3 Rémi Forax CLA 2005-09-21 08:52:34 EDT
it works on windows (Build id: I20050811-1530)
but not on linux (Build id: I20050811-1530).

weird ??
Comment 4 Olivier Thomann CLA 2005-09-21 08:55:18 EDT
Could it be a bug in the VM? Have you tried to run on Windows the .class files
generated on Linux?
They should be identical.
Comment 5 Rémi Forax CLA 2005-09-21 09:39:56 EDT
it's not a VM Error, the class file seems to contain
the corresponding annotation attribute but
declared as a RuntimeInvisibleAnnotations.

i've tested the class copied from linux on my windows box
and it failed.

verbose output from javap:
C:\eclipse\workspace\java-de-base\src>javap -verbose -classpath ../classes fr.um
lv.annotation.Truc
Compiled from "Truc.java"
final class fr.umlv.annotation.Truc extends java.lang.Enum
  Signature: length = 0x2
   00 2D
  SourceFile: "Truc.java"
  minor version: 0
  major version: 49
  Constant pool:
const #1 = Field        #4.#48; //  fr/umlv/annotation/Truc.$VALUES:[Lfr/umlv/an
notation/Truc;
const #2 = Method       #49.#50;        //  "[Lfr/umlv/annotation/Truc;".clone:(
)Ljava/lang/Object;
const #3 = class        #31;    //  "[Lfr/umlv/annotation/Truc;"
const #4 = class        #51;    //  fr/umlv/annotation/Truc
const #5 = Method       #23.#52;        //  java/lang/Enum.valueOf:(Ljava/lang/C
lass;Ljava/lang/String;)Ljava/lang/Enum;
const #6 = Method       #23.#53;        //  java/lang/Enum."<init>":(Ljava/lang/
String;I)V
const #7 = Method       #54.#55;        //  java/lang/Class.getFields:()[Ljava/l
ang/reflect/Field;
const #8 = Field        #56.#57;        //  java/lang/System.out:Ljava/io/PrintS
tream;
const #9 = class        #58;    //  java/lang/StringBuilder
const #10 = Method      #9.#59; //  java/lang/StringBuilder."<init>":()V
const #11 = Method      #9.#60; //  java/lang/StringBuilder.append:(Ljava/lang/O
bject;)Ljava/lang/StringBuilder;
const #12 = String      #61;    //
const #13 = Method      #9.#62; //  java/lang/StringBuilder.append:(Ljava/lang/S
tring;)Ljava/lang/StringBuilder;
const #14 = Method      #63.#64;        //  java/lang/reflect/Field.getAnnotatio
ns:()[Ljava/lang/annotation/Annotation;
const #15 = Method      #65.#66;        //  java/util/Arrays.toString:([Ljava/la
ng/Object;)Ljava/lang/String;
const #16 = Method      #9.#67; //  java/lang/StringBuilder.toString:()Ljava/lan
g/String;
const #17 = Method      #68.#69;        //  java/io/PrintStream.println:(Ljava/l
ang/String;)V
const #18 = String      #24;    //  machin
const #19 = Method      #4.#70; //  fr/umlv/annotation/Truc."<init>":(Ljava/lang
/String;I)V
const #20 = Field       #4.#71; //  fr/umlv/annotation/Truc.machin:Lfr/umlv/anno
tation/Truc;
const #21 = String      #29;    //  muche
const #22 = Field       #4.#72; //  fr/umlv/annotation/Truc.muche:Lfr/umlv/annot
ation/Truc;
const #23 = class       #73;    //  java/lang/Enum
const #24 = Asciz       machin;
const #25 = Asciz       Lfr/umlv/annotation/Truc;;
const #26 = Asciz       RuntimeInvisibleAnnotations;
const #27 = Asciz       Lfr/umlv/annotation/Bidule;;
const #28 = Asciz       value;
const #29 = Asciz       muche;
const #30 = Asciz       $VALUES;
const #31 = Asciz       [Lfr/umlv/annotation/Truc;;
const #32 = Asciz       values;
const #33 = Asciz       ()[Lfr/umlv/annotation/Truc;;
const #34 = Asciz       Code;
const #35 = Asciz       LineNumberTable;
const #36 = Asciz       valueOf;
const #37 = Asciz       (Ljava/lang/String;)Lfr/umlv/annotation/Truc;;
const #38 = Asciz       <init>;
const #39 = Asciz       (Ljava/lang/String;I)V;
const #40 = Asciz       Signature;
const #41 = Asciz       ()V;
const #42 = Asciz       main;
const #43 = Asciz       ([Ljava/lang/String;)V;
const #44 = Asciz       <clinit>;
const #45 = Asciz       Ljava/lang/Enum<Lfr/umlv/annotation/Truc;>;;
const #46 = Asciz       SourceFile;
const #47 = Asciz       Truc.java;
const #48 = NameAndType #30:#31;//  $VALUES:[Lfr/umlv/annotation/Truc;
const #49 = class       #31;    //  "[Lfr/umlv/annotation/Truc;"
const #50 = NameAndType #74:#75;//  clone:()Ljava/lang/Object;
const #51 = Asciz       fr/umlv/annotation/Truc;
const #52 = NameAndType #36:#76;//  valueOf:(Ljava/lang/Class;Ljava/lang/String;
)Ljava/lang/Enum;
const #53 = NameAndType #38:#39;//  "<init>":(Ljava/lang/String;I)V
const #54 = class       #77;    //  java/lang/Class
const #55 = NameAndType #78:#79;//  getFields:()[Ljava/lang/reflect/Field;
const #56 = class       #80;    //  java/lang/System
const #57 = NameAndType #81:#82;//  out:Ljava/io/PrintStream;
const #58 = Asciz       java/lang/StringBuilder;
const #59 = NameAndType #38:#41;//  "<init>":()V
const #60 = NameAndType #83:#84;//  append:(Ljava/lang/Object;)Ljava/lang/String
Builder;
const #61 = Asciz        ;
const #62 = NameAndType #83:#85;//  append:(Ljava/lang/String;)Ljava/lang/String
Builder;
const #63 = class       #86;    //  java/lang/reflect/Field
const #64 = NameAndType #87:#88;//  getAnnotations:()[Ljava/lang/annotation/Anno
tation;
const #65 = class       #89;    //  java/util/Arrays
const #66 = NameAndType #90:#91;//  toString:([Ljava/lang/Object;)Ljava/lang/Str
ing;
const #67 = NameAndType #90:#92;//  toString:()Ljava/lang/String;
const #68 = class       #93;    //  java/io/PrintStream
const #69 = NameAndType #94:#95;//  println:(Ljava/lang/String;)V
const #70 = NameAndType #38:#39;//  "<init>":(Ljava/lang/String;I)V
const #71 = NameAndType #24:#25;//  machin:Lfr/umlv/annotation/Truc;
const #72 = NameAndType #29:#25;//  muche:Lfr/umlv/annotation/Truc;
const #73 = Asciz       java/lang/Enum;
const #74 = Asciz       clone;
const #75 = Asciz       ()Ljava/lang/Object;;
const #76 = Asciz       (Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;;
const #77 = Asciz       java/lang/Class;
const #78 = Asciz       getFields;
const #79 = Asciz       ()[Ljava/lang/reflect/Field;;
const #80 = Asciz       java/lang/System;
const #81 = Asciz       out;
const #82 = Asciz       Ljava/io/PrintStream;;
const #83 = Asciz       append;
const #84 = Asciz       (Ljava/lang/Object;)Ljava/lang/StringBuilder;;
const #85 = Asciz       (Ljava/lang/String;)Ljava/lang/StringBuilder;;
const #86 = Asciz       java/lang/reflect/Field;
const #87 = Asciz       getAnnotations;
const #88 = Asciz       ()[Ljava/lang/annotation/Annotation;;
const #89 = Asciz       java/util/Arrays;
const #90 = Asciz       toString;
const #91 = Asciz       ([Ljava/lang/Object;)Ljava/lang/String;;
const #92 = Asciz       ()Ljava/lang/String;;
const #93 = Asciz       java/io/PrintStream;
const #94 = Asciz       println;
const #95 = Asciz       (Ljava/lang/String;)V;

{
public static final fr.umlv.annotation.Truc machin;
  RuntimeInvisibleAnnotations: length = 0xB
   00 01 00 1B 00 01 00 1C 73 00 18

public static final fr.umlv.annotation.Truc muche;
  RuntimeInvisibleAnnotations: length = 0xB
   00 01 00 1B 00 01 00 1C 73 00 1D

public static final fr.umlv.annotation.Truc[] values();
  Code:
   Stack=1, Locals=0, Args_size=0
   0:   getstatic       #1; //Field $VALUES:[Lfr/umlv/annotation/Truc;
   3:   invokevirtual   #2; //Method "[Lfr/umlv/annotation/Truc;".clone:()Ljava/
lang/Object;
   6:   checkcast       #3; //class "[Lfr/umlv/annotation/Truc;"
   9:   areturn
  LineNumberTable:
   line 6: 0

public static fr.umlv.annotation.Truc valueOf(java.lang.String);
  Code:
   Stack=2, Locals=1, Args_size=1
   0:   ldc_w   #4; //class fr/umlv/annotation/Truc
   3:   aload_0
   4:   invokestatic    #5; //Method java/lang/Enum.valueOf:(Ljava/lang/Class;Lj
ava/lang/String;)Ljava/lang/Enum;
   7:   checkcast       #4; //class fr/umlv/annotation/Truc
   10:  areturn
  LineNumberTable:
   line 6: 0

public static void main(java.lang.String[]);
  Code:
   Stack=3, Locals=5, Args_size=1
   0:   ldc_w   #4; //class fr/umlv/annotation/Truc
   3:   invokevirtual   #7; //Method java/lang/Class.getFields:()[Ljava/lang/ref
lect/Field;
   6:   astore_1
   7:   aload_1
   8:   arraylength
   9:   istore_2
   10:  iconst_0
   11:  istore_3
   12:  iload_3
   13:  iload_2
   14:  if_icmpge       65
   17:  aload_1
   18:  iload_3
   19:  aaload
   20:  astore  4
   22:  getstatic       #8; //Field java/lang/System.out:Ljava/io/PrintStream;
   25:  new     #9; //class java/lang/StringBuilder
   28:  dup
   29:  invokespecial   #10; //Method java/lang/StringBuilder."<init>":()V
   32:  aload   4
   34:  invokevirtual   #11; //Method java/lang/StringBuilder.append:(Ljava/lang
/Object;)Ljava/lang/StringBuilder;
   37:  ldc     #12; //String
   39:  invokevirtual   #13; //Method java/lang/StringBuilder.append:(Ljava/lang
/String;)Ljava/lang/StringBuilder;
   42:  aload   4
   44:  invokevirtual   #14; //Method java/lang/reflect/Field.getAnnotations:()[
Ljava/lang/annotation/Annotation;
   47:  invokestatic    #15; //Method java/util/Arrays.toString:([Ljava/lang/Obj
ect;)Ljava/lang/String;
   50:  invokevirtual   #13; //Method java/lang/StringBuilder.append:(Ljava/lang
/String;)Ljava/lang/StringBuilder;
   53:  invokevirtual   #16; //Method java/lang/StringBuilder.toString:()Ljava/l
ang/String;
   56:  invokevirtual   #17; //Method java/io/PrintStream.println:(Ljava/lang/St
ring;)V
   59:  iinc    3, 1
   62:  goto    12
   65:  return
  LineNumberTable:
   line 11: 0
   line 12: 22
   line 11: 59
   line 13: 65

static {};
  Code:
   Stack=4, Locals=0, Args_size=0
   0:   new     #4; //class fr/umlv/annotation/Truc
   3:   dup
   4:   ldc     #18; //String machin
   6:   iconst_0
   7:   invokespecial   #19; //Method "<init>":(Ljava/lang/String;I)V
   10:  putstatic       #20; //Field machin:Lfr/umlv/annotation/Truc;
   13:  new     #4; //class fr/umlv/annotation/Truc
   16:  dup
   17:  ldc     #21; //String muche
   19:  iconst_1
   20:  invokespecial   #19; //Method "<init>":(Ljava/lang/String;I)V
   23:  putstatic       #22; //Field muche:Lfr/umlv/annotation/Truc;
   26:  iconst_2
   27:  anewarray       #4; //class fr/umlv/annotation/Truc
   30:  dup
   31:  iconst_0
   32:  getstatic       #20; //Field machin:Lfr/umlv/annotation/Truc;
   35:  aastore
   36:  dup
   37:  iconst_1
   38:  getstatic       #22; //Field muche:Lfr/umlv/annotation/Truc;
   41:  aastore
   42:  putstatic       #1; //Field $VALUES:[Lfr/umlv/annotation/Truc;
   45:  return
  LineNumberTable:
   line 7: 0
   line 8: 13
   line 6: 26

}
Comment 6 Olivier Thomann CLA 2005-09-21 10:17:01 EDT
I will investigate using the latest code on Linux. I cannot get the build you
are using anymore. It is too old.
Thanks for your feedback.
Comment 7 Olivier Thomann CLA 2005-09-23 14:22:56 EDT
I get:
public static final Truc Truc.machin [@Bidule(value=machin)]
public static final Truc Truc.muche [@Bidule(value=muche)]

I cannot reproduce on Linux using build I20050923-1000.

Here is what I get when I disassemble Truc.class.
// Compiled from Truc.java (version 1.5 : 49.0, super bit)
// Signature: Ljava/lang/Enum<LTruc;>;
final enum Truc extends java.lang.Enum {
  Constant pool:
    constant #1 class: #2 Truc
    constant #2 utf8: Truc
    constant #3 class: #4 java/lang/Enum
    constant #4 utf8: java/lang/Enum
    constant #5 utf8: machin
    constant #6 utf8: LTruc;
    constant #7 utf8: RuntimeVisibleAnnotations
    constant #8 utf8: LBidule;
    constant #9 utf8: value
    constant #10 utf8: muche
    constant #11 utf8: ENUM$VALUES
    constant #12 utf8: [LTruc;
    constant #13 utf8: class$0
    constant #14 utf8: Ljava/lang/Class;
    constant #15 utf8: <clinit>
    constant #16 utf8: ()V
    constant #17 utf8: Code
    constant #18 string: #5 machin
    constant #19 method_ref: #1.#20 Truc.<init> (Ljava/lang/String;I)V
    constant #20 name_and_type: #21.#22 <init> (Ljava/lang/String;I)V
    constant #21 utf8: <init>
    constant #22 utf8: (Ljava/lang/String;I)V
    constant #23 field_ref: #1.#24 Truc.machin LTruc;
    constant #24 name_and_type: #5.#6 machin LTruc;
    constant #25 string: #10 muche
    constant #26 field_ref: #1.#27 Truc.muche LTruc;
    constant #27 name_and_type: #10.#6 muche LTruc;
    constant #28 field_ref: #1.#29 Truc.ENUM$VALUES [LTruc;
    constant #29 name_and_type: #11.#12 ENUM$VALUES [LTruc;
    constant #30 utf8: LineNumberTable
    constant #31 utf8: LocalVariableTable
    constant #32 method_ref: #3.#20 java/lang/Enum.<init> (Ljava/lang/String;I)V
    constant #33 utf8: this
    constant #34 utf8: main
    constant #35 utf8: ([Ljava/lang/String;)V
    constant #36 method_ref: #37.#39 java/lang/Class.getFields
()[Ljava/lang/reflect/Field;
    constant #37 class: #38 java/lang/Class
    constant #38 utf8: java/lang/Class
    constant #39 name_and_type: #40.#41 getFields ()[Ljava/lang/reflect/Field;
    constant #40 utf8: getFields
    constant #41 utf8: ()[Ljava/lang/reflect/Field;
    constant #42 field_ref: #43.#45 java/lang/System.out Ljava/io/PrintStream;
    constant #43 class: #44 java/lang/System
    constant #44 utf8: java/lang/System
    constant #45 name_and_type: #46.#47 out Ljava/io/PrintStream;
    constant #46 utf8: out
    constant #47 utf8: Ljava/io/PrintStream;
    constant #48 class: #49 java/lang/StringBuilder
    constant #49 utf8: java/lang/StringBuilder
    constant #50 method_ref: #48.#51 java/lang/StringBuilder.<init> ()V
    constant #51 name_and_type: #21.#16 <init> ()V
    constant #52 method_ref: #48.#53 java/lang/StringBuilder.append
(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    constant #53 name_and_type: #54.#55 append
(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    constant #54 utf8: append
    constant #55 utf8: (Ljava/lang/Object;)Ljava/lang/StringBuilder;
    constant #56 string: #57  
    constant #57 utf8:  
    constant #58 method_ref: #48.#59 java/lang/StringBuilder.append
(Ljava/lang/String;)Ljava/lang/StringBuilder;
    constant #59 name_and_type: #54.#60 append
(Ljava/lang/String;)Ljava/lang/StringBuilder;
    constant #60 utf8: (Ljava/lang/String;)Ljava/lang/StringBuilder;
    constant #61 method_ref: #62.#64 java/lang/reflect/Field.getAnnotations
()[Ljava/lang/annotation/Annotation;
    constant #62 class: #63 java/lang/reflect/Field
    constant #63 utf8: java/lang/reflect/Field
    constant #64 name_and_type: #65.#66 getAnnotations
()[Ljava/lang/annotation/Annotation;
    constant #65 utf8: getAnnotations
    constant #66 utf8: ()[Ljava/lang/annotation/Annotation;
    constant #67 method_ref: #68.#70 java/util/Arrays.toString
([Ljava/lang/Object;)Ljava/lang/String;
    constant #68 class: #69 java/util/Arrays
    constant #69 utf8: java/util/Arrays
    constant #70 name_and_type: #71.#72 toString
([Ljava/lang/Object;)Ljava/lang/String;
    constant #71 utf8: toString
    constant #72 utf8: ([Ljava/lang/Object;)Ljava/lang/String;
    constant #73 method_ref: #48.#74 java/lang/StringBuilder.toString
()Ljava/lang/String;
    constant #74 name_and_type: #71.#75 toString ()Ljava/lang/String;
    constant #75 utf8: ()Ljava/lang/String;
    constant #76 method_ref: #77.#79 java/io/PrintStream.println
(Ljava/lang/String;)V
    constant #77 class: #78 java/io/PrintStream
    constant #78 utf8: java/io/PrintStream
    constant #79 name_and_type: #80.#81 println (Ljava/lang/String;)V
    constant #80 utf8: println
    constant #81 utf8: (Ljava/lang/String;)V
    constant #82 utf8: args
    constant #83 utf8: [Ljava/lang/String;
    constant #84 utf8: f
    constant #85 utf8: Ljava/lang/reflect/Field;
    constant #86 utf8: values
    constant #87 utf8: ()[LTruc;
    constant #88 method_ref: #43.#89 java/lang/System.arraycopy
(Ljava/lang/Object;ILjava/lang/Object;II)V
    constant #89 name_and_type: #90.#91 arraycopy
(Ljava/lang/Object;ILjava/lang/Object;II)V
    constant #90 utf8: arraycopy
    constant #91 utf8: (Ljava/lang/Object;ILjava/lang/Object;II)V
    constant #92 utf8: valueOf
    constant #93 utf8: (Ljava/lang/String;)LTruc;
    constant #94 method_ref: #1.#95 Truc.name ()Ljava/lang/String;
    constant #95 name_and_type: #96.#75 name ()Ljava/lang/String;
    constant #96 utf8: name
    constant #97 method_ref: #98.#100 java/lang/String.equals (Ljava/lang/Object;)Z
    constant #98 class: #99 java/lang/String
    constant #99 utf8: java/lang/String
    constant #100 name_and_type: #101.#102 equals (Ljava/lang/Object;)Z
    constant #101 utf8: equals
    constant #102 utf8: (Ljava/lang/Object;)Z
    constant #103 class: #104 java/lang/IllegalArgumentException
    constant #104 utf8: java/lang/IllegalArgumentException
    constant #105 method_ref: #103.#106
java/lang/IllegalArgumentException.<init> (Ljava/lang/String;)V
    constant #106 name_and_type: #21.#81 <init> (Ljava/lang/String;)V
    constant #107 utf8: SourceFile
    constant #108 utf8: Truc.java
    constant #109 utf8: Signature
    constant #110 utf8: Ljava/lang/Enum<LTruc;>;
  
  // Field descriptor #6 LTruc;
  public static final enum Truc machin;
    RuntimeVisibleAnnotations: 
      #8 @Bidule(
        #9 value="machin" (constant type)
      )
  
  // Field descriptor #6 LTruc;
  public static final enum Truc muche;
    RuntimeVisibleAnnotations: 
      #8 @Bidule(
        #9 value="muche" (constant type)
      )
  
  // Field descriptor #12 [LTruc;
  private static final synthetic Truc[] ENUM$VALUES;
  
  // Field descriptor #14 Ljava/lang/Class;
  static synthetic java.lang.Class class$0;
  
  // Method descriptor #16 ()V
  // Stack: 8, Locals: 0
  static {};
     0  new Truc [1]
     3  dup
     4  ldc <String "machin"> [18]
     6  iconst_0
     7  invokespecial Truc(java.lang.String, int) [19]
    10  putstatic Truc.machin : Truc [23]
    13  new Truc [1]
    16  dup
    17  ldc <String "muche"> [25]
    19  iconst_1
    20  invokespecial Truc(java.lang.String, int) [19]
    23  putstatic Truc.muche : Truc [26]
    26  iconst_2
    27  anewarray Truc [1]
    30  dup
    31  iconst_0
    32  getstatic Truc.machin : Truc [23]
    35  aastore
    36  dup
    37  iconst_1
    38  getstatic Truc.muche : Truc [26]
    41  aastore
    42  putstatic Truc.ENUM$VALUES : Truc[] [28]
    45  return
      Line numbers:
        [pc: 0, line: 5]
        [pc: 13, line: 6]
        [pc: 26, line: 4]
  
  // Method descriptor #22 (Ljava/lang/String;I)V
  // Stack: 3, Locals: 3
  private Truc(String arg, int arg);
    0  aload_0 [this]
    1  aload_1
    2  iload_2
    3  invokespecial java.lang.Enum(java.lang.String, int) [32]
    6  return
      Line numbers:
        [pc: 0, line: 4]
      Local variable table:
        [pc: 0, pc: 7] local: this index: 0 type: Truc
  
  // Method descriptor #35 ([Ljava/lang/String;)V
  // Stack: 3, Locals: 5
  public static void main(String[] args);
     0  ldc <Class Truc> [1]
     2  invokevirtual java.lang.Class.getFields() : java.lang.reflect.Field[] [36]
     5  astore 4
     7  iconst_0
     8  istore_2
     9  aload 4
    11  arraylength
    12  istore_3
    13  goto 59
    16  aload 4
    18  iload_2
    19  aaload
    20  astore_1 [f]
    21  getstatic java.lang.System.out : java.io.PrintStream [42]
    24  new java.lang.StringBuilder [48]
    27  dup
    28  invokespecial java.lang.StringBuilder() [50]
    31  aload_1 [f]
    32  invokevirtual java.lang.StringBuilder.append(java.lang.Object) :
java.lang.StringBuilder [52]
    35  ldc <String " "> [56]
    37  invokevirtual java.lang.StringBuilder.append(java.lang.String) :
java.lang.StringBuilder [58]
    40  aload_1 [f]
    41  invokevirtual java.lang.reflect.Field.getAnnotations() :
java.lang.annotation.Annotation[] [61]
    44  invokestatic java.util.Arrays.toString(java.lang.Object[]) :
java.lang.String [67]
    47  invokevirtual java.lang.StringBuilder.append(java.lang.String) :
java.lang.StringBuilder [58]
    50  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [73]
    53  invokevirtual java.io.PrintStream.println(java.lang.String) : void [76]
    56  iinc 2 1
    59  iload_2
    60  iload_3
    61  if_icmplt 16
    64  return
      Line numbers:
        [pc: 0, line: 9]
        [pc: 21, line: 10]
        [pc: 56, line: 9]
        [pc: 64, line: 11]
      Local variable table:
        [pc: 0, pc: 65] local: args index: 0 type: java.lang.String[]
        [pc: 21, pc: 64] local: f index: 1 type: java.lang.reflect.Field
  
  // Method descriptor #87 ()[LTruc;
  // Stack: 5, Locals: 3
  public static final Truc[] values();
     0  getstatic Truc.ENUM$VALUES : Truc[] [28]
     3  dup
     4  astore_0
     5  iconst_0
     6  aload_0
     7  arraylength
     8  dup
     9  istore_1
    10  anewarray Truc [1]
    13  dup
    14  astore_2
    15  iconst_0
    16  iload_1
    17  invokestatic java.lang.System.arraycopy(java.lang.Object, int,
java.lang.Object, int, int) : void [88]
    20  aload_2
    21  areturn
      Line numbers:
        [pc: 0, line: 1]
  
  // Method descriptor #93 (Ljava/lang/String;)LTruc;
  // Stack: 3, Locals: 4
  public static final Truc valueOf(String arg);
     0  getstatic Truc.ENUM$VALUES : Truc[] [28]
     3  dup
     4  astore_1
     5  arraylength
     6  istore_2
     7  goto 27
    10  aload_0
    11  aload_1
    12  iload_2
    13  aaload
    14  dup
    15  astore_3
    16  invokevirtual Truc.name() : java.lang.String [94]
    19  invokevirtual java.lang.String.equals(java.lang.Object) : boolean [97]
    22  ifeq 27
    25  aload_3
    26  areturn
    27  iinc 2 -1
    30  iload_2
    31  ifge 10
    34  new java.lang.IllegalArgumentException [103]
    37  dup
    38  aload_0
    39  invokespecial java.lang.IllegalArgumentException(java.lang.String) [105]
    42  athrow
      Line numbers:
        [pc: 0, line: 1]
}

Could you please give it a try with the upcoming 3.2M2? I will also investigate
using the 3.1.1 maintenance stream.
Closing as WORKSFORME. Please reopen if you can reproduce it.
Comment 8 Olivier Thomann CLA 2005-09-23 14:31:44 EDT
Could not reproduce with latest in 3.1 maintenance (M20050923-0800).