-
Notifications
You must be signed in to change notification settings - Fork 75
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
AddMissingMethodImplementation
generates wrong method for constructors
#360
Comments
Sorry to hear about your issues with this recent addition; adding constructors was not taken into account when this recipe was created. I'm not quite sure what would be needed to support that; perhaps we can start with a draft PR using the above test and work out the details from there. I suspect the JavaTemplate used might need to be made rewrite-migrate-java/src/main/java/org/openrewrite/java/migrate/AddMissingMethodImplementation.java Line 66 in 523cc18
Beyond that we're going to have to find out. Thanks at least for trying it out and reporting your findings already! |
Here's the template that is being parsed on https://github.com/openrewrite/rewrite/blob/main/rewrite-java/src/main/java/org/openrewrite/java/internal/template/JavaTemplateParser.java#L163: package org.openrewrite.example;
import org.openrewrite.example.AbstractClass;
class __P__ { static native <T> T p(); static native <T> T[] arrp(); static native boolean booleanp(); static native byte bytep(); static native char charp(); static native double doublep(); static native int intp(); static native long longp(); static native short shortp(); static native float floatp();}class __M__ { static native Object any(Object o); static native Object any(java.util.function.Predicate<Boolean> o); static native <T> Object anyT();}public class ImplementationClass extends AbstractClass{
/*__TEMPLATE__*/
public class ImplementationClass extends AbstractClass {
public ImplementationClass(String param) {
super(param);
}
}/*__TEMPLATE_STOP__*/
} And here's the parsed tree (for brevity, I'm omiting the
|
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I'm applying rules using the maven plugin and a custom recipe artifact
What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
What did you see instead?
What is the full stack trace of any errors you encountered?
Are you interested in contributing a fix to OpenRewrite?
The text was updated successfully, but these errors were encountered: