Tue, 06 Aug 2013 17:12:42 -0700
Merge
1.1 --- a/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java Tue Aug 06 17:01:50 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java Tue Aug 06 17:12:42 2013 -0700 1.3 @@ -172,8 +172,8 @@ 1.4 } 1.5 1.6 // So we have a containing type 1.7 - String annoTypeName = annoType.getSimpleName(); 1.8 - String containerTypeName = containerType.getSimpleName(); 1.9 + String annoTypeName = annoType.getName(); 1.10 + String containerTypeName = containerType.getName(); 1.11 int directIndex = -1, containerIndex = -1; 1.12 Attribute.Compound direct = null, container = null; 1.13 // Find directly (explicit or implicit) present annotations 1.14 @@ -303,8 +303,8 @@ 1.15 } 1.16 1.17 // So we have a containing type 1.18 - String annoTypeName = annoType.getSimpleName(); 1.19 - String containerTypeName = containerType.getSimpleName(); 1.20 + String annoTypeName = annoType.getName(); 1.21 + String containerTypeName = containerType.getName(); 1.22 int directIndex = -1, containerIndex = -1; 1.23 Attribute.Compound direct = null, container = null; 1.24 // Find directly (explicit or implicit) present annotations
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/tools/javac/processing/model/element/8009367/TestQualifiedNameUsed.java Tue Aug 06 17:12:42 2013 -0700 2.3 @@ -0,0 +1,82 @@ 2.4 +/* 2.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 + * 2.8 + * This code is free software; you can redistribute it and/or modify it 2.9 + * under the terms of the GNU General Public License version 2 only, as 2.10 + * published by the Free Software Foundation. 2.11 + * 2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.15 + * version 2 for more details (a copy is included in the LICENSE file that 2.16 + * accompanied this code). 2.17 + * 2.18 + * You should have received a copy of the GNU General Public License version 2.19 + * 2 along with this work; if not, write to the Free Software Foundation, 2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.21 + * 2.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.23 + * or visit www.oracle.com if you need additional information or have any 2.24 + * questions. 2.25 + */ 2.26 + 2.27 +/* 2.28 + * @test 2.29 + * @bug 8009367 2.30 + * @summary Test that the correct kind of names (binary) are used when comparing 2.31 + * Class and Symbol for repeatable Classes. 2.32 + * @library /tools/javac/lib 2.33 + * @build JavacTestingAbstractProcessor TestQualifiedNameUsed p.Q p.QQ p.R p.RR 2.34 + * @run compile -processor TestQualifiedNameUsed -proc:only TestQualifiedNameUsed.java 2.35 + */ 2.36 + 2.37 +import java.lang.annotation.Repeatable; 2.38 +import java.util.Set; 2.39 +import javax.annotation.processing.*; 2.40 +import javax.lang.model.element.*; 2.41 +import static javax.lang.model.util.ElementFilter.*; 2.42 + 2.43 +import com.sun.tools.javac.util.Assert; 2.44 + 2.45 +import java.util.Arrays; 2.46 + 2.47 +public class TestQualifiedNameUsed extends JavacTestingAbstractProcessor { 2.48 + @Q 2.49 + @p.Q 2.50 + @p.R.Q 2.51 + public boolean process(Set<? extends TypeElement> annotations, 2.52 + RoundEnvironment roundEnv) { 2.53 + if (!roundEnv.processingOver()) { 2.54 + boolean hasRun = false; 2.55 + for (Element element : roundEnv.getRootElements()) { 2.56 + for (ExecutableElement e : methodsIn(element.getEnclosedElements())) { 2.57 + if (e.getSimpleName().contentEquals("value")) 2.58 + continue; // don't want to look Q.value() in this file 2.59 + 2.60 + hasRun = true; 2.61 + Q[] qs = e.getAnnotationsByType(Q.class); 2.62 + Assert.check(qs.length == 1); 2.63 + Assert.check(qs[0] instanceof Q); 2.64 + 2.65 + p.Q[] ps = e.getAnnotationsByType(p.Q.class); 2.66 + Assert.check(ps.length == 1); 2.67 + Assert.check(ps[0] instanceof p.Q); 2.68 + 2.69 + p.R.Q[] rs = e.getAnnotationsByType(p.R.Q.class); 2.70 + Assert.check(rs.length == 1); 2.71 + Assert.check(rs[0] instanceof p.R.Q); 2.72 + } 2.73 + } 2.74 + if (!hasRun) throw new RuntimeException("No methods!"); 2.75 + } 2.76 + return true; 2.77 + } 2.78 +} 2.79 + 2.80 +@Repeatable(QQ.class) 2.81 +@interface Q {} 2.82 + 2.83 +@interface QQ { 2.84 + Q[] value(); 2.85 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/tools/javac/processing/model/element/8009367/p/Q.java Tue Aug 06 17:12:42 2013 -0700 3.3 @@ -0,0 +1,29 @@ 3.4 +/* 3.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. 3.11 + * 3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 + * version 2 for more details (a copy is included in the LICENSE file that 3.16 + * accompanied this code). 3.17 + * 3.18 + * You should have received a copy of the GNU General Public License version 3.19 + * 2 along with this work; if not, write to the Free Software Foundation, 3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 + * 3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 + * or visit www.oracle.com if you need additional information or have any 3.24 + * questions. 3.25 + */ 3.26 + 3.27 +package p; 3.28 + 3.29 +import java.lang.annotation.Repeatable; 3.30 + 3.31 +@Repeatable(QQ.class) 3.32 +public @interface Q {}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/tools/javac/processing/model/element/8009367/p/QQ.java Tue Aug 06 17:12:42 2013 -0700 4.3 @@ -0,0 +1,28 @@ 4.4 +/* 4.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + */ 4.26 + 4.27 +package p; 4.28 + 4.29 +public @interface QQ { 4.30 + Q[] value(); 4.31 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/test/tools/javac/processing/model/element/8009367/p/R.java Tue Aug 06 17:12:42 2013 -0700 5.3 @@ -0,0 +1,32 @@ 5.4 +/* 5.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 + * 5.8 + * This code is free software; you can redistribute it and/or modify it 5.9 + * under the terms of the GNU General Public License version 2 only, as 5.10 + * published by the Free Software Foundation. 5.11 + * 5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.15 + * version 2 for more details (a copy is included in the LICENSE file that 5.16 + * accompanied this code). 5.17 + * 5.18 + * You should have received a copy of the GNU General Public License version 5.19 + * 2 along with this work; if not, write to the Free Software Foundation, 5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.21 + * 5.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.23 + * or visit www.oracle.com if you need additional information or have any 5.24 + * questions. 5.25 + */ 5.26 + 5.27 +package p; 5.28 + 5.29 +import java.lang.annotation.Repeatable; 5.30 + 5.31 +public class R { 5.32 + 5.33 + @Repeatable(RR.class) 5.34 + public @interface Q {} 5.35 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/test/tools/javac/processing/model/element/8009367/p/RR.java Tue Aug 06 17:12:42 2013 -0700 6.3 @@ -0,0 +1,28 @@ 6.4 +/* 6.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.7 + * 6.8 + * This code is free software; you can redistribute it and/or modify it 6.9 + * under the terms of the GNU General Public License version 2 only, as 6.10 + * published by the Free Software Foundation. 6.11 + * 6.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 6.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.15 + * version 2 for more details (a copy is included in the LICENSE file that 6.16 + * accompanied this code). 6.17 + * 6.18 + * You should have received a copy of the GNU General Public License version 6.19 + * 2 along with this work; if not, write to the Free Software Foundation, 6.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.21 + * 6.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 6.23 + * or visit www.oracle.com if you need additional information or have any 6.24 + * questions. 6.25 + */ 6.26 + 6.27 +package p; 6.28 + 6.29 +public @interface RR { 6.30 + R.Q[] value(); 6.31 +}