alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (T7151802.java)

This example Java source code file (T7151802.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

foo, subfoo, t7151802

The T7151802.java Java example source code

/*
 * @test /nodynamiccopyright/
 * @bug     7151802
 * @summary compiler update caused sqe test failed
 * @compile/fail/ref=T7151802.out -Werror -Xlint:unchecked -XDrawDiagnostics T7151802.java
 */
class T7151802 {
    static class Foo<X> { }

    static class SubFoo<X> extends Foo { }

    //generic - bound - arg - non-slilent
    <Z extends Foo void get1(Z fz) { }
    void test1(Foo foo) { get1(foo); }

    //generic - bound - arg - silent
    <Z extends Foo void get2(Z fz) { }
    void test2(Foo foo) { get2(foo); }

    //generic - nobound - arg - non-slilent
    <Z> void get3(Foo fz) { }
    void test(Foo foo) { get3(foo); }

    //generic - nobound - arg - slilent
    <Z> void get4(Foo fz) { }
    void test4(Foo foo) { get4(foo); }

    //generic - bound - ret - non-slilent
    <Z extends Foo Z get5() { return null; }
    void test5() { SubFoo sf = get5(); }

    //generic - bound - ret - slilent
    static <Z extends Foo Z get6() { return null; }
    void test6() { SubFoo sf = get6(); }

    //nogeneric - nobound - arg - non-slilent
    void get7(Foo<String> fz) { }
    void test7(Foo foo) { get7(foo); }

    //nogeneric - nobound - arg - slilent
    static void get8(Foo<?> fz) { }
    void test8(Foo foo) { get8(foo); }
}

Other Java examples (source code examples)

Here is a short list of links related to this Java T7151802.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.