| Summary: | [quick fix] Add quick fix for 'The parameter x should not be assigned' | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Lars Svensson <oxvalley> | ||||||
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> | ||||||
| Status: | ASSIGNED --- | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | daniel_megert, ruediger.herrmann | ||||||
| Version: | 3.7 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 173171 [details]
Example code
Created attachment 173172 [details]
We get errors if compilition is set to errors on assinging values to parameters
Tested in Ganymede, Galilleo and Helios Lars your example is wrong, you need to have "i=+5" to get a method with a parameter. Having said that, we don't want to change the generated code since it's better if it's as close to the extracted one as possible. What we could do is a adding a quick fix to get rid of the problem. (In reply to comment #4) > Lars your example is wrong, you need to have "i=+5" to get a method with a > parameter. Not sure what you are meaning here... I double-checked this example and it gives me the same error... What am I explaining badly in my example?? (In reply to comment #5) > (In reply to comment #4) > > Lars your example is wrong, you need to have "i=+5" to get a method with a > > parameter. > Not sure what you are meaning here... I double-checked this example and it > gives me the same error... What am I explaining badly in my example?? OK.. :-) Now I see my misstake.. bad explaining in text but my two attachments in comment 1 and 2 show the real reason for this error report... |
Build Identifier: When using Refactoring-> Extract Method, a parameter sometimes get assigned a new value, which is not completely allowed. Reproducible: Always Steps to Reproduce: 1.Write: int i=0; i=5; System.out.println(i); 2.Mark line 2 "i=5;" and use Refactoring->Extract Method. Call the method anything you want 3.The method will look like this: public int foo(int i){ i=5; return i; } Now we are assigning a value to a parameter which is bad. Even if we change compiling to "Assigning a value to a parameter" is set to 'Error'. We will then get a compiler error here.