RFR: 8364230: javax/swing/text/StringContent can be migrated away from using finalize [v2]

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Aug 6 05:47:03 UTC 2025


On Mon, 4 Aug 2025 21:11:42 GMT, Phil Race <prr at openjdk.org> wrote:

>> Convert StringContent's Position usage tracking to use a WeakReference
>> 
>> The test that is added only implicitly tests this but I added it because of a complete lack of any test for this code.
>
> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8364230

test/jdk/javax/swing/text/AbstractDocument/StringContentPositionTest.java line 33:

> 31:  */
> 32: 
> 33: public class StringContentPositionTest {

I believe @bug is not added because this is not strictly a regression test for this issue as I see it does not fail even without the fix?
Since `System.gc` is used, can we try restricting the heap size in commandline to see if it will fail without the fix and pass with it?

test/jdk/javax/swing/text/AbstractDocument/StringContentPositionTest.java line 54:

> 52:         for (int i = 0; i < SIZE; i++) {
> 53:             SC.insertString(0, TEXT);
> 54:             positions[i] = SC.createPosition(5);

should it be LEN instead of 5?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26519#discussion_r2255919971
PR Review Comment: https://git.openjdk.org/jdk/pull/26519#discussion_r2255917014


More information about the client-libs-dev mailing list