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 76210 Details for
Bug 199668
IAE in ASTNode.setSourceRange while editing a class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Woraround and regression test
199668.txt (text/plain), 4.97 KB, created by
Jerome Lanneluc
on 2007-08-16 07:47:58 EDT
(
hide
)
Description:
Woraround and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-08-16 07:47:58 EDT
Size:
4.97 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java,v >retrieving revision 1.181 >diff -u -r1.181 ASTConverterTest2.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java 28 Jun 2007 15:03:28 -0000 1.181 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java 16 Aug 2007 11:49:09 -0000 >@@ -5483,4 +5483,29 @@ > workingCopy.discardWorkingCopy(); > } > } >+ >+ /* >+ * Ensures that no exception is thrown in case of a syntax error in a for statement >+ * (regression test for bug 199668 IAE in ASTNode.setSourceRange while editing a class) >+ */ >+ public void test0608() throws CoreException { >+ ICompilationUnit workingCopy = null; >+ try { >+ workingCopy = getWorkingCopy( >+ "/Converter/src/X.java", >+ "public class X {\n" + >+ " void foo() {\n" + >+ " for (int i=0,; i<10; i++) {\n" + >+ " }\n" + >+ " }\n" + >+ "}" >+ ); >+ ASTNode cu = buildAST(null, workingCopy, false, true); >+ assertNotNull("Should get an AST", cu); >+ } finally { >+ if (workingCopy != null) >+ workingCopy.discardWorkingCopy(); >+ } >+ } >+ > } >#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.251 >diff -u -r1.251 ASTConverter.java >--- dom/org/eclipse/jdt/core/dom/ASTConverter.java 19 Jul 2007 08:13:09 -0000 1.251 >+++ dom/org/eclipse/jdt/core/dom/ASTConverter.java 16 Aug 2007 11:49:11 -0000 >@@ -382,6 +382,8 @@ > && stmts[index - 1] instanceof org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) { > org.eclipse.jdt.internal.compiler.ast.LocalDeclaration local1 = (org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) stmts[index - 1]; > org.eclipse.jdt.internal.compiler.ast.LocalDeclaration local2 = (org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) stmts[index]; >+ if (local2.name == RecoveryScanner.FAKE_IDENTIFIER) // workaround for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=199668 >+ return; > if (local1.declarationSourceStart == local2.declarationSourceStart) { > // we have a multiple local declarations > // We retrieve the existing VariableDeclarationStatement to add the new VariableDeclarationFragment >@@ -1737,10 +1739,17 @@ > if (initializations != null) { > // we know that we have at least one initialization > if (initializations[0] instanceof org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) { >- VariableDeclarationExpression variableDeclarationExpression = convertToVariableDeclarationExpression((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) initializations[0]); >+ org.eclipse.jdt.internal.compiler.ast.LocalDeclaration initialization = (org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) initializations[0]; >+ if (initialization.name == RecoveryScanner.FAKE_IDENTIFIER) { // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=199668) >+ return null; >+ } >+ VariableDeclarationExpression variableDeclarationExpression = convertToVariableDeclarationExpression(initialization); > int initializationsLength = initializations.length; > for (int i = 1; i < initializationsLength; i++) { >- variableDeclarationExpression.fragments().add(convertToVariableDeclarationFragment((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration)initializations[i])); >+ initialization = (org.eclipse.jdt.internal.compiler.ast.LocalDeclaration)initializations[i]; >+ if (initialization.name != RecoveryScanner.FAKE_IDENTIFIER) { // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=199668) >+ variableDeclarationExpression.fragments().add(convertToVariableDeclarationFragment(initialization)); >+ } > } > if (initializationsLength != 1) { > int start = variableDeclarationExpression.getStartPosition(); >@@ -2371,7 +2380,10 @@ > return convert((ForeachStatement) statement); > } > if (statement instanceof org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) { >- return convertToVariableDeclarationStatement((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration)statement); >+ org.eclipse.jdt.internal.compiler.ast.LocalDeclaration localDeclaration = (org.eclipse.jdt.internal.compiler.ast.LocalDeclaration)statement; >+ if (localDeclaration.name == RecoveryScanner.FAKE_IDENTIFIER) // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=199668 >+ return null; >+ return convertToVariableDeclarationStatement(localDeclaration); > } > if (statement instanceof org.eclipse.jdt.internal.compiler.ast.AssertStatement) { > return convert((org.eclipse.jdt.internal.compiler.ast.AssertStatement) statement);
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 199668
: 76210 |
77374
|
78886