mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
[java-highlighting] IDEA-378781 Quick fixes for typos in keywords
- more cases - move primitive types to PsiTypes.java GitOrigin-RevId: 3a94f2e8fe84e9e2cb95d84bc7ebb13f77579916
This commit is contained in:
committed by
intellij-monorepo-bot
parent
db6d880d4a
commit
a99d6a79da
@@ -2,10 +2,11 @@
|
||||
package com.intellij.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.intellij.psi.PsiType.*;
|
||||
|
||||
@@ -23,6 +24,10 @@ public final class PsiTypes {
|
||||
doubleType()
|
||||
));
|
||||
|
||||
private static final Map<String, PsiPrimitiveType> PRIMITIVE_TYPES_BY_NAME =
|
||||
Collections.unmodifiableMap(PRIMITIVE_TYPES.stream()
|
||||
.collect(Collectors.toMap(PsiPrimitiveType::getName, Function.identity())));
|
||||
|
||||
/**
|
||||
* Returns instance corresponding to {@code byte} type.
|
||||
*/
|
||||
@@ -94,6 +99,22 @@ public final class PsiTypes {
|
||||
return PRIMITIVE_TYPES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a primitive type by its name.
|
||||
* @param name name of a primitive type.
|
||||
* @return primitive type instance or null if there is no such type.
|
||||
*/
|
||||
public static @Nullable PsiPrimitiveType primitiveTypeByName(@NotNull String name) {
|
||||
return PRIMITIVE_TYPES_BY_NAME.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a set of names of primitive types.
|
||||
*/
|
||||
public static @NotNull Set<String> primitiveTypeNames() {
|
||||
return PRIMITIVE_TYPES_BY_NAME.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns instance describing the type of {@code null} value.
|
||||
*/
|
||||
|
||||
@@ -1538,14 +1538,6 @@ public final class PsiUtil extends PsiUtilCore {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static final Set<String> PRIMITIVE_TYPES = Collections.unmodifiableSet(ContainerUtil.newLinkedHashSet(
|
||||
SHORT, BOOLEAN,
|
||||
DOUBLE, LONG,
|
||||
INT, FLOAT,
|
||||
CHAR, BYTE
|
||||
));
|
||||
|
||||
private static final Set<String> KEYWORDS = Collections.unmodifiableSet(
|
||||
ContainerUtil.newHashSet(ABSTRACT, BOOLEAN, BREAK, BYTE, CASE, CATCH, CHAR, CLASS, CONST, CONTINUE, DEFAULT, DO, DOUBLE, ELSE, EXTENDS,
|
||||
FALSE, FINAL, FINALLY, FLOAT, FOR, GOTO, IF, IMPLEMENTS, IMPORT, INSTANCEOF, INT, INTERFACE, LONG, NATIVE,
|
||||
|
||||
@@ -1300,8 +1300,7 @@ public final class TypeConversionUtil {
|
||||
|
||||
private static final Set<String> PRIMITIVE_WRAPPER_FQNS = Collections.unmodifiableSet(
|
||||
ContainerUtil.newHashSet(JAVA_LANG_BYTE, JAVA_LANG_CHARACTER, JAVA_LANG_DOUBLE, JAVA_LANG_FLOAT, JAVA_LANG_LONG, JAVA_LANG_INTEGER,
|
||||
JAVA_LANG_SHORT,
|
||||
JAVA_LANG_BOOLEAN));
|
||||
JAVA_LANG_SHORT, JAVA_LANG_BOOLEAN));
|
||||
|
||||
private static final Set<String> PRIMITIVE_WRAPPER_SIMPLE_NAMES =
|
||||
ContainerUtil.map2Set(PRIMITIVE_WRAPPER_FQNS, StringUtil::getShortName);
|
||||
|
||||
Reference in New Issue
Block a user