-
Notifications
You must be signed in to change notification settings - Fork 593
java: append correct literal suffix for map keys/values constraints #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java: append correct literal suffix for map keys/values constraints #294
Conversation
581f658
to
7aa38cf
Compare
Without specific handling for maps in `javaTypeLiteralSuffixFor`, no literal suffix was ever appended, resulting in compilation error in the validator for constraints on (Java) long, float or double. This commit mimics the structure of `javaTypeFor` to infer the suffix based on whether keys or values are targeted. Signed-off-by: Brice Jaglin <[email protected]>
7aa38cf
to
6769053
Compare
Excellent find! Is it possible to make a test case that verifies the generated Java compiles? |
@@ -17,7 +17,7 @@ message MapNoSparse { | |||
message Msg {} | |||
} | |||
|
|||
message MapKeys { map<sint32, string> val = 1 [(validate.rules).map.keys.sint32.lt = 0]; } | |||
message MapKeys { map<sint64, string> val = 1 [(validate.rules).map.keys.sint64.lt = 0]; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmichela this triggers a compilation error on pgv-java-validation
without the fix - did you have another specific test case in mind?
Is there anything else I can do to get this in? Also, what's the (maven central) release policy? In other words, when can I roughly expect this fix to land in a released JAR? Thanks in advance! |
@rodaine I'd like to do a java release to get this bugfix in. Is that OK with you? |
I suspect the build failure is related to #290 |
Next step. Release a dot release of the java libs. |
Hi @rmichela, any update on cutting a patch release? Thanks! |
@bjaglin Sorry that took three months to release, but it's out. https://github.com/envoyproxy/protoc-gen-validate/releases/tag/v0.3.0-java |
@rmichela thanks! |
…ufbuild#294) Without specific handling for maps in `javaTypeLiteralSuffixFor`, no literal suffix was ever appended, resulting in compilation error in the validator for constraints on (Java) long, float or double. This commit mimics the structure of `javaTypeFor` to infer the suffix based on whether keys or values are targeted. Signed-off-by: Brice Jaglin <[email protected]> Co-authored-by: Ryan Michela <[email protected]> Signed-off-by: Maxim Chechel <[email protected]>
Without specific handling for maps in
javaTypeLiteralSuffixFor
, no literal suffix was ever appended, resulting in compilation error in the validator for constraints on (Java) long, float or double. This commit mimics the structure ofjavaTypeFor
to infer the suffix based on whether keys or values are targeted.