T8008769.java revision 2942:08092deced3f
1132242Stjr/* 2132242Stjr * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. 3132242Stjr * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4132242Stjr * 5227753Stheraven * This code is free software; you can redistribute it and/or modify it 6227753Stheraven * under the terms of the GNU General Public License version 2 only, as 7227753Stheraven * published by the Free Software Foundation. 8227753Stheraven * 9227753Stheraven * This code is distributed in the hope that it will be useful, but WITHOUT 10132242Stjr * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11132242Stjr * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12132242Stjr * version 2 for more details (a copy is included in the LICENSE file that 13132242Stjr * accompanied this code). 14132242Stjr * 15132242Stjr * You should have received a copy of the GNU General Public License version 16132242Stjr * 2 along with this work; if not, write to the Free Software Foundation, 17132242Stjr * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18132242Stjr * 19132242Stjr * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20132242Stjr * or visit www.oracle.com if you need additional information or have any 21132242Stjr * questions. 22132242Stjr */ 23132242Stjr/* 24132242Stjr * @test 25132242Stjr * @summary Repeated type-annotations on type parm of local variable 26132242Stjr * are not written to classfile. 27132242Stjr * @bug 8008769 28132242Stjr * @modules jdk.jdeps/com.sun.tools.classfile 29132242Stjr */ 30132242Stjrimport java.lang.annotation.*; 31132242Stjrimport static java.lang.annotation.RetentionPolicy.*; 32132242Stjrimport static java.lang.annotation.ElementType.*; 33132242Stjrimport com.sun.tools.classfile.*; 34132242Stjr 35132242Stjrpublic class T8008769 extends ClassfileTestHelper{ 36132242Stjr public static void main(String[] args) throws Exception { 37132242Stjr new T8008769().run(); 38132242Stjr } 39132242Stjr 40132242Stjr public void run() throws Exception { 41227753Stheraven expected_tvisibles = 4; 42132242Stjr ClassFile cf = getClassFile("T8008769$Test.class"); 43132242Stjr for (Method m : cf.methods) { 44227753Stheraven test(cf, m, true); 45132242Stjr } 46132242Stjr countAnnotations(); 47132242Stjr 48227753Stheraven if (errors > 0) 49132242Stjr throw new Exception(errors + " errors found"); 50132242Stjr System.out.println("PASSED"); 51132242Stjr } 52132242Stjr 53132242Stjr /*********************** Test class *************************/ 54227753Stheraven static class Test<T> { 55132242Stjr public void test() { 56132242Stjr Test<@A @B String> t0 = new Test<>(); // 2 ok 57132242Stjr Test<@B @B String> t1 = new Test<>(); // 1 missing 58132242Stjr Test<@A @A @A String> t2 = new Test<>(); // 1 missing 59133223Stjr } 60132242Stjr } 61132242Stjr @Retention(RUNTIME) @Target(TYPE_USE) @Repeatable( AC.class ) @interface A { } 62132242Stjr @Retention(RUNTIME) @Target(TYPE_USE) @Repeatable( BC.class ) @interface B { } 63132242Stjr @Retention(RUNTIME) @Target(TYPE_USE) @interface AC { A[] value(); } 64132242Stjr @Retention(RUNTIME) @Target(TYPE_USE) @interface BC { B[] value(); } 65132242Stjr} 66132242Stjr