mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
extract method: allow to extract @NotNull code with missed branches which would be replaced with 'return null' with check on call site (IDEA-120076)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
class Result {
|
||||
private String _message;
|
||||
|
||||
public Result(String _message) {
|
||||
this._message = _message;
|
||||
}
|
||||
}
|
||||
|
||||
class Main {
|
||||
public static Result doIt(String name) {
|
||||
Result result;
|
||||
|
||||
Result result = newMethod(name);
|
||||
if (result != null) return result;
|
||||
|
||||
result = new Result("Name is " + name);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Result newMethod(String name) {
|
||||
Result result;
|
||||
if (name == null) {
|
||||
result = new Result("Name is null");
|
||||
return result;
|
||||
}
|
||||
if (name.length() == 0) {
|
||||
result = new Result("Name is empty");
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user