-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(custom/test): add kotlin module
- Loading branch information
Showing
9 changed files
with
266 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>custom-test</artifactId> | ||
<groupId>io.github.alice52</groupId> | ||
<version>0.0.1</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>custom-kotlin</artifactId> | ||
|
||
<properties> | ||
<!-- kotlin --> | ||
<kotlin.compiler.incremental>false</kotlin.compiler.incremental> | ||
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget> | ||
<kotlin.version>1.7.21</kotlin.version> | ||
<kotlin.code.style>official</kotlin.code.style> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>mavenCentral</id> | ||
<url>https://repo1.maven.org/maven2/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<!-- kotlin --> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-stdlib-jdk8</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-reflect</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-test-junit</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> | ||
<configuration> | ||
<compilerPlugins> | ||
<plugin>lombok</plugin> | ||
</compilerPlugins> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>compile</id> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
<configuration> | ||
<sourceDirs> | ||
<sourceDir>src/main/kotlin</sourceDir> | ||
<sourceDir>src/main/java</sourceDir> | ||
</sourceDirs> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>test-compile</id> | ||
<goals> | ||
<goal>test-compile</goal> | ||
</goals> | ||
<configuration> | ||
<sourceDirs> | ||
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir> | ||
<sourceDir>${project.basedir}/src/test/java</sourceDir> | ||
</sourceDirs> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-lombok</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
<executions> | ||
<!-- Replacing default-compile as it is treated specially by maven --> | ||
<execution> | ||
<id>default-compile</id> | ||
<phase>none</phase> | ||
</execution> | ||
<!-- Replacing default-testCompile as it is treated specially by maven --> | ||
<execution> | ||
<id>default-testCompile</id> | ||
<phase>none</phase> | ||
</execution> | ||
<execution> | ||
<id>java-compile</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>java-test-compile</id> | ||
<phase>test-compile</phase> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
16 changes: 16 additions & 0 deletions
16
custom-test/custom-kotlin/src/main/java/common/kotlin/JavaUsage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package common.kotlin; | ||
|
||
public class JavaUsage { | ||
|
||
public static void main(String[] args) { | ||
SomePojo obj = new SomePojo(); | ||
obj.setAge(12); | ||
boolean v = obj.isHuman(); | ||
obj.setHuman(!v); | ||
System.out.println(obj); | ||
} | ||
|
||
public static void cycleUsage() { | ||
new SomeKotlinClass().call(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
custom-test/custom-kotlin/src/main/java/common/kotlin/ManualPojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package common.kotlin; | ||
|
||
import org.codehaus.commons.nullanalysis.NotNull; | ||
import org.springframework.lang.Nullable; | ||
|
||
public class ManualPojo { | ||
private Integer age; | ||
public String getFoo() { | ||
return null; | ||
} | ||
|
||
@NotNull | ||
public String getBar() { | ||
return "234"; | ||
} | ||
|
||
@Nullable | ||
public Object someMethod() { | ||
return null; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
custom-test/custom-kotlin/src/main/java/common/kotlin/SomeData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package common.kotlin; | ||
|
||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class SomeData { | ||
private String name; | ||
private int age; | ||
private boolean human; | ||
} |
25 changes: 25 additions & 0 deletions
25
custom-test/custom-kotlin/src/main/java/common/kotlin/SomeKotlinClass.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package common.kotlin | ||
|
||
class SomeKotlinClass { | ||
fun call() { | ||
val ddd = SomeData() | ||
ddd.age = 12 | ||
println(ddd) | ||
} | ||
} | ||
|
||
|
||
fun main() { | ||
println("something") | ||
val obj = SomePojo() | ||
obj.name = "test" | ||
val s: String = obj.name | ||
obj.age = 12 | ||
val v = obj.isHuman | ||
obj.isHuman = !v | ||
println(obj) | ||
|
||
val ddd = SomeData() | ||
|
||
JavaUsage.cycleUsage() | ||
} |
17 changes: 17 additions & 0 deletions
17
custom-test/custom-kotlin/src/main/java/common/kotlin/SomePojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package common.kotlin; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import org.springframework.lang.NonNull; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
public class SomePojo { | ||
|
||
@NonNull private String name; | ||
private int age; | ||
|
||
private boolean human; | ||
} |
2 changes: 1 addition & 1 deletion
2
custom-test/custom-test-log/src/main/resources/logback-spring.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters