[code-reflection] RFR: Concat Transform Optimizations [v5]
    Paul Sandoz 
    psandoz at openjdk.org
       
    Thu Jun 27 18:13:34 UTC 2024
    
    
  
On Thu, 27 Jun 2024 17:35:46 GMT, Ian Graves <igraves at openjdk.org> wrote:
>> Updates to the transformation on Concats to StringBuilder that reduce redundant "new" StringBuilders while respecting correctness.
>
> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Renaming some tests and adding additional coverage for side-effects in StringBuilder
test/jdk/java/lang/reflect/code/TestStringConcatTransform.java line 141:
> 139:     //Testing to make sure StringBuilders aren't caught up in the concat transformation
> 140:     @Test
> 141:     public void testStringBuilderUnchanged() {
Much of this test and the previous can share code. Refactor into a shared method that accepts the `Method` instance and its arguments. For this test case you can assert that the string builder has not been mutated afterwards e.g.,
    @Test
    public void testStringBuilderUnchanged() {
        Method method;
        // ... get method
        StringBuilder sb = new StringBuilder("test")
        testStringConcat(method, new Object[] {"Foo", "Bar", sb});
        Assert.assertEquals(sb, "test");
    }
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/149#discussion_r1657576238
    
    
More information about the babylon-dev
mailing list