Check Java9 Interface private methods

Private method can be defined in Interface in Java9

It became. When default was added in Java8, the problem of diamond inheritance often appeared, so I was curious, so I will check it.

result

--Implementation classes cannot call Interface private methods, just as superclass private methods cannot be called. --Interface private method requires entity --This will happen →![Java: Method body is missing or declared as abstract](https://qiita-image-store.s3.amazonaws.com/0/48666/784afbda-fd6f-3041-e167- bc4ea96984a2.png) --From the above, it cannot be used together with default, which also requires an entity. --This is →![java: The combination of modifiers private and default is invalid](https://qiita-image-store.s3.amazonaws.com/0/48666/508efe96-9bd7-5d24-6fb7-395c76d6019b. png) --There is no need to consider multiple inheritance, hiding, and overriding for methods that cannot be referenced from the above.

Conclusion

It is considered to be a function for creating a helper method within the same Interface. At least it's not something you use for coercion to implement private methods or template method patterns. If you think about it, you mentioned it a long time ago. → Java Interface Memo (Hishidama's Java Interface Memo) #Interface private method

Sample class structure

キャプチャ.PNG

Sample code

SampleInterfaceA.java


public interface SampleInterfaceA {
    /**The usual.*/
    String get();
    /**Explicit usual.*/
    public abstract String getDetail();
    /**default method.*/
    default String getDefault() {return "default IA";}
    /**A static guy.*/
    static String getStatic() {return "static IA";}
//This is no good
//    /**A private guy.*/
//    private String getPrivate();
    /**private static guy.*/
    private static String getPrivateStatic() {return "private static IA";}
//This is also useless
//    /**A private default guy.*/
//    private default String getPrivateDefault() {return "private default";}
    /**A private guy.*/
    private String getPrivate() {return "private IA";}
    /**As usual, consider detailed signatures.*/
    String getException() throws IOException;
    /**Private and detailed signature examination.*/
    private String getPrivateException() throws IOException {return "private Exception IA";}
}

SampleInterfaceB.java


public interface SampleInterfaceB {
    String get();
    public abstract String getDetail();
    default String getDefault() {return "default IB";}
    static String getStatic() {return "static IB";}
    private static String getPrivateStatic() {return "private static IB";}
    private String getPrivate() {return "private IB";}
//This is a bad guy from the beginning
//    String getException() throws NoClassDefFoundError;
    private String getPrivateException() throws NoClassDefFoundError {return "private Exception IA";}
}

ImplementA.java


public class ImplementA implements SampleInterfaceA {
    @Override
    public String get() {return "public XA";}
    @Override
    public String getDetail() {return "public detail XA";}
    @Override
    public String toString() {
        try {
            return "ImplementA["
                    + this.get() + "\n"
                    + this.getDetail() + "\n"
                    + this.getDefault() + "\n"
                    + this.getException() + "\n"
                    + SampleInterfaceA.getStatic() + "\n"
//Interface private cannot be called from the implementation class
//                    + super.getPrivate() + "\n"
//                    + SampleInterfaceA.getPrivateStatic() + "\n"
                    + this.getPrivate() + "\n"
                    + super.toString()
                    + "]";
        } catch (Exception e) {
            return "Okinai";
        }
    }

    @Override
    public String getException() throws IOException {return "public Exception XA";}
//Of course, Override annotation cannot be added.
//    @Override
    private String getPrivate() {return "private XA";}
}

ExtendsAImplementB.java


public class ExtendsAImplementB extends ImplementA implements SampleInterfaceB {
    // SampleInterfaceA#get()Is SampleInterfaceB#get()Since it has the same signature as, the parent class implementation is applied
    @Override
    public String getDefault() {
        return "public default extends XAB";
    }
    // SampleInterfaceA#getPrivate()And SampleInterfaceB#getPrivate()Does not conflict
    // SampleInterfaceA#getException()And SampleInterfaceB#getException()Does not conflict
}

TestInterface.java


