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 183147 Details for
Bug 329998
[content assist] override method proposal in anonymous class inserts bad stub
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_329998.txt (text/plain), 4.36 KB, created by
Olivier Thomann
on 2010-11-15 13:04:34 EST
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-11-15 13:04:34 EST
Size:
4.36 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.271 >diff -u -r1.271 ASTConverter.java >--- dom/org/eclipse/jdt/core/dom/ASTConverter.java 27 Mar 2010 02:26:04 -0000 1.271 >+++ dom/org/eclipse/jdt/core/dom/ASTConverter.java 15 Nov 2010 18:03:26 -0000 >@@ -926,9 +926,11 @@ > Expression lhs = convert(expression.lhs); > assignment.setLeftHandSide(lhs); > assignment.setOperator(Assignment.Operator.ASSIGN); >- assignment.setRightHandSide(convert(expression.expression)); >+ Expression rightHandSide = convert(expression.expression); >+ assignment.setRightHandSide(rightHandSide); > int start = lhs.getStartPosition(); >- assignment.setSourceRange(start, expression.sourceEnd - start + 1); >+ int end = rightHandSide.getStartPosition() + rightHandSide.getLength() - 1; >+ assignment.setSourceRange(start, end - start + 1); > return assignment; > } > >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterRecoveryTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterRecoveryTest.java,v >retrieving revision 1.16 >diff -u -r1.16 ASTConverterRecoveryTest.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterRecoveryTest.java 17 Jun 2009 06:44:27 -0000 1.16 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterRecoveryTest.java 15 Nov 2010 18:03:26 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2009 IBM Corporation and others. >+ * Copyright (c) 2006, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -45,7 +45,7 @@ > > static { > // TESTS_NAMES = new String[] {"test0003"}; >-// TESTS_NUMBERS = new int[] { 624 }; >+// TESTS_NUMBERS = new int[] { 19 }; > } > public static Test suite() { > return buildModelTestSuite(ASTConverterRecoveryTest.class); >@@ -992,4 +992,47 @@ > "Syntax error, insert \") Statement\" to complete BlockStatements\n", > result); > } >+ public void test0019() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Converter/src/test/X.java", >+ "package test;\n"+ >+ "public class X {\n"+ >+ " void foo() {\n" + >+ " field= new Object() {hash};\n" + >+ " }\n" + >+ "}\n"); >+ >+ char[] source = this.workingCopies[0].getSource().toCharArray(); >+ ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true); >+ >+ assertASTNodeEquals( >+ "package test;\n" + >+ "public class X {\n" + >+ " void foo(){\n" + >+ " field=new Object(){\n" + >+ " }\n" + >+ ";\n" + >+ " }\n" + >+ "}\n", >+ result); >+ >+ ASTNode node = getASTNode((CompilationUnit) result, 0, 0); >+ assertNotNull(node); >+ assertTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ >+ MethodDeclaration methodDeclaration = (MethodDeclaration) node; >+ Block block = methodDeclaration.getBody(); >+ List statements = block.statements(); >+ assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$ >+ Statement statement = (Statement) statements.get(0); >+ assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$ >+ ExpressionStatement expressionStatement = (ExpressionStatement) statement; >+ checkSourceRange(expressionStatement, "field= new Object() {hash};", source); //$NON-NLS-1$ >+ Expression expression = expressionStatement.getExpression(); >+ assertTrue("Not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$ >+ Assignment assignment = (Assignment) expression; >+ Expression anonymousClassDeclaration = assignment.getRightHandSide(); >+ checkSourceRange(anonymousClassDeclaration, "new Object() {hash}", source); //$NON-NLS-1$ >+ checkSourceRange(assignment, "field= new Object() {hash}", source); //$NON-NLS-1$ >+ } > }
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 329998
: 183147