When you attempt to extract a method, you may get one or more of the following common errors.
A local type declaration is not part of the selection but is referenced by one of the statements selected for extraction. Either extend the selection that it includes the local type declaration or reduce the selection that no reference to the local type declaration is selected.
The selection covers a local type declaration but the type is also referenced outside the selected statements. Either extend the selection that is includes all references to the local type or reduce the selection that the local type declaration isn't selected.
More than one assignment to a local variable was found inside the selected block. Either reduce the selection that only one assignment is selected or extend the selection that at least all reference except of one to the local variables are covered by the selection too.
More than one variable declared inside the selection is also reference outside the selection. Either reduce the selection that only one variable declaration is selected or extend the selection that at least all references except of one to the selected variable declarations are covered by the selection too.
The selected block contains an assignment to a local variable. Additionally a variable declared inside the selection is also referenced outside the selection. Reduce the selection that either the assignment or the local declaration is selected. Or extend the selection so that either all references to a local variable or all variable declarations are covered by the selection too.
The selected block contains a return statement. Additionally a value must be returned from the extracted method because either a assignment to a local variable or a local declaration is selected too. Either exclude the return statement from the selection or exclude all assignments to local variables and all local type declarations from the selection.
The selected statement is an expression (for example the condition part of an if-then-else statement) which must return a boolean. Additionally a value must be returned from the extracted method because an assignment to a local variable is selected too. To remedy the problem select the whole statement not only the condition part.
To remedy the problem either extend the selection to include the break / continue target or reduce the selection that the break / continue statement isn't covered by the selection.
To remedy the problem either extend the selection to include the break / continue target or reduce the selection that the break / continue statement isn't covered by the selection.
This is a generic error message shown whenever we encounter a problem but don't really know what the problem actual is. Typical scenarios where this error message is shown are:
Parts of a comment cannot be extracted. Either extend the selection that it covers the whole comment or reduce the selection that the comment isn't covered at all.
Parts of a comment can't be extracted. Either extend the selection that it covers the whole comment or reduce the selection that the comment isn't covered at all.
Adjust selection so that it fully covers a set of statements. Statements in the extract method sense are separated by semicolons.
The following problems are fairly self-explanatory.