RFR: 8259235: javac crashes while attributing super method invocation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8259235: javac crashes while attributing super method invocation

Jan Lahoda-3
Code like:
public class SuperMethodCallBroken extends Undef implements I {
    public void test() {
        I.super.test();
    }
}
interface I {
    public default void test() {}
}

crashes javac. The reason is that when `I.super` is being attributed, the interfaces of the enclosing class are pruned to remove subtypes - but `Undef` is erroneous and is a subtype of every type. So `I` is removed from the list of interfaces to check, and javac crashes then.

The proposed fix is to ignore erroneous supertypes when looking for subtypes.

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

Commit messages:
 - 8259235: javac crashes while attributing super method invocation

Changes: https://git.openjdk.java.net/jdk/pull/1945/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1945&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8259235
  Stats: 18 lines in 3 files changed: 17 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1945.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1945/head:pull/1945

PR: https://git.openjdk.java.net/jdk/pull/1945
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8259235: javac crashes while attributing super method invocation

Vicente Romero-3
On Tue, 5 Jan 2021 16:47:26 GMT, Jan Lahoda <[hidden email]> wrote:

> Code like:
> public class SuperMethodCallBroken extends Undef implements I {
>     public void test() {
>         I.super.test();
>     }
> }
> interface I {
>     public default void test() {}
> }
>
> crashes javac. The reason is that when `I.super` is being attributed, the interfaces of the enclosing class are pruned to remove subtypes - but `Undef` is erroneous and is a subtype of every type. So `I` is removed from the list of interfaces to check, and javac crashes then.
>
> The proposed fix is to ignore erroneous supertypes when looking for subtypes.

looks good

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

Marked as reviewed by vromero (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/1945
Reply | Threaded
Open this post in threaded view
|

Integrated: 8259235: javac crashes while attributing super method invocation

Jan Lahoda-3
In reply to this post by Jan Lahoda-3
On Tue, 5 Jan 2021 16:47:26 GMT, Jan Lahoda <[hidden email]> wrote:

> Code like:
> public class SuperMethodCallBroken extends Undef implements I {
>     public void test() {
>         I.super.test();
>     }
> }
> interface I {
>     public default void test() {}
> }
>
> crashes javac. The reason is that when `I.super` is being attributed, the interfaces of the enclosing class are pruned to remove subtypes - but `Undef` is erroneous and is a subtype of every type. So `I` is removed from the list of interfaces to check, and javac crashes then.
>
> The proposed fix is to ignore erroneous supertypes when looking for subtypes.

This pull request has now been integrated.

Changeset: 6d3c858c
Author:    Jan Lahoda <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/6d3c858c
Stats:     18 lines in 3 files changed: 17 ins; 0 del; 1 mod

8259235: javac crashes while attributing super method invocation

Reviewed-by: vromero

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

PR: https://git.openjdk.java.net/jdk/pull/1945