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 111087 Details for
Bug 245348
[DOM] Annotations are recognized by ASTParser even in COMPILER_SOURCE is set < 1.5
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests
patch_245348.txt (text/plain), 5.41 KB, created by
Olivier Thomann
on 2008-08-27 12:12:24 EDT
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2008-08-27 12:12:24 EDT
Size:
5.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: dom/org/eclipse/jdt/core/dom/ASTConverter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java,v >retrieving revision 1.263 >diff -u -r1.263 ASTConverter.java >--- dom/org/eclipse/jdt/core/dom/ASTConverter.java 27 Jun 2008 16:03:47 -0000 1.263 >+++ dom/org/eclipse/jdt/core/dom/ASTConverter.java 27 Aug 2008 16:11:52 -0000 >@@ -696,8 +696,9 @@ > return infixExpression; > } > >- public AnnotationTypeDeclaration convertToAnnotationDeclaration(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration) { >+ private AnnotationTypeDeclaration convertToAnnotationDeclaration(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration) { > checkCanceled(); >+ if (this.scanner.sourceLevel < ClassFileConstants.JDK1_5) return null; > AnnotationTypeDeclaration typeDecl = this.ast.newAnnotationTypeDeclaration(); > setModifiers(typeDecl, typeDeclaration); > final SimpleName typeName = new SimpleName(this.ast); >@@ -2871,6 +2872,7 @@ > > private EnumDeclaration convertToEnumDeclaration(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration) { > checkCanceled(); >+ // enum declaration cannot be built if the source is not >= 1.5, since enum is then seen as an identifier > final EnumDeclaration enumDeclaration2 = new EnumDeclaration(this.ast); > setModifiers(enumDeclaration2, typeDeclaration); > final SimpleName typeName = new SimpleName(this.ast); >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java,v >retrieving revision 1.147 >diff -u -r1.147 ASTConverterTestAST3_2.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 11 Aug 2008 16:53:28 -0000 1.147 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 27 Aug 2008 16:11:53 -0000 >@@ -122,7 +122,7 @@ > static { > // TESTS_NAMES = new String[] {"test0602"}; > // TESTS_RANGE = new int[] { 670, -1 }; >-// TESTS_NUMBERS = new int[] { 693, 694 }; >+// TESTS_NUMBERS = new int[] { 695, 696 }; > } > public static Test suite() { > return buildModelTestSuite(ASTConverterTestAST3_2.class); >@@ -9872,4 +9872,54 @@ > assertFalse("Should not get there", true); > } > } >+ /** >+ * http://dev.eclipse.org/bugs/show_bug.cgi?id=245348 >+ */ >+ public void test0695() throws JavaModelException { >+ ICompilationUnit unit = getCompilationUnit("Converter" , "src", "test0695", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >+ >+ ASTParser parser = ASTParser.newParser(AST.JLS3); >+ parser.setKind(ASTParser.K_COMPILATION_UNIT); >+ parser.setSource(unit.getSource().toCharArray()); >+ Map options = JavaCore.getOptions(); >+ options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); >+ options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); >+ options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); >+ parser.setCompilerOptions(options); >+ >+ CompilationUnit astRoot = (CompilationUnit) parser.createAST(null); >+ ASTVisitor visitor = new ASTVisitor() { >+ public boolean visit(EnumDeclaration node) { >+ assertFalse("Should not be there", true); >+ return false; >+ } >+ }; >+ astRoot.accept(visitor); >+ assertEquals("No problem found", 1, astRoot.getProblems().length); >+ } >+ /** >+ * http://dev.eclipse.org/bugs/show_bug.cgi?id=245348 >+ */ >+ public void test0696() throws JavaModelException { >+ ICompilationUnit unit = getCompilationUnit("Converter" , "src", "test0696", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >+ >+ ASTParser parser = ASTParser.newParser(AST.JLS3); >+ parser.setKind(ASTParser.K_COMPILATION_UNIT); >+ parser.setSource(unit.getSource().toCharArray()); >+ Map options = JavaCore.getOptions(); >+ options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); >+ options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); >+ options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); >+ parser.setCompilerOptions(options); >+ >+ CompilationUnit astRoot = (CompilationUnit) parser.createAST(null); >+ ASTVisitor visitor = new ASTVisitor() { >+ public boolean visit(AnnotationTypeDeclaration node) { >+ assertFalse("Should not be there", true); >+ return false; >+ } >+ }; >+ astRoot.accept(visitor); >+ assertEquals("No problem found", 1, astRoot.getProblems().length); >+ } > } >Index: workspace/Converter/src/test0696/X.java >=================================================================== >RCS file: workspace/Converter/src/test0696/X.java >diff -N workspace/Converter/src/test0696/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter/src/test0696/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+package test0696; >+ >+public @interface X { >+} >Index: workspace/Converter/src/test0695/X.java >=================================================================== >RCS file: workspace/Converter/src/test0695/X.java >diff -N workspace/Converter/src/test0695/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter/src/test0695/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+package test0695; >+ >+public enum X { >+}
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 245348
:
111043
| 111087