test/tools/javac/processing/model/element/TestMissingElement/InvalidSource.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/processing/model/element/TestMissingElement/InvalidSource.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,108 @@
     1.4 +/*
     1.5 + * Copyright (c) 2011, 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 +import java.util.*;
    1.28 +
    1.29 +@interface ExpectInterfaces {
    1.30 +    String value();
    1.31 +}
    1.32 +
    1.33 +@interface ExpectSupertype {
    1.34 +    String value();
    1.35 +}
    1.36 +
    1.37 +interface OK {
    1.38 +    void m();
    1.39 +}
    1.40 +
    1.41 +class InvalidSource {
    1.42 +    /*
    1.43 +     * The following annotations contain a simple description of the expected
    1.44 +     * representation of the superclass and superinterfaces of the corresponding
    1.45 +     * elements.
    1.46 +     * The strings contain a comma-separated list of descriptions.
    1.47 +     * Descriptions are composed as follows:
    1.48 +     * A leading "!:" indicates the type mirror has kind ERROR.
    1.49 +     * "empty" means that the corresponding element has no enclosed elements.
    1.50 +     * "clss", "intf" and "tvar" indicate the name refers to a class, interface
    1.51 +     * or type variable. Each is followed by the declared name of the element.
    1.52 +     * "pkg" indicates the name of a package element.
    1.53 +     * An enclosing element is shown in parentheses.
    1.54 +     * A trailing "!" indicates that the element's type has kind ERROR.
    1.55 +     */
    1.56 +
    1.57 +    @ExpectSupertype("!:empty clss A!")
    1.58 +    class TestClassMissingClassA extends A { }
    1.59 +
    1.60 +    @ExpectSupertype("!:empty clss (pkg A).B!")
    1.61 +    class TestClassMissingClassAB extends A.B { }
    1.62 +
    1.63 +    @ExpectSupertype("!:empty clss (pkg java.util).A!")
    1.64 +    class TestClassMissingClass_juA extends java.util.A { }
    1.65 +
    1.66 +    @ExpectSupertype("!:empty clss A!<tvar T>")
    1.67 +    class TestClassTMissingClassAT<T> extends A<T> { }
    1.68 +
    1.69 +    @ExpectInterfaces("!:empty intf A!")
    1.70 +    class TestClassMissingIntfA implements A { }
    1.71 +
    1.72 +    @ExpectInterfaces("!:empty intf (pkg A).B!")
    1.73 +    class TestClassMissingIntfAB implements A.B { }
    1.74 +
    1.75 +    @ExpectInterfaces("!:empty intf A!, intf OK")
    1.76 +    abstract class TestClassMissingIntfAOK implements A, OK { }
    1.77 +
    1.78 +    @ExpectInterfaces("intf OK, !:empty intf A!")
    1.79 +    abstract class TestClassOKMissingIntfA implements OK, A { }
    1.80 +
    1.81 +    @ExpectInterfaces("!:empty intf A!, !:empty intf B!")
    1.82 +    class TestClassMissingIntfA_B implements A, B { }
    1.83 +
    1.84 +    @ExpectInterfaces("!:empty intf A!")
    1.85 +    interface TestIntfMissingIntfA extends A { }
    1.86 +
    1.87 +    @ExpectInterfaces("!:empty intf A!, intf OK")
    1.88 +    interface TestIntfMissingIntfAOK extends A, OK { }
    1.89 +
    1.90 +    @ExpectInterfaces("intf OK, !:empty intf A!")
    1.91 +    interface TestIntfOKMissingIntfA extends OK, A { }
    1.92 +
    1.93 +    @ExpectInterfaces("!:empty intf A!, !:empty intf B!")
    1.94 +    interface TestIntfMissingIntfAB extends A, B { }
    1.95 +
    1.96 +    @ExpectInterfaces("!:empty intf A!<tvar T>")
    1.97 +    class TestClassTMissingIntfAT<T> implements A<T> { }
    1.98 +
    1.99 +    @ExpectInterfaces("!:empty intf A!<tvar T>, !:empty intf B!")
   1.100 +    class TestClassTMissingIntfAT_B<T> implements A<T>, B { }
   1.101 +
   1.102 +    @ExpectInterfaces("!:empty intf A!<tvar T>")
   1.103 +    interface TestIntfTMissingIntfAT<T> extends A<T> { }
   1.104 +
   1.105 +    @ExpectInterfaces("!:empty intf A!<tvar T>, !:empty intf B!")
   1.106 +    interface TestIntfTMissingIntfAT_B<T> extends A<T>, B { }
   1.107 +
   1.108 +    @ExpectInterfaces("intf (pkg java.util).List<!:empty clss X!>")
   1.109 +    abstract class TestClassListMissingX implements List<X> { }
   1.110 +}
   1.111 +

mercurial