Why, after compiling an interface, "default" method modifier is gone from "javap -v"?

Giorgi Tsiklauri

I have observed, that after compiling an interface containing default method definition, like:

interface Delta {

    default void someMethod() {
        System.out.println("Hi.");
    }

}

and after disassembling the respective .class file (including only corresponding snippet here):

javap -v Delta.class

####

{
  public void someMethod();
    descriptor: ()V
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=2, locals=1, args_size=1
         0: getstatic     #1                  // Field java/lang/System.out:Ljava/io/PrintStream;
         3: ldc           #2                  // String Hi.
         5: invokevirtual #3                  // Method java/io/PrintStream.println:(Ljava/lang/String;)V
         8: return
      LineNumberTable:
        line 10: 0
        line 11: 8
}

default modifier is gone.

Could anyone explain - why?

I am running:

openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

Note, that I am aware, that all methods are implicitly public, when no modifier is defined. So, I am not asking why public modifier is present in the compiled version of the file.

Eugene

Surely looks like a javap bug, see this defect. I've encountered a few more of these javap issues when new features where added, just FYI.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

why cannot we use default access modifier and abstract keyword together for a method in a interface?

Java 9 Interface : Why default Modifier Converted into public Modifier

Why cannot use this while calling static interface method from default interface method?

Call Method from default method in java interface

Why is it not allowed add toString() to interface as default method?

Why I can not create a default method in an interface?

Why are exceptions thrown from mocks gone when using method count?

Abstract modifier on interface method

Calling a default method from Interface in Main Class

Why need default after require() method in Vue?

Why is there no .o after compiling?

Interface covariance contravariance : why is this not compiling?

Why is a default interface method used instead of a class field?

Why isn't my object cast to interface not calling default method?

Why am I not able to use default method in interface?

Default Method in Interface - Java

Shadowing default method of an interface

default annotation for method of an interface

Default implementation of method in interface

Why are the macros gone after a user saves the spreadsheet?

Why are the colors of text gone after changing tabsize?

Default access modifier for interface methods in Java 9?

why Interface Default methods?

How to call default method from interface with TestNG tests and Selenium?

Extract Class from Parameterized Interface using default method

Access instance variables from default method in inner interface

Calling C# interface default method from implementing class

Using default interface method from SPI in versions prior to Java 8

Can you call the parent interface's default method from an interface that subclasses that interface?