7086595: Error message bug: name of initializer is 'null'

Tue, 13 Sep 2011 14:14:57 +0100

author
mcimadamore
date
Tue, 13 Sep 2011 14:14:57 +0100
changeset 1085
ed338593b0b6
parent 1081
f1431cace56e
child 1086
f595d8bc0599

7086595: Error message bug: name of initializer is 'null'
Summary: Implementation of MethodSymbol.location() should take into account static/instance initializers
Reviewed-by: jjg

src/share/classes/com/sun/tools/javac/code/Kinds.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/Printer.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/Symbol.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Check.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/resources/compiler.properties file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java file | annotate | diff | comparison | revisions
test/tools/javac/7086595/T7086595.java file | annotate | diff | comparison | revisions
test/tools/javac/7086595/T7086595.out file | annotate | diff | comparison | revisions
test/tools/javac/Diagnostics/6860795/T6860795.out file | annotate | diff | comparison | revisions
test/tools/javac/LocalClasses_2.out file | annotate | diff | comparison | revisions
test/tools/javac/NestedInnerClassNames.out file | annotate | diff | comparison | revisions
test/tools/javac/TryWithResources/BadTwr.out file | annotate | diff | comparison | revisions
test/tools/javac/TryWithResources/DuplicateResourceDecl.out file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/AlreadyDefinedClinit.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/KindnameInstanceInit.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/KindnameStaticInit.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/6910550/T6910550d.out file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Kinds.java	Mon Sep 12 11:40:07 2011 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Kinds.java	Tue Sep 13 14:14:57 2011 +0100
     1.3 @@ -103,6 +103,8 @@
     1.4          VAL("kindname.value"),
     1.5          METHOD("kindname.method"),
     1.6          CLASS("kindname.class"),
     1.7 +        STATIC_INIT("kindname.static.init"),
     1.8 +        INSTANCE_INIT("kindname.instance.init"),
     1.9          PACKAGE("kindname.package");
    1.10  
    1.11          private String name;
    1.12 @@ -170,9 +172,11 @@
    1.13              return KindName.CONSTRUCTOR;
    1.14  
    1.15          case METHOD:
    1.16 +            return KindName.METHOD;
    1.17          case STATIC_INIT:
    1.18 +            return KindName.STATIC_INIT;
    1.19          case INSTANCE_INIT:
    1.20 -            return KindName.METHOD;
    1.21 +            return KindName.INSTANCE_INIT;
    1.22  
    1.23          default:
    1.24              if (sym.kind == VAL)
     2.1 --- a/src/share/classes/com/sun/tools/javac/code/Printer.java	Mon Sep 12 11:40:07 2011 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Printer.java	Tue Sep 13 14:14:57 2011 +0100
     2.3 @@ -311,7 +311,7 @@
     2.4  
     2.5      @Override
     2.6      public String visitMethodSymbol(MethodSymbol s, Locale locale) {
     2.7 -        if ((s.flags() & BLOCK) != 0) {
     2.8 +        if (s.isStaticOrInstanceInit()) {
     2.9              return s.owner.name.toString();
    2.10          } else {
    2.11              String ms = (s.name == s.name.table.names.init)
     3.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon Sep 12 11:40:07 2011 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Tue Sep 13 14:14:57 2011 +0100
     3.3 @@ -149,7 +149,8 @@
     3.4       * the default package; otherwise, the owner symbol is returned
     3.5       */
     3.6      public Symbol location() {
     3.7 -        if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK && owner.kind != TYP)) {
     3.8 +        if (owner.name == null || (owner.name.isEmpty() &&
     3.9 +                (owner.flags() & BLOCK) == 0 && owner.kind != PCK && owner.kind != TYP)) {
    3.10              return null;
    3.11          }
    3.12          return owner;
    3.13 @@ -1299,10 +1300,17 @@
    3.14                  return ElementKind.CONSTRUCTOR;
    3.15              else if (name == name.table.names.clinit)
    3.16                  return ElementKind.STATIC_INIT;
    3.17 +            else if ((flags() & BLOCK) != 0)
    3.18 +                return isStatic() ? ElementKind.STATIC_INIT : ElementKind.INSTANCE_INIT;
    3.19              else
    3.20                  return ElementKind.METHOD;
    3.21          }
    3.22  
    3.23 +        public boolean isStaticOrInstanceInit() {
    3.24 +            return getKind() == ElementKind.STATIC_INIT ||
    3.25 +                    getKind() == ElementKind.INSTANCE_INIT;
    3.26 +        }
    3.27 +
    3.28          public Attribute getDefaultValue() {
    3.29              return defaultValue;
    3.30          }
     4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Sep 12 11:40:07 2011 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue Sep 13 14:14:57 2011 +0100
     4.3 @@ -306,7 +306,16 @@
     4.4       */
     4.5      void duplicateError(DiagnosticPosition pos, Symbol sym) {
     4.6          if (!sym.type.isErroneous()) {
     4.7 -            log.error(pos, "already.defined", sym, sym.location());
     4.8 +            Symbol location = sym.location();
     4.9 +            if (location.kind == MTH &&
    4.10 +                    ((MethodSymbol)location).isStaticOrInstanceInit()) {
    4.11 +                log.error(pos, "already.defined.in.clinit", kindName(sym), sym,
    4.12 +                        kindName(sym.location()), kindName(sym.location().enclClass()),
    4.13 +                        sym.location().enclClass());
    4.14 +            } else {
    4.15 +                log.error(pos, "already.defined", kindName(sym), sym,
    4.16 +                        kindName(sym.location()), sym.location());
    4.17 +            }
    4.18          }
    4.19      }
    4.20  
     5.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Sep 12 11:40:07 2011 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Sep 13 14:14:57 2011 +0100
     5.3 @@ -68,9 +68,13 @@
     5.4  compiler.err.already.annotated=\
     5.5      {0} {1} has already been annotated
     5.6  
     5.7 -# 0: symbol, 1: symbol
     5.8 +# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol
     5.9  compiler.err.already.defined=\
    5.10 -    {0} is already defined in {1}
    5.11 +    {0} {1} is already defined in {2} {3}
    5.12 +
    5.13 +# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol kind, 4: symbol
    5.14 +compiler.err.already.defined.in.clinit=\
    5.15 +    {0} {1} is already defined in {2} of {3} {4}
    5.16  
    5.17  # 0: string
    5.18  compiler.err.already.defined.single.import=\
    5.19 @@ -1753,6 +1757,12 @@
    5.20  compiler.misc.kindname.package=\
    5.21      package
    5.22  
    5.23 +compiler.misc.kindname.static.init=\
    5.24 +    static initializer
    5.25 +
    5.26 +compiler.misc.kindname.instance.init=\
    5.27 +    instance initializer
    5.28 +
    5.29  #####
    5.30  
    5.31  compiler.misc.no.args=\
     6.1 --- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Mon Sep 12 11:40:07 2011 -0700
     6.2 +++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Tue Sep 13 14:14:57 2011 +0100
     6.3 @@ -412,7 +412,7 @@
     6.4          @Override
     6.5          public String visitMethodSymbol(MethodSymbol s, Locale locale) {
     6.6              String ownerName = visit(s.owner, locale);
     6.7 -            if ((s.flags() & BLOCK) != 0) {
     6.8 +            if (s.isStaticOrInstanceInit()) {
     6.9                 return ownerName;
    6.10              } else {
    6.11                  String ms = (s.name == s.name.table.names.init)
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/tools/javac/7086595/T7086595.java	Tue Sep 13 14:14:57 2011 +0100
     7.3 @@ -0,0 +1,32 @@
     7.4 +/*
     7.5 + * @test /nodynamiccopyright/
     7.6 + * @bug 7086595
     7.7 + * @summary Error message bug: name of initializer is 'null'
     7.8 + * @compile/fail/ref=T7086595.out -XDrawDiagnostics T7086595.java
     7.9 + */
    7.10 +
    7.11 +class T7086595 {
    7.12 +
    7.13 +    String s = "x";
    7.14 +    String s = nonExistent;
    7.15 +
    7.16 +    int foo() {
    7.17 +        String s = "x";
    7.18 +        String s = nonExistent;
    7.19 +    }
    7.20 +
    7.21 +    static int bar() {
    7.22 +        String s = "x";
    7.23 +        String s = nonExistent;
    7.24 +    }
    7.25 +
    7.26 +    {
    7.27 +        String s = "x";
    7.28 +        String s = nonExistent;
    7.29 +    }
    7.30 +
    7.31 +    static {
    7.32 +        String s = "x";
    7.33 +        String s = nonExistent;
    7.34 +    }
    7.35 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/test/tools/javac/7086595/T7086595.out	Tue Sep 13 14:14:57 2011 +0100
     8.3 @@ -0,0 +1,11 @@
     8.4 +T7086595.java:11:12: compiler.err.already.defined: kindname.variable, s, kindname.class, T7086595
     8.5 +T7086595.java:11:16: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
     8.6 +T7086595.java:15:16: compiler.err.already.defined: kindname.variable, s, kindname.method, foo()
     8.7 +T7086595.java:15:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
     8.8 +T7086595.java:20:16: compiler.err.already.defined: kindname.variable, s, kindname.method, bar()
     8.9 +T7086595.java:20:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
    8.10 +T7086595.java:25:16: compiler.err.already.defined.in.clinit: kindname.variable, s, kindname.instance.init, kindname.class, T7086595
    8.11 +T7086595.java:25:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
    8.12 +T7086595.java:30:16: compiler.err.already.defined.in.clinit: kindname.variable, s, kindname.static.init, kindname.class, T7086595
    8.13 +T7086595.java:30:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
    8.14 +10 errors
     9.1 --- a/test/tools/javac/Diagnostics/6860795/T6860795.out	Mon Sep 12 11:40:07 2011 -0700
     9.2 +++ b/test/tools/javac/Diagnostics/6860795/T6860795.out	Tue Sep 13 14:14:57 2011 +0100
     9.3 @@ -1,2 +1,2 @@
     9.4 -T6860795.java:10:27: compiler.err.already.defined: x, foo
     9.5 +T6860795.java:10:27: compiler.err.already.defined: kindname.variable, x, kindname.method, foo
     9.6  1 error
    10.1 --- a/test/tools/javac/LocalClasses_2.out	Mon Sep 12 11:40:07 2011 -0700
    10.2 +++ b/test/tools/javac/LocalClasses_2.out	Tue Sep 13 14:14:57 2011 +0100
    10.3 @@ -1,2 +1,2 @@
    10.4 -LocalClasses_2.java:15:13: compiler.err.already.defined: Local, foo()
    10.5 +LocalClasses_2.java:15:13: compiler.err.already.defined: kindname.class, Local, kindname.method, foo()
    10.6  1 error
    11.1 --- a/test/tools/javac/NestedInnerClassNames.out	Mon Sep 12 11:40:07 2011 -0700
    11.2 +++ b/test/tools/javac/NestedInnerClassNames.out	Tue Sep 13 14:14:57 2011 +0100
    11.3 @@ -1,18 +1,18 @@
    11.4 -NestedInnerClassNames.java:16:5: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
    11.5 -NestedInnerClassNames.java:23:9: compiler.err.already.defined: NestedInnerClassNames.foo, NestedInnerClassNames
    11.6 -NestedInnerClassNames.java:34:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
    11.7 -NestedInnerClassNames.java:45:9: compiler.err.already.defined: NestedInnerClassNames.baz, NestedInnerClassNames
    11.8 -NestedInnerClassNames.java:46:13: compiler.err.already.defined: NestedInnerClassNames.baz.baz, NestedInnerClassNames.baz
    11.9 -NestedInnerClassNames.java:59:9: compiler.err.already.defined: NestedInnerClassNames.foo$bar, NestedInnerClassNames
   11.10 -NestedInnerClassNames.java:76:13: compiler.err.already.defined: NestedInnerClassNames.$bar, NestedInnerClassNames
   11.11 -NestedInnerClassNames.java:90:13: compiler.err.already.defined: NestedInnerClassNames.bar$bar.bar, NestedInnerClassNames.bar$bar
   11.12 +NestedInnerClassNames.java:16:5: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
   11.13 +NestedInnerClassNames.java:23:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.foo, kindname.class, NestedInnerClassNames
   11.14 +NestedInnerClassNames.java:34:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
   11.15 +NestedInnerClassNames.java:45:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.baz, kindname.class, NestedInnerClassNames
   11.16 +NestedInnerClassNames.java:46:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.baz.baz, kindname.class, NestedInnerClassNames.baz
   11.17 +NestedInnerClassNames.java:59:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.foo$bar, kindname.class, NestedInnerClassNames
   11.18 +NestedInnerClassNames.java:76:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.$bar, kindname.class, NestedInnerClassNames
   11.19 +NestedInnerClassNames.java:90:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.bar$bar.bar, kindname.class, NestedInnerClassNames.bar$bar
   11.20  NestedInnerClassNames.java:109:5: compiler.err.duplicate.class: NestedInnerClassNames.foo.foo
   11.21 -NestedInnerClassNames.java:19:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
   11.22 -NestedInnerClassNames.java:28:13: compiler.err.already.defined: foo, m2()
   11.23 -NestedInnerClassNames.java:40:13: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
   11.24 -NestedInnerClassNames.java:52:13: compiler.err.already.defined: baz, m4()
   11.25 -NestedInnerClassNames.java:53:17: compiler.err.already.defined: baz.baz, baz
   11.26 -NestedInnerClassNames.java:67:13: compiler.err.already.defined: foo$bar, m5()
   11.27 -NestedInnerClassNames.java:83:17: compiler.err.already.defined: $bar, m6()
   11.28 -NestedInnerClassNames.java:97:17: compiler.err.already.defined: bar$bar.bar, bar$bar
   11.29 +NestedInnerClassNames.java:19:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
   11.30 +NestedInnerClassNames.java:28:13: compiler.err.already.defined: kindname.class, foo, kindname.method, m2()
   11.31 +NestedInnerClassNames.java:40:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
   11.32 +NestedInnerClassNames.java:52:13: compiler.err.already.defined: kindname.class, baz, kindname.method, m4()
   11.33 +NestedInnerClassNames.java:53:17: compiler.err.already.defined: kindname.class, baz.baz, kindname.class, baz
   11.34 +NestedInnerClassNames.java:67:13: compiler.err.already.defined: kindname.class, foo$bar, kindname.method, m5()
   11.35 +NestedInnerClassNames.java:83:17: compiler.err.already.defined: kindname.class, $bar, kindname.method, m6()
   11.36 +NestedInnerClassNames.java:97:17: compiler.err.already.defined: kindname.class, bar$bar.bar, kindname.class, bar$bar
   11.37  17 errors
    12.1 --- a/test/tools/javac/TryWithResources/BadTwr.out	Mon Sep 12 11:40:07 2011 -0700
    12.2 +++ b/test/tools/javac/TryWithResources/BadTwr.out	Tue Sep 13 14:14:57 2011 +0100
    12.3 @@ -1,5 +1,5 @@
    12.4 -BadTwr.java:13:46: compiler.err.already.defined: r1, main(java.lang.String...)
    12.5 -BadTwr.java:18:20: compiler.err.already.defined: args, main(java.lang.String...)
    12.6 +BadTwr.java:13:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, main(java.lang.String...)
    12.7 +BadTwr.java:18:20: compiler.err.already.defined: kindname.variable, args, kindname.method, main(java.lang.String...)
    12.8  BadTwr.java:21:13: compiler.err.cant.assign.val.to.final.var: thatsIt
    12.9 -BadTwr.java:26:24: compiler.err.already.defined: name, main(java.lang.String...)
   12.10 +BadTwr.java:26:24: compiler.err.already.defined: kindname.variable, name, kindname.method, main(java.lang.String...)
   12.11  4 errors
    13.1 --- a/test/tools/javac/TryWithResources/DuplicateResourceDecl.out	Mon Sep 12 11:40:07 2011 -0700
    13.2 +++ b/test/tools/javac/TryWithResources/DuplicateResourceDecl.out	Tue Sep 13 14:14:57 2011 +0100
    13.3 @@ -1,2 +1,2 @@
    13.4 -DuplicateResourceDecl.java:12:56: compiler.err.already.defined: c, main(java.lang.String[])
    13.5 +DuplicateResourceDecl.java:12:56: compiler.err.already.defined: kindname.variable, c, kindname.method, main(java.lang.String[])
    13.6  1 error
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/test/tools/javac/diags/examples/AlreadyDefinedClinit.java	Tue Sep 13 14:14:57 2011 +0100
    14.3 @@ -0,0 +1,31 @@
    14.4 +/*
    14.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.7 + *
    14.8 + * This code is free software; you can redistribute it and/or modify it
    14.9 + * under the terms of the GNU General Public License version 2 only, as
   14.10 + * published by the Free Software Foundation.
   14.11 + *
   14.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   14.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14.15 + * version 2 for more details (a copy is included in the LICENSE file that
   14.16 + * accompanied this code).
   14.17 + *
   14.18 + * You should have received a copy of the GNU General Public License version
   14.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   14.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   14.21 + *
   14.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   14.23 + * or visit www.oracle.com if you need additional information or have any
   14.24 + * questions.
   14.25 + */
   14.26 +
   14.27 +// key: compiler.err.already.defined.in.clinit
   14.28 +
   14.29 +class AlreadyDefinedClinit {
   14.30 +    static {
   14.31 +        int i;
   14.32 +        int i;
   14.33 +    }
   14.34 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/tools/javac/diags/examples/KindnameInstanceInit.java	Tue Sep 13 14:14:57 2011 +0100
    15.3 @@ -0,0 +1,37 @@
    15.4 +/*
    15.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 + *
    15.8 + * This code is free software; you can redistribute it and/or modify it
    15.9 + * under the terms of the GNU General Public License version 2 only, as
   15.10 + * published by the Free Software Foundation.
   15.11 + *
   15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.15 + * version 2 for more details (a copy is included in the LICENSE file that
   15.16 + * accompanied this code).
   15.17 + *
   15.18 + * You should have received a copy of the GNU General Public License version
   15.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.21 + *
   15.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   15.23 + * or visit www.oracle.com if you need additional information or have any
   15.24 + * questions.
   15.25 + */
   15.26 +
   15.27 +// key: compiler.err.already.defined.in.clinit
   15.28 +// key: compiler.misc.kindname.instance.init
   15.29 +// key: compiler.misc.kindname.class
   15.30 +// key: compiler.misc.kindname.variable
   15.31 +// key: compiler.misc.count.error
   15.32 +// key: compiler.err.error
   15.33 +// run: backdoor
   15.34 +
   15.35 +class KindnameInstanceInit {
   15.36 +    {
   15.37 +        int i;
   15.38 +        int i;
   15.39 +    }
   15.40 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/tools/javac/diags/examples/KindnameStaticInit.java	Tue Sep 13 14:14:57 2011 +0100
    16.3 @@ -0,0 +1,37 @@
    16.4 +/*
    16.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 + *
    16.8 + * This code is free software; you can redistribute it and/or modify it
    16.9 + * under the terms of the GNU General Public License version 2 only, as
   16.10 + * published by the Free Software Foundation.
   16.11 + *
   16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.15 + * version 2 for more details (a copy is included in the LICENSE file that
   16.16 + * accompanied this code).
   16.17 + *
   16.18 + * You should have received a copy of the GNU General Public License version
   16.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.21 + *
   16.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   16.23 + * or visit www.oracle.com if you need additional information or have any
   16.24 + * questions.
   16.25 + */
   16.26 +
   16.27 +// key: compiler.err.already.defined.in.clinit
   16.28 +// key: compiler.misc.kindname.static.init
   16.29 +// key: compiler.misc.kindname.class
   16.30 +// key: compiler.misc.kindname.variable
   16.31 +// key: compiler.misc.count.error
   16.32 +// key: compiler.err.error
   16.33 +// run: backdoor
   16.34 +
   16.35 +class KindnameStaticInit {
   16.36 +    static {
   16.37 +        int i;
   16.38 +        int i;
   16.39 +    }
   16.40 +}
    17.1 --- a/test/tools/javac/generics/6910550/T6910550d.out	Mon Sep 12 11:40:07 2011 -0700
    17.2 +++ b/test/tools/javac/generics/6910550/T6910550d.out	Tue Sep 13 14:14:57 2011 +0100
    17.3 @@ -1,2 +1,2 @@
    17.4 -T6910550d.java:12:14: compiler.err.already.defined: <X>m(X), T6910550d
    17.5 +T6910550d.java:12:14: compiler.err.already.defined: kindname.method, <X>m(X), kindname.class, T6910550d
    17.6  1 error

mercurial