Skip to content

Commit

Permalink
incorporate PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
swissiety committed Jan 31, 2024
1 parent 66a0cc8 commit f139b8e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion sootup.core/src/main/java/sootup/core/IdentifierFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ FieldSignature getFieldSignature(

boolean isStaticInitializerSubSignature(@Nonnull MethodSubSignature methodSubSignature);

boolean isConstructorSubSignature(@Nonnull MethodSignature methodSignature);
boolean isConstructorSignature(@Nonnull MethodSignature methodSignature);

boolean isConstructorSubSignature(@Nonnull MethodSubSignature methodSubSignature);

boolean isMainSubSignature(@Nonnull MethodSubSignature methodSubSignature);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public void testFix_StackUnderrun_convertPutFieldInsn_init() {
Arrays.asList(
"java.util.concurrent.Executor", "javax.management.MBeanNotificationInfo[]"));

assertTrue(idf.isConstructorSubSignature(mainMethodSignature));
assertTrue(idf.isConstructorSignature(mainMethodSignature));
assertTrue(idf.isConstructorSubSignature(mainMethodSignature.getSubSignature()));

final SootClass abstractClass = view.getClass(mainClassSignature).get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,23 @@ public class JavaIdentifierFactory implements IdentifierFactory {
@Nonnull private static final JavaIdentifierFactory INSTANCE = new JavaIdentifierFactory();

@Nonnull
public final MethodSubSignature STATIC_INITIALIZER =
public static final MethodSubSignature STATIC_INITIALIZER =
new MethodSubSignature("<clinit>", Collections.emptyList(), VoidType.getInstance());

@Override
public boolean isStaticInitializerSubSignature(@Nonnull MethodSubSignature methodSubSignature) {
return methodSubSignature.getName().equals("<clinit>")
&& methodSubSignature.getParameterTypes().isEmpty()
&& methodSubSignature.getType() == VoidType.getInstance();
return methodSubSignature.equals(STATIC_INITIALIZER);
}

@Override
public boolean isConstructorSubSignature(@Nonnull MethodSignature methodSignature) {
return methodSignature.getName().equals("<init>")
&& methodSignature.getType() == VoidType.getInstance();
public boolean isConstructorSignature(@Nonnull MethodSignature methodSignature) {
return isConstructorSubSignature(methodSignature.getSubSignature());
}

@Override
public boolean isConstructorSubSignature(@Nonnull MethodSubSignature methodSubSignature) {
return methodSubSignature.getName().equals("<init>")
&& methodSubSignature.getType() == VoidType.getInstance();
}

@Override
Expand Down

0 comments on commit f139b8e

Please sign in to comment.