Project: JDT
Bug 181805 [convert local] Convert local to field fails with shorthand array initializer
Reported: 2007-04-10 13:22:41 | Status: resolved fixed

I20070403-1110 public class Try { void m() { final boolean[] finished= { false }; } } Convert 'finished' to field gives: Caused by: java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.ASTNode.checkNewChild(ASTNode.java:1869) at org.eclipse.jdt.core.dom.ASTNode.preReplaceChild(ASTNode.java:1931) at org.eclipse.jdt.core.dom.Assignment.setRightHandSide(Assignment.java:417) at org.eclipse.jdt.internal.corext.refactoring.code.PromoteTempToFieldRefactoring.createExpressionStatementThatInitializesField(PromoteTempToFieldRefactoring.java:749) at org.eclipse.jdt.internal.corext.refactoring.code.PromoteTempToFieldRefactoring.addLocalDeclarationSplit(PromoteTempToFieldRefactoring.java:718) at org.eclipse.jdt.internal.corext.refactoring.code.PromoteTempToFieldRefactoring.createChange(PromoteTempToFieldRefactoring.java:523) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:121) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/PromoteTempToField/canPromote/A_test24_in.java org.eclipse.jdt.ui.tests.refactoring/resources/PromoteTempToField/canPromote/A_test24_out.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/PromoteTempToFieldTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/PromoteTempToFieldRefactoring.java