Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Commit 08d986b

Browse files
committed
fix code style
1 parent d32796a commit 08d986b

File tree

10 files changed

+9
-27
lines changed

10 files changed

+9
-27
lines changed

ktorm-ksp-codegen/src/main/kotlin/org/ktorm/ksp/codegen/definition/TableDefinition.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public data class TableDefinition(
4646
*/
4747
val sequenceName: String,
4848

49-
5049
/**
5150
* The Table alias, Corresponding to the [org.ktorm.ksp.api.Table.alias] property, may be an empty string.
5251
*/

ktorm-ksp-codegen/src/main/kotlin/org/ktorm/ksp/codegen/generator/DefaultTableTypeGenerator.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,3 @@ public open class DefaultTableTypeGenerator : TableTypeGenerator {
128128
.run(emitter)
129129
}
130130
}
131-
132-

ktorm-ksp-codegen/src/main/kotlin/org/ktorm/ksp/codegen/generator/InterfaceEntityComponentFunGenerator.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,4 @@ public class InterfaceEntityComponentFunGenerator : TopLevelFunctionGenerator {
3939
.run(emitter)
4040
}
4141
}
42-
4342
}

ktorm-ksp-codegen/src/main/kotlin/org/ktorm/ksp/codegen/generator/InterfaceEntityConstructorFunGenerator.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,4 @@ public class InterfaceEntityConstructorFunGenerator : TopLevelFunctionGenerator
4747
.build()
4848
.apply(emitter)
4949
}
50-
5150
}

ktorm-ksp-codegen/src/main/kotlin/org/ktorm/ksp/codegen/generator/util/CodeGenerations.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public inline fun CodeBlock.Builder.withControlFlow(
8787
endControlFlow()
8888
}
8989

