File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
src/main/java/club/bytecode/the/jda Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ public ClassNode loadClassFile(String filename) {
3636
3737 public String findClassfile (String className ) {
3838 String candidate = className + ".class" ;
39+ if (name .endsWith (".class" )) { // this is a single .class file. we need to strip the package path out.
40+ candidate = JDA .getClassName (candidate );
41+ }
3942 if (files .containsKey (candidate ))
4043 return candidate ;
4144 return "" ;
Original file line number Diff line number Diff line change @@ -270,6 +270,11 @@ public static String getClassFilePath(String fileName) {
270270 return fileName .replace (File .separator , "/" ).substring (0 , fileName .length () - ".class" .length ());
271271 }
272272
273+ /**
274+ * Returns the last part of a fully qualified name, e.g. the class name.
275+ * @param fullyQualifiedName a fully qualified name like "java/lang/String"
276+ * @return just the name without the package name, e.g. "String"
277+ */
273278 public static String getClassName (String fullyQualifiedName ) {
274279 return fullyQualifiedName .substring (fullyQualifiedName .lastIndexOf ('/' ) + 1 );
275280 }
You can’t perform that action at this time.
0 commit comments