Annotate semanticException factories as format methods#15963
Annotate semanticException factories as format methods#15963ksobolew wants to merge 3 commits intotrinodb:masterfrom
Conversation
There was a problem hiding this comment.
is it because one @FormatMethod cannot delegate to other @FormatMethod?
if so, seems like error-prone's bug to me
There was a problem hiding this comment.
It can, but looks like it gets confused by them being different types. I wasn't sure if this is a bug or a weird corner case.
There was a problem hiding this comment.
it doesn't look like we were doing anything wrong here
There was a problem hiding this comment.
The actual message is:
java: [FormatStringAnnotation] The format argument types passed with an @FormatString must match the types of the format arguments in the @FormatMethod header where the format string was declared.
Format arg types passed: [io.trino.spi.type.Type, io.trino.spi.type.Type]
Format arg types expected: [io.trino.sql.tree.Expression, io.trino.sql.tree.Expression]
Thing is, the message is the same but the message arguments passed to semanticException are not the same as the parameters of the enclosing method. So it kinda sorta makes sense?
e085a75 to
96fec41
Compare
|
|
96fec41 to
024dee9
Compare
|
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
This method is unusual in that it takes a error message as a format string and exactly two arguments; the annotation will make sure that the format string will also be valid for exactly two arguments.
This makes it consistent with the rest of the method, where all the error messages have the property name.
This annotation allows more cases to be checked by the `FormatStringAnnotation` checker. Fixes up all the trivial cases where they can be used as a format methods but weren't.
024dee9 to
cc1c2ce
Compare
|
Pushed an update with some fresh specimens from a recent large merge. |
Description
This annotation allows more cases to be checked by the
FormatStringAnnotationchecker. Fixes up all the trivial cases where they can be used as a format methods but weren't.Additional context and related issues
Extracted from #14933.
Release notes
(x) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: