don't extend DynamicBundle

GitOrigin-RevId: 49cbebd629a92877dbeeffba8d97b0631fb9407e
This commit is contained in:
Vladimir Krivosheev
2023-05-05 08:11:48 +02:00
committed by intellij-monorepo-bot
parent b2be1ed69d
commit 227d75a1fc
186 changed files with 968 additions and 1474 deletions

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class RegExpBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.RegExpBundle";
private static final RegExpBundle INSTANCE = new RegExpBundle();
public final class RegExpBundle {
private static final @NonNls String BUNDLE = "messages.RegExpBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(RegExpBundle.class, BUNDLE);
private RegExpBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -13,7 +13,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.Collections;
public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost> {
private static final RegExpLanguageHosts INSTANCE = new RegExpLanguageHosts();
private final DefaultRegExpPropertiesProvider myDefaultProvider;
@@ -28,8 +27,7 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
}
@Contract("null -> null")
@Nullable
private static RegExpLanguageHost findRegExpHost(@Nullable final PsiElement element) {
private static @Nullable RegExpLanguageHost findRegExpHost(final @Nullable PsiElement element) {
if (element == null) {
return null;
}
@@ -44,7 +42,7 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
return null;
}
public boolean isRedundantEscape(@NotNull final RegExpChar ch, @NotNull final String text) {
public boolean isRedundantEscape(final @NotNull RegExpChar ch, final @NotNull String text) {
if (text.length() <= 1) {
return false;
}
@@ -83,12 +81,12 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
return host == null || host.supportsPropertySyntax(context);
}
public boolean supportsNamedGroupSyntax(@Nullable final RegExpGroup group) {
public boolean supportsNamedGroupSyntax(final @Nullable RegExpGroup group) {
final RegExpLanguageHost host = findRegExpHost(group);
return host == null || host.supportsNamedGroupSyntax(group);
}
public boolean supportsNamedGroupRefSyntax(@Nullable final RegExpNamedGroupRef ref) {
public boolean supportsNamedGroupRefSyntax(final @Nullable RegExpNamedGroupRef ref) {
final RegExpLanguageHost host = findRegExpHost(ref);
try {
return host == null || host.supportsNamedGroupRefSyntax(ref);
@@ -106,22 +104,22 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
return host.getSupportedNamedGroupTypes(context);
}
public boolean isValidGroupName(String name, @Nullable final RegExpGroup group) {
public boolean isValidGroupName(String name, final @Nullable RegExpGroup group) {
final RegExpLanguageHost host = findRegExpHost(group);
return host == null || host.isValidGroupName(name, group);
}
public boolean isDuplicateGroupNamesAllowed(@NotNull final RegExpGroup group) {
public boolean isDuplicateGroupNamesAllowed(final @NotNull RegExpGroup group) {
final RegExpLanguageHost host = findRegExpHost(group);
return host == null || host.isDuplicateGroupNamesAllowed(group);
}
public boolean supportsPerl5EmbeddedComments(@Nullable final PsiComment comment) {
public boolean supportsPerl5EmbeddedComments(final @Nullable PsiComment comment) {
final RegExpLanguageHost host = findRegExpHost(comment);
return host == null || host.supportsPerl5EmbeddedComments();
}
public boolean supportsConditionals(@Nullable final RegExpConditional conditional) {
public boolean supportsConditionals(final @Nullable RegExpConditional conditional) {
final RegExpLanguageHost host = findRegExpHost(conditional);
return host == null || host.supportsPythonConditionalRefs();
}
@@ -131,22 +129,22 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
return host == null || host.supportConditionalCondition(condition);
}
public boolean supportsPossessiveQuantifiers(@Nullable final RegExpElement context) {
public boolean supportsPossessiveQuantifiers(final @Nullable RegExpElement context) {
final RegExpLanguageHost host = findRegExpHost(context);
return host == null || host.supportsPossessiveQuantifiers();
}
public boolean supportsBoundary(@Nullable final RegExpBoundary boundary) {
public boolean supportsBoundary(final @Nullable RegExpBoundary boundary) {
final RegExpLanguageHost host = findRegExpHost(boundary);
return host == null || host.supportsBoundary(boundary);
}
public boolean supportsSimpleClass(@Nullable final RegExpSimpleClass simpleClass) {
public boolean supportsSimpleClass(final @Nullable RegExpSimpleClass simpleClass) {
final RegExpLanguageHost host = findRegExpHost(simpleClass);
return host == null || host.supportsSimpleClass(simpleClass);
}
public boolean isValidCategory(@NotNull final PsiElement element, @NotNull String category) {
public boolean isValidCategory(final @NotNull PsiElement element, @NotNull String category) {
final RegExpLanguageHost host = findRegExpHost(element);
return host != null ? host.isValidCategory(category) : myDefaultProvider.isValidCategory(category);
}
@@ -161,12 +159,12 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
return host == null || host.isValidPropertyValue(propertyName, propertyValue);
}
public boolean supportsNamedCharacters(@NotNull final RegExpNamedCharacter namedCharacter) {
public boolean supportsNamedCharacters(final @NotNull RegExpNamedCharacter namedCharacter) {
final RegExpLanguageHost host = findRegExpHost(namedCharacter);
return host == null || host.supportsNamedCharacters(namedCharacter);
}
public boolean isValidNamedCharacter(@NotNull final RegExpNamedCharacter namedCharacter) {
public boolean isValidNamedCharacter(final @NotNull RegExpNamedCharacter namedCharacter) {
final RegExpLanguageHost host = findRegExpHost(namedCharacter);
return host == null || host.isValidNamedCharacter(namedCharacter);
}
@@ -179,8 +177,7 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
return host.supportsLookbehind(group);
}
@Nullable
public Number getQuantifierValue(@NotNull RegExpNumber valueElement) {
public @Nullable Number getQuantifierValue(@NotNull RegExpNumber valueElement) {
final RegExpLanguageHost host = findRegExpHost(valueElement);
if (host == null) {
return Double.valueOf(valueElement.getText());
@@ -188,7 +185,7 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
return host.getQuantifierValue(valueElement);
}
public String[] @NotNull [] getAllKnownProperties(@NotNull final PsiElement element) {
public String[] @NotNull [] getAllKnownProperties(final @NotNull PsiElement element) {
final RegExpLanguageHost host = findRegExpHost(element);
return host != null ? host.getAllKnownProperties() : myDefaultProvider.getAllKnownProperties();
}
@@ -199,17 +196,17 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
}
@Nullable
String getPropertyDescription(@NotNull final PsiElement element, @Nullable final String name) {
String getPropertyDescription(final @NotNull PsiElement element, final @Nullable String name) {
final RegExpLanguageHost host = findRegExpHost(element);
return host != null ? host.getPropertyDescription(name) : myDefaultProvider.getPropertyDescription(name);
}
String[] @NotNull [] getKnownCharacterClasses(@NotNull final PsiElement element) {
String[] @NotNull [] getKnownCharacterClasses(final @NotNull PsiElement element) {
final RegExpLanguageHost host = findRegExpHost(element);
return host != null ? host.getKnownCharacterClasses() : myDefaultProvider.getKnownCharacterClasses();
}
String[][] getPosixCharacterClasses(@NotNull final PsiElement element) {
String[][] getPosixCharacterClasses(final @NotNull PsiElement element) {
return myDefaultProvider.getPosixCharacterClasses();
}

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class ImagesBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.ImagesBundle";
private static final ImagesBundle INSTANCE = new ImagesBundle();
public final class ImagesBundle {
private static final @NonNls String BUNDLE = "messages.ImagesBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ImagesBundle.class, BUNDLE);
private ImagesBundle() { super(BUNDLE); }
private ImagesBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JavaCompilerBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.JavaCompilerBundle";
private static final JavaCompilerBundle INSTANCE = new JavaCompilerBundle();
public final class JavaCompilerBundle {
public static final @NonNls String BUNDLE = "messages.JavaCompilerBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaCompilerBundle.class, BUNDLE);
private JavaCompilerBundle() { super(BUNDLE); }
private JavaCompilerBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -11,20 +11,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JavaDebuggerBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.JavaDebuggerBundle";
private static final JavaDebuggerBundle INSTANCE = new JavaDebuggerBundle();
public final class JavaDebuggerBundle {
private static final @NonNls String BUNDLE = "messages.JavaDebuggerBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaDebuggerBundle.class, BUNDLE);
private JavaDebuggerBundle() { super(BUNDLE); }
private JavaDebuggerBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}

View File

@@ -9,11 +9,12 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JavaUiBundle extends DynamicBundle {
public final class JavaUiBundle {
@NonNls private static final String BUNDLE = "messages.JavaUiBundle";
private static final JavaUiBundle INSTANCE = new JavaUiBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaUiBundle.class, BUNDLE);
private JavaUiBundle() { super(BUNDLE); }
private JavaUiBundle() {
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {

View File

@@ -7,16 +7,14 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.PropertyKey;
public final class JavaStartersBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.JavaStartersBundle";
private static final JavaStartersBundle INSTANCE = new JavaStartersBundle();
public final class JavaStartersBundle {
private static final @NonNls String BUNDLE = "messages.JavaStartersBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaStartersBundle.class, BUNDLE);
private JavaStartersBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JavaAnalysisBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.JavaAnalysisBundle";
private static final JavaAnalysisBundle INSTANCE = new JavaAnalysisBundle();
public final class JavaAnalysisBundle {
public static final @NonNls String BUNDLE = "messages.JavaAnalysisBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaAnalysisBundle.class, BUNDLE);
private JavaAnalysisBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class QuickFixBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.QuickFixBundle";
private static final QuickFixBundle INSTANCE = new QuickFixBundle();
public final class QuickFixBundle {
public static final @NonNls String BUNDLE = "messages.QuickFixBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(QuickFixBundle.class, BUNDLE);
private QuickFixBundle() { super(BUNDLE); }
private QuickFixBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -17,7 +17,7 @@ package com.intellij.psi.util;
import com.intellij.psi.PsiElement;
public class PsiMatcherImpl implements PsiMatcher {
public final class PsiMatcherImpl implements PsiMatcher {
private PsiElement myElement;
public PsiMatcherImpl(PsiElement element) {

View File

@@ -24,7 +24,6 @@ import org.jetbrains.annotations.NotNull;
* This policy is to cancel.
*/
public final class CancelPolicy implements ConflictResolutionPolicy {
private static final CancelPolicy instance = new CancelPolicy();
private CancelPolicy() {}

View File

@@ -44,16 +44,14 @@ import java.util.List;
/**
* This class is not singleton but provides {@link #getInstance() single-point-of-usage field}.
*/
public class JavadocHelper {
public final class JavadocHelper {
private static final String PARAM_TEXT = "param";
private static final Pair<JavadocParameterInfo, List<JavadocParameterInfo>> EMPTY
= new Pair<>(null, Collections.emptyList());
private static final JavadocHelper INSTANCE = new JavadocHelper();
@NotNull
public static JavadocHelper getInstance() {
public static @NotNull JavadocHelper getInstance() {
return INSTANCE;
}
@@ -64,7 +62,7 @@ public class JavadocHelper {
* @param editor target editor
* @param project target project
*/
public void navigate(@NotNull LogicalPosition position, @NotNull Editor editor, @NotNull final Project project) {
public void navigate(@NotNull LogicalPosition position, @NotNull Editor editor, final @NotNull Project project) {
final Document document = editor.getDocument();
final CaretModel caretModel = editor.getCaretModel();
final int endLineOffset = document.getLineEndOffset(position.line);
@@ -88,8 +86,7 @@ public class JavadocHelper {
* @param anchor descriptor for the target parameter
* @return logical position that points to the desired parameter description start location
*/
@NotNull
public LogicalPosition calculateDescriptionStartPosition(@NotNull PsiFile psiFile,
public @NotNull LogicalPosition calculateDescriptionStartPosition(@NotNull PsiFile psiFile,
@NotNull Collection<? extends JavadocParameterInfo> data,
@NotNull JavadocHelper.JavadocParameterInfo anchor)
{
@@ -125,8 +122,7 @@ public class JavadocHelper {
* @return pair like (javadoc info for the line identified by the given offset; list of javadoc parameter infos for
* adjacent lines if any
*/
@NotNull
public Pair<JavadocParameterInfo, List<JavadocParameterInfo>> parse(@NotNull PsiFile psiFile, @NotNull Editor editor, int offset) {
public @NotNull Pair<JavadocParameterInfo, List<JavadocParameterInfo>> parse(@NotNull PsiFile psiFile, @NotNull Editor editor, int offset) {
List<JavadocParameterInfo> result = new ArrayList<>();
PsiDocumentManager.getInstance(psiFile.getProject()).commitDocument(editor.getDocument());
final PsiElement elementAtCaret = psiFile.findElementAt(offset);
@@ -181,8 +177,7 @@ public class JavadocHelper {
return Pair.create(anchorInfo, result);
}
@Nullable
private static JavadocParameterInfo parse(@NotNull PsiElement element, @NotNull Editor editor) {
private static @Nullable JavadocParameterInfo parse(@NotNull PsiElement element, @NotNull Editor editor) {
final PsiDocTag tag = PsiTreeUtil.getParentOfType(element, PsiDocTag.class, false);
if (tag == null || !PARAM_TEXT.equals(tag.getName())) {
return null;
@@ -232,8 +227,8 @@ public class JavadocHelper {
* *&#47;
* </pre>
*/
@NotNull public final LogicalPosition parameterNameEndPosition;
@Nullable public final LogicalPosition parameterDescriptionStartPosition;
public final @NotNull LogicalPosition parameterNameEndPosition;
public final @Nullable LogicalPosition parameterDescriptionStartPosition;
/** Last logical line occupied by the current javadoc parameter. */
public final int lastLine;

View File

@@ -51,8 +51,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
private static final Logger LOG = Logger.getInstance(JavaClassReference.class);
protected final int myIndex;
private TextRange myRange;
@NotNull
private final String myText;
private final @NotNull String myText;
private final boolean myInStaticImport;
private final JavaClassReferenceSet myJavaClassReferenceSet;
@@ -67,8 +66,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
}
@Override
@Nullable
public PsiElement getContext() {
public @Nullable PsiElement getContext() {
PsiReference contextRef = getContextReference();
assert contextRef != this : getCanonicalText();
return contextRef != null ? contextRef.resolve() : null;
@@ -131,8 +129,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
}
@Override
@Nullable
public PsiReference getContextReference() {
public @Nullable PsiReference getContextReference() {
return myIndex > 0 ? myJavaClassReferenceSet.getReference(myIndex - 1) : null;
}
@@ -140,9 +137,8 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return myJavaClassReferenceSet.canReferencePackage(myIndex);
}
@NotNull
@Override
public PsiElement getElement() {
public @NotNull PsiElement getElement() {
return myJavaClassReferenceSet.getElement();
}
@@ -151,15 +147,13 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return (element instanceof PsiMember || element instanceof PsiPackage) && super.isReferenceTo(element);
}
@NotNull
@Override
public TextRange getRangeInElement() {
public @NotNull TextRange getRangeInElement() {
return myRange;
}
@Override
@NotNull
public String getCanonicalText() {
public @NotNull String getCanonicalText() {
return myText;
}
@@ -249,8 +243,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return result;
}
@Nullable
public PsiElement getCompletionContext() {
public @Nullable PsiElement getCompletionContext() {
PsiReference contextRef = getContextReference();
if (contextRef == null) {
return JavaPsiFacade.getInstance(getElement().getProject()).findPackage("");
@@ -258,14 +251,12 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return contextRef.resolve();
}
@NotNull
public List<String> getSuperClasses() {
public @NotNull List<String> getSuperClasses() {
List<String> values = JavaClassReferenceProvider.SUPER_CLASSES.getValue(getOptions());
return values == null ? Collections.emptyList() : values;
}
@NotNull
private List<LookupElement> processPackage(@NotNull PsiPackage aPackage) {
private @NotNull List<LookupElement> processPackage(@NotNull PsiPackage aPackage) {
ArrayList<LookupElement> list = new ArrayList<>();
int startOffset = StringUtil.isEmpty(aPackage.getName()) ? 0 : aPackage.getQualifiedName().length() + 1;
GlobalSearchScope scope = getScope(getJavaContextFile());
@@ -299,8 +290,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return list;
}
@Nullable
public ClassKind getClassKind() {
public @Nullable ClassKind getClassKind() {
return JavaClassReferenceProvider.CLASS_KIND.getValue(getOptions());
}
@@ -340,8 +330,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
}
@Override
@NotNull
public JavaResolveResult advancedResolve(boolean incompleteCode) {
public @NotNull JavaResolveResult advancedResolve(boolean incompleteCode) {
PsiFile file = getJavaContextFile();
ResolveCache resolveCache = ResolveCache.getInstance(file.getProject());
return (JavaResolveResult) resolveCache.resolveWithCaching(this, MyResolver.INSTANCE, false, false,file)[0];
@@ -351,8 +340,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return myJavaClassReferenceSet.getProvider().getContextFile(getElement());
}
@NotNull
private JavaResolveResult doAdvancedResolve(@NotNull PsiFile containingFile) {
private @NotNull JavaResolveResult doAdvancedResolve(@NotNull PsiFile containingFile) {
PsiElement psiElement = getElement();
if (!psiElement.isValid()) return JavaResolveResult.EMPTY;
@@ -456,8 +444,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
: JavaResolveResult.EMPTY;
}
@NotNull
private GlobalSearchScope getScope(@NotNull PsiFile containingFile) {
private @NotNull GlobalSearchScope getScope(@NotNull PsiFile containingFile) {
Project project = containingFile.getProject();
GlobalSearchScope scope = myJavaClassReferenceSet.getProvider().getScope(project);
if (scope == null) {
@@ -467,8 +454,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return scope;
}
@Nullable
private Map<CustomizableReferenceProvider.CustomizationKey, Object> getOptions() {
private @Nullable Map<CustomizableReferenceProvider.CustomizationKey, Object> getOptions() {
return myJavaClassReferenceSet.getOptions();
}
@@ -479,8 +465,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return new JavaResolveResult[]{javaResolveResult};
}
@NotNull
private List<? extends @NotNull LocalQuickFix> registerFixes() {
private @NotNull List<? extends @NotNull LocalQuickFix> registerFixes() {
List<LocalQuickFix> list = QuickFixFactory.getInstance().registerOrderEntryFixes(this, new ArrayList<>());
String extendClass = ContainerUtil.getFirstItem(getSuperClasses());
@@ -545,8 +530,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
}
}
@NotNull
private LookupElementBuilder createSubclassLookupValue(@NotNull PsiClass clazz) {
private @NotNull LookupElementBuilder createSubclassLookupValue(@NotNull PsiClass clazz) {
return JavaLookupElementBuilder.forClass(clazz, getQualifiedClassNameToInsert(clazz), true)
.withPresentableText(Objects.requireNonNull(clazz.getName()));
}
@@ -557,8 +541,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return list.toArray(LocalQuickFix.EMPTY_ARRAY);
}
@Nullable
public static PsiElement resolveMember(@NotNull String fqn, @NotNull PsiManager manager, GlobalSearchScope resolveScope) {
public static @Nullable PsiElement resolveMember(@NotNull String fqn, @NotNull PsiManager manager, GlobalSearchScope resolveScope) {
PsiClass aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(fqn, resolveScope);
if (aClass != null) return aClass;
int i = fqn.lastIndexOf('.');
@@ -570,8 +553,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return doResolveMember(aClass, memberName);
}
@Nullable
private static PsiElement doResolveMember(@NotNull PsiClass aClass, @NotNull String memberName) {
private static @Nullable PsiElement doResolveMember(@NotNull PsiClass aClass, @NotNull String memberName) {
PsiMember member = aClass.findFieldByName(memberName, true);
if (member != null) return member;
@@ -579,18 +561,16 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return methods.length == 0 ? null : methods[0];
}
@NotNull
public JavaClassReferenceSet getJavaClassReferenceSet() {
public @NotNull JavaClassReferenceSet getJavaClassReferenceSet() {
return myJavaClassReferenceSet;
}
@NotNull
@Override
public String getUnresolvedMessagePattern() {
public @NotNull String getUnresolvedMessagePattern() {
return myJavaClassReferenceSet.getUnresolvedMessagePattern(myIndex);
}
private static class MyResolver implements ResolveCache.PolyVariantContextResolver<JavaClassReference> {
private static final class MyResolver implements ResolveCache.PolyVariantContextResolver<JavaClassReference> {
private static final MyResolver INSTANCE = new MyResolver();
@Override

View File

@@ -9,11 +9,12 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class RefactorJBundle extends DynamicBundle {
public final class RefactorJBundle {
@NonNls private static final String BUNDLE = "messages.RefactorJBundle";
private static final RefactorJBundle INSTANCE = new RefactorJBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(RefactorJBundle.class, BUNDLE);
private RefactorJBundle() { super(BUNDLE); }
private RefactorJBundle() {
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {

View File

@@ -9,12 +9,11 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JavaIndexingBundle extends DynamicBundle {
public final class JavaIndexingBundle {
@NonNls private static final String BUNDLE = "messages.JavaIndexingBundle";
private static final JavaIndexingBundle INSTANCE = new JavaIndexingBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaIndexingBundle.class, BUNDLE);
private JavaIndexingBundle() {
super(BUNDLE);
}
@NotNull

View File

@@ -11,19 +11,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JavaPsiBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.JavaPsiBundle";
public static final JavaPsiBundle INSTANCE = new JavaPsiBundle();
public final class JavaPsiBundle {
public static final @NonNls String BUNDLE = "messages.JavaPsiBundle";
public static final DynamicBundle INSTANCE = new DynamicBundle(JavaPsiBundle.class, BUNDLE);
private JavaPsiBundle() { super(BUNDLE); }
private JavaPsiBundle() { }
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
@@ -35,10 +33,10 @@ public final class JavaPsiBundle extends DynamicBundle {
* @param modifier modifier string constant
* @return modifier to display to the user.
* Note that it's not localized in the usual sense: modifiers returned from this method are kept in English,
* regardless of the active language pack. It's believed that this way it's more clear.
* regardless of the active language pack.
* It's believed that this way it's clearer.
*/
@NotNull
public static @NlsSafe String visibilityPresentation(@NotNull @PsiModifier.ModifierConstant String modifier) {
public static @NotNull @NlsSafe String visibilityPresentation(@NotNull @PsiModifier.ModifierConstant String modifier) {
return modifier.equals(PsiModifier.PACKAGE_LOCAL) ? "package-private" : modifier;
}
}

View File

@@ -46,37 +46,32 @@ public final class EmptySubstitutor implements PsiSubstitutor {
return JavaPsiFacade.getElementFactory(typeParameter.getProject()).createType(typeParameter);
}
@NotNull
@Override
public PsiSubstitutor put(@NotNull PsiTypeParameter classParameter, PsiType mapping){
public @NotNull PsiSubstitutor put(@NotNull PsiTypeParameter classParameter, PsiType mapping){
if (mapping != null) {
PsiUtil.ensureValidType(mapping);
}
return PsiSubstitutorFactory.getInstance().createSubstitutor(classParameter, mapping);
}
@NotNull
@Override
public PsiSubstitutor putAll(@NotNull PsiClass parentClass, PsiType[] mappings){
public @NotNull PsiSubstitutor putAll(@NotNull PsiClass parentClass, PsiType[] mappings){
if(!parentClass.hasTypeParameters()) return this;
return PsiSubstitutorFactory.getInstance().createSubstitutor(parentClass, mappings);
}
@NotNull
@Override
public PsiSubstitutor putAll(@NotNull PsiSubstitutor another) {
public @NotNull PsiSubstitutor putAll(@NotNull PsiSubstitutor another) {
return another;
}
@NotNull
@Override
public PsiSubstitutor putAll(@NotNull Map<? extends PsiTypeParameter, ? extends PsiType> map) {
public @NotNull PsiSubstitutor putAll(@NotNull Map<? extends PsiTypeParameter, ? extends PsiType> map) {
return map.isEmpty() ? EMPTY : PsiSubstitutorFactory.getInstance().createSubstitutor(map);
}
@Override
@NotNull
public Map<PsiTypeParameter, PsiType> getSubstitutionMap() {
public @NotNull Map<PsiTypeParameter, PsiType> getSubstitutionMap() {
return Collections.emptyMap();
}
@@ -93,7 +88,7 @@ public final class EmptySubstitutor implements PsiSubstitutor {
return "EmptySubstitutor";
}
private static class Holder {
private static final class Holder {
private static final EmptySubstitutor INSTANCE = new EmptySubstitutor();
}
}

View File

@@ -17,14 +17,12 @@ public final class JVMElementFactories extends LanguageExtension<JVMElementFacto
super("com.intellij.generation.topLevelFactory");
}
@Nullable
public static JVMElementFactory getFactory(@NotNull Language language, @NotNull Project project) {
public static @Nullable JVMElementFactory getFactory(@NotNull Language language, @NotNull Project project) {
final JVMElementFactoryProvider provider = INSTANCE.forLanguage(language);
return provider != null? provider.getFactory(project) : null;
}
@NotNull
public static JVMElementFactory requireFactory(@NotNull Language language, @NotNull Project project) {
public static @NotNull JVMElementFactory requireFactory(@NotNull Language language, @NotNull Project project) {
final JVMElementFactory factory = getFactory(language, project);
assert factory != null : language;
return factory;

View File

@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi.controlFlow;
import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;
public class AllVariablesControlFlowPolicy implements ControlFlowPolicy {
public final class AllVariablesControlFlowPolicy implements ControlFlowPolicy {
private static final AllVariablesControlFlowPolicy INSTANCE = new AllVariablesControlFlowPolicy();
@Override
@@ -41,5 +40,4 @@ public class AllVariablesControlFlowPolicy implements ControlFlowPolicy {
public static AllVariablesControlFlowPolicy getInstance() {
return INSTANCE;
}
}

View File

@@ -267,7 +267,7 @@ public class PsiFieldImpl extends JavaStubPsiElement<PsiFieldStub> implements Ps
return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
}
private static class OurConstValueComputer implements JavaResolveCache.ConstValueComputer {
private static final class OurConstValueComputer implements JavaResolveCache.ConstValueComputer {
private static final OurConstValueComputer INSTANCE = new OurConstValueComputer();
@Override

View File

@@ -33,7 +33,7 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
public class PsiImportStaticReferenceElementImpl extends CompositePsiElement implements PsiImportStaticReferenceElement {
public final class PsiImportStaticReferenceElementImpl extends CompositePsiElement implements PsiImportStaticReferenceElement {
private static final Logger LOG = Logger.getInstance(PsiImportStaticReferenceElementImpl.class);
private volatile String myCanonicalText;
@@ -166,15 +166,13 @@ public class PsiImportStaticReferenceElementImpl extends CompositePsiElement imp
return childByRole.getText();
}
@NotNull
@Override
public PsiElement getElement() {
public @NotNull PsiElement getElement() {
return this;
}
@NotNull
@Override
public TextRange getRangeInElement() {
public @NotNull TextRange getRangeInElement() {
TreeElement nameChild = (TreeElement)findChildByRole(ChildRole.REFERENCE_NAME);
if (nameChild == null) return new TextRange(0, getTextLength());
int startOffset = nameChild.getStartOffsetInParent();
@@ -182,8 +180,7 @@ public class PsiImportStaticReferenceElementImpl extends CompositePsiElement imp
}
@Override
@NotNull
public String getCanonicalText() {
public @NotNull String getCanonicalText() {
String canonicalText = myCanonicalText;
if (canonicalText == null) {
myCanonicalText = canonicalText = calcCanonicalText();
@@ -207,8 +204,7 @@ public class PsiImportStaticReferenceElementImpl extends CompositePsiElement imp
}
@Override
@NotNull
public JavaResolveResult advancedResolve(boolean incompleteCode) {
public @NotNull JavaResolveResult advancedResolve(boolean incompleteCode) {
JavaResolveResult[] results = multiResolve(incompleteCode);
if (results.length == 1) return results[0];
return JavaResolveResult.EMPTY;

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JavaStructureViewBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.JavaStructureViewBundle";
private static final JavaStructureViewBundle INSTANCE = new JavaStructureViewBundle();
public final class JavaStructureViewBundle {
private static final @NonNls String BUNDLE = "messages.JavaStructureViewBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaStructureViewBundle.class, BUNDLE);
private JavaStructureViewBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -6,16 +6,14 @@ import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.PropertyKey;
public final class ManifestBundle extends DynamicBundle {
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = PATH_TO_BUNDLE) String key, Object @NotNull ... params) {
return BUNDLE.getMessage(key, params);
}
public static final String PATH_TO_BUNDLE = "messages.ManifestBundle";
private static final ManifestBundle BUNDLE = new ManifestBundle();
public final class ManifestBundle {
private static final String BUNDLE = "messages.ManifestBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ManifestBundle.class, BUNDLE);
private ManifestBundle() {
super(PATH_TO_BUNDLE);
}
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
}

View File

@@ -9,16 +9,14 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JavaBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.JavaBundle";
private static final JavaBundle INSTANCE = new JavaBundle();
public final class JavaBundle {
public static final @NonNls String BUNDLE = "messages.JavaBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaBundle.class, BUNDLE);
private JavaBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@@ -28,8 +26,7 @@ public final class JavaBundle extends DynamicBundle {
return INSTANCE.getPartialMessage(key, unassignedParams, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JavaRefactoringBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.JavaRefactoringBundle";
private static final JavaRefactoringBundle INSTANCE = new JavaRefactoringBundle();
public final class JavaRefactoringBundle {
private static final @NonNls String BUNDLE = "messages.JavaRefactoringBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaRefactoringBundle.class, BUNDLE);
private JavaRefactoringBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class TypeMigrationBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.TypeMigrationBundle";
private static final TypeMigrationBundle INSTANCE = new TypeMigrationBundle();
public final class TypeMigrationBundle {
private static final @NonNls String BUNDLE = "messages.TypeMigrationBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(TypeMigrationBundle.class, BUNDLE);
private TypeMigrationBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,21 +9,19 @@ import org.jetbrains.jps.api.JpsDynamicBundle;
import java.util.function.Supplier;
public class JpsBuildBundle extends JpsDynamicBundle {
@NonNls private static final String BUNDLE = "messages.JpsBuildBundle";
private static final JpsBuildBundle INSTANCE = new JpsBuildBundle();
public final class JpsBuildBundle extends JpsDynamicBundle {
private static final @NonNls String BUNDLE = "messages.JpsBuildBundle";
private static final JpsDynamicBundle INSTANCE = new JpsDynamicBundle(JpsBuildBundle.class, BUNDLE);
private JpsBuildBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class JsonBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.JsonBundle";
private static final JsonBundle INSTANCE = new JsonBundle();
public final class JsonBundle {
public static final @NonNls String BUNDLE = "messages.JsonBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(JsonBundle.class, BUNDLE);
private JsonBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -31,7 +31,6 @@ import static com.intellij.patterns.PlatformPatterns.psiElement;
* @author Mikhail Golubev
*/
public class JsonCompletionContributor extends CompletionContributor {
private static final PsiElementPattern.Capture<PsiElement> AFTER_COLON_IN_PROPERTY = psiElement()
.afterLeaf(":").withSuperParent(2, JsonProperty.class)
.andNot(psiElement().withParent(JsonStringLiteral.class));
@@ -45,7 +44,7 @@ public class JsonCompletionContributor extends CompletionContributor {
extend(CompletionType.BASIC, AFTER_COMMA_OR_BRACKET_IN_ARRAY, MyKeywordsCompletionProvider.INSTANCE);
}
private static class MyKeywordsCompletionProvider extends CompletionProvider<CompletionParameters> {
private static final class MyKeywordsCompletionProvider extends CompletionProvider<CompletionParameters> {
private static final MyKeywordsCompletionProvider INSTANCE = new MyKeywordsCompletionProvider();
private static final String[] KEYWORDS = new String[]{"null", "true", "false"};

View File

@@ -14,14 +14,12 @@ public abstract class JsonSchemaBaseReference<T extends PsiElement> extends PsiR
super(element, textRange, true);
}
@Nullable
@Override
public PsiElement resolve() {
public @Nullable PsiElement resolve() {
return ResolveCache.getInstance(getElement().getProject()).resolveWithCaching(this, MyResolver.INSTANCE, false, false);
}
@Nullable
public abstract PsiElement resolveInner();
public abstract @Nullable PsiElement resolveInner();
@Override
@@ -43,12 +41,11 @@ public abstract class JsonSchemaBaseReference<T extends PsiElement> extends PsiR
return myElement.hashCode();
}
private static class MyResolver implements ResolveCache.Resolver {
private static final class MyResolver implements ResolveCache.Resolver {
private static final MyResolver INSTANCE = new MyResolver();
@Override
@Nullable
public PsiElement resolve(@NotNull PsiReference ref, boolean incompleteCode) {
public @Nullable PsiElement resolve(@NotNull PsiReference ref, boolean incompleteCode) {
return ((JsonSchemaBaseReference<?>)ref).resolveInner();
}
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class AnalysisBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.AnalysisBundle";
private static final AnalysisBundle INSTANCE = new AnalysisBundle();
public final class AnalysisBundle {
public static final @NonNls String BUNDLE = "messages.AnalysisBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(AnalysisBundle.class, BUNDLE);
private AnalysisBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -10,19 +10,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class CommonQuickFixBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.CommonQuickFixBundle";
private static final CommonQuickFixBundle INSTANCE = new CommonQuickFixBundle();
public final class CommonQuickFixBundle {
public static final @NonNls String BUNDLE = "messages.CommonQuickFixBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(CommonQuickFixBundle.class, BUNDLE);
private CommonQuickFixBundle() { super(BUNDLE); }
private CommonQuickFixBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NlsSafe Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NlsSafe Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class InspectionsBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.InspectionsBundle";
private static final InspectionsBundle INSTANCE = new InspectionsBundle();
public final class InspectionsBundle {
public static final @NonNls String BUNDLE = "messages.InspectionsBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(InspectionsBundle.class, BUNDLE);
private InspectionsBundle() { super(BUNDLE); }
private InspectionsBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.containsKey(key) ? INSTANCE.getMessage(key, params) : InspectionsDeprecatedMessagesBundle.message(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.containsKey(key) ? INSTANCE.getLazyMessage(key, params) : InspectionsDeprecatedMessagesBundle.messagePointer(key, params);
}
}

View File

@@ -9,22 +9,20 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public class InspectionsDeprecatedMessagesBundle extends AbstractBundle {
@NonNls private static final String BUNDLE = "messages.InspectionsDeprecatedMessagesBundle";
public final class InspectionsDeprecatedMessagesBundle extends AbstractBundle {
private static final @NonNls String BUNDLE = "messages.InspectionsDeprecatedMessagesBundle";
private static final InspectionsDeprecatedMessagesBundle INSTANCE = new InspectionsDeprecatedMessagesBundle();
private InspectionsDeprecatedMessagesBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,13 +9,12 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class FindBundle extends DynamicBundle {
public final class FindBundle {
public static final String BUNDLE = "messages.FindBundle";
private static final FindBundle INSTANCE = new FindBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(FindBundle.class, BUNDLE);
private FindBundle() {
super(BUNDLE);
}
public static @Nls @NotNull String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class BuiltInServerBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.BuiltInServerBundle";
private static final BuiltInServerBundle INSTANCE = new BuiltInServerBundle();
public final class BuiltInServerBundle {
private static final @NonNls String BUNDLE = "messages.BuiltInServerBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(BuiltInServerBundle.class, BUNDLE);
private BuiltInServerBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -8,21 +8,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public class CodeStyleBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.CodeStyleBundle";
private static final CodeStyleBundle INSTANCE = new CodeStyleBundle();
public final class CodeStyleBundle {
public static final @NonNls String BUNDLE = "messages.CodeStyleBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(CodeStyleBundle.class, BUNDLE);
private CodeStyleBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,22 +9,19 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public class CollaborationToolsBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.CollaborationToolsBundle";
private static final CollaborationToolsBundle INSTANCE = new CollaborationToolsBundle();
public final class CollaborationToolsBundle {
private static final @NonNls String BUNDLE = "messages.CollaborationToolsBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(CollaborationToolsBundle.class, BUNDLE);
private CollaborationToolsBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class ConfigurationStoreBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.ConfigurationStoreBundle";
private static final ConfigurationStoreBundle INSTANCE = new ConfigurationStoreBundle();
public final class ConfigurationStoreBundle {
private static final @NonNls String BUNDLE = "messages.ConfigurationStoreBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ConfigurationStoreBundle.class, BUNDLE);
private ConfigurationStoreBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -30,8 +30,7 @@ public abstract class CachingReference implements PsiReference {
return ResolveCache.getInstance(getElement().getProject()).resolveWithCaching(this, MyResolver.INSTANCE, false, false);
}
@Nullable
public abstract PsiElement resolveInner();
public abstract @Nullable PsiElement resolveInner();
@Override
public boolean isReferenceTo(@NotNull PsiElement element) {
@@ -43,8 +42,7 @@ public abstract class CachingReference implements PsiReference {
return false;
}
@NotNull
public static <T extends PsiElement> ElementManipulator<T> getManipulator(T currentElement){
public static @NotNull <T extends PsiElement> ElementManipulator<T> getManipulator(T currentElement){
ElementManipulator<T> manipulator = ElementManipulators.getManipulator(currentElement);
if (manipulator == null) {
throw new IncorrectOperationException("Manipulator for this element is not defined: " + currentElement + "; " + currentElement.getClass());
@@ -52,11 +50,10 @@ public abstract class CachingReference implements PsiReference {
return manipulator;
}
private static class MyResolver implements ResolveCache.Resolver {
private static final class MyResolver implements ResolveCache.Resolver {
private static final MyResolver INSTANCE = new MyResolver();
@Override
@Nullable
public PsiElement resolve(@NotNull PsiReference ref, boolean incompleteCode) {
public @Nullable PsiElement resolve(@NotNull PsiReference ref, boolean incompleteCode) {
return ((CachingReference)ref).resolveInner();
}
}

View File

@@ -34,7 +34,7 @@ public abstract class PsiPolyVariantCachingReference implements PsiPolyVariantRe
return false;
}
private static class MyResolver implements ResolveCache.PolyVariantContextResolver<PsiPolyVariantReference> {
private static final class MyResolver implements ResolveCache.PolyVariantContextResolver<PsiPolyVariantReference> {
private static final MyResolver INSTANCE = new MyResolver();
@Override

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi.impl.source.tree;
import com.intellij.lang.ASTNode;

View File

@@ -9,20 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class DiffBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.DiffBundle";
public final class DiffBundle {
public static final @NonNls String BUNDLE = "messages.DiffBundle";
private static final DiffBundle INSTANCE = new DiffBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(DiffBundle.class, BUNDLE);
private DiffBundle() { super(BUNDLE); }
private DiffBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -81,39 +81,39 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
private boolean myDisposed;
@Nullable private final Project myProject;
@NotNull private final DiffContext myContext;
private final @Nullable Project myProject;
private final @NotNull DiffContext myContext;
@NotNull private final DiffSettings mySettings;
@NotNull private final List<DiffTool> myAvailableTools = new ArrayList<>();
@NotNull private final List<DiffTool> myToolOrder = new ArrayList<>();
@Nullable private final DiffTool myForcedDiffTool;
private final @NotNull DiffSettings mySettings;
private final @NotNull List<DiffTool> myAvailableTools = new ArrayList<>();
private final @NotNull List<DiffTool> myToolOrder = new ArrayList<>();
private final @Nullable DiffTool myForcedDiffTool;
@NotNull private final DefaultActionGroup myToolbarGroup;
@NotNull private final DefaultActionGroup myRightToolbarGroup;
@NotNull private final DefaultActionGroup myPopupActionGroup;
@NotNull private final DefaultActionGroup myTouchbarActionGroup;
private final @NotNull DefaultActionGroup myToolbarGroup;
private final @NotNull DefaultActionGroup myRightToolbarGroup;
private final @NotNull DefaultActionGroup myPopupActionGroup;
private final @NotNull DefaultActionGroup myTouchbarActionGroup;
@NotNull private final JPanel myPanel;
@NotNull private final MyPanel myMainPanel;
@NotNull private final Wrapper myContentPanel;
@NotNull private final JPanel myTopPanel;
@NotNull private final ActionToolbar myToolbar;
@NotNull private final ActionToolbar myRightToolbar;
@NotNull protected final Wrapper myToolbarWrapper;
@NotNull protected final Wrapper myDiffInfoWrapper;
@NotNull protected final Wrapper myRightToolbarWrapper;
@NotNull private final Wrapper myToolbarStatusPanel;
@NotNull private final MyProgressBar myProgressBar;
private final @NotNull JPanel myPanel;
private final @NotNull MyPanel myMainPanel;
private final @NotNull Wrapper myContentPanel;
private final @NotNull JPanel myTopPanel;
private final @NotNull ActionToolbar myToolbar;
private final @NotNull ActionToolbar myRightToolbar;
protected final @NotNull Wrapper myToolbarWrapper;
protected final @NotNull Wrapper myDiffInfoWrapper;
protected final @NotNull Wrapper myRightToolbarWrapper;
private final @NotNull Wrapper myToolbarStatusPanel;
private final @NotNull MyProgressBar myProgressBar;
@NotNull private final EventDispatcher<DiffRequestProcessorListener> myEventDispatcher =
private final @NotNull EventDispatcher<DiffRequestProcessorListener> myEventDispatcher =
EventDispatcher.create(DiffRequestProcessorListener.class);
@NotNull private DiffRequest myActiveRequest;
private @NotNull DiffRequest myActiveRequest;
@NotNull private ViewerState myState;
private @NotNull ViewerState myState;
@Nullable private ScrollToPolicy myCurrentScrollToPolicy;
private @Nullable ScrollToPolicy myCurrentScrollToPolicy;
private final boolean myIsNewToolbar;
@@ -193,8 +193,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
myContentPanel.setContent(DiffUtil.createMessagePanel(((LoadingDiffRequest)myActiveRequest).getMessage()));
}
@NotNull
private BorderLayoutPanel buildTopPanel() {
private @NotNull BorderLayoutPanel buildTopPanel() {
BorderLayoutPanel topPanel;
if (myIsNewToolbar) {
BorderLayoutPanel rightPanel = JBUI.Panels.simplePanel(myRightToolbarWrapper).addToLeft(myProgressBar);
@@ -246,8 +245,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
@RequiresEdt
public abstract void updateRequest(boolean force, @Nullable ScrollToPolicy scrollToChangePolicy);
@NotNull
private FrameDiffTool getFittedTool(boolean applySubstitutor) {
private @NotNull FrameDiffTool getFittedTool(boolean applySubstitutor) {
if (myForcedDiffTool instanceof FrameDiffTool) {
return myForcedDiffTool.canShow(myContext, myActiveRequest)
? (FrameDiffTool)myForcedDiffTool
@@ -265,13 +263,11 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
return tool;
}
@NotNull
private List<FrameDiffTool> getAvailableFittedTools() {
private @NotNull List<FrameDiffTool> getAvailableFittedTools() {
return filterFittedTools(myAvailableTools);
}
@NotNull
private List<FrameDiffTool> filterFittedTools(@NotNull List<? extends DiffTool> tools) {
private @NotNull List<FrameDiffTool> filterFittedTools(@NotNull List<? extends DiffTool> tools) {
List<FrameDiffTool> result = new ArrayList<>();
for (DiffTool tool : tools) {
try {
@@ -325,8 +321,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
updateToolOrderSettings(myToolOrder);
}
@NotNull
private ViewerState createState() {
private @NotNull ViewerState createState() {
FrameDiffTool frameTool = getFittedTool(true);
DiffViewer viewer = frameTool.createComponent(myContext, myActiveRequest);
@@ -353,7 +348,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
// Abstract
//
@Nullable private ApplyData myQueuedApplyRequest;
private @Nullable ApplyData myQueuedApplyRequest;
@RequiresEdt
protected void applyRequest(@NotNull DiffRequest request, boolean force, @Nullable ScrollToPolicy scrollToChangePolicy) {
@@ -436,8 +431,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
protected void onDispose() {
}
@Nullable
public <T> T getContextUserData(@NotNull Key<T> key) {
public @Nullable <T> T getContextUserData(@NotNull Key<T> key) {
return myContext.getUserData(key);
}
@@ -445,8 +439,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
myContext.putUserData(key, value);
}
@NotNull
protected List<AnAction> getNavigationActions() {
protected @NotNull List<AnAction> getNavigationActions() {
List<AnAction> actions = List.of(
new MyPrevDifferenceAction(), new MyNextDifferenceAction(), new MyOpenInEditorAction(),
Separator.getInstance(),
@@ -486,14 +479,12 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
DiffUtil.requestFocusInWindow(getPreferredFocusedComponent());
}
@NotNull
protected List<DiffTool> getToolOrderFromSettings(@NotNull List<? extends DiffTool> availableTools) {
protected @NotNull List<DiffTool> getToolOrderFromSettings(@NotNull List<? extends DiffTool> availableTools) {
return getToolOrderFromSettings(getSettings(), availableTools);
}
@NotNull
public static List<DiffTool> getToolOrderFromSettings(@NotNull DiffSettings diffSettings,
@NotNull List<? extends DiffTool> availableTools) {
public static @NotNull List<DiffTool> getToolOrderFromSettings(@NotNull DiffSettings diffSettings,
@NotNull List<? extends DiffTool> availableTools) {
List<DiffTool> result = new ArrayList<>();
List<String> savedOrder = diffSettings.getDiffToolsOrder();
@@ -618,8 +609,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
}
}
@NotNull
public ActionToolbar getToolbar() {
public @NotNull ActionToolbar getToolbar() {
return myToolbar;
}
@@ -639,13 +629,11 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
// Getters
//
@NotNull
public JComponent getComponent() {
public @NotNull JComponent getComponent() {
return myPanel;
}
@NotNull
public JComponent getPreferredFocusedComponent() {
public @NotNull JComponent getPreferredFocusedComponent() {
JComponent component = myState.getPreferredFocusedComponent();
JComponent fallback = myToolbar.getComponent();
if (component == null || !component.isFocusable()) return fallback;
@@ -653,23 +641,19 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
return component;
}
@Nullable
public Project getProject() {
public @Nullable Project getProject() {
return myProject;
}
@Nullable
public DiffRequest getActiveRequest() {
public @Nullable DiffRequest getActiveRequest() {
return myActiveRequest;
}
@NotNull
public DiffContext getContext() {
public @NotNull DiffContext getContext() {
return myContext;
}
@Nullable
public DiffViewer getActiveViewer() {
public @Nullable DiffViewer getActiveViewer() {
if (myState instanceof DefaultState) {
return ((DefaultState)myState).myViewer;
}
@@ -679,8 +663,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
return null;
}
@NotNull
protected DiffSettings getSettings() {
protected @NotNull DiffSettings getSettings() {
return mySettings;
}
@@ -694,7 +677,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
//
private class ShowInExternalToolAction extends DumbAwareAction {
@NotNull private final ExternalDiffSettings.ExternalTool myExternalTool;
private final @NotNull ExternalDiffSettings.ExternalTool myExternalTool;
private ShowInExternalToolAction(ExternalDiffSettings.@NotNull ExternalTool externalTool) {
super(DiffBundle.message("action.use.external.tool.text", externalTool.getName()));
@@ -755,8 +738,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
return actions.toArray(AnAction.EMPTY_ARRAY);
}
@NotNull
private List<ShowInExternalToolAction> getShowActions() {
private @NotNull List<ShowInExternalToolAction> getShowActions() {
Map<ExternalToolGroup, List<ExternalTool>> externalTools = ExternalDiffSettings.getInstance().getExternalTools();
List<ExternalTool> diffTools = externalTools.getOrDefault(ExternalToolGroup.DIFF_TOOL, Collections.emptyList());
@@ -777,21 +759,18 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
updateRequest(true);
}
@NotNull
@Override
public List<DiffTool> getTools() {
public @NotNull List<DiffTool> getTools() {
return new ArrayList<>(getAvailableFittedTools());
}
@NotNull
@Override
public DiffTool getActiveTool() {
public @NotNull DiffTool getActiveTool() {
return myState.getActiveTool();
}
@Nullable
@Override
public DiffTool getForcedDiffTool() {
public @Nullable DiffTool getForcedDiffTool() {
return myForcedDiffTool;
}
}
@@ -826,9 +805,8 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
presentation.setEnabledAndVisible(false);
}
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(@NotNull JComponent button, @NotNull DataContext context) {
protected @NotNull DefaultActionGroup createPopupActionGroup(@NotNull JComponent button, @NotNull DataContext context) {
DefaultActionGroup group = new DefaultActionGroup();
for (DiffTool tool : getAvailableFittedTools()) {
group.add(new DiffToolToggleAction(tool));
@@ -839,7 +817,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
}
private final class DiffToolToggleAction extends AnAction implements DumbAware {
@NotNull private final DiffTool myDiffTool;
private final @NotNull DiffTool myDiffTool;
private DiffToolToggleAction(@NotNull DiffTool tool) {
//noinspection DialogTitleCapitalization
@@ -898,7 +876,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
private enum IterationState {NEXT, PREV, NONE}
@NotNull private IterationState myIterationState = IterationState.NONE;
private @NotNull IterationState myIterationState = IterationState.NONE;
@RequiresEdt
protected boolean hasNextChange(boolean fromUpdate) {
@@ -1114,8 +1092,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
}
}
@NotNull
private static HintHint createNotifyHint(@NotNull JComponent component, @NotNull Point point, boolean above) {
private static @NotNull HintHint createNotifyHint(@NotNull JComponent component, @NotNull Point point, boolean above) {
return new HintHint(component, point)
.setPreferredPosition(above ? Balloon.Position.above : Balloon.Position.below)
.setAwtTooltip(true)
@@ -1218,9 +1195,8 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
return new Dimension(Math.max(windowSize.width, size.width), Math.max(windowSize.height, size.height));
}
@Nullable
@Override
public Object getData(@NotNull @NonNls String dataId) {
public @Nullable Object getData(@NotNull @NonNls String dataId) {
Object data;
DataProvider contentProvider = DataManagerImpl.getDataProviderEx(myContentPanel.getTargetComponent());
@@ -1295,16 +1271,15 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
return IdeFocusTraversalPolicy.getPreferredFocusedComponent(component, this);
}
@Nullable
@Override
protected Project getProject() {
protected @Nullable Project getProject() {
return myProject;
}
}
private class MyDiffContext extends DiffContextEx {
@NotNull private final UserDataHolder myInitialContext;
@NotNull private final UserDataHolder myOwnContext = new UserDataHolderBase();
private final @NotNull UserDataHolder myInitialContext;
private final @NotNull UserDataHolder myOwnContext = new UserDataHolderBase();
MyDiffContext(@NotNull UserDataHolder initialContext) {
myInitialContext = initialContext;
@@ -1335,9 +1310,8 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
setTitle(title);
}
@Nullable
@Override
public Project getProject() {
public @Nullable Project getProject() {
return DiffRequestProcessor.this.getProject();
}
@@ -1356,9 +1330,8 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
DiffRequestProcessor.this.requestFocusInWindow();
}
@Nullable
@Override
public <T> T getUserData(@NotNull Key<T> key) {
public @Nullable <T> T getUserData(@NotNull Key<T> key) {
T data = myOwnContext.getUserData(key);
if (data != null) return data;
return myInitialContext.getUserData(key);
@@ -1371,9 +1344,9 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
}
private static class ApplyData {
@NotNull private final DiffRequest request;
private final @NotNull DiffRequest request;
private final boolean force;
@Nullable private final ScrollToPolicy scrollToChangePolicy;
private final @Nullable ScrollToPolicy scrollToChangePolicy;
ApplyData(@NotNull DiffRequest request, boolean force, @Nullable ScrollToPolicy scrollToChangePolicy) {
this.request = request;
@@ -1412,7 +1385,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
DiffTool getActiveTool();
}
private static class EmptyState implements ViewerState {
private static final class EmptyState implements ViewerState {
private static final EmptyState INSTANCE = new EmptyState();
@Override
@@ -1423,29 +1396,26 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
public void destroy() {
}
@Nullable
@Override
public JComponent getPreferredFocusedComponent() {
public @Nullable JComponent getPreferredFocusedComponent() {
return null;
}
@Nullable
@Override
public Object getData(@NotNull @NonNls String dataId) {
public @Nullable Object getData(@NotNull @NonNls String dataId) {
return null;
}
@NotNull
@Override
public DiffTool getActiveTool() {
public @NotNull DiffTool getActiveTool() {
return ErrorDiffTool.INSTANCE;
}
}
private class ErrorState implements ViewerState {
@Nullable private final DiffTool myDiffTool;
private final @Nullable DiffTool myDiffTool;
@NotNull private final DiffViewer myViewer;
private final @NotNull DiffViewer myViewer;
ErrorState(@NotNull MessageDiffRequest request, @Nullable DiffTool diffTool) {
myDiffTool = diffTool;
@@ -1472,28 +1442,25 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
}
}
@Nullable
@Override
public JComponent getPreferredFocusedComponent() {
public @Nullable JComponent getPreferredFocusedComponent() {
return null;
}
@Nullable
@Override
public Object getData(@NotNull @NonNls String dataId) {
public @Nullable Object getData(@NotNull @NonNls String dataId) {
return null;
}
@NotNull
@Override
public DiffTool getActiveTool() {
public @NotNull DiffTool getActiveTool() {
return myDiffTool != null ? myDiffTool : ErrorDiffTool.INSTANCE;
}
}
private class DefaultState implements ViewerState {
@NotNull private final DiffViewer myViewer;
@NotNull private final FrameDiffTool myTool;
private final @NotNull DiffViewer myViewer;
private final @NotNull FrameDiffTool myTool;
DefaultState(@NotNull DiffViewer viewer, @NotNull FrameDiffTool tool) {
myViewer = viewer;
@@ -1534,21 +1501,18 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
}
}
@Nullable
@Override
public JComponent getPreferredFocusedComponent() {
public @Nullable JComponent getPreferredFocusedComponent() {
return myViewer.getPreferredFocusedComponent();
}
@NotNull
@Override
public DiffTool getActiveTool() {
public @NotNull DiffTool getActiveTool() {
return myTool;
}
@Nullable
@Override
public Object getData(@NotNull @NonNls String dataId) {
public @Nullable Object getData(@NotNull @NonNls String dataId) {
if (DiffDataKeys.DIFF_VIEWER.is(dataId)) {
return myViewer;
}
@@ -1557,10 +1521,10 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
}
private class WrapperState implements ViewerState {
@NotNull private final DiffViewer myViewer;
@NotNull private final FrameDiffTool myTool;
private final @NotNull DiffViewer myViewer;
private final @NotNull FrameDiffTool myTool;
@NotNull private final DiffViewer myWrapperViewer;
private final @NotNull DiffViewer myWrapperViewer;
WrapperState(@NotNull DiffViewer viewer, @NotNull FrameDiffTool tool, @NotNull DiffViewerWrapper wrapper) {
myViewer = viewer;
@@ -1587,8 +1551,7 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
}
}
@Nullable
private static List<AnAction> mergeActions(@Nullable List<AnAction> actions1, @Nullable List<AnAction> actions2) {
private static @Nullable List<AnAction> mergeActions(@Nullable List<AnAction> actions1, @Nullable List<AnAction> actions2) {
if (actions1 == null && actions2 == null) return null;
if (ContainerUtil.isEmpty(actions1)) return actions2;
if (ContainerUtil.isEmpty(actions2)) return actions1;
@@ -1618,21 +1581,18 @@ public abstract class DiffRequestProcessor implements CheckedDisposable {
}
}
@Nullable
@Override
public JComponent getPreferredFocusedComponent() {
public @Nullable JComponent getPreferredFocusedComponent() {
return myWrapperViewer.getPreferredFocusedComponent();
}
@NotNull
@Override
public DiffTool getActiveTool() {
public @NotNull DiffTool getActiveTool() {
return myTool;
}
@Nullable
@Override
public Object getData(@NotNull @NonNls String dataId) {
public @Nullable Object getData(@NotNull @NonNls String dataId) {
if (DiffDataKeys.WRAPPING_DIFF_VIEWER.is(dataId)) {
return myWrapperViewer;
}

View File

@@ -8,22 +8,19 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class DupLocatorBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.DupLocatorBundle";
public final class DupLocatorBundle {
private static final @NonNls String BUNDLE = "messages.DupLocatorBundle";
private static final DupLocatorBundle INSTANCE = new DupLocatorBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(DupLocatorBundle.class, BUNDLE);
private DupLocatorBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class DvcsBundle extends DynamicBundle {
@NonNls static final String BUNDLE = "messages.DvcsBundle";
private static final DvcsBundle INSTANCE = new DvcsBundle();
public final class DvcsBundle {
static final @NonNls String BUNDLE = "messages.DvcsBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(DvcsBundle.class, BUNDLE);
private DvcsBundle() { super(BUNDLE); }
private DvcsBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class PlatformEditorBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.PlatformEditorBundle";
private static final PlatformEditorBundle INSTANCE = new PlatformEditorBundle();
public final class PlatformEditorBundle {
public static final @NonNls String BUNDLE = "messages.PlatformEditorBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(PlatformEditorBundle.class, BUNDLE);
private PlatformEditorBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,22 +9,19 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public class ElevationBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.ElevationBundle";
private static final ElevationBundle INSTANCE = new ElevationBundle();
public final class ElevationBundle {
private static final @NonNls String BUNDLE = "messages.ElevationBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ElevationBundle.class, BUNDLE);
private ElevationBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -8,8 +8,7 @@ import com.intellij.openapi.util.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
public final class UnknownConfigurationType extends SimpleConfigurationType {
@NotNull
private static final UnknownConfigurationType INSTANCE = new UnknownConfigurationType();
private static final @NotNull UnknownConfigurationType INSTANCE = new UnknownConfigurationType();
private static final String NAME = "Unknown";
@@ -18,21 +17,18 @@ public final class UnknownConfigurationType extends SimpleConfigurationType {
NotNullLazyValue.createValue(() -> AllIcons.Actions.Help));
}
@NotNull
public static UnknownConfigurationType getInstance() {
public static @NotNull UnknownConfigurationType getInstance() {
return INSTANCE;
}
@NotNull
@Override
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
public @NotNull RunConfiguration createTemplateConfiguration(@NotNull Project project) {
return new UnknownRunConfiguration(this, project);
}
@NotNull
@Override
public RunConfigurationSingletonPolicy getSingletonPolicy() {
// in any case you cannot run UnknownConfigurationType
public @NotNull RunConfigurationSingletonPolicy getSingletonPolicy() {
// in any case, you cannot run UnknownConfigurationType
return RunConfigurationSingletonPolicy.SINGLE_INSTANCE_ONLY;
}

View File

@@ -9,28 +9,25 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class ExternalProcessAuthHelperBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.ExternalProcessAuthHelperBundle";
private static final ExternalProcessAuthHelperBundle INSTANCE = new ExternalProcessAuthHelperBundle();
public final class ExternalProcessAuthHelperBundle {
public static final @NonNls String BUNDLE = "messages.ExternalProcessAuthHelperBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ExternalProcessAuthHelperBundle.class, BUNDLE);
private ExternalProcessAuthHelperBundle() { super(BUNDLE); }
private ExternalProcessAuthHelperBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
/**
* @deprecated prefer {@link #message(String, Object...)} instead
*/
@NotNull
@Deprecated(forRemoval = true)
public static @Nls String getString(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key) {
public static @NotNull @Nls String getString(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key) {
return message(key);
}
}

View File

@@ -12,16 +12,14 @@ import java.util.ResourceBundle;
import java.util.function.Supplier;
@SuppressWarnings("MethodOverridesStaticMethodOfSuperclass")
public final class CommonBundle extends DynamicBundle {
public final class CommonBundle {
private static final String BUNDLE = "messages.CommonBundle";
private static final CommonBundle INSTANCE = new CommonBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(CommonBundle.class, BUNDLE);
private CommonBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (!INSTANCE.containsKey(key)) {
return IdeDeprecatedMessagesBundle.message(key, params);
}
@@ -51,8 +49,7 @@ public final class CommonBundle extends DynamicBundle {
* @deprecated use {@link AbstractBundle#message(ResourceBundle, String, Object...)} instead
*/
@Deprecated
@NotNull
public static @Nls String message(@NotNull ResourceBundle bundle, @NotNull String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull ResourceBundle bundle, @NotNull String key, Object @NotNull ... params) {
return BundleBase.messageOrDefault(bundle, key, null, params);
}
@@ -60,13 +57,11 @@ public final class CommonBundle extends DynamicBundle {
* @deprecated use {@link AbstractBundle#messageOrNull(ResourceBundle, String, Object...)}
*/
@Deprecated
@Nullable
public static @Nls String messageOfNull(@NotNull ResourceBundle bundle, @NotNull String key, Object @NotNull ... params) {
public static @Nullable @Nls String messageOfNull(@NotNull ResourceBundle bundle, @NotNull String key, Object @NotNull ... params) {
return AbstractBundle.messageOrNull(bundle, key, params);
}
@NotNull
public static @Button String getCancelButtonText() {
public static @NotNull @Button String getCancelButtonText() {
return message("button.cancel");
}

View File

@@ -12,21 +12,19 @@ import java.util.function.Supplier;
*/
@ApiStatus.Internal
public class IdeDeprecatedMessagesBundle extends AbstractBundle {
@NonNls private static final String BUNDLE = "messages.IdeDeprecatedMessagesBundle";
private static final @NonNls String BUNDLE = "messages.IdeDeprecatedMessagesBundle";
private static final IdeDeprecatedMessagesBundle INSTANCE = new IdeDeprecatedMessagesBundle();
private IdeDeprecatedMessagesBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -10,25 +10,21 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class ProjectBundle extends DynamicBundle {
@NonNls
public static final String BUNDLE = "messages.ProjectBundle";
private static final ProjectBundle INSTANCE = new ProjectBundle();
public final class ProjectBundle {
public static final @NonNls String BUNDLE = "messages.ProjectBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ProjectBundle.class, BUNDLE);
private ProjectBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getMessage(key, params);
}
return IdeDeprecatedMessagesBundle.message(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getLazyMessage(key, params);
}

View File

@@ -60,13 +60,11 @@ public final class ReferencesSearch extends ExtensibleQueryFactory<PsiReference,
}
@Override
@NotNull
public Project getProject() {
public @NotNull Project getProject() {
return myProject;
}
@NotNull
public PsiElement getElementToSearch() {
public @NotNull PsiElement getElementToSearch() {
return myElementToSearch;
}
@@ -83,13 +81,11 @@ public final class ReferencesSearch extends ExtensibleQueryFactory<PsiReference,
return myIgnoreAccessScope;
}
@NotNull
public SearchRequestCollector getOptimizer() {
public @NotNull SearchRequestCollector getOptimizer() {
return myOptimizer;
}
@NotNull
public SearchScope getEffectiveSearchScope () {
public @NotNull SearchScope getEffectiveSearchScope () {
if (myIgnoreAccessScope) {
return myScope;
}
@@ -112,8 +108,7 @@ public final class ReferencesSearch extends ExtensibleQueryFactory<PsiReference,
* @param element the element (declaration) the references to which are requested.
* @return the query allowing to enumerate the references.
*/
@NotNull
public static Query<PsiReference> search(@NotNull PsiElement element) {
public static @NotNull Query<PsiReference> search(@NotNull PsiElement element) {
return search(element, GlobalSearchScope.allScope(PsiUtilCore.getProjectInReadAction(element)), false);
}
@@ -124,22 +119,20 @@ public final class ReferencesSearch extends ExtensibleQueryFactory<PsiReference,
* @param searchScope the scope in which the search is performed.
* @return the query allowing to enumerate the references.
*/
@NotNull
public static Query<PsiReference> search(@NotNull PsiElement element, @NotNull SearchScope searchScope) {
public static @NotNull Query<PsiReference> search(@NotNull PsiElement element, @NotNull SearchScope searchScope) {
return search(element, searchScope, false);
}
/**
* Searches for references to the specified element in the specified scope, optionally returning also references which
* are invalid because of access rules (e.g. references to a private method from a different class).
* are invalid because of access rules (e.g., references to a private method from a different class).
*
* @param element the element (declaration) the references to which are requested.
* @param searchScope the scope in which the search is performed.
* @param ignoreAccessScope if true, references which are invalid because of access rules are included in the results.
* @return the query allowing to enumerate the references.
*/
@NotNull
public static Query<PsiReference> search(@NotNull PsiElement element, @NotNull SearchScope searchScope, boolean ignoreAccessScope) {
public static @NotNull Query<PsiReference> search(@NotNull PsiElement element, @NotNull SearchScope searchScope, boolean ignoreAccessScope) {
return search(new SearchParameters(element, searchScope, ignoreAccessScope));
}
@@ -149,8 +142,7 @@ public final class ReferencesSearch extends ExtensibleQueryFactory<PsiReference,
* @param parameters the parameters for the search (contain also the element the references to which are requested).
* @return the query allowing to enumerate the references.
*/
@NotNull
public static Query<PsiReference> search(@NotNull SearchParameters parameters) {
public static @NotNull Query<PsiReference> search(@NotNull SearchParameters parameters) {
Query<PsiReference> result = INSTANCE.createQuery(parameters);
if (parameters.isSharedOptimizer) {
return uniqueResults(result);
@@ -161,8 +153,7 @@ public final class ReferencesSearch extends ExtensibleQueryFactory<PsiReference,
return uniqueResults(new MergeQuery<>(result, new SearchRequestQuery(parameters.getProject(), requests)));
}
@NotNull
private static Query<PsiReference> uniqueResults(@NotNull Query<? extends PsiReference> composite) {
private static @NotNull Query<PsiReference> uniqueResults(@NotNull Query<? extends PsiReference> composite) {
return new UniqueResultsQuery<>(composite, ReferenceDescriptor.MAPPER);
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class IndexingBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.IndexingBundle";
private static final IndexingBundle INSTANCE = new IndexingBundle();
public final class IndexingBundle {
private static final @NonNls String BUNDLE = "messages.IndexingBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(IndexingBundle.class, BUNDLE);
private IndexingBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -19,7 +19,6 @@ import com.intellij.util.io.keyStorage.AppendableObjectStorage;
import com.intellij.util.io.keyStorage.AppendableStorageBackedByResizableMappedFile;
import it.unimi.dsi.fastutil.ints.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.VisibleForTesting;
import java.io.*;
@@ -29,18 +28,14 @@ import java.util.concurrent.atomic.AtomicInteger;
/**
* A data structure to store key hashes to virtual file id mappings.
*/
class KeyHashLog<Key> implements Closeable {
final class KeyHashLog<Key> implements Closeable {
private static final Logger LOG = Logger.getInstance(KeyHashLog.class);
private static final boolean ENABLE_CACHED_HASH_IDS = SystemProperties.getBooleanProperty("idea.index.cashed.hashids", true);
@NotNull
private final KeyDescriptor<Key> myKeyDescriptor;
@NotNull
private final Path myBaseStorageFile;
@NotNull
private final AppendableObjectStorage<int[]> myKeyHashToVirtualFileMapping;
@NotNull
private final ConcurrentIntObjectMap<Boolean> myInvalidatedSessionIds = ConcurrentCollectionFactory.createConcurrentIntObjectMap();
private final @NotNull KeyDescriptor<Key> myKeyDescriptor;
private final @NotNull Path myBaseStorageFile;
private final @NotNull AppendableObjectStorage<int[]> myKeyHashToVirtualFileMapping;
private final @NotNull ConcurrentIntObjectMap<Boolean> myInvalidatedSessionIds = ConcurrentCollectionFactory.createConcurrentIntObjectMap();
private volatile int myLastScannedId;
@@ -58,8 +53,7 @@ class KeyHashLog<Key> implements Closeable {
openMapping(getDataFile(), 4096);
}
@NotNull
private static AppendableStorageBackedByResizableMappedFile<int[]> openMapping(@NotNull Path dataFile, int size) throws IOException {
private static @NotNull AppendableStorageBackedByResizableMappedFile<int[]> openMapping(@NotNull Path dataFile, int size) throws IOException {
return new AppendableStorageBackedByResizableMappedFile<>(dataFile,
size,
null,
@@ -76,8 +70,7 @@ class KeyHashLog<Key> implements Closeable {
appendKeyHashToVirtualFileMappingToLog(key, -inputId);
}
@Nullable
IntSet getSuitableKeyHashes(@NotNull IdFilter filter, @NotNull Project project) throws StorageException {
@NotNull IntSet getSuitableKeyHashes(@NotNull IdFilter filter, @NotNull Project project) throws StorageException {
IdFilter.FilterScopeType filteringScopeType = filter.getFilteringScopeType();
if (filteringScopeType == IdFilter.FilterScopeType.OTHER) {
filteringScopeType = IdFilter.FilterScopeType.PROJECT_AND_LIBRARIES;
@@ -275,8 +268,7 @@ class KeyHashLog<Key> implements Closeable {
}
@NotNull
private static IntSet loadProjectHashes(@NotNull Path fileWithCaches) throws IOException {
private static @NotNull IntSet loadProjectHashes(@NotNull Path fileWithCaches) throws IOException {
try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(Files.newInputStream(fileWithCaches)))) {
int capacity = DataInputOutputUtil.readINT(inputStream);
IntSet hashMaskSet = new IntOpenHashSet(capacity);
@@ -327,8 +319,7 @@ class KeyHashLog<Key> implements Closeable {
return sessionDirectory;
}
@NotNull
private Path getSavedProjectFileValueIds(int id, @NotNull IdFilter.FilterScopeType scopeType, @NotNull Project project) {
private @NotNull Path getSavedProjectFileValueIds(int id, @NotNull IdFilter.FilterScopeType scopeType, @NotNull Project project) {
return getSessionDir().resolve(getDataFile().getFileName().toString() + "." + project.hashCode() + "." + id + "." + scopeType.getId());
}
@@ -379,14 +370,12 @@ class KeyHashLog<Key> implements Closeable {
return Files.exists(getCompactionMarker());
}
@NotNull
private Path getCompactionMarker() {
private @NotNull Path getCompactionMarker() {
Path dataFile = getDataFile();
return dataFile.resolveSibling(dataFile.getFileName().toString() + ".require.compaction");
}
@NotNull
private Path getDataFile() {
private @NotNull Path getDataFile() {
return myBaseStorageFile.resolveSibling(myBaseStorageFile.getFileName() + ".project");
}

View File

@@ -10,22 +10,20 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class CodeInsightBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.CodeInsightBundle";
private static final CodeInsightBundle INSTANCE = new CodeInsightBundle();
public final class CodeInsightBundle {
public static final @NonNls String BUNDLE = "messages.CodeInsightBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(CodeInsightBundle.class, BUNDLE);
private CodeInsightBundle() { super(BUNDLE); }
private CodeInsightBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getMessage(key, params);
}
return IdeDeprecatedMessagesBundle.message(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getLazyMessage(key, params);
}

View File

@@ -10,22 +10,20 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class DaemonBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.DaemonBundle";
private static final DaemonBundle INSTANCE = new DaemonBundle();
public final class DaemonBundle {
private static final @NonNls String BUNDLE = "messages.DaemonBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(DaemonBundle.class, BUNDLE);
private DaemonBundle() { super(BUNDLE); }
private DaemonBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getMessage(key, params);
}
return IdeDeprecatedMessagesBundle.message(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getLazyMessage(key, params);
}

View File

@@ -11,24 +11,21 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class LangBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.LangBundle";
private static final LangBundle INSTANCE = new LangBundle();
public final class LangBundle {
public static final @NonNls String BUNDLE = "messages.LangBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(LangBundle.class, BUNDLE);
private LangBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getMessage(key, params);
}
return IdeDeprecatedMessagesBundle.message(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getLazyMessage(key, params);
}

View File

@@ -11,24 +11,21 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class LangCoreBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.LangCoreBundle";
private static final LangCoreBundle INSTANCE = new LangCoreBundle();
public final class LangCoreBundle {
public static final @NonNls String BUNDLE = "messages.LangCoreBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(LangCoreBundle.class, BUNDLE);
private LangCoreBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getMessage(key, params);
}
return IdeDeprecatedMessagesBundle.message(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getLazyMessage(key, params);
}

View File

@@ -9,12 +9,11 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
final class ProblemsViewBundle extends DynamicBundle {
final class ProblemsViewBundle {
private static final @NonNls String BUNDLE = "messages.ProblemsViewBundle";
private static final ProblemsViewBundle INSTANCE = new ProblemsViewBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(ProblemsViewBundle.class, BUNDLE);
private ProblemsViewBundle() {
super(BUNDLE);
}
public static @Nls @NotNull String message(

View File

@@ -10,21 +10,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class BuildBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.BuildBundle";
private static final BuildBundle INSTANCE = new BuildBundle();
public final class BuildBundle {
private static final @NonNls String BUNDLE = "messages.BuildBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(BuildBundle.class, BUNDLE);
private BuildBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -8,11 +8,10 @@ import com.intellij.codeInsight.daemon.LineMarkerSettings;
import com.intellij.icons.AllIcons;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public class DocRenderDummyLineMarkerProvider extends LineMarkerProviderDescriptor {
public final class DocRenderDummyLineMarkerProvider extends LineMarkerProviderDescriptor {
private static final DocRenderDummyLineMarkerProvider INSTANCE = new DocRenderDummyLineMarkerProvider();
@Override
@@ -31,7 +30,7 @@ public class DocRenderDummyLineMarkerProvider extends LineMarkerProviderDescript
}
@Override
public @Nullable Icon getIcon() {
public @NotNull Icon getIcon() {
return AllIcons.Gutter.JavadocRead;
}

View File

@@ -9,12 +9,11 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class BookmarkBundle extends DynamicBundle {
public final class BookmarkBundle {
private static final @NonNls String BUNDLE = "messages.BookmarkBundle";
private static final BookmarkBundle INSTANCE = new BookmarkBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(BookmarkBundle.class, BUNDLE);
private BookmarkBundle() {
super(BUNDLE);
}
public static @Nls @NotNull String message(

View File

@@ -9,12 +9,11 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class BookmarkBundle extends DynamicBundle {
public final class BookmarkBundle {
private static final @NonNls String BUNDLE = "messages.BookmarkBundle";
private static final BookmarkBundle INSTANCE = new BookmarkBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(BookmarkBundle.class, BUNDLE);
private BookmarkBundle() {
super(BUNDLE);
}
public static @Nls @NotNull String message(

View File

@@ -10,21 +10,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class ToolsBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.ToolsBundle";
private static final ToolsBundle INSTANCE = new ToolsBundle();
public final class ToolsBundle {
private static final @NonNls String BUNDLE = "messages.ToolsBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ToolsBundle.class, BUNDLE);
private ToolsBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -6,15 +6,14 @@ import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.PropertyKey;
public final class LocalHistoryBundle extends DynamicBundle {
public final class LocalHistoryBundle {
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
private static final String BUNDLE = "messages.LocalHistoryBundle";
private static final LocalHistoryBundle INSTANCE = new LocalHistoryBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(LocalHistoryBundle.class, BUNDLE);
private LocalHistoryBundle() {
super(BUNDLE);
}
}

View File

@@ -23,13 +23,13 @@ public final class FeatureStatisticsBundle {
private static Reference<ResourceBundle> ourBundle;
private static final Logger LOG = Logger.getInstance(FeatureStatisticsBundle.class);
@NonNls private static final String BUNDLE = "messages.FeatureStatisticsBundle";
private static final @NonNls String BUNDLE = "messages.FeatureStatisticsBundle";
private FeatureStatisticsBundle() {
}
private static ResourceBundle getBundle(final String key) {
ResourceBundle providerBundle = ProvidersBundles.INSTANCE.get(key);
ResourceBundle providerBundle = ProviderBundles.INSTANCE.get(key);
if (providerBundle != null) {
return providerBundle;
}
@@ -42,11 +42,11 @@ public final class FeatureStatisticsBundle {
return bundle;
}
private static final class ProvidersBundles extends HashMap<String, ResourceBundle> {
private static final class ProviderBundles extends HashMap<String, ResourceBundle> {
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
private static final ProvidersBundles INSTANCE = new ProvidersBundles();
private static final ProviderBundles INSTANCE = new ProviderBundles();
private ProvidersBundles() {
private ProviderBundles() {
for (FeatureStatisticsBundleEP bundleEP : FeatureStatisticsBundleEP.EP_NAME.getExtensionList()) {
try {
ResourceBundle bundle = ResourceBundle.getBundle(bundleEP.qualifiedName,

View File

@@ -8,10 +8,10 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class IdeBundle extends DynamicBundle {
public final class IdeBundle {
public static final String BUNDLE = "messages.IdeBundle";
private static final IdeBundle INSTANCE = new IdeBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(IdeBundle.class, BUNDLE);
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.containsKey(key) ? INSTANCE.getMessage(key, params) : IdeDeprecatedMessagesBundle.message(key, params);
@@ -22,6 +22,5 @@ public final class IdeBundle extends DynamicBundle {
}
private IdeBundle() {
super(BUNDLE);
}
}

View File

@@ -10,13 +10,12 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class ActionsBundle extends DynamicBundle {
public final class ActionsBundle {
@NonNls public static final String IDEA_ACTIONS_BUNDLE = "messages.ActionsBundle";
private static final ActionsBundle ourInstance = new ActionsBundle();
private static final DynamicBundle ourInstance = new DynamicBundle(ActionsBundle.class, IDEA_ACTIONS_BUNDLE);
private ActionsBundle() {
super(IDEA_ACTIONS_BUNDLE);
}
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = IDEA_ACTIONS_BUNDLE) String key, Object @NotNull ... params) {

View File

@@ -9,12 +9,11 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
final class ActionsDeprecatedMessagesBundle extends DynamicBundle {
final class ActionsDeprecatedMessagesBundle {
private static final @NonNls String BUNDLE = "messages.ActionsDeprecatedMessagesBundle";
private static final ActionsDeprecatedMessagesBundle INSTANCE = new ActionsDeprecatedMessagesBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(ActionsDeprecatedMessagesBundle.class, BUNDLE);
private ActionsDeprecatedMessagesBundle() {
super(BUNDLE);
}
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class EditorBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.EditorBundle";
private static final EditorBundle INSTANCE = new EditorBundle();
public final class EditorBundle {
public static final @NonNls String BUNDLE = "messages.EditorBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(EditorBundle.class, BUNDLE);
private EditorBundle() { super(BUNDLE); }
private EditorBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -10,19 +10,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class KeyMapBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "messages.KeyMapBundle";
private static final KeyMapBundle INSTANCE = new KeyMapBundle();
public final class KeyMapBundle {
public static final @NonNls String BUNDLE = "messages.KeyMapBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(KeyMapBundle.class, BUNDLE);
private KeyMapBundle() { super(BUNDLE); }
private KeyMapBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,12 +9,11 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class UIBundle extends DynamicBundle {
public final class UIBundle {
private static final String BUNDLE = "messages.UIBundle";
private static final UIBundle INSTANCE = new UIBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(UIBundle.class, BUNDLE);
private UIBundle() {
super(BUNDLE);
}
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {

View File

@@ -8,12 +8,12 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class DiagnosticBundle extends DynamicBundle {
public final class DiagnosticBundle {
public static final String BUNDLE = "messages.DiagnosticBundle";
private static final DiagnosticBundle INSTANCE = new DiagnosticBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(DiagnosticBundle.class, BUNDLE);
private DiagnosticBundle() { super(BUNDLE); }
private DiagnosticBundle() {}
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);

View File

@@ -15,8 +15,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
class LightEditDirectoryIndex extends DirectoryIndex {
final class LightEditDirectoryIndex extends DirectoryIndex {
@SuppressWarnings("removal")
@Override
public @NotNull DirectoryInfo getInfoForFile(@NotNull VirtualFile file) {
@@ -28,32 +27,28 @@ class LightEditDirectoryIndex extends DirectoryIndex {
return LightEditDirectoryInfo.INSTANCE;
}
@NotNull
@Override
public Query<VirtualFile> getDirectoriesByPackageName(@NotNull String packageName, boolean includeLibrarySources) {
public @NotNull Query<VirtualFile> getDirectoriesByPackageName(@NotNull String packageName, boolean includeLibrarySources) {
return EmptyQuery.getEmptyQuery();
}
@Nullable
@Override
public String getPackageName(@NotNull VirtualFile dir) {
public @Nullable String getPackageName(@NotNull VirtualFile dir) {
return null;
}
@NotNull
@Override
public List<OrderEntry> getOrderEntries(@NotNull VirtualFile fileOrDir) {
public @NotNull List<OrderEntry> getOrderEntries(@NotNull VirtualFile fileOrDir) {
return Collections.emptyList();
}
@NotNull
@Override
public Set<String> getDependentUnloadedModules(@NotNull Module module) {
public @NotNull Set<String> getDependentUnloadedModules(@NotNull Module module) {
return Collections.emptySet();
}
@SuppressWarnings("removal")
private static class LightEditDirectoryInfo extends DirectoryInfo {
private static final class LightEditDirectoryInfo extends DirectoryInfo {
private static final LightEditDirectoryInfo INSTANCE = new LightEditDirectoryInfo();
@Override
public VirtualFile getContentRoot() {

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class InternalActionsBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.InternalActionsBundle";
private static final InternalActionsBundle INSTANCE = new InternalActionsBundle();
public final class InternalActionsBundle {
private static final @NonNls String BUNDLE = "messages.InternalActionsBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(InternalActionsBundle.class, BUNDLE);
private InternalActionsBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -30,7 +30,7 @@ import java.util.List;
* Iterator over editor's text contents. Each iteration step corresponds to a text fragment having common graphical attributes
* (font style, foreground and background color, effect type and color).
*/
public class IterationState {
public final class IterationState {
private static final Logger LOG = Logger.getInstance(IterationState.class);
public static Comparator<RangeHighlighterEx> createByLayerThenByAttributesComparator(EditorColorsScheme scheme) {
@@ -76,8 +76,7 @@ public class IterationState {
private final TextAttributes myMergedAttributes = new TextAttributes();
@Nullable
private final HighlighterIterator myHighlighterIterator;
private final @Nullable HighlighterIterator myHighlighterIterator;
private final HighlighterSweep myView;
private final HighlighterSweep myDoc;
@@ -405,7 +404,6 @@ public class IterationState {
}
List<RangeMarker> blocks = myDocument.getGuardedBlocks();
int result = myEnd;
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < blocks.size(); i++) {
RangeMarker block = blocks.get(i);
int nearestValue = getNearestValueAhead(start, alignOffset(block.getStartOffset()), alignOffset(block.getEndOffset()));
@@ -509,7 +507,6 @@ public class IterationState {
private int getMinSegmentHighlightersEnd() {
int end = myEnd;
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < myCurrentHighlighters.size(); i++) {
RangeHighlighterEx highlighter = myCurrentHighlighters.get(i);
if (myReverseIteration) {
@@ -572,7 +569,6 @@ public class IterationState {
ContainerUtil.quickSort(myCurrentHighlighters, createByLayerThenByAttributesComparator(myEditor.getColorsScheme()));
}
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < size; i++) {
RangeHighlighterEx highlighter = myCurrentHighlighters.get(i);
if (highlighter.getTextAttributes(myEditor.getColorsScheme()) == TextAttributes.ERASE_MARKER) {
@@ -583,7 +579,6 @@ public class IterationState {
List<TextAttributes> cachedAttributes = myCachedAttributesList;
if (!cachedAttributes.isEmpty()) cachedAttributes.clear();
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < size; i++) {
RangeHighlighterEx highlighter = myCurrentHighlighters.get(i);
if (atBreak && highlighter.getTargetArea() == HighlighterTargetArea.EXACT_RANGE &&
@@ -632,7 +627,6 @@ public class IterationState {
@JdkConstants.FontStyle int fontType = Font.PLAIN;
TextAttributesEffectsBuilder effectsBuilder = null;
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < cachedAttributes.size(); i++) {
TextAttributes attrs = cachedAttributes.get(i);
@@ -684,8 +678,7 @@ public class IterationState {
return myEndOffset;
}
@NotNull
public TextAttributes getMergedAttributes() {
public @NotNull TextAttributes getMergedAttributes() {
return myMergedAttributes;
}
@@ -698,16 +691,14 @@ public class IterationState {
}
@NotNull
public TextAttributes getPastLineEndBackgroundAttributes() {
public @NotNull TextAttributes getPastLineEndBackgroundAttributes() {
myMergedAttributes.setBackgroundColor(hasSoftWrap() ? getBreakBackgroundColor(true) :
isEditorRightAligned() && myLastBackgroundColor != null ? myLastBackgroundColor :
myCurrentBackgroundColor);
return myMergedAttributes;
}
@NotNull
public TextAttributes getBeforeLineStartBackgroundAttributes() {
public @NotNull TextAttributes getBeforeLineStartBackgroundAttributes() {
return isEditorRightAligned() && !hasSoftWrap() ?
getBreakAttributes() :
new TextAttributes(null, getBreakBackgroundColor(false), null, null, Font.PLAIN);
@@ -737,7 +728,7 @@ public class IterationState {
return myEditor instanceof EditorImpl && ((EditorImpl)myEditor).isRightAligned();
}
private static class LayerComparator implements Comparator<RangeHighlighterEx> {
private static final class LayerComparator implements Comparator<RangeHighlighterEx> {
private static final LayerComparator INSTANCE = new LayerComparator();
@Override
public int compare(RangeHighlighterEx o1, RangeHighlighterEx o2) {

View File

@@ -9,22 +9,19 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class FileTypesBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.FileTypesBundle";
public final class FileTypesBundle {
private static final @NonNls String BUNDLE = "messages.FileTypesBundle";
private static final FileTypesBundle INSTANCE = new FileTypesBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(FileTypesBundle.class, BUNDLE);
private FileTypesBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -19,18 +19,17 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.ex.EditorEx;
import org.jetbrains.annotations.NotNull;
public class MonospaceEditorCustomization implements EditorCustomization {
public final class MonospaceEditorCustomization implements EditorCustomization {
private static final EditorCustomization INSTANCE = new MonospaceEditorCustomization();
@NotNull
public static EditorCustomization getInstance() {
public static @NotNull EditorCustomization getInstance() {
return INSTANCE;
}
@Override
public void customize(@NotNull EditorEx editor) {
/* For the sake of simplicity and consistency, we load the global editor scheme here, although its font is not necessarily monospace.
However if the main editor has not monospaced font, we don't wanna use monospace here either. */
However, if the main editor has not monospaced font, we don't use monospace here either. */
editor.setColorsScheme(EditorColorsManager.getInstance().getGlobalScheme());
}
}

View File

@@ -9,22 +9,19 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public class ProcessHandshakeBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.ProcessHandshakeBundle";
private static final ProcessHandshakeBundle INSTANCE = new ProcessHandshakeBundle();
public final class ProcessHandshakeBundle {
private static final @NonNls String BUNDLE = "messages.ProcessHandshakeBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ProcessHandshakeBundle.class, BUNDLE);
private ProcessHandshakeBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -300,7 +300,7 @@ public class EditorStressTest extends AbstractEditorTest {
private static final Key<Integer> REGION_WIDTH = Key.create("custom.region.width");
private static class MyCustomFoldRegionRenderer implements CustomFoldRegionRenderer {
private static final class MyCustomFoldRegionRenderer implements CustomFoldRegionRenderer {
private static final MyCustomFoldRegionRenderer INSTANCE = new MyCustomFoldRegionRenderer();
@Override

View File

@@ -7,21 +7,18 @@ import org.jetbrains.annotations.*;
import java.util.function.Supplier;
@ApiStatus.Internal
public final class IdeUtilIoBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.IdeUtilIoBundle";
private static final IdeUtilIoBundle INSTANCE = new IdeUtilIoBundle();
public final class IdeUtilIoBundle {
private static final @NonNls String BUNDLE = "messages.IdeUtilIoBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(IdeUtilIoBundle.class, BUNDLE);
private IdeUtilIoBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class ProjectModelBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.ProjectModelBundle";
private static final ProjectModelBundle INSTANCE = new ProjectModelBundle();
public final class ProjectModelBundle {
private static final @NonNls String BUNDLE = "messages.ProjectModelBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ProjectModelBundle.class, BUNDLE);
private ProjectModelBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -8,30 +8,27 @@ import org.jetbrains.annotations.*;
import java.util.function.Supplier;
public final class RefactoringBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.RefactoringBundle";
private static final RefactoringBundle INSTANCE = new RefactoringBundle();
public final class RefactoringBundle {
private static final @NonNls String BUNDLE = "messages.RefactoringBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(RefactoringBundle.class, BUNDLE);
private RefactoringBundle() { super(BUNDLE); }
private RefactoringBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getMessage(key, params);
}
return IdeDeprecatedMessagesBundle.message(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getLazyMessage(key, params);
}
return IdeDeprecatedMessagesBundle.messagePointer(key, params);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getMessage(key);
}
@@ -70,7 +67,7 @@ public final class RefactoringBundle extends DynamicBundle {
return message("visibility.escalate");
}
public static @NlsContexts.DialogMessage String getCannotRefactorMessage(@NlsContexts.DialogMessage @Nullable final String message) {
public static @NlsContexts.DialogMessage String getCannotRefactorMessage(final @NlsContexts.DialogMessage @Nullable String message) {
return message("cannot.perform.refactoring") + (message == null ? "" : "\n" + message);
}
}

View File

@@ -8,20 +8,20 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class RemoteBundle extends DynamicBundle {
public final class RemoteBundle {
public static final String BUNDLE = "messages.RemoteBundle";
private static final RemoteBundle INSTANCE = new RemoteBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(RemoteBundle.class, BUNDLE);
private RemoteBundle() {
}
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
private RemoteBundle() {
super(BUNDLE);
}
}

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class CloudBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.CloudBundle";
private static final CloudBundle INSTANCE = new CloudBundle();
public final class CloudBundle {
private static final @NonNls String BUNDLE = "messages.CloudBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(CloudBundle.class, BUNDLE);
private CloudBundle() { super(BUNDLE); }
private CloudBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,23 +9,20 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public class ScriptDebuggerBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.ScriptDebuggerBundle";
private static final ScriptDebuggerBundle INSTANCE = new ScriptDebuggerBundle();
public final class ScriptDebuggerBundle {
private static final @NonNls String BUNDLE = "messages.ScriptDebuggerBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(ScriptDebuggerBundle.class, BUNDLE);
private ScriptDebuggerBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls
public static @NotNull @Nls
String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class SmRunnerBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.SmRunnerBundle";
private static final SmRunnerBundle INSTANCE = new SmRunnerBundle();
public final class SmRunnerBundle {
private static final @NonNls String BUNDLE = "messages.SmRunnerBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(SmRunnerBundle.class, BUNDLE);
private SmRunnerBundle() { super(BUNDLE); }
private SmRunnerBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -19,12 +19,11 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
public class EventLogAppConnectionSettings implements EventLogConnectionSettings {
public final class EventLogAppConnectionSettings implements EventLogConnectionSettings {
private static final StatsProxyInfo NO_PROXY = new StatsProxyInfo(Proxy.NO_PROXY, null);
@NotNull
@Override
public String getUserAgent() {
public @NotNull String getUserAgent() {
Application app = ApplicationManager.getApplication();
if (app != null && !app.isDisposed()) {
String productName = ApplicationNamesInfo.getInstance().getFullProductName();
@@ -34,9 +33,8 @@ public class EventLogAppConnectionSettings implements EventLogConnectionSettings
return "IntelliJ";
}
@NotNull
@Override
public StatsProxyInfo selectProxy(@NotNull String url) {
public @NotNull StatsProxyInfo selectProxy(@NotNull String url) {
Application app = ApplicationManager.getApplication();
if (app != null && !app.isDisposed()) {
Proxy proxy = findProxy(url);
@@ -47,15 +45,13 @@ public class EventLogAppConnectionSettings implements EventLogConnectionSettings
return NO_PROXY;
}
@Nullable
@Override
public SSLContext getSSLContext() {
public @Nullable SSLContext getSSLContext() {
return IdeUiService.getInstance().getSslContext();
}
@NotNull
@Override
public Map<String, String> getExtraHeaders() {
public @NotNull Map<String, String> getExtraHeaders() {
ExternalEventLogSettings externalEventLogSettings = StatisticsEventLogProviderUtil.getExternalEventLogSettings();
if (externalEventLogSettings != null) {
return externalEventLogSettings.getExtraLogUploadHeaders();
@@ -64,16 +60,14 @@ public class EventLogAppConnectionSettings implements EventLogConnectionSettings
}
}
@Nullable
private static StatsProxyInfo.StatsProxyAuthProvider getAuthProvider() {
private static @Nullable StatsProxyInfo.StatsProxyAuthProvider getAuthProvider() {
if (IdeUiService.getInstance().isProxyAuth()) {
return EventLogAppProxyAuth.INSTANCE;
}
return null;
}
@NotNull
private static Proxy findProxy(@NotNull String url) {
private static @NotNull Proxy findProxy(@NotNull String url) {
try {
List<Proxy> proxies = IdeUiService.getInstance().getProxyList(new URL(url));
return !proxies.isEmpty() ? proxies.get(0) : Proxy.NO_PROXY;
@@ -84,7 +78,7 @@ public class EventLogAppConnectionSettings implements EventLogConnectionSettings
return Proxy.NO_PROXY;
}
private static class EventLogAppProxyAuth implements StatsProxyInfo.StatsProxyAuthProvider {
private static final class EventLogAppProxyAuth implements StatsProxyInfo.StatsProxyAuthProvider {
private static final EventLogAppProxyAuth INSTANCE = new EventLogAppProxyAuth();
@Override

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class SSRBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.SSRBundle";
private static final SSRBundle INSTANCE = new SSRBundle();
public final class SSRBundle {
private static final @NonNls String BUNDLE = "messages.SSRBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(SSRBundle.class, BUNDLE);
private SSRBundle() { super(BUNDLE); }
private SSRBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class StructureViewBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.StructureViewBundle";
private static final StructureViewBundle INSTANCE = new StructureViewBundle();
public final class StructureViewBundle {
private static final @NonNls String BUNDLE = "messages.StructureViewBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(StructureViewBundle.class, BUNDLE);
private StructureViewBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class TaskApiBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.TaskApiBundle";
private static final TaskApiBundle INSTANCE = new TaskApiBundle();
public final class TaskApiBundle {
private static final @NonNls String BUNDLE = "messages.TaskApiBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(TaskApiBundle.class, BUNDLE);
private TaskApiBundle() { super(BUNDLE); }
private TaskApiBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -9,19 +9,17 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class TaskBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.TaskBundle";
private static final TaskBundle INSTANCE = new TaskBundle();
public final class TaskBundle {
private static final @NonNls String BUNDLE = "messages.TaskBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(TaskBundle.class, BUNDLE);
private TaskBundle() { super(BUNDLE); }
private TaskBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -181,13 +181,12 @@ public final class EmptyFileBasedIndex extends FileBasedIndexEx {
return true;
}
@NotNull
@Override
public <K, V> UpdatableIndex<K, V, FileContent, ?> getIndex(ID<K, V> indexId) {
public @NotNull <K, V> UpdatableIndex<K, V, FileContent, ?> getIndex(ID<K, V> indexId) {
return EmptyIndex.getInstance();
}
private static class EmptyIndex<Key, Value> implements UpdatableIndex<Key, Value, FileContent, Void>, MeasurableIndexStore {
private static final class EmptyIndex<Key, Value> implements UpdatableIndex<Key, Value, FileContent, Void>, MeasurableIndexStore {
@SuppressWarnings("rawtypes")
private static final EmptyIndex INSTANCE = new EmptyIndex();
private final ReentrantReadWriteLock myLock = new ReentrantReadWriteLock();

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class TestRunnerBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.TestRunnerBundle";
private static final TestRunnerBundle INSTANCE = new TestRunnerBundle();
public final class TestRunnerBundle {
private static final @NonNls String BUNDLE = "messages.TestRunnerBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(TestRunnerBundle.class, BUNDLE);
private TestRunnerBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

View File

@@ -11,23 +11,21 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class UsageViewBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.UsageViewBundle";
public final class UsageViewBundle {
private static final @NonNls String BUNDLE = "messages.UsageViewBundle";
private static final UsageViewBundle INSTANCE = new UsageViewBundle();
private static final DynamicBundle INSTANCE = new DynamicBundle(UsageViewBundle.class, BUNDLE);
private UsageViewBundle() { super(BUNDLE); }
private UsageViewBundle() {}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getMessage(key, params);
}
return IdeDeprecatedMessagesBundle.message(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
if (INSTANCE.containsKey(key)) {
return INSTANCE.getLazyMessage(key, params);
}
@@ -40,8 +38,7 @@ public final class UsageViewBundle extends DynamicBundle {
}
@SuppressWarnings({"AutoBoxing"})
@Nls
public static String getReferencesString(int usagesCount, int filesCount) {
public static @Nls String getReferencesString(int usagesCount, int filesCount) {
return " (" + message("occurence.info.reference", usagesCount, filesCount) + ")";
}
}

View File

@@ -28,10 +28,12 @@ import java.util.NoSuchElementException;
@ApiStatus.ScheduledForRemoval
public class EmptyIterator<T> implements Iterator<T> {
private static final EmptyIterator INSTANCE = new EmptyIterator();
public static <T> EmptyIterator<T> getInstance() {
//noinspection unchecked
return INSTANCE;
}
public boolean hasNext() {
return false;
}

View File

@@ -34,18 +34,15 @@ import java.util.List;
/**
* {@link VcsDataKeys#VCS_REVISION_NUMBERS}
*/
public class VcsRevisionNumberArrayRule implements GetDataRule {
@Nullable
final class VcsRevisionNumberArrayRule implements GetDataRule {
@Override
public Object getData(@NotNull DataProvider dataProvider) {
public @Nullable Object getData(@NotNull DataProvider dataProvider) {
List<VcsRevisionNumber> revisionNumbers = getRevisionNumbers(dataProvider);
return !ContainerUtil.isEmpty(revisionNumbers) ? revisionNumbers.toArray(new VcsRevisionNumber[0]) : null;
}
@Nullable
public List<VcsRevisionNumber> getRevisionNumbers(@NotNull DataProvider dataProvider) {
public @Nullable List<VcsRevisionNumber> getRevisionNumbers(@NotNull DataProvider dataProvider) {
VcsRevisionNumber revisionNumber = VcsDataKeys.VCS_REVISION_NUMBER.getData(dataProvider);
if (revisionNumber != null) {
return Collections.singletonList(revisionNumber);
@@ -73,8 +70,7 @@ public class VcsRevisionNumberArrayRule implements GetDataRule {
return null;
}
private static class CommittedChangeListToRevisionNumberFunction implements Function<CommittedChangeList, VcsRevisionNumber> {
private static final class CommittedChangeListToRevisionNumberFunction implements Function<CommittedChangeList, VcsRevisionNumber> {
private static final CommittedChangeListToRevisionNumberFunction INSTANCE = new CommittedChangeListToRevisionNumberFunction();
/**
@@ -90,8 +86,7 @@ public class VcsRevisionNumberArrayRule implements GetDataRule {
}
}
private static class FileRevisionToRevisionNumberFunction implements Function<VcsFileRevision, VcsRevisionNumber> {
private static final class FileRevisionToRevisionNumberFunction implements Function<VcsFileRevision, VcsRevisionNumber> {
private static final FileRevisionToRevisionNumberFunction INSTANCE = new FileRevisionToRevisionNumberFunction();
@Override

View File

@@ -9,21 +9,18 @@ import org.jetbrains.annotations.PropertyKey;
import java.util.function.Supplier;
public final class VcsLogBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.VcsLogBundle";
private static final VcsLogBundle INSTANCE = new VcsLogBundle();
public final class VcsLogBundle {
private static final @NonNls String BUNDLE = "messages.VcsLogBundle";
private static final DynamicBundle INSTANCE = new DynamicBundle(VcsLogBundle.class, BUNDLE);
private VcsLogBundle() {
super(BUNDLE);
}
@NotNull
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@NotNull
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}
}

Some files were not shown because too many files have changed in this diff Show More