JDK 9 RFR of JDK-8162539: Test fails because it expects a blank between method signature and throws exception

joe darcy joe.darcy at oracle.com
Tue Jul 26 19:36:13 UTC 2016

Hi Coleen,

The existing tests covered *toGenericString* output with a throws 
clauses but omitted coverage of *toString* methods with a throws clause. 
That let the omission of the space character in toString output slip 

(There is some logically duplicated structure in the implementations of 
the toString and toGenericString methods.)

On the core libs side, I believe there weren't any regression tests of 
the toString output  of core reflection objects until the 
toGenericString methods were added in JDK 5. That is one reason the test 
are weighted toward toGenericString since the tests were added for that 



On 7/26/2016 12:23 PM, Coleen Phillimore wrote:
> Thank you for fixing this so quickly.  This looks good but I have a 
> question about:
> http://cr.openjdk.java.net/~darcy/8162539.0/test/java/lang/reflect/Constructor/GenericStringTest.java.udiff.html
>       @ExpectedGenericString(
>      "protected <S,T> TestClass1(S,T) throws java.lang.Exception")
> + @ExpectedString(
> + "protected TestClass1(java.lang.Object,java.lang.Object) throws 
> java.lang.Exception")
>       protected <S, T> TestClass1(S s, T t) throws Exception{}
> I can't really read the metaprogramming but why didn't the existing 
> @Expected{Generic}String strings here find the problem?
> thanks,
> Coleen
> On 7/26/16 3:08 PM, joe darcy wrote:
>> Hello,
>> Please review the changes to address
>>     JDK-8162539: Test fails because it expects a blank between method 
>> signature and throws exception
>> http://cr.openjdk.java.net/~darcy/8162539.0/
>> In brief, recent refactorings of the toString output in core 
>> reflection (JDK-8161500 Use getTypeName and StringJoiner in core 
>> reflection generic toString methods) omitted a space character 
>> between the closing ")" and "throws" for toString output, but 
>> correctly included the space in toGenericString output.
>> The simple fix is to add the space character; regression tests are 
>> suitably augmented and slightly refactored.
>> Thanks,
>> -Joe

More information about the core-libs-dev mailing list