diff --git a/build.gradle b/build.gradle index 7f98138..1ea5ae6 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ group 'kotlin-in-action' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.1.2-2' + ext.kotlin_version = '1.6.21' repositories { mavenCentral() @@ -19,9 +19,9 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "junit:junit:4.12" + compile 'junit:junit:4.13.2' } sourceSets { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6590ada..0fb0b99 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/src/ch01/1.1_ATasteOfKotlin.kt b/src/ch01/1.1_ATasteOfKotlin.kt index 404442c..57b3d6c 100755 --- a/src/ch01/1.1_ATasteOfKotlin.kt +++ b/src/ch01/1.1_ATasteOfKotlin.kt @@ -7,7 +7,7 @@ fun main(args: Array) { val persons = listOf(Person("Alice"), Person("Bob", age = 29)) - val oldest = persons.maxBy { it.age ?: 0 } + val oldest = persons.maxByOrNull { it.age ?: 0 } println("The oldest is: $oldest") } diff --git a/src/ch03/3.1_2_CreatingCollectionsInKotlin1.kt b/src/ch03/3.1_2_CreatingCollectionsInKotlin1.kt index 0c4764e..83c2f3c 100755 --- a/src/ch03/3.1_2_CreatingCollectionsInKotlin1.kt +++ b/src/ch03/3.1_2_CreatingCollectionsInKotlin1.kt @@ -4,5 +4,5 @@ fun main(args: Array) { val strings = listOf("first", "second", "fourteenth") println(strings.last()) val numbers = setOf(1, 14, 2) - println(numbers.max()) + println(numbers.maxOrNull()) } diff --git a/src/ch10/10.2.1_1_ReflectionAPI.kt b/src/ch10/10.2.1_1_ReflectionAPI.kt index a701432..6d3e08b 100755 --- a/src/ch10/10.2.1_1_ReflectionAPI.kt +++ b/src/ch10/10.2.1_1_ReflectionAPI.kt @@ -1,6 +1,6 @@ package ch10.ex2_1_1_ReflectionAPI -import kotlin.reflect.memberProperties +import kotlin.reflect.full.memberProperties class Person(val name: String, val age: Int)