[PATCH] 8148100: Convert lambda most specific positive tests to check runtime behavior
Jonathan Gibbons
jonathan.gibbons at oracle.com
Sun Sep 18 01:11:14 UTC 2016
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