home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / Compiler.java < prev    next >
Text File  |  1997-05-20  |  4KB  |  113 lines

  1. /*
  2.  * @(#)Compiler.java    1.3 97/01/20
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. package java.lang;
  24.  
  25. /**
  26.  * The <code>Compiler</code> class is provided to support 
  27.  * Java-to-native-code compilers and related services. By design, the 
  28.  * <code>Compiler</code> class does nothing; it serves as a 
  29.  * placeholder for a JIT compiler implementation. 
  30.  * <p>
  31.  * When the Java Virtual Machine first starts, it determines if the 
  32.  * system property <code>java.compiler</code> exists. (System 
  33.  * properties are accessible through <code>getProperty</code>  and , 
  34.  * a method defined by the <code>System</code> class.) If so, it is 
  35.  * assumed to be the name of a library (with a platform-dependent 
  36.  * exact location and type); the <code>loadLibrary</code> method in 
  37.  * class <code>System</code> is called to load that library. If this 
  38.  * loading succeeds, the function named 
  39.  * <code>java_lang_Compiler_start()</code> in that library is called. 
  40.  * <p>
  41.  * If no compiler is available, these methods do nothing. 
  42.  *
  43.  * @author  Frank Yellin
  44.  * @version 1.3, 01/20/97
  45.  * @see     java.lang.System#getProperty(java.lang.String)
  46.  * @see     java.lang.System#getProperty(java.lang.String, java.lang.String)
  47.  * @see     java.lang.System#loadLibrary(java.lang.String)
  48.  * @since   JDK1.0
  49.  */
  50. public final class Compiler  {
  51.     private Compiler() {}        // don't make instances
  52.     
  53.     private static native void initialize();
  54.  
  55.     static { 
  56.     try { 
  57.         String library = System.getProperty("java.compiler");
  58.         if (library != null) {
  59.         System.loadLibrary(library);
  60.         initialize();
  61.         }
  62.     } catch (Throwable e) { 
  63.     }
  64.     }
  65.  
  66.     /**
  67.      * Compiles the specified class. 
  68.      *
  69.      * @param   clazz   a class.
  70.      * @return  <code>true</code> if the compilation succeeded;
  71.      *          <code>false</code> if the compilation failed or no compiler
  72.      *          is available.
  73.      * @since   JDK1.0
  74.      */
  75.     public static native boolean compileClass(Class clazz);
  76.  
  77.     /**
  78.      * Compiles all classes whose name matches the specified string. 
  79.      *
  80.      * @param   string   the name of the classes to compile.
  81.      * @return  <code>true</code> if the compilation succeeded;
  82.      *          <code>false</code> if the compilation failed or no compiler
  83.      *          is available.
  84.      * @since   JDK1.0
  85.      */
  86.     public static native boolean compileClasses(String string);
  87.  
  88.     /**
  89.      * Examines the argument type and its fields and perform some documented
  90.      * operation. No specific operations are required. 
  91.      *
  92.      * @param   any   an argument.
  93.      * @return  a compiler-specific value, or <code>null</code> if no compiler
  94.      *          is available.
  95.      * @since   JDK1.0
  96.      */
  97.     public static native Object command(Object any);
  98.  
  99.     /**
  100.      * Cause the Compiler to resume operation. 
  101.      *
  102.      * @since   JDK1.0
  103.      */
  104.     public static native void enable();
  105.  
  106.     /**
  107.      * Cause the Compiler to cease operation. 
  108.      *
  109.      * @since   JDK1.0
  110.      */
  111.     public static native void disable();
  112. }
  113.