Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/test/tools/javah/6257087/T6257087.java
38813 views
1
/*
2
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 6257087
27
* @summary javah doesn't produce proper signatures for inner class native methods
28
* @library /tools/javac/lib
29
* @build ToolBox
30
* @run main T6257087
31
*/
32
33
import java.nio.file.Paths;
34
35
public class T6257087 {
36
37
private static final String fooBarGoldenFile =
38
"/* DO NOT EDIT THIS FILE - it is machine generated */\n" +
39
"#include <jni.h>\n" +
40
"/* Header for class foo_bar */\n" +
41
"\n" +
42
"#ifndef _Included_foo_bar\n" +
43
"#define _Included_foo_bar\n" +
44
"#ifdef __cplusplus\n" +
45
"extern \"C\" {\n" +
46
"#endif\n" +
47
"/*\n" +
48
" * Class: foo_bar\n" +
49
" * Method: aardvark\n" +
50
" * Signature: ()V\n" +
51
" */\n" +
52
"JNIEXPORT void JNICALL Java_foo_00024bar_aardvark\n" +
53
" (JNIEnv *, jobject);\n" +
54
"\n" +
55
"#ifdef __cplusplus\n" +
56
"}\n" +
57
"#endif\n" +
58
"#endif";
59
60
public static void main(String[] args) throws Exception {
61
ToolBox.JavaToolArgs javahArgs =
62
new ToolBox.JavaToolArgs()
63
.setAllArgs("-cp", System.getProperty("test.classes"), "foo");
64
ToolBox.javah(javahArgs);
65
66
ToolBox.compareLines(Paths.get("foo_bar.h"),
67
ToolBox.splitLines(fooBarGoldenFile, "\n"), null, true);
68
}
69
70
}
71
72
class foo {
73
class bar {
74
public native void aardvark();
75
}
76
}
77
78