001// MultiDiff.java 002 003package daikon.diff; 004 005import java.io.FileOutputStream; 006import java.io.IOException; 007import java.io.PrintStream; 008import java.lang.reflect.InvocationTargetException; 009 010/** 011 * <B>MultiDiff</B> is an executable application that performs the same functionality as Diff with a 012 * few key change. First, it always outputs the histogram even when two files are called. Second, it 013 * allows the option of creating *.spinfo based on the invariants found. 014 */ 015public class MultiDiff { 016 private MultiDiff() { 017 throw new Error("do not instantiate"); 018 } 019 020 public static void main(String[] args) 021 throws IOException, 022 ClassNotFoundException, 023 InstantiationException, 024 IllegalAccessException, 025 NoSuchMethodException, 026 InvocationTargetException { 027 try { 028 mainHelper(args); 029 } catch (daikon.Daikon.DaikonTerminationException e) { 030 daikon.Daikon.handleDaikonTerminationException(e); 031 } 032 } 033 034 /** 035 * This does the work of {@link #main(String[])}, but it never calls System.exit, so it is 036 * appropriate to be called progrmmatically. 037 */ 038 public static void mainHelper(final String[] args) 039 throws IOException, 040 ClassNotFoundException, 041 InstantiationException, 042 IllegalAccessException, 043 InvocationTargetException, 044 NoSuchMethodException { 045 try (FileOutputStream fos = new FileOutputStream("rand_sel.spinfo")) { 046 PrintStream out = new PrintStream(fos); 047 /* 048 try { 049 if (args.length != 0) { 050 FileOutputStream file = new FileOutputStream (args[0]); 051 out = new PrintStream (file); 052 } 053 } 054 055 catch (IOException e) {e.printStackTrace(); } 056 */ 057 MultiDiffVisitor.setForSpinfoOut(out); 058 Diff.main(args); 059 } 060 } 061}