Community
Participate
Working Groups
200412081200 import java.util.List; class A { public A (List/*<String>*/ list, Integer integer) { } } Quick Fix "Assign parameter to new field" works correctly for "integer", but does not appear for "list".
reproduced in 20050509-2010 The reason is that the AST received from reconcile has the second parameter 'Integer integer' represented as a SingleVariableDeclaration with source range starting at the block comment start, overlapping with the first parameter. Unfortunatly the ASTView doesn't show you this. We thought the 'reconciled' mode in the ASTView would do the same as happens in reconcile, but obviously there is a third case of AST are build. Set a breakpoint in QuickAssistProcessor.getAssignParamToFieldProposals to see that node. If you can't reproduce and the quick assist show up correcty: Cut the constructor, save, wait a bit, paste and do the quick fix
When I put a breakpoint in QuickAssistProcessor.getAssignParamToFieldProposals, the 'node' param is a SingleVariableDeclaration for 'Integer integer'. When I inspect its parent and look at the first parameter, the position of the SingleVariableDeclation 'List list' is correct. So why is the 'node' the SingleVariableDeclaration 'Integer integer' ?
The problem is the source range of the SingleVariableDeclaration for 'Integer integer'. I just reproduced this again in N20060418-0010
Thanks for the clarification. The problem comes from the fact that we don't use the same parser when the working copy is consistent (CommentRecorderParser), and when it is not (SourceElementParser). SourceElementParser#checkComment() was not updated when CommentRecorderParser#checkComment() was.
Created attachment 38954 [details] Proposed patch and regression test
+1 for 3.2RC2
Patch is not good. It prevents non-Javadoc comments from being associated with a declaration.
Created attachment 39071 [details] Better patch and same regression test
Released patch and regression test from comment 8
Verified with I20060427-1600 for RC2.