Skip to content

Commit

Permalink
fix signature check of java9 with modules
Browse files Browse the repository at this point in the history
  • Loading branch information
swissiety committed Oct 9, 2023
1 parent d623b8d commit f29ba9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public Optional<? extends ClassType> resolveSuperclass() {
if (classNode.superName == null) {
return Optional.empty();
}
return Optional.ofNullable(AsmUtil.toJimpleClassType(classNode.superName));
return Optional.of(AsmUtil.toJimpleClassType(classNode.superName));
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ public Optional<SootClassSource<JavaSootClass>> createClassSource(
SootClassNode classNode = new SootClassNode(analysisInputLocation);

try {
final String actualClassSignature = AsmUtil.initAsmClassSource(sourcePath, classNode);
if (!actualClassSignature.replace('/', '.').equals(classType.toString())) {
final String actualClassSignatureStr =
AsmUtil.initAsmClassSource(sourcePath, classNode).replace('/', '.');
if (!actualClassSignatureStr.equals(
classType.getFullyQualifiedName())) { // in >Java9 omit the module part of the signature
throw new IllegalArgumentException(
"The given Classtype '"
+ classType
+ "' did not match the found ClassType in the compilation unit '"
+ actualClassSignature
+ actualClassSignatureStr
+ "'. Possibly the AnalysisInputLocation points to a subfolder already including the PackageName directory while the ClassType you wanted to retrieve is missing a PackageName.");
}
} catch (IOException | IllegalArgumentException exception) {
Expand Down

0 comments on commit f29ba9f

Please sign in to comment.