90-
9190
public object CodeFactory {
9291

9392
/**

ktorm-ksp-compiler/src/main/kotlin/org/ktorm/ksp/compiler/KtormProcessorProvider.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public class KtormProcessor(
154154
kspConfig.extension.enableClassEntitySequenceUpdateFun,
155155
kspConfig.extension.enableInterfaceEntitySimulationDataClass
156156
)
157-
//namingStrategy
157+
// namingStrategy
158158
val namingStrategyType = argumentMap[KtormKspConfig::namingStrategy.name]!!.value as KSType
159159
if (namingStrategyType.toClassName() != Nothing::class.asClassName()) {
160160
if ((namingStrategyType.declaration as KSClassDeclaration).classKind != ClassKind.OBJECT) {
@@ -209,10 +209,8 @@ public class KtormProcessor(
209209
throw e
210210
}
211211
}
212-
213212
}
214213

215-
216214
public inner class EntityVisitor(
217215
private val tableDefinitions: MutableList<TableDefinition>
218216
) : KSVisitorVoid() {
@@ -229,7 +227,7 @@ public class KtormProcessor(
229227
ClassKind.INTERFACE -> {
230228
val entityQualifiedName = Entity::class.qualifiedName
231229
classDeclaration.findSuperTypeReference(entityQualifiedName!!)
232-
?: error("wrong entity class declaration: ${entityClassName.canonicalName}, Entity of interface type must inherit [${entityQualifiedName}]")
230+
?: error("wrong entity class declaration: ${entityClassName.canonicalName}, Entity of interface type must inherit [$entityQualifiedName]")
233231
KtormEntityType.ENTITY_INTERFACE
234232
}
235233

@@ -264,16 +262,17 @@ public class KtormProcessor(
264262
.forEach { ksProperty ->
265263
val propertyKSType = ksProperty.type.resolve()
266264
val propertyName = ksProperty.simpleName.asString()
267-
if (ksProperty.isAnnotationPresent(Ignore::class) || propertyName in table.ignoreColumns
268-
|| (tableDef.ktormEntityType == KtormEntityType.ENTITY_INTERFACE && propertyName in ignoreInterfaceEntityProperties)
265+
if (ksProperty.isAnnotationPresent(Ignore::class)
266+
|| propertyName in table.ignoreColumns
267+
|| tableDef.ktormEntityType == KtormEntityType.ENTITY_INTERFACE && propertyName in ignoreInterfaceEntityProperties
269268
) {
270269
logger.info("ignore column: ${tableDef.entityClassName.canonicalName}.$propertyName")
271270
return@forEach
272271
}
273272
val columnAnnotation = ksProperty.getAnnotationsByType(Column::class).firstOrNull()
274273
val ksColumnAnnotation =
275274
ksProperty.annotations.firstOrNull { anno -> anno.annotationType.resolve().declaration.qualifiedName?.asString() == columnQualifiedName }
276-
//converter
275+
// converter
277276
val converter =
278277
ksColumnAnnotation?.arguments?.firstOrNull { anno -> anno.name?.asString() == Column::converter.name }?.value as KSType?
279278
var converterDefinition: ConverterDefinition? = null
@@ -315,6 +314,5 @@ public class KtormProcessor(
315314
throw e
316315
}
317316
}
318-
319317
}
320318
}

ktorm-ksp-compiler/src/main/kotlin/org/ktorm/ksp/compiler/generator/KtormCodeGenerator.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public object KtormCodeGenerator {
3838
logger: KSPLogger,
3939
) {
4040
logger.info("generate tables:${tables.map { it.entityClassName.simpleName }}")
41-
logger.info("code generator config:${config}")
41+
logger.info("code generator config:$config")
4242
val tableFileGenerator = TableFileGenerator(config, logger)
4343
val configDependencyFile = config.configDependencyFile
4444
for (table in tables) {
@@ -53,5 +53,4 @@ public object KtormCodeGenerator {
5353
file.writeTo(codeGenerator, Dependencies(true, *dependencyFiles.toTypedArray()))
5454
}
5555
}
56-
5756
}

ktorm-ksp-ext/ktorm-ksp-sequence-batch/src/main/kotlin/org/ktorm/ksp/ext/SequenceUpdateAllFunctionGenerator.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import org.ktorm.ksp.codegen.TopLevelFunctionGenerator
2727
import org.ktorm.ksp.codegen.generator.util.MemberNames
2828
import org.ktorm.ksp.codegen.generator.util.withControlFlow
2929

30-
3130
public class SequenceUpdateAllFunctionGenerator : TopLevelFunctionGenerator {
3231

3332
private val batchUpdate = MemberName("org.ktorm.dsl", "batchUpdate", true)

ktorm-ksp-tests/src/main/kotlin/org/ktorm/ksp/tests/BaseKspTest.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import java.io.File
2222

2323
public abstract class BaseKspTest : BaseTest() {
2424

25-
2625
protected open fun createKspCompiler(vararg sourceFiles: SourceFile, useKsp: Boolean = true): KotlinCompilation {
2726
return KotlinCompilation().apply {
2827
workingDir = temporaryFolder.root
@@ -76,15 +75,9 @@ public abstract class BaseKspTest : BaseTest() {
7675
.map { SourceFile.fromPath(it.absoluteFile) }
7776
.toList()
7877

79-
8078
protected val KotlinCompilation.kspGeneratedFiles: List<File>
8179
get() = kspSourcesDir.resolve("kotlin")
8280
.walk()
8381
.filter { it.isFile }
8482
.toList()
85-
86-
8783
}
88-
89-
90-

ktorm-ksp-tests/src/main/kotlin/org/ktorm/ksp/tests/BaseTest.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,12 @@ public abstract class BaseTest {
8080
}
8181

8282
private fun Any.reflectionInvoke(methodName: String, vararg args: Any?): Any? {
83-
return this::class.functions.first { it.name == methodName }.call(this@reflectionInvoke, *args)
83+
return this::class.functions.first { it.name == methodName }.call(this, *args)
8484
}
8585

8686
protected fun KotlinCompilation.Result.invokeBridge(methodName: String, vararg args: Any?): Any? {
8787
val bridgeClass = this.classLoader.loadClass("TestBridge")
8888
val bridge = bridgeClass.kotlin.objectInstance!!
8989
return bridge.reflectionInvoke(methodName, *args)
9090
}
91-
92-
}
91+
}

0 commit comments

Comments
 (0)