public class TestInterface {
    public static void main(String... args) {
        System.out.println(new ImplementA());
        System.out.println();
        System.out.println(new ExtendsAImplementB());
    }
}

Sample execution result

ImplementA[public XA
public detail XA
default IA
public Exception XA
static IA
private XA
co.jp.qualysite.qm.java9.exam.privateInterface.ImplementA@13b6d03]

ImplementA[public XA
public detail XA
public default extends XAB
public Exception XA
static IA
private XA
co.jp.qualysite.qm.java9.exam.privateInterface.ExtendsAImplementB@783e6358]

Process finished with exit code 0

Sample javap results

SampleInterfaceA.dec.txt


  Last modified 2017/10/04; size 853 bytes
  MD5 checksum 43c60e1b8af3c04d6cbf41b17a047927
  Compiled from "SampleInterfaceA.java"
public interface co.jp.qualysite.qm.java9.exam.privateInterface.SampleInterfaceA
  minor version: 0
  major version: 53
  flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
  this_class: #6                          // co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA
  super_class: #7                         // java/lang/Object
  interfaces: 0, fields: 0, methods: 8, attributes: 1
Constant pool:
   #1 = String             #26            // default IA
   #2 = String             #27            // static IA
   #3 = String             #28            // private static IA
   #4 = String             #29            // private IA
   #5 = String             #30            // private Exception IA
   #6 = Class              #31            // co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA
   #7 = Class              #32            // java/lang/Object
   #8 = Utf8               get
   #9 = Utf8               ()Ljava/lang/String;
  #10 = Utf8               getDetail
  #11 = Utf8               getDefault
  #12 = Utf8               Code
  #13 = Utf8               LineNumberTable
  #14 = Utf8               LocalVariableTable
  #15 = Utf8               this
  #16 = Utf8               Lco/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA;
  #17 = Utf8               getStatic
  #18 = Utf8               getPrivateStatic
  #19 = Utf8               getPrivate
  #20 = Utf8               getException
  #21 = Utf8               Exceptions
  #22 = Class              #33            // java/io/IOException
  #23 = Utf8               getPrivateException
  #24 = Utf8               SourceFile
  #25 = Utf8               SampleInterfaceA.java
  #26 = Utf8               default IA
  #27 = Utf8               static IA
  #28 = Utf8               private static IA
  #29 = Utf8               private IA
  #30 = Utf8               private Exception IA
  #31 = Utf8               co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA
  #32 = Utf8               java/lang/Object
  #33 = Utf8               java/io/IOException
{
  public abstract java.lang.String get();
    descriptor: ()Ljava/lang/String;
    flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT

  public abstract java.lang.String getDetail();
    descriptor: ()Ljava/lang/String;
    flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT

  public java.lang.String getDefault();
    descriptor: ()Ljava/lang/String;
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #1                  // String default IA
         2: areturn
      LineNumberTable:
        line 16: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA;

  public static java.lang.String getStatic();
    descriptor: ()Ljava/lang/String;
    flags: (0x0009) ACC_PUBLIC, ACC_STATIC
    Code:
      stack=1, locals=0, args_size=0
         0: ldc           #2                  // String static IA
         2: areturn
      LineNumberTable:
        line 20: 0

  private static java.lang.String getPrivateStatic();
    descriptor: ()Ljava/lang/String;
    flags: (0x000a) ACC_PRIVATE, ACC_STATIC
    Code:
      stack=1, locals=0, args_size=0
         0: ldc           #3                  // String private static IA
         2: areturn
      LineNumberTable:
        line 27: 0

  private java.lang.String getPrivate();
    descriptor: ()Ljava/lang/String;
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #4                  // String private IA
         2: areturn
      LineNumberTable:
        line 36: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA;

  public abstract java.lang.String getException() throws java.io.IOException;
    descriptor: ()Ljava/lang/String;
    flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT
    Exceptions:
      throws java.io.IOException

  private java.lang.String getPrivateException() throws java.io.IOException;
    descriptor: ()Ljava/lang/String;
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #5                  // String private Exception IA
         2: areturn
      LineNumberTable:
        line 42: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA;
    Exceptions:
      throws java.io.IOException
}
SourceFile: "SampleInterfaceA.java"

