Bug 289516 - Annotations (visible and invisible) should be preserved with target jsr14
Summary: Annotations (visible and invisible) should be preserved with target jsr14
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-15 15:03 EDT by Olivier Thomann CLA
Modified: 2009-10-27 07:27 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix + regression test (5.37 KB, patch)
2009-09-16 12:53 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix (4.48 KB, patch)
2009-09-17 13:58 EDT, 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 2009-09-15 15:03:49 EDT
When compiling such code:

import java.lang.annotation.*;

@Retention(RetentionPolicy.CLASS)
@interface Annot {}

@Annot
public class X {
}

with -target jsr14, the annotation should be preserved inside the resulting .class file.
Right now we have a test:
org.eclipse.jdt.internal.compiler.ClassFile#addAttributes lin2 404 that removes them for a target < 1.5.
We can safely preserve them regardless of the target since they ends up as attributes. An attribute is ignored if unknown for the VM.
Comment 1 Olivier Thomann CLA 2009-09-16 12:53:52 EDT
Created attachment 147339 [details]
Proposed fix + regression test
Comment 2 Olivier Thomann CLA 2009-09-16 12:55:10 EDT
Released for 3.6M3.
Regression test added in:
org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest#test272
Comment 3 Olivier Thomann CLA 2009-09-17 13:58:04 EDT
Created attachment 147468 [details]
Proposed fix

Patch to apply after the first patch.
Comment 4 Jay Arthanareeswaran CLA 2009-10-27 04:22:00 EDT
Verified for 3.6M3 with build I20091026-0800