author | cushon |
Tue, 19 Dec 2017 16:24:25 -0500 | |
changeset 48344 | 89f6aa26fd6c |
permissions | -rw-r--r-- |
48344
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
1 |
/* |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
2 |
* Copyright 2017 Google Inc. All Rights Reserved. |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
4 |
* |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
8 |
* |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
13 |
* accompanied this code). |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
14 |
* |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
18 |
* |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
21 |
* questions. |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
22 |
*/ |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
23 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
24 |
/* |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
25 |
* @test |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
26 |
* @bug 8007720 8177486 |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
27 |
* @summary class reading of named parameters |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
28 |
* @library /tools/javac/lib |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
29 |
* @modules java.compiler |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
30 |
* jdk.compiler |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
31 |
* @compile -parameters ClassReaderTest.java MethodParameterProcessor.java |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
32 |
* @compile/process/ref=ClassReaderTest.out -proc:only -processor MethodParameterProcessor ClassReaderTest ClassReaderTest$I ClassReaderTest$E |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
33 |
*/ |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
34 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
35 |
import static java.lang.annotation.RetentionPolicy.CLASS; |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
36 |
import static java.lang.annotation.RetentionPolicy.RUNTIME; |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
37 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
38 |
import java.lang.annotation.Retention; |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
39 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
40 |
public class ClassReaderTest { |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
41 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
42 |
@Retention(RUNTIME) |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
43 |
@interface RuntimeAnnoOne { |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
44 |
int value() default 0; |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
45 |
} |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
46 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
47 |
@Retention(RUNTIME) |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
48 |
@interface RuntimeAnnoTwo { |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
49 |
int value() default 0; |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
50 |
} |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
51 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
52 |
@Retention(CLASS) |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
53 |
@interface ClassAnno { |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
54 |
int value() default 0; |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
55 |
} |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
56 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
57 |
@MethodParameterProcessor.ParameterNames |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
58 |
void f( |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
59 |
@RuntimeAnnoOne(1) @RuntimeAnnoTwo(2) @ClassAnno(3) int a, |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
60 |
@RuntimeAnnoOne(4) @RuntimeAnnoTwo(5) @ClassAnno(6) String b) {} |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
61 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
62 |
class I { |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
63 |
@MethodParameterProcessor.ParameterNames |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
64 |
I(@ClassAnno(7) int d, @RuntimeAnnoOne(8) String e, Object o) {} |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
65 |
} |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
66 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
67 |
enum E { |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
68 |
ONE(42, ""); |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
69 |
|
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
70 |
@MethodParameterProcessor.ParameterNames |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
71 |
E(int x, @RuntimeAnnoOne(9) String s) {} |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
72 |
} |
89f6aa26fd6c
8007720: Names are not loaded correctly for method parameters if the parameters have annotations
cushon
parents:
diff
changeset
|
73 |
} |