Vérifier la méthode privée de l'interface Java9

La méthode privée peut être définie dans l'interface en Java9

C'est devenu. Lorsque la valeur par défaut a été ajoutée dans Java8, des problèmes tels que l'héritage des diamants sont souvent apparus, donc j'étais curieux, je vais donc le vérifier.

résultat

Conclusion

Il est considéré comme une fonction permettant de créer une méthode d'assistance dans la même interface. Au moins, ce n'est pas quelque chose pour forcer l'implémentation de méthodes privées ou pour les utiliser pour des modèles de méthode de modèle. Si vous y réfléchissez, vous en avez parlé il y a longtemps. → Java Interface Memo (Java Interface Memo de Hishidama) # Méthode d'interface privée

Exemple de structure de classe

キャプチャ.PNG

Exemple de code

SampleInterfaceA.java


public interface SampleInterfaceA {
    /**L'habituel.*/
    String get();
    /**Explicite d'habitude.*/
    public abstract String getDetail();
    /**méthode par défaut.*/
    default String getDefault() {return "default IA";}
    /**Un gars statique.*/
    static String getStatic() {return "static IA";}
//Ce n'est pas bien
//    /**Un mec privé.*/
//    private String getPrivate();
    /**gars statique privé.*/
    private static String getPrivateStatic() {return "private static IA";}
//C'est aussi inutile
//    /**Un gars par défaut privé.*/
//    private default String getPrivateDefault() {return "private default";}
    /**Un mec privé.*/
    private String getPrivate() {return "private IA";}
    /**Comme d'habitude, pensez aux signatures détaillées.*/
    String getException() throws IOException;
    /**Examen de signature privé et détaillé.*/
    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";}
//C'est un méchant depuis le début
//    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"
//L'interface privée ne peut pas être appelée à partir de la classe d'implémentation
//                    + 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";}
//Bien sûr, l'annotation Remplacer ne peut pas être ajoutée
//    @Override
    private String getPrivate() {return "private XA";}
}

ExtendsAImplementB.java


public class ExtendsAImplementB extends ImplementA implements SampleInterfaceB {
    // SampleInterfaceA#get()Est SampleInterfaceB#get()Puisqu'il a la même signature que, l'implémentation de la classe parente est appliquée
    @Override
    public String getDefault() {
        return "public default extends XAB";
    }
    // SampleInterfaceA#getPrivate()Et SampleInterfaceB#getPrivate()N'entre pas en conflit
    // SampleInterfaceA#getException()Et SampleInterfaceB#getException()N'entre pas en conflit
}

TestInterface.java


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

Exemple de résultat d'exécution

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

Exemple de résultat javap

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 Okinai
  #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                 //Corde 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

Vérifier la méthode privée de l'interface Java9
interface [java]
Méthodes Java
[Java] Tester des méthodes privées avec JUnit
À propos de l'interface Java
Méthodes de classe Java
Vérification de la version Java
Interface [Java]
Processus de vérification Java
[Java] Interface fonctionnelle
À propos de l'interface, interface java
Vérifier le comportement statique et public dans les méthodes Java
Comment accéder aux méthodes et champs Java Private
À propos de l'interface fonctionnelle Java
Vérifier l'implémentation de Java toString ()
Interface appelable en Java
interface de type de fonction standard java
Mémo privé payant Java
Interface d'historique d'apprentissage JAVA
Mémo d'apprentissage Java (interface)
À propos de l'encapsulation Java Private Public
Résumé d'héritage avancé, interface -java
Héritage de l'interface de l'historique d'apprentissage JAVA
(Remarque) Classes / variables / méthodes Java
[Java] Classe générique et méthode générique
Tester les méthodes privées dans JUnit
Vérifiez la connexion https avec Java
Tester les méthodes privées dans JUnit
Méthodes Java et surcharges de méthodes
Méthode de classe variable de classe Java
Méthodes et classes abstraites Java
Rails Les méthodes privées font mal si vous ressentez la même chose que Java!
[Java 8] Suppression en double (et vérification en double) avec Stream
Accéder à l'interface réseau avec Java
À propos des méthodes Java statiques et non statiques
Diverses méthodes de la classe Java String
Aide-mémoire privé pour la programmation compétitive (Java)
[Java débutant] À propos de l'abstraction et de l'interface
[Java] Vérification de l'existence des éléments avec Stream
[JAVA] Différence entre abstrait et interface
Vérifier les paramètres Java dans les pods Kubernetes
Java, interface pour partir du débutant
Méthodes efficaces du chapitre 8 de Java 3rd Edition
Etudier Java 8 (méthode StaticIF et Default)
Comment utiliser les méthodes de classe [Java]
Java Generics (définit les classes et les méthodes)
[Java] Exemple de contrôle de duplication de période de date