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

Java example source code file (ErroneousArg.java)

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

erroneousarg, foo, testerroneousarg

The ErroneousArg.java Java example source code

/*
 * @test /nodynamiccopyright/
 * @bug 8003280
 * @summary Add lambda tests
 *  speculative cache mismatches between Resolve.access and Attr.checkId leads to compiler crashes
 * @compile/fail/ref=ErroneousArg.out -XDrawDiagnostics ErroneousArg.java
 */
class ErroneousArg {

    private static class Foo {
        static int j() { return 1; }
    }

    static Foo foo = new Foo();

    static void m(String s) { }
    static void m(Integer i) { }

    static int f(String s) { return 1; }

    static int g(String s) { return 1; }
    static int g(Double s) { return 1; }

    int h() { return 1; }
}

class TestErroneousArg extends ErroneousArg {
    static void test() {
        m(unknown()); //method not found
        m(f(1)); //inapplicable method
        m(g(1)); //inapplicable methods
        m(g(null)); //ambiguous
        m(h()); //static error
        m(foo.j()); //inaccessible method
    }
}

Other Java examples (source code examples)

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