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 184424 Details for
Bug 331736
[dom] tests should check for malformed nodes - may catch a parser bug
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
test changes and parser fix
Bug_331736.patch (text/plain), 12.65 KB, created by
Stephan Herrmann
on 2010-12-02 18:35:15 EST
(
hide
)
Description:
test changes and parser fix
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2010-12-02 18:35:15 EST
Size:
12.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v >retrieving revision 1.421 >diff -u -r1.421 Parser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 27 Oct 2010 02:55:30 -0000 1.421 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 2 Dec 2010 23:29:49 -0000 >@@ -4403,7 +4403,7 @@ > if (this.currentToken == TokenNameSEMICOLON /*&& !method.isAnnotationMethod()*/){ > method.modifiers |= ExtraCompilerModifiers.AccSemicolonBody; > method.declarationSourceEnd = this.scanner.currentPosition-1; >- method.bodyEnd = this.scanner.currentPosition-1; >+ method.bodyEnd = this.rParenPos; > if (this.currentElement.parseTree() == method && this.currentElement.parent != null) { > this.currentElement = this.currentElement.parent; > } >#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.298 >diff -u -r1.298 ASTConverter15Test.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 2 Nov 2010 16:14:02 -0000 1.298 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 2 Dec 2010 23:30:20 -0000 >@@ -3967,7 +3967,7 @@ > Statement statement = (Statement) statements.get(0); > assertEquals("Not a constructor invocation", ASTNode.CONSTRUCTOR_INVOCATION, statement.getNodeType()); > ConstructorInvocation constructorInvocation = (ConstructorInvocation) statement; >- checkSourceRange(constructorInvocation, "x.<String> this();", source); >+ checkSourceRange(constructorInvocation, "x.<String> this();", source, true/*expectMalformed*/); > assertTrue("Node is not malformed", isMalformed(constructorInvocation)); > } > >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterAST3Test.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterAST3Test.java,v >retrieving revision 1.29 >diff -u -r1.29 ASTConverterAST3Test.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterAST3Test.java 18 Jan 2010 12:53:41 -0000 1.29 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterAST3Test.java 2 Dec 2010 23:30:45 -0000 >@@ -6943,7 +6943,7 @@ > "public void fails() {\n" + //$NON-NLS-1$ > " foo()\n" + //$NON-NLS-1$ > " }"; //$NON-NLS-1$ >- checkSourceRange(methodDeclaration, expectedSource, source); >+ checkSourceRange(methodDeclaration, expectedSource, source, true/*expectMalformed*/); > Block block = methodDeclaration.getBody(); > expectedSource = > "{\n" + //$NON-NLS-1$ >@@ -6999,7 +6999,7 @@ > "public void fails() {\n" + //$NON-NLS-1$ > " foo()\n" + //$NON-NLS-1$ > " }"; //$NON-NLS-1$ >- checkSourceRange(methodDeclaration, expectedSource, source); >+ checkSourceRange(methodDeclaration, expectedSource, source, true/*expectMalformed*/); > Block block = methodDeclaration.getBody(); > expectedSource = > "{\n" + //$NON-NLS-1$ >@@ -8182,7 +8182,7 @@ > " z\n" + //$NON-NLS-1$ > " }\n" + //$NON-NLS-1$ > "}"; //$NON-NLS-1$ >- checkSourceRange(node, expectedSource, source); >+ checkSourceRange(node, expectedSource, source, true/*expectMalformed*/); > int methodEndPosition = node.getStartPosition() + node.getLength(); > node = getASTNode(compilationUnit, 0); > assertNotNull("not null", node); //$NON-NLS-1$ >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java,v >retrieving revision 1.87 >diff -u -r1.87 ASTConverterTest.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java 18 Jan 2010 12:53:41 -0000 1.87 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java 2 Dec 2010 23:31:09 -0000 >@@ -7116,7 +7116,7 @@ > "public void fails() {\n" + //$NON-NLS-1$ > " foo()\n" + //$NON-NLS-1$ > " }"; //$NON-NLS-1$ >- checkSourceRange(methodDeclaration, expectedSource, source); >+ checkSourceRange(methodDeclaration, expectedSource, source, true/*expectMalformed*/); > Block block = methodDeclaration.getBody(); > expectedSource = > "{\n" + //$NON-NLS-1$ >@@ -7171,7 +7171,7 @@ > "public void fails() {\n" + //$NON-NLS-1$ > " foo()\n" + //$NON-NLS-1$ > " }"; //$NON-NLS-1$ >- checkSourceRange(methodDeclaration, expectedSource, source); >+ checkSourceRange(methodDeclaration, expectedSource, source, true/*expectMalformed*/); > Block block = methodDeclaration.getBody(); > expectedSource = > "{\n" + //$NON-NLS-1$ >@@ -8350,7 +8350,7 @@ > " z\n" + //$NON-NLS-1$ > " }\n" + //$NON-NLS-1$ > "}"; //$NON-NLS-1$ >- checkSourceRange(node, expectedSource, source); >+ checkSourceRange(node, expectedSource, source, true /*expectMalformed*/); > int methodEndPosition = node.getStartPosition() + node.getLength(); > node = getASTNode(compilationUnit, 0); > assertNotNull("not null", node); //$NON-NLS-1$ >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.198 >diff -u -r1.198 ASTConverterTest2.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java 26 Oct 2010 17:24:12 -0000 1.198 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java 2 Dec 2010 23:31:22 -0000 >@@ -1908,7 +1908,7 @@ > assertTrue("not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ > MethodDeclaration methodDeclaration = (MethodDeclaration) node; > assertTrue("Is a constructor", !methodDeclaration.isConstructor()); >- checkSourceRange(methodDeclaration, "private void foo(){", source); >+ checkSourceRange(methodDeclaration, "private void foo(){", source, true/*expectMalformed*/); > node = getASTNode(compilationUnit, 0, 1); > assertNotNull("No node", node); > assertTrue("not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ >@@ -3125,7 +3125,7 @@ > assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ > MethodDeclaration declaration = (MethodDeclaration) node; > assertTrue("A constructor", !declaration.isConstructor()); >- checkSourceRange(declaration, "public method(final int parameter);", source); >+ checkSourceRange(declaration, "public method(final int parameter);", source, true/*expectMalformed*/); > } > > /** >@@ -3143,7 +3143,7 @@ > assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ > MethodDeclaration declaration = (MethodDeclaration) node; > assertTrue("A constructor", !declaration.isConstructor()); >- checkSourceRange(declaration, "public method(final int parameter) { }", source); >+ checkSourceRange(declaration, "public method(final int parameter) { }", source, true/*expectMalformed*/); > } > > /** >@@ -3280,7 +3280,7 @@ > assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ > MethodDeclaration declaration = (MethodDeclaration) node; > assertTrue("Not a constructor", declaration.isConstructor()); >- checkSourceRange(declaration, "public A();", source); >+ checkSourceRange(declaration, "public A();", source, true/*expectMalformed*/); > } > > /** >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.177 >diff -u -r1.177 ASTConverterTestAST3_2.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 26 Oct 2010 17:24:11 -0000 1.177 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 2 Dec 2010 23:31:42 -0000 >@@ -1988,7 +1988,7 @@ > assertTrue("not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ > MethodDeclaration methodDeclaration = (MethodDeclaration) node; > assertTrue("Is a constructor", !methodDeclaration.isConstructor()); >- checkSourceRange(methodDeclaration, "private void foo(){", source); >+ checkSourceRange(methodDeclaration, "private void foo(){", source, true/*expectMalformed*/); > node = getASTNode(compilationUnit, 0, 1); > assertNotNull("No node", node); > assertTrue("not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ >@@ -3203,7 +3203,7 @@ > assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ > MethodDeclaration declaration = (MethodDeclaration) node; > assertTrue("A constructor", !declaration.isConstructor()); >- checkSourceRange(declaration, "public method(final int parameter);", source); >+ checkSourceRange(declaration, "public method(final int parameter);", source, true/*expectMalformed*/); > } > > /** >@@ -3221,7 +3221,7 @@ > assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ > MethodDeclaration declaration = (MethodDeclaration) node; > assertTrue("A constructor", !declaration.isConstructor()); >- checkSourceRange(declaration, "public method(final int parameter) { }", source); >+ checkSourceRange(declaration, "public method(final int parameter) { }", source, true/*expectMalformed*/); > } > > /** >@@ -3358,7 +3358,7 @@ > assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ > MethodDeclaration declaration = (MethodDeclaration) node; > assertTrue("Not a constructor", declaration.isConstructor()); >- checkSourceRange(declaration, "public A();", source); >+ checkSourceRange(declaration, "public A();", source, true/*expectMalformed*/); > } > > /** >@@ -5493,7 +5493,7 @@ > node = getASTNode(compilationUnit, 0, 0); > assertEquals("wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType()); > FieldDeclaration fieldDeclaration = (FieldDeclaration) node; >- checkSourceRange(fieldDeclaration, "d String[][]", source.toCharArray()); >+ checkSourceRange(fieldDeclaration, "d String[][]", source.toCharArray(), true/*expectMalformed*/); > Type type = fieldDeclaration.getType(); > assertTrue("Not a simple type", type.isSimpleType()); > List fragments = fieldDeclaration.fragments(); >@@ -7243,7 +7243,7 @@ > List fragments = fieldDeclaration.fragments(); > assertEquals("wrong size", 1, fragments.size()); > VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); >- checkSourceRange(fragment, "s = {\"\",,,", source); >+ checkSourceRange(fragment, "s = {\"\",,,", source, true/*expectMalformed*/); > assertTrue("Not initializer", fragment.getInitializer() == null); > assertTrue("Not a malformed node", isMalformed(fragment)); > } >Index: src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java,v >retrieving revision 1.62 >diff -u -r1.62 ConverterTestSetup.java >--- src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java 26 Aug 2009 22:56:37 -0000 1.62 >+++ src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java 2 Dec 2010 23:31:43 -0000 >@@ -559,6 +559,9 @@ > } > > protected void checkSourceRange(ASTNode node, String expectedContents, char[] source) { >+ checkSourceRange(node, expectedContents, source, false); >+ } >+ protected void checkSourceRange(ASTNode node, String expectedContents, char[] source, boolean expectMalformed) { > assertNotNull("The node is null", node); //$NON-NLS-1$ > assertTrue("The node(" + node.getClass() + ").getLength() == 0", node.getLength() != 0); //$NON-NLS-1$ //$NON-NLS-2$ > assertTrue("The node.getStartPosition() == -1", node.getStartPosition() != -1); //$NON-NLS-1$ >@@ -568,6 +571,10 @@ > System.arraycopy(source, start, actualContents, 0, length); > String actualContentsString = new String(actualContents); > assertSourceEquals("Unexpected source", Util.convertToIndependantLineDelimiter(expectedContents), Util.convertToIndependantLineDelimiter(actualContentsString)); >+ if (expectMalformed) >+ assertTrue("Is not malformed", isMalformed(node)); >+ else >+ assertFalse("Is malformed", isMalformed(node)); > } > > protected boolean isMalformed(ASTNode node) {
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 331736
: 184424 |
184817