Skip to content

Commit

Permalink
fix ruby auto-import collisions
Browse files Browse the repository at this point in the history
Error messages were displayed in the Ruby interpreter when classes were
automatically imported with names that already existed in the namespace.
This fix restores functionality to the check that skips imports of classes
where the name is already defined.
  • Loading branch information
goatshriek committed Mar 16, 2023
1 parent 054b9f5 commit b970fb9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/rubydragon/ruby/RubyGhidraInterpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ public class RubyGhidraInterpreter extends ScriptableGhidraInterpreter {
String loadError = null;
container.getOutput().append("starting auto-import...\n");
try {
DragonPlugin.forEachAutoImport(className -> {
DragonPlugin.forEachAutoImport((packageName, className) -> {
// we don't import the class if it will stomp an existing symbol
// we also have to skip Data because it generates deprecation warnings
if (!className.equals("Data") && container.get(className) == null) {
String importStatement = "java_import Java::" + className;
String importStatement = "java_import Java::" + packageName + "." + className;
container.runScriptlet(importStatement);
}
});
Expand Down

0 comments on commit b970fb9

Please sign in to comment.