Skip to content

Commit

Permalink
Merge pull request #1005 from soot-oss/removeIsBuiltInClass
Browse files Browse the repository at this point in the history
remove IsBuiltInClass() heuristic from ClassType
  • Loading branch information
stschott authored Aug 6, 2024
2 parents e8381d1 + cb8a3fd commit 75e4517
Show file tree
Hide file tree
Showing 17 changed files with 0 additions and 94 deletions.
5 changes: 0 additions & 5 deletions sootup.core/src/main/java/sootup/core/model/SootMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ public boolean isMain(@Nonnull IdentifierFactory idf) {
return isPublic() && isStatic() && idf.isMainSubSignature(getSignature().getSubSignature());
}

/** We rely on the JDK class recognition to decide if a method is JDK method. */
public boolean isBuiltInMethod() {
return getSignature().getDeclClassType().isBuiltInClass();
}

/**
* Returns the declaration of this method, as used at the top of textual body representations
* (before the {}'s containing the code for representation.)
Expand Down
1 change: 0 additions & 1 deletion sootup.core/src/main/java/sootup/core/types/ClassType.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* @author Markus Schmidt
*/
public abstract class ClassType extends ReferenceType implements Signature {
public abstract boolean isBuiltInClass();

public abstract String getFullyQualifiedName();

Expand Down
4 changes: 0 additions & 4 deletions sootup.core/src/test/java/sootup/core/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ public static JInstanceFieldRef createDummyInstanceFieldRef() {
*/
public static ClassType createDummyClassType() {
return new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ public class MutableBlockStmtGraphTest {

private ClassType throwableSig =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return true;
}

@Override
public String getFullyQualifiedName() {
Expand All @@ -58,10 +54,6 @@ public PackageName getPackageName() {

private ClassType ioExceptionSig =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return true;
}

@Override
public String getFullyQualifiedName() {
Expand Down Expand Up @@ -564,10 +556,6 @@ public void modifyTrapToCompleteBlock() {
public void testTrapAggregation() {
final ClassType exception1 =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand All @@ -587,10 +575,6 @@ public PackageName getPackageName() {

final ClassType exception2 =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public void testGenerate() {
final Local r0 =
localGenerator.generateLocal(
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ public void testMethodHandle() {

ClassType classType =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ public void addImportTest() {

private ClassType generateClass(String name, PackageName pckg) {
return new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,4 @@ public JavaSootClass withPosition(@Nullable Position position) {
return new JavaSootClass(
new OverridingJavaClassSource(getClassSource()).withPosition(position), sourceType);
}

public boolean isJavaLibraryClass() {
return this.classSignature.isBuiltInClass();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import sootup.core.IdentifierFactory;
import sootup.core.signatures.PackageName;
import sootup.core.types.ClassType;
import sootup.java.core.signatures.ModulePackageName;

/** Represents the unique fully-qualified name of a Class (aka its signature). */
public class JavaClassType extends ClassType {
Expand Down Expand Up @@ -121,15 +120,4 @@ public String getClassName() {
public PackageName getPackageName() {
return packageName;
}

public boolean isBuiltInClass() {
PackageName packageName = getPackageName();
if (packageName instanceof ModulePackageName) {
// if java modules (>= java9) are used: use JrtFileSystem for explicit.. otherwise use the
// following heuristic
String moduleName = ((ModulePackageName) packageName).getModuleSignature().toString();
return moduleName.startsWith("java.") || moduleName.startsWith("jdk.");
}
return LIBRARY_CLASS_PATTERN.matcher(packageName.getName()).find();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ public void testClassResolving() {

ClassType onlyClassNameType =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand All @@ -42,10 +38,6 @@ public PackageName getPackageName() {

final ClassType classType =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand All @@ -65,10 +57,6 @@ public PackageName getPackageName() {

final ClassType classTypeFake =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public void Setup() {

ClassType classTypeCheckInitValidator =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ public void Setup() {

ClassType classTypeFieldRefValidator =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public void Setup() {

ClassType classTypeFieldRefValidator =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ public void Setup() {

ClassType classTypeCheckInitValidator =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ public static void Setup() {

ClassType classTypeCheckInitValidator =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ public void Setup() {

ClassType classTypeNewValidator =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ public void Setup() {

ClassType classTypeCheckInitValidator =
new ClassType() {
@Override
public boolean isBuiltInClass() {
return false;
}

@Override
public String getFullyQualifiedName() {
Expand Down

0 comments on commit 75e4517

Please sign in to comment.