From 29d29e14ac6c0370624e4a98c745c78c2733b9ca Mon Sep 17 00:00:00 2001 From: Cody <6558800+Bl3nd@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:48:36 -0600 Subject: [PATCH] Add ability to open class files even when they don't have a package --- .../gui/components/actions/GoToAction.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/actions/GoToAction.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/actions/GoToAction.java index ae2fa1b7..23b5409e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/actions/GoToAction.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/actions/GoToAction.java @@ -211,7 +211,9 @@ public class GoToAction extends AbstractAction if (packagePath.startsWith("java") || packagePath.startsWith("javax") || packagePath.startsWith("com.sun")) return null; - String resourceName = packagePath + "/" + classMethodLocation.owner; + String resourceName = classMethodLocation.owner; + if (!packagePath.isEmpty()) + resourceName = packagePath + "/" + classMethodLocation.owner; if (resourceContainer.resourceClasses.containsKey(resourceName)) { @@ -229,7 +231,11 @@ public class GoToAction extends AbstractAction if (packagePath.startsWith("java") || packagePath.startsWith("javax") || packagePath.startsWith("com.sun")) return null; - String resourceName = packagePath + "/" + lexeme; + String resourceName = lexeme; + if (!packagePath.isEmpty()) + { + resourceName = packagePath + "/" + lexeme; + } if (resourceContainer.resourceClasses.containsKey(resourceName)) {