RFR: JMC-7090: [JFR Writer] Make constant pool optional when registering a new type [v3]

Jaroslav Bachorik jbachorik at openjdk.java.net
Tue Jan 19 10:55:00 UTC 2021


On Mon, 18 Jan 2021 20:29:44 GMT, Alexander Kuznetsov <github.com+13893590+AlexVanGogen at openjdk.org> wrote:

>> Jaroslav Bachorik has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Actually run the flightrecorder.writer tests
>
> core/org.openjdk.jmc.flightrecorder.writer/src/main/java/org/openjdk/jmc/flightrecorder/writer/TypesImpl.java line 151:
> 
>> 149: 	@Override
>> 150: 	public TypeImpl getOrAdd(Predefined type, Consumer<TypeStructureBuilder> builderCallback) {
>> 151: 		return getOrAdd(type.getTypeName(), false, builderCallback);
> 
> Just curious, why `withConstantPool` is `false` by default? It alters the previous solution where every jdk type except `jdk.types.Event` was considered to have constant pool, thus causing `ChunkComplexTest` to fail here: https://github.com/openjdk/jmc/blob/2b1af4140b207411a08fde5467b94d86333c1f4a/core/org.openjdk.jmc.flightrecorder.writer/src/test/java/org/openjdk/jmc/flightrecorder/writer/ChunkComplexTest.java#L130
> Without falling to constant pool, stack traces and stack frames are written in-place, and since `classLoader` is not specified in test, NPE is thrown:
> https://github.com/openjdk/jmc/blob/2b1af4140b207411a08fde5467b94d86333c1f4a/core/org.openjdk.jmc.flightrecorder.writer/src/main/java/org/openjdk/jmc/flightrecorder/writer/TypedValueImpl.java#L133

@AlexVanGogen Thanks for catching that. I didn't realize the tests were not running because of JUnit 5.
I have fixed the tests as well as the invalid default value.

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

PR: https://git.openjdk.java.net/jmc/pull/200


More information about the jmc-dev mailing list