openrewrite / openrewrite/rewrite-static-analysis

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

Open
#189 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
62
Forks
112
Avg merge
1d 19h
Merged PRs (30d)
40

Description

What version of OpenRewrite are you using?

I am using

rewrite-static-analysis_ v1.0.8

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with Moderne CLI using mod build ., mod run . --recipe=CommonStaticAnalysis, and mod apply . --last-recipe-run against the Java example in the report. Trace the CommonStaticAnalysis recipe to identify why getter and setter calls are not updated when field names change from snake_case to camelCase. Done means the calls match the expected output and a regression test covers the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.