Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 17353 Details for
Bug 83362
CompilationUnit.rewrite(...) fails on modified annotation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Code fragment to reproduce
test.txt (text/plain), 927 bytes, created by
Carl McConnell
on 2005-01-20 20:39:31 EST
(
hide
)
Description:
Code fragment to reproduce
Filename:
MIME Type:
Creator:
Carl McConnell
Created:
2005-01-20 20:39:31 EST
Size:
927 bytes
patch
obsolete
>// Create an AST containing an annotation. >Document doc = new Document("class X {\n@Anno()\npublic void action() {}\n"); >ASTParser parser = ASTParser.newParser(AST.JLS3); >parser.setSource(doc.get().toCharArray()); >CompilationUnit cu = (CompilationUnit) parser.createAST(null); >cu.recordModifications(); >AST ast = cu.getAST(); > >// Create a member value pair to add to the annotation. >MemberValuePair pair = ast.newMemberValuePair(); >pair.setName(ast.newSimpleName("value")); >StringLiteral value = ast.newStringLiteral(); >value.setLiteralValue("string"); >pair.setValue(value); > >// Add the member value pair to the annotation. >TypeDeclaration type = (TypeDeclaration) cu.types().get(0); >MethodDeclaration method = type.getMethods()[0]; >NormalAnnotation anno = (NormalAnnotation) method.modifiers().get(0); >anno.values().add(pair); > >// Fails with a CoreException regarding end of file >cu.rewrite(doc, null);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 83362
: 17353 |
17354