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 52649 Details for
Bug 162056
[recovery] Confusing errors in editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug162056_001.txt (text/plain), 6.95 KB, created by
David Audel
on 2006-10-25 03:46:28 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2006-10-25 03:46:28 EDT
Size:
6.95 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java,v >retrieving revision 1.34 >diff -u -r1.34 RecoveredUnit.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java 10 May 2006 18:03:51 -0000 1.34 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java 25 Oct 2006 07:50:11 -0000 >@@ -48,12 +48,19 @@ > type.typeDeclaration.declarationSourceEnd = 0; // reset position > type.typeDeclaration.bodyEnd = 0; > >- if(start > 0 && start < end) { >+ int kind = TypeDeclaration.kind(type.typeDeclaration.modifiers); >+ if(start > 0 && >+ start < end && >+ kind != TypeDeclaration.INTERFACE_DECL && >+ kind != TypeDeclaration.ANNOTATION_TYPE_DECL) { >+ // the } of the last type can be considered as the end of an initializer > Initializer initializer = new Initializer(new Block(0), 0); > initializer.bodyStart = end; > initializer.bodyEnd = end; > initializer.declarationSourceStart = end; > initializer.declarationSourceEnd = end; >+ initializer.sourceStart = end; >+ initializer.sourceEnd = end; > type.add(initializer, bracketBalanceValue); > } > >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java,v >retrieving revision 1.35 >diff -u -r1.35 SourceElementParserTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java 20 Apr 2006 17:17:53 -0000 1.35 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java 25 Oct 2006 07:50:16 -0000 >@@ -4630,7 +4630,6 @@ > > String expectedUnitToString = > "public interface X {\n" >- + "\t{}\n" > + "\tint foo() {}\n" > + "\tint x() {}\n" > + "}"; >@@ -4651,11 +4650,7 @@ > assertTrue("has no superinterfaces " , currentType.getInterfaceNames() == null); > > SourceField[] fields = currentType.getFields(); >- assertTrue(" invalid fields ", fields != null); >- assertEquals(" invalid fields length ", 1, fields.length); >- >- assertEquals("Invalid declaration source start for initializer", 51, fields[0].getDeclarationSourceStart()); >- assertEquals("Invalid declaration source end for initializer", 51, fields[0].getDeclarationSourceEnd()); >+ assertTrue(" invalid fields ", fields == null); > > SourceMethod[] methods = currentType.getMethods(); > assertTrue(" invalid methods ", methods != null); >Index: src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java,v >retrieving revision 1.46 >diff -u -r1.46 DietRecoveryTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 25 Oct 2006 07:43:53 -0000 1.46 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 25 Oct 2006 07:50:14 -0000 >@@ -7093,4 +7093,145 @@ > expectedFullUnitToString, > expectedCompletionDietUnitToString, testName); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=162056 >+public void test118() { >+ String s = >+ "interface Irrelevant {}\n"+ >+ "interface I {\n"+ >+ " Object foo(Number n);\n"+ >+ "}\n"+ >+ "interface J extends I {\n"+ >+ " String foo(Number n);\n"+ >+ "}\n"+ >+ "interface K {\n"+ >+ " Object foo(Number n);\n"+ >+ "}\n"+ >+ "public class {\n"+ >+ " void foo() {\n"+ >+ "\n"+ >+ " }\n"+ >+ "} \n"; >+ >+ String expectedDietUnitToString = >+ "interface Irrelevant {\n" + >+ "}\n" + >+ "interface I {\n" + >+ " Object foo(Number n);\n" + >+ "}\n" + >+ "interface J extends I {\n" + >+ " String foo(Number n);\n" + >+ "}\n" + >+ "interface K {\n" + >+ " Object foo(Number n);\n" + >+ " void foo() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ String expectedDietPlusBodyUnitToString = >+ "interface Irrelevant {\n" + >+ "}\n" + >+ "interface I {\n" + >+ " Object foo(Number n);\n" + >+ "}\n" + >+ "interface J extends I {\n" + >+ " String foo(Number n);\n" + >+ "}\n" + >+ "interface K {\n" + >+ " Object foo(Number n);\n" + >+ " void foo() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = >+ expectedDietPlusBodyUnitToString; >+ >+ String expectedFullUnitToString = expectedDietUnitToString; >+ >+ String expectedCompletionDietUnitToString = >+ expectedDietUnitToString; >+ >+ String testName = "test foreach toString"; >+ checkParse( >+ s.toCharArray(), >+ expectedDietUnitToString, >+ expectedDietPlusBodyUnitToString, >+ expectedDietPlusBodyPlusStatementsRecoveryUnitToString, >+ expectedFullUnitToString, >+ expectedCompletionDietUnitToString, testName); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=162056 >+public void test119() { >+ String s = >+ "interface Irrelevant {}\n"+ >+ "interface I {\n"+ >+ " Object foo(Number n);\n"+ >+ "}\n"+ >+ "interface J extends I {\n"+ >+ " String foo(Number n);\n"+ >+ "}\n"+ >+ "abstract class K {\n"+ >+ " abstract Object foo(Number n);\n"+ >+ "}\n"+ >+ "public class {\n"+ >+ " void foo() {\n"+ >+ "\n"+ >+ " }\n"+ >+ "} \n"; >+ >+ String expectedDietUnitToString = >+ "interface Irrelevant {\n" + >+ "}\n" + >+ "interface I {\n" + >+ " Object foo(Number n);\n" + >+ "}\n" + >+ "interface J extends I {\n" + >+ " String foo(Number n);\n" + >+ "}\n" + >+ "abstract class K {\n" + >+ " {\n" + >+ " }\n" + >+ " K() {\n" + >+ " }\n" + >+ " abstract Object foo(Number n);\n" + >+ " void foo() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ String expectedDietPlusBodyUnitToString = >+ "interface Irrelevant {\n" + >+ "}\n" + >+ "interface I {\n" + >+ " Object foo(Number n);\n" + >+ "}\n" + >+ "interface J extends I {\n" + >+ " String foo(Number n);\n" + >+ "}\n" + >+ "abstract class K {\n" + >+ " {\n" + >+ " }\n" + >+ " K() {\n" + >+ " super();\n" + >+ " }\n" + >+ " abstract Object foo(Number n);\n" + >+ " void foo() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = >+ expectedDietPlusBodyUnitToString; >+ >+ String expectedFullUnitToString = expectedDietUnitToString; >+ >+ String expectedCompletionDietUnitToString = >+ expectedDietUnitToString; >+ >+ String testName = "test foreach toString"; >+ checkParse( >+ s.toCharArray(), >+ expectedDietUnitToString, >+ expectedDietPlusBodyUnitToString, >+ expectedDietPlusBodyPlusStatementsRecoveryUnitToString, >+ expectedFullUnitToString, >+ expectedCompletionDietUnitToString, testName); >+} > }
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 162056
: 52649