SampleInterfaceB.dec.txt


  Last modified 2017/10/03; size 831 bytes
  MD5 checksum ed3be9304a1489a8f0f77bb9e5657fe8
  Compiled from "SampleInterfaceB.java"
public interface co.jp.qualysite.qm.java9.exam.privateInterface.SampleInterfaceB
  minor version: 0
  major version: 53
  flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
  this_class: #6                          // co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceB
  super_class: #7                         // java/lang/Object
  interfaces: 0, fields: 0, methods: 7, attributes: 1
Constant pool:
   #1 = String             #25            // default IB
   #2 = String             #26            // static IB
   #3 = String             #27            // private static IB
   #4 = String             #28            // private IB
   #5 = String             #29            // private Exception IA
   #6 = Class              #30            // co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceB
   #7 = Class              #31            // java/lang/Object
   #8 = Utf8               get
   #9 = Utf8               ()Ljava/lang/String;
  #10 = Utf8               getDetail
  #11 = Utf8               getDefault
  #12 = Utf8               Code
  #13 = Utf8               LineNumberTable
  #14 = Utf8               LocalVariableTable
  #15 = Utf8               this
  #16 = Utf8               Lco/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceB;
  #17 = Utf8               getStatic
  #18 = Utf8               getPrivateStatic
  #19 = Utf8               getPrivate
  #20 = Utf8               getPrivateException
  #21 = Utf8               Exceptions
  #22 = Class              #32            // java/lang/NoClassDefFoundError
  #23 = Utf8               SourceFile
  #24 = Utf8               SampleInterfaceB.java
  #25 = Utf8               default IB
  #26 = Utf8               static IB
  #27 = Utf8               private static IB
  #28 = Utf8               private IB
  #29 = Utf8               private Exception IA
  #30 = Utf8               co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceB
  #31 = Utf8               java/lang/Object
  #32 = Utf8               java/lang/NoClassDefFoundError
{
  public abstract java.lang.String get();
    descriptor: ()Ljava/lang/String;
    flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT

  public abstract java.lang.String getDetail();
    descriptor: ()Ljava/lang/String;
    flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT

  public java.lang.String getDefault();
    descriptor: ()Ljava/lang/String;
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #1                  // String default IB
         2: areturn
      LineNumberTable:
        line 7: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceB;

  public static java.lang.String getStatic();
    descriptor: ()Ljava/lang/String;
    flags: (0x0009) ACC_PUBLIC, ACC_STATIC
    Code:
      stack=1, locals=0, args_size=0
         0: ldc           #2                  // String static IB
         2: areturn
      LineNumberTable:
        line 10: 0

  private static java.lang.String getPrivateStatic();
    descriptor: ()Ljava/lang/String;
    flags: (0x000a) ACC_PRIVATE, ACC_STATIC
    Code:
      stack=1, locals=0, args_size=0
         0: ldc           #3                  // String private static IB
         2: areturn
      LineNumberTable:
        line 13: 0

  private java.lang.String getPrivate();
    descriptor: ()Ljava/lang/String;
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #4                  // String private IB
         2: areturn
      LineNumberTable:
        line 16: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceB;

  private java.lang.String getPrivateException() throws java.lang.NoClassDefFoundError;
    descriptor: ()Ljava/lang/String;
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #5                  // String private Exception IA
         2: areturn
      LineNumberTable:
        line 21: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceB;
    Exceptions:
      throws java.lang.NoClassDefFoundError
}
SourceFile: "SampleInterfaceB.java"

ImplementA.dec.txt


  Last modified 2017/10/04; size 1789 bytes
  MD5 checksum 35cd13cc4e177ce294b094056750d7a2
  Compiled from "ImplementA.java"
