langtools/test/tools/javac/LocalClasses_2.java
author jjg
Thu, 10 Jul 2008 11:25:23 -0700
changeset 863 3113c955a388
parent 10 06bc494ca11e
child 6150 d055fa8ced62
permissions -rw-r--r--
6724327: eliminate use of shell tests for simple golden file tests Reviewed-by: darcy
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
 *
863
3113c955a388 6724327: eliminate use of shell tests for simple golden file tests
jjg
parents: 10
diff changeset
     7
 * @compile/fail/ref=LocalClasses_2.out -XDrawDiagnostics -XDstdout LocalClasses_2.java
10
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
}