Community
Participate
Working Groups
I20090803-1800 FUP to bug 213519. ArrayList<Integer> list = new ArrayList<Integer>(); for (Integer var: list) {} int a = 0; for (int c = 0; c < 10; c++) { list.add(a++); } System.out.println(list.toString()); - Select 'list.add(a++)' (without the ';' at the end) - Extract Method => Strange "Ambiguous return value" error Expected: Same behavior as when I select the whole ExpressionStatement. Or at least a better error message.
Strictly spoken, the behavior is correct. But we should be more helpful. Without the ';', only the expression 'list.add(a++)' is selected, and the return value of the extracted method should be 1. the value of the expression (boolean, see return type of List#add(Object)) and 2. the value of 'a', since that variable is modified in the extracted method body One solution could be to always expand the selection in the first place if it occurs in an ExpressionStatement. But this would prevent correct duplicates search in case the selected expression is used in another context (not in an ExpressionStatement). We should just be smarter in the case we know we will fail. In that case, we should not abort with an error dialog, but automagically expand the selection to include the ';'. I first thought we should inform the user about that, but I guess it's OK to just be smart without a witty message.
Ping! Benny, any plans to work on this?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.