@@ -35,10 +35,12 @@ public class MainScreen {
3535
3636 private static final List <String > has_parameter = new ArrayList <>();
3737
38+ //获取commond
39+ private static final Commands command = new Commands ();
40+
3841 public static void screen (String [] args ) throws Exception {
3942 Logo .PrintLogo ();//打印logo
4043 System .out .println ("============================================================================================" );
41- Commands command = new Commands (); //获取commond
4244 JCommander jc = JCommander .newBuilder ().addObject (command ).build ();
4345 jc .parse (args );
4446 if (command .help ) {
@@ -52,7 +54,7 @@ public static void screen(String[] args) throws Exception {
5254 if (command .isjar ){
5355 readbasicjar = true ;
5456 }
55- getClassFileList (command .jarpath , true , readbasicjar );
57+ getClassFileList (command .jarpath , readbasicjar );
5658 discovery ();
5759 inherit ();
5860
@@ -95,10 +97,7 @@ public static void screen(String[] args) throws Exception {
9597 String returnparameter = "" ;
9698 String parameter = "" ;
9799 String method = "" ;
98- boolean sta_tic = false ;
99- if (command .isstatic ){
100- sta_tic = true ;
101- }
100+ boolean sta_tic = command .isstatic ;
102101 if (command .paramter != null ) {
103102 parameter = command .paramter .replace ("." , "/" ).replace ("|" , "$" );
104103 }
@@ -408,11 +407,21 @@ public static void make_methoddunnolist(HashMap<String,List<String>> hashMap){
408407 }
409408 public static HashMap <String ,List <String >> getresult (HashSet <String > hashSet ,List <String > list ){
410409 HashMap <String ,List <String >> returnresult = new HashMap <>();
411- for (String s :hashSet ){
412- List <String > list1 = getlist (s ,list );
413- returnresult .put (s ,list1 );
410+ if (command .isdedug ){
411+ for (String s :hashSet ){
412+ List <String > list1 = getlist (s ,list );
413+ returnresult .put (s ,list1 );
414+ System .out .println (returnresult );
415+ }
416+ }
417+ else {
418+ for (String s :hashSet ){
419+ List <String > list1 = getlist (s ,list );
420+ returnresult .put (s ,list1 );
421+ }
414422 }
415423 return returnresult ;
424+
416425 }
417426 public static List <String > getlist (String s ,List <String > list ){
418427 List <String > list1 = new ArrayList <>();
@@ -576,8 +585,8 @@ public static void has_interfaces(List<String> interfacea){
576585 for (Map .Entry <ClassReference .Handle , ClassReference > handle : classMap .entrySet ()) {
577586 List <String > interfaces = handle .getValue ().getInterfaces ();
578587 if (interfaces != null ) {
579- for (int j = 0 ; j < interfaces . size (); j ++ ) {
580- if (interfaces . get ( j ) .contains (s .replace ("." , "/" ).replace ("|" , "$" ))) {
588+ for (String anInterface : interfaces ) {
589+ if (anInterface .contains (s .replace ("." , "/" ).replace ("|" , "$" ))) {
581590 hasinterfaces .add (handle .getKey ().getName ());
582591 }
583592 }
@@ -613,11 +622,11 @@ private static void discovery() {
613622 DiscoveryService .start (classFileList , discoveredClasses , discoveredMethods ,
614623 classMap , methodMap , classFileByName );
615624 }
616- private static void getClassFileList (String path ,boolean readjar , boolean readbasicjar ) throws Exception {
625+ private static void getClassFileList (String path , boolean readbasicjar ) throws Exception {
617626 ReadUtil readUtil = new ReadUtil ();
618627 File file = new File (path );
619628 if (file .isDirectory ()){
620- getclassfromfloder (path ,readjar ,readbasicjar );
629+ getclassfromfloder (path , true ,readbasicjar );
621630 }
622631 if (file .isFile ()){
623632 if (path .endsWith (".txt" )){
@@ -627,7 +636,7 @@ private static void getClassFileList(String path,boolean readjar,boolean readbas
627636 classFileList .addAll (ClassUtil .getAllClassesFromJars (Collections .singletonList (s ),
628637 readbasicjar ));
629638 } else if (new File (s ).isDirectory ()) {
630- getclassfromfloder (s , readjar , readbasicjar );
639+ getclassfromfloder (s , true , readbasicjar );
631640 } else {
632641 System .out .println ("导入出错!!!!!!!!!!!!!" );
633642 }
@@ -643,6 +652,7 @@ public static void getclassfromfloder(String path,boolean readjar,boolean readba
643652
644653 if (readjar ){
645654 List <String > jarfiles = ReadUtil .noRecursion (file ,".jar" );
655+ assert jarfiles != null ;
646656 for (String jarfile : jarfiles ) {
647657 classFileList .addAll (ClassUtil .getAllClassesFromJars (Collections .singletonList (jarfile ), readbasicjar ));
648658 }
0 commit comments