2017-01-16 4 views
1

私はこれについてIntellij can scanを知っています - そして、Scannotationと呼ばれる古代のプロジェクトがあるようです。これらのどちらも私が望むことをしていないようです。廃止予定のクラスをすべてファイルにリストする方法は?

@Deprecatedとマークされたクラスの完全なパッケージ名をコードベースに表示したいとします。

私の質問は:廃止予定のクラスをすべてファイルにリストするにはどうすればいいですか? UNIX/Linuxシステム上で

答えて

0

これはあなたが使用することができるものである。これに

package util; 

    import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner; 
    import io.github.lukehutch.fastclasspathscanner.matchprocessor.ClassAnnotationMatchProcessor; 

    public class AnnotationScanTest { 


     public static void main(String args[]) throws ClassNotFoundException { 


      new FastClasspathScanner("com") 
        // Optional, in case you want to debug any issues with scanning. 
        // Add this right after the constructor to maximize the amount of log info. 
        .verbose() 
        // Add a MatchProcessor ("Mechanism 1") 
        .matchClassesWithAnnotation(Deprecated.class, new ClassAnnotationMatchProcessor() { 
         @Override 
         public void processMatch(Class<?> matchingClass) { 
          System.out.println("Matching annotation: " + matchingClass); 
         } 
        }) 
        // Actually perform the scan (nothing will happen without this call) 
        .scan(); 
     } 

    } 
0

あなたはこれがsedまたはその他のテキストエディタでの表記をパッケージ化するために変更される可能性が絶対パスとファイルのリストを与えるだろうfind . -name *.java -regex "@Deprecated"

を使用することができます。

Windowsでは、gitのインストールを検討すると、このコマンドを実行できるbashが表示されます。

+1

問題があるが、非推奨のメソッドを持つファイルもリストされます(クラス全体では廃止されているわけではありません) –

+0

これは素晴らしいことです。それを修正すると、クラス宣言の前のものだけが完璧になります。 – hawkeye

0

Structural Searchを使用できます。

CTRL + SHIFT + A - >Search Structurally

使用これは、すべての非推奨クラス見つける:

@Deprecated 
class $class$ { 
} 
関連する問題