mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
[java-psi] main method utils: improve Javadoc a bit
GitOrigin-RevId: 94e7625f0541742bedb9d8a327e9870510895004
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b71e97b87f
commit
2b6f045d49
@@ -16,11 +16,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* An extension that can provide a custom entry point for Java application (like a {@code main()} method).
|
||||
* For example, a custom framework (like JavaFX) may have a separate entry point.
|
||||
* These extensions used in some methods in {@link PsiMethodUtil}, like {@link PsiMethodUtil#hasMainMethod(PsiClass)},
|
||||
* These extensions are used in some methods in {@link PsiMethodUtil}, like {@link PsiMethodUtil#hasMainMethod(PsiClass)},
|
||||
* and can affect the behavior of various IDE features.
|
||||
* <p>
|
||||
* The methods of this extension might be called from {@linkplain com.intellij.openapi.project.DumbService dumb mode}.
|
||||
* </p>
|
||||
* The methods of this extension might be called while the IDE is in {@linkplain com.intellij.openapi.project.DumbService dumb mode}.
|
||||
*/
|
||||
public interface JavaMainMethodProvider extends PossiblyDumbAware {
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ import java.util.List;
|
||||
|
||||
public final class PsiMethodUtil {
|
||||
|
||||
/// Returns a predicate that evaluates to true when passed a class that _can be_ a main class, i.e., a class that has a main method.
|
||||
///
|
||||
/// It does not check whether the class actually has a main method. For that, use [#hasMainMethod(PsiClass)].
|
||||
public static final Condition<@NotNull PsiClass> MAIN_CLASS = psiClass -> {
|
||||
if (PsiUtil.isLocalOrAnonymousClass(psiClass)) return false;
|
||||
if (psiClass.isAnnotationType()) return false;
|
||||
@@ -66,9 +69,12 @@ public final class PsiMethodUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the main method in the given class or its parents.
|
||||
* ATTENTION: this method does not use implementations of {@link JavaMainMethodProvider}
|
||||
* if you need to take into account custom entry points, use {@link #hasMainMethod(PsiClass)} or {@link #findMainMethod(PsiClass)}
|
||||
* Finds the main method in the given class or its superclasses.
|
||||
*
|
||||
* <h3>ATTENTION</h3>
|
||||
* This method does not use implementations of {@link JavaMainMethodProvider}.
|
||||
* <p>
|
||||
* If you need to take custom entry points into account, use {@link #hasMainMethod(PsiClass)} or {@link #findMainMethod(PsiClass)}.
|
||||
*
|
||||
* @param aClass the class in which to find the main method.
|
||||
* @return the main method if found, or null if not found or if an {@link IndexNotReadyException} occurs.
|
||||
|
||||
Reference in New Issue
Block a user