Skip to content

Commit 0ef92e0

Browse files
committed
chore: Cleanup deprecation warnings
1 parent 3c780af commit 0ef92e0

File tree

12 files changed

+37
-18
lines changed

12 files changed

+37
-18
lines changed

core/support/src/main/java/au/com/dius/pact/core/support/json/BaseJsonLexer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
import java.util.function.Predicate;
77

8+
/**
9+
* Base Lexer for tokenising a JSON document
10+
*/
811
public class BaseJsonLexer {
912
protected JsonSource json;
1013

core/support/src/main/java/au/com/dius/pact/core/support/json/InputStreamSource.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import java.io.InputStream;
44
import java.io.InputStreamReader;
55

6+
/**
7+
* JSON source from an Input Stream
8+
*/
69
public class InputStreamSource extends ReaderSource {
710
public InputStreamSource(InputStream source) {
811
super(new InputStreamReader(source));

core/support/src/main/java/au/com/dius/pact/core/support/json/JsonSource.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package au.com.dius.pact.core.support.json;
22

3+
/**
4+
* Abstract class that represents the source of a JSON document
5+
*/
36
public abstract class JsonSource {
47
public abstract Character nextChar();
58
public abstract Character peekNextChar();

core/support/src/main/java/au/com/dius/pact/core/support/json/ReaderSource.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import java.io.IOException;
44
import java.io.Reader;
55

6+
/**
7+
* JSON source from a Reader
8+
*/
69
public class ReaderSource extends JsonSource {
710
private Reader reader;
811
private Character buffer = null;

core/support/src/main/java/au/com/dius/pact/core/support/json/StringSource.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package au.com.dius.pact.core.support.json;
22

3+
/**
4+
* JSON source from a String
5+
*/
36
public class StringSource extends JsonSource {
47
private char[] json;
58
private int index = 0;

provider/gradle/src/main/kotlin/au/com/dius/pact/provider/gradle/GradleConsumerInfo.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ open class GradleConsumerInfo(
1515
override var packagesToScan: List<String> = emptyList(),
1616
override var verificationType: PactVerification? = null,
1717
override var pactSource: Any? = null,
18+
@Deprecated("Replaced with auth")
1819
override var pactFileAuthentication: List<Any?> = emptyList(),
1920
override val notices: List<VerificationNotice> = mutableListOf(),
2021
override val pending: Boolean = false,

provider/gradle/src/main/kotlin/au/com/dius/pact/provider/gradle/GradleProviderInfo.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ import au.com.dius.pact.provider.gradle.PactPluginBase.Companion.PACT_VERIFY
1212
import groovy.lang.Closure
1313
import io.pact.plugins.jvm.core.CatalogueEntry
1414
import io.pact.plugins.jvm.core.CatalogueManager
15-
import io.github.oshai.kotlinlogging.KLogging
15+
import io.github.oshai.kotlinlogging.KotlinLogging
1616
import org.gradle.api.GradleScriptException
17-
import org.gradle.api.Project
1817
import org.gradle.api.model.ObjectFactory
1918
import java.io.File
2019
import java.net.URL
2120
import javax.inject.Inject
2221

22+
private val logger = KotlinLogging.logger {}
23+
2324
/**
2425
* Extends the provider info to be setup in a gradle build
2526
*/
@@ -197,6 +198,4 @@ open class GradleProviderInfo @Inject constructor(
197198
""".trimMargin("|"), null)
198199
}
199200
}
200-
201-
companion object : KLogging()
202201
}

provider/gradle/src/main/kotlin/au/com/dius/pact/provider/gradle/PactBrokerConsumerConfig.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ package au.com.dius.pact.provider.gradle
22

33
import au.com.dius.pact.core.pactbroker.ConsumerVersionSelectors
44
import au.com.dius.pact.provider.junitsupport.loader.SelectorBuilder
5-
import io.github.oshai.kotlinlogging.KLogging
5+
import io.github.oshai.kotlinlogging.KotlinLogging
66
import org.gradle.api.Action
77
import org.gradle.api.model.ObjectFactory
88
import javax.inject.Inject
99

10+
private val logger = KotlinLogging.logger {}
11+
1012
/**
1113
* Config for pact broker
1214
*/
@@ -32,7 +34,7 @@ open class PactBrokerConsumerConfig @Inject constructor(
3234
selectors!!.addAll(config.selectors)
3335
}
3436

35-
companion object : KLogging() {
37+
companion object {
3638
@JvmStatic
3739
@JvmOverloads
3840
@Deprecated(message = "Assigning selectors with latestTags is deprecated, use withSelectors instead")

provider/gradle/src/main/kotlin/au/com/dius/pact/provider/gradle/PactVerificationBaseTask.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ open class PactVerificationBaseTask : DefaultTask() {
1515
val nonPending = failures.filterNot { it.pending }
1616
if (nonPending.isNotEmpty()) {
1717
throw GradleScriptException(
18-
"There were ${nonPending.sumBy { it.failures.size }} non-pending pact failures for provider ${providerToVerify.name}", null)
18+
"There were ${nonPending.sumOf { it.failures.size }} non-pending pact failures for provider ${providerToVerify.name}", null)
1919
}
2020
}
2121
} finally {

provider/junit/src/main/kotlin/au/com/dius/pact/provider/junit/InteractionRunner.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import au.com.dius.pact.provider.junitsupport.State
2727
import au.com.dius.pact.provider.junitsupport.TargetRequestFilter
2828
import au.com.dius.pact.provider.junitsupport.target.Target
2929
import au.com.dius.pact.provider.junitsupport.target.TestTarget
30-
import io.github.oshai.kotlinlogging.KLogging
30+
import io.github.oshai.kotlinlogging.KotlinLogging
3131
import org.junit.After
3232
import org.junit.Before
3333
import org.junit.Rule
@@ -62,6 +62,8 @@ import kotlin.reflect.jvm.kotlinProperty
6262
import kotlin.to
6363
import org.apache.commons.lang3.tuple.Pair as TuplePair
6464

65+
private val logger = KotlinLogging.logger {}
66+
6567
/**
6668
* Internal class to support pact test running
6769
*
@@ -228,7 +230,7 @@ open class InteractionRunner(
228230
}
229231

230232
protected open fun createTest(): Any {
231-
return testClass.javaClass.newInstance()
233+
return testClass.javaClass.getDeclaredConstructor().newInstance()
232234
}
233235

234236
protected fun interactionBlock(
@@ -359,7 +361,7 @@ open class InteractionRunner(
359361
return if (testRules.isEmpty()) statement else RunRules(statement, testRules, describeChild(interaction))
360362
}
361363

362-
companion object : KLogging() {
364+
companion object {
363365

364366
private fun validateStateChangeMethods(testClass: TestClass, errors: MutableList<Throwable>) {
365367
getAnnotatedMethods(testClass, State::class.java).forEach { method ->
@@ -411,6 +413,4 @@ class MissingStateChangeMethodStatement(
411413
"for Interaction (\"${interaction.description}\") " +
412414
"and Consumer $consumerName" }
413415
}
414-
415-
companion object : KLogging()
416416
}

provider/junit/src/main/kotlin/au/com/dius/pact/provider/junit/PactRunner.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ import au.com.dius.pact.provider.junitsupport.loader.PactLoader
2424
import au.com.dius.pact.provider.junitsupport.loader.PactSource
2525
import au.com.dius.pact.provider.junitsupport.target.Target
2626
import au.com.dius.pact.provider.junitsupport.target.TestTarget
27-
import io.github.oshai.kotlinlogging.KLogging
27+
import io.github.oshai.kotlinlogging.KotlinLogging
2828
import org.junit.Ignore
2929
import org.junit.runner.notification.RunNotifier
3030
import org.junit.runners.ParentRunner
3131
import org.junit.runners.model.InitializationError
3232
import org.junit.runners.model.TestClass
3333
import java.io.IOException
3434

35+
private val logger = KotlinLogging.logger {}
36+
3537
/**
3638
* JUnit Runner runs pacts against provider
3739
* To set up name of tested provider use [Provider] annotation
@@ -70,7 +72,7 @@ open class PactRunner(private val clazz: Class<*>) : ParentRunner<InteractionRun
7072
}
7173

7274
if (clazz.getAnnotation(Ignore::class.java) != null) {
73-
logger.info("Ignore annotation detected, exiting")
75+
logger.info { "Ignore annotation detected, exiting" }
7476
} else {
7577
val (providerInfo, serviceName) = lookupProviderInfo()
7678
val (consumerInfo, consumerName) = lookupConsumerInfo()
@@ -206,7 +208,7 @@ open class PactRunner(private val clazz: Class<*>) : ParentRunner<InteractionRun
206208
}
207209
}
208210

209-
companion object : KLogging() {
211+
companion object {
210212
const val WARNING_ON_IGNORED_IOERROR = """
211213
---------------------------------------------------------------------------
212214
| WARNING! Ignoring IO Exception received when loading Pact files as |

provider/junit/src/main/kotlin/au/com/dius/pact/provider/junit/RunStateChanges.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import au.com.dius.pact.core.model.ProviderState
44
import au.com.dius.pact.provider.IProviderVerifier
55
import au.com.dius.pact.provider.junitsupport.State
66
import au.com.dius.pact.provider.junitsupport.StateChangeAction
7-
import io.github.oshai.kotlinlogging.KLogging
7+
import io.github.oshai.kotlinlogging.KotlinLogging
88
import org.junit.runners.model.FrameworkMethod
99
import org.junit.runners.model.Statement
1010
import java.util.function.Supplier
1111
import kotlin.reflect.full.isSubclassOf
1212

13+
private val logger = KotlinLogging.logger {}
14+
1315
data class StateChangeCallbackFailed(
1416
override val message: String,
1517
override val cause: Throwable
@@ -67,6 +69,4 @@ class RunStateChanges(
6769
}
6870
}
6971
}
70-
71-
companion object : KLogging()
7272
}

0 commit comments

Comments
 (0)