|
Java example source code file (T6572945.java)
The T6572945.java Java example source code/* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * 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. */ /* * @test * @bug 6572945 * @summary rewrite javah as an annotation processor, instead of as a doclet * @build TestClass1 TestClass2 TestClass3 * @run main T6572945 */ import java.io.*; import java.util.*; import com.sun.tools.javah.Main; public class T6572945 { static File testSrc = new File(System.getProperty("test.src", ".")); static File testClasses = new File(System.getProperty("test.classes", ".")); static boolean isWindows = System.getProperty("os.name").startsWith("Windows"); public static void main(String... args) throws IOException, InterruptedException { boolean ok = new T6572945().run(args); if (!ok) throw new Error("Test Failed"); } public boolean run(String[] args) throws IOException, InterruptedException { if (args.length == 1) jdk = new File(args[0]); test("-o", "jni.file.1", "-jni", "TestClass1"); test("-o", "jni.file.2", "-jni", "TestClass1", "TestClass2"); test("-d", "jni.dir.1", "-jni", "TestClass1", "TestClass2"); test("-o", "jni.file.3", "-jni", "TestClass3"); // The following tests are disabled because llni support has been // discontinued, and because bugs in old javah means that character // for character testing against output from old javah does not work. // In fact, the LLNI impl in new javah is actually better than the // impl in old javah because of a couple of significant bug fixes. // test("-o", "llni.file.1", "-llni", "TestClass1"); // test("-o", "llni.file.2", "-llni", "TestClass1", "TestClass2"); // test("-d", "llni.dir.1", "-llni", "TestClass1", "TestClass2"); // test("-o", "llni.file.3", "-llni", "TestClass3"); return (errors == 0); } void test(String... args) throws IOException, InterruptedException { String[] cp_args = new String[args.length + 2]; cp_args[0] = "-classpath"; cp_args[1] = testClasses.getPath(); System.arraycopy(args, 0, cp_args, 2, args.length); if (jdk != null) init(cp_args); File out = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("-o")) { out = new File(args[++i]); break; } else if (args[i].equals("-d")) { out = new File(args[++i]); out.mkdirs(); break; } } try { System.out.println("test: " + Arrays.asList(cp_args)); // // Uncomment and use the following lines to execute javah via the // // command line -- for example, to run old javah and set up the golden files // List<String> cmd = new ArrayList Other Java examples (source code examples)Here is a short list of links related to this Java T6572945.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.