langtools/test/tools/javac/8138840/T8139243.java
author mcimadamore
Mon, 12 Oct 2015 12:24:33 +0100 (2015-10-12)
changeset 33018 9790ed482dd0
permissions -rw-r--r--
8138840: NPE when compiling bitwise operations with illegal operand types 8139243: compiler crashes with exception on sum operation of String var and void method call result 8139249: Compiler crashes on unary bitwise complement with non-integral operand Summary: Certain binary operator checks are accepting more operands than required. Reviewed-by: jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33018
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
     1
/*
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
     3
 * @bug 8138840 8139243 8139249
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
     4
 * @summary Compiler crashes when compiling bitwise operations with illegal operand types
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
     5
 *          'void' is erroneously accepted as a possible operand for string concatenation
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
     6
 * @compile/fail/ref=T8139243.out -XDrawDiagnostics T8139243.java
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
     7
 */
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
     8
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
     9
class T8139243 {
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
    10
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
    11
    void test(String s) {
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
    12
        s += m(); // compile time error
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
    13
    }
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
    14
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
    15
    void m() { }
9790ed482dd0 8138840: NPE when compiling bitwise operations with illegal operand types
mcimadamore
parents:
diff changeset
    16
}