Search in sources :

Example 6 with ClassReader

use of org.powermock.api.mockito.repackaged.asm.ClassReader in project powermock by powermock.

the class CheckClassAdapter method main.

/**
     * Checks a given class. <p> Usage: CheckClassAdapter &lt;fully qualified
     * class name or class file name&gt;
     *
     * @param args the command line arguments.
     *
     * @throws Exception if the class cannot be found, or if an IO exception
     *         occurs.
     */
public static void main(final String[] args) throws Exception {
    if (args.length != 1) {
        System.err.println("Verifies the given class.");
        System.err.println("Usage: CheckClassAdapter " + "<fully qualified class name or class file name>");
        return;
    }
    ClassReader cr;
    if (args[0].endsWith(".class")) {
        cr = new ClassReader(new FileInputStream(args[0]));
    } else {
        cr = new ClassReader(args[0]);
    }
    verify(cr, false, new PrintWriter(System.err));
}
Also used : ClassReader(org.powermock.api.mockito.repackaged.asm.ClassReader) FileInputStream(java.io.FileInputStream) PrintWriter(java.io.PrintWriter)

Aggregations

ClassReader (org.powermock.api.mockito.repackaged.asm.ClassReader)6 PrintWriter (java.io.PrintWriter)4 FileInputStream (java.io.FileInputStream)3 IOException (java.io.IOException)2 BufferedOutputStream (java.io.BufferedOutputStream)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Reference (java.lang.ref.Reference)1 WeakReference (java.lang.ref.WeakReference)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 WeakHashMap (java.util.WeakHashMap)1 ClassWriter (org.powermock.api.mockito.repackaged.asm.ClassWriter)1 TraceClassVisitor (org.powermock.api.mockito.repackaged.asm.util.TraceClassVisitor)1 CodeGenerationException (org.powermock.api.mockito.repackaged.cglib.core.CodeGenerationException)1 DebuggingClassWriter (org.powermock.api.mockito.repackaged.cglib.core.DebuggingClassWriter)1