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

Wed, 27 Apr 2016 01:34:52 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:34:52 +0800
changeset 0
959103a6100f
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17

     1 /*
     2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  */
    24 import java.util.*;
    26 @interface ExpectInterfaces {
    27     String value();
    28 }
    30 @interface ExpectSupertype {
    31     String value();
    32 }
    34 interface OK {
    35     void m();
    36 }
    38 class InvalidSource {
    39     /*
    40      * The following annotations contain a simple description of the expected
    41      * representation of the superclass and superinterfaces of the corresponding
    42      * elements.
    43      * The strings contain a comma-separated list of descriptions.
    44      * Descriptions are composed as follows:
    45      * A leading "!:" indicates the type mirror has kind ERROR.
    46      * "empty" means that the corresponding element has no enclosed elements.
    47      * "clss", "intf" and "tvar" indicate the name refers to a class, interface
    48      * or type variable. Each is followed by the declared name of the element.
    49      * "pkg" indicates the name of a package element.
    50      * An enclosing element is shown in parentheses.
    51      * A trailing "!" indicates that the element's type has kind ERROR.
    52      */
    54     @ExpectSupertype("!:empty clss A!")
    55     class TestClassMissingClassA extends A { }
    57     @ExpectSupertype("!:empty clss (pkg A).B!")
    58     class TestClassMissingClassAB extends A.B { }
    60     @ExpectSupertype("!:empty clss (pkg java.util).A!")
    61     class TestClassMissingClass_juA extends java.util.A { }
    63     @ExpectSupertype("!:empty clss A!<tvar T>")
    64     class TestClassTMissingClassAT<T> extends A<T> { }
    66     @ExpectInterfaces("!:empty intf A!")
    67     class TestClassMissingIntfA implements A { }
    69     @ExpectInterfaces("!:empty intf (pkg A).B!")
    70     class TestClassMissingIntfAB implements A.B { }
    72     @ExpectInterfaces("!:empty intf A!, intf OK")
    73     abstract class TestClassMissingIntfAOK implements A, OK { }
    75     @ExpectInterfaces("intf OK, !:empty intf A!")
    76     abstract class TestClassOKMissingIntfA implements OK, A { }
    78     @ExpectInterfaces("!:empty intf A!, !:empty intf B!")
    79     class TestClassMissingIntfA_B implements A, B { }
    81     @ExpectInterfaces("!:empty intf A!")
    82     interface TestIntfMissingIntfA extends A { }
    84     @ExpectInterfaces("!:empty intf A!, intf OK")
    85     interface TestIntfMissingIntfAOK extends A, OK { }
    87     @ExpectInterfaces("intf OK, !:empty intf A!")
    88     interface TestIntfOKMissingIntfA extends OK, A { }
    90     @ExpectInterfaces("!:empty intf A!, !:empty intf B!")
    91     interface TestIntfMissingIntfAB extends A, B { }
    93     @ExpectInterfaces("!:empty intf A!<tvar T>")
    94     class TestClassTMissingIntfAT<T> implements A<T> { }
    96     @ExpectInterfaces("!:empty intf A!<tvar T>, !:empty intf B!")
    97     class TestClassTMissingIntfAT_B<T> implements A<T>, B { }
    99     @ExpectInterfaces("!:empty intf A!<tvar T>")
   100     interface TestIntfTMissingIntfAT<T> extends A<T> { }
   102     @ExpectInterfaces("!:empty intf A!<tvar T>, !:empty intf B!")
   103     interface TestIntfTMissingIntfAT_B<T> extends A<T>, B { }
   105     @ExpectInterfaces("intf (pkg java.util).List<!:empty clss X!>")
   106     abstract class TestClassListMissingX implements List<X> { }
   107 }

mercurial