Throwable not thrown. In sun.reflect.generics.parser.SignatureParser#parseBounds
David Holmes
david.holmes at oracle.com
Fri Oct 8 01:07:13 UTC 2021
On 8/10/2021 6:10 am, Andrey Turbanov wrote:
> Hello.
>
> I found suspicious code in the method
> sun.reflect.generics.parser.SignatureParser#parseBounds
> https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/sun/reflect/generics/parser/SignatureParser.java#L532
>
> Method 'error' called without 'throw'. And the returned value is just ignored.
>
> error("Bound expected");
>
> Current method implementation creates and returns GenericSignatureFormatError.
>
> private Error error(String errorMsg) {
> return new GenericSignatureFormatError("Signature Parse error: " +
> errorMsg +
> "\n\tRemaining input: " +
> remainder());
> }
>
> I believe it's supposed to be thrown:
>
> throw error("Bound expected");
Or given the comment on error():
// Currently throws a GenericSignatureFormatError.
perhaps the intent was for error() to actually do the throwing.
Obviously missing test coverage here too.
Cheers,
David
>
>
> Andrey Turbanov
>
More information about the core-libs-dev
mailing list