Sun, 16 Dec 2012 11:09:36 +0100
8005098: Provide isSynthesized() information on Attribute.Compound
Reviewed-by: jjg
jjg@416 | 1 | /* |
jjg@1358 | 2 | * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
jjg@416 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@416 | 4 | * |
jjg@416 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@416 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@554 | 7 | * published by the Free Software Foundation. Oracle designates this |
jjg@416 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@554 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
jjg@416 | 10 | * |
jjg@416 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@416 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@416 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@416 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@416 | 15 | * accompanied this code). |
jjg@416 | 16 | * |
jjg@416 | 17 | * You should have received a copy of the GNU General Public License version |
jjg@416 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@416 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@416 | 20 | * |
ohair@554 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 23 | * questions. |
jjg@416 | 24 | */ |
jjg@416 | 25 | |
jjg@416 | 26 | package com.sun.tools.javah; //javax.tools; |
jjg@416 | 27 | |
jjg@416 | 28 | import java.io.Writer; |
jjg@416 | 29 | import java.nio.charset.Charset; |
jjg@416 | 30 | import java.util.Locale; |
jjg@416 | 31 | import java.util.concurrent.Callable; |
jjg@1358 | 32 | import javax.tools.Diagnostic; |
jjg@416 | 33 | import javax.tools.DiagnosticListener; |
jjg@416 | 34 | import javax.tools.JavaFileManager; |
jjg@416 | 35 | import javax.tools.JavaFileObject; |
jjg@416 | 36 | import javax.tools.OptionChecker; |
jjg@416 | 37 | import javax.tools.StandardJavaFileManager; |
jjg@1358 | 38 | import javax.tools.StandardLocation; |
jjg@416 | 39 | import javax.tools.Tool; |
jjg@416 | 40 | |
jjg@416 | 41 | /** |
jjg@416 | 42 | * This class is intended to be put in javax.tools. |
jjg@416 | 43 | * |
jjg@416 | 44 | * @see DiagnosticListener |
jjg@416 | 45 | * @see Diagnostic |
jjg@416 | 46 | * @see JavaFileManager |
jjg@416 | 47 | * @since 1.7 |
jjg@416 | 48 | * |
jjg@581 | 49 | * <p><b>This is NOT part of any supported API. |
jjg@581 | 50 | * If you write code that depends on this, you do so at your own risk. |
jjg@416 | 51 | * This code and its internal interfaces are subject to change or |
jjg@416 | 52 | * deletion without notice.</b> |
jjg@416 | 53 | */ |
jjg@416 | 54 | public interface NativeHeaderTool extends Tool, OptionChecker { |
jjg@416 | 55 | |
jjg@416 | 56 | /** |
jjg@416 | 57 | * Creates a future for a native header task with the given |
jjg@416 | 58 | * components and arguments. The task might not have |
jjg@416 | 59 | * completed as described in the NativeHeaderTask interface. |
jjg@416 | 60 | * |
jjg@416 | 61 | * <p>If a file manager is provided, it must be able to handle all |
jjg@416 | 62 | * locations defined in {@link StandardLocation}. |
jjg@416 | 63 | * |
jjg@416 | 64 | * @param out a Writer for additional output from the task; |
jjg@416 | 65 | * use {@code System.err} if {@code null} |
jjg@416 | 66 | * @param fileManager a file manager; if {@code null} use the |
jjg@416 | 67 | * task's standard filemanager |
jjg@416 | 68 | * @param diagnosticListener a diagnostic listener; if {@code |
jjg@416 | 69 | * null} use the compiler's default method for reporting |
jjg@416 | 70 | * diagnostics |
jjg@416 | 71 | * @param options task options, {@code null} means no options |
jjg@416 | 72 | * @param classes class names for which native headers should be generated |
jjg@416 | 73 | * @return an object representing the task to be done |
jjg@416 | 74 | * @throws RuntimeException if an unrecoverable error |
jjg@416 | 75 | * occurred in a user supplied component. The |
jjg@416 | 76 | * {@linkplain Throwable#getCause() cause} will be the error in |
jjg@416 | 77 | * user code. |
jjg@416 | 78 | * @throws IllegalArgumentException if any of the given |
jjg@416 | 79 | * compilation units are of other kind than |
jjg@416 | 80 | * {@linkplain JavaFileObject.Kind#SOURCE source} |
jjg@416 | 81 | */ |
jjg@416 | 82 | NativeHeaderTask getTask(Writer out, |
jjg@416 | 83 | JavaFileManager fileManager, |
jjg@416 | 84 | DiagnosticListener<? super JavaFileObject> diagnosticListener, |
jjg@416 | 85 | Iterable<String> options, |
jjg@416 | 86 | Iterable<String> classes); |
jjg@416 | 87 | |
jjg@416 | 88 | /** |
jjg@416 | 89 | * Gets a new instance of the standard file manager implementation |
jjg@416 | 90 | * for this tool. The file manager will use the given diagnostic |
jjg@416 | 91 | * listener for producing any non-fatal diagnostics. Fatal errors |
jjg@416 | 92 | * will be signalled with the appropriate exceptions. |
jjg@416 | 93 | * |
jjg@416 | 94 | * <p>The standard file manager will be automatically reopened if |
jjg@416 | 95 | * it is accessed after calls to {@code flush} or {@code close}. |
jjg@416 | 96 | * The standard file manager must be usable with other tools. |
jjg@416 | 97 | * |
jjg@416 | 98 | * @param diagnosticListener a diagnostic listener for non-fatal |
jjg@416 | 99 | * diagnostics; if {@code null} use the tool's default method |
jjg@416 | 100 | * for reporting diagnostics |
jjg@416 | 101 | * @param locale the locale to apply when formatting diagnostics; |
jjg@416 | 102 | * {@code null} means the {@linkplain Locale#getDefault() default locale}. |
jjg@416 | 103 | * @param charset the character set used for decoding bytes; if |
jjg@416 | 104 | * {@code null} use the platform default |
jjg@416 | 105 | * @return the standard file manager |
jjg@416 | 106 | */ |
jjg@416 | 107 | StandardJavaFileManager getStandardFileManager( |
jjg@416 | 108 | DiagnosticListener<? super JavaFileObject> diagnosticListener, |
jjg@416 | 109 | Locale locale, |
jjg@416 | 110 | Charset charset); |
jjg@416 | 111 | |
jjg@416 | 112 | /** |
jjg@416 | 113 | * Interface representing a future for a native header task. The |
jjg@416 | 114 | * task has not yet started. To start the task, call |
jjg@416 | 115 | * the {@linkplain #call call} method. |
jjg@416 | 116 | * |
jjg@416 | 117 | * <p>Before calling the call method, additional aspects of the |
jjg@416 | 118 | * task can be configured, for example, by calling the |
jjg@416 | 119 | * {@linkplain #setLocale setLocale} method. |
jjg@416 | 120 | */ |
jjg@416 | 121 | interface NativeHeaderTask extends Callable<Boolean> { |
jjg@416 | 122 | |
jjg@416 | 123 | /** |
jjg@416 | 124 | * Set the locale to be applied when formatting diagnostics and |
jjg@416 | 125 | * other localized data. |
jjg@416 | 126 | * |
jjg@416 | 127 | * @param locale the locale to apply; {@code null} means apply no |
jjg@416 | 128 | * locale |
jjg@416 | 129 | * @throws IllegalStateException if the task has started |
jjg@416 | 130 | */ |
jjg@416 | 131 | void setLocale(Locale locale); |
jjg@416 | 132 | |
jjg@416 | 133 | /** |
jjg@416 | 134 | * Performs this native header task. The task may only |
jjg@416 | 135 | * be performed once. Subsequent calls to this method throw |
jjg@416 | 136 | * IllegalStateException. |
jjg@416 | 137 | * |
jjg@416 | 138 | * @return true if and only all the files were processed without errors; |
jjg@416 | 139 | * false otherwise |
jjg@416 | 140 | * |
jjg@416 | 141 | * @throws RuntimeException if an unrecoverable error occurred |
jjg@416 | 142 | * in a user-supplied component. The |
jjg@416 | 143 | * {@linkplain Throwable#getCause() cause} will be the error |
jjg@416 | 144 | * in user code. |
jjg@416 | 145 | * @throws IllegalStateException if called more than once |
jjg@416 | 146 | */ |
jjg@416 | 147 | Boolean call(); |
jjg@416 | 148 | } |
jjg@416 | 149 | } |