Skip to content

Commit dbe7117

Browse files
committed
Remove unused methods and improve code readability in SQL-related classes
1 parent 7d11733 commit dbe7117

File tree

9 files changed

+1
-94
lines changed

9 files changed

+1
-94
lines changed

src/main/java/org/domaframework/doma/intellij/psi/SqlElCommentExprImpl.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ public SqlElCommentExprImpl(@NotNull ASTNode node) {
4141
super(node);
4242
}
4343

44-
@Override
45-
public @NotNull ASTNode getNode() {
46-
return super.getNode();
47-
}
48-
4944
@Override
5045
public @NotNull IElementType getTokenType() {
5146
return getNode().getElementType();

src/main/kotlin/org/domaframework/doma/intellij/action/sql/BindVariableElement.kt

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/main/kotlin/org/domaframework/doma/intellij/common/CommonPathParameter.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,21 @@ class CommonPathParameter(
6060
entry.sourceFolders.map { folder ->
6161
val file = folder.file
6262
if (file != null) {
63-
println("file:${file.name}")
6463
when (folder.rootType) {
6564
JavaSourceRootType.SOURCE -> {
6665
moduleSourceDirectories.add(file)
67-
println("moduleSourceDirectory:$file")
6866
}
6967

7068
JavaSourceRootType.TEST_SOURCE -> {
7169
moduleTestSourceDirectories.add(file)
72-
println("moduleTestSourceDirectory:$file")
7370
}
7471

7572
JavaResourceRootType.RESOURCE -> {
7673
moduleResourceDirectories.add(file)
77-
println("moduleResourceDirectory:$file")
7874
}
7975

8076
JavaResourceRootType.TEST_RESOURCE -> {
8177
moduleTestResourceDirectories.add(file)
82-
println("moduleTestResourceDirectory:$file")
8378
}
8479
}
8580
}

src/main/kotlin/org/domaframework/doma/intellij/common/psi/PsiParentClass.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ class PsiParentClass(
6767
m.hasModifierProperty(PsiModifier.PUBLIC)
6868
}
6969

70-
fun findStaticField(fieldName: String): PsiField? =
71-
fields
72-
?.filter { f ->
73-
f.hasModifierProperty(PsiModifier.STATIC) &&
74-
PropertyModifyUtil.filterPrivateField(f, type)
75-
}?.firstOrNull { f ->
76-
f.name == fieldName
77-
}
78-
7970
fun searchStaticField(fieldName: String): List<PsiField>? =
8071
fields
8172
?.filter { f ->
@@ -84,15 +75,6 @@ class PsiParentClass(
8475
PropertyModifyUtil.filterPrivateField(f, type)
8576
}
8677

87-
fun findStaticMethod(methodName: String): PsiMethod? =
88-
methods
89-
?.filter { m ->
90-
m.hasModifierProperty(PsiModifier.STATIC) &&
91-
m.hasModifierProperty(PsiModifier.PUBLIC)
92-
}?.firstOrNull { m ->
93-
m.name == methodName
94-
}
95-
9678
fun searchStaticMethod(methodName: String): List<PsiMethod>? =
9779
methods?.filter { m ->
9880
m.hasModifierProperty(PsiModifier.STATIC) &&

src/main/kotlin/org/domaframework/doma/intellij/common/sql/PsiClassTypeUtil.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,6 @@ import com.intellij.psi.search.GlobalSearchScope
2222

2323
class PsiClassTypeUtil {
2424
companion object {
25-
fun getPsiTypeByList(
26-
classType: PsiClassType,
27-
project: Project,
28-
useListParam: Boolean,
29-
): PsiType? {
30-
val isIterableType = isIterableType(classType, project)
31-
if (isIterableType && useListParam) {
32-
return classType.parameters.firstOrNull()
33-
}
34-
return classType
35-
}
36-
3725
fun isIterableType(
3826
type: PsiClassType,
3927
project: Project,

src/main/kotlin/org/domaframework/doma/intellij/extension/psi/PsiMethodExtension.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package org.domaframework.doma.intellij.extension.psi
1717

18-
import com.intellij.codeInsight.AnnotationUtil
1918
import com.intellij.psi.PsiMethod
2019
import com.intellij.psi.PsiParameter
2120

@@ -25,13 +24,3 @@ val PsiMethod.methodParameters: List<PsiParameter>
2524
get() = this.parameterList.parameters.toList()
2625

2726
fun PsiMethod.searchParameter(searchName: String): List<PsiParameter> = this.methodParameters.filter { it.name.startsWith(searchName) }
28-
29-
@OptIn(ExperimentalStdlibApi::class)
30-
fun PsiMethod.getDomaAnnotationType(): DomaAnnotationType {
31-
DomaAnnotationType.entries.forEach {
32-
if (AnnotationUtil.findAnnotation(this, it.fqdn) != null) {
33-
return it
34-
}
35-
}
36-
return DomaAnnotationType.Unknown
37-
}

src/main/kotlin/org/domaframework/doma/intellij/formatter/SqlBlockUtil.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import org.domaframework.doma.intellij.psi.SqlCustomElCommentExpr
5151
import org.domaframework.doma.intellij.psi.SqlTypes
5252

5353
class SqlBlockUtil(
54-
private val sqlBlock: SqlBlock,
54+
sqlBlock: SqlBlock,
5555
) {
5656
val wrap = sqlBlock.wrap
5757
val alignment = sqlBlock.alignment

src/main/kotlin/org/domaframework/doma/intellij/formatter/block/SqlLineCommentBlock.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package org.domaframework.doma.intellij.formatter.block
1717

1818
import com.intellij.formatting.Alignment
19-
import com.intellij.formatting.Indent
2019
import com.intellij.formatting.SpacingBuilder
2120
import com.intellij.formatting.Wrap
2221
import com.intellij.lang.ASTNode
@@ -41,8 +40,6 @@ open class SqlLineCommentBlock(
4140

4241
override fun buildChildren(): MutableList<AbstractBlock> = mutableListOf()
4342

44-
override fun getIndent(): Indent? = super.getIndent()
45-
4643
override fun isLeaf(): Boolean = true
4744

4845
override fun createBlockIndentLen(): Int {

src/main/kotlin/org/domaframework/doma/intellij/formatter/block/group/subgroup/SqlUpdateValueGroupBlock.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import com.intellij.lang.ASTNode
2323
import com.intellij.psi.formatter.common.AbstractBlock
2424
import org.domaframework.doma.intellij.formatter.block.SqlBlock
2525
import org.domaframework.doma.intellij.formatter.block.group.keyword.SqlUpdateKeywordGroupBlock
26-
import org.domaframework.doma.intellij.psi.SqlTypes
2726

2827
/**
2928
* In an UPDATE statement using the row value constructor,
@@ -53,10 +52,6 @@ class SqlUpdateValueGroupBlock(
5352
override fun createBlockIndentLen(): Int {
5453
parentBlock?.let { parent ->
5554
if (parent is SqlUpdateKeywordGroupBlock) {
56-
val keywords =
57-
parent.childBlocks
58-
.dropLast(1)
59-
.takeWhile { parent.node.elementType == SqlTypes.KEYWORD }
6055
return parent.indent.indentLen
6156
.plus(parent.getNodeText().length)
6257
.plus(3)

0 commit comments

Comments
 (0)