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

Java example source code file (T7005671.java)

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

object, t7005671

The T7005671.java Java example source code

/*
 * @test /nodynamiccopyright/
 * @author mcimadamore
 * @bug     7005671
 * @summary Regression: compiler accepts invalid cast from X[] to primitive array
 * @compile/fail/ref=T7005671.out -XDrawDiagnostics T7005671.java
 */

class T7005671<X> {

    void test1() {
        Object o1 = (X[])(byte[])null;
        Object o2 = (X[])(short[])null;
        Object o3 = (X[])(int[])null;
        Object o4 = (X[])(long[])null;
        Object o5 = (X[])(float[])null;
        Object o6 = (X[])(double[])null;
        Object o7 = (X[])(char[])null;
        Object o8 = (X[])(boolean[])null;
    }

    void test2() {
        Object o1 = (byte[])(X[])null;
        Object o2 = (short[])(X[])null;
        Object o3 = (int[])(X[])null;
        Object o4 = (long[])(X[])null;
        Object o5 = (float[])(X[])null;
        Object o6 = (double[])(X[])null;
        Object o7 = (char[])(X[])null;
        Object o8 = (boolean[])(X[])null;
    }
}

Other Java examples (source code examples)

Here is a short list of links related to this Java T7005671.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.