RFR: 8262913: KlassFactory::create_from_stream should never return NULL [v2]
Coleen Phillimore
coleenp at openjdk.java.net
Tue Mar 9 14:32:36 UTC 2021
> 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.
Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
Replace equals with contains, suggested by hseigel.
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2892/files
- new: https://git.openjdk.java.net/jdk/pull/2892/files/27e9994d..88166bea
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2892&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2892&range=00-01
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/2892.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2892/head:pull/2892
PR: https://git.openjdk.java.net/jdk/pull/2892
More information about the hotspot-dev
mailing list