langtools/test/tools/javac/LocalClasses_2.java
author xdono
Wed, 02 Jul 2008 12:56:02 -0700
changeset 735 372aa565a221
parent 10 06bc494ca11e
child 863 3113c955a388
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * @test  /nodynamiccopyright/
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug 4074421 4277278 4785453
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @summary Verify that a local class cannot be redefined within its scope.
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * @author William Maddox (maddox)
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * @run shell LocalClasses_2.sh
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
class LocalClasses_2 {
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
    void foo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
        class Local { }
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
            class Local { }                     // ERROR
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
    void bar() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
        class Local { }
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
        class Baz {
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
            void quux() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
                class Local { }                 // OK
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
        class Quux {
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
            void baz() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
                class Random {
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
                    void quem() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
                        class Local { }         // OK
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
}