-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
For a buggy code snippet like below,
public class Greeting {
public static void greet(String name) {
System.out.println("Hello, " + name.trim());
}
public static void main(String[] args) {
greet(null); // This will throw a NullPointerException
}
}
can we have some features to automatic generate code patch like
public class Greeting {
public static void greet(@NonNull String name) {
System.out.println("Hello, " + name.trim());
}
public static void main(String[] args) {
String name = null;
if (name != null) {
greet(name); // Safe now!
} else {
System.out.println("Name is not provided.");
}
}
}
I think this will be helpful for developers are using the plugin.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels