home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 October / pcp156b.iso / alphawrk / JAX / JAX53.ZIP / jax.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-04-28  |  15.4 KB  |  450 lines

  1. import com.ibm.bobby.aa;
  2. import com.ibm.bobby.au;
  3. import com.ibm.bobby.bs;
  4. import com.ibm.bobby.r;
  5. import com.ibm.jax.e;
  6. import com.ibm.jax.l;
  7. import com.ibm.jax.m;
  8. import com.ibm.jax.o;
  9. import com.ibm.jax.q;
  10. import java.io.DataInputStream;
  11. import java.io.File;
  12. import java.io.FileInputStream;
  13. import java.io.FileNotFoundException;
  14. import java.io.IOException;
  15. import java.util.Date;
  16. import java.util.StringTokenizer;
  17.  
  18. public class jax {
  19.    // $FF: renamed from: m com.ibm.jax.o
  20.    public static o field_0;
  21.    // $FF: renamed from: l java.lang.String
  22.    public static String field_1;
  23.  
  24.    static {
  25.       boolean var10000 = false;
  26.       var10000 = false;
  27.    }
  28.  
  29.    // $FF: renamed from: e (java.lang.String) void
  30.    public static void method_0(String var0) {
  31.       field_0.e(var0);
  32.    }
  33.  
  34.    // $FF: renamed from: f (java.lang.String) void
  35.    public static void method_1(String var0) {
  36.       field_0.f(var0);
  37.    }
  38.  
  39.    // $FF: renamed from: d (java.lang.String) void
  40.    public static void method_2(String var0) {
  41.       field_0.d(var0);
  42.    }
  43.  
  44.    // $FF: renamed from: t (java.lang.String, boolean) void
  45.    public static void method_3(String var0, boolean var1) {
  46.       if (var1 || !var0.startsWith("java.") && !var0.startsWith("sun.") && (!var0.startsWith("sunw.") || !var0.startsWith("com.ms."))) {
  47.          try {
  48.             aa.e1(var0);
  49.          } catch (NoClassDefFoundError var3) {
  50.             field_0.h("cannot find class " + ((Throwable)var3).getMessage());
  51.          }
  52.  
  53.       }
  54.    }
  55.  
  56.    // $FF: renamed from: u () void
  57.    public static void method_4() {
  58.       try {
  59.          FileInputStream var0 = new FileInputStream(new File(field_1 + ".daf"));
  60.          DataInputStream var1 = new DataInputStream(var0);
  61.          int var2 = 1;
  62.  
  63.          while(true) {
  64.             String var3 = var1.readLine();
  65.             if (var3 == null) {
  66.                return;
  67.             }
  68.  
  69.             var3 = var3.trim();
  70.             if (var3.length() != 0 && Character.isJavaIdentifierStart(var3.charAt(0))) {
  71.                StringTokenizer var4 = new StringTokenizer(var3, " ");
  72.                String var5 = (String)var4.nextElement();
  73.                String var6 = (String)var4.nextElement();
  74.                String var7 = (String)var4.nextElement();
  75.  
  76.                m var8;
  77.                try {
  78.                   var8 = (m)aa.eq(var5, var6, var7);
  79.                } catch (Exception var10) {
  80.                   var8 = null;
  81.                }
  82.  
  83.                if (var8 == null) {
  84.                   field_0.h("file \"" + field_1 + ".daf\" at line " + var2 + " no such field found: " + var5 + "." + var6 + " " + var7);
  85.                } else {
  86.                   method_1("readDynamicallyAccessedFieldNames: read \"" + var5 + "." + var6 + " " + var7 + "\"");
  87.                   var8.dj();
  88.                }
  89.  
  90.                ++var2;
  91.             }
  92.          }
  93.       } catch (FileNotFoundException var11) {
  94.          field_0.h("no \"" + field_1 + ".daf\" file with names of dynamically accessed fields\n");
  95.       } catch (IOException var12) {
  96.          field_0.h("error reading \"" + field_1 + ".daf\" file.\n");
  97.       }
  98.  
  99.    }
  100.  
  101.    // $FF: renamed from: v () void
  102.    public static void method_5() {
  103.       try {
  104.          FileInputStream var0 = new FileInputStream(new File(field_1 + ".dim"));
  105.          DataInputStream var1 = new DataInputStream(var0);
  106.          int var2 = 1;
  107.  
  108.          while(true) {
  109.             String var3 = var1.readLine();
  110.             if (var3 == null) {
  111.                return;
  112.             }
  113.  
  114.             var3 = var3.trim();
  115.             if (var3.length() != 0 && Character.isJavaIdentifierStart(var3.charAt(0))) {
  116.                StringTokenizer var4 = new StringTokenizer(var3, " ");
  117.                String var5 = (String)var4.nextElement();
  118.                String var6 = (String)var4.nextElement();
  119.                String var7 = (String)var4.nextElement();
  120.  
  121.                l var8;
  122.                try {
  123.                   var8 = (l)aa.es(var5, var6, var7);
  124.                } catch (Exception var10) {
  125.                   var8 = null;
  126.                }
  127.  
  128.                if (var8 == null) {
  129.                   field_0.h("file \"" + field_1 + ".dim\" at line " + var2 + " no such method found: " + var5 + "." + var6 + " " + var7);
  130.                } else {
  131.                   method_1("readDynamicallyCalledMethodNames: read \"" + var5 + "." + var6 + var7 + "\"");
  132.                   var8.dj();
  133.                }
  134.  
  135.                ++var2;
  136.             }
  137.          }
  138.       } catch (FileNotFoundException var11) {
  139.          field_0.h("no \"" + field_1 + ".dim\" file with names of dynamically invoked methods");
  140.       } catch (IOException var12) {
  141.          field_0.h("error reading \"" + field_1 + ".dim\" file.\n");
  142.       }
  143.  
  144.    }
  145.  
  146.    // $FF: renamed from: w () void
  147.    public static void method_6() {
  148.       try {
  149.          FileInputStream var0 = new FileInputStream(new File(field_1 + ".dlc"));
  150.          DataInputStream var1 = new DataInputStream(var0);
  151.          int var2 = 1;
  152.  
  153.          while(true) {
  154.             String var3 = var1.readLine();
  155.             if (var3 == null) {
  156.                return;
  157.             }
  158.  
  159.             method_3(var3, true);
  160.             q var4 = null;
  161.  
  162.             try {
  163.                var4 = (q)aa.e1(var3);
  164.             } catch (NoClassDefFoundError var6) {
  165.                field_0.h("at line " + var2 + " in file " + field_1 + ".dlc, cannot find class \"" + ((Throwable)var6).getMessage() + "\"");
  166.             }
  167.  
  168.             if (var4 == null) {
  169.                ++var2;
  170.             } else {
  171.                o var10000 = field_0;
  172.                boolean var10001 = true;
  173.                method_1("Found dynamically loaded class \"" + ((au)var4).gg() + "\"");
  174.                var4.dj();
  175.                ++var2;
  176.             }
  177.          }
  178.       } catch (FileNotFoundException var7) {
  179.          field_0.h("no \"" + field_1 + ".dlc\" file with dynamically loaded class names");
  180.       } catch (IOException var8) {
  181.          field_0.h("error reading \"" + field_1 + ".dlc\" file.\n");
  182.       }
  183.  
  184.    }
  185.  
  186.    // $FF: renamed from: x () com.ibm.bobby.r
  187.    public static r method_7() {
  188.       r var0 = new r();
  189.  
  190.       try {
  191.          FileInputStream var1 = new FileInputStream(new File(field_1 + ".inc"));
  192.          DataInputStream var2 = new DataInputStream(var1);
  193.          int var4 = 1;
  194.  
  195.          while(true) {
  196.             String var5 = var2.readLine();
  197.             if (var5 == null) {
  198.                break;
  199.             }
  200.  
  201.             String var3;
  202.             if (var5.startsWith("include ")) {
  203.                var3 = "I";
  204.             } else {
  205.                if (!var5.startsWith("exclude ")) {
  206.                   field_0.h("at line " + var4 + " in file " + field_1 + ".inc, line does not start with \"include\" or \"exclude\"");
  207.                   ++var4;
  208.                   continue;
  209.                }
  210.  
  211.                var3 = "E";
  212.             }
  213.  
  214.             var3 = var3 + var5.substring(8);
  215.             if (var3.endsWith("*")) {
  216.                var3 = var3.substring(0, var3.length() - 1);
  217.             } else {
  218.                field_0.h("at line " + var4 + " in file " + field_1 + ".inc, line does not end with \"*\"");
  219.             }
  220.  
  221.             var0.cx(var3);
  222.             ++var4;
  223.          }
  224.       } catch (FileNotFoundException var6) {
  225.          field_0.h("no \"" + field_1 + ".inc\" file with include/exclude package prefixes");
  226.       } catch (IOException var7) {
  227.          field_0.h("error reading \"" + field_1 + ".inc\" file.\n");
  228.       }
  229.  
  230.       return var0.ct() ? null : var0;
  231.    }
  232.  
  233.    // $FF: renamed from: y () void
  234.    private static void method_8() {
  235.       method_2("\n" + "\n" + "" + "jax" + " generates two files:\n\n" + "      \"<class name>." + "jax" + ".zip\"      containing the compressed program.\n" + "      \"<class name>." + "jax" + ".log\"      containing the log.\n" + "\n" + "" + "jax" + " looks for 4 optional input files:\n\n" + "  (1) Create a file \"<class name>_jax.inc\" in the current \n" + "      directory containing a list of the class name prefixes \n" + "      for classes that are to be included in or excluded from \n" + "      the generated zip file.\n" + "      Classes that do not match any in the list will be \n" + "      included in the generated zip file.\n" + "      Later entries in the list override earlier entries.\n" + "      Each line must begin with the word \"include\" or \n" + "      \"exclude\" and end with a \"*\".\n" + "      Example:\n" + "      \n" + "          exclude java.* \n" + "          exclude sun.* \n" + "          exclude com.ms.* \n" + "          exclude sunw.hot* \n" + "          include myStuff.* \n" + "          exclude myStuff.keepout.* \n" + "      If this file is omitted, classes with a package prefix of \n" + "      java, sun, com.ms are excluded. \n" + "      Example:\n" + "      \n" + "  (2) Create a file \"<class name>_jax.dlc\" in the current \n" + "      directory containing the names of all the \n" + "      classes that are loaded dynamically.\n" + "      Example:\n" + "      \n" + "          com.acme.ClassOne\n" + "          com.acme.ClassTwo\n" + "          com.acme.ClassThree\n" + "      \n" + "  (3) Create a file \"<class name>_jax.dim\" in the current \n" + "      directory containing the names of all the \n" + "      methods that are called using reflection\n" + "      Pattern: <classname> <methodname> " + " <descriptor> using JVM types.\n" + "      Example:\n" + "      \n" + "          com.acme.ClassFour specialMethod1 (I)V\n" + "          com.acme.ClassFour specialMethod2 (III)I\n" + "          com.acme.ClassFour <init> " + "(Ljava/lang/Object;)V\n" + "    \n" + "  (4) Create a file \"<class name>_jax.daf\" in the current \n" + "      directory containing the names of all the \n" + "      fields that are accessed using reflection\n" + "      Pattern: <classname> <fieldname> " + " <descriptor> using JVM types.\n" + "      Example:\n" + "      \n" + "          com.acme.ClassFive specialField1 (I)V\n" + "          com.acme.ClassSix specialField2 (III)I\n" + "          com.acme.ClassSeven specialField3 " + "Ljava/lang/Object;\n" + "    \n" + "\n" + "Use the enclosed \"reflect\" program to \n" + "find all classes, methods, and fields that are.\n" + "accessed using reflection.\n" + "Example:\n" + "    \n" + "        java reflect MyApplet.zip\n" + "    \n" + "\n" + "Use the enclosed \"methods\" and \"fields\" programs to \n" + "get a listing of available methods and fields.\n" + "Example:\n" + "    \n" + "        java methods java.lang.String\n" + "        java fields java.lang.String\n" + "    \n" + "See http://www.alphaWorks.ibm.com/formula/jax and the\n" + "documentation distributed with JAX for more information.\n" + "");
  236.    }
  237.  
  238.    // $FF: renamed from: s () void
  239.    private static void method_9() {
  240.       method_2("\n" + "Usage:  " + "jax" + " [<-options>] <class name>\n" + "  Where:\n" + "    <class name>:         the starting class name\n" + "    <-options> are:\n" + "      -version:                   show version number\n" + "      -help:                      show help information\n" + "" + "      -notransform:               don't merge/eliminate classes\n" + "      -noinline:                  don't inline methods\n" + "      -nodevirtualize:            don't make virtual method calls nonvirtual\n" + "      -noobfuscate:               don't shorten internal names\n" + "      -keeppackagenames:          keep the package structure when obfuscating\n" + "      -noverify:                  don't verify the compressed application\n" + "      -nocompatibleserialization: don't preserve (de)serialization " + "compatibility \n" + "                                  between original/JAXed versions of the " + "application\n" + "" + "\n");
  241.       method_2("    debug options:\n" + "      -ta:                trace type analysis\n" + "      -to:                trace optimization\n" + "      -daXXX:             debug type analysis of method XXX\n" + "      -doXXX:             debug optimization of method XXX\n" + "\n");
  242.       System.exit(1);
  243.    }
  244.  
  245.    // $FF: renamed from: z () void
  246.    public static void method_10() {
  247.       method_1("");
  248.       method_1("Java Execution Environment Information:");
  249.       method_1("=================================================================");
  250.       method_1("creation time      = " + new Date());
  251.       method_1("os.name            = " + System.getProperty("os.name"));
  252.       method_1("os.arch            = " + System.getProperty("os.arch"));
  253.       method_1("os.version         = " + System.getProperty("os.version"));
  254.       method_1("java.version       = " + System.getProperty("java.version"));
  255.       method_1("java.vendor        = " + System.getProperty("java.vendor"));
  256.       method_1("java.vendor.url    = " + System.getProperty("java.vendor.url"));
  257.       method_1("java.class.version = " + System.getProperty("java.class.version"));
  258.       method_1("java.class.path    = " + System.getProperty("java.class.path"));
  259.       method_1("java.home          = " + System.getProperty("java.home"));
  260.       method_1("java_compiler      = " + System.getProperty("java.compiler"));
  261.       method_1("=================================================================");
  262.       method_1("");
  263.    }
  264.  
  265.    // $FF: renamed from: aa () void
  266.    public static void method_11() {
  267.       method_0("\nOptions: " + (field_0.bp ? "obfuscate " : "noobfuscate ") + (field_0.bo ? "keeppackagenames " : "nokeeppackagenames ") + (field_0.bn ? "transform " : "notransform ") + (field_0.bl ? "verify " : "") + (field_0.bm ? "devirtualize " : "nodevirtualize ") + "" + (field_0.bj ? "inline " : "noinline ") + (field_0.bi ? "compatibleserialization " : "nocompatibleserialization ") + "\n");
  268.    }
  269.  
  270.    // $FF: renamed from: ab () void
  271.    public static void method_12() {
  272.       Date var0 = new Date();
  273.       Date var1 = new Date("Jul 28 1999");
  274.       if (var0.getTime() > var1.getTime()) {
  275.          method_0("");
  276.          method_0("---------------------------------------------------");
  277.          method_0("The license for this free software from IBM has");
  278.          method_0("expired. A new version with major improvements ");
  279.          method_0("and bug fixes may have been released. See: ");
  280.          method_0("http://www.alphaWorks.ibm.com/formula/jax ");
  281.          method_0("---------------------------------------------------");
  282.          method_0("");
  283.       } else {
  284.          method_0("");
  285.          method_0("Your free license expires on " + "Jul 28 1999" + ". After this date,");
  286.          method_0("download a new version with " + "major improvements and bug fixes.");
  287.       }
  288.  
  289.    }
  290.  
  291.    // $FF: renamed from: ac (java.lang.String) void
  292.    private static void method_13(String var0) {
  293.       if (var0.equals("version")) {
  294.          System.out.println("jax V5.3-Wednesday-Apr-28-1999 Copyright IBM 1997-1999. All rights reserved.");
  295.          System.exit(1);
  296.       }
  297.  
  298.       if (var0.equals("obfuscate")) {
  299.          field_0.bp = true;
  300.       } else if (var0.equals("noobfuscate")) {
  301.          field_0.bp = false;
  302.       } else if (var0.equals("keeppackagenames")) {
  303.          field_0.bo = true;
  304.       } else if (var0.equals("nokeeppackagenames")) {
  305.          field_0.bo = false;
  306.       } else {
  307.          if (var0.equals("help")) {
  308.             method_8();
  309.             System.exit(5);
  310.          }
  311.  
  312.          if (var0.equals("noverify")) {
  313.             field_0.bl = false;
  314.          } else if (var0.equals("devirtualize")) {
  315.             field_0.bm = true;
  316.          } else if (var0.equals("nodevirtualize")) {
  317.             field_0.bm = false;
  318.          } else if (var0.equals("inline")) {
  319.             field_0.bj = true;
  320.          } else if (var0.equals("noinline")) {
  321.             field_0.bj = false;
  322.          } else if (var0.equals("transform")) {
  323.             field_0.bn = true;
  324.          } else if (var0.equals("notransform")) {
  325.             field_0.bn = false;
  326.          } else if (var0.equals("compatibleserialization")) {
  327.             field_0.bi = true;
  328.          } else if (var0.equals("nocompatibleserialization")) {
  329.             field_0.bi = false;
  330.          } else {
  331.             method_2("*** unknown option \"-" + var0 + "\"");
  332.             method_9();
  333.          }
  334.       }
  335.    }
  336.  
  337.    // $FF: renamed from: ad (java.lang.String[]) void
  338.    private static void method_14(String[] var0) {
  339.       for(int var1 = 0; var1 < var0.length; ++var1) {
  340.          if (var0[var1].startsWith("-")) {
  341.             method_13(var0[var1].substring(1));
  342.          } else if (field_0.bu == null) {
  343.             field_0.d4(var0[var1]);
  344.          } else {
  345.             method_2("\n*** too many arguments that are not options\n");
  346.             method_9();
  347.          }
  348.       }
  349.  
  350.       if (field_0.bu == null) {
  351.          method_2("\n*** Must specify class name\n");
  352.          method_9();
  353.       }
  354.  
  355.       if (field_0.bu.indexOf(File.separator) != -1) {
  356.          method_2("\nPlease specify class with \".\" separators\n");
  357.          method_9();
  358.       }
  359.  
  360.       if (!field_0.bp && field_0.bo) {
  361.          method_2("\nSpecified option -keeppackagenames only makes " + "sense when \nused in combination with obfuscation.");
  362.          method_2("\nPlease do not specify -noobfuscate.");
  363.          method_9();
  364.       }
  365.  
  366.       method_2("ProgramName is \"" + field_0.bu + "\"");
  367.       method_2("JDK used is " + System.getProperty("java.vendor") + " version " + System.getProperty("java.version"));
  368.    }
  369.  
  370.    // $FF: renamed from: ae (java.lang.String[]) void
  371.    private static void method_15(String[] var0) {
  372.       field_0 = new o(0);
  373.       method_14(var0);
  374.       method_2("");
  375.       method_2("jax V5.3-Wednesday-Apr-28-1999 Copyright IBM 1997-1999. All rights reserved.");
  376.       method_2("More information at: " + "http://www.research.ibm.com/jax");
  377.       method_2("");
  378.       method_12();
  379.       method_1("");
  380.       method_1("jax V5.3-Wednesday-Apr-28-1999 Copyright IBM 1997-1999. All rights reserved.");
  381.       method_1("Info inside IBM:  " + "http://w3.watson.ibm.com/~laffra/jax");
  382.       method_1("Info outside IBM: " + "http://www.alphaWorks.ibm.com/formula/jax");
  383.       method_1("");
  384.       method_11();
  385.       method_10();
  386.       long var1 = System.currentTimeMillis();
  387.       field_1 = field_0.bt + "_" + "jax";
  388.       method_2("loading, this may take a while");
  389.       method_2(" ");
  390.       bs.eh = true;
  391.       e.bl(field_0, method_7());
  392.       method_6();
  393.       method_3(field_0.bu, false);
  394.       method_5();
  395.       method_4();
  396.       if (aa.b7.ct()) {
  397.          method_0("\n" + "========================================================\n" + "Jax: could not find class " + field_0.bu + "\n" + "please check your spelling and/or classpath\n" + "========================================================\n" + "");
  398.          System.exit(7);
  399.       }
  400.  
  401.       bs.eh = false;
  402.       System.out.print("\r                                      \r");
  403.       method_1(" ");
  404.       method_0("finished loading, total " + aa.b7.cr() + " classes");
  405.       int var3 = 0;
  406.       int var4 = 0;
  407.       int var5 = 0;
  408.       int var6 = 0;
  409.  
  410.       for(int var7 = 0; var7 < aa.b7.cr(); ++var7) {
  411.          bs var8 = aa.b7.cw(var7);
  412.          if (var8.d3) {
  413.             ++var4;
  414.          } else if (var8.ea) {
  415.             ++var5;
  416.          } else if (var8.d2) {
  417.             ++var6;
  418.          } else {
  419.             ++var3;
  420.          }
  421.       }
  422.  
  423.       method_0("  " + var4 + "\tapplication classes");
  424.       method_0("  " + var6 + "\tbasic types");
  425.       method_0("  " + var5 + "\tarray types");
  426.       method_0("  " + var3 + "\texternal classes");
  427.       e.ae(var0);
  428.       field_0.n(field_0.bq);
  429.       field_0.d2();
  430.       long var9 = System.currentTimeMillis();
  431.       method_0("\nTime used for analysis: " + (var9 - var1) / 1000L + " seconds.\n");
  432.       method_0("\nThanks for using JAX, a technology preview from IBM.");
  433.       method_0("Please email your feedback to: jax@watson.ibm.com");
  434.       method_0("");
  435.       System.exit(0);
  436.    }
  437.  
  438.    public static void main(String[] var0) {
  439.       try {
  440.          method_15(var0);
  441.       } catch (Exception var2) {
  442.          method_1(((Throwable)var2).toString());
  443.          ((Throwable)var2).printStackTrace(field_0.bh);
  444.          System.out.println(((Throwable)var2).toString());
  445.          ((Throwable)var2).printStackTrace(System.out);
  446.       }
  447.  
  448.    }
  449. }
  450.