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

Java example source code file (T6795580.java)

This example Java source code file (T6795580.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

inner, number, object, outer, string, t6795580

The T6795580.java Java example source code

/*
 * @test /nodynamiccopyright/
 * @author Maurizio Cimadamore
 * @bug     6795580
 * @summary parser confused by square brackets in qualified generic cast
 * @compile/fail/ref=T6795580.out -XDrawDiagnostics T6795580.java
 */

class T6795580 {
    class Outer<S> {
        class Inner<T> {}
    }

    void cast1(Outer<Integer>.Inner[] p) {
        Object o = (Outer<Integer>.Inner[])p;
    }

    void cast2(Outer<Integer>.Inner[] p) {
        Object o = (Outer<? extends Number>.Inner[])p;
    }

    void cast3(Outer<Integer>.Inner[] p) {
        Object o = (Outer<Integer>.Inner[])p;
    }

    void cast4(Outer<Integer>.Inner[] p) {
        Object o = (Outer<? extends Number>.Inner[])p;
    }

    void cast5(Outer<Integer>.Inner[] p) {
        Object o = (Outer<? super Number>.Inner[])p;
    }

    void cast6(Outer<Integer>.Inner[] p) {
        Object o = (Outer<Integer>.Inner[])p;
    }

    void cast7(Outer<Integer>.Inner[] p) {
        Object o = (Outer<? super Number>.Inner[])p;
    }

    void cast8(Outer<Integer>.Inner[] p) {
        Object o = (Outer<? extends String>.Inner[])p;
    }

    void cast9(Outer<Integer>.Inner[] p) {
        Object o = (Outer<Integer>.Inner[])p;
    }

    void cast10(Outer<Integer>.Inner[] p) {
        Object o = (Outer<? super String>.Inner[])p;
    }

    void cast11(Outer<Integer>.Inner[] p) {
        Object o = (Outer<Integer>.Inner[])p;
    }
}

Other Java examples (source code examples)

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

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

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 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.