Hello,
Is it possible to apply suggestions from multiple related bugchecks in a specific order in in a single run?
Example:
Given:
- BugCheckA: moves initialized fields to constructor
- BugCheckB: introduce parameter to constructor
- Initial code snipped:
class A {
private int a;
private int b = 1;
A(int a) {
this.a = a;
}
public static void main(String[] args) {
A obj = new A(2);
}
}
Then:
- Apply
BugCheckA resulting in
class A {
private int a;
private int b;
A(int a) {
this.a = a;
this.b = 1;
}
public static void main(String[] args) {
A obj = new A(2);
}
}
Note that b is now initialized inside the constructor instead of the field declaration
- Apply
BugCheckB resulting in
class A {
private int a;
private int b;
A(int a, int b) {
this.a = a;
this.b = b;
}
public static void main(String[] args) {
A obj = new A(2, 1);
}
}
Note that the constructor now has an extra parameter and the object initialization was updated.
Desired
While I'm aware that ErrorProne can be used to inline suggestions when configured with
-XepPatchChecks:BugCheckA,BugCheckB -XepPatchLocation:IN_PLACE
I noticed that I needed two separate runs for each check instead of one.
Is there a way ask ErroProne to run these related bugchecks in a specific order in a single run? (Or maybe, have a "meta"-bugcheck that is composed by these checks?)
Thanks in advance!
Cheers 👋
Hello,
Is it possible to apply suggestions from multiple related bugchecks in a specific order in in a single run?
Example:
Given:
Then:
BugCheckAresulting inNote that
bis now initialized inside the constructor instead of the field declarationBugCheckBresulting inNote that the constructor now has an extra parameter and the object initialization was updated.
Desired
While I'm aware that ErrorProne can be used to inline suggestions when configured with
I noticed that I needed two separate runs for each check instead of one.
Is there a way ask ErroProne to run these related bugchecks in a specific order in a single run? (Or maybe, have a "meta"-bugcheck that is composed by these checks?)
Thanks in advance!
Cheers 👋