-
Bug
-
Resolution: Fixed
-
P4
-
18, 19, 20
-
b23
as reported in compiler-dev:
Please consider this trivial code:
public record Record {
}
Trying to compile this results in:
javac Record.java
Record.java:1: error: record header expected
public record Record {
^
1 error
It isn't too clear what that error message means. It took me a while to realize that I had missed using the () after the record's name. Changing the source to:
public record Record() {
}
is what the error was trying to convey. Could this error message be improved?
By the way, notice that the error message was pointing to the "r" letter of the "record" keyword with the ^ sign. Is that right place for this error or should it have been after the "d" of the "Record" name, similar to what appears to be reported for constructors of classes, for example:
public class Event {
public Event {
}
}
javac Event.java
Event.java:2: error: <identifier> expected
public Event {
^
1 error
(not sure if mail clients will preserve the spacing - that ^ appears between the "t" and the "{")
see: https://mail.openjdk.org/pipermail/compiler-dev/2022-September/020420.html
Please consider this trivial code:
public record Record {
}
Trying to compile this results in:
javac Record.java
Record.java:1: error: record header expected
public record Record {
^
1 error
It isn't too clear what that error message means. It took me a while to realize that I had missed using the () after the record's name. Changing the source to:
public record Record() {
}
is what the error was trying to convey. Could this error message be improved?
By the way, notice that the error message was pointing to the "r" letter of the "record" keyword with the ^ sign. Is that right place for this error or should it have been after the "d" of the "Record" name, similar to what appears to be reported for constructors of classes, for example:
public class Event {
public Event {
}
}
javac Event.java
Event.java:2: error: <identifier> expected
public Event {
^
1 error
(not sure if mail clients will preserve the spacing - that ^ appears between the "t" and the "{")
see: https://mail.openjdk.org/pipermail/compiler-dev/2022-September/020420.html