Can a public annotation be excluded from byte-codec compatible interfaces?

When looking at SO questions, I came by definition Runnable:

@FunctionalInterface
public interface Runnable {
    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see     java.lang.Thread#run()
     */
    public abstract void run();
}

As you can see, it has public abstractmethods in the definition that are superfluous and, as far as I know, should not be included in method declarations.

I expect the JDK team to see this and expects the reason will still be here.

Therefore, the question is, can deleting public abstractfrom interface declarations interrupt bytecode compatibility? Keep in mind that this Runnabletechnically should still work even with code written using JDK1.0 java code.

+4
1

, JLS Java 1. (, .)

JLS , .

AbstractMethodDeclaration:

    AbstractMethodModifiers opt ResultType MethodDeclarator Throwsopt ;

AbstractMethodModifiers:

    AbstractMethodModifier

    AbstractMethodModifiers AbstractMethodModifier

AbstractMethodModifier: one of

    public abstract

opt.

, , . Java , , , .

. , , .

-.

, , .

+5

Source: https://habr.com/ru/post/1542692/


All Articles