Skip to content

Commit

Permalink
Update Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Jun 28, 2023
1 parent 38e6c24 commit 3397b5b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {

plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}

Expand Down Expand Up @@ -60,12 +60,6 @@ compileJava {
targetCompatibility = '1.8'
}

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

tasks.withType(Jar) {
manifest {
attributes 'Premain-Class': 'tech.httptoolkit.javaagent.HttpProxyAgent'
Expand Down
7 changes: 4 additions & 3 deletions src/main/kotlin/tech/httptoolkit/javaagent/AgentMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import net.bytebuddy.dynamic.scaffold.TypeValidation
import net.bytebuddy.matcher.ElementMatchers.none
import net.bytebuddy.pool.TypePool
import net.bytebuddy.utility.JavaModule
import net.bytebuddy.utility.nullability.MaybeNull
import java.lang.instrument.Instrumentation
import javax.net.ssl.SSLContext
import java.net.*
Expand Down Expand Up @@ -137,9 +138,9 @@ abstract class MatchingAgentTransformer(private val logger: TransformationLogger
override fun transform(
builder: DynamicType.Builder<*>,
typeDescription: TypeDescription,
classLoader: ClassLoader?,
module: JavaModule?,
protectionDomain: ProtectionDomain?
@MaybeNull classLoader: ClassLoader?,
@MaybeNull module: JavaModule?,
protectionDomain: ProtectionDomain
): DynamicType.Builder<*> {
logger.beforeTransformation(typeDescription)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import net.bytebuddy.agent.builder.AgentBuilder
import net.bytebuddy.description.type.TypeDescription
import net.bytebuddy.dynamic.DynamicType
import net.bytebuddy.utility.JavaModule
import net.bytebuddy.utility.nullability.MaybeNull

class TransformationLogger(private val debugMode: Boolean) : AgentBuilder.Listener.Adapter() {

Expand Down Expand Up @@ -33,11 +34,11 @@ class TransformationLogger(private val debugMode: Boolean) : AgentBuilder.Listen
}

override fun onTransformation(
typeDescription: TypeDescription?,
classLoader: ClassLoader?,
module: JavaModule?,
typeDescription: TypeDescription,
@MaybeNull classLoader: ClassLoader?,
@MaybeNull module: JavaModule?,
loaded: Boolean,
dynamicType: DynamicType?
dynamicType: DynamicType
) {
if (debugMode) {
println("Proxy hooks configured for $typeDescription")
Expand Down

0 comments on commit 3397b5b

Please sign in to comment.