java-decompiler/jd-core

Access to super default method is missing type name

Marcono1234 opened this issue · 0 comments

Version

1.1.3+, Commit 7f01508

Description

When calling the default implementation of an implemented interface the access must occur using TypeName.super.methodName(), simply using super.methodName() is invalid:

If the form is super.[TypeArguments]Identifier [...] It is a compile-time error if T is the class Object or T is an interface.

Source: JLS 15.12.1

However, jd-core does not emit the type name.

Source:

interface SuperMemberAccess {
    interface Base {
        default void test() { }
    }
    
    public static class A implements Base {
        @Override
        public void test() {
            // Must use TypeName.super.methodName()
            Base.super.test();
        }
    }
}

Decompiled output:

interface SuperMemberAccess {
    public static interface Base {
        default void test() {}
    }
    
    public static class A implements Base {
        public void test() {
            // This is not valid and will not compile
            super.test();
        }
    }
}