mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: add some documentation
GitOrigin-RevId: 3505bb86d31820c00596af5ed196aae8b53d5c65
This commit is contained in:
committed by
intellij-monorepo-bot
parent
58f940d673
commit
f42116023e
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.openapi.util.Ref;
|
||||
@@ -18,7 +18,9 @@ public final class JavaPsiConstructorUtil {
|
||||
|
||||
/**
|
||||
* Finds an explicit call to another constructor within the specified constructor (either chained or super).
|
||||
* If there are multiple explicit constructor calls (which does not compile), the first one is returned.
|
||||
* If there are multiple explicit constructor calls (uncompilable), the first one is returned.
|
||||
* This method is Flexible Constructor Bodies (JEP 492) aware.
|
||||
*
|
||||
* @param constructor constructor to search in
|
||||
* @return found this/super constructor method call or null if not found or the supplied method is not a constructor
|
||||
*/
|
||||
@@ -40,9 +42,10 @@ public final class JavaPsiConstructorUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if given element is a chained constructor call
|
||||
* Returns true if given element is a chained constructor call.
|
||||
*
|
||||
* @param call element to check
|
||||
* @return true if given element is a chained constructor call
|
||||
* @return true, if the specified element is a chained constructor call
|
||||
*/
|
||||
@Contract("null -> false")
|
||||
public static boolean isChainedConstructorCall(@Nullable PsiElement call) {
|
||||
@@ -52,19 +55,23 @@ public final class JavaPsiConstructorUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param call element to check
|
||||
* Checks if the specified element is a super() constructor call.
|
||||
*
|
||||
* @param element element to check
|
||||
* @return true if given element is a {@code super} constructor call
|
||||
*/
|
||||
@Contract("null -> false")
|
||||
public static boolean isSuperConstructorCall(@Nullable PsiElement call) {
|
||||
if (!(call instanceof PsiMethodCallExpression)) return false;
|
||||
PsiElement child = ((PsiMethodCallExpression)call).getMethodExpression().getReferenceNameElement();
|
||||
public static boolean isSuperConstructorCall(@Nullable PsiElement element) {
|
||||
if (!(element instanceof PsiMethodCallExpression)) return false;
|
||||
PsiElement child = ((PsiMethodCallExpression)element).getMethodExpression().getReferenceNameElement();
|
||||
return PsiUtil.isJavaToken(child, JavaTokenType.SUPER_KEYWORD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified element is a this() or super() constructor call.
|
||||
*
|
||||
* @param call element to check
|
||||
* @return true if given element is {@code this} or {@code super} constructor call
|
||||
* @return true if given element is {@code this()} or {@code super()} constructor call
|
||||
*/
|
||||
@Contract("null -> false")
|
||||
public static boolean isConstructorCall(@Nullable PsiElement call) {
|
||||
|
||||
Reference in New Issue
Block a user