1.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/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,133 +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 - * @summary Test generation of annotations on inner class parameters. 1.30 - * @library /lib/annotations/ 1.31 - * @run main SyntheticParameters 1.32 - */ 1.33 - 1.34 -import annotations.classfile.ClassfileInspector; 1.35 - 1.36 -import java.io.*; 1.37 -import java.lang.annotation.*; 1.38 - 1.39 -import com.sun.tools.classfile.*; 1.40 - 1.41 -public class SyntheticParameters extends ClassfileInspector { 1.42 - 1.43 - private static final String Inner_class = "SyntheticParameters$Inner.class"; 1.44 - private static final String Foo_class = "SyntheticParameters$Foo.class"; 1.45 - private static final Expected Inner_expected = 1.46 - new Expected("SyntheticParameters$Inner", 1.47 - null, 1.48 - new ExpectedMethodTypeAnnotation[] { 1.49 - (ExpectedMethodTypeAnnotation) 1.50 - // Assert there is no annotation on the 1.51 - // this$0 parameter. 1.52 - new ExpectedMethodTypeAnnotation.Builder( 1.53 - "<init>", 1.54 - "A", 1.55 - TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER, 1.56 - false, 1.57 - 0).setParameterIndex(0).build(), 1.58 - (ExpectedMethodTypeAnnotation) 1.59 - // Assert there is an annotation on the 1.60 - // first parameter. 1.61 - new ExpectedMethodTypeAnnotation.Builder( 1.62 - "<init>", 1.63 - "A", 1.64 - TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER, 1.65 - false, 1.66 - 1).setParameterIndex(1).build(), 1.67 - (ExpectedMethodTypeAnnotation) 1.68 - new ExpectedMethodTypeAnnotation.Builder( 1.69 - "foo", 1.70 - "A", 1.71 - TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER, 1.72 - false, 1.73 - 1).setParameterIndex(0).build(), 1.74 - (ExpectedMethodTypeAnnotation) 1.75 - new ExpectedMethodTypeAnnotation.Builder( 1.76 - "foo", 1.77 - "A", 1.78 - TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER, 1.79 - false, 1.80 - 0).setParameterIndex(1).build() 1.81 - }, 1.82 - null); 1.83 - private static final Expected Foo_expected = 1.84 - new Expected("SyntheticParameters$Foo", 1.85 - null, 1.86 - new ExpectedMethodTypeAnnotation[] { 1.87 - (ExpectedMethodTypeAnnotation) 1.88 - // Assert there is no annotation on the 1.89 - // $enum$name parameter. 1.90 - new ExpectedMethodTypeAnnotation.Builder( 1.91 - "<init>", 1.92 - "A", 1.93 - TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER, 1.94 - false, 1.95 - 0).setParameterIndex(0).build(), 1.96 - (ExpectedMethodTypeAnnotation) 1.97 - // Assert there is no annotation on the 1.98 - // $enum$ordinal parameter. 1.99 - new ExpectedMethodTypeAnnotation.Builder( 1.100 - "<init>", 1.101 - "A", 1.102 - TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER, 1.103 - false, 1.104 - 0).setParameterIndex(1).build(), 1.105 - (ExpectedMethodTypeAnnotation) 1.106 - // Assert there is an annotation on the 1.107 - // first parameter. 1.108 - new ExpectedMethodTypeAnnotation.Builder( 1.109 - "<init>", 1.110 - "A", 1.111 - TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER, 1.112 - false, 1.113 - 1).setParameterIndex(2).build() 1.114 - }, 1.115 - null); 1.116 - 1.117 - public static void main(String... args) throws Exception { 1.118 - new SyntheticParameters().run( 1.119 - new ClassFile[] { getClassFile(Inner_class, Inner.class), 1.120 - getClassFile(Foo_class, Foo.class) }, 1.121 - new Expected[] { Inner_expected, Foo_expected }); 1.122 - } 1.123 - 1.124 - public class Inner { 1.125 - public Inner(@A int a) {} 1.126 - public void foo(@A int a, int b) {} 1.127 - } 1.128 - 1.129 - public static enum Foo { 1.130 - ONE(null); 1.131 - Foo(@A Object a) {} 1.132 - } 1.133 -} 1.134 - 1.135 -@Target({ElementType.TYPE_USE}) 1.136 -@interface A {}