public class co.jp.qualysite.qm.java9.exam.privateInterface.ImplementA implements co.jp.qualysite.qm.java9.exam.privateInterface.SampleInterfaceA
  minor version: 0
  major version: 53
  flags: (0x0021) ACC_PUBLIC, ACC_SUPER
  this_class: #16                         // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA
  super_class: #17                        // java/lang/Object
  interfaces: 1, fields: 0, methods: 6, attributes: 3
Constant pool:
   #1 = Methodref          #17.#39        // java/lang/Object."<init>":()V
   #2 = String             #40            // public XA
   #3 = String             #41            // public detail XA
   #4 = Methodref          #16.#42        // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA.get:()Ljava/lang/String;
   #5 = Methodref          #16.#43        // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA.getDetail:()Ljava/lang/String;
   #6 = Methodref          #16.#44        // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA.getDefault:()Ljava/lang/String;
   #7 = Methodref          #16.#45        // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA.getException:()Ljava/lang/String;
   #8 = InterfaceMethodref #18.#46        // co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA.getStatic:()Ljava/lang/String;
   #9 = Methodref          #16.#47        // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA.getPrivate:()Ljava/lang/String;
  #10 = Methodref          #17.#48        // java/lang/Object.toString:()Ljava/lang/String;
  #11 = InvokeDynamic      #0:#52         // #0:makeConcatWithConstants:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
  #12 = Class              #53            // java/lang/Exception
  #13 = String             #54            //Okinai
  #14 = String             #55            // public Exception XA
  #15 = String             #56            // private XA
  #16 = Class              #57            // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA
  #17 = Class              #58            // java/lang/Object
  #18 = Class              #59            // co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA
  #19 = Utf8               <init>
  #20 = Utf8               ()V
  #21 = Utf8               Code
  #22 = Utf8               LineNumberTable
  #23 = Utf8               LocalVariableTable
  #24 = Utf8               this
  #25 = Utf8               Lco/jp/qualysite/qm/java9/exam/privateInterface/ImplementA;
  #26 = Utf8               get
  #27 = Utf8               ()Ljava/lang/String;
  #28 = Utf8               getDetail
  #29 = Utf8               toString
  #30 = Utf8               e
  #31 = Utf8               Ljava/lang/Exception;
  #32 = Utf8               StackMapTable
  #33 = Utf8               getException
  #34 = Utf8               Exceptions
  #35 = Class              #60            // java/io/IOException
  #36 = Utf8               getPrivate
  #37 = Utf8               SourceFile
  #38 = Utf8               ImplementA.java
  #39 = NameAndType        #19:#20        // "<init>":()V
  #40 = Utf8               public XA
  #41 = Utf8               public detail XA
  #42 = NameAndType        #26:#27        // get:()Ljava/lang/String;
  #43 = NameAndType        #28:#27        // getDetail:()Ljava/lang/String;
  #44 = NameAndType        #61:#27        // getDefault:()Ljava/lang/String;
  #45 = NameAndType        #33:#27        // getException:()Ljava/lang/String;
  #46 = NameAndType        #62:#27        // getStatic:()Ljava/lang/String;
  #47 = NameAndType        #36:#27        // getPrivate:()Ljava/lang/String;
  #48 = NameAndType        #29:#27        // toString:()Ljava/lang/String;
  #49 = Utf8               BootstrapMethods
  #50 = MethodHandle       6:#63          // REF_invokeStatic java/lang/invoke/StringConcatFactory.makeConcatWithConstants:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
  #51 = String             #64            // ImplementA[\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001]
  #52 = NameAndType        #65:#66        // makeConcatWithConstants:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
  #53 = Utf8               java/lang/Exception
  #54 =Utf8 OK
  #55 = Utf8               public Exception XA
  #56 = Utf8               private XA
  #57 = Utf8               co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA
  #58 = Utf8               java/lang/Object
  #59 = Utf8               co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA
  #60 = Utf8               java/io/IOException
  #61 = Utf8               getDefault
  #62 = Utf8               getStatic
  #63 = Methodref          #67.#68        // java/lang/invoke/StringConcatFactory.makeConcatWithConstants:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
  #64 = Utf8               ImplementA[\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001]
  #65 = Utf8               makeConcatWithConstants
  #66 = Utf8               (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
  #67 = Class              #69            // java/lang/invoke/StringConcatFactory
  #68 = NameAndType        #65:#73        // makeConcatWithConstants:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
  #69 = Utf8               java/lang/invoke/StringConcatFactory
  #70 = Class              #75            // java/lang/invoke/MethodHandles$Lookup
  #71 = Utf8               Lookup
  #72 = Utf8               InnerClasses
  #73 = Utf8               (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
  #74 = Class              #76            // java/lang/invoke/MethodHandles
  #75 = Utf8               java/lang/invoke/MethodHandles$Lookup
  #76 = Utf8               java/lang/invoke/MethodHandles
{
  public co.jp.qualysite.qm.java9.exam.privateInterface.ImplementA();
    descriptor: ()V
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: invokespecial #1                  // Method java/lang/Object."<init>":()V
         4: return
      LineNumberTable:
        line 5: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       5     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/ImplementA;

  public java.lang.String get();
    descriptor: ()Ljava/lang/String;
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #2                  // String public XA
         2: areturn
      LineNumberTable:
        line 8: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/ImplementA;

  public java.lang.String getDetail();
    descriptor: ()Ljava/lang/String;
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #3                  // String public detail XA
         2: areturn
      LineNumberTable:
        line 13: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/ImplementA;

  public java.lang.String toString();
    descriptor: ()Ljava/lang/String;
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=7, locals=2, args_size=1
         0: aload_0
         1: invokevirtual #4                  // Method get:()Ljava/lang/String;
         4: aload_0
         5: invokevirtual #5                  // Method getDetail:()Ljava/lang/String;
         8: aload_0
         9: invokevirtual #6                  // Method getDefault:()Ljava/lang/String;
        12: aload_0
        13: invokevirtual #7                  // Method getException:()Ljava/lang/String;
        16: invokestatic  #8                  // InterfaceMethod co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceA.getStatic:()Ljava/lang/String;
        19: aload_0
        20: invokespecial #9                  // Method getPrivate:()Ljava/lang/String;
        23: aload_0
        24: invokespecial #10                 // Method java/lang/Object.toString:()Ljava/lang/String;
        27: invokedynamic #11,  0             // InvokeDynamic #0:makeConcatWithConstants:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
        32: areturn
        33: astore_1
        34: ldc           #13                 //String Okinai
        36: areturn
      Exception table:
         from    to  target type
             0    32    33   Class java/lang/Exception
      LineNumberTable:
        line 19: 0
        line 20: 1
        line 21: 5
        line 22: 9
        line 23: 13
        line 24: 16
        line 28: 20
        line 29: 24
        line 19: 32
        line 31: 33
        line 32: 34
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
           34       3     1     e   Ljava/lang/Exception;
            0      37     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/ImplementA;
      StackMapTable: number_of_entries = 1
        frame_type = 97 /* same_locals_1_stack_item */
          stack = [ class java/lang/Exception ]

  public java.lang.String getException() throws java.io.IOException;
    descriptor: ()Ljava/lang/String;
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #14                 // String public Exception XA
         2: areturn
      LineNumberTable:
        line 38: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/ImplementA;
    Exceptions:
      throws java.io.IOException

  private java.lang.String getPrivate();
    descriptor: ()Ljava/lang/String;
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #15                 // String private XA
         2: areturn
      LineNumberTable:
        line 44: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/ImplementA;
}
SourceFile: "ImplementA.java"
InnerClasses:
  public static final #71= #70 of #74;    // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
