Bug 286405

Summary: Default value character of annotations in ClassFileEditor are badly printed
Product: [Eclipse Project] JDT Reporter: Romain Dervaux <romain.dervaux>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: Olivier_Thomann
Version: 3.5   
Target Milestone: 3.6 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description Romain Dervaux CLA 2009-08-12 12:04:44 EDT
Build ID: 20090619-0625

Steps To Reproduce:
1. Create .class file of this annotation : 
public @interface MonAnnotation {
	
	String test1() default "\0";
	char test2() default '\0';
}

2. Open the class file in the ClassFileEditor.
3. default value of test1() will be printed normally. default value of test2() will not, probably because the character has not been escaped.


More information:
Comment 1 Olivier Thomann CLA 2009-08-12 12:20:07 EDT
Reproduced.
We print:
  // Method descriptor #8 ()Ljava/lang/String;
  public abstract String test1();
    Annotation Default: 
      "\0" (constant type)
  
  // Method descriptor #12 ()C
  public abstract char test2();
    Annotation Default: 
      ' ' (constant type)
}
Instead of '\0'.
Will fix for 3.6M2. No need to backport for 3.5.1.
Comment 2 Olivier Thomann CLA 2009-08-12 12:33:24 EDT
Created attachment 144258 [details]
Proposed fix
Comment 3 Olivier Thomann CLA 2009-08-12 21:28:01 EDT
Released for 3.6M2.
Regression test added in:
org.eclipse.jdt.core.tests.compiler.regression.ClassFileReaderTest_1_5#test016
Comment 4 Kent Johnson CLA 2009-09-15 11:41:20 EDT
Verified for 3.6M2