Skip to content

Commit 7dc962e

Browse files
authored
✅ Add Tests For Reflection Injection Edge Case (#406)
Add a tests for the edge case when code invokes the Class.forName(String) method using the fully qualified class name. /close #work
1 parent 3e93da7 commit 7dc962e

File tree

2 files changed

+210
-149
lines changed

2 files changed

+210
-149
lines changed

framework/codemodder-base/src/main/java/io/codemodder/remediation/reflectioninjection/DefaultReflectionInjectionRemediator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,11 @@ private static boolean isClassForNameCall(
9191
expression -> {
9292
if (expression.isNameExpr()) {
9393
final var nameExpr = expression.asNameExpr();
94-
return nameExpr.getNameAsString().equals("Class")
95-
|| nameExpr.getNameAsString().equals("java.lang.Class");
94+
return nameExpr.getNameAsString().equals("Class");
9695
}
9796
return false;
9897
})
9998
.orElse(
100-
// check for static import (TODO test)
10199
cu.getImports().stream()
102100
.anyMatch(
103101
importDeclaration ->

0 commit comments

Comments
 (0)