since Java 8 it is allowed to predefine methods in interfaces. Some of these standard implementations are already implemented on the "standard" interfaces such as CharSequence. If you try to read Java 8 ByteCode (e.g. the rt.jar of the Java home folder) with a JVM 7, an error occurs.
e.g. the type java.lang.CharSequence cannot be resolved.
This may not be the only difference between levels, but I would like to understand the structure of the new byte code.
public interface com.company.ITest {
public void HelloWorld();
Code:
0: getstatic #1 // Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc #2 // String hello world
5: invokevirtual #3 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
8: return
}
This Bbytecode was produced by this Javacode:
public interface ITest {
default void HelloWorld(){
System.out.println("hello world");
}
}
So here is my question: How does an default interface impact on the constant pool?
Is any of these flags relevant:
CONSTANT_MethodHandle CONSTANT_MethodType CONSTANT_InvokeDynamic