add demo for class file
This commit is contained in:
parent
4843f5b4d2
commit
a010745843
73
pom.xml
73
pom.xml
@ -11,6 +11,7 @@
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<kotlin.version>2.1.20</kotlin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -26,18 +27,88 @@
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.11.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-test</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirs>
|
||||
<source>src/main/java</source>
|
||||
<source>target/generated-sources/annotations</source>
|
||||
<source>src</source>
|
||||
</sourceDirs>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>test-compile</phase>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<jvmTarget>${maven.compiler.target}</jvmTarget>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-compile</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>default-testCompile</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>testCompile</id>
|
||||
<phase>test-compile</phase>
|
||||
<goals>
|
||||
<goal>testCompile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<source>{maven.compiler.source}</source>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>{maven.compiler.target}</target>
|
||||
<release>21</release>
|
||||
<compilerArgs>
|
||||
<arg>--enable-preview</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -1,3 +1,5 @@
|
||||
package main.java;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, World!");
|
@ -1,3 +1,5 @@
|
||||
package main.java;
|
||||
|
||||
import jvm.VarHandleDemo;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
13
src/main/java/jvm/classfile/TestClass.java
Normal file
13
src/main/java/jvm/classfile/TestClass.java
Normal file
@ -0,0 +1,13 @@
|
||||
package jvm.classfile;
|
||||
|
||||
/**
|
||||
* Compile for examine class file
|
||||
*/
|
||||
public class TestClass {
|
||||
|
||||
private int m;
|
||||
|
||||
public int inc() {
|
||||
return m+1;
|
||||
}
|
||||
}
|
9
src/main/java/jvm/classfile/TestClassK.kt
Normal file
9
src/main/java/jvm/classfile/TestClassK.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package jvm.classfile
|
||||
|
||||
class TestClassK {
|
||||
private var m: Int = 0;
|
||||
|
||||
fun inc() : Int {
|
||||
return m + 1
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user