Sat, 13 Apr 2013 12:25:44 +0100
8010659: Javac Crashes while building OpenJFX
Reviewed-by: jjg
Contributed-by: maurizio.cimadamore@oracle.com
jjg@1521 | 1 | /* |
jjg@1521 | 2 | * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. |
jjg@1521 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@1521 | 4 | * |
jjg@1521 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@1521 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@1521 | 7 | * published by the Free Software Foundation. |
jjg@1521 | 8 | * |
jjg@1521 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@1521 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@1521 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@1521 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@1521 | 13 | * accompanied this code). |
jjg@1521 | 14 | * |
jjg@1521 | 15 | * You should have received a copy of the GNU General Public License version |
jjg@1521 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@1521 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@1521 | 18 | * |
jjg@1521 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
jjg@1521 | 20 | * or visit www.oracle.com if you need additional information or have any |
jjg@1521 | 21 | * questions. |
jjg@1521 | 22 | */ |
jjg@1521 | 23 | |
jjg@1521 | 24 | import java.lang.annotation.*; |
jjg@1521 | 25 | |
jjg@1521 | 26 | /* |
jjg@1521 | 27 | * @test |
jjg@1521 | 28 | * @bug 6843077 8006775 |
jjg@1521 | 29 | * @summary new type annotation location: receivers |
jjg@1521 | 30 | * @author Mahmood Ali, Werner Dietl |
jjg@1521 | 31 | * @compile Receivers.java |
jjg@1521 | 32 | */ |
jjg@1521 | 33 | class DefaultUnmodified { |
jjg@1521 | 34 | void plain(@A DefaultUnmodified this) { } |
jjg@1521 | 35 | <T> void generic(@A DefaultUnmodified this) { } |
jjg@1521 | 36 | void withException(@A DefaultUnmodified this) throws Exception { } |
jjg@1521 | 37 | String nonVoid(@A DefaultUnmodified this) { return null; } |
jjg@1521 | 38 | <T extends Runnable> void accept(@A DefaultUnmodified this, T r) throws Exception { } |
jjg@1521 | 39 | } |
jjg@1521 | 40 | |
jjg@1521 | 41 | class PublicModified { |
jjg@1521 | 42 | public final void plain(@A PublicModified this) { } |
jjg@1521 | 43 | public final <T> void generic(@A PublicModified this) { } |
jjg@1521 | 44 | public final void withException(@A PublicModified this) throws Exception { } |
jjg@1521 | 45 | public final String nonVoid(@A PublicModified this) { return null; } |
jjg@1521 | 46 | public final <T extends Runnable> void accept(@A PublicModified this, T r) throws Exception { } |
jjg@1521 | 47 | } |
jjg@1521 | 48 | |
jjg@1521 | 49 | class WithValue { |
jjg@1521 | 50 | void plain(@B("m") WithValue this) { } |
jjg@1521 | 51 | <T> void generic(@B("m") WithValue this) { } |
jjg@1521 | 52 | void withException(@B("m") WithValue this) throws Exception { } |
jjg@1521 | 53 | String nonVoid(@B("m") WithValue this) { return null; } |
jjg@1521 | 54 | <T extends Runnable> void accept(@B("m") WithValue this, T r) throws Exception { } |
jjg@1521 | 55 | } |
jjg@1521 | 56 | |
jjg@1521 | 57 | class WithFinal { |
jjg@1521 | 58 | void plain(final @B("m") WithFinal this) { } |
jjg@1521 | 59 | <T> void generic(final @B("m") WithFinal this) { } |
jjg@1521 | 60 | void withException(final @B("m") WithFinal this) throws Exception { } |
jjg@1521 | 61 | String nonVoid(final @B("m") WithFinal this) { return null; } |
jjg@1521 | 62 | <T extends Runnable> void accept(final @B("m") WithFinal this, T r) throws Exception { } |
jjg@1521 | 63 | } |
jjg@1521 | 64 | |
jjg@1521 | 65 | class WithBody { |
jjg@1521 | 66 | Object f; |
jjg@1521 | 67 | |
jjg@1521 | 68 | void field(@A WithBody this) { |
jjg@1521 | 69 | this.f = null; |
jjg@1521 | 70 | } |
jjg@1521 | 71 | void meth(@A WithBody this) { |
jjg@1521 | 72 | this.toString(); |
jjg@1521 | 73 | } |
jjg@1521 | 74 | } |
jjg@1521 | 75 | |
jjg@1521 | 76 | class Generic1<X> { |
jjg@1521 | 77 | void test1(Generic1<X> this) {} |
jjg@1521 | 78 | void test2(@A Generic1<X> this) {} |
jjg@1521 | 79 | void test3(Generic1<@A X> this) {} |
jjg@1521 | 80 | void test4(@A Generic1<@A X> this) {} |
jjg@1521 | 81 | } |
jjg@1521 | 82 | |
jjg@1521 | 83 | class Generic2<@A X> { |
jjg@1521 | 84 | void test1(Generic2<X> this) {} |
jjg@1521 | 85 | void test2(@A Generic2<X> this) {} |
jjg@1521 | 86 | void test3(Generic2<@A X> this) {} |
jjg@1521 | 87 | void test4(@A Generic2<@A X> this) {} |
jjg@1521 | 88 | } |
jjg@1521 | 89 | |
jjg@1521 | 90 | class Generic3<X extends @A Object> { |
jjg@1521 | 91 | void test1(Generic3<X> this) {} |
jjg@1521 | 92 | void test2(@A Generic3<X> this) {} |
jjg@1521 | 93 | void test3(Generic3<@A X> this) {} |
jjg@1521 | 94 | void test4(@A Generic3<@A X> this) {} |
jjg@1521 | 95 | } |
jjg@1521 | 96 | |
jjg@1521 | 97 | class Generic4<X extends @A Object> { |
jjg@1521 | 98 | <Y> void test1(Generic4<X> this) {} |
jjg@1521 | 99 | <Y> void test2(@A Generic4<X> this) {} |
jjg@1521 | 100 | <Y> void test3(Generic4<@A X> this) {} |
jjg@1521 | 101 | <Y> void test4(@A Generic4<@A X> this) {} |
jjg@1521 | 102 | } |
jjg@1521 | 103 | |
jjg@1521 | 104 | class Outer { |
jjg@1521 | 105 | class Inner { |
jjg@1521 | 106 | void none(Outer.Inner this) {} |
jjg@1521 | 107 | void outer(@A Outer.Inner this) {} |
jjg@1521 | 108 | void inner(Outer. @B("i") Inner this) {} |
jjg@1521 | 109 | void both(@A Outer.@B("i") Inner this) {} |
jjg@1521 | 110 | |
jjg@1521 | 111 | void innerOnlyNone(Inner this) {} |
jjg@1521 | 112 | void innerOnly(@A Inner this) {} |
jjg@1521 | 113 | } |
jjg@1521 | 114 | } |
jjg@1521 | 115 | |
jjg@1521 | 116 | class GenericOuter<S, T> { |
jjg@1521 | 117 | class GenericInner<U, V> { |
jjg@1521 | 118 | void none(GenericOuter<S, T>.GenericInner<U, V> this) {} |
jjg@1521 | 119 | void outer(@A GenericOuter<S, T>.GenericInner<U, V> this) {} |
jjg@1521 | 120 | void inner(GenericOuter<S, T>. @B("i") GenericInner<U, V> this) {} |
jjg@1521 | 121 | void both(@A GenericOuter<S, T>.@B("i") GenericInner<U, V> this) {} |
jjg@1521 | 122 | |
jjg@1521 | 123 | void innerOnlyNone(GenericInner<U, V> this) {} |
jjg@1521 | 124 | void innerOnly(@A GenericInner<U, V> this) {} |
jjg@1521 | 125 | } |
jjg@1521 | 126 | } |
jjg@1521 | 127 | |
jjg@1521 | 128 | @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) |
jjg@1521 | 129 | @interface A {} |
jjg@1521 | 130 | @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) |
jjg@1521 | 131 | @interface B { String value(); } |