Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump kotlin 1.7.10, and language level to 1.5 #850

Merged
merged 8 commits into from Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/gradle.yml
Expand Up @@ -11,13 +11,8 @@ jobs:
strategy:
matrix:
java-version: [11, 12, 13, 14, 15, 16, 17]
kotlin-version: [1.4.32, 1.5.31, 1.6.0]
kotlin-version: [1.5.31, 1.6.0, 1.7.10]
kotlin-ir-enabled: [true, false]
exclude:
- kotlin-version: 1.4.32
java-version: 16
- kotlin-version: 1.4.32
java-version: 17
# in case one JDK fails, we still want to see results from others
fail-fast: false
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions README.md
@@ -1,7 +1,7 @@
![mockk](doc/logo-site.png) ![kotlin](doc/kotlin-logo.png)

[![Gitter](https://badges.gitter.im/mockk-io/Lobby.svg)](https://gitter.im/mockk-io/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
[![Relase Version](https://img.shields.io/maven-central/v/io.mockk/mockk.svg?label=release)](http://search.maven.org/#search%7Cga%7C1%7Cmockk)
[![Relase Version](https://img.shields.io/maven-central/v/io.mockk/mockk.svg?label=release)](https://search.maven.org/#search%7Cga%7C1%7Cmockk)
[![Change log](https://img.shields.io/badge/change%20log-%E2%96%A4-yellow.svg)](https://github.com/mockk/mockk/releases)
[![codecov](https://codecov.io/gh/mockk/mockk/branch/master/graph/badge.svg)](https://codecov.io/gh/mockk/mockk)
[![Android](https://img.shields.io/badge/android-support-green.svg)](https://mockk.io/ANDROID)
Expand Down Expand Up @@ -1397,7 +1397,7 @@ This project exists thanks to all the people who contribute.
To ask questions, please use Stack Overflow or Gitter.

* Chat/Gitter: [https://gitter.im/mockk-io/Lobby](https://gitter.im/mockk-io/Lobby)
* Stack Overflow: [http://stackoverflow.com/questions/tagged/mockk](http://stackoverflow.com/questions/tagged/mockk)
* Stack Overflow: [http://stackoverflow.com/questions/tagged/mockk](https://stackoverflow.com/questions/tagged/mockk)

To report bugs, please use the GitHub project.

Expand Down
8 changes: 4 additions & 4 deletions agent/jvm/api/mockk-agent-jvm.api
Expand Up @@ -73,7 +73,7 @@ public final class io/mockk/proxy/jvm/advice/jvm/SynchronizedMockHandlersMap : i
public final fun containsValue (Ljava/lang/Object;)Z
public final fun entrySet ()Ljava/util/Set;
public fun get (Ljava/lang/Object;)Lio/mockk/proxy/MockKInvocationHandler;
public final fun get (Ljava/lang/Object;)Ljava/lang/Object;
public synthetic fun get (Ljava/lang/Object;)Ljava/lang/Object;
public fun getEntries ()Ljava/util/Set;
public fun getKeys ()Ljava/util/Set;
public fun getSize ()I
Expand All @@ -85,7 +85,7 @@ public final class io/mockk/proxy/jvm/advice/jvm/SynchronizedMockHandlersMap : i
public synthetic fun put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun putAll (Ljava/util/Map;)V
public fun remove (Ljava/lang/Object;)Lio/mockk/proxy/MockKInvocationHandler;
public final fun remove (Ljava/lang/Object;)Ljava/lang/Object;
public synthetic fun remove (Ljava/lang/Object;)Ljava/lang/Object;
public final fun size ()I
public final fun values ()Ljava/util/Collection;
}
Expand All @@ -99,7 +99,7 @@ public final class io/mockk/proxy/jvm/advice/jvm/WeakMockHandlersMap : io/mockk/
public final fun containsValue (Ljava/lang/Object;)Z
public final fun entrySet ()Ljava/util/Set;
public fun get (Ljava/lang/Object;)Lio/mockk/proxy/MockKInvocationHandler;
public final fun get (Ljava/lang/Object;)Ljava/lang/Object;
public synthetic fun get (Ljava/lang/Object;)Ljava/lang/Object;
public fun getEntries ()Ljava/util/Set;
public fun getKeys ()Ljava/util/Set;
public fun getSize ()I
Expand All @@ -111,7 +111,7 @@ public final class io/mockk/proxy/jvm/advice/jvm/WeakMockHandlersMap : io/mockk/
public synthetic fun put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun putAll (Ljava/util/Map;)V
public fun remove (Ljava/lang/Object;)Lio/mockk/proxy/MockKInvocationHandler;
public final fun remove (Ljava/lang/Object;)Ljava/lang/Object;
public synthetic fun remove (Ljava/lang/Object;)Ljava/lang/Object;
public final fun size ()I
public final fun values ()Ljava/util/Collection;
}
Expand Down
7 changes: 3 additions & 4 deletions build.gradle
Expand Up @@ -29,7 +29,7 @@ plugins {
subprojects { subProject ->
group = 'io.mockk'

ext.kotlin_version = findProperty('kotlin.version')?.toString() ?: '1.6.0'
ext.kotlin_version = findProperty('kotlin.version')?.toString() ?: '1.7.10'
ext.kotlin_gradle_version = findProperty('kotlin.version')?.toString() ?: '1.6.0'

repositories {
Expand All @@ -40,9 +40,8 @@ subprojects { subProject ->
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
apiVersion = "1.4"
languageVersion = "1.4"
useIR = findProperty("kotlin.ir.enabled")?.toBoolean() == true
apiVersion = "1.5"
languageVersion = "1.5"
}
}
}
2 changes: 1 addition & 1 deletion dsl/common/src/main/kotlin/io/mockk/MockKSettings.kt
Expand Up @@ -19,7 +19,7 @@ enum class StackTracesAlignment {

fun stackTracesAlignmentValueOf(property: String): StackTracesAlignment {
return try {
enumValueOf(property.toUpperCase())
enumValueOf(property.uppercase())
} catch (e: IllegalArgumentException) {
StackTracesAlignment.CENTER
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -4,4 +4,4 @@ org.gradle.configureondemand=false
org.gradle.jvmargs=-XX:MaxMetaspaceSize=768m
# localrepo=build/mockk-repo
localrepo=/Users/raibaz/.m2/repository
# kotlin.version=1.5.10
kotlin.version=1.7.10
4 changes: 2 additions & 2 deletions gradle/upload.gradle
Expand Up @@ -28,7 +28,7 @@ afterEvaluate {
pom {
name = mavenName
description = mavenDescription
url = 'http://mockk.io'
url = 'https://mockk.io'

scm {
connection = 'scm:git:git@github.com:mockk/mockk.git'
Expand All @@ -52,7 +52,7 @@ afterEvaluate {
licenses {
license {
name = 'Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
}
}
}
Expand Down
Expand Up @@ -138,11 +138,11 @@ class PermanentMocker(
args.isEmpty()
) {
return prefix +
methodName[3].toLowerCase() +
methodName[3].lowercase() +
methodName.substring(4)
}

return prefix + methodName + "(" + args.joinToString(", ") + ")"
}

}
}
Expand Up @@ -71,5 +71,5 @@ class StubbingAwaitingAnswerState(recorder: CommonCallRecorder) : CallRecordingS
}
}

private fun String.toCamelCase() = if (isEmpty()) this else substring(0, 1).toLowerCase() + substring(1)
}
private fun String.toCamelCase() = if (isEmpty()) this else substring(0, 1).lowercase() + substring(1)
}
Expand Up @@ -54,16 +54,13 @@ class VerifyingState(
}

private fun failIfNotPassed(outcome: VerificationResult, inverse: Boolean) {
if (inverse) {
when (outcome) {
is VerificationResult.OK -> {
val callsReport = VerificationHelpers.formatCalls(outcome.verifiedCalls)
throw AssertionError("Inverse verification failed.\n\nVerified calls:\n$callsReport")
}
when (outcome) {
is VerificationResult.OK -> if (inverse) {
val callsReport = VerificationHelpers.formatCalls(outcome.verifiedCalls)
throw AssertionError("Inverse verification failed.\n\nVerified calls:\n$callsReport")
}
} else {
when (outcome) {
is VerificationResult.Failure -> throw AssertionError("Verification failed: ${outcome.message}")
is VerificationResult.Failure -> if (!inverse) {
throw AssertionError("Verification failed: ${outcome.message}")
Comment on lines +57 to +63
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a little bit of refactoring here because having two 'when' statements seemed odd. I think it's clearer now.

}
}
}
Expand All @@ -86,17 +83,17 @@ class VerifyingState(
}
}

if (!calledStubs.isEmpty()) {
if (calledStubs.isNotEmpty()) {
if (calledStubs.size == 1) {
val calledStub = calledStubs[0]
throw AssertionError(recorder.safeExec {
"Verification failed: ${calledStub.toStr()} should not be called:\n" +
calledStub.allRecordedCalls().joinToString("\n")
calledStub.allRecordedCalls().joinToString("\n")
})
} else {
throw AssertionError(recorder.safeExec {
"Verification failed: ${calledStubs.map { it.toStr() }.joinToString(", ")} should not be called:\n" +
calledStubs.flatMap { it.allRecordedCalls() }.joinToString("\n")
"Verification failed: ${calledStubs.joinToString(", ") { it.toStr() }} should not be called:\n" +
calledStubs.flatMap { it.allRecordedCalls() }.joinToString("\n")
})
}
}
Expand All @@ -105,4 +102,4 @@ class VerifyingState(
companion object {
val log = Logger<VerifyingState>()
}
}
}
Expand Up @@ -159,7 +159,7 @@ actual object InternalPlatform {

fun isRunningAndroidInstrumentationTest(): Boolean {
return System.getProperty("java.vendor", "")
.toLowerCase(Locale.US)
.lowercase(Locale.US)
.contains("android")
}

Expand Down
Expand Up @@ -8,7 +8,7 @@ object Deps {
object Versions {
const val androidTools = "4.1.1"
const val dokka = "1.6.0"
const val kotlinDefault = "1.6.0"
const val kotlinDefault = "1.7.10"
const val coroutines = "1.3.3"
const val slfj = "1.7.32"
const val logback = "1.2.10"
Expand Down