提交 71544570 编写于 作者: L lana

Merge

/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2012, 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
......@@ -126,6 +126,7 @@ public class Symtab {
public final Type cloneableType;
public final Type serializableType;
public final Type methodHandleType;
public final Type nativeHeaderType;
public final Type polymorphicSignatureType;
public final Type throwableType;
public final Type errorType;
......@@ -477,6 +478,7 @@ public class Symtab {
List.of(exceptionType), methodClass),
autoCloseableType.tsym);
trustMeType = enterClass("java.lang.SafeVarargs");
nativeHeaderType = enterClass("javax.tools.annotation.GenerateNativeHeader");
synthesizeEmptyInterfaceIfMissing(autoCloseableType);
synthesizeEmptyInterfaceIfMissing(cloneableType);
......
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -648,7 +648,8 @@ public class Locations {
new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S)
new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S),
new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H)
};
for (LocationHandler h: handlers) {
......
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2012, 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
......@@ -69,11 +69,11 @@ public class ClassWriter extends ClassFile {
*/
private boolean verbose;
/** Switch: scrable private names.
/** Switch: scramble private names.
*/
private boolean scramble;
/** Switch: scrable private names.
/** Switch: scramble private names.
*/
private boolean scrambleAll;
......
......@@ -44,6 +44,8 @@ import javax.lang.model.SourceVersion;
import javax.tools.DiagnosticListener;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardLocation;
import static javax.tools.StandardLocation.CLASS_OUTPUT;
import com.sun.source.util.TaskEvent;
......@@ -60,6 +62,7 @@ import com.sun.tools.javac.tree.*;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.util.Log.WriterKind;
import static com.sun.tools.javac.main.Option.*;
import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
import static com.sun.tools.javac.util.ListBuffer.lb;
......@@ -227,6 +230,10 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
*/
protected ClassWriter writer;
/** The native header writer.
*/
protected JNIWriter jniWriter;
/** The module for the symbol table entry phases.
*/
protected Enter enter;
......@@ -330,6 +337,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
reader = ClassReader.instance(context);
make = TreeMaker.instance(context);
writer = ClassWriter.instance(context);
jniWriter = JNIWriter.instance(context);
enter = Enter.instance(context);
todo = Todo.instance(context);
......@@ -1450,8 +1458,13 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
JavaFileObject file;
if (usePrintSource)
file = printSource(env, cdef);
else
else {
if (fileManager.hasLocation(StandardLocation.NATIVE_HEADER_OUTPUT)
&& jniWriter.needsHeader(cdef.sym)) {
jniWriter.write(cdef.sym);
}
file = genCode(env, cdef);
}
if (results != null && file != null)
results.add(file);
} catch (IOException ex) {
......
/*
* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2012, 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
......@@ -160,6 +160,8 @@ public enum Option {
S("-s", "opt.arg.directory", "opt.sourceDest", STANDARD, FILEMANAGER),
H("-h", "opt.arg.directory", "opt.headerDest", STANDARD, FILEMANAGER),
IMPLICIT("-implicit:", "opt.implicit", STANDARD, BASIC, ONEOF, "none", "class"),
ENCODING("-encoding", "opt.arg.encoding", "opt.encoding", STANDARD, FILEMANAGER) {
......
#
# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2012, 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
......@@ -61,6 +61,8 @@ javac.opt.d=\
Specify where to place generated class files
javac.opt.sourceDest=\
Specify where to place generated source files
javac.opt.headerDest=\
Specify where to place generated native header files
javac.opt.J=\
Pass <flag> directly to the runtime system
javac.opt.encoding=\
......
/*
* Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2012, 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
......@@ -66,7 +66,13 @@ public enum StandardLocation implements Location {
* Location to search for platform classes. Sometimes called
* the boot class path.
*/
PLATFORM_CLASS_PATH;
PLATFORM_CLASS_PATH,
/**
* Location of new native header files.
* @since 1.8
*/
NATIVE_HEADER_OUTPUT;
/**
* Gets a location object with the given name. The following
......@@ -97,6 +103,13 @@ public enum StandardLocation implements Location {
public String getName() { return name(); }
public boolean isOutputLocation() {
return this == CLASS_OUTPUT || this == SOURCE_OUTPUT;
switch (this) {
case CLASS_OUTPUT:
case SOURCE_OUTPUT:
case NATIVE_HEADER_OUTPUT:
return true;
default:
return false;
}
}
}
/*
* Copyright (c) 2012, 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. 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.
*/
package javax.tools.annotation;
import java.lang.annotation.*;
import static java.lang.annotation.RetentionPolicy.*;
import static java.lang.annotation.ElementType.*;
/**
* An annotation used to indicate that a native header file
* should be generated for this class.
*
* Normally, the presence of native methods is a sufficient
* indication of the need for a native header file. However,
* in some cases, a class may contain constants of interest to
* native code, without containing any native methods.
*
* @since 1.8
*/
@Documented
@Target(TYPE)
@Retention(SOURCE)
public @interface GenerateNativeHeader {
}
/*
* Copyright (c) 20011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
......
/*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, 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
......@@ -259,6 +259,7 @@ public class CheckResourceKeys {
"application.home", // in Paths.java
"env.class.path",
"line.separator",
"os.name",
"user.dir",
// file names
"ct.sym",
......
/*
* Copyright (c) 2012, 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 7150368
* @summary javac should include basic ability to generate native headers
*/
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import com.sun.source.util.JavacTask;
import com.sun.tools.javac.api.JavacTool;
public class NativeHeaderTest {
public static void main(String... args) throws Exception {
new NativeHeaderTest().run();
}
/** How to invoke javac. */
enum RunKind {
/** Use the command line entry point. */
CMD,
/** Use the JavaCompiler API. */
API
};
/** Which classes for which to generate headers. */
enum GenKind {
/** Just classes with native methods or the marker annotation. */
SIMPLE,
/** All appropriate classes within the top level class. */
FULL
};
// ---------- Test cases, invoked reflectively via run. ----------
@Test
void simpleTest(RunKind rk, GenKind gk) throws Exception {
List<File> files = new ArrayList<File>();
files.add(createFile("p/C.java",
"class C { native void m(); }"));
Set<String> expect = createSet("C.h");
test(rk, gk, files, expect);
}
@Test
void nestedClassTest(RunKind rk, GenKind gk) throws Exception {
List<File> files = new ArrayList<File>();
files.add(createFile("p/C.java",
"class C { static class Inner { native void m(); } }"));
Set<String> expect = createSet("C_Inner.h");
if (gk == GenKind.FULL) expect.add("C.h");
test(rk, gk, files, expect);
}
@Test
void localClassTest(RunKind rk, GenKind gk) throws Exception {
List<File> files = new ArrayList<File>();
files.add(createFile("p/C.java",
"class C { native void m(); void m2() { class Local { } } }"));
Set<String> expect = createSet("C.h");
test(rk, gk, files, expect);
}
@Test
void syntheticClassTest(RunKind rk, GenKind gk) throws Exception {
List<File> files = new ArrayList<File>();
files.add(createFile("p/C.java",
"class C {\n"
+ " private C() { }\n"
+ " class Inner extends C { native void m(); }\n"
+ "}"));
Set<String> expect = createSet("C_Inner.h");
if (gk == GenKind.FULL) expect.add("C.h");
test(rk, gk, files, expect);
// double check the synthetic class was generated
checkEqual("generatedClasses",
createSet("C.class", "C$1.class", "C$Inner.class"),
createSet(classesDir.list()));
}
@Test
void annoTest(RunKind rk, GenKind gk) throws Exception {
List<File> files = new ArrayList<File>();
files.add(createFile("p/C.java",
"@javax.tools.annotation.GenerateNativeHeader class C { }"));
Set<String> expect = createSet("C.h");
test(rk, gk, files, expect);
}
@Test
void annoNestedClassTest(RunKind rk, GenKind gk) throws Exception {
List<File> files = new ArrayList<File>();
files.add(createFile("p/C.java",
"class C { @javax.tools.annotation.GenerateNativeHeader class Inner { } }"));
Set<String> expect = createSet("C_Inner.h");
if (gk == GenKind.FULL) expect.add("C.h");
test(rk, gk, files, expect);
}
/**
* The worker method for each test case.
* Compile the files and verify that exactly the expected set of header files
* is generated.
*/
void test(RunKind rk, GenKind gk, List<File> files, Set<String> expect) throws Exception {
List<String> args = new ArrayList<String>();
if (gk == GenKind.FULL)
args.add("-XDjavah:full");
switch (rk) {
case CMD:
args.add("-d");
args.add(classesDir.getPath());
args.add("-h");
args.add(headersDir.getPath());
for (File f: files)
args.add(f.getPath());
int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]));
if (rc != 0)
throw new Exception("compilation failed, rc=" + rc);
break;
case API:
fm.setLocation(StandardLocation.SOURCE_PATH, Arrays.asList(srcDir));
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(classesDir));
fm.setLocation(StandardLocation.NATIVE_HEADER_OUTPUT, Arrays.asList(headersDir));
JavacTask task = javac.getTask(null, fm, null, args, null,
fm.getJavaFileObjectsFromFiles(files));
if (!task.call())
throw new Exception("compilation failed");
break;
}
Set<String> found = createSet(headersDir.list());
checkEqual("header files", expect, found);
}
/** Marker annotation for test cases. */
@Retention(RetentionPolicy.RUNTIME)
@interface Test { }
/** Combo test to run all test cases in all modes. */
void run() throws Exception {
javac = JavacTool.create();
fm = javac.getStandardFileManager(null, null, null);
for (RunKind rk: RunKind.values()) {
for (GenKind gk: GenKind.values()) {
for (Method m: getClass().getDeclaredMethods()) {
Annotation a = m.getAnnotation(Test.class);
if (a != null) {
init(rk, gk, m.getName());
try {
m.invoke(this, new Object[] { rk, gk });
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
throw (cause instanceof Exception) ? ((Exception) cause) : e;
}
System.err.println();
}
}
}
}
System.err.println(testCount + " tests" + ((errorCount == 0) ? "" : ", " + errorCount + " errors"));
if (errorCount > 0)
throw new Exception(errorCount + " errors found");
}
/**
* Init directories for a test case.
*/
void init(RunKind rk, GenKind gk, String name) throws IOException {
System.err.println("Test " + rk + " " + gk + " " + name);
testCount++;
testDir = new File(rk.toString().toLowerCase() + "_" + gk.toString().toLowerCase() + "-" + name);
srcDir = new File(testDir, "src");
srcDir.mkdirs();
classesDir = new File(testDir, "classes");
classesDir.mkdirs();
headersDir = new File(testDir, "headers");
headersDir.mkdirs();
}
/** Create a source file with given body text. */
File createFile(String path, final String body) throws IOException {
File f = new File(srcDir, path);
f.getParentFile().mkdirs();
try (FileWriter out = new FileWriter(f)) {
out.write(body);
}
return f;
}
/** Convenience method to create a set of items. */
<T> Set<T> createSet(T... items) {
return new HashSet<T>(Arrays.asList(items));
}
/** Convenience method to check two values are equal, and report an error if not. */
<T> void checkEqual(String label, T expect, T found) {
if ((found == null) ? (expect == null) : found.equals(expect))
return;
System.err.println("Error: mismatch");
System.err.println(" expected: " + expect);
System.err.println(" found: " + found);
errorCount++;
}
// Shared across API test cases
JavacTool javac;
StandardJavaFileManager fm;
// Directories set up by init
File testDir;
File srcDir;
File classesDir;
File headersDir;
// Statistics
int testCount;
int errorCount;
}
/*
* Copyright (c) 2007,2012 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 7150368
* @summary javac should include basic ability to generate native headers
*/
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class CompareTest {
public static void main(String... args) throws Exception {
new CompareTest().run();
}
void run() throws Exception {
File srcDir = new File(System.getProperty("test.src"));
File classesDir = new File("classes");
classesDir.mkdirs();
File javacHeaders = new File("headers.javac");
javacHeaders.mkdirs();
File javahHeaders = new File("headers.javah");
javahHeaders.mkdirs();
List<String> javacArgs = new ArrayList<String>();
javacArgs.add("-d");
javacArgs.add(classesDir.getPath());
javacArgs.add("-h");
javacArgs.add(javacHeaders.getPath());
javacArgs.add("-XDjavah:full");
for (File f: srcDir.listFiles()) {
if (f.getName().matches("TestClass[0-9]+\\.java")) {
sourceFileCount++;
javacArgs.add(f.getPath());
}
}
int rc = com.sun.tools.javac.Main.compile(javacArgs.toArray(new String[javacArgs.size()]));
if (rc != 0)
throw new Exception("javac failed; rc=" + rc);
List<String> javahArgs = new ArrayList<String>();
javahArgs.add("-d");
javahArgs.add(javahHeaders.getPath());
for (File f: classesDir.listFiles()) {
if (f.getName().endsWith(".class")) {
javahArgs.add(inferBinaryName(f));
}
}
PrintWriter pw = new PrintWriter(System.out, true);
rc = com.sun.tools.javah.Main.run(javahArgs.toArray(new String[javahArgs.size()]), pw);
if (rc != 0)
throw new Exception("javah failed; rc=" + rc);
compare(javahHeaders, javacHeaders);
int javahHeaderCount = javahHeaders.list().length;
int javacHeaderCount = javacHeaders.list().length;
System.out.println(sourceFileCount + " .java files found");
System.out.println(javacHeaderCount + " .h files generated by javac");
System.out.println(javahHeaderCount + " .h files generated by javah");
System.out.println(compareCount + " header files compared");
if (javacHeaderCount != javahHeaderCount || javacHeaderCount != compareCount)
error("inconsistent counts");
if (errors > 0)
throw new Exception(errors + " errors occurred");
}
String inferBinaryName(File file) {
String name = file.getName();
return name.substring(0, name.length() - ".class".length()).replace("$", ".");
}
/** Compare two directories.
* @param f1 The golden directory
* @param f2 The directory to be compared
*/
void compare(File f1, File f2) {
compare(f1, f2, null);
}
/** Compare two files or directories
* @param f1 The golden directory
* @param f2 The directory to be compared
* @param p An optional path identifying a file within the two directories
*/
void compare(File f1, File f2, String p) {
File f1p = (p == null ? f1 : new File(f1, p));
File f2p = (p == null ? f2 : new File(f2, p));
if (f1p.isDirectory() && f2p.isDirectory()) {
Set<String> children = new HashSet<String>();
children.addAll(Arrays.asList(f1p.list()));
children.addAll(Arrays.asList(f2p.list()));
for (String c: children) {
compare(f1, f2, new File(p, c).getPath()); // null-safe for p
}
}
else if (f1p.isFile() && f2p.isFile()) {
System.out.println("checking " + p);
compareCount++;
String s1 = read(f1p);
String s2 = read(f2p);
if (!s1.equals(s2)) {
System.out.println("File: " + f1p + "\n" + s1);
System.out.println("File: " + f2p + "\n" + s2);
error("Files differ: " + f1p + " " + f2p);
}
}
else if (f1p.exists() && !f2p.exists())
error("Only in " + f1 + ": " + p);
else if (f2p.exists() && !f1p.exists())
error("Only in " + f2 + ": " + p);
else
error("Files differ: " + f1p + " " + f2p);
}
private String read(File f) {
try {
return new String(Files.readAllBytes(f.toPath()));
} catch (IOException e) {
error("error reading " + f + ": " + e);
return "";
}
}
private void error(String msg) {
System.out.println(msg);
errors++;
}
private int errors;
private int compareCount;
private int sourceFileCount;
}
/*
* Copyright (c) 2007, 2012, 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.
*/
import java.util.List;
public class TestClass1 {
// simple types
byte b;
short s;
int i;
long l;
float f;
double d;
Object o;
String t;
List<String> g;
// constants
static final byte bc = 0;
static final short sc = 0;
static final int ic = 0;
static final long lc = 0;
static final float fc = 0;
static final double dc = 0;
static final Object oc = null;
static final String tc = "";
static final List<String> gc = null;
// simple arrays
byte[] ba;
short[] sa; // not handled corrected by javah v6
int[] ia;
long[] la;
float[] fa;
double[] da;
Object[] oa;
String[] ta;
List<String>[] ga;
// multidimensional arrays
byte[][] baa;
short[][] saa;
int[][] iaa;
long[][] laa;
float[][] faa;
double[][] daa;
Object[][] oaa;
String[][] taa;
List<String>[] gaa;
// simple Java methods
byte bm() { return 0; }
short sm() { return 0; }
int im() { return 0; }
long lm() { return 0; }
float fm() { return 0; }
double dm() { return 0; }
Object om() { return null; }
String tm() { return ""; }
List<String> gm() { return null; }
void vm() { }
byte[] bam() { return null; }
short[] sam() { return null; }
int[] iam() { return null; }
long[] lam() { return null; }
float[] fam() { return null; }
double[] dam() { return null; }
Object[] oam() { return null; }
String[] tam() { return null; }
List<String>[] gam() { return null; }
byte[][] baam() { return null; }
short[][] saam() { return null; }
int[][] iaam() { return null; }
long[][] laam() { return null; }
float[][] faam() { return null; }
double[][] daam() { return null; }
Object[][] oaam() { return null; }
String[][] taam() { return null; }
List<String>[] gaam() { return null; }
// simple native methods
native byte bmn();
native short smn();
native int imn();
native long lmn();
native float fmn();
native double dmn();
native Object omn();
native String tmn();
native List<String> gmn();
native void vmn();
native byte[] bamn();
native short[] samn();
native int[] iamn();
native long[] lamn();
native float[] famn();
native double[] damn();
native Object[] oamn();
native String[] tamn();
native List<String>[] gamn();
native byte[][] baamn();
native short[][] saamn();
native int[][] iaamn();
native long[][] laamn();
native float[][] faamn();
native double[][] daamn();
native Object[][] oaamn();
native String[][] taamn();
native List<String>[] gaamn();
// overloaded Java methods
byte bm1() { return 0; }
short sm1() { return 0; }
int im1() { return 0; }
long lm1() { return 0; }
float fm1() { return 0; }
double dm1() { return 0; }
Object om1() { return null; }
String tm1() { return ""; }
List<String> gm1() { return null; }
void vm1() { }
byte bm2(int i) { return 0; }
short sm2(int i) { return 0; }
int im2(int i) { return 0; }
long lm2(int i) { return 0; }
float fm2(int i) { return 0; }
double dm2(int i) { return 0; }
Object om2(int i) { return null; }
String tm2(int i) { return ""; }
List<String> gm2(int i) { return null; }
void vm2(int i) { }
// overloaded native methods
native byte bmn1();
native short smn1();
native int imn1();
native long lmn1();
native float fmn1();
native double dmn1();
native Object omn1();
native String tmn1();
native List<String> gmn1();
native void vmn1();
native byte bmn2(int i);
native short smn2(int i);
native int imn2(int i);
native long lmn2(int i);
native float fmn2(int i);
native double dmn2(int i);
native Object omn2(int i);
native String tmn2(int i);
native List<String> gmn2(int i);
native void vmn2(int i);
// arg types for Java methods
void mb(byte b) { }
void ms(short s) { }
void mi(int i) { }
void ml(long l) { }
void mf(float f) { }
void md(double d) { }
void mo(Object o) { }
void mt(String t) { }
void mg(List<String> g) { }
// arg types for native methods
native void mbn(byte b);
native void msn(short s);
native void min(int i);
native void mln(long l);
native void mfn(float f);
native void mdn(double d);
native void mon(Object o);
native void mtn(String t);
native void mgn(List<String> g);
static class Inner1 {
// simple types
byte b;
short s;
int i;
long l;
float f;
double d;
Object o;
String t;
List<String> g;
// constants
static final byte bc = 0;
static final short sc = 0;
static final int ic = 0;
static final long lc = 0;
static final float fc = 0;
static final double dc = 0;
static final Object oc = null;
static final String tc = "";
static final List<String> gc = null;
// simple arrays
byte[] ba;
// short[] sa; // not handled corrected by javah v6
int[] ia;
long[] la;
float[] fa;
double[] da;
Object[] oa;
String[] ta;
List<String>[] ga;
// multidimensional arrays
byte[][] baa;
short[][] saa;
int[][] iaa;
long[][] laa;
float[][] faa;
double[][] daa;
Object[][] oaa;
String[][] taa;
List<String>[] gaa;
// simple Java methods
byte bm() { return 0; }
short sm() { return 0; }
int im() { return 0; }
long lm() { return 0; }
float fm() { return 0; }
double dm() { return 0; }
Object om() { return null; }
String tm() { return ""; }
List<String> gm() { return null; }
void vm() { }
// simple native methods
native byte bmn();
native short smn();
native int imn();
native long lmn();
native float fmn();
native double dmn();
native Object omn();
native String tmn();
native List<String> gmn();
native void vmn();
// overloaded Java methods
byte bm1() { return 0; }
short sm1() { return 0; }
int im1() { return 0; }
long lm1() { return 0; }
float fm1() { return 0; }
double dm1() { return 0; }
Object om1() { return null; }
String tm1() { return ""; }
List<String> gm1() { return null; }
void vm1() { }
byte bm2(int i) { return 0; }
short sm2(int i) { return 0; }
int im2(int i) { return 0; }
long lm2(int i) { return 0; }
float fm2(int i) { return 0; }
double dm2(int i) { return 0; }
Object om2(int i) { return null; }
String tm2(int i) { return ""; }
List<String> gm2(int i) { return null; }
void vm2(int i) { }
// overloaded native methods
native byte bmn1();
native short smn1();
native int imn1();
native long lmn1();
native float fmn1();
native double dmn1();
native Object omn1();
native String tmn1();
native List<String> gmn1();
native void vmn1();
native byte bmn2(int i);
native short smn2(int i);
native int imn2(int i);
native long lmn2(int i);
native float fmn2(int i);
native double dmn2(int i);
native Object omn2(int i);
native String tmn2(int i);
native List<String> gmn2(int i);
native void vmn2(int i);
// arg types for Java methods
void mb(byte b) { }
void ms(short s) { }
void mi(int i) { }
void ml(long l) { }
void mf(float f) { }
void md(double d) { }
void mo(Object o) { }
void mt(String t) { }
void mg(List<String> g) { }
// arg types for native methods
native void mbn(byte b);
native void msn(short s);
native void min(int i);
native void mln(long l);
native void mfn(float f);
native void mdn(double d);
native void mon(Object o);
native void mtn(String t);
native void mgn(List<String> g);
}
class Inner2 {
// simple types
byte b;
short s;
int i;
long l;
float f;
double d;
Object o;
String t;
List<String> g;
// constants
static final byte bc = 0;
static final short sc = 0;
static final int ic = 0;
static final long lc = 0;
static final float fc = 0;
static final double dc = 0;
//static final Object oc = null;
static final String tc = "";
//static final List<String> gc = null;
// simple arrays
byte[] ba;
// short[] sa; // not handled corrected by javah v6
int[] ia;
long[] la;
float[] fa;
double[] da;
Object[] oa;
String[] ta;
List<String>[] ga;
// multidimensional arrays
byte[][] baa;
short[][] saa;
int[][] iaa;
long[][] laa;
float[][] faa;
double[][] daa;
Object[][] oaa;
String[][] taa;
List<String>[] gaa;
// simple Java methods
byte bm() { return 0; }
short sm() { return 0; }
int im() { return 0; }
long lm() { return 0; }
float fm() { return 0; }
double dm() { return 0; }
Object om() { return null; }
String tm() { return ""; }
List<String> gm() { return null; }
void vm() { }
// simple native methods
native byte bmn();
native short smn();
native int imn();
native long lmn();
native float fmn();
native double dmn();
native Object omn();
native String tmn();
native List<String> gmn();
native void vmn();
// overloaded Java methods
byte bm1() { return 0; }
short sm1() { return 0; }
int im1() { return 0; }
long lm1() { return 0; }
float fm1() { return 0; }
double dm1() { return 0; }
Object om1() { return null; }
String tm1() { return ""; }
List<String> gm1() { return null; }
void vm1() { }
byte bm2(int i) { return 0; }
short sm2(int i) { return 0; }
int im2(int i) { return 0; }
long lm2(int i) { return 0; }
float fm2(int i) { return 0; }
double dm2(int i) { return 0; }
Object om2(int i) { return null; }
String tm2(int i) { return ""; }
List<String> gm2(int i) { return null; }
void vm2(int i) { }
// overloaded native methods
native byte bmn1();
native short smn1();
native int imn1();
native long lmn1();
native float fmn1();
native double dmn1();
native Object omn1();
native String tmn1();
native List<String> gmn1();
native void vmn1();
native byte bmn2(int i);
native short smn2(int i);
native int imn2(int i);
native long lmn2(int i);
native float fmn2(int i);
native double dmn2(int i);
native Object omn2(int i);
native String tmn2(int i);
native List<String> gmn2(int i);
native void vmn2(int i);
// arg types for Java methods
void mb(byte b) { }
void ms(short s) { }
void mi(int i) { }
void ml(long l) { }
void mf(float f) { }
void md(double d) { }
void mo(Object o) { }
void mt(String t) { }
void mg(List<String> g) { }
// arg types for native methods
native void mbn(byte b);
native void msn(short s);
native void min(int i);
native void mln(long l);
native void mfn(float f);
native void mdn(double d);
native void mon(Object o);
native void mtn(String t);
native void mgn(List<String> g);
}
}
/*
* Copyright (c) 2007, 2012, 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.
*/
import javax.tools.annotation.GenerateNativeHeader;
@GenerateNativeHeader
public class TestClass2 {
byte b;
short s;
int i;
long l;
float f;
double d;
Object o;
String t;
}
/*
* Copyright (c) 2007, 2012, 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.
*/
import javax.tools.annotation.GenerateNativeHeader;
@GenerateNativeHeader
public class TestClass3 {
public int tc3;
public class Inner1 {
public int tc3i1;
public class Inner1A {
public int tc3i1i1a;
}
public class Inner1B {
public int tc3i1i1b;
}
}
public class Inner2 {
public int tc321;
public class Inner2A {
public int tc3i2i2a;
}
public class Inner2B {
public int tc3i2i2b;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册