mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
[java-impl] IDEA-375621 Enable Kotlin "explicit API mode"
Merge-request: IJ-MR-169690 Merged-by: Bartek Pacia <bartek.pacia@jetbrains.com> GitOrigin-RevId: d6647857b72704095347b1e821132e69559fe75c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ffbacb2461
commit
e4d48cf04f
@@ -1,5 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module relativePaths="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
|
||||
<compilerSettings>
|
||||
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=com.intellij.openapi.util.IntellijInternalApi -Xexplicit-api=strict" />
|
||||
</compilerSettings>
|
||||
<compilerArguments>
|
||||
<stringArguments>
|
||||
<stringArg name="jvmTarget" arg="17" />
|
||||
<stringArg name="apiVersion" arg="2.2" />
|
||||
<stringArg name="languageVersion" arg="2.2" />
|
||||
</stringArguments>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.intellij.openapi.options.ex.Settings
|
||||
import com.intellij.ui.components.ActionLink
|
||||
import com.intellij.ui.dsl.builder.Panel
|
||||
|
||||
class JavaCompletionConfigurable : UiDslUnnamedConfigurable.Simple() {
|
||||
public class JavaCompletionConfigurable : UiDslUnnamedConfigurable.Simple() {
|
||||
|
||||
override fun Panel.createContent() {
|
||||
row {
|
||||
|
||||
@@ -19,8 +19,8 @@ import com.intellij.codeInsight.CodeInsightSettings
|
||||
import com.intellij.java.JavaBundle
|
||||
import com.intellij.openapi.options.BeanConfigurable
|
||||
|
||||
class JavadocOptionsProvider : BeanConfigurable<CodeInsightSettings>(CodeInsightSettings.getInstance(),
|
||||
JavaBundle.message("javadoc.option.javadoc.title")) {
|
||||
public class JavadocOptionsProvider : BeanConfigurable<CodeInsightSettings>(CodeInsightSettings.getInstance(),
|
||||
JavaBundle.message("javadoc.option.javadoc.title")) {
|
||||
|
||||
init {
|
||||
checkBox(JavaBundle.message("javadoc.option.automatically.insert.closing.tag.javadoc"), instance::JAVADOC_GENERATE_CLOSING_TAG)
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.intellij.ui.dsl.builder.*
|
||||
import com.intellij.ui.dsl.listCellRenderer.textListCellRenderer
|
||||
import javax.swing.JComponent
|
||||
|
||||
class JavaAutoImportOptions(val project: Project) : UiDslUnnamedConfigurable.Simple(), AutoImportOptionsProvider {
|
||||
public class JavaAutoImportOptions(public val project: Project) : UiDslUnnamedConfigurable.Simple(), AutoImportOptionsProvider {
|
||||
private val excludeTable = object : ImportTable(project,
|
||||
JavaBundle.message("exclude.from.imports.no.exclusions"),
|
||||
JavaBundle.message("exclude.table.mask"),
|
||||
@@ -158,7 +158,7 @@ class JavaAutoImportOptions(val project: Project) : UiDslUnnamedConfigurable.Sim
|
||||
}
|
||||
}
|
||||
|
||||
fun addExcludePackage(packageName: String) {
|
||||
public fun addExcludePackage(packageName: String) {
|
||||
excludeTable.addRow(packageName)
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,13 @@ package com.intellij.codeInsight
|
||||
|
||||
import com.intellij.java.JavaBundle
|
||||
|
||||
class ExternalAnnotationLineMarkerProvider : NonCodeAnnotationsLineMarkerProvider(
|
||||
public class ExternalAnnotationLineMarkerProvider : NonCodeAnnotationsLineMarkerProvider(
|
||||
JavaBundle.message("line.marker.type.external.annotations"), LineMarkerType.External)
|
||||
|
||||
class InferredNullabilityAnnotationsLineMarkerProvider : NonCodeAnnotationsLineMarkerProvider(
|
||||
public class InferredNullabilityAnnotationsLineMarkerProvider : NonCodeAnnotationsLineMarkerProvider(
|
||||
JavaBundle.message("line.marker.type.inferred.nullability.annotations"), LineMarkerType.InferredNullability)
|
||||
|
||||
class InferredContractAnnotationsLineMarkerProvider : NonCodeAnnotationsLineMarkerProvider(
|
||||
public class InferredContractAnnotationsLineMarkerProvider : NonCodeAnnotationsLineMarkerProvider(
|
||||
JavaBundle.message("line.marker.type.inferred.contract.annotations"), LineMarkerType.InferredContract) {
|
||||
override fun isEnabledByDefault(): Boolean = false
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.intellij.psi.LambdaUtil.resolveFunctionalInterfaceClass
|
||||
import com.intellij.psi.util.PsiUtil.isJavaToken
|
||||
import com.intellij.psi.util.PsiUtil.resolveClassInType
|
||||
|
||||
class JavaImplicitReferenceProvider : ImplicitReferenceProvider {
|
||||
public class JavaImplicitReferenceProvider : ImplicitReferenceProvider {
|
||||
|
||||
override fun resolveAsReference(element: PsiElement): Collection<Symbol> {
|
||||
return listOfNotNull(
|
||||
|
||||
@@ -23,12 +23,12 @@ import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.*
|
||||
import java.util.*
|
||||
|
||||
object CompletionMemory {
|
||||
public object CompletionMemory {
|
||||
private val LAST_CHOSEN_METHODS = Key.create<LinkedList<RangeMarker>>("COMPLETED_METHODS")
|
||||
private val CHOSEN_METHODS = Key.create<SmartPsiElementPointer<PsiMethod>>("CHOSEN_METHODS")
|
||||
|
||||
@JvmStatic
|
||||
fun registerChosenMethod(method: PsiMethod, call: PsiCall) {
|
||||
public fun registerChosenMethod(method: PsiMethod, call: PsiCall) {
|
||||
val nameRange = getAnchorRange(call) ?: return
|
||||
val document = call.containingFile.viewProvider.document ?: return
|
||||
addToMemory(document, createChosenMethodMarker(document, CompletionUtil.getOriginalOrSelf(method), nameRange))
|
||||
@@ -57,7 +57,7 @@ object CompletionMemory {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getChosenMethod(call: PsiCall): PsiMethod? {
|
||||
public fun getChosenMethod(call: PsiCall): PsiMethod? {
|
||||
val range = getAnchorRange(call) ?: return null
|
||||
val completedMethods = call.containingFile.originalFile.viewProvider.document?.getUserData(LAST_CHOSEN_METHODS)
|
||||
val marker = completedMethods?.let { it.find { m -> haveSameRange(m, range) } }
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.codeInsight.lookup.LookupElement
|
||||
import com.intellij.codeInsight.lookup.LookupElementAction
|
||||
import com.intellij.util.Consumer
|
||||
|
||||
class ExcludeLoggerFromCompletionLookupActionProvider : LookupActionProvider {
|
||||
public class ExcludeLoggerFromCompletionLookupActionProvider : LookupActionProvider {
|
||||
override fun fillActions(lookupElement: LookupElement, lookup: Lookup, consumer: Consumer<in LookupElementAction>) {
|
||||
if (lookupElement is JvmLoggerLookupElement) {
|
||||
for (s in AddImportAction.getAllExcludableStrings(lookupElement.typeName)) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.codeInsight.lookup.LookupElement
|
||||
* It is better to invoke this PreselectionSkip machinery (even though it's not designed for filtering), than to make another
|
||||
* CompletionContributor that will filter the CompletionResultSet.
|
||||
*/
|
||||
class JavaGeneratedCompletionItemsSkipper : CompletionPreselectSkipper() {
|
||||
public class JavaGeneratedCompletionItemsSkipper : CompletionPreselectSkipper() {
|
||||
override fun skipElement(element: LookupElement, location: CompletionLocation): Boolean {
|
||||
val triggersWizzard = element.getUserData(JavaGenerateMemberCompletionContributor.GENERATE_ELEMENT)
|
||||
return triggersWizzard == true
|
||||
|
||||
@@ -16,27 +16,27 @@ import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.util.containers.addIfNotNull
|
||||
|
||||
|
||||
interface LookupPositionMatcher {
|
||||
fun match(position: PsiElement): Boolean
|
||||
fun createIncorrectElementMatcher(position: PsiElement): (LookupElement) -> Boolean
|
||||
public interface LookupPositionMatcher {
|
||||
public fun match(position: PsiElement): Boolean
|
||||
public fun createIncorrectElementMatcher(position: PsiElement): (LookupElement) -> Boolean
|
||||
}
|
||||
|
||||
object JavaIncorrectElements {
|
||||
public object JavaIncorrectElements {
|
||||
private val matcherKey = Key<(LookupElement) -> Boolean>("JavaIncorrectElements.matcher")
|
||||
private val positions = listOf(
|
||||
ExceptionPositionMatcher, TryWithResourcesPositionMatcher, AnnotationPositionMatcher, TypeParameterPositionMatcher,
|
||||
ImplementsDeclarationPositionMatcher, ExtendsDeclarationPositionMatcher
|
||||
)
|
||||
|
||||
fun matchPosition(position: PsiElement): LookupPositionMatcher? {
|
||||
public fun matchPosition(position: PsiElement): LookupPositionMatcher? {
|
||||
return positions.firstOrNull { it.match(position) }
|
||||
}
|
||||
|
||||
fun putMatcher(elementMatcher: (LookupElement) -> Boolean, context: UserDataHolder) {
|
||||
public fun putMatcher(elementMatcher: (LookupElement) -> Boolean, context: UserDataHolder) {
|
||||
context.putUserData(matcherKey, elementMatcher)
|
||||
}
|
||||
|
||||
fun tryGetMatcher(context: UserDataHolder): ((LookupElement) -> Boolean)? {
|
||||
public fun tryGetMatcher(context: UserDataHolder): ((LookupElement) -> Boolean)? {
|
||||
return context.getUserData(matcherKey)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.intellij.psi.PsiReferenceExpression
|
||||
import com.intellij.util.ProcessingContext
|
||||
import com.siyeh.ig.psiutils.ExpressionUtils
|
||||
|
||||
class JvmLoggerCompletionContributor : CompletionContributor() {
|
||||
public class JvmLoggerCompletionContributor : CompletionContributor() {
|
||||
init {
|
||||
extend(CompletionType.BASIC,
|
||||
psiElement().withParent(PsiReferenceExpression::class.java).andNot(
|
||||
|
||||
@@ -10,9 +10,9 @@ import com.intellij.psi.statistics.StatisticsInfo
|
||||
import com.intellij.psi.util.parentOfType
|
||||
import com.intellij.ui.logging.JvmLoggingConfigurable.Companion.LOG_MAX_NAME_LENGTH
|
||||
|
||||
class JvmLoggerLookupElement(private val logger: JvmLogger, private val place: PsiClass) : LookupElement(), JavaCompletionStatistician.CustomStatisticsInfoProvider {
|
||||
val typeName: String = logger.loggerTypeName
|
||||
val typeId: String = logger.id
|
||||
public class JvmLoggerLookupElement(private val logger: JvmLogger, private val place: PsiClass) : LookupElement(), JavaCompletionStatistician.CustomStatisticsInfoProvider {
|
||||
public val typeName: String = logger.loggerTypeName
|
||||
public val typeId: String = logger.id
|
||||
|
||||
override fun getLookupString(): String {
|
||||
return logger.getLogFieldName(place)?.take(LOG_MAX_NAME_LENGTH) ?: JvmLoggerFieldDelegate.LOGGER_IDENTIFIER
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.codeInsight.completion
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElement
|
||||
|
||||
class LoggerWeigher : CompletionWeigher() {
|
||||
public class LoggerWeigher : CompletionWeigher() {
|
||||
override fun weigh(element: LookupElement, location: CompletionLocation): Comparable<*> = when (element) {
|
||||
is JvmLoggerLookupElement -> -1
|
||||
else -> 1
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.intellij.psi.PsiModifier.STATIC
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.psi.util.findParentOfType
|
||||
|
||||
class JavaMoveCompletionCommandProvider : AbstractMoveCompletionCommandProvider() {
|
||||
public class JavaMoveCompletionCommandProvider : AbstractMoveCompletionCommandProvider() {
|
||||
override fun findMoveClassOffset(offset: Int, psiFile: PsiFile): Int? {
|
||||
var currentOffset = offset
|
||||
if (currentOffset == 0) return null
|
||||
@@ -41,7 +41,7 @@ class JavaMoveCompletionCommandProvider : AbstractMoveCompletionCommandProvider(
|
||||
}
|
||||
}
|
||||
|
||||
class JavaCopyCompletionCommandProvider : AbstractCopyClassCompletionCommandProvider() {
|
||||
public class JavaCopyCompletionCommandProvider : AbstractCopyClassCompletionCommandProvider() {
|
||||
override fun findMoveClassOffset(offset: Int, psiFile: PsiFile): Int? {
|
||||
var currentOffset = offset
|
||||
if (currentOffset == 0) return null
|
||||
|
||||
@@ -11,19 +11,19 @@ import com.intellij.psi.PsiWhiteSpace
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.psi.util.findParentOfType
|
||||
|
||||
class JavaExtractConstantCompletionCommandProvider : AbstractExtractConstantCompletionCommandProvider() {
|
||||
public class JavaExtractConstantCompletionCommandProvider : AbstractExtractConstantCompletionCommandProvider() {
|
||||
override fun findOffsetToCall(offset: Int, psiFile: PsiFile): Int? {
|
||||
return findOffsetForLocalVariable(offset, psiFile)
|
||||
}
|
||||
}
|
||||
|
||||
class JavaExtractFieldCompletionCommandProvider : AbstractExtractFieldCompletionCommandProvider() {
|
||||
public class JavaExtractFieldCompletionCommandProvider : AbstractExtractFieldCompletionCommandProvider() {
|
||||
override fun findOffsetToCall(offset: Int, psiFile: PsiFile): Int? {
|
||||
return findOffsetForLocalVariable(offset, psiFile)
|
||||
}
|
||||
}
|
||||
|
||||
class JavaExtractParameterCompletionCommandProvider : AbstractExtractParameterCompletionCommandProvider() {
|
||||
public class JavaExtractParameterCompletionCommandProvider : AbstractExtractParameterCompletionCommandProvider() {
|
||||
override fun findOffsetToCall(offset: Int, psiFile: PsiFile): Int? {
|
||||
return findOffsetForLocalVariable(offset, psiFile)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.intellij.psi.PsiWhiteSpace
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.psi.util.findParentOfType
|
||||
|
||||
class JavaInlineMethodCompletionCommandProvider : AbstractInlineMethodCompletionCommandProvider() {
|
||||
public class JavaInlineMethodCompletionCommandProvider : AbstractInlineMethodCompletionCommandProvider() {
|
||||
override fun findOffsetToCall(offset: Int, psiFile: PsiFile): Int? {
|
||||
var currentOffset = offset
|
||||
if (currentOffset == 0) return null
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.intellij.psi.PsiWhiteSpace
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.psi.util.parentOfType
|
||||
|
||||
class JavaRenameActionCommandProvider: AbstractRenameActionCommandProvider() {
|
||||
public class JavaRenameActionCommandProvider: AbstractRenameActionCommandProvider() {
|
||||
override fun findRenameOffset(offset: Int, psiFile: PsiFile): Int? {
|
||||
var currentOffset = offset
|
||||
if (currentOffset == 0) return null
|
||||
|
||||
@@ -15,14 +15,14 @@ import org.jetbrains.annotations.ApiStatus
|
||||
import java.util.*
|
||||
|
||||
@ApiStatus.Internal
|
||||
object JavaCompletionFeatures {
|
||||
public object JavaCompletionFeatures {
|
||||
private val VARIABLES_KEY: Key<VariablesInfo> = Key.create("java.ml.completion.variables")
|
||||
private val PACKAGES_KEY: Key<PackagesInfo> = Key.create("java.ml.completion.packages")
|
||||
private val CHILD_CLASS_WORDS_KEY: Key<List<String>> = Key.create("java.ml.completion.child.class.name.words")
|
||||
|
||||
private val wordsSplitter: WordsSplitter = WordsSplitter.Builder.identifiers().build()
|
||||
|
||||
enum class JavaKeyword {
|
||||
public enum class JavaKeyword {
|
||||
ABSTRACT,
|
||||
BOOLEAN,
|
||||
BREAK,
|
||||
@@ -65,16 +65,16 @@ object JavaCompletionFeatures {
|
||||
NULL,
|
||||
ANOTHER;
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
private val ALL_VALUES: Map<String, JavaKeyword> = values().associateBy { it.toString() }
|
||||
|
||||
fun getValue(text: String): JavaKeyword? = ALL_VALUES[text]
|
||||
public fun getValue(text: String): JavaKeyword? = ALL_VALUES[text]
|
||||
}
|
||||
|
||||
override fun toString(): String = name.lowercase(Locale.ENGLISH)
|
||||
}
|
||||
|
||||
enum class JavaType {
|
||||
public enum class JavaType {
|
||||
VOID,
|
||||
BOOLEAN,
|
||||
NUMERIC,
|
||||
@@ -87,8 +87,8 @@ object JavaCompletionFeatures {
|
||||
THROWABLE,
|
||||
ANOTHER;
|
||||
|
||||
companion object {
|
||||
fun getValue(type: PsiType): JavaType {
|
||||
public companion object {
|
||||
public fun getValue(type: PsiType): JavaType {
|
||||
return when {
|
||||
type == PsiTypes.voidType() -> VOID
|
||||
type == PsiTypes.charType() -> CHAR
|
||||
@@ -106,16 +106,16 @@ object JavaCompletionFeatures {
|
||||
}
|
||||
}
|
||||
|
||||
fun asKeyword(text: String): JavaKeyword? = JavaKeyword.getValue(text)
|
||||
public fun asKeyword(text: String): JavaKeyword? = JavaKeyword.getValue(text)
|
||||
|
||||
fun asJavaType(type: PsiType): JavaType = JavaType.getValue(type)
|
||||
public fun asJavaType(type: PsiType): JavaType = JavaType.getValue(type)
|
||||
|
||||
fun calculateChildClassWords(environment: CompletionEnvironment, childClass: PsiElement) {
|
||||
public fun calculateChildClassWords(environment: CompletionEnvironment, childClass: PsiElement) {
|
||||
val childClassWords = wordsSplitter.split(childClass.text)
|
||||
environment.putUserData(CHILD_CLASS_WORDS_KEY, childClassWords)
|
||||
}
|
||||
|
||||
fun getChildClassTokensMatchingFeature(contextFeatures: ContextFeatures, baseClassName: String): MLFeatureValue? {
|
||||
public fun getChildClassTokensMatchingFeature(contextFeatures: ContextFeatures, baseClassName: String): MLFeatureValue? {
|
||||
contextFeatures.getUserData(CHILD_CLASS_WORDS_KEY)?.let { childClassTokens ->
|
||||
val baseClassTokens = wordsSplitter.split(baseClassName)
|
||||
if (baseClassTokens.isNotEmpty()) {
|
||||
@@ -125,7 +125,7 @@ object JavaCompletionFeatures {
|
||||
return null
|
||||
}
|
||||
|
||||
fun calculateVariables(environment: CompletionEnvironment): Unit? = try {
|
||||
public 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()
|
||||
@@ -135,7 +135,7 @@ object JavaCompletionFeatures {
|
||||
}
|
||||
} catch (ignored: PsiInvalidElementAccessException) {}
|
||||
|
||||
fun getArgumentsVariablesMatchingFeatures(contextFeatures: ContextFeatures, method: PsiMethod): Map<String, MLFeatureValue> {
|
||||
public fun getArgumentsVariablesMatchingFeatures(contextFeatures: ContextFeatures, method: PsiMethod): Map<String, MLFeatureValue> {
|
||||
val result = mutableMapOf<String, MLFeatureValue>()
|
||||
val parameters = method.parameterList.parameters
|
||||
result["args_count"] = MLFeatureValue.numerical(parameters.size)
|
||||
@@ -148,7 +148,7 @@ object JavaCompletionFeatures {
|
||||
return result
|
||||
}
|
||||
|
||||
fun isInQualifierExpression(environment: CompletionEnvironment): Boolean {
|
||||
public fun isInQualifierExpression(environment: CompletionEnvironment): Boolean {
|
||||
val parentExpressions = mutableSetOf<PsiExpression>()
|
||||
var curParent = environment.parameters.position.context
|
||||
while (curParent is PsiExpression) {
|
||||
@@ -161,7 +161,7 @@ object JavaCompletionFeatures {
|
||||
return false
|
||||
}
|
||||
|
||||
fun isAfterMethodCall(environment: CompletionEnvironment): Boolean {
|
||||
public fun isAfterMethodCall(environment: CompletionEnvironment): Boolean {
|
||||
val context = environment.parameters.position.context
|
||||
if (context is PsiReferenceExpression) {
|
||||
val qualifier = context.qualifierExpression
|
||||
@@ -170,7 +170,7 @@ object JavaCompletionFeatures {
|
||||
return false
|
||||
}
|
||||
|
||||
fun collectPackages(environment: CompletionEnvironment) {
|
||||
public fun collectPackages(environment: CompletionEnvironment) {
|
||||
val file = environment.parameters.originalFile as? PsiJavaFile ?: return
|
||||
val packageTrie = FqnTrie.withFqn(file.packageName)
|
||||
val importsTrie = FqnTrie.create()
|
||||
@@ -179,7 +179,7 @@ object JavaCompletionFeatures {
|
||||
environment.putUserData(PACKAGES_KEY, PackagesInfo(packageTrie, importsTrie))
|
||||
}
|
||||
|
||||
fun getPackageMatchingFeatures(contextFeatures: ContextFeatures, psiClass: PsiClass): Map<String, MLFeatureValue> {
|
||||
public fun getPackageMatchingFeatures(contextFeatures: ContextFeatures, psiClass: PsiClass): Map<String, MLFeatureValue> {
|
||||
val packagesInfo = contextFeatures.getUserData(PACKAGES_KEY) ?: return emptyMap()
|
||||
val packageName = PsiUtil.getPackageName(psiClass)
|
||||
if (packageName.isNullOrEmpty()) return emptyMap()
|
||||
@@ -220,21 +220,21 @@ object JavaCompletionFeatures {
|
||||
val importPackages: FqnTrie
|
||||
)
|
||||
|
||||
class FqnTrie private constructor(private val level: Int) {
|
||||
companion object {
|
||||
fun create(): FqnTrie = FqnTrie(0)
|
||||
public class FqnTrie private constructor(private val level: Int) {
|
||||
public companion object {
|
||||
public fun create(): FqnTrie = FqnTrie(0)
|
||||
|
||||
fun withFqn(name: String): FqnTrie = create().also { it.addFqn(name) }
|
||||
public fun withFqn(name: String): FqnTrie = create().also { it.addFqn(name) }
|
||||
}
|
||||
private val children = mutableMapOf<String, FqnTrie>()
|
||||
|
||||
fun addFqn(name: String) {
|
||||
public fun addFqn(name: String) {
|
||||
if (name.isEmpty()) return
|
||||
val (prefix, postfix) = split(name)
|
||||
children.getOrPut(prefix) { FqnTrie(level + 1) }.addFqn(postfix)
|
||||
}
|
||||
|
||||
fun matchedParts(name: String): Int {
|
||||
public fun matchedParts(name: String): Int {
|
||||
if (name.isEmpty()) return level
|
||||
val (prefix, postfix) = split(name)
|
||||
return children[prefix]?.matchedParts(postfix) ?: return level
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import java.util.Locale
|
||||
|
||||
class JavaContextFeaturesProvider : ContextFeatureProvider {
|
||||
public class JavaContextFeaturesProvider : ContextFeatureProvider {
|
||||
override fun getName(): String = "java"
|
||||
|
||||
override fun calculateFeatures(environment: @NotNull CompletionEnvironment): @NotNull MutableMap<String, MLFeatureValue> {
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.VisibleForTesting
|
||||
import java.util.Locale
|
||||
|
||||
@VisibleForTesting
|
||||
class JavaElementFeaturesProvider : ElementFeatureProvider {
|
||||
public class JavaElementFeaturesProvider : ElementFeatureProvider {
|
||||
|
||||
private inline val POPULAR_MODIFIERS: List<JvmModifier>
|
||||
get() =
|
||||
|
||||
@@ -9,8 +9,8 @@ import com.intellij.lang.java.JavaLanguage
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
class JavaMLRankingProvider : CatBoostJarCompletionModelProvider(JavaBundle.message("settings.completion.ml.java.display.name"),
|
||||
"java_features", "java_model") {
|
||||
public class JavaMLRankingProvider : CatBoostJarCompletionModelProvider(JavaBundle.message("settings.completion.ml.java.display.name"),
|
||||
"java_features", "java_model") {
|
||||
|
||||
override fun isLanguageSupported(language: Language): Boolean = JavaLanguage.INSTANCE == language
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiFile
|
||||
|
||||
abstract class JavaCodeVisionProviderBase : DaemonBoundCodeVisionProvider {
|
||||
public abstract class JavaCodeVisionProviderBase : DaemonBoundCodeVisionProvider {
|
||||
override fun computeForEditor(editor: Editor, file: PsiFile): List<Pair<TextRange, CodeVisionEntry>> {
|
||||
if (file.language != JavaLanguage.INSTANCE) return emptyList()
|
||||
|
||||
return computeLenses(editor, file)
|
||||
}
|
||||
|
||||
abstract fun computeLenses(editor: Editor, psiFile: PsiFile): List<Pair<TextRange, CodeVisionEntry>>
|
||||
public abstract fun computeLenses(editor: Editor, psiFile: PsiFile): List<Pair<TextRange, CodeVisionEntry>>
|
||||
}
|
||||
@@ -15,9 +15,9 @@ import com.intellij.psi.util.CachedValuesManager
|
||||
import com.intellij.psi.util.PsiUtil
|
||||
import java.awt.event.MouseEvent
|
||||
|
||||
class JavaInheritorsCodeVisionProvider : InheritorsCodeVisionProvider() {
|
||||
companion object {
|
||||
const val ID: String = "java.inheritors"
|
||||
public class JavaInheritorsCodeVisionProvider : InheritorsCodeVisionProvider() {
|
||||
public companion object {
|
||||
public const val ID: String = "java.inheritors"
|
||||
}
|
||||
|
||||
override fun acceptsFile(file: PsiFile): Boolean = file.language == JavaLanguage.INSTANCE
|
||||
|
||||
@@ -12,9 +12,9 @@ import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.PsiMember
|
||||
import com.intellij.psi.PsiTypeParameter
|
||||
|
||||
class JavaReferencesCodeVisionProvider : RenameAwareReferencesCodeVisionProvider() {
|
||||
companion object {
|
||||
const val ID: String = "java.references"
|
||||
public class JavaReferencesCodeVisionProvider : RenameAwareReferencesCodeVisionProvider() {
|
||||
public companion object {
|
||||
public const val ID: String = "java.references"
|
||||
}
|
||||
|
||||
override fun acceptsFile(file: PsiFile): Boolean = file.language == JavaLanguage.INSTANCE
|
||||
|
||||
@@ -13,14 +13,14 @@ import com.intellij.serviceContainer.NonInjectable
|
||||
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
class UsagesCountManager @NonInjectable constructor(project: Project, configuration: UsageCounterConfiguration): UsagesCountManagerBase<PsiMember>(project, configuration) {
|
||||
public class UsagesCountManager @NonInjectable constructor(project: Project, configuration: UsageCounterConfiguration): UsagesCountManagerBase<PsiMember>(project, configuration) {
|
||||
|
||||
@Suppress("unused")
|
||||
constructor(project: Project) : this(project, object : UsageCounterConfiguration {})
|
||||
public constructor(project: Project) : this(project, object : UsageCounterConfiguration {})
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
@JvmStatic
|
||||
fun getInstance(project: Project): UsagesCountManager {
|
||||
public fun getInstance(project: Project): UsagesCountManager {
|
||||
return project.getService(UsagesCountManager::class.java)
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class UsagesCountManager @NonInjectable constructor(project: Project, configurat
|
||||
}
|
||||
}
|
||||
|
||||
interface UsageCounterConfiguration: UsageCounterConfigurationBase<PsiMember> {
|
||||
public interface UsageCounterConfiguration: UsageCounterConfigurationBase<PsiMember> {
|
||||
override fun countUsages(file: PsiFile, members: List<PsiMember>, scope: SearchScope): Int {
|
||||
return JavaTelescope.usagesCount(file, members, scope)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.intellij.psi.JvmCommon
|
||||
import com.intellij.psi.PsiClass
|
||||
import com.intellij.psi.PsiTypes
|
||||
|
||||
fun createVoidMethodFixes(psiClass: @JvmCommon PsiClass, methodName: String, modifier: JvmModifier): Array<LocalQuickFix> {
|
||||
public fun createVoidMethodFixes(psiClass: @JvmCommon PsiClass, methodName: String, modifier: JvmModifier): Array<LocalQuickFix> {
|
||||
if (!ModuleUtilCore.projectContainsFile(psiClass.project, psiClass.containingFile.virtualFile, false)) return LocalQuickFix.EMPTY_ARRAY
|
||||
val request = methodRequest(psiClass.project, methodName, listOf(modifier), PsiTypes.voidType())
|
||||
val actions = createMethodActions(psiClass, request)
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.intellij.codeInsight.intention.impl.DefaultIntentionsOrderProvider
|
||||
import com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching
|
||||
import com.intellij.codeInsight.intention.impl.IntentionsOrderProvider
|
||||
|
||||
class JavaIntentionsOrderProvider : IntentionsOrderProvider {
|
||||
public class JavaIntentionsOrderProvider : IntentionsOrderProvider {
|
||||
override fun getSortedIntentions(context: CachedIntentions, intentions: List<IntentionActionWithTextCaching>): List<IntentionActionWithTextCaching> {
|
||||
val (errors, others) = intentions.partition { intention -> isCompilationFix(context, intention) }
|
||||
val errorsSortedByPriority = errors
|
||||
|
||||
@@ -13,11 +13,11 @@ import com.intellij.psi.SmartPsiElementPointer
|
||||
import com.intellij.util.containers.SLRUMap
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
class FileStateCache : Disposable {
|
||||
public class FileStateCache : Disposable {
|
||||
private val cache = SLRUMap<SmartPsiElementPointer<PsiFile>, PrivateFileState>(100, 50)
|
||||
|
||||
companion object {
|
||||
fun getInstance(project: Project): FileStateCache = project.service()
|
||||
public companion object {
|
||||
public fun getInstance(project: Project): FileStateCache = project.service()
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.codeInsight.daemon.problems
|
||||
|
||||
import com.intellij.psi.*
|
||||
|
||||
class MemberCollector(private val memberFilter: (PsiMember) -> Boolean) : JavaRecursiveElementWalkingVisitor() {
|
||||
public class MemberCollector(private val memberFilter: (PsiMember) -> Boolean) : JavaRecursiveElementWalkingVisitor() {
|
||||
|
||||
private val members = mutableListOf<PsiMember>()
|
||||
|
||||
@@ -24,8 +24,8 @@ class MemberCollector(private val memberFilter: (PsiMember) -> Boolean) : JavaRe
|
||||
if (memberFilter(psiEnumConstant)) members.add(psiEnumConstant)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun collectMembers(psiElement: PsiElement, filter: (PsiMember) -> Boolean): List<PsiMember> {
|
||||
public companion object {
|
||||
public fun collectMembers(psiElement: PsiElement, filter: (PsiMember) -> Boolean): List<PsiMember> {
|
||||
val collector = MemberCollector(filter)
|
||||
psiElement.accept(collector)
|
||||
return collector.members
|
||||
|
||||
@@ -18,8 +18,8 @@ import com.intellij.util.text.StringSearcher
|
||||
import java.util.function.IntPredicate
|
||||
|
||||
|
||||
open class MemberUsageCollector {
|
||||
companion object {
|
||||
public open class MemberUsageCollector {
|
||||
public companion object {
|
||||
/**
|
||||
* Search files with memberName occurence in code.
|
||||
*
|
||||
@@ -27,7 +27,7 @@ open class MemberUsageCollector {
|
||||
* it might be just reference to an element with a same name (see ProblemCollector#extractUsage for details).
|
||||
* Also note that there's a limit on how many files we analyze for references (and their total size)
|
||||
*/
|
||||
fun collect(
|
||||
public fun collect(
|
||||
memberName: String,
|
||||
containingFile: PsiFile,
|
||||
scope: GlobalSearchScope,
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.intellij.psi.util.PsiTreeUtil
|
||||
* Pair of reported element and context.
|
||||
* Context is mainly used for display purposes.
|
||||
*/
|
||||
class Problem(val reportedElement: PsiElement, val context: PsiElement) {
|
||||
public class Problem(public val reportedElement: PsiElement, public val context: PsiElement) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.PsiJavaFile
|
||||
|
||||
class JavaImportBlockRangeProvider : ImportBlockRangeProvider {
|
||||
public class JavaImportBlockRangeProvider : ImportBlockRangeProvider {
|
||||
override fun isEnabledForFile(file: PsiFile): Boolean = file is PsiJavaFile
|
||||
|
||||
override fun getImportBlockRange(file: PsiFile): TextRange? {
|
||||
|
||||
@@ -7,13 +7,13 @@ import com.intellij.openapi.roots.libraries.Library
|
||||
/**
|
||||
* Component that looks for an external annotations locations using plugin providers.
|
||||
*/
|
||||
class AnnotationsLocationSearcher {
|
||||
companion object {
|
||||
fun findAnnotationsLocation(project: Project,
|
||||
library: Library,
|
||||
artifactId: String?,
|
||||
groupId: String?,
|
||||
version: String?): Collection<AnnotationsLocation> {
|
||||
public class AnnotationsLocationSearcher {
|
||||
public companion object {
|
||||
public fun findAnnotationsLocation(project: Project,
|
||||
library: Library,
|
||||
artifactId: String?,
|
||||
groupId: String?,
|
||||
version: String?): Collection<AnnotationsLocation> {
|
||||
return AnnotationsLocationProvider.EP_NAME.extensionList.flatMap { it.getLocations(project, library, artifactId, groupId, version) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.nio.file.Files
|
||||
|
||||
private val LOG = logger<JBBundledAnnotationsProvider>()
|
||||
|
||||
class JBBundledAnnotationsProvider : AnnotationsLocationProvider {
|
||||
public class JBBundledAnnotationsProvider : AnnotationsLocationProvider {
|
||||
private val pluginId = PluginManagerCore.JAVA_PLUGIN_ID
|
||||
private val knownAnnotations: Map<String, Map<VersionRange, AnnotationsLocation>> by lazy { buildAnnotations() }
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.intellij.refactoring.util.CommonRefactoringUtil
|
||||
import com.intellij.ui.logging.JvmLoggingSettingsStorage
|
||||
import org.jetbrains.java.generate.GenerationUtil
|
||||
|
||||
class GenerateLoggerHandler : CodeInsightActionHandler {
|
||||
public class GenerateLoggerHandler : CodeInsightActionHandler {
|
||||
override fun invoke(project: Project, editor: Editor, psiFile: PsiFile) {
|
||||
GenerateLoggerStatisticsCollector.logActionInvoked(project)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.openapi.module.ModuleUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiFile
|
||||
|
||||
class GenerateLoggerAction : BaseGenerateAction(GenerateLoggerHandler()) {
|
||||
public class GenerateLoggerAction : BaseGenerateAction(GenerateLoggerHandler()) {
|
||||
|
||||
override fun isValidForFile(project: Project, editor: Editor, psiFile: PsiFile): Boolean {
|
||||
val element = psiFile.findElementAt(editor.caretModel.offset) ?: return false
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
object GenerateLoggerStatisticsCollector : CounterUsagesCollector() {
|
||||
public object GenerateLoggerStatisticsCollector : CounterUsagesCollector() {
|
||||
private val GROUP = EventLogGroup("jvm.logger.generation", 2)
|
||||
|
||||
private const val ACTION_STARTED = "action_started"
|
||||
@@ -20,11 +20,11 @@ object GenerateLoggerStatisticsCollector : CounterUsagesCollector() {
|
||||
|
||||
override fun getGroup(): EventLogGroup = GROUP
|
||||
|
||||
fun logActionInvoked(project: Project) {
|
||||
public fun logActionInvoked(project: Project) {
|
||||
ACTION_INVOKED.log(project, ACTION_STATUS.with(ACTION_STARTED))
|
||||
}
|
||||
|
||||
fun logActionCompleted(project: Project) {
|
||||
public fun logActionCompleted(project: Project) {
|
||||
ACTION_INVOKED.log(project, ACTION_STATUS.with(ACTION_FINISHED))
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,12 @@ import com.intellij.ui.logging.JvmLoggingSettingsStorage
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import javax.swing.JComponent
|
||||
|
||||
class ChooseLoggerDialogWrapper(
|
||||
public class ChooseLoggerDialogWrapper(
|
||||
private val project: Project,
|
||||
private val availableLoggers: List<JvmLogger>,
|
||||
selectedLogger: JvmLogger,
|
||||
) : DialogWrapper(project, true) {
|
||||
var selectedLogger: JvmLogger = selectedLogger
|
||||
public var selectedLogger: JvmLogger = selectedLogger
|
||||
private set
|
||||
|
||||
private lateinit var comboBox: Cell<ComboBox<JvmLogger>>
|
||||
@@ -32,7 +32,7 @@ class ChooseLoggerDialogWrapper(
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
fun setComboBoxItem(item: JvmLogger) {
|
||||
public fun setComboBoxItem(item: JvmLogger) {
|
||||
comboBox.component.item = item
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ private fun isDefinedInClass(method: PsiMethod, className: String): Boolean =
|
||||
method.containingClass?.qualifiedName == className ||
|
||||
DeepestSuperMethodsSearch.search(method).findAll().any { it.containingClass?.qualifiedName == className }
|
||||
|
||||
fun getDefaultType(method: PsiMethod, substitutor: PsiSubstitutor, argIndex: Int, argument: PsiExpression): PsiType? {
|
||||
public fun getDefaultType(method: PsiMethod, substitutor: PsiSubstitutor, argIndex: Int, argument: PsiExpression): PsiType? {
|
||||
for (provider in providers[MethodArgument(method.name, argIndex)]) {
|
||||
return provider.getDefaultType(method, substitutor, argument) ?: continue
|
||||
}
|
||||
|
||||
@@ -43,11 +43,11 @@ private val HINT_FORMAT = HintFormat(
|
||||
HintMarginPadding.OnlyPadding,
|
||||
)
|
||||
|
||||
class AnnotationInlayProvider : InlayHintsProvider {
|
||||
companion object {
|
||||
const val PROVIDER_ID: String = "java.annotation.hints"
|
||||
const val SHOW_INFERRED: String = "showInferred"
|
||||
const val SHOW_EXTERNAL: String = "showExternal"
|
||||
public class AnnotationInlayProvider : InlayHintsProvider {
|
||||
public companion object {
|
||||
public const val PROVIDER_ID: String = "java.annotation.hints"
|
||||
public const val SHOW_INFERRED: String = "showInferred"
|
||||
public const val SHOW_EXTERNAL: String = "showExternal"
|
||||
}
|
||||
|
||||
override fun createCollector(file: PsiFile, editor: Editor): InlayHintsCollector? {
|
||||
@@ -189,7 +189,7 @@ private fun <T> Array<T>.joinPresentations(separator: () -> Unit, transform: (T)
|
||||
}
|
||||
}
|
||||
|
||||
class InsertAnnotationAction() : AnAction() {
|
||||
public class InsertAnnotationAction() : AnAction() {
|
||||
override fun update(e: AnActionEvent) {
|
||||
if (e.hasAnnotationProviderId()) {
|
||||
e.presentation.isEnabledAndVisible = e.psiFile?.virtualFile?.isInLocalFileSystem == true
|
||||
@@ -216,7 +216,7 @@ class InsertAnnotationAction() : AnAction() {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ToggleAnnotationsOptionAction(
|
||||
public abstract class ToggleAnnotationsOptionAction(
|
||||
private val optionId: String,
|
||||
private val turnOnKey: @PropertyKey(resourceBundle = JavaBundle.BUNDLE) String,
|
||||
private val turnOffKey: @PropertyKey(resourceBundle = JavaBundle.BUNDLE) String,
|
||||
@@ -252,14 +252,14 @@ abstract class ToggleAnnotationsOptionAction(
|
||||
}
|
||||
}
|
||||
|
||||
class ToggleInferredAnnotationsAction : ToggleAnnotationsOptionAction(
|
||||
public class ToggleInferredAnnotationsAction : ToggleAnnotationsOptionAction(
|
||||
optionId = AnnotationInlayProvider.SHOW_INFERRED,
|
||||
turnOnKey = "settings.inlay.java.turn.on.showInferred.annotations",
|
||||
turnOffKey = "settings.inlay.java.turn.off.showInferred.annotations",
|
||||
shouldEnableAndShowToggle = { tag -> tag == SHOW_EXTERNAL_AND_INTERNAL_TOGGLES_TAG }
|
||||
)
|
||||
|
||||
class ToggleExternalAnnotationsAction : ToggleAnnotationsOptionAction(
|
||||
public class ToggleExternalAnnotationsAction : ToggleAnnotationsOptionAction(
|
||||
optionId = AnnotationInlayProvider.SHOW_EXTERNAL,
|
||||
turnOnKey = "settings.inlay.java.turn.on.showExternal.annotations",
|
||||
turnOffKey = "settings.inlay.java.turn.off.showExternal.annotations",
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.intellij.psi.SyntaxTraverser
|
||||
import com.intellij.util.SmartList
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
||||
|
||||
abstract class ElementProcessingHintPass(
|
||||
public abstract class ElementProcessingHintPass(
|
||||
private val rootElement: PsiElement,
|
||||
editor: Editor,
|
||||
private val modificationStampHolder: ModificationStampHolder
|
||||
@@ -56,22 +56,22 @@ abstract class ElementProcessingHintPass(
|
||||
/**
|
||||
* Returns true if this pass should be applied for current [virtualFile]
|
||||
*/
|
||||
abstract fun isAvailable(virtualFile: VirtualFile): Boolean
|
||||
public abstract fun isAvailable(virtualFile: VirtualFile): Boolean
|
||||
|
||||
/**
|
||||
* For current [element] collect hints information if it is possible
|
||||
*/
|
||||
abstract fun collectElementHints(element: PsiElement, collector: (offset: Int, hint : String) -> Unit)
|
||||
public abstract fun collectElementHints(element: PsiElement, collector: (offset: Int, hint : String) -> Unit)
|
||||
|
||||
/**
|
||||
* Returns key marking inlay as created by this pass
|
||||
*/
|
||||
abstract fun getHintKey(): Key<Boolean>
|
||||
public abstract fun getHintKey(): Key<Boolean>
|
||||
|
||||
/**
|
||||
* Creates inlay renderer for hints created by this pass
|
||||
*/
|
||||
abstract fun createRenderer(text: String): HintRenderer
|
||||
public abstract fun createRenderer(text: String): HintRenderer
|
||||
|
||||
private fun applyHintsToEditor() {
|
||||
val inlayModel = myEditor.inlayModel
|
||||
@@ -97,8 +97,8 @@ abstract class ElementProcessingHintPass(
|
||||
}
|
||||
}
|
||||
|
||||
class ModificationStampHolder(private val key: Key<Long>) {
|
||||
fun putCurrentModificationStamp(editor: Editor, file: PsiFile) {
|
||||
public class ModificationStampHolder(private val key: Key<Long>) {
|
||||
public fun putCurrentModificationStamp(editor: Editor, file: PsiFile) {
|
||||
editor.putUserData(key, ParameterHintsPassFactory.getCurrentModificationStamp(file))
|
||||
}
|
||||
|
||||
@@ -106,11 +106,11 @@ class ModificationStampHolder(private val key: Key<Long>) {
|
||||
editor.putUserData(key, null)
|
||||
}
|
||||
|
||||
fun forceHintsUpdateOnNextPass() {
|
||||
public fun forceHintsUpdateOnNextPass() {
|
||||
EditorFactory.getInstance().allEditors.forEach { forceHintsUpdateOnNextPass(it) }
|
||||
}
|
||||
|
||||
fun isNotChanged(editor: Editor, file: PsiFile): Boolean {
|
||||
public fun isNotChanged(editor: Editor, file: PsiFile): Boolean {
|
||||
return key.get(editor, 0) == ParameterHintsPassFactory.getCurrentModificationStamp(file)
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,9 @@ import com.intellij.psi.JavaPsiFacade
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.util.concurrency.AppExecutorUtil
|
||||
|
||||
class JavaFqnDeclarativeInlayActionHandler : InlayActionHandler {
|
||||
companion object {
|
||||
const val HANDLER_NAME: String = "java.fqn.class"
|
||||
public class JavaFqnDeclarativeInlayActionHandler : InlayActionHandler {
|
||||
public companion object {
|
||||
public const val HANDLER_NAME: String = "java.fqn.class"
|
||||
}
|
||||
|
||||
override fun handleClick(editor: Editor, payload: InlayActionPayload) {
|
||||
|
||||
@@ -230,9 +230,9 @@ private fun inlayInfo(callArgument: PsiExpression, methodParam: PsiParameter, sh
|
||||
return InlayInfo(paramToShow, offset, showOnlyIfExistedBefore)
|
||||
}
|
||||
|
||||
fun inlayOffset(callArgument: PsiExpression): Int = inlayOffset(callArgument, false)
|
||||
public fun inlayOffset(callArgument: PsiExpression): Int = inlayOffset(callArgument, false)
|
||||
|
||||
fun inlayOffset(callArgument: PsiExpression, atEnd: Boolean): Int {
|
||||
public fun inlayOffset(callArgument: PsiExpression, atEnd: Boolean): Int {
|
||||
if (callArgument.textRange.isEmpty) {
|
||||
val next = callArgument.nextSibling as? PsiWhiteSpace
|
||||
if (next != null) return next.textRange.endOffset
|
||||
|
||||
@@ -7,9 +7,9 @@ import com.intellij.codeInsight.hints.declarative.InlayHintsProvider
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.psi.*
|
||||
|
||||
class JavaImplicitTypeDeclarativeInlayHintsProvider : InlayHintsProvider {
|
||||
companion object {
|
||||
const val PROVIDER_ID : String = "java.implicit.types"
|
||||
public class JavaImplicitTypeDeclarativeInlayHintsProvider : InlayHintsProvider {
|
||||
public companion object {
|
||||
public const val PROVIDER_ID : String = "java.implicit.types"
|
||||
}
|
||||
|
||||
override fun createCollector(file: PsiFile, editor: Editor): InlayHintsCollector {
|
||||
|
||||
@@ -9,11 +9,11 @@ import com.intellij.lang.java.JavaLanguage
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.*
|
||||
|
||||
class JavaInlayParameterHintsProvider : InlayParameterHintsProvider {
|
||||
public class JavaInlayParameterHintsProvider : InlayParameterHintsProvider {
|
||||
|
||||
object Utils {
|
||||
public object Utils {
|
||||
@JvmStatic
|
||||
fun getInstance(): JavaInlayParameterHintsProvider = InlayParameterHintsExtension.forLanguage(JavaLanguage.INSTANCE) as JavaInlayParameterHintsProvider
|
||||
public fun getInstance(): JavaInlayParameterHintsProvider = InlayParameterHintsExtension.forLanguage(JavaLanguage.INSTANCE) as JavaInlayParameterHintsProvider
|
||||
}
|
||||
|
||||
override fun getHintInfo(element: PsiElement): MethodInfo? {
|
||||
@@ -98,41 +98,41 @@ class JavaInlayParameterHintsProvider : InlayParameterHintsProvider {
|
||||
"*.Arrays.asList"
|
||||
)
|
||||
|
||||
val showIfMethodNameContainsParameterName: Option = Option("java.method.name.contains.parameter.name",
|
||||
JavaBundle.messagePointer(
|
||||
public val showIfMethodNameContainsParameterName: Option = Option("java.method.name.contains.parameter.name",
|
||||
JavaBundle.messagePointer(
|
||||
"settings.inlay.java.parameters.with.names.that.are.contained.in.the.method.name"),
|
||||
false)
|
||||
false)
|
||||
|
||||
val showForParamsWithSameType: Option = Option("java.multiple.params.same.type",
|
||||
JavaBundle.messagePointer(
|
||||
public val showForParamsWithSameType: Option = Option("java.multiple.params.same.type",
|
||||
JavaBundle.messagePointer(
|
||||
"settings.inlay.java.non.literals.in.case.of.multiple.parameters.with.the.same.type"),
|
||||
false)
|
||||
false)
|
||||
|
||||
val showForBuilderLikeMethods: Option = Option("java.build.like.method",
|
||||
JavaBundle.messagePointer("settings.inlay.java.builder.like.methods"),
|
||||
false)
|
||||
public val showForBuilderLikeMethods: Option = Option("java.build.like.method",
|
||||
JavaBundle.messagePointer("settings.inlay.java.builder.like.methods"),
|
||||
false)
|
||||
|
||||
|
||||
val ignoreOneCharOneDigitHints: Option = Option("java.simple.sequentially.numbered",
|
||||
JavaBundle.messagePointer(
|
||||
public val ignoreOneCharOneDigitHints: Option = Option("java.simple.sequentially.numbered",
|
||||
JavaBundle.messagePointer(
|
||||
"settings.inlay.java.methods.with.same.named.numbered.parameters"),
|
||||
false)
|
||||
false)
|
||||
|
||||
val isShowHintWhenExpressionTypeIsClear: Option = Option("java.clear.expression.type",
|
||||
JavaBundle.messagePointer(
|
||||
public val isShowHintWhenExpressionTypeIsClear: Option = Option("java.clear.expression.type",
|
||||
JavaBundle.messagePointer(
|
||||
"settings.inlay.java.complex.expressions.binary.functional.array.access.and.other"),
|
||||
false).also {
|
||||
false).also {
|
||||
it.extendedDescriptionSupplier = JavaBundle.messagePointer(
|
||||
"settings.inlay.java.show.parameter.hints.when.expression.type.is.clear.description")
|
||||
}
|
||||
|
||||
val isShowHintsForEnumConstants: Option = Option("java.enums",
|
||||
JavaBundle.messagePointer("settings.inlay.java.enum.constants"),
|
||||
true)
|
||||
public val isShowHintsForEnumConstants: Option = Option("java.enums",
|
||||
JavaBundle.messagePointer("settings.inlay.java.enum.constants"),
|
||||
true)
|
||||
|
||||
val isShowHintsForNewExpressions: Option = Option("java.new.expr",
|
||||
JavaBundle.messagePointer("settings.inlay.java.new.expressions"),
|
||||
true)
|
||||
public val isShowHintsForNewExpressions: Option = Option("java.new.expr",
|
||||
JavaBundle.messagePointer("settings.inlay.java.new.expressions"),
|
||||
true)
|
||||
|
||||
override fun getSupportedOptions(): List<Option> {
|
||||
return listOf(
|
||||
|
||||
@@ -7,9 +7,9 @@ import com.intellij.codeInsight.hints.declarative.InlayHintsProvider
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.psi.*
|
||||
|
||||
class JavaLambdaParameterTypeHintsProvider : InlayHintsProvider {
|
||||
companion object {
|
||||
const val PROVIDER_ID : String = "java.implicit.types.lambda"
|
||||
public class JavaLambdaParameterTypeHintsProvider : InlayHintsProvider {
|
||||
public companion object {
|
||||
public const val PROVIDER_ID : String = "java.implicit.types.lambda"
|
||||
}
|
||||
|
||||
override fun createCollector(file: PsiFile, editor: Editor): InlayHintsCollector {
|
||||
|
||||
@@ -7,9 +7,9 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.*
|
||||
import com.siyeh.ig.psiutils.ExpressionUtils
|
||||
|
||||
class JavaMethodChainsDeclarativeInlayProvider : AbstractDeclarativeCallChainProvider<PsiMethodCallExpression, PsiType, Unit>() {
|
||||
companion object {
|
||||
const val PROVIDER_ID: String = "java.method.chains"
|
||||
public class JavaMethodChainsDeclarativeInlayProvider : AbstractDeclarativeCallChainProvider<PsiMethodCallExpression, PsiType, Unit>() {
|
||||
public companion object {
|
||||
public const val PROVIDER_ID: String = "java.method.chains"
|
||||
}
|
||||
|
||||
override fun PsiType.buildTree(expression: PsiElement, project: Project, context: Unit, treeBuilder: PresentationTreeBuilder) {
|
||||
|
||||
@@ -3,4 +3,4 @@ package com.intellij.codeInsight.hints
|
||||
|
||||
import com.intellij.codeInsight.hints.chain.AbstractDeclarativeCallChainCustomSettingsProvider
|
||||
|
||||
class JavaMethodChainsHintsCustomSettingsProvider : AbstractDeclarativeCallChainCustomSettingsProvider(defaultChainLength = 2)
|
||||
public class JavaMethodChainsHintsCustomSettingsProvider : AbstractDeclarativeCallChainCustomSettingsProvider(defaultChainLength = 2)
|
||||
@@ -11,8 +11,8 @@ import com.intellij.psi.*
|
||||
* @param myFoldingLevel level at which generics will be shown as placeholders, so they require click to expand it.
|
||||
* @param maxLength length of the text after which everything will be folded
|
||||
*/
|
||||
class JavaTypeHintsPresentationFactory(private val myFactory: PresentationFactory, private val myFoldingLevel: Int, private val maxLength: Int = DEFAULT_LENGTH) {
|
||||
fun typeHint(type: PsiType): InlayPresentation = myFactory.roundWithBackground(hint(type, 0, Context(maxLength)))
|
||||
public class JavaTypeHintsPresentationFactory(private val myFactory: PresentationFactory, private val myFoldingLevel: Int, private val maxLength: Int = DEFAULT_LENGTH) {
|
||||
public fun typeHint(type: PsiType): InlayPresentation = myFactory.roundWithBackground(hint(type, 0, Context(maxLength)))
|
||||
|
||||
private val captureOfLabel = "capture of "
|
||||
|
||||
@@ -150,15 +150,15 @@ class JavaTypeHintsPresentationFactory(private val myFactory: PresentationFactor
|
||||
return SequencePresentation(seq)
|
||||
}
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
@JvmStatic
|
||||
fun presentation(type: PsiType, factory: PresentationFactory): InlayPresentation {
|
||||
public fun presentation(type: PsiType, factory: PresentationFactory): InlayPresentation {
|
||||
val base = JavaTypeHintsPresentationFactory(factory, 3).typeHint(type)
|
||||
return factory.roundWithBackground(base)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun presentationWithColon(type: PsiType, factory: PresentationFactory): InlayPresentation {
|
||||
public fun presentationWithColon(type: PsiType, factory: PresentationFactory): InlayPresentation {
|
||||
val presentations = JavaTypeHintsPresentationFactory(factory, 3).hint(type, 0, Context(DEFAULT_LENGTH))
|
||||
return factory.roundWithBackground(factory.seq(factory.smallText(": "), presentations))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.codeInsight.hints.declarative.StringInlayActionPayload
|
||||
import com.intellij.psi.*
|
||||
|
||||
|
||||
object JavaTypeHintsFactory {
|
||||
public object JavaTypeHintsFactory {
|
||||
private const val startFoldingFromLevel: Int = 2
|
||||
|
||||
private const val CAPTURE_OF = "capture of "
|
||||
@@ -15,7 +15,7 @@ object JavaTypeHintsFactory {
|
||||
private const val ANONYMOUS_MARK = "anonymous"
|
||||
|
||||
|
||||
fun typeHint(type: PsiType, treeBuilder: PresentationTreeBuilder) {
|
||||
public fun typeHint(type: PsiType, treeBuilder: PresentationTreeBuilder) {
|
||||
treeBuilder.typeHint(this.startFoldingFromLevel, type)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.jetbrains.annotations.Nls
|
||||
*
|
||||
* @param T type of actions
|
||||
*/
|
||||
abstract class IntentionActionGroup<T : IntentionAction>(private val actions: List<T>) : BaseIntentionAction() {
|
||||
public abstract class IntentionActionGroup<T : IntentionAction>(private val actions: List<T>) : BaseIntentionAction() {
|
||||
|
||||
final override fun getElementToMakeWritable(currentFile: PsiFile): PsiElement? = null
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.intellij.util.asSafely
|
||||
import org.jetbrains.uast.UDeclaration
|
||||
import java.util.*
|
||||
|
||||
class JavaElementActionsFactory : JvmElementActionsFactory() {
|
||||
public class JavaElementActionsFactory : JvmElementActionsFactory() {
|
||||
override fun createChangeModifierActions(target: JvmModifiersOwner, request: ChangeModifierRequest): List<IntentionAction> {
|
||||
val declaration = if (target is UDeclaration) target.javaPsi as PsiModifierListOwner else target as PsiModifierListOwner
|
||||
if (declaration.language != JavaLanguage.INSTANCE) return emptyList()
|
||||
|
||||
@@ -11,14 +11,14 @@ import com.intellij.psi.*
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
|
||||
|
||||
abstract class AbstractJavaSplitJoinContext : CommaListSplitJoinContext() {
|
||||
public abstract class AbstractJavaSplitJoinContext : CommaListSplitJoinContext() {
|
||||
override fun isValidIntermediateElement(data: ListWithElements, element: PsiElement): Boolean {
|
||||
return super.isValidIntermediateElement(data, element) ||
|
||||
element is PsiComment && element.tokenType === JavaTokenType.C_STYLE_COMMENT
|
||||
}
|
||||
}
|
||||
|
||||
class JavaSplitJoinArgumentsContext : AbstractJavaSplitJoinContext() {
|
||||
public class JavaSplitJoinArgumentsContext : AbstractJavaSplitJoinContext() {
|
||||
override fun extractData(context: PsiElement): ListWithElements? =
|
||||
getCallArgumentsList(context)?.let { ListWithElements(it, it.expressions.asList()) }
|
||||
|
||||
@@ -43,7 +43,7 @@ class JavaSplitJoinArgumentsContext : AbstractJavaSplitJoinContext() {
|
||||
override fun getSplitText(data: ListWithElements): String = JavaBundle.message("intention.family.put.arguments.on.separate.lines")
|
||||
}
|
||||
|
||||
class JavaSplitJoinParametersContext : AbstractJavaSplitJoinContext() {
|
||||
public class JavaSplitJoinParametersContext : AbstractJavaSplitJoinContext() {
|
||||
override fun extractData(context: PsiElement): ListWithElements? =
|
||||
PsiTreeUtil.getParentOfType(context, PsiParameterList::class.java, false)?.let { ListWithElements(it, it.parameters.toList()) }
|
||||
|
||||
@@ -57,7 +57,7 @@ class JavaSplitJoinParametersContext : AbstractJavaSplitJoinContext() {
|
||||
override fun getJoinText(data: ListWithElements): String = JavaBundle.message("intention.family.put.parameters.on.one.line")
|
||||
}
|
||||
|
||||
class JavaSplitJoinRecordComponentsContext : AbstractJavaSplitJoinContext() {
|
||||
public class JavaSplitJoinRecordComponentsContext : AbstractJavaSplitJoinContext() {
|
||||
override fun extractData(context: PsiElement): ListWithElements? =
|
||||
PsiTreeUtil.getParentOfType(context, PsiRecordHeader::class.java, false, PsiCodeBlock::class.java, PsiExpression::class.java)
|
||||
?.let { ListWithElements(it, it.recordComponents.toList()) }
|
||||
|
||||
@@ -12,13 +12,13 @@ import com.intellij.psi.util.MethodSignatureUtil
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
object JavaSuperTypeSearchUtil {
|
||||
public object JavaSuperTypeSearchUtil {
|
||||
|
||||
/**
|
||||
* Performs automatic supertype search as described in the
|
||||
* [JavaDoc Documentation Comment Specification](https://docs.oracle.com/en/java/javase/22/docs/specs/javadoc/doc-comment-spec.html#inheritdoc).
|
||||
*/
|
||||
fun <T> automaticSupertypeSearch(
|
||||
public fun <T> automaticSupertypeSearch(
|
||||
psiClass: PsiClass,
|
||||
method: PsiMethod,
|
||||
target: PsiDocTagValue?,
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFunctionalExpression
|
||||
import com.intellij.psi.PsiMethod
|
||||
|
||||
class JavaGotoTargetPresentationProvider : GotoTargetPresentationProvider {
|
||||
public class JavaGotoTargetPresentationProvider : GotoTargetPresentationProvider {
|
||||
|
||||
override fun getTargetPresentation(element: PsiElement, differentNames: Boolean): TargetPresentation? {
|
||||
return when (element) {
|
||||
|
||||
@@ -6,9 +6,9 @@ import com.intellij.openapi.ui.DialogPanel
|
||||
import com.intellij.ui.dsl.builder.panel
|
||||
import javax.swing.JCheckBox
|
||||
|
||||
class InferNullityAdditionalUi {
|
||||
lateinit var checkBox: JCheckBox
|
||||
val panel: DialogPanel = panel {
|
||||
public class InferNullityAdditionalUi {
|
||||
public lateinit var checkBox: JCheckBox
|
||||
public val panel: DialogPanel = panel {
|
||||
row {
|
||||
checkBox = checkBox(JavaBundle.message("checkbox.annotate.local.variables")).component
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.codeInspection.ex.InspectionElementsMergerBase
|
||||
import com.intellij.openapi.util.JDOMExternalizerUtil
|
||||
import org.jdom.Element
|
||||
|
||||
class JavadocDeclarationMerger: InspectionElementsMergerBase() {
|
||||
public class JavadocDeclarationMerger: InspectionElementsMergerBase() {
|
||||
override fun getMergedToolName(): String = "JavadocDeclaration"
|
||||
|
||||
override fun getSourceToolNames(): Array<String> = arrayOf("JavaDoc")
|
||||
|
||||
@@ -36,10 +36,10 @@ import com.intellij.psi.javadoc.PsiDocComment
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import java.io.File
|
||||
|
||||
class JavadocHtmlLintAnnotator : ExternalAnnotator<JavadocHtmlLintAnnotator.Info, JavadocHtmlLintAnnotator.Result>() {
|
||||
data class Info(val file: PsiFile)
|
||||
data class Anno(val row: Int, val col: Int, val error: Boolean, val message: String)
|
||||
data class Result(val annotations: List<Anno>)
|
||||
public class JavadocHtmlLintAnnotator : ExternalAnnotator<JavadocHtmlLintAnnotator.Info, JavadocHtmlLintAnnotator.Result>() {
|
||||
public data class Info(val file: PsiFile)
|
||||
public data class Anno(val row: Int, val col: Int, val error: Boolean, val message: String)
|
||||
public data class Result(val annotations: List<Anno>)
|
||||
|
||||
override fun getPairedBatchInspectionShortName(): String = JavadocHtmlLintInspection.SHORT_NAME
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import com.intellij.codeInspection.SuppressQuickFix
|
||||
import com.intellij.codeInspection.ex.ExternalAnnotatorBatchInspection
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
class JavadocHtmlLintInspection : LocalInspectionTool(), ExternalAnnotatorBatchInspection {
|
||||
companion object {
|
||||
const val SHORT_NAME: String = "JavadocHtmlLint"
|
||||
public class JavadocHtmlLintInspection : LocalInspectionTool(), ExternalAnnotatorBatchInspection {
|
||||
public companion object {
|
||||
public const val SHORT_NAME: String = "JavadocHtmlLint"
|
||||
}
|
||||
|
||||
override fun getBatchSuppressActions(element: PsiElement?): Array<out SuppressQuickFix> = SuppressQuickFix.EMPTY_ARRAY
|
||||
|
||||
@@ -6,9 +6,9 @@ import com.intellij.ui.dsl.builder.Cell
|
||||
import kotlin.reflect.KMutableProperty0
|
||||
|
||||
@Suppress("unused")
|
||||
object JavadocUIUtil {
|
||||
public object JavadocUIUtil {
|
||||
@Deprecated(message = "Will be removed. Inline if you need this functionality")
|
||||
fun <T> Cell<ComboBox<T>>.bindItem(property: KMutableProperty0<T>): Cell<ComboBox<T>> = applyToComponent {
|
||||
public fun <T> Cell<ComboBox<T>>.bindItem(property: KMutableProperty0<T>): Cell<ComboBox<T>> = applyToComponent {
|
||||
selectedItem = property.get()
|
||||
addActionListener {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.codeInspection.ex.InspectionElementsMergerBase
|
||||
import com.intellij.openapi.util.JDOMExternalizerUtil
|
||||
import org.jdom.Element
|
||||
|
||||
class MissingJavadocMerger: InspectionElementsMergerBase() {
|
||||
public class MissingJavadocMerger: InspectionElementsMergerBase() {
|
||||
override fun getMergedToolName(): String = "MissingJavadoc"
|
||||
override fun getSourceToolNames(): Array<String> = arrayOf("JavaDoc")
|
||||
override fun transformElement(sourceToolName: String, sourceElement: Element, toolElement: Element): Element {
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.*
|
||||
import java.util.function.Predicate
|
||||
import java.util.stream.Collectors
|
||||
|
||||
class ReplaceWithJavadocInspection : LocalInspectionTool() {
|
||||
public class ReplaceWithJavadocInspection : LocalInspectionTool() {
|
||||
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
||||
return object : JavaElementVisitor() {
|
||||
@@ -40,7 +40,7 @@ class ReplaceWithJavadocInspection : LocalInspectionTool() {
|
||||
}
|
||||
}
|
||||
|
||||
class ReplaceWithJavadocFix : PsiUpdateModCommandQuickFix() {
|
||||
public class ReplaceWithJavadocFix : PsiUpdateModCommandQuickFix() {
|
||||
override fun getFamilyName(): String {
|
||||
return JavaBundle.message("inspection.replace.with.javadoc")
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ import com.intellij.openapi.roots.libraries.LibraryProperties
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
import org.jetbrains.jps.model.library.JpsMavenRepositoryLibraryDescriptor
|
||||
|
||||
class ImportedLibraryProperties(override var mavenCoordinates: MavenCoordinates?) : LibraryProperties<ImportedLibraryProperties.MavenCoordinatesState>(), LibraryWithMavenCoordinatesProperties {
|
||||
public class ImportedLibraryProperties(override var mavenCoordinates: MavenCoordinates?) : LibraryProperties<ImportedLibraryProperties.MavenCoordinatesState>(), LibraryWithMavenCoordinatesProperties {
|
||||
|
||||
// required for serialization
|
||||
@Suppress("unused")
|
||||
constructor() : this(null)
|
||||
public constructor() : this(null)
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other != null && other is ImportedLibraryProperties) {
|
||||
return mavenCoordinates == other.mavenCoordinates
|
||||
@@ -36,8 +36,8 @@ class ImportedLibraryProperties(override var mavenCoordinates: MavenCoordinates?
|
||||
this.mavenCoordinates = MavenCoordinates(state.groupId, state.artifactId, state.version, state.baseVersion, state.packaging, state.classifier)
|
||||
}
|
||||
|
||||
class MavenCoordinatesState() {
|
||||
constructor(coordinates: MavenCoordinates): this() {
|
||||
public class MavenCoordinatesState() {
|
||||
public constructor(coordinates: MavenCoordinates): this() {
|
||||
groupId = coordinates.groupId
|
||||
artifactId = coordinates.artifactId
|
||||
version = coordinates.version
|
||||
@@ -46,16 +46,16 @@ class ImportedLibraryProperties(override var mavenCoordinates: MavenCoordinates?
|
||||
classifier = coordinates.classifier
|
||||
}
|
||||
@Attribute
|
||||
var groupId: String = ""
|
||||
public var groupId: String = ""
|
||||
@Attribute
|
||||
var artifactId: String= ""
|
||||
public var artifactId: String= ""
|
||||
@Attribute
|
||||
var version: String = ""
|
||||
public var version: String = ""
|
||||
@Attribute
|
||||
var baseVersion: String = ""
|
||||
public var baseVersion: String = ""
|
||||
@Attribute
|
||||
var packaging: String = JpsMavenRepositoryLibraryDescriptor.DEFAULT_PACKAGING
|
||||
public var packaging: String = JpsMavenRepositoryLibraryDescriptor.DEFAULT_PACKAGING
|
||||
@Attribute
|
||||
var classifier: String? = null
|
||||
public var classifier: String? = null
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import com.intellij.openapi.vfs.VirtualFile
|
||||
import javax.swing.Icon
|
||||
import javax.swing.JComponent
|
||||
|
||||
class ImportedLibraryType : LibraryType<ImportedLibraryProperties>(IMPORTED_LIBRARY_KIND) {
|
||||
public class ImportedLibraryType : LibraryType<ImportedLibraryProperties>(IMPORTED_LIBRARY_KIND) {
|
||||
|
||||
// not supposed to be created manually from project structure dialog
|
||||
override fun getCreateActionName(): @NlsContexts.Label String? = null
|
||||
@@ -38,8 +38,8 @@ class ImportedLibraryType : LibraryType<ImportedLibraryProperties>(IMPORTED_LIBR
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val IMPORTED_LIBRARY_KIND: PersistentLibraryKind<ImportedLibraryProperties> =
|
||||
public companion object {
|
||||
public val IMPORTED_LIBRARY_KIND: PersistentLibraryKind<ImportedLibraryProperties> =
|
||||
object : PersistentLibraryKind<ImportedLibraryProperties>("java-imported") {
|
||||
override fun createDefaultProperties(): ImportedLibraryProperties {
|
||||
return ImportedLibraryProperties(null)
|
||||
|
||||
@@ -18,10 +18,10 @@ import com.intellij.workspaceModel.ide.legacyBridge.findLibraryEntity
|
||||
import com.intellij.workspaceModel.ide.legacyBridge.findModuleEntity
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
object JavaBridgeCoordinateEntitySource : EntitySource
|
||||
public object JavaBridgeCoordinateEntitySource : EntitySource
|
||||
|
||||
@ApiStatus.Internal
|
||||
fun IdeModifiableModelsProvider.setModuleCoordinates(module: Module, moduleData: ModuleData) {
|
||||
public fun IdeModifiableModelsProvider.setModuleCoordinates(module: Module, moduleData: ModuleData) {
|
||||
val moduleCoordinates = moduleData.publication?.toMavenCoordinates() ?: return
|
||||
val moduleEntity = module.findModuleEntity(actualStorageBuilder) ?: return
|
||||
actualStorageBuilder.modifyModuleEntity(moduleEntity) {
|
||||
@@ -30,7 +30,7 @@ fun IdeModifiableModelsProvider.setModuleCoordinates(module: Module, moduleData:
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
fun IdeModifiableModelsProvider.setLibraryCoordinates(library: Library, libraryData: LibraryData) {
|
||||
public fun IdeModifiableModelsProvider.setLibraryCoordinates(library: Library, libraryData: LibraryData) {
|
||||
val libraryCoordinates = libraryData.toMavenCoordinates() ?: return
|
||||
val libraryEntity = library.findLibraryEntity(actualStorageBuilder) ?: return
|
||||
actualStorageBuilder.modifyLibraryEntity(libraryEntity) {
|
||||
@@ -39,7 +39,7 @@ fun IdeModifiableModelsProvider.setLibraryCoordinates(library: Library, libraryD
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
fun ProjectCoordinate.toMavenCoordinates(): MavenCoordinates? {
|
||||
public fun ProjectCoordinate.toMavenCoordinates(): MavenCoordinates? {
|
||||
val groupId = groupId ?: return null
|
||||
val artifactId = artifactId ?: return null
|
||||
val version = version ?: return null
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.openapi.roots.impl.libraries.LibraryEx
|
||||
import com.intellij.openapi.roots.libraries.Library
|
||||
import com.intellij.openapi.roots.libraries.PersistentLibraryKind
|
||||
|
||||
class JavaLibraryDataServiceExtension : LibraryDataServiceExtension {
|
||||
public class JavaLibraryDataServiceExtension : LibraryDataServiceExtension {
|
||||
|
||||
override fun getLibraryKind(libraryData: LibraryData): PersistentLibraryKind<*>? {
|
||||
if (libraryData.toMavenCoordinates() != null) {
|
||||
|
||||
@@ -5,17 +5,17 @@ import com.intellij.openapi.externalSystem.model.Key
|
||||
import com.intellij.openapi.externalSystem.model.ProjectKeys
|
||||
import com.intellij.serialization.PropertyMapping
|
||||
|
||||
class JavaManifestData {
|
||||
public class JavaManifestData {
|
||||
|
||||
val manifestAttributes: Map<String, String>
|
||||
public val manifestAttributes: Map<String, String>
|
||||
|
||||
@PropertyMapping("manifestAttributes")
|
||||
constructor(manifestAttributes: Map<String, String>) {
|
||||
public constructor(manifestAttributes: Map<String, String>) {
|
||||
this.manifestAttributes = manifestAttributes
|
||||
}
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
@JvmField
|
||||
val KEY = Key.create(JavaManifestData::class.java, ProjectKeys.TASK.processingWeight + 1)
|
||||
public val KEY: Key<JavaManifestData> = Key.create(JavaManifestData::class.java, ProjectKeys.TASK.processingWeight + 1)
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.ApiStatus
|
||||
private const val GRADLE_MAIN_SUFFIX = ".main"
|
||||
|
||||
@ApiStatus.Internal
|
||||
class JavaManifestDataService : WorkspaceDataService<JavaManifestData> {
|
||||
public class JavaManifestDataService : WorkspaceDataService<JavaManifestData> {
|
||||
|
||||
override fun getTargetDataKey(): Key<JavaManifestData> = JavaManifestData.KEY
|
||||
|
||||
|
||||
@@ -7,18 +7,18 @@ import com.intellij.openapi.externalSystem.model.project.AbstractExternalEntityD
|
||||
import com.intellij.pom.java.LanguageLevel
|
||||
import com.intellij.serialization.PropertyMapping
|
||||
|
||||
class JavaModuleData : AbstractExternalEntityData {
|
||||
public class JavaModuleData : AbstractExternalEntityData {
|
||||
|
||||
var languageLevel: LanguageLevel?
|
||||
var targetBytecodeVersion: String?
|
||||
var compilerArguments: List<String>
|
||||
public var languageLevel: LanguageLevel?
|
||||
public var targetBytecodeVersion: String?
|
||||
public var compilerArguments: List<String>
|
||||
|
||||
@Deprecated("Use #JavaModuleData(ProjectSystemId, LanguageLevel, String, Collection<String>) instead")
|
||||
constructor(owner: ProjectSystemId, languageLevel: LanguageLevel?, targetBytecodeVersion: String?) :
|
||||
public constructor(owner: ProjectSystemId, languageLevel: LanguageLevel?, targetBytecodeVersion: String?) :
|
||||
this(owner, languageLevel, targetBytecodeVersion, emptyList())
|
||||
|
||||
@PropertyMapping("owner", "languageLevel", "targetBytecodeVersion", "compilerArguments")
|
||||
constructor(owner: ProjectSystemId, languageLevel: LanguageLevel?, targetBytecodeVersion: String?, compilerArguments: List<String>) : super(owner) {
|
||||
public constructor(owner: ProjectSystemId, languageLevel: LanguageLevel?, targetBytecodeVersion: String?, compilerArguments: List<String>) : super(owner) {
|
||||
this.languageLevel = languageLevel
|
||||
this.targetBytecodeVersion = targetBytecodeVersion
|
||||
this.compilerArguments = compilerArguments
|
||||
@@ -46,8 +46,8 @@ class JavaModuleData : AbstractExternalEntityData {
|
||||
|
||||
override fun toString(): String = "java module"
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
@JvmField
|
||||
val KEY: Key<JavaModuleData> = Key.create(JavaModuleData::class.java, JavaProjectData.KEY.processingWeight + 1)
|
||||
public val KEY: Key<JavaModuleData> = Key.create(JavaModuleData::class.java, JavaProjectData.KEY.processingWeight + 1)
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import com.intellij.platform.workspace.jps.entities.sourceRoots
|
||||
import com.intellij.workspaceModel.ide.legacyBridge.findModule
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
|
||||
fun moduleDescriptions(project: Project): List<ModuleDescription> {
|
||||
public fun moduleDescriptions(project: Project): List<ModuleDescription> {
|
||||
val snapshot = WorkspaceModel
|
||||
.getInstance(project)
|
||||
.currentSnapshot
|
||||
|
||||
@@ -8,25 +8,25 @@ import com.intellij.util.xmlb.annotations.Attribute
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
class IgnoreLanguageInDefaultProvider {
|
||||
public class IgnoreLanguageInDefaultProvider {
|
||||
|
||||
@RequiredElement
|
||||
@JvmField
|
||||
@Attribute("language")
|
||||
var language: String = ""
|
||||
public var language: String = ""
|
||||
|
||||
fun languageInstance(): Language =
|
||||
public fun languageInstance(): Language =
|
||||
Language.findLanguageByID(language) ?: error("No language with id $language found")
|
||||
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
@ApiStatus.Internal
|
||||
val EP_NAME: ExtensionPointName<IgnoreLanguageInDefaultProvider> =
|
||||
public val EP_NAME: ExtensionPointName<IgnoreLanguageInDefaultProvider> =
|
||||
ExtensionPointName.create<IgnoreLanguageInDefaultProvider>("com.intellij.gotoByName.defaultProvider.ignoreLanguage")
|
||||
|
||||
@JvmStatic
|
||||
@ApiStatus.Internal
|
||||
fun getIgnoredLanguages(): Set<Language> =
|
||||
public fun getIgnoredLanguages(): Set<Language> =
|
||||
EP_NAME.extensionList.mapTo(mutableSetOf()) { it.languageInstance() }
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ import com.intellij.util.indexing.DumbModeAccessType
|
||||
import com.intellij.util.indexing.FindSymbolParameters
|
||||
import com.intellij.util.indexing.IdFilter
|
||||
|
||||
class JavaModuleNavigationContributor : ChooseByNameContributorEx, PossiblyDumbAware {
|
||||
public class JavaModuleNavigationContributor : ChooseByNameContributorEx, PossiblyDumbAware {
|
||||
override fun processNames(processor: Processor<in String>, scope: GlobalSearchScope, filter: IdFilter?) {
|
||||
DumbModeAccessType.RAW_INDEX_DATA_ACCEPTABLE.ignoreDumbMode {
|
||||
StubIndex.getInstance().processAllKeys(JavaStubIndexKeys.MODULE_NAMES, processor, scope, filter)
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.wm.ToolWindowId
|
||||
|
||||
class HierarchyScopeDescriptorProvider : ScopeDescriptorProvider {
|
||||
public class HierarchyScopeDescriptorProvider : ScopeDescriptorProvider {
|
||||
override fun getScopeDescriptors(project: Project, dataContext: DataContext): Array<ScopeDescriptor> =
|
||||
if (dataContext.getData(PlatformDataKeys.TOOL_WINDOW)?.id == ToolWindowId.TODO_VIEW) {
|
||||
ScopeDescriptorProvider.EMPTY
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.ProjectManager
|
||||
import java.nio.file.Path
|
||||
|
||||
class JdkWarmupConfigurator : WarmupConfigurator {
|
||||
public class JdkWarmupConfigurator : WarmupConfigurator {
|
||||
|
||||
override val configuratorPresentableName: String = "warmupJdkConfigurator"
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.intellij.psi.codeStyle.JavaCodeStyleSettings
|
||||
* PLEASE DON'T EDIT MANUALLY,
|
||||
* USE com.intellij.psi.codeStyle.GenerateJavaFormattingStyleCollector
|
||||
*/
|
||||
class JavaFormattingStyleCollector : ProjectUsagesCollector() {
|
||||
public class JavaFormattingStyleCollector : ProjectUsagesCollector() {
|
||||
private val GROUP = EventLogGroup("java.code.style", 3)
|
||||
|
||||
override fun getGroup(): EventLogGroup {
|
||||
|
||||
@@ -12,15 +12,15 @@ import com.intellij.internal.statistic.libraryUsage.LibraryUsageDescriptors
|
||||
* <br/>
|
||||
* See 'library-jar-statistics.xml' and 'library-usage-statistics.xml' files.
|
||||
*/
|
||||
class LibraryNameValidationRule : CustomValidationRule() {
|
||||
public class LibraryNameValidationRule : CustomValidationRule() {
|
||||
override fun getRuleId(): String = "used_library_name"
|
||||
|
||||
override fun doValidate(data: String, context: EventContext): ValidationResultType {
|
||||
return if (AllowListHolder.allowedNames.contains(data)) ValidationResultType.ACCEPTED else ValidationResultType.REJECTED
|
||||
}
|
||||
|
||||
object AllowListHolder {
|
||||
val allowedNames: Set<String> = (LibraryUsageDescriptors.libraryNames +
|
||||
LibraryJarStatisticsService.getInstance().libraryNames).toHashSet()
|
||||
public object AllowListHolder {
|
||||
public val allowedNames: Set<String> = (LibraryUsageDescriptors.libraryNames +
|
||||
LibraryJarStatisticsService.getInstance().libraryNames).toHashSet()
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.libraryUsage
|
||||
|
||||
data class LibraryDescriptor(
|
||||
public data class LibraryDescriptor(
|
||||
/**
|
||||
* Name of library/framework
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.openapi.diagnostic.thisLogger
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
class LibraryLayer private constructor(
|
||||
public class LibraryLayer private constructor(
|
||||
/**
|
||||
* Library on this layer. Must be no more than one per layer.
|
||||
*/
|
||||
@@ -16,7 +16,7 @@ class LibraryLayer private constructor(
|
||||
*/
|
||||
private val nextLayers: Map<String, LibraryLayer> = emptyMap(),
|
||||
) {
|
||||
fun findSuitableLibrary(packageQualifier: String): String? = findLibrary(packageQualifier)
|
||||
public fun findSuitableLibrary(packageQualifier: String): String? = findLibrary(packageQualifier)
|
||||
|
||||
private fun findLibrary(packageQualifier: String?): String? {
|
||||
if (packageQualifier == null) return libraryName
|
||||
@@ -25,8 +25,8 @@ class LibraryLayer private constructor(
|
||||
return nextLayers[key]?.findLibrary(newPrefix) ?: libraryName
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun create(libraryDescriptors: List<LibraryDescriptor>): LibraryLayer = LibraryLayerBuilder().apply {
|
||||
public companion object {
|
||||
public fun create(libraryDescriptors: List<LibraryDescriptor>): LibraryLayer = LibraryLayerBuilder().apply {
|
||||
for (descriptor in libraryDescriptors) {
|
||||
add(descriptor.packagePrefix, descriptor.libraryName)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.util.xmlb.annotations.Property
|
||||
import com.intellij.util.xmlb.annotations.Tag
|
||||
import com.intellij.util.xmlb.annotations.XCollection
|
||||
|
||||
object LibraryUsageDescriptors {
|
||||
public object LibraryUsageDescriptors {
|
||||
private val descriptors: List<LibraryDescriptor> = downloadLibraryDescriptors()
|
||||
private val libraryDescriptorFinder: LibraryLayer = LibraryLayer.create(downloadLibraryDescriptors())
|
||||
|
||||
@@ -22,9 +22,9 @@ object LibraryUsageDescriptors {
|
||||
.map { LibraryDescriptor(it.name!!, it.root!!) }
|
||||
}
|
||||
|
||||
fun findSuitableLibrary(packageQualifier: String): String? = libraryDescriptorFinder.findSuitableLibrary(packageQualifier)
|
||||
public fun findSuitableLibrary(packageQualifier: String): String? = libraryDescriptorFinder.findSuitableLibrary(packageQualifier)
|
||||
|
||||
val libraryNames: Set<String>
|
||||
public val libraryNames: Set<String>
|
||||
get() = descriptors.mapTo(HashSet()) { it.libraryName }
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,15 @@ import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
interface LibraryUsageImportProcessor<T : PsiElement> {
|
||||
fun imports(file: PsiFile): List<T>
|
||||
public interface LibraryUsageImportProcessor<T : PsiElement> {
|
||||
public fun imports(file: PsiFile): List<T>
|
||||
|
||||
/**
|
||||
* Checks if the statement represents a single element or on-demand import.
|
||||
*
|
||||
* @return true if the import statement is a single element, false otherwise.
|
||||
*/
|
||||
fun isSingleElementImport(import: T): Boolean
|
||||
fun importQualifier(import: T): String?
|
||||
fun resolve(import: T): PsiElement?
|
||||
public fun isSingleElementImport(import: T): Boolean
|
||||
public fun importQualifier(import: T): String?
|
||||
public fun resolve(import: T): PsiElement?
|
||||
}
|
||||
@@ -48,8 +48,8 @@ internal class LibraryUsageStatisticsProvider(private val project: Project) : Da
|
||||
}
|
||||
}
|
||||
|
||||
class LibraryUsageStatisticReporter(private val project: Project) {
|
||||
fun addStatsFromFile(vFile: VirtualFile) {
|
||||
public class LibraryUsageStatisticReporter(private val project: Project) {
|
||||
public fun addStatsFromFile(vFile: VirtualFile) {
|
||||
project.service<FileImportsCollector>().run(vFile)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import kotlin.concurrent.write
|
||||
reloadable = false,
|
||||
)
|
||||
@ApiStatus.Internal
|
||||
class LibraryUsageStatisticsStorageService : PersistentStateComponent<LibraryUsageStatisticsStorageService.LibraryUsageStatisticsState> {
|
||||
public class LibraryUsageStatisticsStorageService : PersistentStateComponent<LibraryUsageStatisticsStorageService.LibraryUsageStatisticsState> {
|
||||
private val lock = ReentrantReadWriteLock()
|
||||
private var statistics = Object2IntOpenHashMap<LibraryUsage>()
|
||||
|
||||
@@ -33,35 +33,35 @@ class LibraryUsageStatisticsStorageService : PersistentStateComponent<LibraryUsa
|
||||
statistics = Object2IntOpenHashMap(state.statistics)
|
||||
}
|
||||
|
||||
fun getStatisticsAndResetState(): Map<LibraryUsage, Int> = lock.write {
|
||||
public fun getStatisticsAndResetState(): Map<LibraryUsage, Int> = lock.write {
|
||||
val old = statistics
|
||||
statistics = Object2IntOpenHashMap()
|
||||
old
|
||||
}
|
||||
|
||||
fun increaseUsages(libraries: Collection<LibraryUsage>): Unit = lock.write {
|
||||
public fun increaseUsages(libraries: Collection<LibraryUsage>): Unit = lock.write {
|
||||
for (it in libraries) {
|
||||
statistics.addTo(it, 1)
|
||||
}
|
||||
}
|
||||
|
||||
class LibraryUsageStatisticsState {
|
||||
public class LibraryUsageStatisticsState {
|
||||
@XMap
|
||||
@JvmField
|
||||
val statistics: HashMap<LibraryUsage, Int> = HashMap()
|
||||
public val statistics: HashMap<LibraryUsage, Int> = HashMap()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getInstance(project: Project): LibraryUsageStatisticsStorageService = project.service()
|
||||
public companion object {
|
||||
public fun getInstance(project: Project): LibraryUsageStatisticsStorageService = project.service()
|
||||
}
|
||||
}
|
||||
|
||||
data class LibraryUsage(
|
||||
public data class LibraryUsage(
|
||||
var name: String? = null,
|
||||
var version: String? = null,
|
||||
var fileTypeName: String? = null,
|
||||
) {
|
||||
constructor(name: String, version: String, fileType: FileType) : this(name = name, version = version, fileTypeName = fileType.name)
|
||||
public constructor(name: String, version: String, fileType: FileType) : this(name = name, version = version, fileTypeName = fileType.name)
|
||||
|
||||
override fun toString(): String = "$name-$version for $fileTypeName"
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.TimeUnit
|
||||
@Service(Service.Level.PROJECT)
|
||||
@State(name = "ProcessedFilesStorage", storages = [Storage(StoragePathMacros.CACHE_FILE)], reloadable = false)
|
||||
@ApiStatus.Internal
|
||||
class ProcessedFilesStorageService : PersistentStateComponentWithModificationTracker<ProcessedFilesStorageService.MyState>, Disposable {
|
||||
public class ProcessedFilesStorageService : PersistentStateComponentWithModificationTracker<ProcessedFilesStorageService.MyState>, Disposable {
|
||||
override fun initializeComponent() {
|
||||
if (dropOutdatedPaths()) {
|
||||
tracker.incModificationCount()
|
||||
@@ -35,19 +35,19 @@ class ProcessedFilesStorageService : PersistentStateComponentWithModificationTra
|
||||
this.state = state
|
||||
}
|
||||
|
||||
class MyState {
|
||||
public class MyState {
|
||||
@XMap
|
||||
@JvmField
|
||||
val timestamps: MutableMap<String, Long> = ConcurrentHashMap()
|
||||
public val timestamps: MutableMap<String, Long> = ConcurrentHashMap()
|
||||
}
|
||||
|
||||
fun isVisited(vFile: VirtualFile): Boolean {
|
||||
public fun isVisited(vFile: VirtualFile): Boolean {
|
||||
val fileTime = state.timestamps[pathMd5Hash(vFile)] ?: return false
|
||||
val currentTime = System.currentTimeMillis()
|
||||
return !isDayPassed(lastTime = fileTime, currentTime = currentTime)
|
||||
}
|
||||
|
||||
fun visit(vFile: VirtualFile): Boolean {
|
||||
public fun visit(vFile: VirtualFile): Boolean {
|
||||
val hash = pathMd5Hash(vFile)
|
||||
val currentTime = System.currentTimeMillis()
|
||||
val oldTime = state.timestamps.put(hash, currentTime)
|
||||
@@ -65,8 +65,8 @@ class ProcessedFilesStorageService : PersistentStateComponentWithModificationTra
|
||||
|
||||
override fun dispose(): Unit = Unit
|
||||
|
||||
companion object {
|
||||
fun getInstance(project: Project): ProcessedFilesStorageService = project.service()
|
||||
public companion object {
|
||||
public fun getInstance(project: Project): ProcessedFilesStorageService = project.service()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,26 +13,26 @@ import com.intellij.platform.workspace.storage.annotations.Parent
|
||||
import org.jetbrains.annotations.ApiStatus.Experimental
|
||||
|
||||
@Experimental
|
||||
interface LibraryMavenCoordinateEntity : WorkspaceEntity {
|
||||
public interface LibraryMavenCoordinateEntity : WorkspaceEntity {
|
||||
|
||||
@Parent
|
||||
val library: LibraryEntity
|
||||
public val library: LibraryEntity
|
||||
|
||||
val coordinates: MavenCoordinates
|
||||
public val coordinates: MavenCoordinates
|
||||
|
||||
//region generated code
|
||||
@GeneratedCodeApiVersion(3)
|
||||
interface Builder : WorkspaceEntity.Builder<LibraryMavenCoordinateEntity> {
|
||||
public interface Builder : WorkspaceEntity.Builder<LibraryMavenCoordinateEntity> {
|
||||
override var entitySource: EntitySource
|
||||
var library: LibraryEntity.Builder
|
||||
var coordinates: MavenCoordinates
|
||||
public var library: LibraryEntity.Builder
|
||||
public var coordinates: MavenCoordinates
|
||||
}
|
||||
|
||||
companion object : EntityType<LibraryMavenCoordinateEntity, Builder>() {
|
||||
public companion object : EntityType<LibraryMavenCoordinateEntity, Builder>() {
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
@JvmName("create")
|
||||
operator fun invoke(
|
||||
public operator fun invoke(
|
||||
coordinates: MavenCoordinates,
|
||||
entitySource: EntitySource,
|
||||
init: (Builder.() -> Unit)? = null,
|
||||
@@ -48,16 +48,16 @@ interface LibraryMavenCoordinateEntity : WorkspaceEntity {
|
||||
}
|
||||
|
||||
//region generated code
|
||||
fun MutableEntityStorage.modifyLibraryMavenCoordinateEntity(
|
||||
public fun MutableEntityStorage.modifyLibraryMavenCoordinateEntity(
|
||||
entity: LibraryMavenCoordinateEntity,
|
||||
modification: LibraryMavenCoordinateEntity.Builder.() -> Unit,
|
||||
): LibraryMavenCoordinateEntity {
|
||||
return modifyEntity(LibraryMavenCoordinateEntity.Builder::class.java, entity, modification)
|
||||
}
|
||||
|
||||
var LibraryEntity.Builder.mavenCoordinates: LibraryMavenCoordinateEntity.Builder?
|
||||
public var LibraryEntity.Builder.mavenCoordinates: LibraryMavenCoordinateEntity.Builder?
|
||||
by WorkspaceEntity.extensionBuilder(LibraryMavenCoordinateEntity::class.java)
|
||||
//endregion
|
||||
|
||||
val LibraryEntity.mavenCoordinates: LibraryMavenCoordinateEntity?
|
||||
public val LibraryEntity.mavenCoordinates: LibraryMavenCoordinateEntity?
|
||||
by WorkspaceEntity.extension()
|
||||
@@ -13,26 +13,26 @@ import com.intellij.platform.workspace.storage.annotations.Parent
|
||||
import org.jetbrains.annotations.ApiStatus.Experimental
|
||||
|
||||
@Experimental
|
||||
interface ModuleMavenCoordinateEntity : WorkspaceEntity {
|
||||
public interface ModuleMavenCoordinateEntity : WorkspaceEntity {
|
||||
|
||||
@Parent
|
||||
val module: ModuleEntity
|
||||
public val module: ModuleEntity
|
||||
|
||||
val coordinates: MavenCoordinates
|
||||
public val coordinates: MavenCoordinates
|
||||
|
||||
//region generated code
|
||||
@GeneratedCodeApiVersion(3)
|
||||
interface Builder : WorkspaceEntity.Builder<ModuleMavenCoordinateEntity> {
|
||||
public interface Builder : WorkspaceEntity.Builder<ModuleMavenCoordinateEntity> {
|
||||
override var entitySource: EntitySource
|
||||
var module: ModuleEntity.Builder
|
||||
var coordinates: MavenCoordinates
|
||||
public var module: ModuleEntity.Builder
|
||||
public var coordinates: MavenCoordinates
|
||||
}
|
||||
|
||||
companion object : EntityType<ModuleMavenCoordinateEntity, Builder>() {
|
||||
public companion object : EntityType<ModuleMavenCoordinateEntity, Builder>() {
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
@JvmName("create")
|
||||
operator fun invoke(
|
||||
public operator fun invoke(
|
||||
coordinates: MavenCoordinates,
|
||||
entitySource: EntitySource,
|
||||
init: (Builder.() -> Unit)? = null,
|
||||
@@ -48,16 +48,16 @@ interface ModuleMavenCoordinateEntity : WorkspaceEntity {
|
||||
}
|
||||
|
||||
//region generated code
|
||||
fun MutableEntityStorage.modifyModuleMavenCoordinateEntity(
|
||||
public fun MutableEntityStorage.modifyModuleMavenCoordinateEntity(
|
||||
entity: ModuleMavenCoordinateEntity,
|
||||
modification: ModuleMavenCoordinateEntity.Builder.() -> Unit,
|
||||
): ModuleMavenCoordinateEntity {
|
||||
return modifyEntity(ModuleMavenCoordinateEntity.Builder::class.java, entity, modification)
|
||||
}
|
||||
|
||||
var ModuleEntity.Builder.mavenCoordinates: ModuleMavenCoordinateEntity.Builder?
|
||||
public var ModuleEntity.Builder.mavenCoordinates: ModuleMavenCoordinateEntity.Builder?
|
||||
by WorkspaceEntity.extensionBuilder(ModuleMavenCoordinateEntity::class.java)
|
||||
//endregion
|
||||
|
||||
val ModuleEntity.mavenCoordinates: ModuleMavenCoordinateEntity?
|
||||
public val ModuleEntity.mavenCoordinates: ModuleMavenCoordinateEntity?
|
||||
by WorkspaceEntity.extension()
|
||||
@@ -13,32 +13,32 @@ import javax.swing.JCheckBox
|
||||
import javax.swing.JPanel
|
||||
import javax.swing.JTextField
|
||||
|
||||
class JavadocGenerationAdditionalUi {
|
||||
lateinit var myIncludeLibraryCb: JCheckBox
|
||||
lateinit var myLinkToJdkDocs: JCheckBox
|
||||
public class JavadocGenerationAdditionalUi {
|
||||
public lateinit var myIncludeLibraryCb: JCheckBox
|
||||
public lateinit var myLinkToJdkDocs: JCheckBox
|
||||
|
||||
lateinit var myTfOutputDir: TextFieldWithBrowseButton
|
||||
public lateinit var myTfOutputDir: TextFieldWithBrowseButton
|
||||
|
||||
lateinit var myScopeCombo: ComboBox<@NlsSafe String>
|
||||
public lateinit var myScopeCombo: ComboBox<@NlsSafe String>
|
||||
|
||||
lateinit var myHierarchy: JCheckBox
|
||||
lateinit var myNavigator: JCheckBox
|
||||
lateinit var myIndex: JCheckBox
|
||||
lateinit var mySeparateIndex: JCheckBox
|
||||
public lateinit var myHierarchy: JCheckBox
|
||||
public lateinit var myNavigator: JCheckBox
|
||||
public lateinit var myIndex: JCheckBox
|
||||
public lateinit var mySeparateIndex: JCheckBox
|
||||
|
||||
lateinit var myTagUse: JCheckBox
|
||||
lateinit var myTagAuthor: JCheckBox
|
||||
lateinit var myTagVersion: JCheckBox
|
||||
lateinit var myTagDeprecated: JCheckBox
|
||||
lateinit var myDeprecatedList: JCheckBox
|
||||
public lateinit var myTagUse: JCheckBox
|
||||
public lateinit var myTagAuthor: JCheckBox
|
||||
public lateinit var myTagVersion: JCheckBox
|
||||
public lateinit var myTagDeprecated: JCheckBox
|
||||
public lateinit var myDeprecatedList: JCheckBox
|
||||
|
||||
lateinit var myLocaleTextField: JTextField
|
||||
lateinit var myOtherOptionsField: JTextField
|
||||
lateinit var myHeapSizeField: JTextField
|
||||
public lateinit var myLocaleTextField: JTextField
|
||||
public lateinit var myOtherOptionsField: JTextField
|
||||
public lateinit var myHeapSizeField: JTextField
|
||||
|
||||
lateinit var myOpenInBrowserCheckBox: JCheckBox
|
||||
public lateinit var myOpenInBrowserCheckBox: JCheckBox
|
||||
|
||||
val panel: JPanel = panel {
|
||||
public val panel: JPanel = panel {
|
||||
group(JavaBundle.message("javadoc.generate.options.separator")) {
|
||||
row {
|
||||
myIncludeLibraryCb = checkBox(JavaBundle.message("javadoc.generate.include.jdk.library.sources.in.sourcepath.option")).component
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.intellij.psi.util.createSmartPointer
|
||||
import com.intellij.psi.util.parentOfTypes
|
||||
import com.intellij.util.CommonJavaRefactoringUtil
|
||||
|
||||
abstract class CreateExecutableFromJavaUsageRequest<out T : PsiCall>(
|
||||
public abstract class CreateExecutableFromJavaUsageRequest<out T : PsiCall>(
|
||||
call: T,
|
||||
private val modifiers: Collection<JvmModifier>
|
||||
) : CreateExecutableRequest {
|
||||
@@ -20,7 +20,7 @@ abstract class CreateExecutableFromJavaUsageRequest<out T : PsiCall>(
|
||||
private val psiManager = call.manager
|
||||
private val project = psiManager.project
|
||||
private val callPointer: SmartPsiElementPointer<T> = call.createSmartPointer(project)
|
||||
val call: T get() = callPointer.element ?: error("dead pointer")
|
||||
public val call: T get() = callPointer.element ?: error("dead pointer")
|
||||
|
||||
override fun isValid(): Boolean = callPointer.element != null
|
||||
|
||||
@@ -43,5 +43,5 @@ abstract class CreateExecutableFromJavaUsageRequest<out T : PsiCall>(
|
||||
}
|
||||
}
|
||||
|
||||
val context: PsiElement? get() = call.parentOfTypes(PsiMethod::class, PsiClass::class)
|
||||
public val context: PsiElement? get() = call.parentOfTypes(PsiMethod::class, PsiClass::class)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.intellij.psi.PsiJvmSubstitutor
|
||||
import com.intellij.psi.PsiReferenceExpression
|
||||
import com.intellij.psi.util.createSmartPointer
|
||||
|
||||
class CreateFieldFromJavaUsageRequest(
|
||||
public class CreateFieldFromJavaUsageRequest(
|
||||
reference: PsiReferenceExpression,
|
||||
private val modifiers: Collection<JvmModifier>,
|
||||
private val isConstant: Boolean,
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.intellij.psi.*
|
||||
import com.intellij.psi.util.parentsOfType
|
||||
import com.intellij.util.SmartList
|
||||
|
||||
fun generateConstructorActions(call: PsiConstructorCall): List<IntentionAction> {
|
||||
public fun generateConstructorActions(call: PsiConstructorCall): List<IntentionAction> {
|
||||
val targetClass = findTargetClass(call) ?: return emptyList()
|
||||
val request = CreateConstructorFromJavaUsageRequest(call, emptyList())
|
||||
return createConstructorActions(targetClass, request)
|
||||
@@ -35,7 +35,7 @@ private fun findTargetClass(newExpression: PsiNewExpression): JvmClass? {
|
||||
return if (clazz.classKind == JvmClassKind.CLASS) clazz else null
|
||||
}
|
||||
|
||||
fun generateConstructorActions(call: PsiMethodCallExpression): List<IntentionAction> {
|
||||
public fun generateConstructorActions(call: PsiMethodCallExpression): List<IntentionAction> {
|
||||
val containingClass = call.parentsOfType<PsiClass>().firstOrNull() ?: return emptyList()
|
||||
val result = SmartList<IntentionAction>()
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.intellij.psi.impl.PsiImplUtil
|
||||
import com.intellij.psi.util.*
|
||||
import com.intellij.psi.util.PsiUtil.resolveClassInClassTypeOnly
|
||||
|
||||
fun generateActions(ref: PsiReferenceExpression): List<IntentionAction> {
|
||||
public fun generateActions(ref: PsiReferenceExpression): List<IntentionAction> {
|
||||
if (!checkReference(ref)) return emptyList()
|
||||
val fieldRequests = CreateFieldRequests(ref).collectRequests()
|
||||
val extensions = EP_NAME.extensionList
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.intellij.psi.PsiMethodCallExpression
|
||||
import com.intellij.psi.util.PsiUtil.resolveClassInClassTypeOnly
|
||||
import com.intellij.psi.util.parentOfType
|
||||
|
||||
fun generateActions(call: PsiMethodCallExpression): List<IntentionAction> {
|
||||
public fun generateActions(call: PsiMethodCallExpression): List<IntentionAction> {
|
||||
if (!checkCall(call)) return emptyList()
|
||||
val methodRequests = CreateMethodRequests(call).collectRequests()
|
||||
val extensions = EP_NAME.extensionList
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.JList
|
||||
import javax.swing.ListCellRenderer
|
||||
import javax.swing.SwingConstants
|
||||
|
||||
open class JvmClassIntentionActionGroup(
|
||||
public open class JvmClassIntentionActionGroup(
|
||||
actions: List<JvmGroupIntentionAction>,
|
||||
private val actionGroup: JvmActionGroup,
|
||||
private val callSiteLanguage: Language
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.codeInsight.intention.IntentionAction
|
||||
import com.intellij.lang.Language
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
|
||||
fun List<IntentionAction>.groupActionsByType(language: Language): List<IntentionAction> {
|
||||
public fun List<IntentionAction>.groupActionsByType(language: Language): List<IntentionAction> {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode) {
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.lang.logging
|
||||
|
||||
import com.siyeh.ig.psiutils.JavaLoggingUtils
|
||||
|
||||
class ApacheCommonsLogger : JvmLogger by JvmLoggerFieldDelegate(
|
||||
public class ApacheCommonsLogger : JvmLogger by JvmLoggerFieldDelegate(
|
||||
JavaLoggingUtils.COMMONS_LOGGING_FACTORY,
|
||||
"getLog",
|
||||
"%s.class",
|
||||
|
||||
@@ -15,30 +15,30 @@ import org.jetbrains.annotations.ApiStatus
|
||||
* the way to generate a logger at the class. Please, don't use it now, this API will be rewritten in the future.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
interface JvmLogger {
|
||||
public interface JvmLogger {
|
||||
/**
|
||||
* This field represents id of the logger which is used to save the logger the settings
|
||||
*/
|
||||
val id : String
|
||||
public val id : String
|
||||
/**
|
||||
* This field represents fully qualified name of the logger's type
|
||||
*/
|
||||
val loggerTypeName: String
|
||||
public val loggerTypeName: String
|
||||
|
||||
/**
|
||||
* This field is used to determine the order of loggers in the settings
|
||||
* @see com.intellij.ui.logging.JvmLoggingConfigurable
|
||||
*/
|
||||
val priority: Int
|
||||
public val priority: Int
|
||||
|
||||
/**
|
||||
* Determines if the logger should only be used when user didn't specify the preferred logger in the settings.
|
||||
* For example, it happens after creation of the new project.
|
||||
*
|
||||
* @return true if the logger should only be used during startup, false otherwise
|
||||
* @see com.intellij.lang.logging.UnspecifiedLogger
|
||||
* @see UnspecifiedLogger
|
||||
*/
|
||||
fun isOnlyOnStartup() = false
|
||||
public fun isOnlyOnStartup(): Boolean = false
|
||||
|
||||
/**
|
||||
* Method for inserting the logger at the specified class. Should only be invoked inside WriteAction.
|
||||
@@ -46,7 +46,7 @@ interface JvmLogger {
|
||||
* @param clazz the class where the logger element will be inserted
|
||||
* @param logger PsiElement, corresponding to the logger to be inserted
|
||||
*/
|
||||
fun insertLoggerAtClass(project: Project, clazz: PsiClass, logger: PsiElement): PsiElement?
|
||||
public fun insertLoggerAtClass(project: Project, clazz: PsiClass, logger: PsiElement): PsiElement?
|
||||
|
||||
/**
|
||||
* Determines if the logger is available for the given project. Should only be invoked inside ReadAction.
|
||||
@@ -54,7 +54,7 @@ interface JvmLogger {
|
||||
* @param project the project context
|
||||
* @return true if the logger is available, false otherwise
|
||||
*/
|
||||
fun isAvailable(project: Project?): Boolean
|
||||
public fun isAvailable(project: Project?): Boolean
|
||||
|
||||
/**
|
||||
* Determines if the logger is available for the given module. Should only be invoked inside ReadAction.
|
||||
@@ -62,7 +62,7 @@ interface JvmLogger {
|
||||
* @param module the module context
|
||||
* @return true if the logger is available, false otherwise
|
||||
*/
|
||||
fun isAvailable(module: Module?): Boolean
|
||||
public fun isAvailable(module: Module?): Boolean
|
||||
|
||||
/**
|
||||
* Determines if it is possible to place a logger at the specified class.
|
||||
@@ -70,7 +70,7 @@ interface JvmLogger {
|
||||
* @param clazz the class where the logger will be placed
|
||||
* @return true if it is possible to place a logger, false otherwise
|
||||
*/
|
||||
fun isPossibleToPlaceLoggerAtClass(clazz: PsiClass): Boolean
|
||||
public fun isPossibleToPlaceLoggerAtClass(clazz: PsiClass): Boolean
|
||||
|
||||
/**
|
||||
* Creates a logger element for inserting into a class.
|
||||
@@ -79,14 +79,14 @@ interface JvmLogger {
|
||||
* @param clazz the class where the logger element will be inserted
|
||||
* @return the created logger element, or null if creation fails
|
||||
*/
|
||||
fun createLogger(project: Project, clazz: PsiClass): PsiElement?
|
||||
public fun createLogger(project: Project, clazz: PsiClass): PsiElement?
|
||||
|
||||
/**
|
||||
* @return the name of the log field for the class, or null if it is impossible to define
|
||||
*/
|
||||
fun getLogFieldName(clazz: PsiClass): String?
|
||||
public fun getLogFieldName(clazz: PsiClass): String?
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
private val EP_NAME = ExtensionPointName<JvmLogger>("com.intellij.jvm.logging")
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,7 @@ interface JvmLogger {
|
||||
* @param isOnlyOnStartup flag indicating whether to include only loggers that should be used on startup like [UnspecifiedLogger].
|
||||
* @return a list of JvmLogger instances sorted by priority
|
||||
*/
|
||||
fun getAllLoggers(isOnlyOnStartup: Boolean): List<JvmLogger> {
|
||||
public fun getAllLoggers(isOnlyOnStartup: Boolean): List<JvmLogger> {
|
||||
return EP_NAME.extensionList.filter { if (!isOnlyOnStartup) !it.isOnlyOnStartup() else true }.sortedByDescending { it.priority }
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ interface JvmLogger {
|
||||
* @param loggerId The ID of the logger to retrieve.
|
||||
* @return The logger with the specified ID, or null if not found.
|
||||
*/
|
||||
fun getLoggerById(loggerId: String?): JvmLogger? {
|
||||
public fun getLoggerById(loggerId: String?): JvmLogger? {
|
||||
return EP_NAME.extensionList.find { loggerId == it.id }
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ interface JvmLogger {
|
||||
* @param filterByImportExclusion indicates whether to filter loggers by import exclusion
|
||||
* @return a list of suitable loggers for the module
|
||||
*/
|
||||
fun findSuitableLoggers(module: Module?, filterByImportExclusion: Boolean = false): List<JvmLogger> {
|
||||
public fun findSuitableLoggers(module: Module?, filterByImportExclusion: Boolean = false): List<JvmLogger> {
|
||||
val project = module?.project ?: return emptyList()
|
||||
return getAllLoggers(false).filter {
|
||||
it.isAvailable(module) && !(filterByImportExclusion && isLoggerExcluded(project, it))
|
||||
@@ -135,7 +135,7 @@ interface JvmLogger {
|
||||
* @param element the [PsiElement] from which to retrieve the nested classes
|
||||
* @return [Sequence] of [PsiClass] representing the nested classes
|
||||
*/
|
||||
fun getAllNamedContainingClasses(element: PsiElement): List<PsiClass> = element.parentsOfType(PsiClass::class.java, true)
|
||||
public fun getAllNamedContainingClasses(element: PsiElement): List<PsiClass> = element.parentsOfType(PsiClass::class.java, true)
|
||||
.filter { clazz -> clazz !is PsiAnonymousClass && clazz !is PsiImplicitClass }
|
||||
.toList()
|
||||
|
||||
@@ -147,7 +147,7 @@ interface JvmLogger {
|
||||
* @return a list of PsiClass objects representing the possible places for inserting a logger, in reversed order
|
||||
* @see isOnlyOnStartup
|
||||
*/
|
||||
fun getPossiblePlacesForLogger(element: PsiElement, loggerList: List<JvmLogger>): List<PsiClass> = getAllNamedContainingClasses(element)
|
||||
public fun getPossiblePlacesForLogger(element: PsiElement, loggerList: List<JvmLogger>): List<PsiClass> = getAllNamedContainingClasses(element)
|
||||
.filter { clazz -> isPossibleToPlaceLogger(clazz, loggerList) }
|
||||
.reversed()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.intellij.ui.logging.JvmLoggingSettingsStorage
|
||||
* @property loggerTypeName The fully qualified name of the logger's type.
|
||||
* @property priority The priority of the logger, used for ordering in the settings.
|
||||
*/
|
||||
class JvmLoggerFieldDelegate(
|
||||
public class JvmLoggerFieldDelegate(
|
||||
private val factoryName: String,
|
||||
private val methodName: String,
|
||||
private val classNamePattern: String,
|
||||
@@ -67,7 +67,7 @@ class JvmLoggerFieldDelegate(
|
||||
return settings.loggerName
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val LOGGER_IDENTIFIER = "log"
|
||||
public companion object {
|
||||
public const val LOGGER_IDENTIFIER: String = "log"
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.intellij.lang.logging
|
||||
|
||||
import com.siyeh.ig.psiutils.JavaLoggingUtils
|
||||
|
||||
class Log4j2Logger : JvmLogger by JvmLoggerFieldDelegate(
|
||||
public class Log4j2Logger : JvmLogger by JvmLoggerFieldDelegate(
|
||||
JavaLoggingUtils.LOG4J2_FACTORY,
|
||||
"getLogger",
|
||||
"%s.class",
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.lang.logging
|
||||
|
||||
import com.siyeh.ig.psiutils.JavaLoggingUtils
|
||||
|
||||
class Log4jLogger : JvmLogger by JvmLoggerFieldDelegate(
|
||||
public class Log4jLogger : JvmLogger by JvmLoggerFieldDelegate(
|
||||
JavaLoggingUtils.LOG4J_FACTORY,
|
||||
"getLogger",
|
||||
"%s.class",
|
||||
|
||||
@@ -12,17 +12,17 @@ import com.intellij.psi.search.ProjectAndLibrariesScope
|
||||
* Scope which contains project files and libraries which are only available in the project, e.g. it excludes libraries for
|
||||
* the configuration scripts like Gradle build script.
|
||||
* */
|
||||
class ProjectContainingLibrariesScope(project: Project) : ProjectAndLibrariesScope(project) {
|
||||
public class ProjectContainingLibrariesScope(project: Project) : ProjectAndLibrariesScope(project) {
|
||||
private val projectFileIndex: ProjectFileIndex = ProjectFileIndex.getInstance(project);
|
||||
|
||||
override fun contains(file: VirtualFile): Boolean = !projectFileIndex.findContainingLibraries(file).isEmpty()
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
private val PROJECT_CONTAINING_LIBRARIES_SCOPE_KEY = NotNullLazyKey.createLazyKey<GlobalSearchScope, Project>(
|
||||
"PROJECT_CONTAINING_LIBRARIES_SCOPE_KEY"
|
||||
) { project: Project -> ProjectContainingLibrariesScope(project) }
|
||||
|
||||
@JvmStatic
|
||||
fun getScope(project: Project): GlobalSearchScope = PROJECT_CONTAINING_LIBRARIES_SCOPE_KEY.getValue(project)
|
||||
public fun getScope(project: Project): GlobalSearchScope = PROJECT_CONTAINING_LIBRARIES_SCOPE_KEY.getValue(project)
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.intellij.lang.logging
|
||||
|
||||
import com.siyeh.ig.psiutils.JavaLoggingUtils
|
||||
|
||||
class Slf4jLogger : JvmLogger by JvmLoggerFieldDelegate(
|
||||
public class Slf4jLogger : JvmLogger by JvmLoggerFieldDelegate(
|
||||
JavaLoggingUtils.SLF4J_FACTORY,
|
||||
"getLogger",
|
||||
"%s.class",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user