mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
[java] API: deprecate constants of type PsiPrimitiveType in PsiType class (IDEA-309438)
GitOrigin-RevId: 5764c33b64a9b4228a2f43febd055a357d581644
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3e7b344ec7
commit
0a1df5c00a
@@ -11,18 +11,49 @@ import org.jetbrains.annotations.*;
|
||||
|
||||
/**
|
||||
* Representation of Java type (primitive type, array or class type).
|
||||
* <p/>
|
||||
* <h3><a id="deprecated-constants">Deprecated constants</a></h3>
|
||||
* All static fields in this class representing instances of {@link PsiPrimitiveType} are deprecated. It was done to avoid deadlocks
|
||||
* during initialization of the class. According to <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-5.html#jvms-5.5">section 5.5</a>
|
||||
* of JVM specification, when a class is initialized, JVM firsly synchronizes on an initialization lock specific for that class, then
|
||||
* initializes its super class and then computes initializers for its static fields. So because of these fields initialization of {@link PsiType}
|
||||
* performs initialization of {@link PsiPrimitiveType}, and initialization of {@link PsiPrimitiveType} performs initialization of {@link PsiType}
|
||||
* because its the super class of its super class. Therefore, if one thread starts initialization of {@link PsiType}, and another thread
|
||||
* starts initialization of {@link PsiPrimitiveType} at the same time, it'll result in a deadlock. In order to avoid this, methods from
|
||||
* {@link PsiTypes} must be used to get instances of the primitive types.
|
||||
*/
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass")
|
||||
public abstract class PsiType implements PsiAnnotationOwner, Cloneable, JvmType {
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType BYTE = PsiTypes.byteType();
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType CHAR = PsiTypes.charType();
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType DOUBLE = PsiTypes.doubleType();
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType FLOAT = PsiTypes.floatType();
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType INT = PsiTypes.intType();
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType LONG = PsiTypes.longType();
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType SHORT = PsiTypes.shortType();
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType BOOLEAN = PsiTypes.booleanType();
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType VOID = PsiTypes.voidType();
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass") public static final PsiPrimitiveType NULL = (PsiPrimitiveType)PsiTypes.nullType();
|
||||
/** @deprecated use {@link PsiTypes#byteType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType BYTE = PsiTypes.byteType();
|
||||
/** @deprecated use {@link PsiTypes#charType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType CHAR = PsiTypes.charType();
|
||||
/** @deprecated use {@link PsiTypes#doubleType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType DOUBLE = PsiTypes.doubleType();
|
||||
/** @deprecated use {@link PsiTypes#floatType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType FLOAT = PsiTypes.floatType();
|
||||
/** @deprecated use {@link PsiTypes#intType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType INT = PsiTypes.intType();
|
||||
/** @deprecated use {@link PsiTypes#longType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType LONG = PsiTypes.longType();
|
||||
/** @deprecated use {@link PsiTypes#shortType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType SHORT = PsiTypes.shortType();
|
||||
/** @deprecated use {@link PsiTypes#booleanType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType BOOLEAN = PsiTypes.booleanType();
|
||||
/** @deprecated use {@link PsiTypes#voidType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType VOID = PsiTypes.voidType();
|
||||
/** @deprecated use {@link PsiTypes#nullType()} instead, see <a href="#deprecated-constants">Deprecated Constants</a> for details. */
|
||||
@Deprecated @ApiStatus.ScheduledForRemoval
|
||||
public static final PsiPrimitiveType NULL = (PsiPrimitiveType)PsiTypes.nullType();
|
||||
|
||||
public static final PsiType[] EMPTY_ARRAY = new PsiType[0];
|
||||
public static final ArrayFactory<PsiType> ARRAY_FACTORY = count -> count == 0 ? EMPTY_ARRAY : new PsiType[count];
|
||||
|
||||
Reference in New Issue
Block a user