Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/test/tools/javah/6257087/T6257087.java
38813 views
/*1* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 625708726* @summary javah doesn't produce proper signatures for inner class native methods27* @library /tools/javac/lib28* @build ToolBox29* @run main T625708730*/3132import java.nio.file.Paths;3334public class T6257087 {3536private static final String fooBarGoldenFile =37"/* DO NOT EDIT THIS FILE - it is machine generated */\n" +38"#include <jni.h>\n" +39"/* Header for class foo_bar */\n" +40"\n" +41"#ifndef _Included_foo_bar\n" +42"#define _Included_foo_bar\n" +43"#ifdef __cplusplus\n" +44"extern \"C\" {\n" +45"#endif\n" +46"/*\n" +47" * Class: foo_bar\n" +48" * Method: aardvark\n" +49" * Signature: ()V\n" +50" */\n" +51"JNIEXPORT void JNICALL Java_foo_00024bar_aardvark\n" +52" (JNIEnv *, jobject);\n" +53"\n" +54"#ifdef __cplusplus\n" +55"}\n" +56"#endif\n" +57"#endif";5859public static void main(String[] args) throws Exception {60ToolBox.JavaToolArgs javahArgs =61new ToolBox.JavaToolArgs()62.setAllArgs("-cp", System.getProperty("test.classes"), "foo");63ToolBox.javah(javahArgs);6465ToolBox.compareLines(Paths.get("foo_bar.h"),66ToolBox.splitLines(fooBarGoldenFile, "\n"), null, true);67}6869}7071class foo {72class bar {73public native void aardvark();74}75}767778