On Wed, 19 May 2021 11:05:06 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:
>> The primary problem was that key `compiler.err.dc.ref.bad.parens` had the >> wrong message "')' missing in reference". That error message is not used >> when the right parenthesis is missing, but when it occurs before the end of >> the signature. The missing parenthesis case is caught earlier by the parens >> balancing code in `DocCommentParser#reference` and uses message >> `compiler.err.dc.unterminated.signature` ("unterminated signature"). >> >> I changed the message for `compiler.err.dc.ref.bad.parens` to "unexpected >> parenthesis". >> >> A secondary problem was that `DocCommentParser#reference` also threw >> "unterminated signature" when there were too many closing angle brackets or >> parentheses. These cases are now passed through >> in`DocCommentParser#reference` so that `ReferenceParser#parse` can throw a >> more appropriate error ("unexpected parenthesis" or "unexpected input"). >> >> Here's a list of what references now cause what error messages: >> >> - `#foo(int` `unterminated signature` >> - `#foo((int))` `unexpected parenthesis` >> - `#foo(int))` `unexpected parenthesis` >> - `#foo(int)x` `unexpected parenthesis` >> - `F<T` `unterminated signature` >> - `F<T>>` `unexpected input` >> >> I added two new tests for the cases with too many closing brackets/parens >> that used to fail with "unterminated signature". > > Hannes Wallnöfer has updated the pull request incrementally with one > additional commit since the last revision: > > JDK-8264181: Change error message Thanks for updating the error message, Hannes. This PR adds tests for 2 out of 6 items from your list. I think it makes sense to ensure that the remaining 4 items are also tested. I can see that one more item is covered by the existing RefBadParens. That said, I couldn't find tests that cover these 3 cases: #foo(int #foo(int)x F<T ------------- PR: https://git.openjdk.java.net/jdk/pull/4068