Coverage Report - com.sun.tools.javafx.Main
 
Classes in this File Line Coverage Branch Coverage Complexity
Main
33%
8/24
0%
0/4
0
 
 1  
 /*
 2  
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
 3  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  
  *
 5  
  * This code is free software; you can redistribute it and/or modify it
 6  
  * under the terms of the GNU General Public License version 2 only, as
 7  
  * published by the Free Software Foundation.  Sun designates this
 8  
  * particular file as subject to the "Classpath" exception as provided
 9  
  * by Sun in the LICENSE file that accompanied this code.
 10  
  *
 11  
  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  
  * version 2 for more details (a copy is included in the LICENSE file that
 15  
  * accompanied this code).
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License version
 18  
  * 2 along with this work; if not, write to the Free Software Foundation,
 19  
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  
  *
 21  
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 22  
  * CA 95054 USA or visit www.sun.com if you need additional information or
 23  
  * have any questions.
 24  
  */
 25  
 
 26  
 package com.sun.tools.javafx;
 27  
 
 28  
 import java.io.PrintWriter;
 29  
 import java.lang.reflect.*;
 30  
 
 31  
 /**
 32  
  * The programmatic interface for the Java Programming Language
 33  
  * compiler, javac.
 34  
  *
 35  
  * <p>Except for the two methods
 36  
  * {@link #compile(java.lang.String[])}
 37  
  * {@link #compile(java.lang.String[],java.io.PrintWriter)},
 38  
  * nothing described in this source file is part of any supported
 39  
  * API.  If you write code that depends on this, you do so at your own
 40  
  * risk.  This code and its internal interfaces are subject to change
 41  
  * or deletion without notice.
 42  
  */
 43  0
 public class Main {
 44  
 
 45  
     static {
 46  2
         ClassLoader loader = Main.class.getClassLoader();
 47  2
         if (loader != null) {
 48  2
             loader.setPackageAssertionStatus("com.sun.tools.javafx", true);
 49  
             
 50  
             //workaround for JFXC-964, so compiler works when IDE enables all assertions
 51  2
             loader.setClassAssertionStatus("com.sun.tools.javac.code.Symbol", false);
 52  2
             loader.setClassAssertionStatus("com.sun.tools.javac.jvm.Code", false);
 53  
         }
 54  2
     }
 55  
 
 56  
     /** Unsupported command line interface.
 57  
      * @param args   The command line parameters.
 58  
      */
 59  
     public static void main(String[] args) throws Exception {
 60  0
       if (args.length > 0 && args[0].equals("-Xjdb")) {
 61  0
         String[] newargs = new String[args.length + 2];
 62  0
         Class<?> c = Class.forName("com.sun.tools.example.debug.tty.TTY");
 63  0
         Method method = c.getDeclaredMethod ("main", new Class[] {args.getClass()});
 64  0
         method.setAccessible(true);
 65  0
         System.arraycopy(args, 1, newargs, 3, args.length - 1);
 66  0
         newargs[0] = "-connect";
 67  0
         newargs[1] = "com.sun.jdi.CommandLineLaunch:options=-esa -ea:com.sun.tools...";
 68  0
         newargs[2] = "com.sun.tools.javafx.Main";
 69  0
         method.invoke(null, new Object[] { newargs });
 70  0
       } else {
 71  0
         System.exit(compile(args));
 72  
       }
 73  0
     }
 74  
 
 75  
     /** Programmatic interface to the Java Programming Language
 76  
      * compiler, javac.
 77  
      *
 78  
      * @param args The command line arguments that would normally be
 79  
      * passed to the javac program as described in the man page.
 80  
      * @return an integer equivalent to the exit value from invoking
 81  
      * javac, see the man page for details.
 82  
      */
 83  
     public static int compile(String[] args) {
 84  0
         com.sun.tools.javafx.main.Main compiler =
 85  
             new com.sun.tools.javafx.main.Main("javafxc");
 86  0
         return compiler.compile(args);
 87  
     }
 88  
 
 89  
      
 90  
  
 91  
     /** Programmatic interface to the Java Programming Language
 92  
      * compiler, javac.
 93  
      *
 94  
      * @param args The command line arguments that would normally be
 95  
      * passed to the javac program as described in the man page.
 96  
      * @param out PrintWriter to which the compiler's diagnostic
 97  
      * output is directed.
 98  
      * @return an integer equivalent to the exit value from invoking
 99  
      * javac, see the man page for details.
 100  
      */
 101  
     public static int compile(String[] args, PrintWriter out) {
 102  351
         com.sun.tools.javafx.main.Main compiler =
 103  
             new com.sun.tools.javafx.main.Main("javafxc", out);
 104  351
         return compiler.compile(args);
 105  
     }
 106  
 }