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 71360 Details for
Bug 191908
[1.5][compiler] Missing strike through for deprecated declaration fragment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests (191908 and 191909)
patch_191908.txt (text/plain), 6.03 KB, created by
Olivier Thomann
on 2007-06-14 15:23:00 EDT
(
hide
)
Description:
Proposed fix + regression tests (191908 and 191909)
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2007-06-14 15:23:00 EDT
Size:
6.03 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java,v >retrieving revision 1.6 >diff -u -r1.6 Deprecated15Test.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java 6 Mar 2007 04:42:12 -0000 1.6 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java 14 Jun 2007 19:21:41 -0000 >@@ -187,6 +187,46 @@ > customOptions, > null); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159709 >+//guard variant for DeprecatedTest#test015 using an annotation >+public void test004() { >+ Map customOptions = new HashMap(); >+ customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR); >+ this.runNegativeTest( >+ new String[] { >+ "test1/E01.java", >+ "package test1;\n" + >+ "public class E01 {\n" + >+ " @Deprecated\n" + >+ " public static int x = 5, y= 10;\n" + >+ "}", >+ "test1/E02.java", >+ "package test1;\n" + >+ "public class E02 {\n" + >+ " public void foo() {\n" + >+ " System.out.println(E01.x);\n" + >+ " System.out.println(E01.y);\n" + >+ " }\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. ERROR in test1\\E02.java (at line 4)\n" + >+ " System.out.println(E01.x);\n" + >+ " ^\n" + >+ "The field E01.x is deprecated\n" + >+ "----------\n" + >+ "2. ERROR in test1\\E02.java (at line 5)\n" + >+ " System.out.println(E01.y);\n" + >+ " ^\n" + >+ "The field E01.y is deprecated\n" + >+ "----------\n", >+ null, >+ true, >+ customOptions, >+ true, >+ false, >+ false); >+} > public static Class testClass() { > return Deprecated15Test.class; > } >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java,v >retrieving revision 1.83 >diff -u -r1.83 ASTNode.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 25 Apr 2007 16:59:23 -0000 1.83 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 14 Jun 2007 19:21:41 -0000 >@@ -563,12 +563,33 @@ > TypeBinding[] annotationTypes = new TypeBinding[length]; > for (int i = 0; i < length; i++) { > Annotation annotation = annotations[i]; >- annotation.recipient = recipient; >- annotationTypes[i] = annotation.resolveType(scope); >+ if (annotation.recipient != null) { >+ // only local and field can share annnotations >+ switch (recipient.kind()) { >+ case Binding.FIELD : >+ FieldBinding field = (FieldBinding) recipient; >+ field.tagBits = ((FieldBinding) annotation.recipient).tagBits; >+ /* now we can return since all tag bits have already >+ * been set and duplicate annotations detected >+ */ >+ return; >+ case Binding.LOCAL : >+ LocalVariableBinding local = (LocalVariableBinding) recipient; >+ local.tagBits = ((LocalVariableBinding) annotation.recipient).tagBits; >+ /* now we can return since all tag bits have already >+ * been set and duplicate annotations detected >+ */ >+ return; >+ } >+ } else { >+ annotation.recipient = recipient; >+ annotationTypes[i] = annotation.resolveType(scope); > >- // null if receiver is a package binding >- if (instances != null) >- instances[i] = annotation.getCompilerAnnotation(); >+ // null if receiver is a package binding >+ if (instances != null) { >+ instances[i] = annotation.getCompilerAnnotation(); >+ } >+ } > } > // check duplicate annotations > for (int i = 0; i < length; i++) { >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v >retrieving revision 1.247 >diff -u -r1.247 ASTConverter15Test.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 11 May 2007 14:55:27 -0000 1.247 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 14 Jun 2007 19:21:43 -0000 >@@ -46,7 +46,7 @@ > } > > static { >-// TESTS_NUMBERS = new int[] { 272 }; >+// TESTS_NUMBERS = new int[] { 274 }; > // TESTS_RANGE = new int[] { 253, -1 }; > // TESTS_NAMES = new String[] {"test0204"}; > } >@@ -9098,4 +9098,31 @@ > CompilationUnit unit = (CompilationUnit) node; > assertProblemsSize(unit, 1, "The type A is not generic; it cannot be parameterized with arguments <?>"); > } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=191908 >+ public void test0274() throws JavaModelException { >+ this.workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/); >+ String contents = >+ "public class X {\n" + >+ " @Deprecated\n" + >+ " public static int x= 5, y= 10;\n" + >+ "}"; >+ ASTNode node = buildAST( >+ contents, >+ this.workingCopy, >+ true); >+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); >+ CompilationUnit unit = (CompilationUnit) node; >+ assertProblemsSize(unit, 0); >+ node = getASTNode(unit, 0, 0); >+ assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType()); >+ FieldDeclaration fieldDeclaration = (FieldDeclaration) node; >+ List fragments = fieldDeclaration.fragments(); >+ assertEquals("Wrong size", 2, fragments.size()); >+ VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); >+ IVariableBinding binding = fragment.resolveBinding(); >+ assertTrue("Not deprecated", binding.isDeprecated()); >+ fragment = (VariableDeclarationFragment) fragments.get(1); >+ binding = fragment.resolveBinding(); >+ assertTrue("Not deprecated", binding.isDeprecated()); >+ } > }
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 191908
:
71360
|
71362
|
72181
|
72190