Throwable not thrown. In sun.reflect.generics.parser.SignatureParser#parseBounds

Andrey Turbanov turbanoff at gmail.com
Thu Oct 7 20:10:13 UTC 2021


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");



Andrey Turbanov


More information about the core-libs-dev mailing list