[PATCH] 8148100: Convert lambda most specific positive tests to check runtime behavior

B. Blaser bsrbnd at gmail.com
Sun Jan 8 12:43:22 UTC 2017


Fine, thanks!
Bernard

2017-01-05 20:32 GMT+01:00 Vicente Romero <vicente.romero at oracle.com>:
> pushed,
>
> Thanks,
> Vicente
>
>
> On 12/14/2016 09:50 AM, Vicente Romero wrote:
>>
>> Hi Bernard,
>>
>> Very sorry for the delay with your patch, I will take care of it,
>>
>> Vicente
>>
>> On 12/12/2016 04:40 AM, B. Blaser wrote:
>>>
>>> Hi,
>>> Does this patch need to be improved?
>>>
>>> Thanks,
>>> Bernard
>>>
>>> 2016-09-21 16:24 GMT+02:00 bsrbnd <bsrbnd at gmail.com>:
>>>>
>>>> Please find in attachment an all-in-one patch for the 9 tests, as
>>>> discussed previously.
>>>>
>>>> Bernard
>>>>
>>>>
>>>> 2016-09-19 16:01 GMT+02:00 bsrbnd <bsrbnd at gmail.com>:
>>>>>
>>>>> Thanks for your advices.
>>>>>
>>>>> I re-wrote, below, the patch in a more compliant way (I hope).
>>>>> I'll perhaps (probably) also go through the 8 others soon, if I have
>>>>> time...
>>>>>
>>>>> Bernard
>>>>>
>>>>> diff --git a/test/tools/javac/lambda/MostSpecific10.java
>>>>> b/test/tools/javac/lambda/MostSpecific10.java
>>>>> --- a/test/tools/javac/lambda/MostSpecific10.java
>>>>> +++ b/test/tools/javac/lambda/MostSpecific10.java
>>>>> @@ -25,9 +25,12 @@
>>>>>    * @test
>>>>>    * @bug 8034223
>>>>>    * @summary Structural most-specific logic for lambdas, method refs,
>>>>> parens, and conditionals
>>>>> - * @compile MostSpecific10.java
>>>>>    */
>>>>> -class MostSpecific10 {
>>>>> +public class MostSpecific10 {
>>>>> +
>>>>> +    public static void main(String[] args) {
>>>>> +        new MostSpecific10().test(true);
>>>>> +    }
>>>>>
>>>>>       interface GetInt {
>>>>>           int get();
>>>>> @@ -38,7 +41,9 @@
>>>>>       }
>>>>>
>>>>>       void m(GetInt getter) {}
>>>>> -    void m(GetInteger getter) {}
>>>>> +    void m(GetInteger getter) {
>>>>> +        throw new RuntimeException("Less-specific method invocation:
>>>>> " + getter.getClass());
>>>>> +    }
>>>>>
>>>>>       void test(boolean cond) {
>>>>>           m(() -> 23);
>>>>>
>>>>>
>>>>> 2016-09-18 3:11 GMT+02:00 Jonathan Gibbons
>>>>> <jonathan.gibbons at oracle.com>:
>>>>>>
>>>>>> Bernard,
>>>>>>
>>>>>> Thanks for posting this patch.
>>>>>>
>>>>>> It's not wrong to say it explicitly, but the addition of the "@run
>>>>>> main"
>>>>>> line is unnecessary, since that is the default behavior once you
>>>>>> remove the
>>>>>> @compile.
>>>>>>
>>>>>> The replacement for void m(GetInteger getter) should be formatted in a
>>>>>> more
>>>>>> standard manner.
>>>>>>
>>>>>> It's more common to put the main method at the head of a test, instead
>>>>>> of at
>>>>>> the end.
>>>>>>
>>>>>> We can't check in "partial patches", so either you have to look at the
>>>>>> 8
>>>>>> other tests and fix them all together, or we have to accept this one
>>>>>> change
>>>>>> as a "complete" fix for 8148100, and open a new, different issue for
>>>>>> the 8
>>>>>> other tests. (The OpenJDK rules only permit one changeset per issue
>>>>>> per
>>>>>> repo,)
>>>>>>
>>>>>> -- Jon
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 9/17/16 10:16 AM, bsrbnd wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I just wrote a partial patch for issue 8148100.
>>>>>>> This is an updated version of
>>>>>>> test/tools/javac/lambda/MostSpecific10.java that verifies if the
>>>>>>> most-specific method is run with respect to JLS 15.12.2 (and also as
>>>>>>> explained in the issue description).
>>>>>>> I've not checked the 8 other tests yet...
>>>>>>>
>>>>>>> Regards,
>>>>>>> Bernard
>>>>>>>
>>>>>>> diff --git a/test/tools/javac/lambda/MostSpecific10.java
>>>>>>> b/test/tools/javac/lambda/MostSpecific10.java
>>>>>>> --- a/test/tools/javac/lambda/MostSpecific10.java
>>>>>>> +++ b/test/tools/javac/lambda/MostSpecific10.java
>>>>>>> @@ -26,8 +26,9 @@
>>>>>>>     * @bug 8034223
>>>>>>>     * @summary Structural most-specific logic for lambdas, method
>>>>>>> refs,
>>>>>>> parens, and conditionals
>>>>>>>     * @compile MostSpecific10.java
>>>>>>> + * @run main MostSpecific10
>>>>>>>     */
>>>>>>> -class MostSpecific10 {
>>>>>>> +public class MostSpecific10 {
>>>>>>>
>>>>>>>        interface GetInt {
>>>>>>>            int get();
>>>>>>> @@ -38,7 +39,7 @@
>>>>>>>        }
>>>>>>>
>>>>>>>        void m(GetInt getter) {}
>>>>>>> -    void m(GetInteger getter) {}
>>>>>>> +    void m(GetInteger getter) {throw new
>>>>>>> RuntimeException("Less-specific method invocation: " +
>>>>>>> getter.getClass());}
>>>>>>>
>>>>>>>        void test(boolean cond) {
>>>>>>>            m(() -> 23);
>>>>>>> @@ -50,5 +51,9 @@
>>>>>>>            m(cond ? (() -> 23) : ("abc"::length) );
>>>>>>>            m(( cond ? () -> 23 : cond ? ("abc"::length) : (() -> 23)
>>>>>>> ));
>>>>>>>        }
>>>>>>> +
>>>>>>> +    public static void main(String[] args) {
>>>>>>> +        new MostSpecific10().test(true);
>>>>>>> +    }
>>>>>>>
>>>>>>>    }
>>>>>>
>>>>>>
>>
>


More information about the compiler-dev mailing list