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

changeset 0
959103a6100f
child 2525
2eb010b6cb22
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javah/NativeHeaderTool.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,149 @@
     1.4 +/*
     1.5 + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.tools.javah; //javax.tools;
    1.30 +
    1.31 +import java.io.Writer;
    1.32 +import java.nio.charset.Charset;
    1.33 +import java.util.Locale;
    1.34 +import java.util.concurrent.Callable;
    1.35 +import javax.tools.Diagnostic;
    1.36 +import javax.tools.DiagnosticListener;
    1.37 +import javax.tools.JavaFileManager;
    1.38 +import javax.tools.JavaFileObject;
    1.39 +import javax.tools.OptionChecker;
    1.40 +import javax.tools.StandardJavaFileManager;
    1.41 +import javax.tools.StandardLocation;
    1.42 +import javax.tools.Tool;
    1.43 +
    1.44 +/**
    1.45 + * This class is intended to be put in javax.tools.
    1.46 + *
    1.47 + * @see DiagnosticListener
    1.48 + * @see Diagnostic
    1.49 + * @see JavaFileManager
    1.50 + * @since 1.7
    1.51 + *
    1.52 + *  <p><b>This is NOT part of any supported API.
    1.53 + *  If you write code that depends on this, you do so at your own risk.
    1.54 + *  This code and its internal interfaces are subject to change or
    1.55 + *  deletion without notice.</b>
    1.56 + */
    1.57 +public interface NativeHeaderTool extends Tool, OptionChecker {
    1.58 +
    1.59 +    /**
    1.60 +     * Creates a future for a native header task with the given
    1.61 +     * components and arguments.  The task might not have
    1.62 +     * completed as described in the NativeHeaderTask interface.
    1.63 +     *
    1.64 +     * <p>If a file manager is provided, it must be able to handle all
    1.65 +     * locations defined in {@link StandardLocation}.
    1.66 +     *
    1.67 +     * @param out a Writer for additional output from the task;
    1.68 +     * use {@code System.err} if {@code null}
    1.69 +     * @param fileManager a file manager; if {@code null} use the
    1.70 +     * task's standard filemanager
    1.71 +     * @param diagnosticListener a diagnostic listener; if {@code
    1.72 +     * null} use the compiler's default method for reporting
    1.73 +     * diagnostics
    1.74 +     * @param options task options, {@code null} means no options
    1.75 +     * @param classes class names for which native headers should be generated
    1.76 +     * @return an object representing the task to be done
    1.77 +     * @throws RuntimeException if an unrecoverable error
    1.78 +     * occurred in a user supplied component.  The
    1.79 +     * {@linkplain Throwable#getCause() cause} will be the error in
    1.80 +     * user code.
    1.81 +     * @throws IllegalArgumentException if any of the given
    1.82 +     * compilation units are of other kind than
    1.83 +     * {@linkplain JavaFileObject.Kind#SOURCE source}
    1.84 +     */
    1.85 +    NativeHeaderTask getTask(Writer out,
    1.86 +                            JavaFileManager fileManager,
    1.87 +                            DiagnosticListener<? super JavaFileObject> diagnosticListener,
    1.88 +                            Iterable<String> options,
    1.89 +                            Iterable<String> classes);
    1.90 +
    1.91 +    /**
    1.92 +     * Gets a new instance of the standard file manager implementation
    1.93 +     * for this tool.  The file manager will use the given diagnostic
    1.94 +     * listener for producing any non-fatal diagnostics.  Fatal errors
    1.95 +     * will be signalled with the appropriate exceptions.
    1.96 +     *
    1.97 +     * <p>The standard file manager will be automatically reopened if
    1.98 +     * it is accessed after calls to {@code flush} or {@code close}.
    1.99 +     * The standard file manager must be usable with other tools.
   1.100 +     *
   1.101 +     * @param diagnosticListener a diagnostic listener for non-fatal
   1.102 +     * diagnostics; if {@code null} use the tool's default method
   1.103 +     * for reporting diagnostics
   1.104 +     * @param locale the locale to apply when formatting diagnostics;
   1.105 +     * {@code null} means the {@linkplain Locale#getDefault() default locale}.
   1.106 +     * @param charset the character set used for decoding bytes; if
   1.107 +     * {@code null} use the platform default
   1.108 +     * @return the standard file manager
   1.109 +     */
   1.110 +    StandardJavaFileManager getStandardFileManager(
   1.111 +        DiagnosticListener<? super JavaFileObject> diagnosticListener,
   1.112 +        Locale locale,
   1.113 +        Charset charset);
   1.114 +
   1.115 +    /**
   1.116 +     * Interface representing a future for a native header task.  The
   1.117 +     * task has not yet started.  To start the task, call
   1.118 +     * the {@linkplain #call call} method.
   1.119 +     *
   1.120 +     * <p>Before calling the call method, additional aspects of the
   1.121 +     * task can be configured, for example, by calling the
   1.122 +     * {@linkplain #setLocale setLocale} method.
   1.123 +     */
   1.124 +    interface NativeHeaderTask extends Callable<Boolean> {
   1.125 +
   1.126 +        /**
   1.127 +         * Set the locale to be applied when formatting diagnostics and
   1.128 +         * other localized data.
   1.129 +         *
   1.130 +         * @param locale the locale to apply; {@code null} means apply no
   1.131 +         * locale
   1.132 +         * @throws IllegalStateException if the task has started
   1.133 +         */
   1.134 +        void setLocale(Locale locale);
   1.135 +
   1.136 +        /**
   1.137 +         * Performs this native header task.  The task may only
   1.138 +         * be performed once.  Subsequent calls to this method throw
   1.139 +         * IllegalStateException.
   1.140 +         *
   1.141 +         * @return true if and only all the files were processed without errors;
   1.142 +         * false otherwise
   1.143 +         *
   1.144 +         * @throws RuntimeException if an unrecoverable error occurred
   1.145 +         * in a user-supplied component.  The
   1.146 +         * {@linkplain Throwable#getCause() cause} will be the error
   1.147 +         * in user code.
   1.148 +         * @throws IllegalStateException if called more than once
   1.149 +         */
   1.150 +        Boolean call();
   1.151 +    }
   1.152 +}

mercurial