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

feat: Use com.google.inject over javax.inject to allow migrate to guice7+ #2884

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ object Dependencies {
val guavaTestLib = "com.google.guava:guava-testlib"
val guice = "com.google.inject:guice"
val guiceBom = "com.google.inject:guice-bom:6.0.0"
val guice7Bom = "com.google.inject:guice-bom:7.0.0"
val guiceTestLib = "com.google.inject.extensions:guice-testlib"
val hibernateCore = "org.hibernate:hibernate-core:5.5.3.Final"
val hikariCp = "com.zaxxer:HikariCP:4.0.3"
Expand All @@ -70,8 +71,8 @@ object Dependencies {
val jacksonDataformatYaml = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.2"
val jacksonJsr310 = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2"
val jacksonKotlin = "com.fasterxml.jackson.module:jackson-module-kotlin:2.14.2"
val jakartaInject = "jakarta.inject:jakarta.inject-api:2.0.1"
val javaxAnnotation = "javax.annotation:javax.annotation-api:1.3.2"
val javaxInject = "javax.inject:javax.inject:1"
val javaxPersistenceApi = "javax.persistence:javax.persistence-api:2.2"
val jedis = "redis.clients:jedis:4.1.1"
val jerseyBom = "org.glassfish.jersey:jersey-bom:3.0.2"
Expand Down
1 change: 0 additions & 1 deletion misk-action-scopes/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ plugins {
dependencies {
api(Dependencies.guava)
api(Dependencies.guice)
api(Dependencies.javaxInject)
api(project(":misk-inject"))
implementation(Dependencies.kotlinReflect)
implementation(Dependencies.kotlinStdLibJdk8)
Expand Down
4 changes: 2 additions & 2 deletions misk-action-scopes/src/main/kotlin/misk/scope/ActionScope.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.google.inject.Provider
import kotlinx.coroutines.asContextElement
import java.util.UUID
import java.util.concurrent.Callable
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton
import kotlin.coroutines.CoroutineContext
import kotlin.reflect.KFunction
import kotlin.reflect.KParameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import misk.inject.parameterizedType
import misk.inject.toKey
import misk.inject.typeLiteral
import java.lang.reflect.Type
import javax.inject.Inject
import com.google.inject.Inject
import kotlin.reflect.KClass
import kotlin.reflect.jvm.javaMethod

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package misk.scope

import com.google.inject.Key
import javax.inject.Inject
import com.google.inject.Inject

internal class RealActionScoped<T> @Inject internal constructor(
val key: Key<T>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import java.util.concurrent.Callable
import java.util.concurrent.Executors
import javax.inject.Inject
import com.google.inject.Inject
import kotlin.reflect.KFunction

internal class ActionScopePropagationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import java.util.Optional
import javax.inject.Inject
import com.google.inject.Inject
import kotlin.test.assertFailsWith

internal class ActionScopedTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.google.inject.TypeLiteral
import com.google.inject.name.Named
import com.google.inject.name.Names
import java.util.Optional
import javax.inject.Inject
import com.google.inject.Inject

internal class TestActionScopedProviderModule : ActionScopedProviderModule() {
override fun configureProviders() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import org.junit.jupiter.api.Test
import java.util.concurrent.Callable
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton
import kotlin.test.assertFailsWith

internal class ActionScopedExecutorServiceTest {
Expand Down
1 change: 0 additions & 1 deletion misk-admin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ plugins {

dependencies {
api(Dependencies.guice)
api(Dependencies.javaxInject)
api(Dependencies.kotlinxHtml)
api(Dependencies.moshi)
api(Dependencies.okio)
Expand Down
4 changes: 2 additions & 2 deletions misk-admin/src/main/kotlin/misk/web/dashboard/DashboardTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package misk.web.dashboard

import misk.security.authz.AccessAnnotationEntry
import misk.web.dashboard.ValidWebEntry.Companion.slugify
import javax.inject.Inject
import javax.inject.Provider
import com.google.inject.Inject
import com.google.inject.Provider
import kotlin.reflect.KClass

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import misk.web.PathParam
import misk.web.ResponseContentType
import misk.web.actions.WebAction
import misk.web.mediatype.MediaTypes
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton

/**
* Kotlin backed tab loader, equivalent to /_tab/slug/index.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import misk.web.dashboard.DashboardTheme
import misk.web.dashboard.MiskWebTheme
import misk.web.mediatype.MediaTypes
import misk.web.metadata.DashboardMetadataAction.DashboardTabMetadata.Companion.toMetadata
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton

/**
* Serve metadata related to a Misk-Web Dashboard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import misk.web.ResponseContentType
import misk.web.actions.WebAction
import misk.web.mediatype.MediaTypes
import wisp.deployment.Deployment
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton

/**
* Service Metadata used for front end dashboards including App Name and Misk.Deployment name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import misk.web.mediatype.MediaTypes
import misk.web.metadata.jvm.JvmMetadataAction
import wisp.config.Config
import wisp.deployment.Deployment
import javax.inject.Singleton
import com.google.inject.Singleton

@Singleton
class ConfigMetadataAction @Inject constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import misk.web.ResponseContentType
import misk.web.actions.WebAction
import misk.web.dashboard.AdminDashboardAccess
import misk.web.mediatype.MediaTypes
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton

/** Display available queries and their types */
@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import misk.web.actions.WebAction
import misk.web.dashboard.AdminDashboardAccess
import misk.web.mediatype.MediaTypes
import java.lang.management.RuntimeMXBean
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton

/**
* Conveys information about the current JVM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import misk.web.ResponseContentType
import misk.web.actions.WebAction
import misk.web.dashboard.AdminDashboardAccess
import misk.web.mediatype.MediaTypes
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton

@Singleton
class WebActionMetadataAction @Inject constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import misk.web.dashboard.AdminDashboardAccess
import misk.web.dashboard.DashboardTabLoader
import misk.web.dashboard.DashboardTabLoaderEntry
import misk.web.mediatype.MediaTypes
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton

/**
* Builds dashboard UI and loads Hotwire tab.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import misk.web.dashboard.AdminDashboardAccess
import misk.web.dashboard.DashboardTabLoader
import misk.web.dashboard.DashboardTabLoaderEntry
import misk.web.mediatype.MediaTypes
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton

/**
* Builds dashboard UI and loads IFrame tab.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import misk.web.ResponseContentType
import misk.web.actions.WebAction
import misk.web.dashboard.AdminDashboardAccess
import misk.web.mediatype.MediaTypes
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton
import kotlin.reflect.KClass

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import misk.web.dashboard.DashboardNavbarItem
import misk.web.dashboard.DashboardTab
import misk.web.v2.DashboardIndexAction.Companion.titlecase
import wisp.deployment.Deployment
import javax.inject.Inject
import com.google.inject.Inject

/**
* Builds dashboard UI for index homepage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import misk.web.WebActionModule
import misk.web.WebServerTestingModule
import misk.web.mediatype.MediaTypes
import misk.web.toResponseBody
import javax.inject.Inject
import com.google.inject.Inject

// Common module for web action-related tests to use to use that bind up some sample web actions
class TestWebActionModule : KAbstractModule() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import misk.web.jetty.JettyService
import okhttp3.OkHttpClient
import okhttp3.Request
import org.junit.jupiter.api.Test
import javax.inject.Inject
import com.google.inject.Inject
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import javax.inject.Inject
import com.google.inject.Inject

@MiskTest(startService = true)
class ServiceMetadataActionTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import wisp.config.Config
import wisp.deployment.TESTING
import javax.inject.Inject
import com.google.inject.Inject
import kotlin.test.assertEquals

@MiskTest(startService = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import misk.web.metadata.jvm.JvmMetadataAction.JvmRuntimeResponse
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import java.lang.management.RuntimeMXBean
import javax.inject.Inject
import com.google.inject.Inject
import javax.management.ObjectName

@MiskTest(startService = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import misk.web.mediatype.MediaTypes
import misk.web.metadata.MetadataTestingModule
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import javax.inject.Inject
import com.google.inject.Inject

@MiskTest(startService = true)
class WebActionMetadataActionTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import misk.web.HttpCall
import misk.web.actions.WebAction
import misk.web.metadata.MetadataTestingModule
import org.junit.jupiter.api.Test
import javax.inject.Inject
import javax.inject.Provider
import com.google.inject.Inject
import com.google.inject.Provider
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith

Expand Down
1 change: 0 additions & 1 deletion misk-aws-dynamodb-testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
api(Dependencies.awsDynamodb)
api(Dependencies.guava)
api(Dependencies.guice)
api(Dependencies.javaxInject)
api(Dependencies.tempestTestingInternal)
api(project(":misk-aws-dynamodb"))
api(project(":misk-inject"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.amazonaws.services.dynamodbv2.AmazonDynamoDB
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreams
import com.google.common.util.concurrent.AbstractService
import com.google.inject.Provides
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton
import kotlin.reflect.KClass
import misk.ServiceModule
import misk.dynamodb.DynamoDbHealthCheck
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.amazonaws.services.dynamodbv2.AmazonDynamoDB
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreams
import com.google.common.util.concurrent.AbstractService
import com.google.inject.Provides
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton
import kotlin.reflect.KClass
import misk.ServiceModule
import misk.dynamodb.DynamoDbHealthCheck
Expand Down
2 changes: 0 additions & 2 deletions misk-aws-dynamodb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies {
api(Dependencies.awsJavaSdkCore)
api(Dependencies.guava)
api(Dependencies.guice)
api(Dependencies.javaxInject)
api(Dependencies.kotlinLogging)
api(project(":misk-aws"))
api(project(":misk-core"))
Expand All @@ -26,7 +25,6 @@ dependencies {

testFixturesApi(Dependencies.awsDynamodb)
testFixturesApi(Dependencies.guice)
testFixturesApi(Dependencies.javaxInject)
testFixturesApi(Dependencies.tempestTestingInternal)
testFixturesApi(project(":misk-aws-dynamodb"))
testFixturesApi(project(":misk-inject"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package misk.dynamodb

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton
import misk.healthchecks.HealthCheck
import misk.healthchecks.HealthStatus
import wisp.logging.getLogger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import misk.cloud.aws.AwsRegion
import misk.exceptions.dynamodb.DynamoDbExceptionMapperModule
import misk.healthchecks.HealthCheck
import misk.inject.KAbstractModule
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton
import kotlin.reflect.KClass
import kotlin.reflect.full.findAnnotation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import misk.dynamodb.DynamoDbHealthCheck
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import java.time.LocalDate
import javax.inject.Inject
import com.google.inject.Inject

abstract class AbstractDynamoDbTest {
@Inject lateinit var dynamoDbClient: AmazonDynamoDB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.amazonaws.services.dynamodbv2.AmazonDynamoDB
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreams
import com.google.common.util.concurrent.AbstractService
import com.google.inject.Provides
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton
import kotlin.reflect.KClass
import misk.ServiceModule
import misk.dynamodb.DynamoDbHealthCheck
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.amazonaws.services.dynamodbv2.AmazonDynamoDB
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreams
import com.google.common.util.concurrent.AbstractService
import com.google.inject.Provides
import javax.inject.Inject
import javax.inject.Singleton
import com.google.inject.Inject
import com.google.inject.Singleton
import kotlin.reflect.KClass
import misk.ServiceModule
import misk.dynamodb.DynamoDbHealthCheck
Expand Down
Loading