Bug 217907 - Compact mode in the disassembler should also work for annotation values
Summary: Compact mode in the disassembler should also work for annotation values
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-05 15:19 EST by Olivier Thomann CLA
Modified: 2008-03-26 12:40 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (15.15 KB, patch)
2008-02-05 15:26 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2008-02-05 15:19:13 EST
The following code:
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.*;
@Retention(CLASS)
@interface X {
	int value() default -1;
}

leads to this output by the disassembler:
// Compiled from X.java (version 1.5 : 49.0, no super bit)
@Retention(value=java.lang.annotation.RetentionPolicy.CLASS)
abstract @interface Annot extends Annotation {
  
  // Method descriptor #8 ()I
  public abstract int value() default (int) -1;

}

The annotation value should be:
RetentionPolicy.CLASS

in COMPACT mode.
Comment 1 Olivier Thomann CLA 2008-02-05 15:26:09 EST
Created attachment 88932 [details]
Proposed fix
Comment 2 Olivier Thomann CLA 2008-02-11 13:08:06 EST
We now return:
// Compiled from X.java (version 1.5 : 49.0, no super bit)
@Retention(value=RetentionPolicy.CLASS)
abstract @interface X extends Annotation {
  
  // Method descriptor #8 ()I
  public abstract int value() default (int) -1;

}
Comment 3 Olivier Thomann CLA 2008-02-11 14:22:07 EST
Released for 3.4M6.
Updated regression test org.eclipse.jdt.core.tests.compiler.regression.ClassFileReaderTest_1_5#test011
Comment 4 Frederic Fusier CLA 2008-03-25 11:48:04 EDT
The test referenced in previous comment
1) reference bug 203577
2) use ClassFileBytesDisassembler.SYSTEM instead of COMPACT

So, it seems that some clarification need to be done before set it as VERIFIED
Comment 5 Olivier Thomann CLA 2008-03-25 11:49:43 EDT
The enum values are always printed in COMPACT mode.
Fixed and released for 3.4M6.
Added org.eclipse.jdt.core.tests.compiler.regression.ClassFileReaderTest_1_5#test013
Comment 6 Olivier Thomann CLA 2008-03-25 11:54:18 EDT
I added also org.eclipse.jdt.core.tests.compiler.regression.ClassFileReaderTest_1_5#test014 to illustrate the DETAILED + COMPACT mode.
Comment 7 David Audel CLA 2008-03-26 12:40:16 EDT
Verified for 3.4M6 using build I20080325-2233