Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions plugin/callgraph/fixtures/testJavaArguments.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.awt.Canvas;
import java.awt.Dialog;
import java.awt.Window;
import java.awt.Frame;

public class testJavaArguments {

public static void testMessageDigest() throws NoSuchAlgorithmException {
// Test literal string argument matching - should match MD5 signature
MessageDigest md5 = MessageDigest.getInstance("MD5");

// Test different case variations
MessageDigest md5Upper = MessageDigest.getInstance("md5");

// Test SHA-256 hash algorithm
MessageDigest sha256 = MessageDigest.getInstance("SHA-256");

// Test SHA-1 (should match sha1 signature)
MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
}

public static void testCanvasSetSize() {
Canvas canvas1 = new Canvas();
// Test specific numeric literal arguments
canvas1.setSize(32, 99);

Canvas canvas2 = new Canvas();
// Test different values (should not match 32, 99 signature)
canvas2.setSize(64, 128);

Canvas canvas3 = new Canvas();
// Test first arg matches, second doesn't
canvas3.setSize(32, 100);
}

public static void testDialogWithWindow() {
// Test type resolution - Dialog constructor with Window argument
Window window = new Window(new Frame());
Dialog dialog = new Dialog(window);

// Test nested type resolution
Dialog nestedDialog = new Dialog(new Window(new Frame()));
}

public static void testMixedArguments() {
Canvas canvas = new Canvas();
// Variable arguments (should not match specific literal signatures)
int width = 32;
int height = 99;
canvas.setSize(width, height);
}

public static void main(String[] args) {
try {
testMessageDigest();
testCanvasSetSize();
testDialogWithWindow();
testMixedArguments();
} catch (Exception e) {
e.printStackTrace();
}
}
}
2 changes: 2 additions & 0 deletions plugin/callgraph/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func resolveNamespaceWithSeparator(moduleName string, lang core.Language) string
if exists {
return strings.Join(strings.Split(moduleName, separator), namespaceSeparator)
}

return moduleName
}

Expand All @@ -111,5 +112,6 @@ func resolveSubmoduleIdentifier(identifier string, lang core.Language) string {
parts := strings.Split(identifier, separator)
return parts[len(parts)-1]
}

return identifier
}
Loading