src/share/classes/com/sun/tools/javah/NativeHeaderTool.java

Thu, 10 Jun 2010 16:08:01 -0700

author
jjg
date
Thu, 10 Jun 2010 16:08:01 -0700
changeset 581
f2fdd52e4e87
parent 554
9d9f26857129
child 1358
fc123bdeddb8
permissions
-rw-r--r--

6944312: Potential rebranding issues in openjdk/langtools repository sources
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 2005, 2006, Oracle and/or its affiliates. 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.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.javah; //javax.tools;
    28 import java.io.Writer;
    29 import java.nio.charset.Charset;
    30 import java.util.Locale;
    31 import java.util.concurrent.Callable;
    32 import javax.tools.DiagnosticListener;
    33 import javax.tools.JavaFileManager;
    34 import javax.tools.JavaFileObject;
    35 import javax.tools.OptionChecker;
    36 import javax.tools.StandardJavaFileManager;
    37 import javax.tools.Tool;
    39 /**
    40  * This class is intended to be put in javax.tools.
    41  *
    42  * @see DiagnosticListener
    43  * @see Diagnostic
    44  * @see JavaFileManager
    45  * @since 1.7
    46  *
    47  *  <p><b>This is NOT part of any supported API.
    48  *  If you write code that depends on this, you do so at your own risk.
    49  *  This code and its internal interfaces are subject to change or
    50  *  deletion without notice.</b>
    51  */
    52 public interface NativeHeaderTool extends Tool, OptionChecker {
    54     /**
    55      * Creates a future for a native header task with the given
    56      * components and arguments.  The task might not have
    57      * completed as described in the NativeHeaderTask interface.
    58      *
    59      * <p>If a file manager is provided, it must be able to handle all
    60      * locations defined in {@link StandardLocation}.
    61      *
    62      * @param out a Writer for additional output from the task;
    63      * use {@code System.err} if {@code null}
    64      * @param fileManager a file manager; if {@code null} use the
    65      * task's standard filemanager
    66      * @param diagnosticListener a diagnostic listener; if {@code
    67      * null} use the compiler's default method for reporting
    68      * diagnostics
    69      * @param options task options, {@code null} means no options
    70      * @param classes class names for which native headers should be generated
    71      * @return an object representing the task to be done
    72      * @throws RuntimeException if an unrecoverable error
    73      * occurred in a user supplied component.  The
    74      * {@linkplain Throwable#getCause() cause} will be the error in
    75      * user code.
    76      * @throws IllegalArgumentException if any of the given
    77      * compilation units are of other kind than
    78      * {@linkplain JavaFileObject.Kind#SOURCE source}
    79      */
    80     NativeHeaderTask getTask(Writer out,
    81                             JavaFileManager fileManager,
    82                             DiagnosticListener<? super JavaFileObject> diagnosticListener,
    83                             Iterable<String> options,
    84                             Iterable<String> classes);
    86     /**
    87      * Gets a new instance of the standard file manager implementation
    88      * for this tool.  The file manager will use the given diagnostic
    89      * listener for producing any non-fatal diagnostics.  Fatal errors
    90      * will be signalled with the appropriate exceptions.
    91      *
    92      * <p>The standard file manager will be automatically reopened if
    93      * it is accessed after calls to {@code flush} or {@code close}.
    94      * The standard file manager must be usable with other tools.
    95      *
    96      * @param diagnosticListener a diagnostic listener for non-fatal
    97      * diagnostics; if {@code null} use the tool's default method
    98      * for reporting diagnostics
    99      * @param locale the locale to apply when formatting diagnostics;
   100      * {@code null} means the {@linkplain Locale#getDefault() default locale}.
   101      * @param charset the character set used for decoding bytes; if
   102      * {@code null} use the platform default
   103      * @return the standard file manager
   104      */
   105     StandardJavaFileManager getStandardFileManager(
   106         DiagnosticListener<? super JavaFileObject> diagnosticListener,
   107         Locale locale,
   108         Charset charset);
   110     /**
   111      * Interface representing a future for a native header task.  The
   112      * task has not yet started.  To start the task, call
   113      * the {@linkplain #call call} method.
   114      *
   115      * <p>Before calling the call method, additional aspects of the
   116      * task can be configured, for example, by calling the
   117      * {@linkplain #setLocale setLocale} method.
   118      */
   119     interface NativeHeaderTask extends Callable<Boolean> {
   121         /**
   122          * Set the locale to be applied when formatting diagnostics and
   123          * other localized data.
   124          *
   125          * @param locale the locale to apply; {@code null} means apply no
   126          * locale
   127          * @throws IllegalStateException if the task has started
   128          */
   129         void setLocale(Locale locale);
   131         /**
   132          * Performs this native header task.  The task may only
   133          * be performed once.  Subsequent calls to this method throw
   134          * IllegalStateException.
   135          *
   136          * @return true if and only all the files were processed without errors;
   137          * false otherwise
   138          *
   139          * @throws RuntimeException if an unrecoverable error occurred
   140          * in a user-supplied component.  The
   141          * {@linkplain Throwable#getCause() cause} will be the error
   142          * in user code.
   143          * @throws IllegalStateException if called more than once
   144          */
   145         Boolean call();
   146     }
   147 }

mercurial