1
1
package the .bytecode .club .bytecodeviewer .resources .classcontainer ;
2
2
3
- import com .github .javaparser .*;
3
+ import com .github .javaparser .JavaParser ;
4
+ import com .github .javaparser .ParseResult ;
4
5
import com .github .javaparser .ast .CompilationUnit ;
5
6
import com .github .javaparser .resolution .TypeSolver ;
6
7
import com .github .javaparser .symbolsolver .JavaSymbolSolver ;
12
13
import the .bytecode .club .bytecodeviewer .resources .classcontainer .locations .*;
13
14
import the .bytecode .club .bytecodeviewer .resources .classcontainer .parser .visitors .MyVoidVisitor ;
14
15
15
- import java .io .IOException ;
16
16
import java .util .ArrayList ;
17
17
import java .util .List ;
18
18
import java .util .NavigableMap ;
27
27
*/
28
28
public class ClassFileContainer
29
29
{
30
+
30
31
public transient NavigableMap <String , ArrayList <ClassFieldLocation >> fieldMembers = new TreeMap <>();
31
32
public transient NavigableMap <String , ArrayList <ClassParameterLocation >> methodParameterMembers = new TreeMap <>();
32
33
public transient NavigableMap <String , ArrayList <ClassLocalVariableLocation >> methodLocalMembers = new TreeMap <>();
@@ -35,13 +36,15 @@ public class ClassFileContainer
35
36
36
37
public boolean hasBeenParsed = false ;
37
38
public final String className ;
39
+ public final String decompiler ;
38
40
private final String content ;
39
41
private final String parentContainer ;
40
42
private final String path ;
41
43
42
- public ClassFileContainer (String className , String content , ResourceContainer resourceContainer )
44
+ public ClassFileContainer (String className , String decompiler , String content , ResourceContainer resourceContainer )
43
45
{
44
46
this .className = className ;
47
+ this .decompiler = decompiler ;
45
48
this .content = content ;
46
49
this .parentContainer = resourceContainer .name ;
47
50
this .path = resourceContainer .file .getAbsolutePath ();
@@ -95,15 +98,19 @@ public boolean shouldParse()
95
98
96
99
public String getName ()
97
100
{
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 );
102
109
}
103
110
104
111
public String getDecompiler ()
105
112
{
106
- return this . className . substring ( this . className . lastIndexOf ( '-' ) + 1 ) ;
113
+ return decompiler ;
107
114
}
108
115
109
116
public String getParentContainer ()
0 commit comments