tisonkun commented on issue #16912: URL: https://github.com/apache/pulsar/issues/16912#issuecomment-1208848484
I draft an incompleted patch on #16997. However, I notice that there's some code we hack in "set final" field, like: https://github.com/apache/pulsar/blob/21634edd30bbe33d231ec73e8045d7666a8ad366/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerTest.java#L1071-L1072 .. or even "set static final" field, like: https://github.com/apache/pulsar/blob/21634edd30bbe33d231ec73e8045d7666a8ad366/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/thread/ThreadRuntimeFactoryTest.java#L111 It seems `powermock-reflect` is the better library existing to handle these cases since JDK12+ it's banned changing `final` field instead you have to use `Unsafe`. I tend not to maintain such unsafe hacks within Pulsar codebase. And perhaps we should gradually refactor code to avoid depending on such manners. cc @Shoothzj @eolivelli -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
