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 147339 Details for
Bug 289516
Annotations (visible and invisible) should be preserved with target jsr14
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_ 289516.txt (text/plain), 5.37 KB, created by
Olivier Thomann
on 2009-09-16 12:53:52 EDT
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2009-09-16 12:53:52 EDT
Size:
5.37 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ClassFile.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java,v >retrieving revision 1.192 >diff -u -r1.192 ClassFile.java >--- compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 16 Sep 2009 16:46:33 -0000 1.192 >+++ compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 16 Sep 2009 16:56:43 -0000 >@@ -401,13 +401,11 @@ > this.contents[this.contentsOffset++] = methodIndexByte2; > attributesNumber++; > } >- if (this.targetJDK >= ClassFileConstants.JDK1_5) { >- TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext; >- if (typeDeclaration != null) { >- final Annotation[] annotations = typeDeclaration.annotations; >- if (annotations != null) { >- attributesNumber += generateRuntimeAnnotations(annotations); >- } >+ TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext; >+ if (typeDeclaration != null) { >+ final Annotation[] annotations = typeDeclaration.annotations; >+ if (annotations != null) { >+ attributesNumber += generateRuntimeAnnotations(annotations); > } > } > >@@ -673,13 +671,11 @@ > this.contents[this.contentsOffset++] = (byte) signatureIndex; > attributesNumber++; > } >- if (this.targetJDK >= ClassFileConstants.JDK1_5) { >- FieldDeclaration fieldDeclaration = fieldBinding.sourceField(); >- if (fieldDeclaration != null) { >- Annotation[] annotations = fieldDeclaration.annotations; >- if (annotations != null) { >- attributesNumber += generateRuntimeAnnotations(annotations); >- } >+ FieldDeclaration fieldDeclaration = fieldBinding.sourceField(); >+ if (fieldDeclaration != null) { >+ Annotation[] annotations = fieldDeclaration.annotations; >+ if (annotations != null) { >+ attributesNumber += generateRuntimeAnnotations(annotations); > } > } > if ((fieldBinding.tagBits & TagBits.HasMissingType) != 0) { >@@ -6290,18 +6286,16 @@ > this.contents[this.contentsOffset++] = (byte) signatureIndex; > attributeNumber++; > } >- if (this.targetJDK >= ClassFileConstants.JDK1_5) { >- AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod(); >- if (methodDeclaration != null) { >- Annotation[] annotations = methodDeclaration.annotations; >- if (annotations != null) { >- attributeNumber += generateRuntimeAnnotations(annotations); >- } >- if ((methodBinding.tagBits & TagBits.HasParameterAnnotations) != 0) { >- Argument[] arguments = methodDeclaration.arguments; >- if (arguments != null) { >- attributeNumber += generateRuntimeAnnotationsForParameters(arguments); >- } >+ AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod(); >+ if (methodDeclaration != null) { >+ Annotation[] annotations = methodDeclaration.annotations; >+ if (annotations != null) { >+ attributeNumber += generateRuntimeAnnotations(annotations); >+ } >+ if ((methodBinding.tagBits & TagBits.HasParameterAnnotations) != 0) { >+ Argument[] arguments = methodDeclaration.arguments; >+ if (arguments != null) { >+ attributeNumber += generateRuntimeAnnotationsForParameters(arguments); > } > } > } >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java,v >retrieving revision 1.201 >diff -u -r1.201 AnnotationTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 16 Sep 2009 16:46:34 -0000 1.201 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 16 Sep 2009 16:56:44 -0000 >@@ -44,7 +44,7 @@ > // All specified tests which do not belong to the class are skipped... > static { > // TESTS_NAMES = new String[] { "test127" }; >-// TESTS_NUMBERS = new int[] { 271 }; >+// TESTS_NUMBERS = new int[] { 272 }; > // TESTS_RANGE = new int[] { 249, -1 }; > } > >@@ -8889,4 +8889,37 @@ > > checkDisassembledClassFile(OUTPUT_DIR + File.separator +"X.class", "X", expectedOutput, ClassFileBytesDisassembler.DETAILED); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=289576 >+public void test272() throws Exception { >+ if (this.complianceLevel != ClassFileConstants.JDK1_5) { >+ return; >+ } >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); >+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); >+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "@interface A {}\n" + >+ "public class X {\n" + >+ " @SuppressWarnings(\"unused\")\n" + >+ " private void foo(@A Object o) {}\n" + >+ "}" >+ }, >+ "", >+ null, >+ true, >+ null, >+ options, >+ null, >+ true); >+ >+ String expectedOutput = >+ " // Method descriptor #15 (Ljava/lang/Object;)V\n" + >+ " // Stack: 0, Locals: 2\n" + >+ " private void foo(@A java.lang.Object o);\n"; >+ >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator +"X.class", "X", expectedOutput, ClassFileBytesDisassembler.DETAILED); >+} > }
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 289516
: 147339 |
147468