Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
71544570
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
71544570
编写于
3月 21, 2012
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
fc54c824
22da7ffe
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
1959 addition
and
14 deletion
+1959
-14
src/share/classes/com/sun/tools/javac/code/Symtab.java
src/share/classes/com/sun/tools/javac/code/Symtab.java
+3
-1
src/share/classes/com/sun/tools/javac/file/Locations.java
src/share/classes/com/sun/tools/javac/file/Locations.java
+3
-2
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
+3
-3
src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java
src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java
+856
-0
src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
+14
-1
src/share/classes/com/sun/tools/javac/main/Option.java
src/share/classes/com/sun/tools/javac/main/Option.java
+3
-1
src/share/classes/com/sun/tools/javac/resources/javac.properties
...re/classes/com/sun/tools/javac/resources/javac.properties
+3
-1
src/share/classes/javax/tools/StandardLocation.java
src/share/classes/javax/tools/StandardLocation.java
+16
-3
src/share/classes/javax/tools/annotation/GenerateNativeHeader.java
.../classes/javax/tools/annotation/GenerateNativeHeader.java
+47
-0
test/tools/javac/api/7086261/T7086261.java
test/tools/javac/api/7086261/T7086261.java
+1
-1
test/tools/javac/diags/CheckResourceKeys.java
test/tools/javac/diags/CheckResourceKeys.java
+2
-1
test/tools/javac/nativeHeaders/NativeHeaderTest.java
test/tools/javac/nativeHeaders/NativeHeaderTest.java
+274
-0
test/tools/javac/nativeHeaders/javahComparison/CompareTest.java
...ools/javac/nativeHeaders/javahComparison/CompareTest.java
+169
-0
test/tools/javac/nativeHeaders/javahComparison/TestClass1.java
...tools/javac/nativeHeaders/javahComparison/TestClass1.java
+475
-0
test/tools/javac/nativeHeaders/javahComparison/TestClass2.java
...tools/javac/nativeHeaders/javahComparison/TestClass2.java
+36
-0
test/tools/javac/nativeHeaders/javahComparison/TestClass3.java
...tools/javac/nativeHeaders/javahComparison/TestClass3.java
+54
-0
未找到文件。
src/share/classes/com/sun/tools/javac/code/Symtab.java
浏览文件 @
71544570
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
2
, 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
);
...
...
src/share/classes/com/sun/tools/javac/file/Locations.java
浏览文件 @
71544570
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
2
, 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
)
{
...
...
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
浏览文件 @
71544570
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
2
, 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: scra
m
ble private names.
*/
private
boolean
scramble
;
/** Switch: scrable private names.
/** Switch: scra
m
ble private names.
*/
private
boolean
scrambleAll
;
...
...
src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java
0 → 100644
浏览文件 @
71544570
此差异已折叠。
点击以展开。
src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
浏览文件 @
71544570
...
...
@@ -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
)
{
...
...
src/share/classes/com/sun/tools/javac/main/Option.java
浏览文件 @
71544570
/*
* Copyright (c) 2006, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 201
2
, 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
)
{
...
...
src/share/classes/com/sun/tools/javac/resources/javac.properties
浏览文件 @
71544570
#
# Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 201
2
, 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
=
\
...
...
src/share/classes/javax/tools/StandardLocation.java
浏览文件 @
71544570
/*
* Copyright (c) 2006, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 20
12
, 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
;
}
}
}
src/share/classes/javax/tools/annotation/GenerateNativeHeader.java
0 → 100644
浏览文件 @
71544570
/*
* 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
{
}
test/tools/javac/api/7086261/T7086261.java
浏览文件 @
71544570
/*
* Copyright (c) 20
0
11, 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
...
...
test/tools/javac/diags/CheckResourceKeys.java
浏览文件 @
71544570
/*
* Copyright (c) 2010, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 201
2
, 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"
,
...
...
test/tools/javac/nativeHeaders/NativeHeaderTest.java
0 → 100644
浏览文件 @
71544570
/*
* 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
;
}
test/tools/javac/nativeHeaders/javahComparison/CompareTest.java
0 → 100644
浏览文件 @
71544570
/*
* 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
;
}
test/tools/javac/nativeHeaders/javahComparison/TestClass1.java
0 → 100644
浏览文件 @
71544570
/*
* 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
);
}
}
test/tools/javac/nativeHeaders/javahComparison/TestClass2.java
0 → 100644
浏览文件 @
71544570
/*
* 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
;
}
test/tools/javac/nativeHeaders/javahComparison/TestClass3.java
0 → 100644
浏览文件 @
71544570
/*
* 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录