RFR: 8342782: AWTEventMulticaster throws StackOverflowError using AquaButtonUI [v5]
Laurent Bourgès
lbourges at openjdk.org
Wed Dec 4 23:40:46 UTC 2024
On Sun, 24 Nov 2024 08:10:28 GMT, Jeremy <duke at openjdk.org> wrote:
>> src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java line 991:
>>
>>> 989: while (true) {
>>> 990: if (++level > 500)
>>> 991: return true;
>>
>> our coding standards require that you always include the body in { .. }
>
> @prrace : I added { .. }
>
> @bourgesl : I'm struggling to define this as a constant in a helpful way. Is there an example of a similar constant somewhere in the codebase you could refer me to for comparison?
>
> I think part of my challenge here is the AWTEventMulticaster doesn't promise to be any particular kind of tree. (For example: if it promised it was a self-balancing tree, then we'd know what our obligations were to meet that expectation.)
>
> This PR's implementation is intended to be a fast heuristic/educated guess, but it does not scan the entire height of the left or right node. This makes it ... hard for me to name.
>
> (Relatedly: the value 500 is arbitrary, and I'm happy to change it if someone would rather it be closer to 50 or 1000.)
Here is a constant declaration (hotspot friendly):
https://github.com/bourgesl/jdk-official/blob/d0b770c938be6b5b3a0176148265ef33184a9b8b/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java#L38
private static final int ALL_BUT_LSB = 0xFFFFFFFE;
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21962#discussion_r1855397860
More information about the client-libs-dev
mailing list