wang-xinhong / protobuf

Automatically exported from code.google.com/p/protobuf
Other
0 stars 0 forks source link

protoc does not warn for Java keyword "super" #676

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Be mindless and forget that super is a keyword and try to use it as an enum 
identifier.
2. Create protofile:
enum SuperEnum {
  super = 1;
}

message SuperMessage {
  required SuperEnum super = 1;
}

3. compile with protoc
4. compile with javac
5. Get confused, because a moment ago before some copy and paste acrobatics, 
everything worked just fine and the cause is obfuscated by unrelated errors.

What is the expected output? What do you see instead?
protoc should warn or deny to use identifier "super", instead it does not show 
any warning.

javac does not compile with error
SuperEnumMessage.java:13: error: <identifier> expected
      implements com.google.protobuf.ProtocolMessageEnum {
and tons of subsequent errors.

What version of the product are you using? On what operating system?
protoc 2.5.0, java hotspot 1.8.0_25, Linux 64-bit

Original issue reported on code.google.com by klocksve...@gmail.com on 21 Oct 2014 at 7:32