specify return type explicitly in Kotlin in some openapi and util to speedup Kotlin resolve

GitOrigin-RevId: 2b68c5d51524b822c645dbcb3828acbdd15245ad
This commit is contained in:
Alexey Kudravtsev
2023-05-30 15:41:09 +02:00
committed by intellij-monorepo-bot
parent f677746966
commit 14ff37953d
408 changed files with 1581 additions and 1557 deletions

View File

@@ -15,11 +15,11 @@ internal class SimpleFieldRequest(
private val isConstant: Boolean,
) : CreateFieldRequest {
override fun isValid(): Boolean = true
override fun getFieldName() = fieldName
override fun getAnnotations() = annotations
override fun getModifiers() = modifiers
override fun getFieldType() = fieldType
override fun getTargetSubstitutor() = targetSubstitutor
override fun getFieldName(): String = fieldName
override fun getAnnotations(): Collection<AnnotationRequest> = annotations
override fun getModifiers(): Collection<JvmModifier> = modifiers
override fun getFieldType(): ExpectedTypes = fieldType
override fun getTargetSubstitutor(): JvmSubstitutor = targetSubstitutor
override fun getInitializer(): JvmValue? = initializer
override fun isConstant(): Boolean = isConstant
}

View File

@@ -3,7 +3,7 @@ package com.intellij.lang.jvm.actions
import com.intellij.lang.jvm.JvmModifier
fun modifierRequest(modifier: JvmModifier, shouldBePresent: Boolean) = object : ChangeModifierRequest {
fun modifierRequest(modifier: JvmModifier, shouldBePresent: Boolean): ChangeModifierRequest = object : ChangeModifierRequest {
override fun isValid(): Boolean = true
override fun getModifier(): JvmModifier = modifier
override fun shouldBePresent(): Boolean = shouldBePresent

View File

@@ -7,5 +7,5 @@ import com.intellij.util.xmlb.annotations.Attribute
class LanguageLevelState : BaseState() {
@get:Attribute("LANGUAGE_LEVEL")
var languageLevel by enum<LanguageLevel>()
var languageLevel: LanguageLevel? by enum<LanguageLevel>()
}

View File

@@ -19,8 +19,8 @@ interface PreContract {
}
internal data class KnownContract(val contract: StandardMethodContract) : PreContract {
override fun toContracts(method: PsiMethod, body: () -> PsiCodeBlock) = listOf(contract)
override fun negate() = negateContract(contract)?.let(::KnownContract)
override fun toContracts(method: PsiMethod, body: () -> PsiCodeBlock): List<StandardMethodContract> = listOf(contract)
override fun negate(): KnownContract? = negateContract(contract)?.let(::KnownContract)
}
internal data class DelegationContract(internal val expression: ExpressionRange, internal val negated: Boolean) : PreContract {
@@ -166,7 +166,7 @@ internal data class SideEffectFilter(internal val expressionsToCheck: List<Expre
}
internal data class NegatingContract(internal val negated: PreContract) : PreContract {
override fun toContracts(method: PsiMethod, body: () -> PsiCodeBlock) = negated.toContracts(method, body).mapNotNull(::negateContract)
override fun toContracts(method: PsiMethod, body: () -> PsiCodeBlock): List<StandardMethodContract> = negated.toContracts(method, body).mapNotNull(::negateContract)
}
private fun negateContract(c: StandardMethodContract): StandardMethodContract? {
@@ -177,7 +177,7 @@ private fun negateContract(c: StandardMethodContract): StandardMethodContract? {
@Suppress("EqualsOrHashCode")
internal data class MethodCallContract(internal val call: ExpressionRange, internal val states: List<List<StandardMethodContract.ValueConstraint>>) : PreContract {
override fun hashCode() = call.hashCode() * 31 + states.flatten().map { it.ordinal }.hashCode()
override fun hashCode(): Int = call.hashCode() * 31 + states.flatten().map { it.ordinal }.hashCode()
override fun toContracts(method: PsiMethod, body: () -> PsiCodeBlock): List<StandardMethodContract> {
val target = call.restoreExpression<PsiMethodCallExpression>(body()).resolveMethod()

View File

@@ -47,8 +47,8 @@ class LanguageLevelModuleExtensionBridge private constructor(private val module:
throw UnsupportedOperationException("This method must not be called for extensions backed by workspace model")
}
override fun commit() = Unit
override fun dispose() = Unit
override fun commit() {}
override fun dispose() {}
class Factory : ModuleExtensionBridgeFactory<LanguageLevelModuleExtensionBridge> {
override fun createExtension(module: ModuleBridge,

View File

@@ -20,7 +20,7 @@ import training.project.ProjectUtils
import java.nio.file.Path
abstract class JavaBasedLangSupport : AbstractLangSupport() {
protected val sourcesDirectoryPath = "src"
protected val sourcesDirectoryPath: String = "src"
override fun installAndOpenLearningProject(contentRoot: Path,
projectToClose: Project?,
@@ -69,5 +69,5 @@ abstract class JavaBasedLangSupport : AbstractLangSupport() {
override fun blockProjectFileModification(project: Project, file: VirtualFile): Boolean = true
override fun isSdkConfigured(project: Project) = ProjectRootManager.getInstance(project).projectSdk?.sdkType is JavaSdkType
override fun isSdkConfigured(project: Project): Boolean = ProjectRootManager.getInstance(project).projectSdk?.sdkType is JavaSdkType
}

View File

@@ -20,8 +20,8 @@ import training.util.getFeedbackLink
import javax.swing.JList
internal class JavaLangSupport : JavaBasedLangSupport() {
override val contentRootDirectoryName = "IdeaLearningProject"
override val projectResourcePath = "learnProjects/java/LearnProject"
override val contentRootDirectoryName: String = "IdeaLearningProject"
override val projectResourcePath: String = "learnProjects/java/LearnProject"
override val primaryLanguage: String = "JAVA"
@@ -31,10 +31,10 @@ internal class JavaLangSupport : JavaBasedLangSupport() {
override val sampleFilePath: String = "$sourcesDirectoryPath/Sample.java"
override val langCourseFeedback
override val langCourseFeedback: String?
get() = getFeedbackLink(this, false)
override val readMeCreator by lazy { ReadMeCreator() }
override val readMeCreator: ReadMeCreator by lazy { ReadMeCreator() }
override val sdkConfigurationTasks: LessonContext.(lesson: KLesson) -> Unit = {
val setupSdkText = ProjectBundle.message("project.sdk.setup")

View File

@@ -18,6 +18,7 @@ import com.intellij.openapi.application.ApplicationNamesInfo
import training.dsl.LessonUtil
import training.learn.CourseManager
import training.learn.LessonsBundle
import training.learn.course.IftModule
import training.learn.course.LearningCourseBase
import training.learn.course.LearningModule
import training.learn.course.LessonType
@@ -30,7 +31,7 @@ import training.learn.lesson.general.navigation.FindInFilesLesson
import training.learn.lesson.general.refactorings.ExtractVariableFromBubbleLesson
class JavaLearningCourse : LearningCourseBase(JavaLanguage.INSTANCE.id) {
override fun modules() = onboardingTour() + stableModules() + CourseManager.instance.findCommonModules("Git")
override fun modules(): List<IftModule> = onboardingTour() + stableModules() + CourseManager.instance.findCommonModules("Git")
private val disableOnboardingLesson get() = ApplicationNamesInfo.getInstance().fullProductNameWithEdition.equals("IDEA Edu")

View File

@@ -6,10 +6,10 @@ import training.dsl.parseLessonSample
import training.learn.lesson.general.NewSelectLesson
class JavaSelectLesson : NewSelectLesson() {
override val selectArgument = "\"$selectString\""
override val selectCall = """someMethod("$firstString", $selectArgument, "$thirdString")"""
override val selectArgument: String = "\"$selectString\""
override val selectCall: String = """someMethod("$firstString", $selectArgument, "$thirdString")"""
override val numberOfSelectsForWholeCall = 2
override val numberOfSelectsForWholeCall: Int = 2
override val sample: LessonSample = parseLessonSample("""
abstract class Scratch {
@@ -24,5 +24,5 @@ class JavaSelectLesson : NewSelectLesson() {
}
}
""".trimIndent())
override val selectIf = sample.getPosition(1).selection!!.let { sample.text.substring(it.first, it.second) }
override val selectIf: String = sample.getPosition(1).selection!!.let { sample.text.substring(it.first, it.second) }
}

View File

@@ -2,6 +2,7 @@
package com.intellij.java.ift.lesson.basic
import com.intellij.codeInsight.CodeInsightBundle
import org.jetbrains.annotations.Nls
import training.dsl.LessonSample
import training.dsl.parseLessonSample
import training.learn.lesson.general.SurroundAndUnwrapLesson
@@ -15,9 +16,9 @@ class JavaSurroundAndUnwrapLesson : SurroundAndUnwrapLesson() {
}
""".trimIndent())
override val surroundItems = arrayOf("try", "catch", "finally")
override val surroundItems: Array<String> = arrayOf("try", "catch", "finally")
override val lineShiftBeforeUnwrap = -2
override val lineShiftBeforeUnwrap: Int = -2
override val unwrapTryText = CodeInsightBundle.message("unwrap.try")
override val unwrapTryText: @Nls String = CodeInsightBundle.message("unwrap.try")
}

View File

@@ -1,12 +1,13 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.ift.lesson.completion
import training.dsl.LessonSample
import training.dsl.parseLessonSample
import training.learn.lesson.general.CompletionWithTabLesson
class JavaCompletionWithTabLesson :
CompletionWithTabLesson("DO_NOTHING_ON_CLOSE") {
override val sample = parseLessonSample("""import javax.swing.*;
override val sample: LessonSample = parseLessonSample("""import javax.swing.*;
class FrameDemo {

View File

@@ -2,16 +2,13 @@
package com.intellij.java.ift.lesson.completion
import com.intellij.java.ift.JavaLessonsBundle
import training.dsl.LessonContext
import training.dsl.LessonUtil
import training.dsl.*
import training.dsl.LessonUtil.restoreIfModifiedOrMoved
import training.dsl.TaskContext
import training.dsl.parseLessonSample
import training.learn.LessonsBundle
import training.learn.course.KLesson
class JavaSmartTypeCompletionLesson : KLesson("Smart type completion", LessonsBundle.message("smart.completion.lesson.name")) {
val sample = parseLessonSample("""
val sample: LessonSample = parseLessonSample("""
import java.lang.String;
import java.util.HashSet;
import java.util.LinkedList;

View File

@@ -5,18 +5,15 @@ import com.intellij.java.ift.JavaLessonsBundle
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiForStatement
import com.intellij.psi.util.PsiTreeUtil
import training.dsl.LessonContext
import training.dsl.LessonUtil
import training.dsl.*
import training.dsl.LessonUtil.checkExpectedStateOfEditor
import training.dsl.LessonUtil.restoreIfModifiedOrMoved
import training.dsl.TaskRuntimeContext
import training.dsl.parseLessonSample
import training.learn.course.KLesson
class JavaStatementCompletionLesson
: KLesson("Statement completion", JavaLessonsBundle.message("java.statement.completion.lesson.name")) {
val sample = parseLessonSample("""
val sample: LessonSample = parseLessonSample("""
class PrimeNumbers {
public static void main(String[] args) {
System.out.println("Prime numbers between 1 and 100");

View File

@@ -94,12 +94,12 @@ class JavaOnboardingTourLesson : KLesson("java.onboarding", JavaLessonsBundle.me
private val uiSettings get() = UISettings.getInstance()
override val properties = LessonProperties(
override val properties: LessonProperties = LessonProperties(
canStartInDumbMode = true,
openFileAtStart = false
)
override val testScriptProperties = TaskTestContext.TestScriptProperties(skipTesting = true)
override val testScriptProperties: TaskTestContext.TestScriptProperties = TaskTestContext.TestScriptProperties(skipTesting = true)
private var backupPopupLocation: Point? = null
private var hideToolStripesPreference = false

View File

@@ -5,7 +5,7 @@ import training.dsl.LessonContext
import training.learn.lesson.general.navigation.DeclarationAndUsagesLesson
class JavaDeclarationAndUsagesLesson : DeclarationAndUsagesLesson() {
override fun LessonContext.setInitialPosition() = caret("foo()")
override fun LessonContext.setInitialPosition(): Unit = caret("foo()")
override val sampleFilePath: String get() = "src/DerivedClass2.java"
override val entityName = "foo"
override val entityName: String = "foo"
}

View File

@@ -5,6 +5,7 @@ import com.intellij.find.SearchTextArea
import com.intellij.java.ift.JavaLessonsBundle
import com.intellij.usageView.UsageViewBundle
import training.dsl.LessonContext
import training.dsl.LessonSample
import training.dsl.LessonUtil
import training.dsl.LessonUtil.restoreIfModifiedOrMoved
import training.dsl.parseLessonSample
@@ -14,9 +15,9 @@ import training.learn.course.LessonType
class JavaOccurrencesLesson
: KLesson("java.occurrences.lesson", JavaLessonsBundle.message("java.find.occurrences.lesson.name")) {
override val lessonType = LessonType.SINGLE_EDITOR
override val lessonType: LessonType = LessonType.SINGLE_EDITOR
val sample = parseLessonSample("""
val sample: LessonSample = parseLessonSample("""
class OccurrencesDemo {
final private String DATABASE = "MyDataBase";
DataEntry myPerson;

View File

@@ -13,7 +13,7 @@ class JavaRecentFilesLesson : RecentFilesLesson() {
override val transitionFileName: String = "PrintStream"
override val stringForRecentFilesSearch: String = "print"
override fun LessonContext.setInitialPosition() = caret("println")
override fun LessonContext.setInitialPosition(): Unit = caret("println")
override val helpLinks: Map<String, String> get() = mapOf(
Pair(LessonsBundle.message("recent.files.locations.help.link"),

View File

@@ -6,7 +6,7 @@ import training.learn.LessonsBundle
import training.learn.lesson.general.navigation.SearchEverywhereLesson
class JavaSearchEverywhereLesson : SearchEverywhereLesson() {
override val sampleFilePath = "src/RecentFilesDemo.java"
override val sampleFilePath: String = "src/RecentFilesDemo.java"
override val resultFileName: String = "QuadraticEquationsSolver.java"
override fun LessonContext.epilogue() {

View File

@@ -13,7 +13,7 @@ import training.util.adaptToNotNativeLocalization
import javax.swing.JDialog
class JavaRefactoringMenuLesson : RefactoringMenuLessonBase("java.refactoring.menu") {
override val sample = parseLessonSample("""
override val sample: LessonSample = parseLessonSample("""
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

View File

@@ -23,12 +23,12 @@ import training.util.isToStringContains
class JavaDebugLesson : CommonDebugLesson("java.debug.workflow") {
override val testScriptProperties = TaskTestContext.TestScriptProperties(duration = 60)
override val testScriptProperties: TaskTestContext.TestScriptProperties = TaskTestContext.TestScriptProperties(duration = 60)
private val demoClassName = "Sample"
override val configurationName: String = demoClassName
override val sample = parseLessonSample("""
override val sample: LessonSample = parseLessonSample("""
public class $demoClassName {
public static void main(String[] args) {
double average = findAverage(prepareValues());
@@ -76,10 +76,10 @@ class JavaDebugLesson : CommonDebugLesson("java.debug.workflow") {
private val debugLineNumber = StringUtil.offsetToLineNumber(sample.text, sample.getPosition (2).startOffset)
override val confNameForWatches: String = "Application"
override val quickEvaluationArgument = "Integer.parseInt"
override val debuggingMethodName = "findAverage"
override val quickEvaluationArgument: String = "Integer.parseInt"
override val debuggingMethodName: String = "findAverage"
override val methodForStepInto: String = "extractNumber"
override val stepIntoDirectionToRight = true
override val stepIntoDirectionToRight: Boolean = true
override fun LessonContext.applyProgramChangeTasks() {
if (isHotSwapDisabled()) {

View File

@@ -53,13 +53,13 @@ class JavaSuggestedRefactoringSupport : SuggestedRefactoringSupport {
})?.textRange
}
override fun isIdentifierStart(c: Char) = c.isJavaIdentifierStart()
override fun isIdentifierPart(c: Char) = c.isJavaIdentifierPart()
override fun isIdentifierStart(c: Char): Boolean = c.isJavaIdentifierStart()
override fun isIdentifierPart(c: Char): Boolean = c.isJavaIdentifierPart()
override val stateChanges = JavaSuggestedRefactoringStateChanges(this)
override val availability = JavaSuggestedRefactoringAvailability(this)
override val ui get() = JavaSuggestedRefactoringUI
override val execution = JavaSuggestedRefactoringExecution(this)
override val stateChanges: JavaSuggestedRefactoringStateChanges = JavaSuggestedRefactoringStateChanges(this)
override val availability: JavaSuggestedRefactoringAvailability = JavaSuggestedRefactoringAvailability(this)
override val ui: JavaSuggestedRefactoringUI get() = JavaSuggestedRefactoringUI
override val execution: JavaSuggestedRefactoringExecution = JavaSuggestedRefactoringExecution(this)
companion object {
fun extractAnnotationsToCopy(type: PsiType, owner: PsiModifierListOwner, file: PsiFile): List<PsiAnnotation> {

View File

@@ -11,5 +11,5 @@ class InferredNullabilityAnnotationsLineMarkerProvider : NonCodeAnnotationsLineM
class InferredContractAnnotationsLineMarkerProvider : NonCodeAnnotationsLineMarkerProvider(
JavaBundle.message("line.marker.type.inferred.contract.annotations"), LineMarkerType.InferredContract) {
override fun isEnabledByDefault() = false
override fun isEnabledByDefault(): Boolean = false
}

View File

@@ -125,7 +125,7 @@ object JavaCompletionFeatures {
return null
}
fun calculateVariables(environment: CompletionEnvironment) = try {
fun calculateVariables(environment: CompletionEnvironment): Unit? = try {
PsiTreeUtil.getParentOfType(environment.parameters.position, PsiMethod::class.java)?.let { enclosingMethod ->
val variables = getVariablesInScope(environment.parameters.position, enclosingMethod)
val names = variables.mapNotNull { it.name }.toSet()

View File

@@ -32,8 +32,8 @@ internal class JavaCodeVisionConfigurable(val settings: JavaCodeVisionSettings)
get() = JavaBundle.message("settings.inlay.java.show.hints.for")
companion object {
const val USAGES_CASE_ID = "usages"
const val INHERITORS_CASE_ID = "inheritors"
const val USAGES_CASE_ID: String = "usages"
const val INHERITORS_CASE_ID: String = "inheritors"
@JvmStatic
fun getCaseName(caseId: String): Supplier<@Nls String> =

View File

@@ -17,7 +17,7 @@ import java.awt.event.MouseEvent
class JavaInheritorsCodeVisionProvider : InheritorsCodeVisionProvider() {
companion object {
const val ID = "java.inheritors"
const val ID: String = "java.inheritors"
}
override fun acceptsFile(file: PsiFile): Boolean = file.language == JavaLanguage.INSTANCE

View File

@@ -13,7 +13,7 @@ import com.intellij.psi.PsiTypeParameter
class JavaReferencesCodeVisionProvider : ReferencesCodeVisionProvider() {
companion object{
const val ID = "java.references"
const val ID: String = "java.references"
}
override fun acceptsFile(file: PsiFile): Boolean = file.language == JavaLanguage.INSTANCE

View File

@@ -21,13 +21,13 @@ internal class FileStateUpdater(private val prevState: FileState?) : JavaElement
private val snapshot = mutableMapOf<SmartPsiElementPointer<PsiMember>, ScopedMember>()
private val changes = mutableMapOf<PsiMember, ScopedMember?>()
override fun visitEnumConstant(psiEnumConstant: PsiEnumConstant) = visitMember(psiEnumConstant)
override fun visitEnumConstant(psiEnumConstant: PsiEnumConstant): Unit = visitMember(psiEnumConstant)
override fun visitClass(psiClass: PsiClass) = visitMember(psiClass)
override fun visitClass(psiClass: PsiClass): Unit = visitMember(psiClass)
override fun visitField(psiField: PsiField) = visitMember(psiField)
override fun visitField(psiField: PsiField): Unit = visitMember(psiField)
override fun visitMethod(psiMethod: PsiMethod) = visitMember(psiMethod)
override fun visitMethod(psiMethod: PsiMethod): Unit = visitMember(psiMethod)
private fun visitMember(psiMember: PsiMember) {
val member = ScopedMember.create(psiMember) ?: return

View File

@@ -7,11 +7,11 @@ import com.intellij.psi.search.SearchScope
internal class ScopedMember(val member: Member, val scope: SearchScope) {
val name = member.name
val name: String = member.name
internal fun hasChanged(other: ScopedMember) = member.hasChanged(other.member)
internal fun hasChanged(other: ScopedMember): Boolean = member.hasChanged(other.member)
override fun equals(other: Any?) = other is ScopedMember && member == other.member
override fun equals(other: Any?): Boolean = other is ScopedMember && member == other.member
override fun hashCode(): Int = member.hashCode()
@@ -37,7 +37,7 @@ internal sealed class Member(open val name: String, open val modifiers: Set<Stri
protected abstract fun copy(modifiers: MutableSet<String>): Member
companion object {
internal fun create(psiMember: PsiMember) = when (psiMember) {
internal fun create(psiMember: PsiMember): Member? = when (psiMember) {
is PsiEnumConstant -> EnumConstant.create(psiMember)
is PsiMethod -> Method.create(psiMember)
is PsiField -> Field.create(psiMember)

View File

@@ -13,7 +13,7 @@ import com.intellij.util.concurrency.AppExecutorUtil
class JavaFqnDeclarativeInlayActionHandler : InlayActionHandler {
companion object {
const val HANDLER_NAME = "java.fqn.class"
const val HANDLER_NAME: String = "java.fqn.class"
}
override fun handleClick(editor: Editor, payload: InlayActionPayload) {

View File

@@ -9,7 +9,7 @@ import com.siyeh.ig.psiutils.ExpressionUtils
class JavaMethodChainsDeclarativeInlayProvider : AbstractDeclarativeCallChainProvider<PsiMethodCallExpression, PsiType, Unit>() {
companion object {
const val PROVIDER_ID = "java.method.chains"
const val PROVIDER_ID: String = "java.method.chains"
}
override fun PsiType.buildTree(expression: PsiElement, project: Project, context: Unit, treeBuilder: PresentationTreeBuilder) {

View File

@@ -3,9 +3,7 @@ package com.intellij.find.findUsages
import com.intellij.ide.util.scopeChooser.ScopeIdMapper
import com.intellij.internal.statistic.eventLog.EventLogGroup
import com.intellij.internal.statistic.eventLog.events.EventField
import com.intellij.internal.statistic.eventLog.events.EventFields
import com.intellij.internal.statistic.eventLog.events.VarargEventId
import com.intellij.internal.statistic.eventLog.events.*
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
internal class JavaFindUsagesCollector : CounterUsagesCollector() {
@@ -15,95 +13,95 @@ internal class JavaFindUsagesCollector : CounterUsagesCollector() {
private val GROUP = EventLogGroup("java.find.usages", 3)
@JvmField
val USAGES = EventFields.Boolean("usages")
val USAGES: BooleanEventField = EventFields.Boolean("usages")
@JvmField
val TEXT_OCCURRENCES = EventFields.Boolean("textOccurrences")
val TEXT_OCCURRENCES: BooleanEventField = EventFields.Boolean("textOccurrences")
@JvmField
val SEARCH_SCOPE = EventFields.String("searchScope", ScopeIdMapper.standardNames.toList())
val SEARCH_SCOPE: StringEventField = EventFields.String("searchScope", ScopeIdMapper.standardNames.toList())
@JvmField
val METHOD_USAGES = EventFields.Boolean("methodUsages")
val METHOD_USAGES: BooleanEventField = EventFields.Boolean("methodUsages")
@JvmField
val FIELD_USAGES = EventFields.Boolean("fieldUsages")
val FIELD_USAGES: BooleanEventField = EventFields.Boolean("fieldUsages")
@JvmField
val DERIVED_USAGES = EventFields.Boolean("derivedUsages")
val DERIVED_USAGES: BooleanEventField = EventFields.Boolean("derivedUsages")
@JvmField
val IMPLEMENTING_CLASSES = EventFields.Boolean("implementingClasses")
val IMPLEMENTING_CLASSES: BooleanEventField = EventFields.Boolean("implementingClasses")
@JvmField
val DERIVED_INTERFACES = EventFields.Boolean("derivedInterfaces")
val DERIVED_INTERFACES: BooleanEventField = EventFields.Boolean("derivedInterfaces")
@JvmField
val SEARCH_FOR_BASE_METHODS = EventFields.Boolean("searchForBaseMethods")
val SEARCH_FOR_BASE_METHODS: BooleanEventField = EventFields.Boolean("searchForBaseMethods")
@JvmField
val OVERRIDING_METHODS = EventFields.Boolean("overridingMethods")
val OVERRIDING_METHODS: BooleanEventField = EventFields.Boolean("overridingMethods")
@JvmField
val IMPLEMENTING_METHODS = EventFields.Boolean("implementingMethods")
val IMPLEMENTING_METHODS: BooleanEventField = EventFields.Boolean("implementingMethods")
@JvmField
val INCLUDE_INHERITED = EventFields.Boolean("includeInherited")
val INCLUDE_INHERITED: BooleanEventField = EventFields.Boolean("includeInherited")
@JvmField
val INCLUDE_OVERLOAD = EventFields.Boolean("includeOverload")
val INCLUDE_OVERLOAD: BooleanEventField = EventFields.Boolean("includeOverload")
@JvmField
val IMPLICIT_CALLS = EventFields.Boolean("implicitCalls")
val IMPLICIT_CALLS: BooleanEventField = EventFields.Boolean("implicitCalls")
@JvmField
val CLASSES_USAGES = EventFields.Boolean("classesUsages")
val CLASSES_USAGES: BooleanEventField = EventFields.Boolean("classesUsages")
@JvmField
val SEARCH_FOR_BASE_ACCESSOR = EventFields.Boolean("searchForBaseAccessors")
val SEARCH_FOR_BASE_ACCESSOR: BooleanEventField = EventFields.Boolean("searchForBaseAccessors")
@JvmField
val SEARCH_FOR_ACCESSORS = EventFields.Boolean("searchForAccessors")
val SEARCH_FOR_ACCESSORS: BooleanEventField = EventFields.Boolean("searchForAccessors")
@JvmField
val SEARCH_IN_OVERRIDING = EventFields.Boolean("searchInOverriding")
val SEARCH_IN_OVERRIDING: BooleanEventField = EventFields.Boolean("searchInOverriding")
@JvmField
val READ_ACCESS = EventFields.Boolean("readAccess")
val READ_ACCESS: BooleanEventField = EventFields.Boolean("readAccess")
@JvmField
val WRITE_ACCESS = EventFields.Boolean("writeAccess")
val WRITE_ACCESS: BooleanEventField = EventFields.Boolean("writeAccess")
@JvmField
val FIND_CLASS_STARTED = registerEvent("find.class.started",
METHOD_USAGES,
FIELD_USAGES,
DERIVED_USAGES,
IMPLEMENTING_CLASSES,
DERIVED_INTERFACES)
val FIND_CLASS_STARTED: VarargEventId = registerEvent("find.class.started",
METHOD_USAGES,
FIELD_USAGES,
DERIVED_USAGES,
IMPLEMENTING_CLASSES,
DERIVED_INTERFACES)
@JvmField
val FIND_METHOD_STARTED = registerEvent("find.method.started",
SEARCH_FOR_BASE_METHODS,
OVERRIDING_METHODS,
IMPLEMENTING_METHODS,
INCLUDE_INHERITED,
INCLUDE_OVERLOAD,
IMPLICIT_CALLS)
val FIND_METHOD_STARTED: VarargEventId = registerEvent("find.method.started",
SEARCH_FOR_BASE_METHODS,
OVERRIDING_METHODS,
IMPLEMENTING_METHODS,
INCLUDE_INHERITED,
INCLUDE_OVERLOAD,
IMPLICIT_CALLS)
@JvmField
val FIND_PACKAGE_STARTED = registerEvent("find.package.started", CLASSES_USAGES)
val FIND_PACKAGE_STARTED: VarargEventId = registerEvent("find.package.started", CLASSES_USAGES)
@JvmField
val FIND_THROW_STARTED = registerEvent("find.throw.started")
val FIND_THROW_STARTED: VarargEventId = registerEvent("find.throw.started")
@JvmField
val FIND_VARIABLE_STARTED = registerEvent("find.variable.started",
SEARCH_FOR_BASE_ACCESSOR,
SEARCH_FOR_ACCESSORS,
SEARCH_IN_OVERRIDING,
READ_ACCESS,
WRITE_ACCESS)
val FIND_VARIABLE_STARTED: VarargEventId = registerEvent("find.variable.started",
SEARCH_FOR_BASE_ACCESSOR,
SEARCH_FOR_ACCESSORS,
SEARCH_IN_OVERRIDING,
READ_ACCESS,
WRITE_ACCESS)
private fun registerEvent(eventId: String, vararg additionalFields: EventField<*>): VarargEventId {
return GROUP.registerVarargEvent(eventId, USAGES, TEXT_OCCURRENCES, SEARCH_SCOPE, *additionalFields)

View File

@@ -73,4 +73,4 @@ private fun positionCaret(context: InsertionContext) {
context.editor.caretModel.moveToOffset(if (hasParams) (argRange.startOffset + argRange.endOffset) / 2 else argRange.endOffset)
}
fun looksLikeBuilder(clazz: PsiClass?) = clazz?.name?.contains("Builder") == true
fun looksLikeBuilder(clazz: PsiClass?): Boolean = clazz?.name?.contains("Builder") == true

View File

@@ -3,10 +3,7 @@ package com.intellij.psi.impl.beanProperties
import com.intellij.lang.java.beans.PropertyKind
import com.intellij.lang.jvm.JvmModifier
import com.intellij.lang.jvm.actions.AnnotationRequest
import com.intellij.lang.jvm.actions.CreateMethodRequest
import com.intellij.lang.jvm.actions.expectedParameter
import com.intellij.lang.jvm.actions.expectedTypes
import com.intellij.lang.jvm.actions.*
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiJvmSubstitutor
import com.intellij.psi.PsiSubstitutor
@@ -28,18 +25,18 @@ class CreateBeanPropertyRequest(
override fun getMethodName(): String = myMethodName
private val myReturnType = if (isSetter) expectedTypes(PsiTypes.voidType()) else expectedTypes
override fun getReturnType() = myReturnType
override fun getReturnType(): ExpectedTypes = myReturnType
private val myModifiers = listOf(JvmModifier.PUBLIC)
override fun getModifiers() = myModifiers
override fun getModifiers(): List<JvmModifier> = myModifiers
override fun getAnnotations() = emptyList<AnnotationRequest>()
override fun getAnnotations(): List<AnnotationRequest> = emptyList<AnnotationRequest>()
private val myTargetSubstitutor = PsiJvmSubstitutor(project, PsiSubstitutor.EMPTY)
override fun getTargetSubstitutor() = myTargetSubstitutor
override fun getTargetSubstitutor(): PsiJvmSubstitutor = myTargetSubstitutor
private val myParameters = if (isSetter) listOf(expectedParameter(type, propertyName)) else emptyList()
override fun getExpectedParameters() = myParameters
override fun getExpectedParameters(): List<ExpectedParameter> = myParameters
override fun isValid() = type.isValid
override fun isValid(): Boolean = type.isValid
}

View File

@@ -21,6 +21,7 @@ import com.intellij.psi.tree.TokenSet
import com.intellij.psi.util.PropertyUtil
import com.intellij.psi.util.PropertyUtilBase
import com.intellij.util.gist.GistManager
import com.intellij.util.gist.PsiFileGist
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.DataInputOutputUtil
import com.intellij.util.io.EnumeratorStringDescriptor
@@ -51,7 +52,7 @@ private fun resolveFieldFromIndexValue(method: PsiMethod, isGetter: Boolean): Ps
}
@VisibleForTesting
val javaSimplePropertyGist = GistManager.getInstance().newPsiFileGist("java.simple.property", 2, SimplePropertiesExternalizer()) { file ->
val javaSimplePropertyGist: PsiFileGist<Int2ObjectMap<PropertyIndexValue>> = GistManager.getInstance().newPsiFileGist("java.simple.property", 2, SimplePropertiesExternalizer()) { file ->
findSimplePropertyCandidates(file.node.lighterAST)
}

View File

@@ -14,14 +14,14 @@ import org.assertj.core.api.Assertions.assertThat
class ServiceLineMarkerTest : LightJavaCodeInsightFixtureTestCase() {
override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_9
override fun isIconRequired() = true
override fun isIconRequired(): Boolean = true
override fun setUp() {
super.setUp()
myFixture.addFileToProject("foo/bar/MyService.java", "package foo.bar;\npublic class MyService { void doWork(); }")
}
fun testProvidesAsSubclass() =
fun testProvidesAsSubclass(): Unit =
doTestImplementer("""
public class <caret>MyServiceImpl implements MyService {
@Override public void doWork() {}

View File

@@ -8,13 +8,13 @@ import com.intellij.psi.PsiJavaFile
import com.intellij.psi.PsiJavaModule
class AddModuleDirectiveTest : LightJava9ModulesCodeInsightFixtureTestCase() {
fun testNewRequires() = doRequiresTest(
fun testNewRequires(): Unit = doRequiresTest(
"module M { }",
"module M {\n" +
" requires M2;\n" +
"}")
fun testRequiresAfterOther() = doRequiresTest(
fun testRequiresAfterOther(): Unit = doRequiresTest(
"module M {\n" +
" requires other;\n" +
"}",
@@ -23,22 +23,22 @@ class AddModuleDirectiveTest : LightJava9ModulesCodeInsightFixtureTestCase() {
" requires M2;\n" +
"}")
fun testNoDuplicateRequires() = doRequiresTest(
fun testNoDuplicateRequires(): Unit = doRequiresTest(
"module M { requires M2; }",
"module M { requires M2; }")
fun testRequiresInIncompleteModule() = doRequiresTest(
fun testRequiresInIncompleteModule(): Unit = doRequiresTest(
"module M {",
"module M {\n" +
" requires M2;")
fun testNewExports() = doExportsTest(
fun testNewExports(): Unit = doExportsTest(
"module M { }",
"module M {\n" +
" exports pkg.m;\n" +
"}")
fun testExportsAfterOther() = doExportsTest(
fun testExportsAfterOther(): Unit = doExportsTest(
"module M {\n" +
" exports pkg.other;\n" +
"}",
@@ -47,20 +47,20 @@ class AddModuleDirectiveTest : LightJava9ModulesCodeInsightFixtureTestCase() {
" exports pkg.m;\n" +
"}")
fun testNoNarrowingExports() = doExportsTest(
fun testNoNarrowingExports(): Unit = doExportsTest(
"module M { exports pkg.m; }",
"module M { exports pkg.m; }")
fun testNoDuplicateExports() = doExportsTest(
fun testNoDuplicateExports(): Unit = doExportsTest(
"module M { exports pkg.m to M1, M2; }",
"module M { exports pkg.m to M1, M2; }")
fun testNoExportsToUnnamed() = doExportsTest(
fun testNoExportsToUnnamed(): Unit = doExportsTest(
"module M { exports pkg.m to M1; }",
"module M { exports pkg.m to M1; }",
target = "")
fun testExportsExtendsOther() = doExportsTest(
fun testExportsExtendsOther(): Unit = doExportsTest(
"module M {\n" +
" exports pkg.m to M1;\n" +
"}",
@@ -68,7 +68,7 @@ class AddModuleDirectiveTest : LightJava9ModulesCodeInsightFixtureTestCase() {
" exports pkg.m to M1, M2;\n" +
"}")
fun testExportsExtendsIncompleteOther() = doExportsTest(
fun testExportsExtendsIncompleteOther(): Unit = doExportsTest(
"module M {\n" +
" exports pkg.m to M1\n" +
"}",
@@ -76,13 +76,13 @@ class AddModuleDirectiveTest : LightJava9ModulesCodeInsightFixtureTestCase() {
" exports pkg.m to M1, M2\n" +
"}")
fun testNewUses() = doUsesTest(
fun testNewUses(): Unit = doUsesTest(
"module M { }",
"module M {\n" +
" uses pkg.m.C;\n" +
"}")
fun testUsesAfterOther() = doUsesTest(
fun testUsesAfterOther(): Unit = doUsesTest(
"module M {\n" +
" uses pkg.m.B;\n" +
"}",
@@ -91,7 +91,7 @@ class AddModuleDirectiveTest : LightJava9ModulesCodeInsightFixtureTestCase() {
" uses pkg.m.C;\n" +
"}")
fun testNoDuplicateUses() = doUsesTest(
fun testNoDuplicateUses(): Unit = doUsesTest(
"module M { uses pkg.m.C; }",
"module M { uses pkg.m.C; }")

View File

@@ -8,14 +8,14 @@ import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
class CreateClassInPackageInModuleTest : LightJavaCodeInsightFixtureTestCase() {
fun testExportsMissingDir() = doTestMissingDir("exports")
fun testOpensMissingDir() = doTestMissingDir("opens")
fun testExportsMissingDir(): Unit = doTestMissingDir("exports")
fun testOpensMissingDir(): Unit = doTestMissingDir("opens")
fun testExportsEmptyDir() = doTestEmptyDir("exports")
fun testOpensEmptyDir() = doTestEmptyDir("opens")
fun testExportsEmptyDir(): Unit = doTestEmptyDir("exports")
fun testOpensEmptyDir(): Unit = doTestEmptyDir("opens")
fun testExportsInterface() = doTestInterface("exports")
fun testOpensInterface() = doTestInterface("opens")
fun testExportsInterface(): Unit = doTestInterface("exports")
fun testOpensInterface(): Unit = doTestInterface("opens")
private fun doTestMissingDir(keyword: String) {
val moduleInfo = myFixture.configureByText("module-info.java", "module foo.bar { $keyword foo.bar.<caret>missing; }") as PsiJavaFile

View File

@@ -86,9 +86,9 @@ class CreateServiceInterfaceOrClassTest : LightJava9ModulesCodeInsightFixtureTes
"}\n", true)
}
fun testExistingLibraryPackage() = doTestNoAction("module foo.bar { uses java.io.<caret>MyService; }")
fun testExistingLibraryPackage(): Unit = doTestNoAction("module foo.bar { uses java.io.<caret>MyService; }")
fun testExistingLibraryOuterClass() = doTestNoAction("module foo.bar { uses java.io.File.<caret>MyService; }")
fun testExistingLibraryOuterClass(): Unit = doTestNoAction("module foo.bar { uses java.io.File.<caret>MyService; }")
private fun doAction(interfaceFQN: String, moduleInfo: PsiJavaFile,
rootDirectory: PsiDirectory? = null, classKind: CreateClassKind = CreateClassKind.CLASS) {

View File

@@ -5,6 +5,6 @@ import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCa
class DeleteUnreachableTest : LightQuickFixParameterizedTestCase() {
override fun getBasePath() = "/codeInsight/daemonCodeAnalyzer/quickFix/deleteUnreachable"
override fun getBasePath(): String = "/codeInsight/daemonCodeAnalyzer/quickFix/deleteUnreachable"
}

View File

@@ -15,5 +15,5 @@ class JavaLangInvokeFieldHandleSignatureFixTest : LightQuickFixParameterizedTest
enableInspectionTool(JavaLangInvokeHandleSignatureInspection())
}
override fun getBasePath() = "/codeInsight/daemonCodeAnalyzer/quickFix/fieldHandle"
override fun getBasePath(): String = "/codeInsight/daemonCodeAnalyzer/quickFix/fieldHandle"
}

View File

@@ -27,25 +27,25 @@ class JavaLangInvokeMethodHandleSignatureFixTest : LightJavaCodeInsightFixtureTe
override fun getTestDataPath(): String = JavaTestUtil.getJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/quickFix/methodHandle"
fun testConstructor() = doTestConstructor(INT)
fun testConstructor2() = doTestConstructor(INT)
fun testConstructor3() = doTestConstructor()
fun testConstructor4() = doTestConstructor()
fun testConstructor(): Unit = doTestConstructor(INT)
fun testConstructor2(): Unit = doTestConstructor(INT)
fun testConstructor3(): Unit = doTestConstructor()
fun testConstructor4(): Unit = doTestConstructor()
fun testGenericMethod() = doTestMethod(OBJECT, OBJECT)
fun testGenericMethod2() = doTestMethod(OBJECT, OBJECT, OBJECT_ARRAY)
fun testGenericMethod3() = doTestMethod(OBJECT, OBJECT, STRING)
fun testGenericMethod4() = doTestMethod(OBJECT, OBJECT)
fun testGenericMethod(): Unit = doTestMethod(OBJECT, OBJECT)
fun testGenericMethod2(): Unit = doTestMethod(OBJECT, OBJECT, OBJECT_ARRAY)
fun testGenericMethod3(): Unit = doTestMethod(OBJECT, OBJECT, STRING)
fun testGenericMethod4(): Unit = doTestMethod(OBJECT, OBJECT)
fun testStaticMethod() = doTestMethod(VOID)
fun testStaticMethod2() = doTestMethod(STRING, STRING)
fun testStaticMethod3() = doTestMethod(STRING, STRING, STRING_ARRAY)
fun testStaticMethod4() = doTestReplace("findStatic")
fun testStaticMethod(): Unit = doTestMethod(VOID)
fun testStaticMethod2(): Unit = doTestMethod(STRING, STRING)
fun testStaticMethod3(): Unit = doTestMethod(STRING, STRING, STRING_ARRAY)
fun testStaticMethod4(): Unit = doTestReplace("findStatic")
fun testVirtualMethod() = doTestMethod(VOID)
fun testVirtualMethod2() = doTestMethod(STRING, STRING)
fun testVirtualMethod3() = doTestMethod(STRING, STRING, STRING_ARRAY)
fun testVirtualMethod4() = doTestReplace("findVirtual")
fun testVirtualMethod(): Unit = doTestMethod(VOID)
fun testVirtualMethod2(): Unit = doTestMethod(STRING, STRING)
fun testVirtualMethod3(): Unit = doTestMethod(STRING, STRING, STRING_ARRAY)
fun testVirtualMethod4(): Unit = doTestReplace("findVirtual")
private fun doTestMethod(vararg withSignature: String) = doTest(USE_METHOD, *withSignature)

View File

@@ -9,19 +9,19 @@ import com.intellij.java.testFramework.fixtures.MultiModuleJava9ProjectDescripto
class MergeModuleStatementsFixTest : LightJava9ModulesCodeInsightFixtureTestCase() {
override fun getBasePath() = getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/quickFix/mergeModuleStatementsFix"
override fun getBasePath(): String = getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/quickFix/mergeModuleStatementsFix"
fun testExports1() = doTest("exports", "my.api")
fun testExports2() = doTest("exports", "my.api")
fun testExports3() = doTest("exports", "my.api")
fun testExports1(): Unit = doTest("exports", "my.api")
fun testExports2(): Unit = doTest("exports", "my.api")
fun testExports3(): Unit = doTest("exports", "my.api")
fun testProvides1() = doTest("provides", "my.api.MyService")
fun testProvides2() = doTest("provides", "my.api.MyService")
fun testProvides3() = doTest("provides", "my.api.MyService")
fun testProvides1(): Unit = doTest("provides", "my.api.MyService")
fun testProvides2(): Unit = doTest("provides", "my.api.MyService")
fun testProvides3(): Unit = doTest("provides", "my.api.MyService")
fun testOpens1() = doTest("opens", "my.api")
fun testOpens2() = doTest("opens", "my.api")
fun testOpens3() = doTest("opens", "my.api")
fun testOpens1(): Unit = doTest("opens", "my.api")
fun testOpens2(): Unit = doTest("opens", "my.api")
fun testOpens3(): Unit = doTest("opens", "my.api")
override fun setUp() {

View File

@@ -55,15 +55,15 @@ internal class BrokenPluginException : RuntimeException()
@InternalIgnoreDependencyViolation
internal class BrokenFileBasedIndexExtension : ScalarIndexExtension<Int>() {
override fun getIndexer() = DataIndexer<Int, Void, FileContent> { throw BrokenPluginException() }
override fun getName() = INDEX_ID
override fun getKeyDescriptor() = EnumeratorIntegerDescriptor.INSTANCE!!
override fun getVersion() = 0
override fun getInputFilter() = FileBasedIndex.InputFilter { it.name.contains("Some") }
override fun dependsOnFileContent() = true
override fun getIndexer(): DataIndexer<Int, Void, FileContent> = DataIndexer<Int, Void, FileContent> { throw BrokenPluginException() }
override fun getName(): ID<Int, Void> = INDEX_ID
override fun getKeyDescriptor(): EnumeratorIntegerDescriptor = EnumeratorIntegerDescriptor.INSTANCE!!
override fun getVersion(): Int = 0
override fun getInputFilter(): FileBasedIndex.InputFilter = FileBasedIndex.InputFilter { it.name.contains("Some") }
override fun dependsOnFileContent(): Boolean = true
companion object {
@JvmStatic
val INDEX_ID = ID.create<Int, Void>("broken.file.based.index")
val INDEX_ID: ID<Int, Void> = ID.create<Int, Void>("broken.file.based.index")
}
}

View File

@@ -14,15 +14,15 @@ import java.util.concurrent.atomic.AtomicInteger
internal class CountingFileBasedIndexExtension : CountingIndexBase("counting.file.based.index", true) {
companion object {
@JvmStatic
val INDEX_ID
val INDEX_ID: ID<Int, Void>
get() = INSTANCE.name
@JvmStatic
val COUNTER
val COUNTER: AtomicInteger
get() = INSTANCE.counter
@JvmStatic
val INSTANCE
val INSTANCE: CountingFileBasedIndexExtension
get() = EXTENSION_POINT_NAME.findExtensionOrFail(CountingFileBasedIndexExtension::class.java)
@JvmStatic
@@ -34,7 +34,7 @@ internal class CountingFileBasedIndexExtension : CountingIndexBase("counting.fil
@InternalIgnoreDependencyViolation
internal class CountingContentIndependentFileBasedIndexExtension :
CountingIndexBase("counting.content.independent.file.based.index", false) {
override fun getDefaultValue() = mapOf(2 to null)
override fun getDefaultValue(): Map<Int, Nothing?> = mapOf(2 to null)
companion object {
@JvmStatic
@@ -50,7 +50,7 @@ private fun <T : CountingIndexBase> registerCountingFileBasedIndex(clazz: Class<
}
internal open class CountingIndexBase(id: String, private val dependsOnFileContent: Boolean) : ScalarIndexExtension<Int>() {
internal val counter = AtomicInteger()
internal val counter: AtomicInteger = AtomicInteger()
override fun getIndexer(): DataIndexer<Int, Void, FileContent> {
return DataIndexer {
@@ -65,5 +65,5 @@ internal open class CountingIndexBase(id: String, private val dependsOnFileConte
override fun getVersion(): Int = 0
override fun getInputFilter(): FileBasedIndex.InputFilter = FileBasedIndex.InputFilter { f: VirtualFile -> f.name.contains("Foo") }
override fun dependsOnFileContent(): Boolean = dependsOnFileContent
open fun getDefaultValue() = mapOf(1 to null)
open fun getDefaultValue(): Map<Int, Nothing?> = mapOf(1 to null)
}

View File

@@ -42,7 +42,7 @@ class IndexInfrastructureExtensionTest : LightJavaCodeInsightFixtureTestCase() {
}
}
const val testInfraExtensionFile = "_test_extension"
const val testInfraExtensionFile: String = "_test_extension"
@InternalIgnoreDependencyViolation
class TestIndexInfrastructureExtension : FileBasedIndexInfrastructureExtension {
@@ -55,18 +55,18 @@ class TestIndexInfrastructureExtension : FileBasedIndexInfrastructureExtension {
return null
}
override fun onFileBasedIndexVersionChanged(indexId: ID<*, *>) = Unit
override fun onFileBasedIndexVersionChanged(indexId: ID<*, *>) {}
override fun onStubIndexVersionChanged(indexId: StubIndexKey<*, *>) = Unit
override fun onStubIndexVersionChanged(indexId: StubIndexKey<*, *>) {}
override fun initialize(indexLayoutId: String?): FileBasedIndexInfrastructureExtension.InitializationResult
= FileBasedIndexInfrastructureExtension.InitializationResult.INDEX_REBUILD_REQUIRED
override fun resetPersistentState() = Unit
override fun resetPersistentState() {}
override fun resetPersistentState(indexId: ID<*, *>) = Unit
override fun resetPersistentState(indexId: ID<*, *>) {}
override fun shutdown() = Unit
override fun shutdown() {}
override fun getVersion(): Int = 0

View File

@@ -6,11 +6,13 @@ import com.intellij.lang.java.JavaParserDefinition
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.fileEditor.impl.LoadTextUtil
import com.intellij.openapi.vfs.VfsUtil
import com.intellij.psi.stubs.PsiFileStub
import com.intellij.psi.tree.IStubFileElementType
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase
class JavaPerFileElementTypeModificationTrackerTest : JavaCodeInsightFixtureTestCase() {
companion object {
val JAVA = JavaParserDefinition.JAVA_FILE!!
val JAVA: IStubFileElementType<out PsiFileStub<*>> = JavaParserDefinition.JAVA_FILE!!
}
private val helper = StubIndexPerFileElementTypeModificationTrackerTestHelper()

View File

@@ -24,25 +24,25 @@ import java.util.concurrent.atomic.AtomicInteger
import kotlin.io.path.writeText
import kotlin.test.assertEquals
const val fileNameMarkerPrefix = "TestFoo"
const val fileNameMarkerPrefix: String = "TestFoo"
@RunsInEdt
class MultiProjectIndexTest {
@Rule
@JvmField
val tempDir = TempDirectory()
val tempDir: TempDirectory = TempDirectory()
@Rule
@JvmField
val disposable = DisposableRule()
val disposable: DisposableRule = DisposableRule()
@Rule
@JvmField
val appRule = ApplicationRule()
val appRule: ApplicationRule = ApplicationRule()
@Rule
@JvmField
val runInEdt = EdtRule()
val runInEdt: EdtRule = EdtRule()
@Test
fun `test index extension process files intersection`() {
@@ -92,9 +92,9 @@ class MultiProjectIndexTest {
@InternalIgnoreDependencyViolation
internal class CountingTestExtension : FileBasedIndexInfrastructureExtension {
val stubCounter = AtomicInteger()
val trigramCounter = AtomicInteger()
val commonBundledFileCounter = AtomicInteger()
val stubCounter: AtomicInteger = AtomicInteger()
val trigramCounter: AtomicInteger = AtomicInteger()
val commonBundledFileCounter: AtomicInteger = AtomicInteger()
override fun createFileIndexingStatusProcessor(project: Project): FileBasedIndexInfrastructureExtension.FileIndexingStatusProcessor {
return object : FileBasedIndexInfrastructureExtension.FileIndexingStatusProcessor {
@@ -126,18 +126,18 @@ internal class CountingTestExtension : FileBasedIndexInfrastructureExtension {
return baseIndex
}
override fun onFileBasedIndexVersionChanged(indexId: ID<*, *>) = Unit
override fun onFileBasedIndexVersionChanged(indexId: ID<*, *>) {}
override fun onStubIndexVersionChanged(indexId: StubIndexKey<*, *>) = Unit
override fun onStubIndexVersionChanged(indexId: StubIndexKey<*, *>) {}
override fun initialize(indexLayoutId: String?): FileBasedIndexInfrastructureExtension.InitializationResult =
FileBasedIndexInfrastructureExtension.InitializationResult.SUCCESSFULLY
override fun resetPersistentState() = Unit
override fun resetPersistentState() {}
override fun resetPersistentState(indexId: ID<*, *>) = Unit
override fun resetPersistentState(indexId: ID<*, *>) {}
override fun shutdown() = Unit
override fun shutdown() {}
override fun getVersion(): Int = 0

View File

@@ -14,10 +14,10 @@ import kotlin.io.path.pathString
class StorageDiagnosticTest {
@get: Rule
val tempDir = TempDirectory()
val tempDir: TempDirectory = TempDirectory()
@get: Rule
val app = ApplicationRule()
val app: ApplicationRule = ApplicationRule()
@Test
fun `test dump persistent map stats`() {

View File

@@ -23,7 +23,7 @@ class StubIndexPerFileElementTypeModificationTrackerTestHelper() {
FileBasedIndex.getInstance().ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, GlobalSearchScope.allScope(project))
}
fun getModCount(type: StubFileElementType<*>) = (StubIndex.getInstance() as StubIndexEx)
fun getModCount(type: StubFileElementType<*>): Long = (StubIndex.getInstance() as StubIndexEx)
.getPerFileElementTypeModificationTracker(type).modificationCount
fun initModCounts(vararg types: StubFileElementType<*>) {
@@ -38,7 +38,7 @@ class StubIndexPerFileElementTypeModificationTrackerTestHelper() {
lastSeenModCounts[type] = modCount
}
fun checkModCountHasChanged(type: StubFileElementType<*>) = checkModCountIncreasedAtLeast(type, 1)
fun checkModCountHasChanged(type: StubFileElementType<*>): Unit = checkModCountIncreasedAtLeast(type, 1)
fun checkModCountIsSame(type: StubFileElementType<*>) {
val modCount = getModCount(type)

View File

@@ -12,6 +12,7 @@ import com.jetbrains.performancePlugin.PerformanceTestSpan
import com.jetbrains.performancePlugin.commands.PerformanceCommandCoroutineAdapter
import com.jetbrains.performancePlugin.utils.VcsTestUtil
import io.opentelemetry.context.Context
import org.jetbrains.annotations.Nls
/**
* Command to add Java file to project
@@ -20,9 +21,9 @@ import io.opentelemetry.context.Context
class CreateJavaFileCommand(text: String, line: Int) : PerformanceCommandCoroutineAdapter(text, line) {
companion object {
const val NAME = "createJavaFile"
const val PREFIX = CMD_PREFIX + NAME
val POSSIBLE_FILE_TYPES = mapOf(
const val NAME: String = "createJavaFile"
const val PREFIX: String = CMD_PREFIX + NAME
val POSSIBLE_FILE_TYPES: Map<String, @Nls String> = mapOf(
Pair(message("node.class.tooltip").lowercase(), message("node.class.tooltip")),
Pair(message("node.record.tooltip").lowercase(), message("node.record.tooltip")),
Pair(message("node.interface.tooltip").lowercase(), message("node.interface.tooltip")),

View File

@@ -10,7 +10,7 @@ import org.jetbrains.concurrency.resolvedPromise
class SyncJpsLibrariesCommand(text: String, line: Int) : AbstractCommand(text, line) {
companion object {
const val PREFIX = "${CMD_PREFIX}syncJpsLibraries"
const val PREFIX: String = "${CMD_PREFIX}syncJpsLibraries"
}
override fun _execute(context: PlaybackContext): Promise<Any?> {

View File

@@ -9,7 +9,7 @@ import com.intellij.refactoring.RefactoringBundle
abstract class BaseSuggestedRefactoringAvailabilityTest : LightJavaCodeInsightFixtureTestCaseWithUtils() {
protected abstract val fileType: LanguageFileType
protected var ignoreErrors = false
protected var ignoreErrors: Boolean = false
override fun setUp() {
ignoreErrors = false

View File

@@ -12,8 +12,8 @@ import org.junit.Assert.assertNotEquals
abstract class BaseSuggestedRefactoringTest : LightJavaCodeInsightFixtureTestCaseWithUtils() {
protected abstract val fileType: LanguageFileType
protected var ignoreErrorsBefore = false
protected var ignoreErrorsAfter = false
protected var ignoreErrorsBefore: Boolean = false
protected var ignoreErrorsAfter: Boolean = false
override fun setUp() {
ignoreErrorsBefore = false

View File

@@ -18,7 +18,7 @@ abstract class LightJavaCodeInsightFixtureTestCase5 (projectDescriptor: LightPro
protected open fun getTestDataPath() : String? = null
@RegisterExtension
protected val testNameRule = TestNameExtension()
protected val testNameRule: TestNameExtension = TestNameExtension()
protected fun getTestName(lowercaseFirstLetter: Boolean): String {
return PlatformTestUtil.getTestName(testNameRule.methodName, lowercaseFirstLetter)

View File

@@ -30,11 +30,11 @@ object KotlinTester {
VersionComparatorUtil.compare(version, actualKotlinVersion) <= 0)
}
const val KOTLIN_VERSION = "1.3.70"
const val KOTLIN_VERSION: String = "1.3.70"
const val KT_STD_JDK_8_MAVEN_ID = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION"
const val KT_STD_JDK_8_MAVEN_ID: String = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION"
const val KT_STD_MAVEN_ID = "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION"
const val KT_STD_MAVEN_ID: String = "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION"
fun configureKotlinStdLib(model: ModifiableRootModel) {
MavenDependencyUtil.addFromMaven(model, KT_STD_MAVEN_ID)

View File

@@ -41,7 +41,7 @@ open class DumpUastTreeAction : AnAction() {
)
}
open fun buildDump(file: PsiFile) = file.toUElement()?.asRecursiveLogString()
open fun buildDump(file: PsiFile): String? = file.toUElement()?.asRecursiveLogString()
override fun update(e: AnActionEvent) {
e.presentation.isEnabledAndVisible = ApplicationManager.getApplication().isInternal && run {

View File

@@ -67,7 +67,7 @@ open class DeclarativeInsertHandler2 protected constructor(
val popupOptions: PopupOptions
) : InsertHandler<LookupElement> {
data class RelativeTextEdit(val rangeFrom: Int, val rangeTo: Int, val newText: String) {
fun toAbsolute(baseOffset: Int) = AbsoluteTextEdit(rangeFrom + baseOffset, rangeTo + baseOffset, newText)
fun toAbsolute(baseOffset: Int): AbsoluteTextEdit = AbsoluteTextEdit(rangeFrom + baseOffset, rangeTo + baseOffset, newText)
}
data class AbsoluteTextEdit(val rangeFrom: Int, val rangeTo: Int, val newText: String)
@@ -115,7 +115,7 @@ open class DeclarativeInsertHandler2 protected constructor(
object ParameterInfo : PopupOptions()
object MemberLookup : PopupOptions()
fun showPopup() = when (this) {
fun showPopup(): Boolean = when (this) {
is DoNotShow -> false
else -> true
}
@@ -157,8 +157,8 @@ open class DeclarativeInsertHandler2 protected constructor(
private var postInsertHandler: InsertHandler<LookupElement>? = null
private var popupOptions: PopupOptions = PopupOptions.DoNotShow
fun addOperation(offsetAt: Int, newText: String) = addOperation(offsetAt, offsetAt, newText)
fun addOperation(offsetFrom: Int, offsetTo: Int, newText: String) = addOperation(RelativeTextEdit(offsetFrom, offsetTo, newText))
fun addOperation(offsetAt: Int, newText: String): Builder = addOperation(offsetAt, offsetAt, newText)
fun addOperation(offsetFrom: Int, offsetTo: Int, newText: String): Builder = addOperation(RelativeTextEdit(offsetFrom, offsetTo, newText))
fun addOperation(operation: RelativeTextEdit): Builder {
val operationIsEmpty = (operation.rangeFrom == operation.rangeTo) && operation.newText.isEmpty()
if (!operationIsEmpty)

View File

@@ -4,4 +4,4 @@ package com.intellij.codeInsight.util
import com.intellij.platform.diagnostic.telemetry.Scope
@JvmField
val CodeCompletion = Scope("codeCompletion")
val CodeCompletion: Scope = Scope("codeCompletion")

View File

@@ -4,4 +4,4 @@ package com.intellij.codeInsight.util
import com.intellij.platform.diagnostic.telemetry.Scope
@JvmField
val HighlightVisitorScope = Scope("highlightVisitor")
val HighlightVisitorScope: Scope = Scope("highlightVisitor")

View File

@@ -9,6 +9,7 @@ import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.SettingsCategory
import com.intellij.openapi.components.service
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.options.SchemeManager
import com.intellij.openapi.options.SchemeManagerFactory
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ProjectManager
@@ -47,7 +48,7 @@ open class ApplicationInspectionProfileManagerBase @Internal @NonInjectable cons
})
}
override val schemeManager = schemeManagerFactory.create(InspectionProfileManager.INSPECTION_DIR, object : InspectionProfileProcessor() {
override val schemeManager: SchemeManager<InspectionProfileImpl> = schemeManagerFactory.create(InspectionProfileManager.INSPECTION_DIR, object : InspectionProfileProcessor() {
override fun getSchemeKey(attributeProvider: Function<String, String?>, fileNameWithoutExtension: String) = fileNameWithoutExtension
override fun createScheme(dataHolder: SchemeDataHolder<InspectionProfileImpl>,
@@ -73,7 +74,7 @@ open class ApplicationInspectionProfileManagerBase @Internal @NonInjectable cons
}
}, settingsCategory = SettingsCategory.CODE)
protected val profilesAreInitialized by lazy {
protected val profilesAreInitialized: Unit by lazy {
val app = ApplicationManager.getApplication()
if (!(app.isUnitTestMode || app.isHeadlessEnvironment)) {
BUNDLED_EP_NAME.processWithPluginDescriptor(BiConsumer { ep, pluginDescriptor ->
@@ -90,7 +91,7 @@ open class ApplicationInspectionProfileManagerBase @Internal @NonInjectable cons
}
@Volatile
protected var LOAD_PROFILES = !ApplicationManager.getApplication().isUnitTestMode
protected var LOAD_PROFILES: Boolean = !ApplicationManager.getApplication().isUnitTestMode
override fun getProfiles(): Collection<InspectionProfileImpl> {
initProfiles()
@@ -151,6 +152,6 @@ open class ApplicationInspectionProfileManagerBase @Internal @NonInjectable cons
private val BUNDLED_EP_NAME = ExtensionPointName<BundledSchemeEP>("com.intellij.bundledInspectionProfile")
@JvmStatic
fun getInstanceBase() = service<InspectionProfileManager>() as ApplicationInspectionProfileManagerBase
fun getInstanceBase(): ApplicationInspectionProfileManagerBase = service<InspectionProfileManager>() as ApplicationInspectionProfileManagerBase
}
}

View File

@@ -43,7 +43,7 @@ abstract class NewInspectionProfile(name: String, private var profileManager: Ba
}
@Transient
fun getProfileManager() = profileManager
fun getProfileManager(): BaseInspectionProfileManager = profileManager
fun setProfileManager(value: BaseInspectionProfileManager) {
profileManager = value

View File

@@ -35,7 +35,7 @@ open class InspectionProfileModifiableModel(val source: InspectionProfileImpl) :
copyToolsConfigurations(source, project)
}
override fun createTools(project: Project?) = source.getDefaultStates(project).map { it.tool }
override fun createTools(project: Project?): List<InspectionToolWrapper<*, *>> = source.getDefaultStates(project).map { it.tool }
private fun copyToolsConfigurations(profile: InspectionProfileImpl, project: Project?) {
try {

View File

@@ -28,7 +28,7 @@ private typealias InspectionFactory = () -> InspectionToolWrapper<*, *>?
class InspectionToolRegistrar : InspectionToolsSupplier() {
companion object {
@JvmStatic
fun getInstance() = service<InspectionToolRegistrar>()
fun getInstance(): InspectionToolRegistrar = service<InspectionToolRegistrar>()
@ApiStatus.Internal
@JvmStatic

View File

@@ -15,7 +15,7 @@ abstract class BaseInspectionProfileManager(messageBus: MessageBus) : Inspectio
private val severityRegistrar = SeverityRegistrar(messageBus)
final override fun getSeverityRegistrar() = severityRegistrar
final override fun getSeverityRegistrar(): SeverityRegistrar = severityRegistrar
internal fun cleanupSchemes(project: Project) {
for (profile in schemeManager.allSchemes) {

View File

@@ -9,6 +9,7 @@ import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.*
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.options.SchemeManager
import com.intellij.openapi.options.SchemeManagerFactory
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.StartupManager
@@ -53,7 +54,7 @@ open class ProjectInspectionProfileManager(final override val project: Project)
private val schemeManagerIprProvider = if (project.isDirectoryBased) null else SchemeManagerIprProvider("profile")
override val schemeManager = SchemeManagerFactory.getInstance(project).create(PROFILE_DIR, object : InspectionProfileProcessor() {
override val schemeManager: SchemeManager<InspectionProfileImpl> = SchemeManagerFactory.getInstance(project).create(PROFILE_DIR, object : InspectionProfileProcessor() {
override fun createScheme(dataHolder: SchemeDataHolder<InspectionProfileImpl>,
name: String,
attributeProvider: (String) -> String?,
@@ -137,7 +138,7 @@ open class ProjectInspectionProfileManager(final override val project: Project)
schemeManager.loadSchemes()
}
fun isCurrentProfileInitialized() = currentProfile.wasInitialized()
fun isCurrentProfileInitialized(): Boolean = currentProfile.wasInitialized()
override fun schemeRemoved(scheme: InspectionProfileImpl) {
scheme.cleanup(project)
@@ -190,7 +191,7 @@ open class ProjectInspectionProfileManager(final override val project: Project)
}
}
override fun getScopesManager() = DependencyValidationManager.getInstance(project)
override fun getScopesManager(): DependencyValidationManager = DependencyValidationManager.getInstance(project)
@Synchronized
override fun getProfiles(): Collection<InspectionProfileImpl> {

View File

@@ -42,7 +42,7 @@ data class ClientId(val value: String) {
companion object {
private val LOG = Logger.getInstance(ClientId::class.java)
fun getClientIdLogger() = LOG
fun getClientIdLogger(): Logger = LOG
/**
* Default client id for local application

View File

@@ -10,7 +10,7 @@ interface DynamicPluginListener {
companion object {
@JvmField
@Topic.AppLevel
val TOPIC = Topic(DynamicPluginListener::class.java, Topic.BroadcastDirection.TO_DIRECT_CHILDREN, true)
val TOPIC: Topic<DynamicPluginListener> = Topic(DynamicPluginListener::class.java, Topic.BroadcastDirection.TO_DIRECT_CHILDREN, true)
}
fun beforePluginLoaded(pluginDescriptor: IdeaPluginDescriptor) {

View File

@@ -374,7 +374,7 @@ abstract class DumbService {
companion object {
@JvmField
@Topic.ProjectLevel
val DUMB_MODE = Topic("dumb mode", DumbModeListener::class.java, Topic.BroadcastDirection.NONE)
val DUMB_MODE: Topic<DumbModeListener> = Topic("dumb mode", DumbModeListener::class.java, Topic.BroadcastDirection.NONE)
@JvmStatic
fun isDumb(project: Project): Boolean {

View File

@@ -20,7 +20,7 @@ import org.jetbrains.annotations.ApiStatus.Obsolete
interface StartupActivity {
companion object {
@Internal
val POST_STARTUP_ACTIVITY = ExtensionPointName<Any>("com.intellij.postStartupActivity")
val POST_STARTUP_ACTIVITY: ExtensionPointName<Any> = ExtensionPointName<Any>("com.intellij.postStartupActivity")
}
fun runActivity(project: Project)
@@ -71,5 +71,5 @@ interface InitProjectActivity {
abstract class InitProjectActivityJavaShim : InitProjectActivity {
abstract fun runActivity(project: Project)
override suspend fun run(project: Project) = runActivity(project)
override suspend fun run(project: Project): Unit = runActivity(project)
}

View File

@@ -5,7 +5,7 @@ import com.intellij.openapi.extensions.ExtensionPointName
interface VirtualFilePreCloseCheck {
companion object {
val extensionPoint = ExtensionPointName.create<VirtualFilePreCloseCheck>("com.intellij.openapi.vfs.VirtualFilePreCloseCheck")
val extensionPoint: ExtensionPointName<VirtualFilePreCloseCheck> = ExtensionPointName.create<VirtualFilePreCloseCheck>("com.intellij.openapi.vfs.VirtualFilePreCloseCheck")
}
/**

View File

@@ -22,6 +22,6 @@ data class EncodingReference(val charset: Charset?) {
companion object {
@JvmField
val DEFAULT = EncodingReference(charset = null)
val DEFAULT: EncodingReference = EncodingReference(charset = null)
}
}

View File

@@ -89,5 +89,5 @@ internal sealed class BaseBusConnection(bus: MessageBusImpl) : MessageHandlerHol
protected abstract fun disconnect()
override fun toString() = subscriptions.get().contentToString()
override fun toString(): String = subscriptions.get().contentToString()
}

View File

@@ -22,5 +22,5 @@ internal class DescriptorBasedMessageBusConnection(@JvmField val module: PluginD
override val isDisposed: Boolean
get() = false
override fun toString() = "DescriptorBasedMessageBusConnection(handlers=$handlers)"
override fun toString(): String = "DescriptorBasedMessageBusConnection(handlers=$handlers)"
}

View File

@@ -16,11 +16,11 @@ internal class Message(
@JvmField val bus: MessageBusImpl,
) {
@JvmField
val clientId = ClientId.getCurrentValue()
val clientId: String = ClientId.getCurrentValue()
// to avoid creating Message for each handler
// see note about pumpMessages in createPublisher (invoking job handlers can be stopped and continued as part of another pumpMessages call)
@JvmField var currentHandlerIndex = 0
@JvmField var currentHandlerIndex: Int = 0
override fun toString(): String {
return "Message(topic=$topic, method=$methodName, args=${args.contentToString()}, handlers=${handlers.contentToString()})"

View File

@@ -41,13 +41,13 @@ open class MessageBusImpl : MessageBus {
companion object {
@JvmField
internal val LOG = Logger.getInstance(MessageBusImpl::class.java)
internal val LOG: Logger = Logger.getInstance(MessageBusImpl::class.java)
}
@JvmField
internal val publisherCache: ConcurrentMap<Topic<*>, Any> = ConcurrentHashMap()
@JvmField
internal val subscribers = ConcurrentLinkedQueue<MessageHandlerHolder>()
internal val subscribers: ConcurrentLinkedQueue<MessageHandlerHolder> = ConcurrentLinkedQueue<MessageHandlerHolder>()
// caches subscribers for this bus and its children or parents, depending on the topic's broadcast policy
@JvmField
@@ -368,7 +368,7 @@ class RootBus(owner: MessageBusOwner) : CompositeMessageBus(owner) {
internal class MessageQueue {
@JvmField
val queue = ArrayDeque<Message>()
val queue: ArrayDeque<Message> = ArrayDeque<Message>()
@JvmField
var current: Message? = null

View File

@@ -8,11 +8,11 @@ package com.intellij.util
* The first thrown exception (if any) is propagated.
* Subsequent exceptions (again, if any) are added to the "suppressed" list of the first one.
*/
fun runSuppressing(vararg blocks: () -> Unit) =
fun runSuppressing(vararg blocks: () -> Unit): Unit =
runSuppressing(blocks.asSequence())
/** A Java-friendly overload of [runSuppressing]. */
fun runSuppressing(vararg runnables: ThrowableRunnable<Throwable>) =
fun runSuppressing(vararg runnables: ThrowableRunnable<Throwable>): Unit =
runSuppressing(runnables.asSequence().map { r -> { r.run() } })
private fun runSuppressing(blocks: Sequence<() -> Unit>) {

View File

@@ -20,7 +20,7 @@ class ContainerDescriptor {
@JvmField var extensionPoints: MutableList<ExtensionPointDescriptor>? = null
@Transient var distinctExtensionPointCount = -1
@Transient var distinctExtensionPointCount: Int = -1
@Transient @JvmField var extensions: Map<String, MutableList<ExtensionDescriptor>>? = null
fun addService(serviceDescriptor: ServiceDescriptor) {

View File

@@ -30,7 +30,7 @@ class DescriptorListLoadingContext(
@JvmField val transient: Boolean = false
) : AutoCloseable, ReadModuleContext {
@JvmField
internal val globalErrors = CopyOnWriteArrayList<Supplier<String>>()
internal val globalErrors: CopyOnWriteArrayList<Supplier<String>> = CopyOnWriteArrayList<Supplier<String>>()
internal fun copyGlobalErrors(): MutableList<Supplier<String>> = ArrayList(globalErrors)

View File

@@ -160,13 +160,13 @@ class DisabledPluginsState internal constructor() : PluginEnabler.Headless {
}
}
override fun isIgnoredDisabledPlugins() = isDisabledStateIgnored
override fun isIgnoredDisabledPlugins(): Boolean = isDisabledStateIgnored
override fun setIgnoredDisabledPlugins(ignoredDisabledPlugins: Boolean) {
isDisabledStateIgnored = ignoredDisabledPlugins
}
override fun isDisabled(pluginId: PluginId) = getDisabledIds().contains(pluginId)
override fun isDisabled(pluginId: PluginId): Boolean = getDisabledIds().contains(pluginId)
override fun enable(descriptors: Collection<IdeaPluginDescriptor>): Boolean = setEnabledState(descriptors, enabled = true)

View File

@@ -67,7 +67,7 @@ class IdeaPluginDescriptorImpl(raw: RawPluginDescriptor,
private val vendorEmail = raw.vendorEmail
private val vendorUrl = raw.vendorUrl
private var category: String? = raw.category
@JvmField internal val url = raw.url
@JvmField internal val url: String? = raw.url
@JvmField val pluginDependencies: List<PluginDependency>
@JvmField val incompatibilities: List<PluginId> = raw.incompatibilities ?: Collections.emptyList()
@@ -100,38 +100,38 @@ class IdeaPluginDescriptorImpl(raw: RawPluginDescriptor,
// extension point name -> list of extension descriptors
val epNameToExtensions: Map<String, MutableList<ExtensionDescriptor>>? = raw.epNameToExtensions
@JvmField val appContainerDescriptor = raw.appContainerDescriptor
@JvmField val projectContainerDescriptor = raw.projectContainerDescriptor
@JvmField val moduleContainerDescriptor = raw.moduleContainerDescriptor
@JvmField val appContainerDescriptor: ContainerDescriptor = raw.appContainerDescriptor
@JvmField val projectContainerDescriptor: ContainerDescriptor = raw.projectContainerDescriptor
@JvmField val moduleContainerDescriptor: ContainerDescriptor = raw.moduleContainerDescriptor
@JvmField val content: PluginContentDescriptor = raw.contentModules?.let { PluginContentDescriptor(it) } ?: PluginContentDescriptor.EMPTY
@JvmField val dependencies = raw.dependencies
@JvmField val dependencies: ModuleDependenciesDescriptor = raw.dependencies
@JvmField var modules: List<PluginId> = raw.modules ?: Collections.emptyList()
private val descriptionChildText = raw.description
@JvmField val isUseIdeaClassLoader = raw.isUseIdeaClassLoader
@JvmField val isBundledUpdateAllowed = raw.isBundledUpdateAllowed
@JvmField internal val implementationDetail = raw.implementationDetail
@ApiStatus.Experimental @JvmField internal val onDemand = raw.onDemand && isOnDemandPluginEnabled
@JvmField internal val isRestartRequired = raw.isRestartRequired
@JvmField val packagePrefix = raw.`package`
@JvmField val isUseIdeaClassLoader: Boolean = raw.isUseIdeaClassLoader
@JvmField val isBundledUpdateAllowed: Boolean = raw.isBundledUpdateAllowed
@JvmField internal val implementationDetail: Boolean = raw.implementationDetail
@ApiStatus.Experimental @JvmField internal val onDemand: Boolean = raw.onDemand && isOnDemandPluginEnabled
@JvmField internal val isRestartRequired: Boolean = raw.isRestartRequired
@JvmField val packagePrefix: String? = raw.`package`
private val sinceBuild = raw.sinceBuild
private val untilBuild = raw.untilBuild
private var isEnabled = true
var isDeleted = false
var isDeleted: Boolean = false
@JvmField internal var isIncomplete: PluginLoadingError? = null
override fun getDescriptorPath() = descriptorPath
override fun getDescriptorPath(): String? = descriptorPath
override fun getDependencies(): List<IdeaPluginDependency> {
return if (pluginDependencies.isEmpty()) Collections.emptyList() else Collections.unmodifiableList(pluginDependencies)
}
override fun getPluginPath() = path
override fun getPluginPath(): Path = path
private fun createSub(raw: RawPluginDescriptor,
descriptorPath: String,
@@ -431,17 +431,17 @@ class IdeaPluginDescriptorImpl(raw: RawPluginDescriptor,
return result
}
override fun getChangeNotes() = changeNotes
override fun getChangeNotes(): String? = changeNotes
override fun getName(): String = name!!
override fun getProductCode() = productCode
override fun getProductCode(): String? = productCode
override fun getReleaseDate() = releaseDate
override fun getReleaseDate(): Date? = releaseDate
override fun getReleaseVersion() = releaseVersion
override fun getReleaseVersion(): Int = releaseVersion
override fun isLicenseOptional() = isLicenseOptional
override fun isLicenseOptional(): Boolean = isLicenseOptional
override fun getOptionalDependentPluginIds(): Array<PluginId> {
val pluginDependencies = pluginDependencies
@@ -455,13 +455,13 @@ class IdeaPluginDescriptorImpl(raw: RawPluginDescriptor,
.toTypedArray()
}
override fun getVendor() = vendor
override fun getVendor(): String? = vendor
override fun getVersion() = version
override fun getVersion(): String? = version
override fun getResourceBundleBaseName() = resourceBundleBaseName
override fun getResourceBundleBaseName(): String? = resourceBundleBaseName
override fun getCategory() = category
override fun getCategory(): String? = category
/*
This setter was explicitly defined to be able to set a category for a
@@ -479,13 +479,13 @@ class IdeaPluginDescriptorImpl(raw: RawPluginDescriptor,
return Collections.unmodifiableMap(epNameToExtensions ?: return Collections.emptyMap())
}
override fun getVendorEmail() = vendorEmail
override fun getVendorEmail(): String? = vendorEmail
override fun getVendorUrl() = vendorUrl
override fun getVendorUrl(): String? = vendorUrl
override fun getUrl() = url
override fun getUrl(): String? = url
override fun getPluginId() = id
override fun getPluginId(): PluginId = id
override fun getPluginClassLoader(): ClassLoader? = _pluginClassLoader
@@ -494,25 +494,25 @@ class IdeaPluginDescriptorImpl(raw: RawPluginDescriptor,
_pluginClassLoader = classLoader
}
override fun isEnabled() = isEnabled
override fun isEnabled(): Boolean = isEnabled
override fun setEnabled(enabled: Boolean) {
isEnabled = enabled
}
override fun getSinceBuild() = sinceBuild
override fun getSinceBuild(): String? = sinceBuild
override fun getUntilBuild() = untilBuild
override fun getUntilBuild(): String? = untilBuild
override fun isBundled() = isBundled
override fun isBundled(): Boolean = isBundled
override fun allowBundledUpdate() = isBundledUpdateAllowed
override fun allowBundledUpdate(): Boolean = isBundledUpdateAllowed
override fun isImplementationDetail() = implementationDetail
override fun isImplementationDetail(): Boolean = implementationDetail
override fun isOnDemand() = onDemand
override fun isOnDemand(): Boolean = onDemand
override fun isRequireRestart() = isRestartRequired
override fun isRequireRestart(): Boolean = isRestartRequired
override fun equals(other: Any?): Boolean {
if (this === other) {

View File

@@ -17,7 +17,7 @@ internal class ImmutableZipFileDataLoader(private val resolver: EntryResolver,
}
// yes, by identity - ImmutableZipFileDataLoader is created for the same Path object from plugin JARs list
override fun isExcludedFromSubSearch(jarFile: Path) = jarFile === zipPath
override fun isExcludedFromSubSearch(jarFile: Path): Boolean = jarFile === zipPath
override fun toString() = resolver.toString()
override fun toString(): String = resolver.toString()
}

View File

@@ -8,34 +8,34 @@ import java.util.*
@ApiStatus.Internal
class ModuleDependenciesDescriptor(@JvmField val modules: List<ModuleReference>, @JvmField val plugins: List<PluginReference>) {
companion object {
@JvmField val EMPTY = ModuleDependenciesDescriptor(Collections.emptyList(), Collections.emptyList())
@JvmField val EMPTY: ModuleDependenciesDescriptor = ModuleDependenciesDescriptor(Collections.emptyList(), Collections.emptyList())
}
class ModuleReference(@JvmField val name: String) {
override fun toString() = "ModuleItem(name=$name)"
override fun toString(): String = "ModuleItem(name=$name)"
}
class PluginReference(@JvmField val id: PluginId) {
override fun toString() = "PluginReference(id=$id)"
override fun toString(): String = "PluginReference(id=$id)"
}
override fun toString() = "ModuleDependenciesDescriptor(modules=$modules, plugins=$plugins)"
override fun toString(): String = "ModuleDependenciesDescriptor(modules=$modules, plugins=$plugins)"
}
@ApiStatus.Internal
class PluginContentDescriptor(@JvmField val modules: List<ModuleItem>) {
companion object {
@JvmField val EMPTY = PluginContentDescriptor(Collections.emptyList())
@JvmField val EMPTY: PluginContentDescriptor = PluginContentDescriptor(Collections.emptyList())
}
@ApiStatus.Internal
class ModuleItem(@JvmField val name: String, @JvmField val configFile: String?) {
@JvmField internal var descriptor: IdeaPluginDescriptorImpl? = null
fun requireDescriptor() = descriptor ?: throw IllegalStateException("Descriptor is not set for $this")
fun requireDescriptor(): IdeaPluginDescriptorImpl = descriptor ?: throw IllegalStateException("Descriptor is not set for $this")
override fun toString() = "ModuleItem(name=$name, descriptor=$descriptor, configFile=$configFile)"
override fun toString(): String = "ModuleItem(name=$name, descriptor=$descriptor, configFile=$configFile)"
}
override fun toString() = "PluginContentDescriptor(modules=$modules)"
override fun toString(): String = "PluginContentDescriptor(modules=$modules)"
}

View File

@@ -36,7 +36,7 @@ open class ModuleGraphBase protected constructor(
override fun getOut(descriptor: IdeaPluginDescriptorImpl): Iterator<IdeaPluginDescriptorImpl> = getDependents(descriptor).iterator()
fun builder() = DFSTBuilder(this, null, true)
fun builder(): DFSTBuilder<IdeaPluginDescriptorImpl> = DFSTBuilder(this, null, true)
internal fun sorted(builder: DFSTBuilder<IdeaPluginDescriptorImpl> = builder()): SortedModuleGraph {
return SortedModuleGraph(

View File

@@ -8,10 +8,10 @@ import org.jetbrains.annotations.ApiStatus
class PluginDependency internal constructor(override val pluginId: PluginId,
configFile: String?,
isOptional: Boolean) : IdeaPluginDependency {
var configFile = configFile
var configFile: String? = configFile
internal set
override var isOptional = isOptional
override var isOptional: Boolean = isOptional
internal set
@Transient

View File

@@ -12,7 +12,7 @@ class PluginLoadingError internal constructor(val plugin: IdeaPluginDescriptor,
val isNotifyUser: Boolean,
@JvmField val disabledDependency: PluginId? = null) {
companion object {
internal val DISABLED = Supplier { "" }
internal val DISABLED: Supplier<String> = Supplier { "" }
private fun formatErrorMessage(descriptor: IdeaPluginDescriptor, message: String): @NonNls String {
val builder = StringBuilder()
@@ -42,7 +42,7 @@ class PluginLoadingError internal constructor(val plugin: IdeaPluginDescriptor,
internal val isDisabledError: Boolean
get() = shortMessageSupplier === DISABLED
override fun toString() = internalMessage
override fun toString(): @NonNls String = internalMessage
val internalMessage: @NonNls String
get() = formatErrorMessage(plugin, (detailedMessageSupplier ?: shortMessageSupplier).get())

View File

@@ -21,7 +21,7 @@ import kotlin.io.path.name
class PluginLoadingResult(private val checkModuleDependencies: Boolean = !PlatformUtils.isIntelliJ()) {
private val incompletePlugins = HashMap<PluginId, IdeaPluginDescriptorImpl>()
@JvmField val enabledPluginsById = HashMap<PluginId, IdeaPluginDescriptorImpl>()
@JvmField val enabledPluginsById: HashMap<PluginId, IdeaPluginDescriptorImpl> = HashMap<PluginId, IdeaPluginDescriptorImpl>()
private val idMap = HashMap<PluginId, IdeaPluginDescriptorImpl>()
@JvmField var duplicateModuleMap: MutableMap<PluginId, MutableList<IdeaPluginDescriptorImpl>>? = null

View File

@@ -33,9 +33,9 @@ import javax.xml.stream.XMLStreamException
import javax.xml.stream.XMLStreamReader
import javax.xml.stream.events.XMLEvent
@ApiStatus.Internal const val PACKAGE_ATTRIBUTE = "package"
@ApiStatus.Internal const val IMPLEMENTATION_DETAIL_ATTRIBUTE = "implementation-detail"
@ApiStatus.Experimental const val ON_DEMAND_ATTRIBUTE = "on-demand"
@ApiStatus.Internal const val PACKAGE_ATTRIBUTE: String = "package"
@ApiStatus.Internal const val IMPLEMENTATION_DETAIL_ATTRIBUTE: String = "implementation-detail"
@ApiStatus.Experimental const val ON_DEMAND_ATTRIBUTE: String = "on-demand"
private const val defaultXPointerValue = "xpointer(/idea-plugin/*)"

View File

@@ -39,5 +39,5 @@ class LocalFsDataLoader(val basePath: Path) : DataLoader {
}
}
override fun toString() = basePath.toString()
override fun toString(): String = basePath.toString()
}

View File

@@ -37,7 +37,7 @@ internal sealed class EdtCoroutineDispatcher : MainCoroutineDispatcher() {
companion object : EdtCoroutineDispatcher() {
override fun toString() = "EDT"
override fun toString(): String = "EDT"
}
object Immediate : EdtCoroutineDispatcher() {
@@ -52,6 +52,6 @@ internal sealed class EdtCoroutineDispatcher : MainCoroutineDispatcher() {
return false
}
override fun toString() = "EDT.immediate"
override fun toString(): String = "EDT.immediate"
}
}

View File

@@ -27,7 +27,7 @@ internal data class TextDetails(
val details: ProgressText?,
) {
companion object {
val NULL = TextDetails(null, null)
val NULL: TextDetails = TextDetails(null, null)
}
}

View File

@@ -31,7 +31,7 @@ internal class IdeIdeaFormatWriter(activities: Map<String, MutableList<ActivityI
private val pluginCostMap: MutableMap<String, Object2LongMap<String>>,
threadNameManager: ThreadNameManager) : IdeaFormatWriter(activities, threadNameManager,
StartUpPerformanceReporter.VERSION) {
val publicStatMetrics = Object2IntOpenHashMap<String>()
val publicStatMetrics: Object2IntOpenHashMap<String> = Object2IntOpenHashMap<String>()
init {
publicStatMetrics.defaultReturnValue(-1)

View File

@@ -67,11 +67,11 @@ open class StartUpPerformanceReporter(private val coroutineScope: CoroutineScope
}
}
override fun getMetrics() = lastMetrics
override fun getMetrics(): Object2IntMap<String>? = lastMetrics
override fun getPluginCostMap() = pluginCostMap!!
override fun getPluginCostMap(): Map<String, Object2LongMap<String>> = pluginCostMap!!
override fun getLastReport() = lastReport
override fun getLastReport(): ByteBuffer? = lastReport
override fun reportStatistics(project: Project) {
keepAndLogStats(project.name)

View File

@@ -86,7 +86,7 @@ class CsvGzippedMetricsExporter(private var fileToWrite: File) : MetricExporter
}
companion object {
val logger = Logger.getInstance(CsvGzippedMetricsExporter::class.java)
val logger: Logger = Logger.getInstance(CsvGzippedMetricsExporter::class.java)
fun generatePathForConnectionMetrics(): Path {
val connectionMetricsPath = "open-telemetry-connection-metrics.csv.gz"

View File

@@ -107,7 +107,7 @@ class BatchSpanProcessor(
override fun onStart(parentContext: Context, span: ReadWriteSpan) {
}
override fun isStartRequired() = false
override fun isStartRequired(): Boolean = false
override fun onEnd(span: ReadableSpan) {
if (span.spanContext.isSampled) {
@@ -115,7 +115,7 @@ class BatchSpanProcessor(
}
}
override fun isEndRequired() = true
override fun isEndRequired(): Boolean = true
override fun shutdown(): CompletableResultCode {
if (isShutdown.getAndSet(true)) {

View File

@@ -3,4 +3,4 @@ package com.intellij.platform.diagnostic.telemetry
import io.opentelemetry.sdk.metrics.data.MetricData
fun MetricData.belongsToScope(scope: Scope) = this.instrumentationScopeInfo.name.startsWith(scope.toString())
fun MetricData.belongsToScope(scope: Scope): Boolean = this.instrumentationScopeInfo.name.startsWith(scope.toString())

View File

@@ -36,9 +36,9 @@ open class OpenTelemetryDefaultConfigurator(protected val mainScope: CoroutineSc
ResourceAttributes.SERVICE_INSTANCE_ID, DateTimeFormatter.ISO_INSTANT.format(Instant.now()),
))
val aggregatedMetricsExporter = AggregatedMetricsExporter()
val aggregatedSpansProcessor = AggregatedSpansProcessor(mainScope)
protected val spanExporters = mutableListOf<AsyncSpanExporter>()
val aggregatedMetricsExporter: AggregatedMetricsExporter = AggregatedMetricsExporter()
val aggregatedSpansProcessor: AggregatedSpansProcessor = AggregatedSpansProcessor(mainScope)
protected val spanExporters: MutableList<AsyncSpanExporter> = mutableListOf<AsyncSpanExporter>()
private val metricsExporters = mutableListOf<MetricsExporterEntry>()
private fun isMetricsEnabled(): Boolean {

View File

@@ -15,10 +15,10 @@ import java.util.stream.Stream
@ApiStatus.Internal
object OpenTelemetryUtils {
//flags
const val RDCT_TRACING_DIAGNOSTIC_FLAG = "rdct.diagnostic.otlp"
const val IDEA_DIAGNOSTIC_OTLP = "idea.diagnostic.opentelemetry.otlp"
const val RDCT_CONN_METRICS_DIAGNOSTIC_FLAG = "rdct.connection.metrics.enabled"
const val RDCT_LUX_METRICS_DIAGNOSTIC_FLAG = "lux.metrics.enabled"
const val RDCT_TRACING_DIAGNOSTIC_FLAG: String = "rdct.diagnostic.otlp"
const val IDEA_DIAGNOSTIC_OTLP: String = "idea.diagnostic.opentelemetry.otlp"
const val RDCT_CONN_METRICS_DIAGNOSTIC_FLAG: String = "rdct.connection.metrics.enabled"
const val RDCT_LUX_METRICS_DIAGNOSTIC_FLAG: String = "lux.metrics.enabled"
@JvmStatic
fun toCsvStream(metricData: MetricData): Stream<String> {

View File

@@ -3,25 +3,25 @@ package com.intellij.platform.diagnostic.telemetry
@JvmField
val PlatformMetrics = Scope("platform.metrics")
val PlatformMetrics: Scope = Scope("platform.metrics")
@JvmField
val EDT = Scope("edt", PlatformMetrics)
val EDT: Scope = Scope("edt", PlatformMetrics)
@JvmField
val Indexes = Scope("indexes", PlatformMetrics)
val Indexes: Scope = Scope("indexes", PlatformMetrics)
@JvmField
val Storage = Scope("storage", PlatformMetrics)
val Storage: Scope = Scope("storage", PlatformMetrics)
@JvmField
val JPS = Scope("jps", PlatformMetrics)
val JPS: Scope = Scope("jps", PlatformMetrics)
@JvmField
val VFS = Scope("vfs", PlatformMetrics)
val VFS: Scope = Scope("vfs", PlatformMetrics)
@JvmField
val JVM = Scope("jvm", PlatformMetrics)
val JVM: Scope = Scope("jvm", PlatformMetrics)
@JvmField
val CompletionRanking = Scope("completion.ranking.ml", PlatformMetrics)
val CompletionRanking: Scope = Scope("completion.ranking.ml", PlatformMetrics)

View File

@@ -1,6 +1,8 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.diagnostic.telemetry
import io.opentelemetry.api.metrics.Meter
fun Scope.meter() = TelemetryTracer.getInstance().getMeter(this.toString())
fun Scope.tracer(verbose: Boolean) = TelemetryTracer.getInstance().getTracer(this.toString(), verbose)
fun Scope.meter(): Meter = TelemetryTracer.getInstance().getMeter(this.toString())
fun Scope.tracer(verbose: Boolean): IJTracer = TelemetryTracer.getInstance().getTracer(this.toString(), verbose)

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.diagnostic.telemetry.otExporters
import com.intellij.openapi.diagnostic.Logger
import com.intellij.platform.diagnostic.telemetry.MetricsExporterEntry
import com.intellij.openapi.diagnostic.logger
import io.opentelemetry.sdk.common.CompletableResultCode
@@ -13,7 +14,7 @@ import java.util.concurrent.CopyOnWriteArrayList
class AggregatedMetricsExporter : MetricExporter {
companion object {
val LOG = logger<AggregatedMetricsExporter>()
val LOG: Logger = logger<AggregatedMetricsExporter>()
}
private val metricsExporters: CopyOnWriteArrayList<MetricsExporterEntry> = CopyOnWriteArrayList<MetricsExporterEntry>()

Some files were not shown because too many files have changed in this diff Show More