test/tools/javap/classfile/6888367/T6888367.java

changeset 0
959103a6100f
child 2525
2eb010b6cb22
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javap/classfile/6888367/T6888367.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,511 @@
     1.4 +/*
     1.5 + * Copyright (c) 2009, 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.io.*;
    1.28 +import java.net.*;
    1.29 +import java.util.*;
    1.30 +import com.sun.tools.classfile.*;
    1.31 +import com.sun.tools.classfile.Type.ArrayType;
    1.32 +import com.sun.tools.classfile.Type.ClassSigType;
    1.33 +import com.sun.tools.classfile.Type.ClassType;
    1.34 +import com.sun.tools.classfile.Type.MethodType;
    1.35 +import com.sun.tools.classfile.Type.SimpleType;
    1.36 +import com.sun.tools.classfile.Type.TypeParamType;
    1.37 +import com.sun.tools.classfile.Type.WildcardType;
    1.38 +
    1.39 +/*
    1.40 + * @test
    1.41 + * @bug 6888367
    1.42 + * @summary classfile library parses signature attributes incorrectly
    1.43 + */
    1.44 +
    1.45 +/*
    1.46 + * This test is a pretty detailed test both of javac signature generation and classfile
    1.47 + * signature parsing.  The first part of the test tests all the examples given in the
    1.48 + * second part of the test. Each example comes with one or two annotations, @Desc, @Sig,
    1.49 + * for the descriptor and signature of the annotated declaration.  Annotations are
    1.50 + * provided whenever the annotated item is expected to have a corresponding value.
    1.51 + * Each annotation has two argument values.  The first arg is the expected value of the
    1.52 + * descriptor/signature as found in the class file.  This value is mostly for documentation
    1.53 + * purposes in reading the test.  The second value is the rendering of the descriptor or
    1.54 + * signature using a custom Type visitor that explicitly includes an indication of the
    1.55 + * Type classes being used to represent the  descriptor/signature.  Thus we test
    1.56 + * that the descriptor/signature is being parsed into the expected type tree structure.
    1.57 + */
    1.58 +public class T6888367 {
    1.59 +
    1.60 +    public static void main(String... args) throws Exception {
    1.61 +        new T6888367().run();
    1.62 +    }
    1.63 +
    1.64 +    public void run() throws Exception {
    1.65 +        ClassFile cf = getClassFile("Test");
    1.66 +
    1.67 +        testFields(cf);
    1.68 +        testMethods(cf);
    1.69 +        testInnerClasses(cf); // recursive
    1.70 +
    1.71 +        if (errors > 0)
    1.72 +            throw new Exception(errors + " errors found");
    1.73 +    }
    1.74 +
    1.75 +    void testFields(ClassFile cf) throws Exception {
    1.76 +        String cn = cf.getName();
    1.77 +        ConstantPool cp = cf.constant_pool;
    1.78 +        for (Field f: cf.fields) {
    1.79 +            test("field " + cn + "." + f.getName(cp), f.descriptor, f.attributes, cp);
    1.80 +        }
    1.81 +    }
    1.82 +
    1.83 +    void testMethods(ClassFile cf) throws Exception {
    1.84 +        String cn = cf.getName();
    1.85 +        ConstantPool cp = cf.constant_pool;
    1.86 +        for (Method m: cf.methods) {
    1.87 +            test("method " + cn + "." + m.getName(cp), m.descriptor, m.attributes, cp);
    1.88 +        }
    1.89 +    }
    1.90 +
    1.91 +    void testInnerClasses(ClassFile cf) throws Exception {
    1.92 +        ConstantPool cp = cf.constant_pool;
    1.93 +        InnerClasses_attribute ic =
    1.94 +                (InnerClasses_attribute) cf.attributes.get(Attribute.InnerClasses);
    1.95 +        for (InnerClasses_attribute.Info info: ic.classes) {
    1.96 +            String outerClassName = cp.getClassInfo(info.outer_class_info_index).getName();
    1.97 +            if (!outerClassName.equals(cf.getName())) {
    1.98 +                continue;
    1.99 +            }
   1.100 +            String innerClassName = cp.getClassInfo(info.inner_class_info_index).getName();
   1.101 +            ClassFile icf = getClassFile(innerClassName);
   1.102 +            test("class " + innerClassName, null, icf.attributes, icf.constant_pool);
   1.103 +            testInnerClasses(icf);
   1.104 +        }
   1.105 +    }
   1.106 +
   1.107 +    void test(String name, Descriptor desc, Attributes attrs, ConstantPool cp)
   1.108 +            throws Exception {
   1.109 +        AnnotValues d = getDescValue(attrs, cp);
   1.110 +        AnnotValues s = getSigValue(attrs, cp);
   1.111 +        if (d == null && s == null) // not a test field or method if no @Desc or @Sig given
   1.112 +            return;
   1.113 +
   1.114 +        System.err.println(name);
   1.115 +
   1.116 +        if (desc != null) {
   1.117 +            System.err.println("    descriptor: " + desc.getValue(cp));
   1.118 +            checkEqual(d.raw, desc.getValue(cp));
   1.119 +            Type dt = new Signature(desc.index).getType(cp);
   1.120 +            checkEqual(d.type, tp.print(dt));
   1.121 +        }
   1.122 +
   1.123 +        Signature_attribute sa = (Signature_attribute) attrs.get(Attribute.Signature);
   1.124 +        if (sa != null)
   1.125 +            System.err.println("     signature: " + sa.getSignature(cp));
   1.126 +
   1.127 +        if (s != null || sa != null) {
   1.128 +            if (s != null && sa != null) {
   1.129 +                checkEqual(s.raw, sa.getSignature(cp));
   1.130 +                Type st = new Signature(sa.signature_index).getType(cp);
   1.131 +                checkEqual(s.type, tp.print(st));
   1.132 +            } else if (s != null)
   1.133 +                error("@Sig annotation found but not Signature attribute");
   1.134 +            else
   1.135 +                error("Signature attribute found but no @Sig annotation");
   1.136 +        }
   1.137 +
   1.138 +        System.err.println();
   1.139 +    }
   1.140 +
   1.141 +
   1.142 +    ClassFile getClassFile(String name) throws IOException, ConstantPoolException {
   1.143 +        URL url = getClass().getResource(name + ".class");
   1.144 +        InputStream in = url.openStream();
   1.145 +        try {
   1.146 +            return ClassFile.read(in);
   1.147 +        } finally {
   1.148 +            in.close();
   1.149 +        }
   1.150 +    }
   1.151 +
   1.152 +    AnnotValues getDescValue(Attributes attrs, ConstantPool cp) throws Exception {
   1.153 +        return getAnnotValues(Desc.class.getName(), attrs, cp);
   1.154 +    }
   1.155 +
   1.156 +    AnnotValues getSigValue(Attributes attrs, ConstantPool cp) throws Exception {
   1.157 +        return getAnnotValues(Sig.class.getName(), attrs, cp);
   1.158 +    }
   1.159 +
   1.160 +    static class AnnotValues {
   1.161 +        AnnotValues(String raw, String type) {
   1.162 +            this.raw = raw;
   1.163 +            this.type = type;
   1.164 +        }
   1.165 +        final String raw;
   1.166 +        final String type;
   1.167 +    }
   1.168 +
   1.169 +    AnnotValues getAnnotValues(String annotName, Attributes attrs, ConstantPool cp)
   1.170 +            throws Exception {
   1.171 +        RuntimeInvisibleAnnotations_attribute annots =
   1.172 +                (RuntimeInvisibleAnnotations_attribute)attrs.get(Attribute.RuntimeInvisibleAnnotations);
   1.173 +        if (annots != null) {
   1.174 +            for (Annotation a: annots.annotations) {
   1.175 +                if (cp.getUTF8Value(a.type_index).equals("L" + annotName + ";")) {
   1.176 +                    Annotation.Primitive_element_value pv0 =
   1.177 +                            (Annotation.Primitive_element_value) a.element_value_pairs[0].value;
   1.178 +                    Annotation.Primitive_element_value pv1 =
   1.179 +                            (Annotation.Primitive_element_value) a.element_value_pairs[1].value;
   1.180 +                    return new AnnotValues(
   1.181 +                            cp.getUTF8Value(pv0.const_value_index),
   1.182 +                            cp.getUTF8Value(pv1.const_value_index));
   1.183 +                }
   1.184 +            }
   1.185 +        }
   1.186 +        return null;
   1.187 +
   1.188 +    }
   1.189 +
   1.190 +    void checkEqual(String expect, String found) {
   1.191 +        if (!(expect == null ? found == null : expect.equals(found))) {
   1.192 +            System.err.println("expected: " + expect);
   1.193 +            System.err.println("   found: " + found);
   1.194 +            error("unexpected values found");
   1.195 +        }
   1.196 +    }
   1.197 +
   1.198 +    void error(String msg) {
   1.199 +        System.err.println("error: " + msg);
   1.200 +        errors++;
   1.201 +    }
   1.202 +
   1.203 +    int errors;
   1.204 +
   1.205 +    TypePrinter tp = new TypePrinter();
   1.206 +
   1.207 +    class TypePrinter implements Type.Visitor<String,Void> {
   1.208 +        String print(Type t) {
   1.209 +            return t == null ? null : t.accept(this, null);
   1.210 +        }
   1.211 +        String print(String pre, List<? extends Type> ts, String post) {
   1.212 +            if (ts == null)
   1.213 +                return null;
   1.214 +            StringBuilder sb = new StringBuilder();
   1.215 +            sb.append(pre);
   1.216 +            String sep = "";
   1.217 +            for (Type t: ts) {
   1.218 +                sb.append(sep);
   1.219 +                sb.append(print(t));
   1.220 +                sep = ",";
   1.221 +            }
   1.222 +            sb.append(post);
   1.223 +            return sb.toString();
   1.224 +        }
   1.225 +
   1.226 +        public String visitSimpleType(SimpleType type, Void p) {
   1.227 +            return "S{" + type.name + "}";
   1.228 +        }
   1.229 +
   1.230 +        public String visitArrayType(ArrayType type, Void p) {
   1.231 +            return "A{" + print(type.elemType) + "}";
   1.232 +        }
   1.233 +
   1.234 +        public String visitMethodType(MethodType type, Void p) {
   1.235 +            StringBuilder sb = new StringBuilder();
   1.236 +            sb.append("M{");
   1.237 +            if (type.typeParamTypes != null)
   1.238 +                sb.append(print("<", type.typeParamTypes, ">"));
   1.239 +            sb.append(print(type.returnType));
   1.240 +            sb.append(print("(", type.paramTypes, ")"));
   1.241 +            if (type.throwsTypes != null)
   1.242 +                sb.append(print("", type.throwsTypes, ""));
   1.243 +            sb.append("}");
   1.244 +            return sb.toString();
   1.245 +        }
   1.246 +
   1.247 +        public String visitClassSigType(ClassSigType type, Void p) {
   1.248 +            StringBuilder sb = new StringBuilder();
   1.249 +            sb.append("CS{");
   1.250 +            if (type.typeParamTypes != null)
   1.251 +                sb.append(print("<", type.typeParamTypes, ">"));
   1.252 +            sb.append(print(type.superclassType));
   1.253 +            if (type.superinterfaceTypes != null)
   1.254 +                sb.append(print("i(", type.superinterfaceTypes, ")"));
   1.255 +            sb.append("}");
   1.256 +            return sb.toString();
   1.257 +        }
   1.258 +
   1.259 +        public String visitClassType(ClassType type, Void p) {
   1.260 +            StringBuilder sb = new StringBuilder();
   1.261 +            sb.append("C{");
   1.262 +            if (type.outerType != null) {
   1.263 +                sb.append(print(type.outerType));
   1.264 +                sb.append(".");
   1.265 +            }
   1.266 +            sb.append(type.name);
   1.267 +            if (type.typeArgs != null)
   1.268 +                sb.append(print("<", type.typeArgs, ">"));
   1.269 +            sb.append("}");
   1.270 +            return sb.toString();
   1.271 +        }
   1.272 +
   1.273 +        public String visitTypeParamType(TypeParamType type, Void p) {
   1.274 +            StringBuilder sb = new StringBuilder();
   1.275 +            sb.append("TA{");
   1.276 +            sb.append(type.name);
   1.277 +            if (type.classBound != null) {
   1.278 +                sb.append(":c");
   1.279 +                sb.append(print(type.classBound));
   1.280 +            }
   1.281 +            if (type.interfaceBounds != null)
   1.282 +                sb.append(print(":i", type.interfaceBounds, ""));
   1.283 +            sb.append("}");
   1.284 +            return sb.toString();
   1.285 +        }
   1.286 +
   1.287 +        public String visitWildcardType(WildcardType type, Void p) {
   1.288 +            switch (type.kind) {
   1.289 +                case UNBOUNDED:
   1.290 +                    return "W{?}";
   1.291 +                case EXTENDS:
   1.292 +                    return "W{e," + print(type.boundType) + "}";
   1.293 +                case SUPER:
   1.294 +                    return "W{s," + print(type.boundType) + "}";
   1.295 +                default:
   1.296 +                    throw new AssertionError();
   1.297 +            }
   1.298 +        }
   1.299 +
   1.300 +    };
   1.301 +}
   1.302 +
   1.303 +
   1.304 +@interface Desc {
   1.305 +    String d();
   1.306 +    String t();
   1.307 +}
   1.308 +
   1.309 +@interface Sig {
   1.310 +    String s();
   1.311 +    String t();
   1.312 +}
   1.313 +
   1.314 +class Clss { }
   1.315 +interface Intf { }
   1.316 +class GenClss<T> { }
   1.317 +
   1.318 +class Test {
   1.319 +    // fields
   1.320 +
   1.321 +    @Desc(d="Z", t="S{boolean}")
   1.322 +    boolean z;
   1.323 +
   1.324 +    @Desc(d="B", t="S{byte}")
   1.325 +    byte b;
   1.326 +
   1.327 +    @Desc(d="C", t="S{char}")
   1.328 +    char c;
   1.329 +
   1.330 +    @Desc(d="D", t="S{double}")
   1.331 +    double d;
   1.332 +
   1.333 +    @Desc(d="F", t="S{float}")
   1.334 +    float f;
   1.335 +
   1.336 +    @Desc(d="I", t="S{int}")
   1.337 +    int i;
   1.338 +
   1.339 +    @Desc(d="J", t="S{long}")
   1.340 +    long l;
   1.341 +
   1.342 +    @Desc(d="S", t="S{short}")
   1.343 +    short s;
   1.344 +
   1.345 +    @Desc(d="LClss;", t="C{Clss}")
   1.346 +    Clss clss;
   1.347 +
   1.348 +    @Desc(d="LIntf;", t="C{Intf}")
   1.349 +    Intf intf;
   1.350 +
   1.351 +    @Desc(d="[I", t="A{S{int}}")
   1.352 +    int[] ai;
   1.353 +
   1.354 +    @Desc(d="[LClss;", t="A{C{Clss}}")
   1.355 +    Clss[] aClss;
   1.356 +
   1.357 +    @Desc(d="LGenClss;", t="C{GenClss}")
   1.358 +    @Sig(s="LGenClss<LClss;>;", t="C{GenClss<C{Clss}>}")
   1.359 +    GenClss<Clss> genClass;
   1.360 +
   1.361 +    // methods, return types
   1.362 +
   1.363 +    @Desc(d="()V", t="M{S{void}()}")
   1.364 +    void mv0() { }
   1.365 +
   1.366 +    @Desc(d="()I", t="M{S{int}()}")
   1.367 +    int mi0() { return 0; }
   1.368 +
   1.369 +    @Desc(d="()LClss;", t="M{C{Clss}()}")
   1.370 +    Clss mclss0() { return null; }
   1.371 +
   1.372 +    @Desc(d="()[I", t="M{A{S{int}}()}")
   1.373 +    int[] mai0() { return null; }
   1.374 +
   1.375 +    @Desc(d="()[LClss;", t="M{A{C{Clss}}()}")
   1.376 +    Clss[] maClss0() { return null; }
   1.377 +
   1.378 +    @Desc(d="()LGenClss;", t="M{C{GenClss}()}")
   1.379 +    @Sig(s="()LGenClss<LClss;>;", t="M{C{GenClss<C{Clss}>}()}")
   1.380 +    GenClss<Clss> mgenClss0() { return null; }
   1.381 +
   1.382 +    @Desc(d="()LGenClss;", t="M{C{GenClss}()}")
   1.383 +    @Sig(s="()LGenClss<*>;", t="M{C{GenClss<W{?}>}()}")
   1.384 +    GenClss<?> mgenClssW0() { return null; }
   1.385 +
   1.386 +    @Desc(d="()LGenClss;", t="M{C{GenClss}()}")
   1.387 +    @Sig(s="()LGenClss<+LClss;>;", t="M{C{GenClss<W{e,C{Clss}}>}()}")
   1.388 +    GenClss<? extends Clss> mgenClssWExtClss0() { return null; }
   1.389 +
   1.390 +    @Desc(d="()LGenClss;", t="M{C{GenClss}()}")
   1.391 +    @Sig(s="()LGenClss<-LClss;>;", t="M{C{GenClss<W{s,C{Clss}}>}()}")
   1.392 +    GenClss<? super Clss> mgenClssWSupClss0() { return null; }
   1.393 +
   1.394 +    @Desc(d="()Ljava/lang/Object;", t="M{C{java/lang/Object}()}")
   1.395 +    @Sig(s="<T:Ljava/lang/Object;>()TT;", t="M{<TA{T:cC{java/lang/Object}}>S{T}()}")
   1.396 +    <T> T mt0() { return null; }
   1.397 +
   1.398 +    @Desc(d="()LGenClss;", t="M{C{GenClss}()}")
   1.399 +    @Sig(s="<T:Ljava/lang/Object;>()LGenClss<+TT;>;",
   1.400 +        t="M{<TA{T:cC{java/lang/Object}}>C{GenClss<W{e,S{T}}>}()}")
   1.401 +    <T> GenClss<? extends T> mgenClssWExtT0() { return null; }
   1.402 +
   1.403 +    @Desc(d="()LGenClss;", t="M{C{GenClss}()}")
   1.404 +    @Sig(s="<T:Ljava/lang/Object;>()LGenClss<-TT;>;", t="M{<TA{T:cC{java/lang/Object}}>C{GenClss<W{s,S{T}}>}()}")
   1.405 +    <T> GenClss<? super T> mgenClssWSupT0() { return null; }
   1.406 +
   1.407 +    // methods, arg types
   1.408 +
   1.409 +    @Desc(d="(I)V", t="M{S{void}(S{int})}")
   1.410 +    void mi1(int arg) { }
   1.411 +
   1.412 +    @Desc(d="(LClss;)V", t="M{S{void}(C{Clss})}")
   1.413 +    void mclss1(Clss arg) { }
   1.414 +
   1.415 +    @Desc(d="([I)V", t="M{S{void}(A{S{int}})}")
   1.416 +    void mai1(int[] arg) { }
   1.417 +
   1.418 +    @Desc(d="([LClss;)V", t="M{S{void}(A{C{Clss}})}")
   1.419 +    void maClss1(Clss[] arg) { }
   1.420 +
   1.421 +    @Desc(d="(LGenClss;)V", t="M{S{void}(C{GenClss})}")
   1.422 +    @Sig(s="(LGenClss<LClss;>;)V", t="M{S{void}(C{GenClss<C{Clss}>})}")
   1.423 +    void mgenClss1(GenClss<Clss> arg) { }
   1.424 +
   1.425 +    @Desc(d="(LGenClss;)V", t="M{S{void}(C{GenClss})}")
   1.426 +    @Sig(s="(LGenClss<*>;)V", t="M{S{void}(C{GenClss<W{?}>})}")
   1.427 +    void mgenClssW1(GenClss<?> arg) { }
   1.428 +
   1.429 +    @Desc(d="(LGenClss;)V", t="M{S{void}(C{GenClss})}")
   1.430 +    @Sig(s="(LGenClss<+LClss;>;)V", t="M{S{void}(C{GenClss<W{e,C{Clss}}>})}")
   1.431 +    void mgenClssWExtClss1(GenClss<? extends Clss> arg) { }
   1.432 +
   1.433 +    @Desc(d="(LGenClss;)V", t="M{S{void}(C{GenClss})}")
   1.434 +    @Sig(s="(LGenClss<-LClss;>;)V", t="M{S{void}(C{GenClss<W{s,C{Clss}}>})}")
   1.435 +    void mgenClssWSupClss1(GenClss<? super Clss> arg) { }
   1.436 +
   1.437 +    @Desc(d="(Ljava/lang/Object;)V", t="M{S{void}(C{java/lang/Object})}")
   1.438 +    @Sig(s="<T:Ljava/lang/Object;>(TT;)V",
   1.439 +        t="M{<TA{T:cC{java/lang/Object}}>S{void}(S{T})}")
   1.440 +    <T> void mt1(T arg) { }
   1.441 +
   1.442 +    @Desc(d="(LGenClss;)V", t="M{S{void}(C{GenClss})}")
   1.443 +    @Sig(s="<T:Ljava/lang/Object;>(LGenClss<+TT;>;)V",
   1.444 +        t="M{<TA{T:cC{java/lang/Object}}>S{void}(C{GenClss<W{e,S{T}}>})}")
   1.445 +    <T> void mgenClssWExtT1(GenClss<? extends T> arg) { }
   1.446 +
   1.447 +    @Desc(d="(LGenClss;)V", t="M{S{void}(C{GenClss})}")
   1.448 +    @Sig(s="<T:Ljava/lang/Object;>(LGenClss<-TT;>;)V",
   1.449 +        t="M{<TA{T:cC{java/lang/Object}}>S{void}(C{GenClss<W{s,S{T}}>})}")
   1.450 +    <T> void mgenClssWSupT1(GenClss<? super T> arg) { }
   1.451 +
   1.452 +    // methods, throws
   1.453 +
   1.454 +    @Desc(d="()V", t="M{S{void}()}")
   1.455 +    void m_E() throws Exception { }
   1.456 +
   1.457 +    @Desc(d="()V", t="M{S{void}()}")
   1.458 +    @Sig(s="<T:Ljava/lang/Throwable;>()V^TT;",
   1.459 +        t="M{<TA{T:cC{java/lang/Throwable}}>S{void}()S{T}}")
   1.460 +    <T extends Throwable> void m_T() throws T { }
   1.461 +
   1.462 +    // inner classes
   1.463 +
   1.464 +    static class X {
   1.465 +        // no sig
   1.466 +        class P { }
   1.467 +
   1.468 +        @Sig(s="<TQ:Ljava/lang/Object;>LTest$X$P;",
   1.469 +            t="CS{<TA{TQ:cC{java/lang/Object}}>C{Test$X$P}}")
   1.470 +        class Q<TQ> extends P { }
   1.471 +
   1.472 +        @Sig(s="<TR:Ljava/lang/Object;>LTest$X$Q<TTR;>;",
   1.473 +            t="CS{<TA{TR:cC{java/lang/Object}}>C{Test$X$Q<S{TR}>}}")
   1.474 +        class R<TR> extends Q<TR> { }
   1.475 +    }
   1.476 +
   1.477 +    @Sig(s="<TY:Ljava/lang/Object;>Ljava/lang/Object;",
   1.478 +        t="CS{<TA{TY:cC{java/lang/Object}}>C{java/lang/Object}}")
   1.479 +    static class Y<TY> {
   1.480 +        // no sig
   1.481 +        class P { }
   1.482 +
   1.483 +        @Sig(s="<TQ:Ljava/lang/Object;>LTest$Y<TTY;>.P;",
   1.484 +            t="CS{<TA{TQ:cC{java/lang/Object}}>C{C{Test$Y<S{TY}>}.P}}")
   1.485 +        class Q<TQ> extends P { }
   1.486 +
   1.487 +        @Sig(s="<TR:Ljava/lang/Object;>LTest$Y<TTY;>.Q<TTR;>;",
   1.488 +            t="CS{<TA{TR:cC{java/lang/Object}}>C{C{Test$Y<S{TY}>}.Q<S{TR}>}}")
   1.489 +        class R<TR> extends Q<TR> {
   1.490 +            // no sig
   1.491 +            class R1 { }
   1.492 +
   1.493 +            @Sig(s="<TR2:Ljava/lang/Object;>LTest$Y<TTY;>.R<TTR;>.R1;",
   1.494 +                t="CS{<TA{TR2:cC{java/lang/Object}}>C{C{C{Test$Y<S{TY}>}.R<S{TR}>}.R1}}")
   1.495 +            class R2<TR2> extends R1 { }
   1.496 +        }
   1.497 +
   1.498 +        @Sig(s="LTest$Y<TTY;>.Q<TTY;>;", t="C{C{Test$Y<S{TY}>}.Q<S{TY}>}")
   1.499 +        class S extends Q<TY> {
   1.500 +            // no sig
   1.501 +            class S1 { }
   1.502 +
   1.503 +            @Sig(s="<TS2:Ljava/lang/Object;>LTest$Y<TTY;>.S.S1;",
   1.504 +                t="CS{<TA{TS2:cC{java/lang/Object}}>C{C{C{Test$Y<S{TY}>}.S}.S1}}")
   1.505 +            class S2<TS2> extends S1 { }
   1.506 +
   1.507 +            @Sig(s="LTest$Y<TTY;>.S.S2<TTY;>;",
   1.508 +                t="C{C{C{Test$Y<S{TY}>}.S}.S2<S{TY}>}")
   1.509 +            class S3 extends S2<TY> { }
   1.510 +        }
   1.511 +    }
   1.512 +}
   1.513 +
   1.514 +

mercurial