Integrated: 8262913: KlassFactory::create_from_stream should never return NULL

Coleen Phillimore coleenp at openjdk.java.net
Wed Mar 10 14:21:11 UTC 2021


On Tue, 9 Mar 2021 13:45:42 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> ClassFileParser.create_instance_klass cannot return NULL without a pending exception, it's called by 
>        klassFactory::create_from_stream who also cannot return NULL without a pending exception, it's called by
>        SystemDictionary::parse_stream and SystemDictionary::resolve_from_stream who also cannot return NULL without a pending exception.
> 
> I removed the NULL checks on returns from these 4 functions and either replaced them with an assert, or in cases that already had an unconditional indirection from the return value, just removed the null checks.
> 
> I wrote a test case to cover the case of testing st->buffer() == NULL which returned NULL from SystemDictionary::resolve_from_stream to show that this code path is not used. ClassFileStream constructor will set buffer() to the u1* input argument if it doesn't point to anything and will get a ClassFormatError.
> 
> Tested with tier1-3.

This pull request has now been integrated.

Changeset: 4d21a455
Author:    Coleen Phillimore <coleenp at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/4d21a455
Stats:     236 lines in 9 files changed: 191 ins; 16 del; 29 mod

8262913: KlassFactory::create_from_stream should never return NULL

Reviewed-by: hseigel, iklam

-------------

PR: https://git.openjdk.java.net/jdk/pull/2892


More information about the hotspot-dev mailing list