8000407: remove @GenerateNativeHeader
authorjjg
Fri, 03 May 2013 15:08:47 -0700
changeset 17546 06bbe5f5a2b8
parent 17545 bfd4d1aa16ae
child 17547 40f2f9a5a445
8000407: remove @GenerateNativeHeader Reviewed-by: vromero, darcy
langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java
langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java
langtools/src/share/classes/javax/tools/annotation/GenerateNativeHeader.java
langtools/test/tools/javac/nativeHeaders/NativeHeaderTest.java
langtools/test/tools/javac/nativeHeaders/javahComparison/CompareTest.java
langtools/test/tools/javac/nativeHeaders/javahComparison/TestClass2.java
langtools/test/tools/javac/nativeHeaders/javahComparison/TestClass3.java
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Fri May 03 10:17:12 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Fri May 03 15:08:47 2013 -0700
@@ -131,7 +131,6 @@
     public final Type methodHandleLookupType;
     public final Type methodTypeType;
     public final Type nativeHeaderType;
-    public final Type nativeHeaderType_old;
     public final Type throwableType;
     public final Type errorType;
     public final Type interruptedExceptionType;
@@ -526,7 +525,6 @@
                              autoCloseableType.tsym);
         trustMeType = enterClass("java.lang.SafeVarargs");
         nativeHeaderType = enterClass("java.lang.annotation.Native");
-        nativeHeaderType_old = enterClass("javax.tools.annotation.GenerateNativeHeader");
         lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
         functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
 
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Fri May 03 10:17:12 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Fri May 03 15:08:47 2013 -0700
@@ -157,13 +157,6 @@
         if (c.isLocal() || (c.flags() & Flags.SYNTHETIC) != 0)
             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) {
             if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0)
                 return true;
--- a/langtools/src/share/classes/javax/tools/annotation/GenerateNativeHeader.java	Fri May 03 10:17:12 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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 {
-}
--- a/langtools/test/tools/javac/nativeHeaders/NativeHeaderTest.java	Fri May 03 10:17:12 2013 -0700
+++ b/langtools/test/tools/javac/nativeHeaders/NativeHeaderTest.java	Fri May 03 15:08:47 2013 -0700
@@ -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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7150368 8003412
+ * @bug 7150368 8003412 8000407
  * @summary javac should include basic ability to generate native headers
  */
 
@@ -125,17 +125,6 @@
     }
 
     @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
     void annoTest(RunKind rk, GenKind gk) throws Exception {
         List<File> files = new ArrayList<File>();
         files.add(createFile("p/C.java",
@@ -147,18 +136,6 @@
     }
 
     @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
     void annoNestedClassTest(RunKind rk, GenKind gk) throws Exception {
         List<File> files = new ArrayList<File>();
         files.add(createFile("p/C.java",
--- a/langtools/test/tools/javac/nativeHeaders/javahComparison/CompareTest.java	Fri May 03 10:17:12 2013 -0700
+++ b/langtools/test/tools/javac/nativeHeaders/javahComparison/CompareTest.java	Fri May 03 15:08:47 2013 -0700
@@ -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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7150368 8003412
+ * @bug 7150368 8003412 8000407
  * @summary javac should include basic ability to generate native headers
  */
 
--- a/langtools/test/tools/javac/nativeHeaders/javahComparison/TestClass2.java	Fri May 03 10:17:12 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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;
-}
--- a/langtools/test/tools/javac/nativeHeaders/javahComparison/TestClass3.java	Fri May 03 10:17:12 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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;
-        }
-    }
-}
-