Skip to content

Commit

Permalink
remove all dependencies to lombok (#37627)
Browse files Browse the repository at this point in the history
We only use lombok for super trivial stuff and it tends to not play well with Micronauts. Lets' get rid of it!
  • Loading branch information
stephane-airbyte committed Apr 26, 2024
1 parent 2f76ace commit 75ac5a9
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import io.airbyte.commons.json.Jsons
import io.airbyte.protocol.models.v0.AirbyteMessage
import io.airbyte.protocol.models.v0.ConfiguredAirbyteCatalog
import java.util.function.Consumer
import lombok.extern.slf4j.Slf4j
import org.slf4j.Logger
import org.slf4j.LoggerFactory

Expand Down Expand Up @@ -64,7 +63,6 @@ interface Destination : Integration {
* Backwards-compatibility wrapper for an AirbyteMessageConsumer. Strips the sizeInBytes
* argument away from the .accept call.
*/
@Slf4j
class ShimToSerializedAirbyteMessageConsumer(private val consumer: AirbyteMessageConsumer?) :
SerializedAirbyteMessageConsumer {
@Throws(Exception::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import io.airbyte.protocol.models.AirbyteTraceMessage
import java.io.*
import java.nio.charset.StandardCharsets
import java.util.*
import lombok.SneakyThrows
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
Expand Down Expand Up @@ -202,7 +201,6 @@ class AirbyteExceptionHandlerTest {
// because junit catches any exceptions in main thread, i.e. they're not 'uncaught'
val thread: Thread =
object : Thread() {
@SneakyThrows
override fun run() {
val runner = Mockito.mock(IntegrationRunner::class.java)
Mockito.doThrow(throwable).`when`(runner).run(arrayOf("write"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import java.util.HashMap
import java.util.concurrent.CompletableFuture
import java.util.concurrent.CompletionStage
import java.util.function.Predicate
import lombok.extern.slf4j.Slf4j
import org.jooq.Condition
import org.jooq.DSLContext
import org.jooq.SQLDialect
Expand All @@ -39,7 +38,6 @@ import org.jooq.impl.SQLDataType
import org.slf4j.Logger
import org.slf4j.LoggerFactory

@Slf4j
abstract class JdbcDestinationHandler<DestinationState>(
protected val databaseName: String,
protected val jdbcDatabase: JdbcDatabase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import io.airbyte.integrations.base.destination.typing_deduping.StreamConfig
import java.sql.DatabaseMetaData
import java.sql.SQLException
import java.util.*
import lombok.SneakyThrows

/**
* Largely based on
Expand All @@ -24,7 +23,6 @@ class JdbcV1V2Migrator(
private val database: JdbcDatabase,
private val databaseName: String
) : BaseDestinationV1V2Migrator<TableDefinition>() {
@SneakyThrows
override fun doesAirbyteInternalNamespaceExist(streamConfig: StreamConfig?): Boolean {
val retrievedSchema =
database.executeMetadataQuery<String> { dbMetadata: DatabaseMetaData? ->
Expand Down Expand Up @@ -54,7 +52,6 @@ class JdbcV1V2Migrator(
return existingTable.columns.keys.containsAll(columns)
}

@SneakyThrows
@Throws(Exception::class)
override fun getTableIfExists(
namespace: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import io.airbyte.cdk.integrations.destination.s3.util.CompressionTypeHelper
import io.airbyte.cdk.integrations.destination.s3.util.Flattening
import io.airbyte.cdk.integrations.destination.s3.util.Flattening.Companion.fromValue
import java.util.*
import lombok.ToString
import org.apache.commons.lang3.builder.ToStringBuilder

@ToString
class UploadJsonlFormatConfig(
val flatteningType: Flattening,
val compressionType: CompressionType
Expand Down Expand Up @@ -51,6 +50,10 @@ class UploadJsonlFormatConfig(
return Objects.hash(flatteningType, compressionType)
}

override fun toString(): String {
return ToStringBuilder.reflectionToString(this)
}

companion object {
const val JSONL_SUFFIX: String = ".jsonl"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import kotlin.collections.List
import kotlin.collections.MutableMap
import kotlin.collections.emptyList
import kotlin.collections.set
import lombok.SneakyThrows
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
Expand Down Expand Up @@ -59,7 +58,6 @@ class DefaultTyperDeduperTest {

private val MIGRATION_REQUIRING_SOFT_RESET: Migration<MockState> =
object : Migration<MockState> {
@SneakyThrows
override fun migrateIfNecessary(
destinationHandler: DestinationHandler<MockState>,
stream: StreamConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import io.airbyte.cdk.integrations.base.JavaBaseConstants
import io.airbyte.protocol.models.v0.DestinationSyncMode
import java.util.*
import java.util.stream.Stream
import lombok.SneakyThrows
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtensionContext
Expand Down Expand Up @@ -99,7 +98,6 @@ class DestinationV1V2MigratorTest {
)
}

@SneakyThrows
@Test
@Throws(Exception::class)
fun testMigrate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Slf4j
public class Main {

private static final Logger log = LoggerFactory.getLogger(Main.class);
private static final String CREDENTIALS_PATH = "secrets/%s_%s_credentials.json";

public static void main(final String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,18 @@
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This is a crude copy of {@link io.airbyte.workers.general.DefaultReplicationWorker} where if that
* class changes this class will need to be updated to match as this class mocks the functionality
* of the platform from the perspectives of the platform communicating with the destination by
* sending AirbyteRecordMessages the same way platform pipes data into the destination
*/
@Slf4j
public class PerformanceHarness {

private static final Logger log = LoggerFactory.getLogger(PerformanceHarness.class);
public static final int PORT1 = 9877;
public static final int PORT2 = 9878;
public static final int PORT3 = 9879;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Slf4j
public class Main {

private static final Logger log = LoggerFactory.getLogger(Main.class);
private static final String CREDENTIALS_PATH = "secrets/%s_%s_credentials.json";

public static void main(final String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@
import java.util.List;
import java.util.Optional;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Slf4j
public class PerformanceTest {

private static final Logger log = LoggerFactory.getLogger(PerformanceTest.class);
public static final int PORT1 = 9877;
public static final int PORT2 = 9878;
public static final int PORT3 = 9879;
Expand Down
9 changes: 0 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,6 @@ allprojects {
}

dependencies {
// Lombok dependencies.
def lombok = "org.projectlombok:lombok:1.18.30"
compileOnly lombok
annotationProcessor lombok
testCompileOnly lombok
testAnnotationProcessor lombok
testFixturesCompileOnly lombok
testFixturesAnnotationProcessor lombok

// JUnit dependencies.
def vAssertJ = "3.25.3"
def vJUnit = "5.10.2"
Expand Down

0 comments on commit 75ac5a9

Please sign in to comment.