/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Javah generates support files for native methods.
* Parse commandline options & Invokes javadoc to execute those commands.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own
* risk. This code and its internal interfaces are subject to change
* or deletion without notice.</b></p>
*
* @author Sucheta Dambalkar
* @author Jonathan Gibbons
*/
}
showUsage = b;
return this;
}
boolean showUsage;
}
static abstract class Option {
}
boolean isHidden() {
return false;
}
return true;
}
return false;
}
boolean ignoreRest() {
return false;
}
final boolean hasArg;
}
}
boolean isHidden() {
return true;
}
}
new Option(true, "-o") {
}
},
new Option(true, "-d") {
}
},
new HiddenOption(true, "-td") {
// ignored; for backwards compatibility
}
},
new HiddenOption(false, "-stubs") {
// ignored; for backwards compatibility
}
},
}
},
}
},
new HiddenOption(false, "-trace") {
}
},
new Option(false, "-version") {
}
},
new HiddenOption(false, "-fullversion") {
task.fullVersion = true;
}
},
new Option(false, "-jni") {
}
},
new Option(false, "-force") {
}
},
new HiddenOption(false, "-Xnew") {
// we're already using the new javah
}
},
new HiddenOption(false, "-old") {
}
},
}
},
new HiddenOption(false, "-llnidouble") {
task.doubleAlign = true;
}
},
new HiddenOption(false) {
}
}
},
};
JavahTask() {
}
this();
this.fileManager = fileManager;
this.diagnosticListener = diagnosticListener;
try {
handleOptions(options, false);
} catch (BadArgs e) {
throw new IllegalArgumentException(e.getMessage());
}
}
}
}
}
}
}
return new PrintWriter(s, true);
}
if (w == null)
return getPrintWriterForStream(null);
else if (w instanceof PrintWriter)
return (PrintWriter) w;
else
return new PrintWriter(w, true);
}
}
}
}
return new DiagnosticListener<JavaFileObject> () {
}
}
};
}
try {
} catch (BadArgs e) {
return 1;
} catch (InternalError e) {
return 1;
return e.exitValue;
} finally {
}
}
}
if (diagnosticListener == null)
} else {
if (diagnosticListener == null)
}
if (fileManager == null)
else if (allowClasses) {
} else
}
throw new BadArgs("err.no.classes.specified");
}
throw new BadArgs("jni.llni.mixed");
throw new BadArgs("dir.file.mixed");
}
for (Option o: recognizedOptions) {
if (o.hasArg) {
else
} else
if (o.ignoreRest()) {
}
return;
}
}
return;
}
try {
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
}
return run();
}
showHelp();
return help; // treat noArgs as an error for purposes of exit code
}
if (version || fullVersion) {
return true;
}
Gen g;
if (llni)
else {
// if (stubs)
// throw new BadArgs("jni.no.stubs");
}
if (!(fileManager instanceof StandardJavaFileManager)) {
return false;
}
g.setOutFile(fo);
} else {
if (!(fileManager instanceof StandardJavaFileManager)) {
return false;
}
try {
((StandardJavaFileManager) fileManager).setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(odir));
} catch (IOException e) {
msg = e;
}
return false;
}
}
}
/*
* Force set to false will turn off smarts about checking file
* content before writing.
*/
if (fileManager instanceof JavahFileManager)
JavahProcessor p = new JavahProcessor(g);
return ok;
}
if (f.length() > 0)
}
return files;
}
static StandardJavaFileManager getDefaultFileManager(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) {
}
private void showHelp() {
for (Option o: recognizedOptions) {
if (o.isHidden())
continue;
}
continue;
}
}
}
// versionKey=product: mm.nn.oo[-milestone]
// versionKey=full: mm.mm.oo[-milestone]-build
try {
} catch (MissingResourceException e) {
}
}
try {
}
catch (MissingResourceException e) {
}
}
return new Diagnostic<JavaFileObject>() {
}
public JavaFileObject getSource() {
return null;
}
public long getPosition() {
return Diagnostic.NOPOS;
}
public long getStartPosition() {
return Diagnostic.NOPOS;
}
public long getEndPosition() {
return Diagnostic.NOPOS;
}
public long getLineNumber() {
return Diagnostic.NOPOS;
}
public long getColumnNumber() {
return Diagnostic.NOPOS;
}
return key;
}
}
};
}
}
// could make this a HashMap<Locale,SoftReference<ResourceBundle>>
// and for efficiency, keep a hard reference to the bundle for the task
// locale
}
if (b == null) {
try {
} catch (MissingResourceException e) {
}
}
try {
} catch (MissingResourceException e) {
return key;
//throw new InternalError(e, key);
}
}
boolean verbose;
boolean noArgs;
boolean help;
boolean trace;
boolean version;
boolean fullVersion;
boolean jni;
boolean llni;
boolean doubleAlign;
boolean force;
boolean old;
@SupportedAnnotationTypes("*")
this.g = g;
}
// since this is co-bundled with javac, we can assume it supports
// the latest source version
return SourceVersion.latest();
}
}
try {
g.setClasses(classes);
g.run();
}
} catch (CompletionFailure cf) {
} catch (ClassNotFoundException cnfe) {
} catch (IOException ioe) {
exit = e;
}
return true;
}
return allClasses;
}
for (TypeElement c: classes) {
allClasses.add(c);
}
}
// 4942232:
// check that classes exist for all the parameters of native methods
}
}
}
}
return null;
}
return null;
}
};
private Gen g;
}
}