Skip to content

Commit

Permalink
make API return type more convenient
Browse files Browse the repository at this point in the history
  • Loading branch information
swissiety committed Dec 21, 2023
1 parent 023e566 commit 011a239
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ public CallGraph addClass(@Nonnull CallGraph oldCallGraph, @Nonnull JavaClassTyp
Set<MethodSignature> newMethodSignatures =
clazz.getMethods().stream().map(Method::getSignature).collect(Collectors.toSet());


if (newMethodSignatures.stream().anyMatch(oldCallGraph::containsMethod)) {
// FIXME: [ms] handle better - remove from entry point signatures in this case
throw new IllegalArgumentException("CallGraph already contains methods from " + classType);
Expand Down Expand Up @@ -356,7 +355,7 @@ public CallGraph addClass(@Nonnull CallGraph oldCallGraph, @Nonnull JavaClassTyp
MethodSignature overridingMethodSig =
clazz.getMethod(overriddenMethodSig.getSubSignature()).get().getSignature();

if( updated.containsMethod(overriddenMethodSig) ){
if (updated.containsMethod(overriddenMethodSig)) {
for (MethodSignature callingMethodSig : updated.callsTo(overriddenMethodSig)) {
updated.addCall(callingMethodSig, overridingMethodSig);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import sootup.core.signatures.MethodSubSignature;
import sootup.core.types.ClassType;
import sootup.core.types.Type;
import sootup.java.core.types.JavaClassType;
import sootup.java.core.views.JavaView;

public class JavaSootClass extends SootClass<JavaSootClassSource> {
Expand All @@ -45,6 +46,12 @@ public JavaSootClass(JavaSootClassSource classSource, SourceType sourceType) {
super(classSource, sourceType);
}

@Nonnull
@Override
public JavaClassType getType() {
return (JavaClassType) super.getType();
}

/**
* Get all annotations on this class. If provided with a View, will also resolve all inherited
* annotations from super classes.
Expand Down

0 comments on commit 011a239

Please sign in to comment.