diff --git a/java/java-psi-api/src/com/intellij/psi/util/DefaultPropertyAccessorDetector.java b/java/java-psi-api/src/com/intellij/psi/util/DefaultPropertyAccessorDetector.java deleted file mode 100644 index ed4968b091ff..000000000000 --- a/java/java-psi-api/src/com/intellij/psi/util/DefaultPropertyAccessorDetector.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.intellij.psi.util; - -import com.intellij.lang.java.beans.PropertyKind; -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.psi.PsiMethod; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class DefaultPropertyAccessorDetector implements PropertyAccessorDetector { - private static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.propertyAccessorDetector"); - - public static @Nullable PropertyAccessorInfo detectFrom(@NotNull PsiMethod method) { - for (PropertyAccessorDetector detector : EP_NAME.getExtensions()) { - PropertyAccessorInfo accessorInfo = detector.detectPropertyAccessor(method); - if (accessorInfo != null) { - return accessorInfo; - } - } - return getAccessorInfo(method); - } - - @Nullable - private static PropertyAccessorInfo getAccessorInfo(@NotNull PsiMethod method) { - if (PropertyUtilBase.isSimplePropertyGetter(method)) { - return new PropertyAccessorInfo(PropertyUtilBase.getPropertyNameByGetter(method), - method.getReturnType(), - PropertyKind.GETTER); - } - else if (PropertyUtilBase.isSimplePropertySetter(method)) { - return new PropertyAccessorInfo(PropertyUtilBase.getPropertyNameBySetter(method), - method.getParameterList().getParameters()[0].getType(), - PropertyKind.SETTER); - } - return null; - } - - @Override - public @Nullable PropertyAccessorInfo detectPropertyAccessor(@NotNull PsiMethod method) { - return getAccessorInfo(method); - } -} diff --git a/java/java-psi-api/src/com/intellij/psi/util/PropertyAccessorDetector.java b/java/java-psi-api/src/com/intellij/psi/util/PropertyAccessorDetector.java index 7afeed7bf78d..b22efa3ff5dd 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PropertyAccessorDetector.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PropertyAccessorDetector.java @@ -2,12 +2,40 @@ package com.intellij.psi.util; import com.intellij.lang.java.beans.PropertyKind; +import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public interface PropertyAccessorDetector { + ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.propertyAccessorDetector"); + + static @Nullable PropertyAccessorInfo detectFrom(@NotNull PsiMethod method) { + for (PropertyAccessorDetector detector : EP_NAME.getExtensions()) { + PropertyAccessorInfo accessorInfo = detector.detectPropertyAccessor(method); + if (accessorInfo != null) { + return accessorInfo; + } + } + return getDefaultAccessorInfo(method); + } + + @Nullable + static PropertyAccessorInfo getDefaultAccessorInfo(@NotNull PsiMethod method) { + if (PropertyUtilBase.isSimplePropertyGetter(method)) { + return new PropertyAccessorInfo(PropertyUtilBase.getPropertyNameByGetter(method), + method.getReturnType(), + PropertyKind.GETTER); + } + else if (PropertyUtilBase.isSimplePropertySetter(method)) { + return new PropertyAccessorInfo(PropertyUtilBase.getPropertyNameBySetter(method), + method.getParameterList().getParameters()[0].getType(), + PropertyKind.SETTER); + } + return null; + } + /** * Detects property access information if any, or results to null */ diff --git a/java/java-structure-view/src/com/intellij/ide/structureView/impl/java/PropertyGroup.java b/java/java-structure-view/src/com/intellij/ide/structureView/impl/java/PropertyGroup.java index 2f1208550aef..65bfbe38c292 100644 --- a/java/java-structure-view/src/com/intellij/ide/structureView/impl/java/PropertyGroup.java +++ b/java/java-structure-view/src/com/intellij/ide/structureView/impl/java/PropertyGroup.java @@ -13,7 +13,6 @@ import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.project.IndexNotReadyException; import com.intellij.openapi.project.Project; import com.intellij.psi.*; -import com.intellij.psi.util.DefaultPropertyAccessorDetector; import com.intellij.psi.util.PropertyAccessorDetector; import com.intellij.psi.util.PropertyUtilBase; import com.intellij.psi.util.PsiUtil; @@ -59,7 +58,7 @@ public final class PropertyGroup implements Group, ColoredItemPresentation, Acce return group; } else if (object instanceof PsiMethod method) { - final PropertyAccessorDetector.PropertyAccessorInfo accessorInfo = DefaultPropertyAccessorDetector.detectFrom(method); + final PropertyAccessorDetector.PropertyAccessorInfo accessorInfo = PropertyAccessorDetector.detectFrom(method); if (null != accessorInfo && (accessorInfo.isKindOf(PropertyKind.GETTER) || accessorInfo.isKindOf(PropertyKind.SETTER))) {