mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8000407: remove @GenerateNativeHeader
Reviewed-by: vromero, darcy
This commit is contained in:
parent
ce05f1c8ec
commit
cb5ef8cc5c
7 changed files with 4 additions and 173 deletions
|
@ -131,7 +131,6 @@ public class Symtab {
|
||||||
public final Type methodHandleLookupType;
|
public final Type methodHandleLookupType;
|
||||||
public final Type methodTypeType;
|
public final Type methodTypeType;
|
||||||
public final Type nativeHeaderType;
|
public final Type nativeHeaderType;
|
||||||
public final Type nativeHeaderType_old;
|
|
||||||
public final Type throwableType;
|
public final Type throwableType;
|
||||||
public final Type errorType;
|
public final Type errorType;
|
||||||
public final Type interruptedExceptionType;
|
public final Type interruptedExceptionType;
|
||||||
|
@ -526,7 +525,6 @@ public class Symtab {
|
||||||
autoCloseableType.tsym);
|
autoCloseableType.tsym);
|
||||||
trustMeType = enterClass("java.lang.SafeVarargs");
|
trustMeType = enterClass("java.lang.SafeVarargs");
|
||||||
nativeHeaderType = enterClass("java.lang.annotation.Native");
|
nativeHeaderType = enterClass("java.lang.annotation.Native");
|
||||||
nativeHeaderType_old = enterClass("javax.tools.annotation.GenerateNativeHeader");
|
|
||||||
lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
|
lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
|
||||||
functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
|
functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
|
||||||
|
|
||||||
|
|
|
@ -157,13 +157,6 @@ public class JNIWriter {
|
||||||
if (c.isLocal() || (c.flags() & Flags.SYNTHETIC) != 0)
|
if (c.isLocal() || (c.flags() & Flags.SYNTHETIC) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* temporary code for backwards compatibility */
|
|
||||||
for (Attribute.Compound a: c.annotations.getDeclarationAttributes()) {
|
|
||||||
if (a.type.tsym == syms.nativeHeaderType_old.tsym)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/* end of temporary code for backwards compatibility */
|
|
||||||
|
|
||||||
for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
|
for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
|
||||||
if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0)
|
if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 {
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 7150368 8003412
|
* @bug 7150368 8003412 8000407
|
||||||
* @summary javac should include basic ability to generate native headers
|
* @summary javac should include basic ability to generate native headers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -124,17 +124,6 @@ public class NativeHeaderTest {
|
||||||
createSet(classesDir.list()));
|
createSet(classesDir.list()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void oldAnnoTest(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
|
@Test
|
||||||
void annoTest(RunKind rk, GenKind gk) throws Exception {
|
void annoTest(RunKind rk, GenKind gk) throws Exception {
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
|
@ -146,18 +135,6 @@ public class NativeHeaderTest {
|
||||||
test(rk, gk, files, expect);
|
test(rk, gk, files, expect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void oldAnnoNestedClassTest(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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void annoNestedClassTest(RunKind rk, GenKind gk) throws Exception {
|
void annoNestedClassTest(RunKind rk, GenKind gk) throws Exception {
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 7150368 8003412
|
* @bug 7150368 8003412 8000407
|
||||||
* @summary javac should include basic ability to generate native headers
|
* @summary javac should include basic ability to generate native headers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue