You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using ParameterizedLogging, the output is not compatible in my IDE, since restriction is placed on autoboxing usage.
I wish I can apply another recipe that performs automatic wrapping of those primitives.
Note1: its fine if all applicable primitives are changed, since the entire project doesn't use autoboxing in the first place.
Note2: should be applicable to all primitives that can be autoboxed. i.e.: byte, short, int, long, float, double, char, boolean
What precondition(s) should be checked before applying this recipe?
Nil.
Describe the situation before applying the recipe
classA {
voidbar() {
inti = 0;
foo(i);
}
voidfoo(Integerbar) {
// do something
}
}
Describe the situation after applying the recipe
classA {
voidbar() {
inti = 0;
foo(Integer.valueOf(i));
}
voidfoo(Integerbar) {
// do something
}
}
Have you considered any alternatives or workarounds?
Unfortunately, I did not manage to fine any recipe, or rewrite tool, that supports this.
I was hoping IDE (Eclipse) can separate autoboxing and autounboxing criticality, but it doesn't allow me to do so.
Sure, if someone more experienced tells me its possible to create such a recipe.
I am afraid to dig deep into it, only to find out it is not possible with the current openrewrite concept.
The text was updated successfully, but these errors were encountered:
return"Under certain conditions the `java.lang.Boolean` type is used as an expression, " +
"and it may throw a `NullPointerException` if the value is null.";
}
It sounds like your suggestion would be a separate recipe where we visit any method invocation, figure out if the types are boxed versions of the argument types passed in, and if so replace the arguments with explicit boxing. Would you also want to handle cases where there's a need to go from Integer to int?
I think it should be possible to create such a recipe with the type information that we have. You can look here to get started with either a fork of this repository, or a custom recipe module for your own purposes based on the moderneinc/rewrite-recipe-starter.
What problem are you trying to solve?
When using ParameterizedLogging, the output is not compatible in my IDE, since restriction is placed on autoboxing usage.
I wish I can apply another recipe that performs automatic wrapping of those primitives.
Note1: its fine if all applicable primitives are changed, since the entire project doesn't use autoboxing in the first place.
Note2: should be applicable to all primitives that can be autoboxed. i.e.: byte, short, int, long, float, double, char, boolean
What precondition(s) should be checked before applying this recipe?
Nil.
Describe the situation before applying the recipe
Describe the situation after applying the recipe
Have you considered any alternatives or workarounds?
Unfortunately, I did not manage to fine any recipe, or rewrite tool, that supports this.
I was hoping IDE (Eclipse) can separate autoboxing and autounboxing criticality, but it doesn't allow me to do so.
Any additional context
Nil.
Are you interested in contributing this recipe to OpenRewrite?
Sure, if someone more experienced tells me its possible to create such a recipe.
I am afraid to dig deep into it, only to find out it is not possible with the current openrewrite concept.
The text was updated successfully, but these errors were encountered: