Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic program repair in plugin #189

Open
Ao-senXiong opened this issue Sep 22, 2023 · 0 comments
Open

Automatic program repair in plugin #189

Ao-senXiong opened this issue Sep 22, 2023 · 0 comments

Comments

@Ao-senXiong
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant