11package the .bytecode .club .bytecodeviewer .resources .classcontainer ;
22
3- import com .github .javaparser .*;
3+ import com .github .javaparser .JavaParser ;
4+ import com .github .javaparser .ParseResult ;
45import com .github .javaparser .ast .CompilationUnit ;
56import com .github .javaparser .resolution .TypeSolver ;
67import com .github .javaparser .symbolsolver .JavaSymbolSolver ;
1213import the .bytecode .club .bytecodeviewer .resources .classcontainer .locations .*;
1314import the .bytecode .club .bytecodeviewer .resources .classcontainer .parser .visitors .MyVoidVisitor ;
1415
15- import java .io .IOException ;
1616import java .util .ArrayList ;
1717import java .util .List ;
1818import java .util .NavigableMap ;
2727 */
2828public class ClassFileContainer
2929{
30+
3031 public transient NavigableMap <String , ArrayList <ClassFieldLocation >> fieldMembers = new TreeMap <>();
3132 public transient NavigableMap <String , ArrayList <ClassParameterLocation >> methodParameterMembers = new TreeMap <>();
3233 public transient NavigableMap <String , ArrayList <ClassLocalVariableLocation >> methodLocalMembers = new TreeMap <>();
@@ -35,13 +36,15 @@ public class ClassFileContainer
3536
3637 public boolean hasBeenParsed = false ;
3738 public final String className ;
39+ public final String decompiler ;
3840 private final String content ;
3941 private final String parentContainer ;
4042 private final String path ;
4143
42- public ClassFileContainer (String className , String content , ResourceContainer resourceContainer )
44+ public ClassFileContainer (String className , String decompiler , String content , ResourceContainer resourceContainer )
4345 {
4446 this .className = className ;
47+ this .decompiler = decompiler ;
4548 this .content = content ;
4649 this .parentContainer = resourceContainer .name ;
4750 this .path = resourceContainer .file .getAbsolutePath ();
@@ -95,15 +98,19 @@ public boolean shouldParse()
9598
9699 public String getName ()
97100 {
98- if (this .className .contains ("/" ))
99- return this .className .substring (this .className .lastIndexOf ('/' ) + 1 , this .className .lastIndexOf ('.' ));
100- else
101- return this .className .substring (0 , this .className .lastIndexOf ('.' ));
101+ int from = className .lastIndexOf ('/' ) + 1 ;
102+
103+ int until = className .lastIndexOf ('.' );
104+ if (until == -1 || until < from ) {
105+ until = className .length ();
106+ }
107+
108+ return className .substring (from , until );
102109 }
103110
104111 public String getDecompiler ()
105112 {
106- return this . className . substring ( this . className . lastIndexOf ( '-' ) + 1 ) ;
113+ return decompiler ;
107114 }
108115
109116 public String getParentContainer ()
0 commit comments