langtools/test/tools/javac/7023703/T7023703pos.java
author jlahoda
Tue, 17 Dec 2013 10:55:59 +0100
changeset 22153 f9f06fcca59d
parent 8627 e60ca990602f
permissions -rw-r--r--
8029800: Flags.java uses String.toLowerCase without specifying Locale Summary: Introducing StringUtils.toLowerCase/toUpperCase independent on the default locale, converting almost all usages of String.toLowerCase/toUpperCase to use the new methods. Reviewed-by: jjg, bpatel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8627
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
     1
/*
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
     4
 *
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
     8
 *
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    14
 *
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    18
 *
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    21
 * questions.
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    22
 */
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    23
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    24
/* @test
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    25
 * @bug 7023703
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    26
 * @summary Valid code doesn't compile
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    27
 * @compile T7023703pos.java
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    28
 */
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    29
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    30
class T7023703pos {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    31
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    32
    void testForLoop() {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    33
        final int bug;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    34
        for (;"a".equals("b");) {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    35
            final int item = 0;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    36
        }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    37
        bug = 0; //ok
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    38
    }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    39
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    40
    void testForEachLoop(boolean cond, java.util.Collection<Integer> c) {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    41
        final int bug;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    42
        for (Integer i : c) {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    43
            if (cond) {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    44
                final int item = 0;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    45
            }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    46
        }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    47
        bug = 0; //ok
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    48
    }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    49
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    50
    void testWhileLoop() {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    51
        final int bug;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    52
        while ("a".equals("b")) {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    53
            final int item = 0;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    54
        }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    55
        bug = 0; //ok
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    56
    }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    57
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    58
    void testDoWhileLoop() {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    59
        final int bug;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    60
        do {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    61
            final int item = 0;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    62
        } while ("a".equals("b"));
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    63
        bug = 0; //ok
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    64
    }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    65
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    66
    private static class Inner {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    67
        private final int a, b, c, d, e;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    68
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    69
        public Inner() {
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    70
            a = b = c = d = e = 0;
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    71
        }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    72
    }
e60ca990602f 7023703: Valid code doesn't compile
mcimadamore
parents:
diff changeset
    73
}