BootstrapMethods:
  0: #50 REF_invokeStatic java/lang/invoke/StringConcatFactory.makeConcatWithConstants:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
    Method arguments:
      #51 ImplementA[\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001]

ExtendsAImplementB.dec.txt


  Last modified 2017/10/04; size 612 bytes
  MD5 checksum 1fa0fadf291413f1950fd318148fe45a
  Compiled from "ExtendsAImplementB.java"
public class co.jp.qualysite.qm.java9.exam.privateInterface.ExtendsAImplementB extends co.jp.qualysite.qm.java9.exam.privateInterface.ImplementA implements co.jp.qualysite.qm.java9.exam.privateInterface.SampleInterfaceB
  minor version: 0
  major version: 53
  flags: (0x0021) ACC_PUBLIC, ACC_SUPER
  this_class: #3                          // co/jp/qualysite/qm/java9/exam/privateInterface/ExtendsAImplementB
  super_class: #4                         // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA
  interfaces: 1, fields: 0, methods: 2, attributes: 1
Constant pool:
   #1 = Methodref          #4.#17         // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA."<init>":()V
   #2 = String             #18            // public default extends XAB
   #3 = Class              #19            // co/jp/qualysite/qm/java9/exam/privateInterface/ExtendsAImplementB
   #4 = Class              #20            // co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA
   #5 = Class              #21            // co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceB
   #6 = Utf8               <init>
   #7 = Utf8               ()V
   #8 = Utf8               Code
   #9 = Utf8               LineNumberTable
  #10 = Utf8               LocalVariableTable
  #11 = Utf8               this
  #12 = Utf8               Lco/jp/qualysite/qm/java9/exam/privateInterface/ExtendsAImplementB;
  #13 = Utf8               getDefault
  #14 = Utf8               ()Ljava/lang/String;
  #15 = Utf8               SourceFile
  #16 = Utf8               ExtendsAImplementB.java
  #17 = NameAndType        #6:#7          // "<init>":()V
  #18 = Utf8               public default extends XAB
  #19 = Utf8               co/jp/qualysite/qm/java9/exam/privateInterface/ExtendsAImplementB
  #20 = Utf8               co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA
  #21 = Utf8               co/jp/qualysite/qm/java9/exam/privateInterface/SampleInterfaceB
{
  public co.jp.qualysite.qm.java9.exam.privateInterface.ExtendsAImplementB();
    descriptor: ()V
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: invokespecial #1                  // Method co/jp/qualysite/qm/java9/exam/privateInterface/ImplementA."<init>":()V
         4: return
      LineNumberTable:
        line 3: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       5     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/ExtendsAImplementB;

  public java.lang.String getDefault();
    descriptor: ()Ljava/lang/String;
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           #2                  // String public default extends XAB
         2: areturn
      LineNumberTable:
        line 7: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       3     0  this   Lco/jp/qualysite/qm/java9/exam/privateInterface/ExtendsAImplementB;
}
SourceFile: "ExtendsAImplementB.java"

