37 import javax.tools.DiagnosticListener; |
37 import javax.tools.DiagnosticListener; |
38 import javax.tools.JavaFileManager; |
38 import javax.tools.JavaFileManager; |
39 import javax.tools.JavaFileObject; |
39 import javax.tools.JavaFileObject; |
40 import javax.tools.StandardJavaFileManager; |
40 import javax.tools.StandardJavaFileManager; |
41 |
41 |
|
42 import com.sun.tools.javac.util.DefinedBy; |
|
43 import com.sun.tools.javac.util.DefinedBy.Api; |
|
44 |
42 /* |
45 /* |
43 * <p><b>This is NOT part of any supported API. |
46 * <p><b>This is NOT part of any supported API. |
44 * If you write code that depends on this, you do so at your own |
47 * If you write code that depends on this, you do so at your own |
45 * risk. This code and its internal interfaces are subject to change |
48 * risk. This code and its internal interfaces are subject to change |
46 * or deletion without notice.</b></p> |
49 * or deletion without notice.</b></p> |
57 |
60 |
58 public StandardJavaFileManager getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset) { |
61 public StandardJavaFileManager getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset) { |
59 return JavahTask.getDefaultFileManager(diagnosticListener, null); |
62 return JavahTask.getDefaultFileManager(diagnosticListener, null); |
60 } |
63 } |
61 |
64 |
|
65 @DefinedBy(Api.COMPILER) |
62 public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) { |
66 public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) { |
63 JavahTask t = new JavahTask( |
67 JavahTask t = new JavahTask( |
64 JavahTask.getPrintWriterForStream(out), |
68 JavahTask.getPrintWriterForStream(out), |
65 null, |
69 null, |
66 null, |
70 null, |
67 Arrays.asList(arguments), |
71 Arrays.asList(arguments), |
68 null); |
72 null); |
69 return (t.run() ? 0 : 1); |
73 return (t.run() ? 0 : 1); |
70 } |
74 } |
71 |
75 |
|
76 @DefinedBy(Api.COMPILER) |
72 public Set<SourceVersion> getSourceVersions() { |
77 public Set<SourceVersion> getSourceVersions() { |
73 return EnumSet.allOf(SourceVersion.class); |
78 return EnumSet.allOf(SourceVersion.class); |
74 } |
79 } |
75 |
80 |
|
81 @DefinedBy(Api.COMPILER) |
76 public int isSupportedOption(String option) { |
82 public int isSupportedOption(String option) { |
77 for (JavahTask.Option opt : JavahTask.recognizedOptions) { |
83 for (JavahTask.Option opt : JavahTask.recognizedOptions) { |
78 if (opt.matches(option)) |
84 if (opt.matches(option)) |
79 return (opt.hasArg ? 1 : 0); |
85 return (opt.hasArg ? 1 : 0); |
80 } |
86 } |