-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b08
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2213949 | 7u4 | Dmeetry Degrave | P3 | Closed | Fixed | b06 |
An error message that is supposed to print a method name instead prints 'null' when the error occurs inside of an initializer block.
public class InitializerError {
int foo() {
String s = "x";
String s = "y";
}
static int bar() {
String s = "x";
String s = "y";
}
{
String s = "x";
String s = "y";
}
static {
String s = "x";
String s = "y";
}
}
Output:
InitializerError.java:5: error: s is already defined in foo()
String s = "y";
^
InitializerError.java:10: error: s is already defined in bar()
String s = "y";
^
InitializerError.java:15: error: s is already defined in null
String s = "y";
^
InitializerError.java:20: error: s is already defined in null
String s = "y";
^
4 errors
In javac 6, the error message was different, but also bad -- it used an empty string as the method name.
public class InitializerError {
int foo() {
String s = "x";
String s = "y";
}
static int bar() {
String s = "x";
String s = "y";
}
{
String s = "x";
String s = "y";
}
static {
String s = "x";
String s = "y";
}
}
Output:
InitializerError.java:5: error: s is already defined in foo()
String s = "y";
^
InitializerError.java:10: error: s is already defined in bar()
String s = "y";
^
InitializerError.java:15: error: s is already defined in null
String s = "y";
^
InitializerError.java:20: error: s is already defined in null
String s = "y";
^
4 errors
In javac 6, the error message was different, but also bad -- it used an empty string as the method name.
- backported by
-
JDK-2213949 Error message bug: name of initializer is 'null'
-
- Closed
-
- relates to
-
JDK-8052070 javac crashes when there are duplicated type parameters
-
- Closed
-