langtools/test/tools/javac/T8029179/CompileErrorForValidBooleanExpTest.java
author vromero
Tue, 03 Dec 2013 18:13:18 +0000
changeset 22004 203318f0799d
permissions -rw-r--r--
8029179: javac produces a compile error for valid boolean expressions Reviewed-by: jjg, jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22004
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
     1
/*
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
     4
 *
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
     7
 * published by the Free Software Foundation.
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
     8
 *
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    13
 * accompanied this code).
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    14
 *
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    18
 *
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    21
 * questions.
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    22
 */
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    23
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    24
/*
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    25
 * @test
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    26
 * @bug 8029179
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    27
 * @summary javac produces a compile error for valid boolean expressions
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    28
 * @compile CompileErrorForValidBooleanExpTest.java
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    29
 */
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    30
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    31
public class CompileErrorForValidBooleanExpTest {
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    32
    static int a, b, c, d;
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    33
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    34
    static void m() {
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    35
        boolean cond1 = (a < b & c > d);
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    36
        boolean cond2 = (f1() < f2() & c > d);
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    37
        boolean cond3 = (f1() < b & f3() > d);
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    38
        boolean cond4 = (f1() < b & f3() > 1);
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    39
    }
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    40
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    41
    static int f1() {
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    42
        return 0;
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    43
    }
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    44
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    45
    static int f2() {
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    46
        return 0;
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    47
    }
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    48
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    49
    static int f3() {
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    50
        return 0;
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    51
    }
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    52
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    53
    static int f4() {
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    54
        return 0;
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    55
    }
203318f0799d 8029179: javac produces a compile error for valid boolean expressions
vromero
parents:
diff changeset
    56
}