-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add new migration case of WebMvcConfigurer #616
base: main
Are you sure you want to change the base?
Conversation
} else if (newClass.getClazz() instanceof J.ParameterizedType) { | ||
J.ParameterizedType parameterizedType = (J.ParameterizedType) newClass.getClazz(); | ||
newClass = newClass.withClazz(parameterizedType | ||
.withType(WEB_MVC_CONFIGURER_TYPE) | ||
.withClazz(TypeTree.build(WEB_MVC_CONFIGURER).withType(WEB_MVC_CONFIGURER_TYPE)) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither WebMvcConfigurerAdapter
nor WebMvcConfigurer
takes in an generic type right? Would we even need the handling here then?
} else if (newClass.getClazz() instanceof J.ParameterizedType) { | |
J.ParameterizedType parameterizedType = (J.ParameterizedType) newClass.getClazz(); | |
newClass = newClass.withClazz(parameterizedType | |
.withType(WEB_MVC_CONFIGURER_TYPE) | |
.withClazz(TypeTree.build(WEB_MVC_CONFIGURER).withType(WEB_MVC_CONFIGURER_TYPE)) | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see these additional cases covered! Thanks a lot for the continued work on improvements here.
A quick question and two code suggestions before we merge, but otherwise this looks perfect already.
} else if (md.getReturnTypeExpression() instanceof J.ParameterizedType) { | ||
J.ParameterizedType parameterizedType = (J.ParameterizedType) md.getReturnTypeExpression(); | ||
md = md.withReturnTypeExpression(parameterizedType | ||
.withType(WEB_MVC_CONFIGURER_TYPE) | ||
.withClazz(TypeTree.build(WEB_MVC_CONFIGURER).withType(WEB_MVC_CONFIGURER_TYPE)) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if (md.getReturnTypeExpression() instanceof J.ParameterizedType) { | |
J.ParameterizedType parameterizedType = (J.ParameterizedType) md.getReturnTypeExpression(); | |
md = md.withReturnTypeExpression(parameterizedType | |
.withType(WEB_MVC_CONFIGURER_TYPE) | |
.withClazz(TypeTree.build(WEB_MVC_CONFIGURER).withType(WEB_MVC_CONFIGURER_TYPE)) | |
); |
What's changed?
The origin recipe only handle classes that extend WebMvcConfigurer. In some cases, people return
new WebMvcConfigurer()
directly as a bean.Checklist