Skip to content

Commit 0deb35e

Browse files
author
gmyasoedov
committed
chore: 253 support
1 parent 0969472 commit 0deb35e

File tree

149 files changed

+441
-630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+441
-630
lines changed

build.gradle.kts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import org.gradle.api.tasks.compile.JavaCompile
2-
import org.gradle.api.tasks.testing.Test
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
32
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
43

54
buildscript {
@@ -37,9 +36,9 @@ subprojects {
3736
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
3837

3938
tasks.withType<KotlinJvmCompile>().configureEach {
40-
kotlinOptions {
41-
jvmTarget = java.toolchain.languageVersion.get().toString()
42-
freeCompilerArgs += listOf("-Xjvm-default=all-compatibility", "-Xjsr305=strict")
39+
compilerOptions {
40+
jvmTarget.set(JvmTarget.JVM_21)
41+
freeCompilerArgs.addAll("-Xjvm-default=all-compatibility", "-Xjsr305=strict")
4342
}
4443
}
4544

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ org.gradle.parallel=true
66
# Let Gradle choose optimal workers; override with ORG_GRADLE_PROJECT_org_gradle_workers_max if needed
77
# org.gradle.workers.max=0
88
kotlin.stdlib.default.dependency=false
9-
10-
kotlinVersion=2.1.20
11-
gradleIntellijPluginVersion=2.7.0
12-
defaultIdeaVersion=2025.2
9+
kotlinVersion=2.2.0
10+
gradleIntellijPluginVersion=2.10.4
11+
#defaultIdeaVersion=2025.2
12+
defaultIdeaVersion=253-EAP-SNAPSHOT
1313
defaultIdeaType=IC
1414
org.jetbrains.intellij.platform.selfUpdateCheck=false
1515
org.jetbrains.intellij.platform.downloadSources=true
16-
sinceVersion=252.23892.409
17-
untilVersion=256.*
16+
sinceVersion=253
17+
untilVersion=265.*
1818
kotlin.daemon.jvmargs=-Xmx2G
1919
pluginVersion=29

modules/base/base.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ dependencies {
5555
exclude(group = "com.fasterxml.jackson.core", module = "jackson-core")
5656
}
5757
intellijPlatform {
58-
create(defaultIdeaType, defaultIdeaVersion, useInstaller = false)
59-
jetbrainsRuntime()
58+
intellijIdea(defaultIdeaVersion) {
59+
useInstaller = false
60+
}
6061
bundledPlugins(intellijPlugins)
6162
}
6263
}

modules/base/src/main/kotlin/com/explyt/inspection/SpringBaseUastLocalInspectionTool.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@
1818
package com.explyt.inspection
1919

2020
import com.explyt.base.LibraryClassCache
21+
import com.explyt.plugin.PluginIds
2122
import com.explyt.util.SpringBaseClasses.CORE_ENVIRONMENT
2223
import com.intellij.codeInspection.AbstractBaseUastLocalInspectionTool
2324
import com.intellij.psi.PsiFile
2425

2526
abstract class SpringBaseUastLocalInspectionTool : AbstractBaseUastLocalInspectionTool() {
2627

2728
override fun isAvailableForFile(file: PsiFile): Boolean {
28-
return LibraryClassCache.searchForLibraryClass(file.project, CORE_ENVIRONMENT) != null
29+
return PluginIds.SPRING_JB.isNotEnabled() && LibraryClassCache.searchForLibraryClass(
30+
file.project,
31+
CORE_ENVIRONMENT
32+
) != null
2933
}
3034
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright © 2025 Explyt Ltd
3+
*
4+
* All rights reserved.
5+
*
6+
* This code and software are the property of Explyt Ltd and are protected by copyright and other intellectual property laws.
7+
*
8+
* You may use this code under the terms of the Explyt Source License Version 1.0 ("License"), if you accept its terms and conditions.
9+
*
10+
* By installing, downloading, accessing, using, or distributing this code, you agree to the terms and conditions of the License.
11+
* If you do not agree to such terms and conditions, you must cease using this code and immediately delete all copies of it.
12+
*
13+
* You may obtain a copy of the License at: https://github.com/explyt/spring-plugin/blob/main/EXPLYT-SOURCE-LICENSE.md
14+
*
15+
* Unauthorized use of this code constitutes a violation of intellectual property rights and may result in legal action.
16+
*/
17+
18+
package com.explyt.plugin
19+
20+
import com.intellij.ide.plugins.PluginManager
21+
import com.intellij.lang.Language
22+
import com.intellij.openapi.extensions.PluginId
23+
24+
25+
enum class PluginIds(val pluginId: String) {
26+
EXPLYT("com.explyt.test"),
27+
HTTP_CLIENT_JB("com.jetbrains.restClient"),
28+
SPRING_JB("com.intellij.spring"),
29+
SPRING_DEBUGGER_JB("com.intellij.spring.debugger"),
30+
CDI_JB("com.intellij.cdi"), //Jakarta EE - DI (QUARKUS SEXPLYT Conflict)
31+
SPRING_BOOT_JB("com.intellij.spring.boot"),
32+
;
33+
34+
fun findEnabled() = PluginManager.getInstance().findEnabledPlugin(PluginId.getId(pluginId))
35+
36+
fun isEnabled() = findEnabled() != null
37+
38+
fun isNotEnabled() = !isEnabled()
39+
}
40+
41+
enum class PluginSqlLanguage(val langId: String) {
42+
SQL("SQL"),
43+
JPAQL("JPAQL"),
44+
HQL("HQL"),
45+
SPRING_QL("SpringDataQL"),
46+
;
47+
48+
fun isEnabled() = Language.findLanguageByID(langId) != null
49+
}

modules/base/src/main/kotlin/com/explyt/util/ExplytPsiUtil.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ import com.intellij.psi.*
2828
import com.intellij.psi.util.PropertyUtilBase
2929
import com.intellij.psi.util.PsiTreeUtil
3030
import com.intellij.psi.util.childrenOfType
31+
import org.jetbrains.kotlin.idea.KotlinLanguage
3132
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
3233
import org.jetbrains.kotlin.psi.KtNamedFunction
34+
import org.jetbrains.uast.UClass
3335
import org.jetbrains.uast.UMethod
36+
import org.jetbrains.uast.getParentOfType
3437
import org.jetbrains.uast.toUElement
3538
import kotlin.contracts.ExperimentalContracts
3639
import kotlin.contracts.contract
@@ -285,8 +288,12 @@ object ExplytPsiUtil {
285288
fun PsiMember?.isRegistrar(): Boolean {
286289
val psiMethod = this as? PsiMethod ?: return false
287290
if (psiMethod.name == "register" && psiMethod.returnType?.canonicalText == "void") return true
288-
return psiMethod.isPublic && (psiMethod.toString().contains("BeanRegistrarDsl")
289-
|| psiMethod.parent?.toString()?.contains("BeanRegistrarDsl") == true)
291+
if (psiMethod.language != KotlinLanguage.INSTANCE) return false
292+
if (psiMethod.isPublic && psiMethod.name.contains("regist", true)) {
293+
val uClass = psiMethod.toUElement()?.getParentOfType<UClass>() ?: return false
294+
return uClass.uastSuperTypes.any { it.getQualifiedName()?.contains("BeanRegistrarDsl", true) == true }
295+
}
296+
return false
290297
}
291298

292299
fun navigate(psiElement: PsiElement?) {

modules/jpa/jpa.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ val defaultIdeaVersion: String by rootProject
7171
dependencies {
7272
implementation(baseProject)
7373
intellijPlatform {
74-
create(defaultIdeaType, defaultIdeaVersion, useInstaller = false)
75-
jetbrainsRuntime()
74+
intellijIdea(defaultIdeaVersion) {
75+
useInstaller = false
76+
}
7677
bundledPlugins(intellijPlugins)
7778
testFramework(TestFrameworkType.Platform)
7879
testFramework(TestFrameworkType.Plugin.Java)

modules/jpa/src/main/kotlin/com/explyt/jpa/langinjection/JpqNamedQueryLanguageInjector.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@
1818
package com.explyt.jpa.langinjection
1919

2020
import com.explyt.jpa.JpaClasses
21+
import com.explyt.plugin.PluginSqlLanguage
2122
import org.jetbrains.uast.UAnnotation
2223
import org.jetbrains.uast.UElement
2324
import org.jetbrains.uast.getParentOfType
2425
import org.jetbrains.uast.isUastChildOf
2526

2627
class JpqNamedQueryLanguageInjector : JpqlInjectorBase() {
2728
override fun isValidPlace(uElement: UElement): Boolean {
29+
if (PluginSqlLanguage.JPAQL.isEnabled()) return false
30+
if (PluginSqlLanguage.SPRING_QL.isEnabled()) return false
31+
2832
val uAnnotation = uElement.getParentOfType<UAnnotation>() ?: return false
2933

3034
if (!JpaClasses.namedQuery.check(uAnnotation.qualifiedName))

modules/jpa/src/main/kotlin/com/explyt/jpa/langinjection/JpqlEntityManagerLanguageInjector.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
package com.explyt.jpa.langinjection
1919

2020
import com.explyt.jpa.JpaClasses
21+
import com.explyt.plugin.PluginSqlLanguage
2122
import com.intellij.psi.PsiMethod
2223
import org.jetbrains.uast.*
2324

2425
class JpqlEntityManagerLanguageInjector : JpqlInjectorBase() {
2526
override fun isValidPlace(uElement: UElement): Boolean {
27+
if (PluginSqlLanguage.JPAQL.isEnabled()) return false
28+
2629
val uCallExpression = uElement.getParentOfType<UCallExpression>() ?: return false
2730

2831
val firstParameter = uCallExpression.valueArguments.getOrNull(0) ?: return false

modules/jpa/src/main/kotlin/com/explyt/jpa/ql/JpqlFileType.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ import com.intellij.openapi.fileTypes.LanguageFileType
2222
import javax.swing.Icon
2323

2424
class JpqlFileType private constructor() : LanguageFileType(JpqlLanguage.INSTANCE) {
25-
override fun getName(): String = "JPA QL"
25+
override fun getName(): String = "JPA QL Explyt"
2626

27-
override fun getDescription(): String = "JPQL file"
27+
override fun getDescription(): String = "JPQL file Explyt"
2828

29-
override fun getDefaultExtension(): String = "jpql"
29+
override fun getDefaultExtension(): String = "ejpql"
3030

3131
override fun getIcon(): Icon = AllIcons.FileTypes.Text
3232

0 commit comments

Comments
 (0)