1.1 --- a/test/tools/javac/annotations/SyntheticParameters.java Wed Dec 10 14:35:58 2014 -0800 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,198 +0,0 @@ 1.4 -/* 1.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 1.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 - * 1.8 - * This code is free software; you can redistribute it and/or modify it 1.9 - * under the terms of the GNU General Public License version 2 only, as 1.10 - * published by the Free Software Foundation. 1.11 - * 1.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 - * version 2 for more details (a copy is included in the LICENSE file that 1.16 - * accompanied this code). 1.17 - * 1.18 - * You should have received a copy of the GNU General Public License version 1.19 - * 2 along with this work; if not, write to the Free Software Foundation, 1.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 - * 1.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 - * or visit www.oracle.com if you need additional information or have any 1.24 - * questions. 1.25 - */ 1.26 - 1.27 -/* 1.28 - * @test SyntheticParameters 1.29 - * @bug 8065132 1.30 - * @summary Test generation of annotations on inner class parameters. 1.31 - * @library /lib/annotations/ 1.32 - * @run main SyntheticParameters 1.33 - */ 1.34 - 1.35 -import annotations.classfile.ClassfileInspector; 1.36 - 1.37 -import java.io.*; 1.38 -import java.lang.annotation.*; 1.39 - 1.40 -import com.sun.tools.classfile.*; 1.41 - 1.42 -public class SyntheticParameters extends ClassfileInspector { 1.43 - 1.44 - private static final String Inner_class = "SyntheticParameters$Inner.class"; 1.45 - private static final String Foo_class = "SyntheticParameters$Foo.class"; 1.46 - private static final Expected Inner_expected = 1.47 - new Expected("SyntheticParameters$Inner", 1.48 - null, 1.49 - null, 1.50 - new ExpectedParameterAnnotation[] { 1.51 - (ExpectedParameterAnnotation) 1.52 - // Assert there is no annotation on the 1.53 - // this$0 parameter. 1.54 - new ExpectedParameterAnnotation( 1.55 - "<init>", 1.56 - 0, 1.57 - "A", 1.58 - true, 1.59 - 0), 1.60 - (ExpectedParameterAnnotation) 1.61 - // Assert there is an annotation on the 1.62 - // first parameter. 1.63 - new ExpectedParameterAnnotation( 1.64 - "<init>", 1.65 - 1, 1.66 - "A", 1.67 - true, 1.68 - 1), 1.69 - (ExpectedParameterAnnotation) 1.70 - new ExpectedParameterAnnotation( 1.71 - "foo", 1.72 - 0, 1.73 - "A", 1.74 - true, 1.75 - 1), 1.76 - (ExpectedParameterAnnotation) 1.77 - new ExpectedParameterAnnotation( 1.78 - "foo", 1.79 - 1, 1.80 - "A", 1.81 - true, 1.82 - 0), 1.83 - (ExpectedParameterAnnotation) 1.84 - // Assert there is no annotation on the 1.85 - // this$0 parameter. 1.86 - new ExpectedParameterAnnotation( 1.87 - "<init>", 1.88 - 0, 1.89 - "B", 1.90 - false, 1.91 - 0), 1.92 - (ExpectedParameterAnnotation) 1.93 - // Assert there is an annotation on the 1.94 - // first parameter. 1.95 - new ExpectedParameterAnnotation( 1.96 - "<init>", 1.97 - 1, 1.98 - "B", 1.99 - false, 1.100 - 1), 1.101 - (ExpectedParameterAnnotation) 1.102 - new ExpectedParameterAnnotation( 1.103 - "foo", 1.104 - 0, 1.105 - "B", 1.106 - false, 1.107 - 1), 1.108 - (ExpectedParameterAnnotation) 1.109 - new ExpectedParameterAnnotation( 1.110 - "foo", 1.111 - 1, 1.112 - "B", 1.113 - false, 1.114 - 0) 1.115 - }, 1.116 - null); 1.117 - private static final Expected Foo_expected = 1.118 - new Expected("SyntheticParameters$Foo", 1.119 - null, 1.120 - null, 1.121 - new ExpectedParameterAnnotation[] { 1.122 - (ExpectedParameterAnnotation) 1.123 - // Assert there is no annotation on the 1.124 - // $enum$name parameter. 1.125 - new ExpectedParameterAnnotation( 1.126 - "<init>", 1.127 - 0, 1.128 - "A", 1.129 - true, 1.130 - 0), 1.131 - (ExpectedParameterAnnotation) 1.132 - // Assert there is no annotation on the 1.133 - // $enum$ordinal parameter. 1.134 - new ExpectedParameterAnnotation( 1.135 - "<init>", 1.136 - 1, 1.137 - "A", 1.138 - true, 1.139 - 0), 1.140 - (ExpectedParameterAnnotation) 1.141 - // Assert there is an annotation on the 1.142 - // first parameter. 1.143 - new ExpectedParameterAnnotation( 1.144 - "<init>", 1.145 - 2, 1.146 - "A", 1.147 - true, 1.148 - 1), 1.149 - (ExpectedParameterAnnotation) 1.150 - // Assert there is no annotation on the 1.151 - // $enum$name parameter. 1.152 - new ExpectedParameterAnnotation( 1.153 - "<init>", 1.154 - 0, 1.155 - "B", 1.156 - false, 1.157 - 0), 1.158 - (ExpectedParameterAnnotation) 1.159 - // Assert there is no annotation on the 1.160 - // $enum$ordinal parameter. 1.161 - new ExpectedParameterAnnotation( 1.162 - "<init>", 1.163 - 1, 1.164 - "B", 1.165 - false, 1.166 - 0), 1.167 - (ExpectedParameterAnnotation) 1.168 - // Assert there is an annotation on the 1.169 - // first parameter. 1.170 - new ExpectedParameterAnnotation( 1.171 - "<init>", 1.172 - 2, 1.173 - "B", 1.174 - false, 1.175 - 1) 1.176 - }, 1.177 - null); 1.178 - 1.179 - public static void main(String... args) throws Exception { 1.180 - new SyntheticParameters().run( 1.181 - new ClassFile[] { getClassFile(Inner_class, Inner.class), 1.182 - getClassFile(Foo_class, Foo.class) }, 1.183 - new Expected[] { Inner_expected, Foo_expected }); 1.184 - } 1.185 - 1.186 - public class Inner { 1.187 - public Inner(@A @B int a) {} 1.188 - public void foo(@A @B int a, int b) {} 1.189 - } 1.190 - 1.191 - public static enum Foo { 1.192 - ONE(null); 1.193 - Foo(@A @B Object a) {} 1.194 - } 1.195 -} 1.196 - 1.197 -@Retention(RetentionPolicy.RUNTIME) 1.198 -@interface A {} 1.199 - 1.200 -@Retention(RetentionPolicy.CLASS) 1.201 -@interface B {}