openrewrite / rewrite

Automated mass refactoring of source code.
https://docs.openrewrite.org
Apache License 2.0
2.13k stars 317 forks source link

CommonStaticAnalysis recipe does not change calls to getter/setters on camel casing changes. #3611

Closed Murtuza24 closed 11 months ago

Murtuza24 commented 11 months ago

What version of OpenRewrite are you using?

I am using

How are you running OpenRewrite?

I am using the Moderne CLI v 1.1.0.

mod build . mod run . --recipe=CommonStaticAnalysis mod apply . --last-recipe-run

What is the smallest, simplest way to reproduce the problem?


// lombok annotation
@Data
class A {
private String variable_name1;
private String variable_name2;
    // do something
}

class B {
  void setAData (){
     A a = new A();
     a.setvariable_name1("some value 1");
     a.setvariable_name2("some value 2");
   }
}

class C {
  void retreiveAData(A a) {
   String data1 = a.getvariable_name1();
   String data2 = a.getvariable_name2();
  }
}

What did you expect to see?

// lombok annotation
@Data
class A {
private String variableName1;
private String variableName2;
    // do something
}

class B {
  void setAData (){
     A a = new A();
     a.setVariableName1("some value 1");
     a.setVariableName2("some value 2");
   }
}

class C {
  void retreiveAData(A a) {
   String data1 = a.getVariableName1();
   String data2 = a.getVariableName2();
  }
}

What did you see instead?


// lombok annotation
@Data
class A {
private String variableName1;
private String variableName2;
    // do something
}

class B {
  void setAData (){
     A a = new A();
     a.setvariable_name1("some value 1");
     a.setvariable_name2("some value 2");
   }
}

class C {
  void retreiveAData(A a) {
   String data1 = a.getvariable_name1();
   String data2 = a.getvariable_name2();
  }
}

What is the full stack trace of any errors you encountered?

There are no errors while running the CommonStaticAnalysis v1.0.8 recipe.

Are you interested in contributing a fix to OpenRewrite?

Murtuza24 commented 11 months ago

moved to correct repository issue: rewrite-static-analysis https://github.com/openrewrite/rewrite-static-analysis/issues/189