Can you please let me know if there is way to write a check when it spans across multiple java classes.
For Example: we want to check if there is DB call made in loop, in the below example the call from first class is made to a second class. Can we want check if helper method is a call to DB. Is it possible to write a rule for this scenario? Can you please point me to custom rule that checks across class files.
First.java
public class First {
public void method1(){
Second secRef = new Second();
List<String> res = new ArrayList<>();
for(int i=0;i<n;i++){
red.add(secRef.helper(i));
}
}
}
Second.java
public class Second{
public String helper(int i){
// call database
String result;
result = DAO.callSQL(i);
return result;
}
}