jjg@1521: /* jjg@1521: * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. jjg@1521: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jjg@1521: * jjg@1521: * This code is free software; you can redistribute it and/or modify it jjg@1521: * under the terms of the GNU General Public License version 2 only, as jjg@1521: * published by the Free Software Foundation. jjg@1521: * jjg@1521: * This code is distributed in the hope that it will be useful, but WITHOUT jjg@1521: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jjg@1521: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jjg@1521: * version 2 for more details (a copy is included in the LICENSE file that jjg@1521: * accompanied this code). jjg@1521: * jjg@1521: * You should have received a copy of the GNU General Public License version jjg@1521: * 2 along with this work; if not, write to the Free Software Foundation, jjg@1521: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jjg@1521: * jjg@1521: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jjg@1521: * or visit www.oracle.com if you need additional information or have any jjg@1521: * questions. jjg@1521: */ jjg@1521: jjg@1521: import java.lang.annotation.*; jjg@1521: jjg@1521: /* jjg@1521: * @test jjg@1521: * @bug 6843077 8006775 jjg@1521: * @summary new type annotation location: receivers jjg@1521: * @author Mahmood Ali, Werner Dietl jjg@1521: * @compile Receivers.java jjg@1521: */ jjg@1521: class DefaultUnmodified { jjg@1521: void plain(@A DefaultUnmodified this) { } jjg@1521: void generic(@A DefaultUnmodified this) { } jjg@1521: void withException(@A DefaultUnmodified this) throws Exception { } jjg@1521: String nonVoid(@A DefaultUnmodified this) { return null; } jjg@1521: void accept(@A DefaultUnmodified this, T r) throws Exception { } jjg@1521: } jjg@1521: jjg@1521: class PublicModified { jjg@1521: public final void plain(@A PublicModified this) { } jjg@1521: public final void generic(@A PublicModified this) { } jjg@1521: public final void withException(@A PublicModified this) throws Exception { } jjg@1521: public final String nonVoid(@A PublicModified this) { return null; } jjg@1521: public final void accept(@A PublicModified this, T r) throws Exception { } jjg@1521: } jjg@1521: jjg@1521: class WithValue { jjg@1521: void plain(@B("m") WithValue this) { } jjg@1521: void generic(@B("m") WithValue this) { } jjg@1521: void withException(@B("m") WithValue this) throws Exception { } jjg@1521: String nonVoid(@B("m") WithValue this) { return null; } jjg@1521: void accept(@B("m") WithValue this, T r) throws Exception { } jjg@1521: } jjg@1521: jjg@1521: class WithFinal { jjg@1521: void plain(final @B("m") WithFinal this) { } jjg@1521: void generic(final @B("m") WithFinal this) { } jjg@1521: void withException(final @B("m") WithFinal this) throws Exception { } jjg@1521: String nonVoid(final @B("m") WithFinal this) { return null; } jjg@1521: void accept(final @B("m") WithFinal this, T r) throws Exception { } jjg@1521: } jjg@1521: jjg@1521: class WithBody { jjg@1521: Object f; jjg@1521: jjg@1521: void field(@A WithBody this) { jjg@1521: this.f = null; jjg@1521: } jjg@1521: void meth(@A WithBody this) { jjg@1521: this.toString(); jjg@1521: } jjg@1521: } jjg@1521: jjg@1521: class Generic1 { jjg@1521: void test1(Generic1 this) {} jjg@1521: void test2(@A Generic1 this) {} jjg@1521: void test3(Generic1<@A X> this) {} jjg@1521: void test4(@A Generic1<@A X> this) {} jjg@1521: } jjg@1521: jjg@1521: class Generic2<@A X> { jjg@1521: void test1(Generic2 this) {} jjg@1521: void test2(@A Generic2 this) {} jjg@1521: void test3(Generic2<@A X> this) {} jjg@1521: void test4(@A Generic2<@A X> this) {} jjg@1521: } jjg@1521: jjg@1521: class Generic3 { jjg@1521: void test1(Generic3 this) {} jjg@1521: void test2(@A Generic3 this) {} jjg@1521: void test3(Generic3<@A X> this) {} jjg@1521: void test4(@A Generic3<@A X> this) {} jjg@1521: } jjg@1521: jjg@1521: class Generic4 { jjg@1521: void test1(Generic4 this) {} jjg@1521: void test2(@A Generic4 this) {} jjg@1521: void test3(Generic4<@A X> this) {} jjg@1521: void test4(@A Generic4<@A X> this) {} jjg@1521: } jjg@1521: jjg@1521: class Outer { jjg@1521: class Inner { jjg@1521: void none(Outer.Inner this) {} jjg@1521: void outer(@A Outer.Inner this) {} jjg@1521: void inner(Outer. @B("i") Inner this) {} jjg@1521: void both(@A Outer.@B("i") Inner this) {} jjg@1521: jjg@1521: void innerOnlyNone(Inner this) {} jjg@1521: void innerOnly(@A Inner this) {} jjg@1521: } jjg@1521: } jjg@1521: jjg@1521: class GenericOuter { jjg@1521: class GenericInner { jjg@1521: void none(GenericOuter.GenericInner this) {} jjg@1521: void outer(@A GenericOuter.GenericInner this) {} jjg@1521: void inner(GenericOuter. @B("i") GenericInner this) {} jjg@1521: void both(@A GenericOuter.@B("i") GenericInner this) {} jjg@1521: jjg@1521: void innerOnlyNone(GenericInner this) {} jjg@1521: void innerOnly(@A GenericInner this) {} jjg@1521: } jjg@1521: } jjg@1521: jjg@1521: @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) jjg@1521: @interface A {} jjg@1521: @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) jjg@1521: @interface B { String value(); }