Recommended Posts

Check Java9 Interface private methods
[java] interface
Java methods
[Java] Test private methods with JUnit
About Java interface
Java class methods
Java version check
[Java] About interface
Java check process
[Java] Functional interface
About interface, java interface
Check static and public behavior in Java methods
How to access Java Private methods and fields
About Java functional interface
Check Java toString () implementation
Callable Interface in Java
java standard functional interface
Java paid private memo
JAVA learning history interface
Java learning memo (interface)
Java encapsulation private public
Advanced inheritance abstract, interface -java
JAVA learning history interface inheritance
(Note) Java classes / variables / methods
[Java] Generics classes and generics methods
Test private methods in JUnit
Check https connection in Java
Test private methods in JUnit
Java methods and method overloads
About Java class variables class methods
Java abstract methods and classes
Rails' Private methods hurt if you feel the same as Java!
[Java 8] Duplicate deletion (& duplicate check) with Stream
Access the network interface in Java
About Java static and non-static methods
Various methods of Java String class
Competitive programming private cheat sheet (Java)
[Java beginner] About abstraction and interface
[Java] Element existence check with Stream
[JAVA] Difference between abstract and interface
Check Java parameters in Kubernetes pods
Java, interface to start from beginner
Effective Java 3rd Edition Chapter 8 Methods
Studying Java 8 (StaticIF and Default methods)
How to use class methods [Java]
Java generics (defines classes and methods)
[Java] Date period duplication check sample