Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
JavafxCompiler |
|
| 0.0;0 | ||||
JavafxCompiler$CompilationTask |
|
| 0.0;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.javafx.api; | |
27 | ||
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; | |
38 | ||
39 | /** | |
40 | * The interface to invoke JavaFX Script compilers from programs, used with | |
41 | * ServiceLoader lookup. This interface is based on the JavaCompiler interface; | |
42 | * see its documentation for detailed descriptions. | |
43 | * @see javax.tools.JavaCompiler | |
44 | * | |
45 | * @author tball | |
46 | */ | |
47 | public interface JavafxCompiler extends Tool, OptionChecker { | |
48 | ||
49 | /** | |
50 | * Creates a future for a compilation task with the given | |
51 | * components and arguments. The compilation might not have | |
52 | * completed as described in the CompilationTask interface. | |
53 | * | |
54 | * <p>If a file manager is provided, it must be able to handle all | |
55 | * locations defined in {@link javax.tools.StandardLocation}. | |
56 | * | |
57 | * @param out a Writer for additional output from the compiler; | |
58 | * use {@code System.err} if {@code null} | |
59 | * @param fileManager a file manager; if {@code null} use the | |
60 | * compiler's standard filemanager | |
61 | * @param diagnosticListener a diagnostic listener; if {@code | |
62 | * null} use the compiler's default method for reporting | |
63 | * diagnostics | |
64 | * @param options compiler options, {@code null} means no options | |
65 | * @param compilationUnits the compilation units to compile, {@code | |
66 | * null} means no compilation units | |
67 | * @return an object representing the compilation | |
68 | * @throws RuntimeException if an unrecoverable error | |
69 | * occurred in a user supplied component. The | |
70 | * {@linkplain Throwable#getCause() cause} will be the error in | |
71 | * user code. | |
72 | * @throws IllegalArgumentException if any of the given | |
73 | * compilation units are of other kind than | |
74 | * {@linkplain javax.tools.JavaFileObject.Kind#SOURCE source} | |
75 | */ | |
76 | JavafxcTask getTask(Writer out, | |
77 | JavaFileManager fileManager, | |
78 | DiagnosticListener<? super JavaFileObject> diagnosticListener, | |
79 | Iterable<String> options, | |
80 | Iterable<? extends JavaFileObject> compilationUnits); | |
81 | ||
82 | /** | |
83 | * Gets a new instance of the standard file manager implementation | |
84 | * for this tool. The file manager will use the given diagnostic | |
85 | * listener for producing any non-fatal diagnostics. Fatal errors | |
86 | * will be signalled with the appropriate exceptions. | |
87 | * | |
88 | * <p>The standard file manager will be automatically reopened if | |
89 | * it is accessed after calls to {@code flush} or {@code close}. | |
90 | * The standard file manager must be usable with other tools. | |
91 | * | |
92 | * @param diagnosticListener a diagnostic listener for non-fatal | |
93 | * diagnostics; if {@code null} use the compiler's default method | |
94 | * for reporting diagnostics | |
95 | * @param locale the locale to apply when formatting diagnostics; | |
96 | * {@code null} means the {@linkplain Locale#getDefault() default locale}. | |
97 | * @param charset the character set used for decoding bytes; if | |
98 | * {@code null} use the platform default | |
99 | * @return the standard file manager | |
100 | */ | |
101 | StandardJavaFileManager getStandardFileManager( | |
102 | DiagnosticListener<? super JavaFileObject> diagnosticListener, | |
103 | Locale locale, | |
104 | Charset charset); | |
105 | ||
106 | /** | |
107 | * Interface representing a future for a compilation task. The | |
108 | * compilation task has not yet started. To start the task, call | |
109 | * the {@linkplain #call call} method. | |
110 | */ | |
111 | public interface CompilationTask extends Callable<Boolean> { | |
112 | ||
113 | /** | |
114 | * Performs this compilation task. The compilation may only | |
115 | * be performed once. Subsequent calls to this method throw | |
116 | * IllegalStateException. | |
117 | * | |
118 | * @return true if and only all the files compiled without errors; | |
119 | * false otherwise | |
120 | * | |
121 | * @throws RuntimeException if an unrecoverable error occurred | |
122 | * in a user-supplied component. The | |
123 | * {@linkplain Throwable#getCause() cause} will be the error | |
124 | * in user code. | |
125 | * @throws IllegalStateException if called more than once | |
126 | */ | |
127 | @Override | |
128 | Boolean call(); | |
129 | } | |
130 | } |