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 52647 Details for
Bug 154811
[compiler] Internal compiler error while parsing/formatting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug154811_001.txt (text/plain), 7.80 KB, created by
David Audel
on 2006-10-25 03:36:13 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2006-10-25 03:36:13 EDT
Size:
7.80 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java,v >retrieving revision 1.28 >diff -u -r1.28 ComplianceDiagnoseTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java 26 Sep 2006 16:33:09 -0000 1.28 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java 25 Oct 2006 07:39:33 -0000 >@@ -2316,4 +2316,60 @@ > expected15ProblemLog > ); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154811 >+public void test0052() { >+ String[] testFiles = new String[] { >+ "X.java", >+ "public class X {\n" + >+ " void foo1() {\n" + >+ " class Y {\n" + >+ " }\n" + >+ " void foo2() {\n" + >+ " }\n" + >+ " class Z<T> { \n" + >+ " }\n" + >+ " }\n" + >+ "} \n" >+ }; >+ >+ String expected13ProblemLog = >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " void foo2() {\n" + >+ " ^^^^\n" + >+ "Syntax error on token \"void\", new expected\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 7)\n" + >+ " class Z<T> { \n" + >+ " ^^^^^\n" + >+ "Syntax error on token \"class\", invalid AssignmentOperator\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 7)\n" + >+ " class Z<T> { \n" + >+ " ^\n" + >+ "Syntax error on token \">\", ; expected\n" + >+ "----------\n"; >+ String expected14ProblemLog = >+ expected13ProblemLog; >+ >+ String expected15ProblemLog = >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " void foo2() {\n" + >+ " ^^^^\n" + >+ "Syntax error on token \"void\", new expected\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 6)\n" + >+ " }\n" + >+ " ^\n" + >+ "Syntax error, insert \";\" to complete Statement\n" + >+ "----------\n"; >+ >+ runComplianceParserTest( >+ testFiles, >+ expected13ProblemLog, >+ expected14ProblemLog, >+ expected15ProblemLog >+ ); >+} > } >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.45 >diff -u -r1.45 DietRecoveryTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 16 Oct 2006 08:40:57 -0000 1.45 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 25 Oct 2006 07:39:36 -0000 >@@ -6950,4 +6950,147 @@ > expectedFullUnitToString, > expectedCompletionDietUnitToString, testName); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154811 >+public void test117() { >+ String s = >+ "public class X {\n" + >+ " void foo1() {\n" + >+ " class Y {\n" + >+ " }\n" + >+ " void foo2() {\n" + >+ " }\n" + >+ " class Z<T> { \n" + >+ " }\n" + >+ " }\n" + >+ "} \n"; >+ >+ String expectedDietUnitToString = null; >+ String expectedDietPlusBodyUnitToString = null; >+ String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = null; >+ String expectedFullUnitToString = null; >+ String expectedCompletionDietUnitToString = null; >+ >+ >+ if(COMPLIANCE_1_3.equals(this.complianceLevel) || >+ COMPLIANCE_1_4.equals(this.complianceLevel)) { >+ >+ expectedDietUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " }\n" + >+ " void foo1() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ expectedDietPlusBodyUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " void foo1() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ expectedDietPlusBodyPlusStatementsRecoveryUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " void foo1() {\n" + >+ " class Y {\n" + >+ " Y() {\n" + >+ " super();\n" + >+ " }\n" + >+ " }\n" + >+ " class Z<T> {\n" + >+ " Z() {\n" + >+ " super();\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ >+ expectedFullUnitToString = >+ "public class X {\n" + >+ " class Z<T> {\n" + >+ " Z() {\n" + >+ " }\n" + >+ " }\n" + >+ " public X() {\n" + >+ " }\n" + >+ " void foo1() {\n" + >+ " }\n" + >+ " void foo2() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ expectedCompletionDietUnitToString = >+ expectedDietUnitToString; >+ } else if(this.complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) { >+ >+ expectedDietUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " }\n" + >+ " void foo1() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ expectedDietPlusBodyUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " void foo1() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ expectedDietPlusBodyPlusStatementsRecoveryUnitToString = >+ "public class X {\n" + >+ " public X() {\n" + >+ " super();\n" + >+ " }\n" + >+ " void foo1() {\n" + >+ " class Y {\n" + >+ " Y() {\n" + >+ " super();\n" + >+ " }\n" + >+ " }\n" + >+ " new foo2() {\n" + >+ " };\n" + >+ " class Z<T> {\n" + >+ " Z() {\n" + >+ " super();\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"; >+ >+ expectedFullUnitToString = >+ "public class X {\n" + >+ " class Z<T> {\n" + >+ " Z() {\n" + >+ " }\n" + >+ " }\n" + >+ " public X() {\n" + >+ " }\n" + >+ " void foo1() {\n" + >+ " }\n" + >+ " void foo2() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ expectedCompletionDietUnitToString = >+ expectedDietUnitToString; >+ } >+ >+ String testName = "test foreach toString"; >+ checkParse( >+ s.toCharArray(), >+ expectedDietUnitToString, >+ expectedDietPlusBodyUnitToString, >+ expectedDietPlusBodyPlusStatementsRecoveryUnitToString, >+ expectedFullUnitToString, >+ expectedCompletionDietUnitToString, testName); >+} > } >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java,v >retrieving revision 1.38 >diff -u -r1.38 RecoveredBlock.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java 18 Apr 2006 14:11:17 -0000 1.38 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java 25 Oct 2006 07:39:44 -0000 >@@ -11,6 +11,7 @@ > package org.eclipse.jdt.internal.compiler.parser; > > import org.eclipse.jdt.core.compiler.*; >+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.Argument; > import org.eclipse.jdt.internal.compiler.ast.ASTNode; > import org.eclipse.jdt.internal.compiler.ast.Block; >@@ -36,6 +37,16 @@ > > this.preserveContent = this.parser().methodRecoveryActivated || this.parser().statementRecoveryActivated; > } >+public RecoveredElement add(AbstractMethodDeclaration methodDeclaration, int bracketBalanceValue) { >+ if (this.parent != null && this.parent instanceof RecoveredMethod) { >+ RecoveredMethod enclosingRecoveredMethod = (RecoveredMethod) this.parent; >+ if (enclosingRecoveredMethod.methodBody == this && enclosingRecoveredMethod.parent == null) { >+ // the element cannot be added because we are in the body of a top level method >+ return this; // ignore this element >+ } >+ } >+ return super.add(methodDeclaration, bracketBalanceValue); >+} > /* > * Record a nested block declaration > */
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 154811
: 52647