GitOrigin-RevId: 1a171a3b2ca8473f0cf2d89520f492f0e9233a52
This commit is contained in:
Vladimir Krivosheev
2024-12-26 14:39:00 +01:00
committed by intellij-monorepo-bot
parent 29e18c34d7
commit c3d02ef03e
848 changed files with 4157 additions and 9592 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.intellilang.instrumentation;
import org.jetbrains.annotations.NotNull;
@@ -12,9 +12,8 @@ import java.util.List;
* @author Eugene Zhuravlev
*/
public class PatternValidatorBuilderService extends BuilderService{
@NotNull
@Override
public List<? extends ModuleLevelBuilder> createModuleLevelBuilders() {
public @NotNull List<? extends ModuleLevelBuilder> createModuleLevelBuilders() {
return Collections.singletonList(new PatternValidatorBuilder());
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.intellilang.model;
import org.jetbrains.annotations.NotNull;
@@ -13,8 +13,7 @@ public abstract class JpsIntelliLangExtensionService {
return JpsServiceManager.getInstance().getService(JpsIntelliLangExtensionService.class);
}
@NotNull
public abstract JpsIntelliLangConfiguration getConfiguration(@NotNull JpsGlobal project);
public abstract @NotNull JpsIntelliLangConfiguration getConfiguration(@NotNull JpsGlobal project);
public abstract void setConfiguration(@NotNull JpsGlobal project, @NotNull JpsIntelliLangConfiguration extension);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.intellilang.model.impl;
import org.jetbrains.annotations.NotNull;
@@ -17,21 +17,18 @@ public class JpsIntelliLangConfigurationImpl extends JpsElementBase<JpsIntelliLa
private String myPatternAnnotationClassName = "org.intellij.lang.annotations.Pattern";
private InstrumentationType myInstrumentationType = InstrumentationType.ASSERT;
@NotNull
@Override
public JpsIntelliLangConfigurationImpl createCopy() {
public @NotNull JpsIntelliLangConfigurationImpl createCopy() {
return new JpsIntelliLangConfigurationImpl();
}
@NotNull
@Override
public String getPatternAnnotationClass() {
public @NotNull String getPatternAnnotationClass() {
return myPatternAnnotationClassName;
}
@NotNull
@Override
public InstrumentationType getInstrumentationType() {
public @NotNull InstrumentationType getInstrumentationType() {
return myInstrumentationType;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.intellilang.model.impl;
import org.jetbrains.annotations.NotNull;
@@ -10,9 +10,8 @@ import org.jetbrains.jps.model.JpsGlobal;
* @author Eugene Zhuravlev
*/
public class JpsIntelliLangExtensionServiceImpl extends JpsIntelliLangExtensionService {
@NotNull
@Override
public JpsIntelliLangConfiguration getConfiguration(@NotNull JpsGlobal global) {
public @NotNull JpsIntelliLangConfiguration getConfiguration(@NotNull JpsGlobal global) {
JpsIntelliLangConfiguration configuration = global.getContainer().getChild(JpsIntelliLangConfigurationImpl.ROLE);
return configuration != null ? configuration : new JpsIntelliLangConfigurationImpl();
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang;
@@ -29,7 +29,7 @@ public class AdvancedSettingsUI implements SearchableConfigurable {
private AdvancedSettingsPanel myPanel;
private final Project myProject;
public AdvancedSettingsUI(@NotNull final Project project, Configuration configuration) {
public AdvancedSettingsUI(final @NotNull Project project, Configuration configuration) {
myProject = project;
myConfiguration = configuration.getAdvancedConfiguration();
}
@@ -70,9 +70,8 @@ public class AdvancedSettingsUI implements SearchableConfigurable {
return "reference.settings.injection.advanced";
}
@NotNull
@Override
public String getId() {
public @NotNull String getId() {
return "IntelliLang.Advanced";
}
@@ -188,8 +187,7 @@ public class AdvancedSettingsUI implements SearchableConfigurable {
return false;
}
@NotNull
private Configuration.InstrumentationType getInstrumentation() {
private @NotNull Configuration.InstrumentationType getInstrumentation() {
if (myNoInstrumentation.isSelected()) return Configuration.InstrumentationType.NONE;
if (myAssertInstrumentation.isSelected()) return Configuration.InstrumentationType.ASSERT;
if (myExceptionInstrumentation.isSelected()) return Configuration.InstrumentationType.EXCEPTION;
@@ -209,8 +207,7 @@ public class AdvancedSettingsUI implements SearchableConfigurable {
myConfiguration.setSourceModificationAllowed(mySourceModificationAllowedCheckBox.isSelected());
}
@NotNull
private Configuration.DfaOption getDfaOption() {
private @NotNull Configuration.DfaOption getDfaOption() {
if (myDfaOff.isSelected()) return Configuration.DfaOption.OFF;
if (myAnalyzeReferences.isSelected()) return Configuration.DfaOption.RESOLVE;
if (myLookForAssignments.isSelected()) return Configuration.DfaOption.ASSIGNMENTS;
@@ -232,7 +229,7 @@ public class AdvancedSettingsUI implements SearchableConfigurable {
mySourceModificationAllowedCheckBox.setSelected(myConfiguration.isSourceModificationAllowed());
}
private void setDfaOption(@NotNull final Configuration.DfaOption dfaOption) {
private void setDfaOption(final @NotNull Configuration.DfaOption dfaOption) {
switch (dfaOption) {
case OFF -> myDfaOff.setSelected(true);
case RESOLVE -> myAnalyzeReferences.setSelected(true);

View File

@@ -36,18 +36,15 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
public final class MethodParameterInjection extends BaseInjection {
@NotNull
private String myClassName = "";
private @NotNull String myClassName = "";
@NotNull
private final Map<String, MethodInfo> myParameterMap = new HashMap<>();
private final @NotNull Map<String, MethodInfo> myParameterMap = new HashMap<>();
public MethodParameterInjection() {
super(JavaLanguageInjectionSupport.JAVA_SUPPORT_ID);
}
@NotNull
public String getClassName() {
public @NotNull String getClassName() {
return myClassName;
}
@@ -152,8 +149,7 @@ public final class MethodParameterInjection extends BaseInjection {
}
@Override
@NotNull
public String getDisplayName() {
public @NotNull String getDisplayName() {
final String className = getClassName();
if (StringUtil.isEmpty(className)) return IntelliLangBundle.message("method.param.injection.unnamed.placeholder");
MethodInfo singleInfo = null;
@@ -175,7 +171,7 @@ public final class MethodParameterInjection extends BaseInjection {
}
public static String fixSignature(final String signature, final boolean parameterNames) {
@NonNls final StringBuilder sb = new StringBuilder();
final @NonNls StringBuilder sb = new StringBuilder();
final StringTokenizer st = new StringTokenizer(signature, "(,)");
for (int i = 0; st.hasMoreTokens(); i++) {
final String token = st.nextToken().trim();
@@ -203,8 +199,7 @@ public final class MethodParameterInjection extends BaseInjection {
return sb.toString();
}
@NotNull
private static String buildSignature(@NotNull PsiMethod method) {
private static @NotNull String buildSignature(@NotNull PsiMethod method) {
return PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS,
PsiFormatUtil.SHOW_TYPE | PsiFormatUtil.SHOW_FQ_CLASS_NAMES | PsiFormatUtil.SHOW_RAW_TYPE);
}
@@ -214,11 +209,11 @@ public final class MethodParameterInjection extends BaseInjection {
return new MethodInfo(signature, new boolean[method.getParameterList().getParametersCount()], false);
}
public static boolean isInjectable(@Nullable final PsiType type, final Project project) {
public static boolean isInjectable(final @Nullable PsiType type, final Project project) {
if (type == null) return false;
if (type instanceof PsiPrimitiveType) return false;
if (project.isDefault()) {
@NonNls final String text = type.getPresentableText();
final @NonNls String text = type.getPresentableText();
return text.equals("java.lang.String") || text.equals("java.lang.String...") || text.equals("java.lang.String[]");
}
else {
@@ -226,8 +221,7 @@ public final class MethodParameterInjection extends BaseInjection {
}
}
@Nullable
public static PsiMethod makeMethod(final Project project, final String signature) {
public static @Nullable PsiMethod makeMethod(final Project project, final String signature) {
if (StringUtil.isEmpty(signature)) return null;
try {
return JavaPsiFacade.getInstance(project).getElementFactory().
@@ -240,7 +234,7 @@ public final class MethodParameterInjection extends BaseInjection {
}
public static String getParameterTypesString(final String signature) {
@NonNls final StringBuilder sb = new StringBuilder();
final @NonNls StringBuilder sb = new StringBuilder();
final StringTokenizer st = new StringTokenizer(signature, "(,)");
for (int i = 0; st.hasMoreTokens(); i++) {
final String token = st.nextToken().trim();
@@ -284,14 +278,14 @@ public final class MethodParameterInjection extends BaseInjection {
boolean returnFlag;
public MethodInfo(@NotNull final String methodSignature, final boolean @NotNull [] paramFlags, final boolean returnFlag) {
public MethodInfo(final @NotNull String methodSignature, final boolean @NotNull [] paramFlags, final boolean returnFlag) {
this.methodSignature = methodSignature;
this.paramFlags = paramFlags;
this.returnFlag = returnFlag;
methodName = calcMethodName(methodSignature);
}
public MethodInfo(@NotNull final String methodSignature, @NotNull final String paramFlags) {
public MethodInfo(final @NotNull String methodSignature, final @NotNull String paramFlags) {
this.methodSignature = methodSignature;
final Pair<boolean[], Boolean> flags = parseFlags(paramFlags);
returnFlag = flags.second.booleanValue();
@@ -299,13 +293,11 @@ public final class MethodParameterInjection extends BaseInjection {
methodName = calcMethodName(methodSignature);
}
@NotNull
public String getMethodSignature() {
public @NotNull String getMethodSignature() {
return methodSignature;
}
@NotNull
public String getMethodName() {
public @NotNull String getMethodName() {
return methodName;
}
@@ -340,8 +332,7 @@ public final class MethodParameterInjection extends BaseInjection {
return Pair.create(result, returnFlag);
}
@NonNls
private static String calcMethodName(final String methodSignature) {
private static @NonNls String calcMethodName(final String methodSignature) {
final String s = StringUtil.split(methodSignature, "(").get(0);
return s.length() == 0 ? "<none>" : s;
}

View File

@@ -74,7 +74,7 @@ public final class MethodParameterPanel extends AbstractInjectionPanel<MethodPar
final Document document = PsiUtilEx.createDocument(s, project);
document.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(@NotNull final DocumentEvent e) {
public void documentChanged(final @NotNull DocumentEvent e) {
updateParamTree();
updateInjectionPanelTree();
}
@@ -121,7 +121,7 @@ public final class MethodParameterPanel extends AbstractInjectionPanel<MethodPar
});
new AnAction(CommonBundle.message("action.text.toggle")) {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
performToggleAction();
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0)), myParamsTable);
@@ -148,8 +148,7 @@ public final class MethodParameterPanel extends AbstractInjectionPanel<MethodPar
myParamsTable.updateUI();
}
@Nullable
private PsiType getClassType() {
private @Nullable PsiType getClassType() {
final Document document = myClassField.getEditorTextField().getDocument();
final PsiDocumentManager dm = PsiDocumentManager.getInstance(myProject);
dm.commitDocument(document);
@@ -275,8 +274,7 @@ public final class MethodParameterPanel extends AbstractInjectionPanel<MethodPar
myAdvancedPanel = new AdvancedPanel(myProject, myOrigInjection);
}
@Nullable
private Boolean isNodeSelected(final DefaultMutableTreeNode o) {
private @Nullable Boolean isNodeSelected(final DefaultMutableTreeNode o) {
final Object userObject = o.getUserObject();
if (userObject instanceof PsiMethod method) {
return MethodParameterInjection.isInjectable(method.getReturnType(), method.getProject()) ? myData.get(method).isReturnFlag() : null;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject.java;
import com.intellij.ide.highlighter.JavaFileType;
@@ -9,7 +9,10 @@ import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.searches.AnnotatedElementsSearch;
import com.intellij.psi.search.searches.AnnotatedElementsSearch.Parameters;
import com.intellij.psi.util.*;
import com.intellij.psi.util.CachedValue;
import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.util.PatternValuesIndex;
import com.intellij.util.containers.ContainerUtil;
import org.intellij.plugins.intelliLang.Configuration;
@@ -47,8 +50,7 @@ public final class InjectionCache {
}, false);
}
@NotNull
private Set<String> collectMethodNamesWithLanguage(String annotationClassName) {
private @NotNull Set<String> collectMethodNamesWithLanguage(String annotationClassName) {
GlobalSearchScope allScope = GlobalSearchScope.allScope(myProject);
// todo use allScope once Kotlin support becomes fast enough (https://youtrack.jetbrains.com/issue/KT-13734)

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject.java;
import com.intellij.codeInsight.AnnotationUtil;
@@ -58,15 +58,14 @@ import static org.intellij.plugins.intelliLang.inject.config.MethodParameterInje
* @author Gregory.Shrago
*/
public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectionSupport {
@NonNls public static final String JAVA_SUPPORT_ID = "java";
public static final @NonNls String JAVA_SUPPORT_ID = "java";
private static boolean isMine(final PsiLanguageInjectionHost psiElement) {
return PsiUtilEx.isStringOrCharacterLiteral(psiElement) || psiElement instanceof PsiFragment;
}
@Override
@NotNull
public String getId() {
public @NotNull String getId() {
return JAVA_SUPPORT_ID;
}
@@ -85,9 +84,8 @@ public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectio
return host instanceof PsiLiteralExpression || host instanceof PsiFragment;
}
@Nullable
@Override
public BaseInjection findCommentInjection(@NotNull PsiElement host, @Nullable Ref<? super PsiElement> commentRef) {
public @Nullable BaseInjection findCommentInjection(@NotNull PsiElement host, @Nullable Ref<? super PsiElement> commentRef) {
PsiFile containingFile = host.getContainingFile();
boolean compiled = containingFile != null && containingFile.getOriginalFile() instanceof PsiCompiledFile;
return compiled ? null : super.findCommentInjection(host, commentRef);
@@ -163,7 +161,7 @@ public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectio
}
private static boolean doInjectInJava(final Project project,
@NotNull final PsiElement psiElement,
final @NotNull PsiElement psiElement,
PsiLanguageInjectionHost host,
final String languageId) {
PsiElement target = ContextComputationProcessor.getTopLevelInjectionTarget(psiElement);
@@ -221,8 +219,8 @@ public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectio
}
public static boolean doAddLanguageAnnotation(@NotNull Project project,
@Nullable final PsiModifierListOwner modifierListOwner,
@NotNull final PsiLanguageInjectionHost host,
final @Nullable PsiModifierListOwner modifierListOwner,
final @NotNull PsiLanguageInjectionHost host,
final String languageId,
Processor<? super PsiLanguageInjectionHost> annotationFixer) {
if (modifierListOwner == null) return false;
@@ -276,10 +274,10 @@ public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectio
return true;
}
public static boolean doInjectInJavaMethod(@NotNull final Project project,
@Nullable final PsiMethod psiMethod,
public static boolean doInjectInJavaMethod(final @NotNull Project project,
final @Nullable PsiMethod psiMethod,
final int parameterIndex,
@NotNull PsiLanguageInjectionHost host, @NotNull final String languageId) {
@NotNull PsiLanguageInjectionHost host, final @NotNull String languageId) {
if (psiMethod == null) return false;
if (parameterIndex < -1) return false;
if (parameterIndex >= psiMethod.getParameterList().getParametersCount()) return false;
@@ -301,10 +299,9 @@ public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectio
return true;
}
@NotNull
public static MethodParameterInjection makeParameterInjection(@NotNull PsiMethod psiMethod,
int parameterIndex,
@NotNull String languageId) {
public static @NotNull MethodParameterInjection makeParameterInjection(@NotNull PsiMethod psiMethod,
int parameterIndex,
@NotNull String languageId) {
final PsiClass containingClass = psiMethod.getContainingClass();
assert containingClass != null;
final String className = containingClass.getQualifiedName();
@@ -329,8 +326,7 @@ public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectio
return idx < 0? -2 : idx;
}
@Nullable
static PsiMethod findPsiMethod(final PsiElement parent) {
static @Nullable PsiMethod findPsiMethod(final PsiElement parent) {
if (parent instanceof PsiNameValuePair) {
final PsiAnnotation annotation = PsiTreeUtil.getParentOfType(parent, PsiAnnotation.class);
if (annotation != null) {
@@ -535,7 +531,7 @@ public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectio
new AnAction(IntelliLangBundle.message("java.parameter"), null,
IconManager.getInstance().getPlatformIcon(com.intellij.ui.PlatformIcons.Parameter)) {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
final BaseInjection injection = showInjectionUI(project, new MethodParameterInjection());
if (injection != null) consumer.consume(injection);
}
@@ -547,7 +543,7 @@ public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectio
public AnAction createEditAction(final Project project, final Factory<? extends BaseInjection> producer) {
return new AnAction() {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
final BaseInjection originalInjection = producer.create();
final MethodParameterInjection injection = createFrom(project, originalInjection, null, false);
final boolean mergeEnabled = !project.isInitialized() ||
@@ -561,7 +557,7 @@ public final class JavaLanguageInjectionSupport extends AbstractLanguageInjectio
};
}
private final static Pattern ourPresentationPattern = Pattern.compile("(.+)(\\(\\S+(?:\\.\\S+)+\\))");
private static final Pattern ourPresentationPattern = Pattern.compile("(.+)(\\(\\S+(?:\\.\\S+)+\\))");
@Override
public void setupPresentation(final BaseInjection injection, final SimpleColoredText presentation, final boolean isSelected) {
final Matcher matcher = ourPresentationPattern.matcher(injection.getDisplayName());

View File

@@ -43,7 +43,7 @@ public final class LanguageReferenceProvider extends PsiReferenceContributor {
new PatternCondition<>(
"isLanguageAnnotation") {
@Override
public boolean accepts(@NotNull final String s, final ProcessingContext context) {
public boolean accepts(final @NotNull String s, final ProcessingContext context) {
return Objects.equals(configuration.getAdvancedConfiguration().getLanguageAnnotationClass(), s);
}
}), "value"), new UastInjectionHostReferenceProvider() {
@@ -62,7 +62,7 @@ public final class LanguageReferenceProvider extends PsiReferenceContributor {
}, PsiReferenceRegistrar.DEFAULT_PRIORITY);
registrar.registerReferenceProvider(literalExpression().with(new PatternCondition<>("isStringLiteral") {
@Override
public boolean accepts(@NotNull final PsiLiteralExpression expression, final ProcessingContext context) {
public boolean accepts(final @NotNull PsiLiteralExpression expression, final ProcessingContext context) {
return PsiUtilEx.isStringOrCharacterLiteral(expression);
}
}), new PsiReferenceProvider() {

View File

@@ -55,14 +55,12 @@ final class RegExpEnumReference extends StringLiteralReference {
}
@Override
@Nullable
public PsiElement resolve() {
public @Nullable PsiElement resolve() {
final Set<String> values = getEnumValues();
return values != null ? values.contains(getValue()) ? myValue : null : null;
}
@Nullable
private Set<String> getEnumValues() {
private @Nullable Set<String> getEnumValues() {
return RegExpUtil.getEnumValues(myValue.getProject(), myPattern);
}
}

View File

@@ -33,8 +33,7 @@ final class RegExpUtil {
private RegExpUtil() {
}
@Nullable
public static Set<String> getEnumValues(Project project, @NotNull String regExp) {
public static @Nullable Set<String> getEnumValues(Project project, @NotNull String regExp) {
final PsiFileFactory factory = PsiFileFactory.getInstance(project);
final PsiFile file = factory.createFileFromText("dummy.regexp", RegExpFileType.INSTANCE, regExp);
final RegExpPattern pattern = (RegExpPattern)file.getFirstChild();

View File

@@ -26,7 +26,6 @@ import com.intellij.openapi.util.text.HtmlChunk;
import com.intellij.psi.*;
import com.intellij.psi.util.JavaPsiStringTemplateUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.SmartList;
import com.siyeh.ig.psiutils.CollectionUtils;
@@ -55,8 +54,7 @@ public class LanguageMismatch extends LocalInspectionTool {
}
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new JavaElementVisitor() {
final Pair<String, ? extends Set<String>> annotationName = Configuration.getProjectInstance(holder.getProject()).getAdvancedConfiguration().getLanguageAnnotationPair();

View File

@@ -29,8 +29,7 @@ import org.jetbrains.annotations.NotNull;
public class UnknownLanguageID extends LocalInspectionTool {
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new JavaElementVisitor() {
final String annotationName = Configuration.getProjectInstance(holder.getProject()).getAdvancedConfiguration().getLanguageAnnotationClass();

View File

@@ -42,9 +42,7 @@ public class PatternAnnotationNotApplicable extends AbstractAnnotationNotApplica
}
@Override
@NotNull
@NonNls
public String getShortName() {
public @NotNull @NonNls String getShortName() {
return "PatternNotApplicable";
}
}

View File

@@ -32,8 +32,7 @@ import java.util.Set;
public class PatternOverriddenByNonAnnotatedMethod extends LocalInspectionTool {
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new JavaElementVisitor() {
final Pair<String, ? extends Set<String>> annotationName =
Configuration.getProjectInstance(holder.getProject()).getAdvancedConfiguration().getPatternAnnotationPair();

View File

@@ -59,8 +59,7 @@ public class PatternValidator extends LocalInspectionTool {
}
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new JavaElementVisitor() {
@Override

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.util;
import com.intellij.codeInsight.AnnotationUtil;
@@ -20,8 +20,7 @@ public abstract class AbstractAnnotationNotApplicableInspection extends LocalIns
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new JavaElementVisitor() {
final String annotationName = getAnnotationName(holder.getProject());

View File

@@ -52,8 +52,7 @@ public final class AnnotationUtilEx {
* decides whether to prefer the element a reference expressions resolves to, or the element that is implied by the
* usage context ("expected type").
*/
@Nullable
public static PsiModifierListOwner getAnnotatedElementFor(@Nullable PsiElement element, LookupType type) {
public static @Nullable PsiModifierListOwner getAnnotatedElementFor(@Nullable PsiElement element, LookupType type) {
while (element != null) {
if (type == LookupType.PREFER_DECLARATION || type == LookupType.DECLARATION_ONLY) {
if (element instanceof PsiReferenceExpression) {
@@ -267,8 +266,7 @@ public final class AnnotationUtilEx {
* find the attribute in the supplied list of annotations and calculating the constant value for the first attribute
* it finds.
*/
@Nullable
public static String calcAnnotationValue(PsiAnnotation[] annotation, @NonNls String attr) {
public static @Nullable String calcAnnotationValue(PsiAnnotation[] annotation, @NonNls String attr) {
for (PsiAnnotation psiAnnotation : annotation) {
final String value = calcAnnotationValue(psiAnnotation, attr);
if (value != null) return value;
@@ -276,8 +274,7 @@ public final class AnnotationUtilEx {
return null;
}
@Nullable
public static String calcAnnotationValue(@NotNull PsiAnnotation annotation, @NonNls String attr) {
public static @Nullable String calcAnnotationValue(@NotNull PsiAnnotation annotation, @NonNls String attr) {
PsiElement value = annotation.findAttributeValue(attr);
Object o = CONSTANT_EVALUATION_HELPER.computeConstantExpression(value);
if (o instanceof String) {
@@ -291,7 +288,7 @@ public final class AnnotationUtilEx {
*
* @see AnnotationUtil#getSuperAnnotationOwners(PsiModifierListOwner)
*/
private static PsiAnnotation[] getAnnotations(@NotNull final PsiModifierListOwner listOwner, final boolean inHierarchy) {
private static PsiAnnotation[] getAnnotations(final @NotNull PsiModifierListOwner listOwner, final boolean inHierarchy) {
final PsiModifierList modifierList = listOwner.getModifierList();
if (!inHierarchy) {
return modifierList == null ? PsiAnnotation.EMPTY_ARRAY : modifierList.getAnnotations();

View File

@@ -42,8 +42,7 @@ public final class ContextComputationProcessor {
myEvaluationHelper = new SubstitutedExpressionEvaluationHelper(project);
}
@NotNull
public static List<Object> collectOperands(@NotNull String prefix, String suffix, Ref<? super Boolean> unparsable, PsiElement[] operands) {
public static @NotNull List<Object> collectOperands(@NotNull String prefix, String suffix, Ref<? super Boolean> unparsable, PsiElement[] operands) {
ArrayList<Object> result = new ArrayList<>();
ContextComputationProcessor processor = new ContextComputationProcessor(operands[0].getProject());
addStringFragment(prefix, result);
@@ -113,8 +112,7 @@ public final class ContextComputationProcessor {
}
}
@NotNull
public static PsiElement getTopLevelInjectionTarget(@NotNull PsiElement host) {
public static @NotNull PsiElement getTopLevelInjectionTarget(@NotNull PsiElement host) {
PsiElement target = host;
PsiElement parent = target.getParent();
for (; parent != null; target = parent, parent = target.getParent()) {

View File

@@ -35,8 +35,7 @@ public final class PsiUtilEx {
private PsiUtilEx() {
}
@Nullable
public static PsiParameter getParameterForArgument(PsiElement element) {
public static @Nullable PsiParameter getParameterForArgument(PsiElement element) {
PsiElement p = element.getParent();
if (!(p instanceof PsiExpressionList list)) return null;
PsiElement parent = list.getParent();

View File

@@ -35,20 +35,17 @@ public abstract class StringLiteralReference implements PsiReference {
}
@Override
@NotNull
public PsiElement getElement() {
public @NotNull PsiElement getElement() {
return myValue;
}
@Override
@NotNull
public TextRange getRangeInElement() {
public @NotNull TextRange getRangeInElement() {
return ElementManipulators.getValueTextRange(myValue);
}
@Override
@NotNull
public String getCanonicalText() {
public @NotNull String getCanonicalText() {
return myValue.getText();
}
@@ -67,8 +64,7 @@ public abstract class StringLiteralReference implements PsiReference {
return resolve() == element;
}
@Nullable
protected String getValue() {
protected @Nullable String getValue() {
return (String)myValue.getValue();
}

View File

@@ -159,7 +159,7 @@ public class Configuration extends SimpleModificationTracker implements Persiste
}
@Override
public void loadState(@NotNull final Element element) {
public void loadState(final @NotNull Element element) {
myAdvancedConfiguration.loadState(element);
super.loadState(element);
}
@@ -198,10 +198,8 @@ public class Configuration extends SimpleModificationTracker implements Persiste
return injections;
}
@NotNull
@Override
@Unmodifiable
public List<BaseInjection> getInjections(final String injectorId) {
public @NotNull @Unmodifiable List<BaseInjection> getInjections(final String injectorId) {
return ContainerUtil.concat(myParentConfiguration.getInjections(injectorId), getOwnInjections(injectorId));
}
@@ -219,8 +217,7 @@ public class Configuration extends SimpleModificationTracker implements Persiste
super.invokeAfterReload(runnable);
}
@Unmodifiable
public List<BaseInjection> getOwnInjections(final String injectorId) {
public @Unmodifiable List<BaseInjection> getOwnInjections(final String injectorId) {
return super.getInjections(injectorId);
}
@@ -251,18 +248,18 @@ public class Configuration extends SimpleModificationTracker implements Persiste
OFF, RESOLVE, ASSIGNMENTS, DFA
}
@NonNls public static final String COMPONENT_NAME = "LanguageInjectionConfiguration";
public static final @NonNls String COMPONENT_NAME = "LanguageInjectionConfiguration";
// element names
@NonNls private static final String INSTRUMENTATION_TYPE_NAME = "INSTRUMENTATION";
@NonNls private static final String LANGUAGE_ANNOTATION_NAME = "LANGUAGE_ANNOTATION";
@NonNls private static final String PATTERN_ANNOTATION_NAME = "PATTERN_ANNOTATION";
@NonNls private static final String SUBST_ANNOTATION_NAME = "SUBST_ANNOTATION";
@NonNls private static final String RESOLVE_REFERENCES = "RESOLVE_REFERENCES";
@NonNls private static final String LOOK_FOR_VAR_ASSIGNMENTS = "LOOK_FOR_VAR_ASSIGNMENTS";
@NonNls private static final String USE_DFA_IF_AVAILABLE = "USE_DFA_IF_AVAILABLE";
@NonNls private static final String INCLUDE_UNCOMPUTABLES_AS_LITERALS = "INCLUDE_UNCOMPUTABLES_AS_LITERALS";
@NonNls private static final String SOURCE_MODIFICATION_ALLOWED = "SOURCE_MODIFICATION_ALLOWED";
private static final @NonNls String INSTRUMENTATION_TYPE_NAME = "INSTRUMENTATION";
private static final @NonNls String LANGUAGE_ANNOTATION_NAME = "LANGUAGE_ANNOTATION";
private static final @NonNls String PATTERN_ANNOTATION_NAME = "PATTERN_ANNOTATION";
private static final @NonNls String SUBST_ANNOTATION_NAME = "SUBST_ANNOTATION";
private static final @NonNls String RESOLVE_REFERENCES = "RESOLVE_REFERENCES";
private static final @NonNls String LOOK_FOR_VAR_ASSIGNMENTS = "LOOK_FOR_VAR_ASSIGNMENTS";
private static final @NonNls String USE_DFA_IF_AVAILABLE = "USE_DFA_IF_AVAILABLE";
private static final @NonNls String INCLUDE_UNCOMPUTABLES_AS_LITERALS = "INCLUDE_UNCOMPUTABLES_AS_LITERALS";
private static final @NonNls String SOURCE_MODIFICATION_ALLOWED = "SOURCE_MODIFICATION_ALLOWED";
private final Map<String, List<BaseInjection>> myInjections =
ConcurrentFactoryMap.createMap(key -> ContainerUtil.createLockFreeCopyOnWriteList());
@@ -291,7 +288,7 @@ public class Configuration extends SimpleModificationTracker implements Persiste
}
@Override
public void loadState(@NotNull final Element element) {
public void loadState(final @NotNull Element element) {
myInjections.clear();
List<Element> injectionElements = element.getChildren("injection");
@@ -421,8 +418,7 @@ public class Configuration extends SimpleModificationTracker implements Persiste
return myInjectionsById.getValue().get(languageId);
}
@Nullable
public static Configuration load(final InputStream is) throws IOException, JDOMException {
public static @Nullable Configuration load(final InputStream is) throws IOException, JDOMException {
final List<Element> elements = new ArrayList<>();
final Element rootElement = JDOMUtil.load(is);
final Element state;
@@ -497,8 +493,7 @@ public class Configuration extends SimpleModificationTracker implements Persiste
incModificationCount();
}
@Nullable
public BaseInjection findExistingInjection(@NotNull final BaseInjection injection) {
public @Nullable BaseInjection findExistingInjection(final @NotNull BaseInjection injection) {
final List<BaseInjection> list = getInjections(injection.getSupportId());
for (BaseInjection cur : list) {
if (cur.intersectsWith(injection)) return cur;
@@ -546,9 +541,7 @@ public class Configuration extends SimpleModificationTracker implements Persiste
/**
* @param injectorId see {@link LanguageInjectionSupport#getId()}
*/
@NotNull
@Unmodifiable
public List<BaseInjection> getInjections(final String injectorId) {
public @NotNull @Unmodifiable List<BaseInjection> getInjections(final String injectorId) {
return Collections.unmodifiableList(myInjections.get(injectorId));
}
@@ -647,12 +640,12 @@ public class Configuration extends SimpleModificationTracker implements Persiste
public static class AdvancedConfiguration {
// runtime pattern validation instrumentation
@NotNull private InstrumentationType myInstrumentationType = InstrumentationType.ASSERT;
private @NotNull InstrumentationType myInstrumentationType = InstrumentationType.ASSERT;
// annotation class names
@NotNull private String myLanguageAnnotation;
@NotNull private String myPatternAnnotation;
@NotNull private String mySubstAnnotation;
private @NotNull String myLanguageAnnotation;
private @NotNull String myPatternAnnotation;
private @NotNull String mySubstAnnotation;
private boolean myIncludeUncomputablesAsLiterals;
private DfaOption myDfaOption = DfaOption.RESOLVE;
@@ -730,12 +723,11 @@ public class Configuration extends SimpleModificationTracker implements Persiste
myIncludeUncomputablesAsLiterals = flag;
}
@NotNull
public DfaOption getDfaOption() {
public @NotNull DfaOption getDfaOption() {
return myDfaOption;
}
public void setDfaOption(@NotNull final DfaOption dfaOption) {
public void setDfaOption(final @NotNull DfaOption dfaOption) {
myDfaOption = dfaOption;
}

View File

@@ -54,8 +54,8 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.*;
import java.util.List;
import java.util.function.Supplier;
/**
@@ -160,7 +160,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
com.intellij.util.PlatformIcons.SELECT_ALL_ICON) {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
performSelectedInjectionsEnabled(true);
}
});
@@ -169,7 +169,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
com.intellij.util.PlatformIcons.UNSELECT_ALL_ICON) {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
performSelectedInjectionsEnabled(false);
}
});
@@ -187,7 +187,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
}
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
performToggleAction();
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0)), myInjectionsTable);
@@ -205,7 +205,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
}
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
final List<InjInfo> injections = getSelectedInjections();
final CfgInfo cfg = getTargetCfgInfo(injections);
if (cfg == null) return;
@@ -220,8 +220,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
TableUtil.selectRows(myInjectionsTable, selectedRows);
}
@Nullable
private CfgInfo getTargetCfgInfo(final List<InjInfo> injections) {
private @Nullable CfgInfo getTargetCfgInfo(final List<InjInfo> injections) {
CfgInfo cfg = null;
for (InjInfo info : injections) {
if (info.bundled) {
@@ -247,7 +246,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
AllIcons.Actions.Install) {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
doImportAction(e.getDataContext());
updateCountLabel();
}
@@ -257,7 +256,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
AllIcons.ToolbarDecorator.Export) {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
List<BaseInjection> injections = getInjectionList(getSelectedInjections());
VirtualFileWrapper wrapper = FileChooserFactory.getInstance()
.createSaveFileDialog(
@@ -317,8 +316,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
}
}
@Nullable
private AnAction getEditAction() {
private @Nullable AnAction getEditAction() {
final InjInfo info = getSelectedInjection();
final String supportId = info == null? null : info.injection.getSupportId();
return supportId == null? null : myEditActions.get(supportId);
@@ -351,9 +349,8 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
return configurables.toArray(new Configurable[0]);
}
@NotNull
@Override
public String getId() {
public @NotNull String getId() {
return "IntelliLang.Configuration";
}
@@ -439,8 +436,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
return toRemove;
}
@Nullable
private InjInfo getSelectedInjection() {
private @Nullable InjInfo getSelectedInjection() {
final int row = myInjectionsTable.getSelectedRow();
return row < 0? null : myInjectionsTable.getItems().get(myInjectionsTable.convertRowIndexToModel(row));
}
@@ -454,8 +450,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
}
@Override
@Nls
public String getDisplayName() {
public @Nls String getDisplayName() {
return IntelliLangBundle.message("configurable.InjectionsSettingsUI.display.name");
}
@@ -861,8 +856,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
}
}
@Unmodifiable
private static List<InjInfo> getInjInfoList(final CfgInfo[] infos) {
private static @Unmodifiable List<InjInfo> getInjInfoList(final CfgInfo[] infos) {
return ContainerUtil.concat(infos, cfgInfo -> cfgInfo.injectionInfos);
}
@@ -880,7 +874,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
};
}
private static abstract class MyAction extends DumbAwareAction {
private abstract static class MyAction extends DumbAwareAction {
MyAction(@NotNull Supplier<@NlsActions.ActionText String> dynamicText,
@NotNull Supplier<@NlsActions.ActionDescription String> dynamicDescription,
@Nullable Icon icon) {

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject;
@@ -66,9 +52,8 @@ public abstract class AbstractLanguageInjectionSupport extends LanguageInjection
}
@Deprecated(forRemoval = true)
@Nullable
@Override
public BaseInjection findCommentInjection(@NotNull PsiElement host, @Nullable Ref<? super PsiElement> commentRef) {
public @Nullable BaseInjection findCommentInjection(@NotNull PsiElement host, @Nullable Ref<? super PsiElement> commentRef) {
return InjectorUtils.findCommentInjection(host, "comment", commentRef);
}
@@ -142,8 +127,7 @@ public abstract class AbstractLanguageInjectionSupport extends LanguageInjection
return action;
}
@Nullable
protected static BaseInjection showDefaultInjectionUI(final Project project, BaseInjection injection) {
protected static @Nullable BaseInjection showDefaultInjectionUI(final Project project, BaseInjection injection) {
final BaseInjectionPanel panel = new BaseInjectionPanel(injection, project);
panel.reset();
String dimensionServiceKey = "#org.intellij.plugins.intelliLang.inject.config.ui.BaseInjectionDialog";
@@ -186,8 +170,7 @@ public abstract class AbstractLanguageInjectionSupport extends LanguageInjection
return obj instanceof LanguageInjectionSupport && getId().equals(((LanguageInjectionSupport)obj).getId());
}
@Nullable
public String getHelpId() {
public @Nullable String getHelpId() {
return null;
}
}

View File

@@ -15,9 +15,8 @@ import org.jetbrains.annotations.Nullable;
*/
final class CommentLanguageInjector implements LanguageInjectionContributor {
@Nullable
@Override
public Injection getInjection(@NotNull PsiElement context) {
public @Nullable Injection getInjection(@NotNull PsiElement context) {
if (!(context instanceof PsiLanguageInjectionHost host) || context instanceof PsiComment) return null;
if (!host.isValidHost()) return null;

View File

@@ -26,14 +26,12 @@ import java.util.Collections;
final class EditInjectionSettingsAction implements IntentionAction, LowPriorityAction {
@Override
@NotNull
public String getText() {
public @NotNull String getText() {
return IntelliLangBundle.message("intention.name.language.injection.settings");
}
@Override
@NotNull
public String getFamilyName() {
public @NotNull String getFamilyName() {
return IntelliLangBundle.message("intention.family.name.edit.injection.settings");
}
@@ -47,7 +45,7 @@ final class EditInjectionSettingsAction implements IntentionAction, LowPriorityA
}
@Override
public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
public void invoke(final @NotNull Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
ApplicationManager.getApplication().runReadAction(() -> invokeImpl(project, editor, file));
}

View File

@@ -79,8 +79,7 @@ public final class InjectLanguageAction implements IntentionAction, LowPriorityA
});
};
@NotNull
public static List<Injectable> getAllInjectables() {
public static @NotNull List<Injectable> getAllInjectables() {
Language[] languages = InjectedLanguage.getAvailableLanguages();
List<Injectable> list = new ArrayList<>();
for (Language language : languages) {
@@ -92,14 +91,12 @@ public final class InjectLanguageAction implements IntentionAction, LowPriorityA
}
@Override
@NotNull
public String getText() {
public @NotNull String getText() {
return IntelliLangBundle.message("intelliLang.inject.language.action.text");
}
@Override
@NotNull
public String getFamilyName() {
public @NotNull String getFamilyName() {
return getText();
}
@@ -123,9 +120,8 @@ public final class InjectLanguageAction implements IntentionAction, LowPriorityA
return new IntentionPreviewInfo.Html(IntelliLangBundle.message("intelliLang.inject.language.action.preview", text));
}
@Nullable
private static PsiLanguageInjectionHost findInjectionHost(@NotNull Editor editor,
@NotNull PsiFile file) {
private static @Nullable PsiLanguageInjectionHost findInjectionHost(@NotNull Editor editor,
@NotNull PsiFile file) {
if (editor instanceof EditorWindow) return null;
int offset = editor.getCaretModel().getOffset();
@@ -311,8 +307,7 @@ public final class InjectLanguageAction implements IntentionAction, LowPriorityA
myFix = fix;
}
@NlsContexts.PopupContent
public String getText() {
public @NlsContexts.PopupContent String getText() {
return myText;
}

View File

@@ -28,12 +28,9 @@ public final class InjectedLanguage {
private static Map<String, Language> ourLanguageCache;
private static int ourLanguageCount;
@NotNull
private final String myID;
@NotNull
private final String myPrefix;
@NotNull
private final String mySuffix;
private final @NotNull String myID;
private final @NotNull String myPrefix;
private final @NotNull String mySuffix;
private final boolean myDynamic;
private InjectedLanguage(@NotNull String id, @NotNull String prefix, @NotNull String suffix, boolean dynamic) {
@@ -43,23 +40,19 @@ public final class InjectedLanguage {
myDynamic = dynamic;
}
@NotNull
public String getID() {
public @NotNull String getID() {
return myID;
}
@Nullable
public Language getLanguage() {
public @Nullable Language getLanguage() {
return findLanguageById(myID);
}
@NotNull
public String getPrefix() {
public @NotNull String getPrefix() {
return myPrefix;
}
@NotNull
public String getSuffix() {
public @NotNull String getSuffix() {
return mySuffix;
}
@@ -70,8 +63,7 @@ public final class InjectedLanguage {
return myDynamic;
}
@Nullable
public static Language findLanguageById(@Nullable String langID) {
public static @Nullable Language findLanguageById(@Nullable String langID) {
if (langID == null || langID.isEmpty()) {
return null;
}
@@ -128,14 +120,12 @@ public final class InjectedLanguage {
return myID.hashCode();
}
@Nullable
public static InjectedLanguage create(String id) {
public static @Nullable InjectedLanguage create(String id) {
return create(id, "", "", false);
}
@Contract(value = "null, _, _, _ -> null; !null, _, _, _ -> new", pure = true)
@Nullable
public static InjectedLanguage create(@Nullable String id, String prefix, String suffix, boolean isDynamic) {
public static @Nullable InjectedLanguage create(@Nullable String id, String prefix, String suffix, boolean isDynamic) {
return id == null ? null : new InjectedLanguage(id, prefix == null ? "" : prefix, suffix == null ? "" : suffix, isDynamic);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject;
import com.intellij.codeInsight.completion.CompletionUtil;
@@ -50,13 +50,11 @@ public final class InjectorUtils {
private InjectorUtils() {
}
@Nullable
public static Language getLanguage(@NotNull BaseInjection injection) {
public static @Nullable Language getLanguage(@NotNull BaseInjection injection) {
return getLanguageByString(injection.getInjectedLanguageId());
}
@Nullable
public static Language getLanguageByString(@NotNull String languageId) {
public static @Nullable Language getLanguageByString(@NotNull String languageId) {
Language language = InjectedLanguage.findLanguageById(languageId);
if (language != null) return language;
ReferenceInjector injector = ReferenceInjector.findById(languageId);
@@ -172,19 +170,15 @@ public final class InjectorUtils {
}
}
@NotNull
@Unmodifiable
public static Collection<String> getActiveInjectionSupportIds() {
public static @NotNull @Unmodifiable Collection<String> getActiveInjectionSupportIds() {
return ContainerUtil.map(LanguageInjectionSupport.EP_NAME.getExtensionList(), LanguageInjectionSupport::getId);
}
@NotNull
public static Collection<LanguageInjectionSupport> getActiveInjectionSupports() {
public static @NotNull Collection<LanguageInjectionSupport> getActiveInjectionSupports() {
return LanguageInjectionSupport.EP_NAME.getExtensionList();
}
@Nullable
public static LanguageInjectionSupport findInjectionSupport(@NotNull String id) {
public static @Nullable LanguageInjectionSupport findInjectionSupport(@NotNull String id) {
if (TemporaryPlacesRegistry.SUPPORT_ID.equals(id)) return new TemporaryLanguageInjectionSupport();
for (LanguageInjectionSupport support : LanguageInjectionSupport.EP_NAME.getExtensionList()) {
if (id.equals(support.getId())) return support;
@@ -197,8 +191,7 @@ public final class InjectorUtils {
return support == null ? ArrayUtil.EMPTY_CLASS_ARRAY : support.getPatternClasses();
}
@NotNull
public static LanguageInjectionSupport findNotNullInjectionSupport(@NotNull String id) {
public static @NotNull LanguageInjectionSupport findNotNullInjectionSupport(@NotNull String id) {
LanguageInjectionSupport result = findInjectionSupport(id);
if (result == null) {
throw new IllegalStateException(id + " injector not found");
@@ -206,8 +199,7 @@ public final class InjectorUtils {
return result;
}
@NotNull
public static StringBuilder appendStringPattern(@NotNull StringBuilder sb, @NotNull String prefix, @NotNull String text, @NotNull String suffix) {
public static @NotNull StringBuilder appendStringPattern(@NotNull StringBuilder sb, @NotNull String prefix, @NotNull String text, @NotNull String suffix) {
sb.append(prefix).append("string().");
final String[] parts = text.split("[,|\\s]+");
boolean useMatches = false;
@@ -284,13 +276,11 @@ public final class InjectorUtils {
return true;
}
@Nullable
private static CommentInjectionData findCommentInjectionData(@NotNull PsiElement context, @Nullable Ref<? super PsiElement> causeRef) {
private static @Nullable CommentInjectionData findCommentInjectionData(@NotNull PsiElement context, @Nullable Ref<? super PsiElement> causeRef) {
return findCommentInjectionData(context, true, causeRef);
}
@Nullable
public static Pair.NonNull<PsiComment, CommentInjectionData> findClosestCommentInjectionData(@NotNull PsiElement context) {
public static @Nullable Pair.NonNull<PsiComment, CommentInjectionData> findClosestCommentInjectionData(@NotNull PsiElement context) {
PsiFile file = context.getContainingFile();
if (file == null) return null;
TreeMap<TextRange, CommentInjectionData> map = getInjectionMap(file);
@@ -302,8 +292,7 @@ public final class InjectorUtils {
return Pair.createNonNull(psiComment, entry.getValue());
}
@Nullable
public static CommentInjectionData findCommentInjectionData(@NotNull PsiElement context, boolean treeElementsIncludeComment, @Nullable Ref<? super PsiElement> causeRef) {
public static @Nullable CommentInjectionData findCommentInjectionData(@NotNull PsiElement context, boolean treeElementsIncludeComment, @Nullable Ref<? super PsiElement> causeRef) {
PsiElement target = CompletionUtil.getOriginalOrSelf(context);
Pair.NonNull<PsiComment, CommentInjectionData> pair = findClosestCommentInjectionData(target);
if (pair == null) return null;
@@ -345,10 +334,9 @@ public final class InjectorUtils {
return injectionData;
}
@Nullable
public static BaseInjection findCommentInjection(@NotNull PsiElement context,
@NotNull String supportId,
@Nullable Ref<? super PsiElement> causeRef) {
public static @Nullable BaseInjection findCommentInjection(@NotNull PsiElement context,
@NotNull String supportId,
@Nullable Ref<? super PsiElement> causeRef) {
CommentInjectionData data = findCommentInjectionData(context, causeRef);
if (data == null) return null;
BaseInjection injection = new BaseInjection(supportId);
@@ -359,16 +347,14 @@ public final class InjectorUtils {
return injection;
}
@Nullable
private static TreeMap<TextRange, CommentInjectionData> getInjectionMap(@NotNull final PsiFile file) {
private static @Nullable TreeMap<TextRange, CommentInjectionData> getInjectionMap(final @NotNull PsiFile file) {
return CachedValuesManager.getCachedValue(file, () -> {
TreeMap<TextRange, CommentInjectionData> map = calcInjections(file);
return CachedValueProvider.Result.create(map.isEmpty() ? null : map, file);
});
}
@NotNull
private static TreeMap<TextRange,CommentInjectionData> calcInjections(@NotNull PsiFile file) {
private static @NotNull TreeMap<TextRange,CommentInjectionData> calcInjections(@NotNull PsiFile file) {
final TreeMap<TextRange, CommentInjectionData> injectionMap = new TreeMap<>(RANGE_COMPARATOR);
StringSearcher searcher = new StringSearcher("language=", true, true, false);
@@ -393,8 +379,7 @@ public final class InjectorUtils {
}
private static final Pattern MAP_ENTRY_PATTERN = Pattern.compile("([\\S&&[^=]]+)=(\"(?:[^\"]|\\\\\")*\"|\\S*)");
@NotNull
private static Map<String, String> decodeMap(@NotNull CharSequence charSequence) {
private static @NotNull Map<String, String> decodeMap(@NotNull CharSequence charSequence) {
if (StringUtil.isEmpty(charSequence)) return Collections.emptyMap();
final Matcher matcher = MAP_ENTRY_PATTERN.matcher(charSequence);
final LinkedHashMap<String, String> map = new LinkedHashMap<>();
@@ -405,14 +390,12 @@ public final class InjectorUtils {
return map;
}
@NotNull
private static Supplier<PsiElement> prevWalker(@NotNull PsiElement element, @NotNull PsiElement scope) {
private static @NotNull Supplier<PsiElement> prevWalker(@NotNull PsiElement element, @NotNull PsiElement scope) {
return new Supplier<>() {
PsiElement e = element;
@Nullable
@Override
public PsiElement get() {
public @Nullable PsiElement get() {
if (e == null || e == scope) return null;
PsiElement prev = e.getPrevSibling();
if (prev != null) {
@@ -435,29 +418,23 @@ public final class InjectorUtils {
myDisplayName = displayName;
}
@NotNull
public String getPrefix() {
public @NotNull String getPrefix() {
return ObjectUtils.notNull(myMap.get("prefix"), "");
}
@NotNull
public String getSuffix() {
public @NotNull String getSuffix() {
return ObjectUtils.notNull(myMap.get("suffix"), "");
}
@NotNull
public String getInjectedLanguageId() {
public @NotNull String getInjectedLanguageId() {
return ObjectUtils.notNull(myMap.get("language"), "");
}
@NlsSafe
@NotNull
public String getDisplayName() {
public @NlsSafe @NotNull String getDisplayName() {
return myDisplayName;
}
@NotNull
public Map<String, String> getValues() {
public @NotNull Map<String, String> getValues() {
return myMap;
}
}

View File

@@ -84,8 +84,7 @@ public abstract class LanguageInjectionSupport {
*/
@SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated(forRemoval = true)
@Nullable
public abstract BaseInjection findCommentInjection(@NotNull PsiElement host, @Nullable Ref<? super PsiElement> commentRef);
public abstract @Nullable BaseInjection findCommentInjection(@NotNull PsiElement host, @Nullable Ref<? super PsiElement> commentRef);
public abstract boolean addInjectionInPlace(final Language language, final PsiLanguageInjectionHost psiElement);

View File

@@ -8,9 +8,8 @@ import org.jetbrains.annotations.NotNull;
final class TemporaryLanguageInjectionSupport extends AbstractLanguageInjectionSupport {
@NotNull
@Override
public String getId() {
public @NotNull String getId() {
return TemporaryPlacesRegistry.SUPPORT_ID;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject;
import com.intellij.codeInsight.completion.CompletionUtilCoreImpl;
@@ -29,7 +29,7 @@ public final class TemporaryPlacesRegistry {
private volatile long myPsiModificationCounter;
public final static String SUPPORT_ID = "temp";
public static final String SUPPORT_ID = "temp";
public static TemporaryPlacesRegistry getInstance(@NotNull Project project) {
return project.getService(TemporaryPlacesRegistry.class);
@@ -152,8 +152,7 @@ public final class TemporaryPlacesRegistry {
return InjectorUtils.findInjectionSupport(SUPPORT_ID);
}
@Nullable
public InjectedLanguage getLanguageFor(@NotNull PsiLanguageInjectionHost host, PsiFile containingFile) {
public @Nullable InjectedLanguage getLanguageFor(@NotNull PsiLanguageInjectionHost host, PsiFile containingFile) {
PsiLanguageInjectionHost originalHost = CompletionUtilCoreImpl.getOriginalElement(host, containingFile);
PsiLanguageInjectionHost injectionHost = originalHost == null ? host : originalHost;
getInjectionPlacesSafe();

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject;
import com.intellij.codeInsight.intention.IntentionAction;
@@ -27,8 +27,7 @@ import java.util.Set;
public final class UnInjectLanguageAction implements IntentionAction, LowPriorityAction {
@Override
@NotNull
public String getText() {
public @NotNull String getText() {
return IntelliLangBundle.message("intelliLang.uninject.language.action.text");
}
@@ -38,8 +37,7 @@ public final class UnInjectLanguageAction implements IntentionAction, LowPriorit
}
@Override
@NotNull
public String getFamilyName() {
public @NotNull String getFamilyName() {
return getText();
}
@@ -54,7 +52,7 @@ public final class UnInjectLanguageAction implements IntentionAction, LowPriorit
}
@Override
public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
public void invoke(final @NotNull Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
ApplicationManager.getApplication().runReadAction(() -> invokeImpl(project, editor, file));
}

View File

@@ -54,7 +54,7 @@ public class BaseInjection implements Injection, PersistentStateComponent<Elemen
public static final Key<BaseInjection> INJECTION_KEY = Key.create("INJECTION_KEY");
@NotNull private final @NlsSafe String mySupportId;
private final @NotNull @NlsSafe String mySupportId;
private @Nls String myDisplayName = "";
@@ -62,12 +62,10 @@ public class BaseInjection implements Injection, PersistentStateComponent<Elemen
private String myPrefix = "";
private String mySuffix = "";
@NonNls
private String myValuePattern = "";
private @NonNls String myValuePattern = "";
private Pattern myCompiledValuePattern;
@NonNls
private String myIgnorePattern = "";
private @NonNls String myIgnorePattern = "";
private Pattern myCompiledIgnorePattern;
private boolean mySingleFile;
@@ -104,21 +102,17 @@ public class BaseInjection implements Injection, PersistentStateComponent<Elemen
}
@Override
@NotNull
public @NlsSafe String getSupportId() {
public @NotNull @NlsSafe String getSupportId() {
return mySupportId;
}
@Override
@NotNull
public @NlsSafe String getInjectedLanguageId() {
public @NotNull @NlsSafe String getInjectedLanguageId() {
return myInjectedLanguageId;
}
@Nls
@Override
@NotNull
public String getDisplayName() {
public @Nls @NotNull String getDisplayName() {
return myDisplayName;
}
@@ -131,8 +125,7 @@ public class BaseInjection implements Injection, PersistentStateComponent<Elemen
}
@Override
@NotNull
public String getPrefix() {
public @NotNull String getPrefix() {
return myPrefix;
}
@@ -141,8 +134,7 @@ public class BaseInjection implements Injection, PersistentStateComponent<Elemen
}
@Override
@NotNull
public String getSuffix() {
public @NotNull String getSuffix() {
return mySuffix;
}
@@ -195,8 +187,7 @@ public class BaseInjection implements Injection, PersistentStateComponent<Elemen
}
@Override
@NotNull
public List<TextRange> getInjectedArea(final PsiElement element) {
public @NotNull List<TextRange> getInjectedArea(final PsiElement element) {
final TextRange textRange = ElementManipulators.getValueTextRange(element);
if (myCompiledValuePattern == null) {
return Collections.singletonList(textRange);
@@ -384,8 +375,7 @@ public class BaseInjection implements Injection, PersistentStateComponent<Elemen
protected void writeExternalImpl(Element e) { }
@NotNull
public String getValuePattern() {
public @NotNull String getValuePattern() {
return myValuePattern;
}
@@ -406,8 +396,7 @@ public class BaseInjection implements Injection, PersistentStateComponent<Elemen
}
}
@NotNull
public String getIgnorePattern() {
public @NotNull String getIgnorePattern() {
return myIgnorePattern;
}
@@ -474,7 +463,7 @@ public class BaseInjection implements Injection, PersistentStateComponent<Elemen
}
}
public void setPlaceEnabled(@Nullable final String text, final boolean enabled) {
public void setPlaceEnabled(final @Nullable String text, final boolean enabled) {
for (int i = 0; i < myPlaces.length; i++) {
final InjectionPlace cur = myPlaces[i];
if (text == null || Objects.equals(text, cur.getText())) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject.config;
@@ -16,8 +16,7 @@ public abstract class JspSupportProxy {
private static JspSupportProxy ourInstance;
private static boolean isInitialized;
@Nullable
public static synchronized JspSupportProxy getInstance() {
public static synchronized @Nullable JspSupportProxy getInstance() {
if (isInitialized) {
return ourInstance;
}

View File

@@ -37,8 +37,7 @@ public abstract class AbstractInjectionPanel<T extends BaseInjection> implements
/**
* The orignal item - must not be modified unless apply() is called.
*/
@NotNull
protected final T myOrigInjection;
protected final @NotNull T myOrigInjection;
/**
* Represents the current UI state. Outside access should use {@link #getInjection()}

View File

@@ -113,8 +113,7 @@ public final class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
}
}
@NotNull
public String getLanguage() {
public @NotNull String getLanguage() {
return (String)myLanguage.getSelectedItem();
}

View File

@@ -15,15 +15,13 @@ import org.jetbrains.annotations.NotNull;
*/
public final class FileReferenceInjector extends ReferenceInjector {
@NotNull
@Override
public String getId() {
public @NotNull String getId() {
return "file-reference";
}
@NotNull
@Override
public String getDisplayName() {
public @NotNull String getDisplayName() {
return IntelliLangBundle.message("reference.injection.display.name.file.reference");
}

View File

@@ -49,7 +49,7 @@ public final class InjectedReferencesContributor extends PsiReferenceContributor
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(PlatformPatterns.psiElement(), new PsiReferenceProvider() {
@Override
public PsiReference @NotNull [] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) {
public PsiReference @NotNull [] getReferencesByElement(final @NotNull PsiElement element, final @NotNull ProcessingContext context) {
return getInjectionInfo(element).first;
}

View File

@@ -14,9 +14,8 @@ import java.util.List;
* @author Dmitry Avdeev
*/
public final class InjectedReferencesInspection extends LocalInspectionTool {
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new InjectedReferencesVisitor(holder);
}

View File

@@ -64,7 +64,7 @@ public abstract class StringMatcher<T> {
}
}
private final static class Equals extends Simple {
private static final class Equals extends Simple {
Equals(String target) {
super(target);
}
@@ -75,7 +75,7 @@ public abstract class StringMatcher<T> {
}
}
private final static class StartsWith extends Simple {
private static final class StartsWith extends Simple {
StartsWith(String target) {
super(target);
}
@@ -91,7 +91,7 @@ public abstract class StringMatcher<T> {
}
}
private final static class EndsWith extends Simple {
private static final class EndsWith extends Simple {
EndsWith(String target) {
super(target);
}
@@ -107,7 +107,7 @@ public abstract class StringMatcher<T> {
}
}
private final static class Contains extends Simple {
private static final class Contains extends Simple {
Contains(String target) {
super(target);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject.config;
import com.intellij.openapi.application.ApplicationManager;
@@ -12,13 +12,11 @@ import org.jetbrains.annotations.Nullable;
* Proxy class that allows to avoid a hard compile time dependency on the XPathView plugin.
*/
public abstract class XPathSupportProxy {
@NotNull
public abstract XPath createXPath(String expression) throws JaxenException;
public abstract @NotNull XPath createXPath(String expression) throws JaxenException;
public abstract void attachContext(@NotNull PsiFile file);
@Nullable
public static synchronized XPathSupportProxy getInstance() {
public static synchronized @Nullable XPathSupportProxy getInstance() {
return ApplicationManager.getApplication().getService(XPathSupportProxy.class);
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject.config;
import com.intellij.psi.PsiFile;
@@ -47,14 +33,12 @@ public class XPathSupportProxyImpl extends XPathSupportProxy {
};
@Override
@NotNull
public ContextType getContextType() {
public @NotNull ContextType getContextType() {
return XPathSupport.TYPE;
}
@NotNull
@Override
public XPathType getExpectedType(XPathExpression expr) {
public @NotNull XPathType getExpectedType(XPathExpression expr) {
return XPathType.BOOLEAN;
}
@@ -90,8 +74,7 @@ public class XPathSupportProxyImpl extends XPathSupportProxy {
private final XPathSupport mySupport = XPathSupport.getInstance();
@Override
@NotNull
public XPath createXPath(String expression) throws JaxenException {
public @NotNull XPath createXPath(String expression) throws JaxenException {
return mySupport.createXPath(null, expression, Collections.emptyList());
}

View File

@@ -28,7 +28,7 @@ public class XmlTagInjection extends AbstractTagInjection {
setTagName("<none>");
}
public boolean isApplicable(@NotNull final XmlTag context) {
public boolean isApplicable(final @NotNull XmlTag context) {
return matches(context) && matchXPath(context);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.intellij.plugins.intelliLang.inject.xml;
@@ -41,7 +41,7 @@ import java.util.Collections;
*/
public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSupport {
@NonNls public static final String XML_SUPPORT_ID = "xml";
public static final @NonNls String XML_SUPPORT_ID = "xml";
private static boolean isMine(final PsiLanguageInjectionHost host) {
if (host instanceof XmlAttributeValue) {
@@ -59,8 +59,7 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
}
@Override
@NotNull
public String getId() {
public @NotNull String getId() {
return XML_SUPPORT_ID;
}
@@ -74,9 +73,8 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
return host instanceof XmlElement;
}
@Nullable
@Override
public BaseInjection findCommentInjection(@NotNull PsiElement host, @Nullable Ref<? super PsiElement> commentRef) {
public @Nullable BaseInjection findCommentInjection(@NotNull PsiElement host, @Nullable Ref<? super PsiElement> commentRef) {
if (host instanceof XmlAttributeValue) return null;
return InjectorUtils.findCommentInjection(host instanceof XmlText ? host.getParent() : host, getId(), commentRef);
}
@@ -137,8 +135,7 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
return true;
}
@Nullable
private static BaseInjection showInjectionUI(final Project project, final BaseInjection xmlInjection) {
private static @Nullable BaseInjection showInjectionUI(final Project project, final BaseInjection xmlInjection) {
final AbstractInjectionPanel panel;
String helpId;
if (xmlInjection instanceof XmlTagInjection) {
@@ -156,8 +153,7 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
return showEditInjectionDialog(project, panel, null, helpId) ? xmlInjection.copy() : null;
}
@Nullable
private static BaseInjection createFrom(final BaseInjection injection) {
private static @Nullable BaseInjection createFrom(final BaseInjection injection) {
if (injection.getInjectionPlaces().length == 0 || injection.getInjectionPlaces().length > 1) return null;
AbstractTagInjection result;
@@ -219,8 +215,7 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
return result;
}
@Nullable
private static String extractValue(PatternCondition<?> condition) {
private static @Nullable String extractValue(PatternCondition<?> condition) {
if (!(condition instanceof PatternConditionPlus)) return null;
final ElementPattern valuePattern = ((PatternConditionPlus<?, ?>)condition).getValuePattern();
final ElementPatternCondition<?> rootCondition = valuePattern.getCondition();
@@ -328,14 +323,14 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
new AnAction(IntelliLangBundle.messagePointer("action.XmlLanguageInjectionSupport.Anonymous.xml.tag.injection"),
Presentation.NULL_STRING, PlatformIcons.XML_TAG_ICON) {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
final BaseInjection newInjection = showInjectionUI(project, new XmlTagInjection());
if (newInjection != null) consumer.consume(newInjection);
}
},
new AnAction(IntelliLangBundle.messagePointer("action.XmlLanguageInjectionSupport.Anonymous.xml.attribute.injection"), Presentation.NULL_STRING, PlatformIcons.ANNOTATION_TYPE_ICON) {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
final BaseInjection injection = showInjectionUI(project, new XmlAttributeInjection());
if (injection != null) consumer.consume(injection);
}
@@ -347,7 +342,7 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
public AnAction createEditAction(final Project project, final Factory<? extends BaseInjection> producer) {
return new AnAction() {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
final BaseInjection originalInjection = producer.create();
final BaseInjection injection = createFrom(originalInjection);
if (injection != null) {

View File

@@ -64,13 +64,12 @@ final class XmlLanguageInjector implements MultiHostInjector {
}
@Override
@NotNull
public List<? extends Class<? extends PsiElement>> elementsToInjectIn() {
public @NotNull List<? extends Class<? extends PsiElement>> elementsToInjectIn() {
return Arrays.asList(XmlTag.class, XmlAttributeValue.class);
}
@Override
public void getLanguagesToInject(@NotNull final MultiHostRegistrar registrar, @NotNull PsiElement host) {
public void getLanguagesToInject(final @NotNull MultiHostRegistrar registrar, @NotNull PsiElement host) {
final XmlElement xmlElement = (XmlElement) host;
if (!isInIndex(xmlElement)) return;
final TreeSet<TextRange> ranges = new TreeSet<>(InjectorUtils.RANGE_COMPARATOR);
@@ -248,8 +247,7 @@ final class XmlLanguageInjector implements MultiHostInjector {
return index;
}
@Nullable
private static Pattern buildPattern(Collection<String> stringSet) {
private static @Nullable Pattern buildPattern(Collection<String> stringSet) {
final StringBuilder sb = new StringBuilder();
for (String s : stringSet) {
if (!InjectorUtils.isRegexp(s)) continue;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.openapi.util.JDOMExternalizable;
@@ -11,8 +11,8 @@ import java.util.Objects;
@Tag("build-property")
public final class BuildFileProperty implements JDOMExternalizable, Cloneable {
@NonNls private static final String NAME = "name";
@NonNls private static final String VALUE = "value";
private static final @NonNls String NAME = "name";
private static final @NonNls String VALUE = "value";
private String myPropertyName;
private String myPropertyValue;

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.ant.build;
import com.intellij.execution.process.BaseOSProcessHandler;
@@ -65,9 +51,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class AntArtifactBuildTaskProvider extends ArtifactBuildTaskProvider {
private static final Logger LOG = Logger.getInstance(AntArtifactBuildTaskProvider.class);
@NotNull
@Override
public List<? extends BuildTask> createArtifactBuildTasks(@NotNull JpsArtifact artifact, @NotNull ArtifactBuildPhase buildPhase) {
public @NotNull List<? extends BuildTask> createArtifactBuildTasks(@NotNull JpsArtifact artifact, @NotNull ArtifactBuildPhase buildPhase) {
JpsAntArtifactExtension extension = getBuildExtension(artifact, buildPhase);
if (extension != null && extension.isEnabled() && !StringUtil.isEmpty(extension.getFileUrl())) {
return Collections.singletonList(new AntArtifactBuildTask(extension));
@@ -75,8 +60,7 @@ public class AntArtifactBuildTaskProvider extends ArtifactBuildTaskProvider {
return Collections.emptyList();
}
@Nullable
private static JpsAntArtifactExtension getBuildExtension(JpsArtifact artifact, ArtifactBuildPhase buildPhase) {
private static @Nullable JpsAntArtifactExtension getBuildExtension(JpsArtifact artifact, ArtifactBuildPhase buildPhase) {
switch (buildPhase) {
case PRE_PROCESSING:
return JpsAntExtensionService.getPreprocessingExtension(artifact);
@@ -88,7 +72,7 @@ public class AntArtifactBuildTaskProvider extends ArtifactBuildTaskProvider {
}
private static class AntArtifactBuildTask extends BuildTask {
@NlsSafe public static final String BUILDER_NAME = "ant";
public static final @NlsSafe String BUILDER_NAME = "ant";
private final JpsAntArtifactExtension myExtension;
AntArtifactBuildTask(@NotNull JpsAntArtifactExtension extension) {
@@ -194,7 +178,7 @@ public class AntArtifactBuildTaskProvider extends ArtifactBuildTaskProvider {
}
BaseOSProcessHandler handler = new BaseOSProcessHandler(process, commandLineString, null);
final AtomicBoolean hasErrors = new AtomicBoolean();
@NlsSafe final StringBuilder errorOutput = new StringBuilder();
final @NlsSafe StringBuilder errorOutput = new StringBuilder();
handler.addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.ant.model;
import com.intellij.openapi.application.PathManager;
@@ -26,13 +26,11 @@ public final class JpsAntExtensionService {
public static final String BUNDLED_ANT_PATH_PROPERTY = "jps.bundled.ant.path";
private static final Logger LOG = Logger.getInstance(JpsAntExtensionService.class);
@Nullable
public static JpsAntArtifactExtension getPreprocessingExtension(@NotNull JpsArtifact artifact) {
public static @Nullable JpsAntArtifactExtension getPreprocessingExtension(@NotNull JpsArtifact artifact) {
return artifact.getContainer().getChild(JpsAntArtifactExtensionImpl.PREPROCESSING_ROLE);
}
@Nullable
public static JpsAntArtifactExtension getPostprocessingExtension(@NotNull JpsArtifact artifact) {
public static @Nullable JpsAntArtifactExtension getPostprocessingExtension(@NotNull JpsArtifact artifact) {
return artifact.getContainer().getChild(JpsAntArtifactExtensionImpl.POSTPROCESSING_ROLE);
}
@@ -40,8 +38,7 @@ public final class JpsAntExtensionService {
global.getContainer().getOrSetChild(JpsAntInstallationImpl.COLLECTION_ROLE).addChild(antInstallation);
}
@NotNull
public static JpsAntBuildFileOptions getOptions(@NotNull JpsProject project, @NotNull String buildFileUrl) {
public static @NotNull JpsAntBuildFileOptions getOptions(@NotNull JpsProject project, @NotNull String buildFileUrl) {
JpsAntConfiguration configuration = getAntConfiguration(project);
if (configuration != null) {
return configuration.getOptions(buildFileUrl);
@@ -49,13 +46,11 @@ public final class JpsAntExtensionService {
return new JpsAntBuildFileOptionsImpl();
}
@Nullable
private static JpsAntConfiguration getAntConfiguration(JpsProject project) {
private static @Nullable JpsAntConfiguration getAntConfiguration(JpsProject project) {
return project.getContainer().getChild(JpsAntConfigurationImpl.ROLE);
}
@NotNull
public static JpsAntConfiguration getOrCreateAntConfiguration(@NotNull JpsProject project) {
public static @NotNull JpsAntConfiguration getOrCreateAntConfiguration(@NotNull JpsProject project) {
JpsAntConfiguration configuration = getAntConfiguration(project);
if (configuration != null) {
return configuration;
@@ -64,8 +59,7 @@ public final class JpsAntExtensionService {
return project.getContainer().setChild(JpsAntConfigurationImpl.ROLE, antConfiguration);
}
@Nullable
private static JpsAntInstallation getBundledAntInstallation() {
private static @Nullable JpsAntInstallation getBundledAntInstallation() {
String antPath = System.getProperty(BUNDLED_ANT_PATH_PROPERTY);
File antHome;
if (antPath != null) {
@@ -105,8 +99,7 @@ public final class JpsAntExtensionService {
return new JpsAntInstallationImpl(antHome, "Bundled Ant", emptyList(), singletonList(antJarsHome));
}
@Nullable
public static JpsAntInstallation getAntInstallationForBuildFile(@NotNull JpsModel model, @NotNull String buildFileUrl) {
public static @Nullable JpsAntInstallation getAntInstallationForBuildFile(@NotNull JpsModel model, @NotNull String buildFileUrl) {
JpsAntBuildFileOptions options = getOptions(model.getProject(), buildFileUrl);
String antInstallationName;
if (options.isUseProjectDefaultAnt()) {
@@ -122,8 +115,7 @@ public final class JpsAntExtensionService {
return findAntInstallation(model, antInstallationName);
}
@Nullable
public static JpsAntInstallation findAntInstallation(@NotNull JpsModel model, @NotNull String antInstallationName) {
public static @Nullable JpsAntInstallation findAntInstallation(@NotNull JpsModel model, @NotNull String antInstallationName) {
JpsElementCollection<JpsAntInstallation> antInstallations = model.getGlobal().getContainer().getChild(JpsAntInstallationImpl.COLLECTION_ROLE);
if (antInstallations != null) {
for (JpsAntInstallation installation : antInstallations.getElements()) {

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.ant.model.impl;
import com.intellij.lang.ant.config.impl.BuildFileProperty;
@@ -110,8 +96,7 @@ public final class JpsAntBuildFileOptionsImpl implements JpsAntBuildFileOptions
}
@Override
@NotNull
public List<BuildFileProperty> getProperties() {
public @NotNull List<BuildFileProperty> getProperties() {
return myProperties;
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.ant.model.impl;
import org.jetbrains.annotations.NotNull;
@@ -37,9 +23,8 @@ public final class JpsAntConfigurationImpl extends JpsElementBase<JpsAntConfigur
myOptionsMap.putAll(options);
}
@NotNull
@Override
public JpsAntConfigurationImpl createCopy() {
public @NotNull JpsAntConfigurationImpl createCopy() {
return new JpsAntConfigurationImpl(myOptionsMap, myProjectDefaultAntName);
}
@@ -49,20 +34,17 @@ public final class JpsAntConfigurationImpl extends JpsElementBase<JpsAntConfigur
}
@Override
@Nullable
public String getProjectDefaultAntName() {
public @Nullable String getProjectDefaultAntName() {
return myProjectDefaultAntName;
}
@Override
@NotNull
public Collection<JpsAntBuildFileOptions> getOptionsForAllBuildFiles() {
public @NotNull Collection<JpsAntBuildFileOptions> getOptionsForAllBuildFiles() {
return myOptionsMap.values();
}
@NotNull
@Override
public JpsAntBuildFileOptions getOptions(@NotNull String buildFileUrl) {
public @NotNull JpsAntBuildFileOptions getOptions(@NotNull String buildFileUrl) {
JpsAntBuildFileOptions options = myOptionsMap.get(buildFileUrl);
if (options != null) {
return options;

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.ant.model.impl;
import com.intellij.openapi.util.text.StringUtil;
@@ -41,9 +27,8 @@ public final class JpsAntInstallationImpl extends JpsElementBase<JpsAntInstallat
myJarDirectories = jarDirectories;
}
@NotNull
@Override
public JpsAntInstallationImpl createCopy() {
public @NotNull JpsAntInstallationImpl createCopy() {
return new JpsAntInstallationImpl(myAntHome, myName, myClasspath, myJarDirectories);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.ant.model.impl;
import com.intellij.openapi.util.JDOMUtil;
@@ -26,21 +26,18 @@ import java.io.File;
import java.util.*;
public final class JpsAntModelSerializerExtension extends JpsModelSerializerExtension {
@NotNull
@Override
public List<? extends JpsGlobalExtensionSerializer> getGlobalExtensionSerializers() {
public @NotNull List<? extends JpsGlobalExtensionSerializer> getGlobalExtensionSerializers() {
return Collections.singletonList(new JpsGlobalAntConfigurationSerializer());
}
@NotNull
@Override
public List<? extends JpsProjectExtensionSerializer> getProjectExtensionSerializers() {
public @NotNull List<? extends JpsProjectExtensionSerializer> getProjectExtensionSerializers() {
return Arrays.asList(new JpsProjectAntConfigurationSerializer(), new JpsWorkspaceAntConfigurationSerializer());
}
@NotNull
@Override
public List<? extends JpsArtifactExtensionSerializer<?>> getArtifactExtensionSerializers() {
public @NotNull List<? extends JpsArtifactExtensionSerializer<?>> getArtifactExtensionSerializers() {
return Arrays.asList(new JpsAntArtifactExtensionSerializer("ant-postprocessing", JpsAntArtifactExtensionImpl.POSTPROCESSING_ROLE),
new JpsAntArtifactExtensionSerializer("ant-preprocessing", JpsAntArtifactExtensionImpl.PREPROCESSING_ROLE));
}
@@ -57,8 +54,7 @@ public final class JpsAntModelSerializerExtension extends JpsModelSerializerExte
}
}
@Nullable
private static String getValueAttribute(Element buildFileTag, final String childName) {
private static @Nullable String getValueAttribute(Element buildFileTag, final String childName) {
Element child = buildFileTag.getChild(childName);
return child != null ? child.getAttributeValue("value") : null;
}

View File

@@ -1,3 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.ant.model.impl.artifacts;
import com.intellij.lang.ant.config.impl.BuildFileProperty;
@@ -16,7 +17,7 @@ import java.util.List;
public final class JpsAntArtifactExtensionImpl extends JpsCompositeElementBase<JpsAntArtifactExtensionImpl> implements JpsAntArtifactExtension {
public static final JpsElementChildRole<JpsAntArtifactExtension> PREPROCESSING_ROLE = JpsElementChildRoleBase.create("ant preprocessing");
public static final JpsElementChildRole<JpsAntArtifactExtension> POSTPROCESSING_ROLE = JpsElementChildRoleBase.create("ant postprocessing");
@NonNls public static final String ARTIFACT_OUTPUT_PATH_PROPERTY = "artifact.output.path";
public static final @NonNls String ARTIFACT_OUTPUT_PATH_PROPERTY = "artifact.output.path";
private final AntArtifactExtensionProperties myProperties;
public JpsAntArtifactExtensionImpl(AntArtifactExtensionProperties properties) {
@@ -28,9 +29,8 @@ public final class JpsAntArtifactExtensionImpl extends JpsCompositeElementBase<J
myProperties = XmlSerializerUtil.createCopy(original.myProperties);
}
@NotNull
@Override
public JpsAntArtifactExtensionImpl createCopy() {
public @NotNull JpsAntArtifactExtensionImpl createCopy() {
return new JpsAntArtifactExtensionImpl(this);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant;
import com.intellij.codeInsight.daemon.impl.HighlightRangeExtension;
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
public final class AntHighlightRangeExtension implements HighlightRangeExtension {
@Override
public boolean isForceHighlightParents(@NotNull final PsiFile file) {
public boolean isForceHighlightParents(final @NotNull PsiFile file) {
return XmlUtil.isAntFile(file);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant;
import com.intellij.ide.highlighter.XmlFileType;
@@ -30,14 +30,12 @@ public final class AntImportsIndex extends ScalarIndexExtension<Integer>{
}
@Override
@NotNull
public ID<Integer, Void> getName() {
public @NotNull ID<Integer, Void> getName() {
return INDEX_NAME;
}
@Override
@NotNull
public DataIndexer<Integer, Void, FileContent> getIndexer() {
public @NotNull DataIndexer<Integer, Void, FileContent> getIndexer() {
return inputData -> {
AtomicBoolean importFound = new AtomicBoolean();
@@ -64,15 +62,13 @@ public final class AntImportsIndex extends ScalarIndexExtension<Integer>{
};
}
@NotNull
@Override
public KeyDescriptor<Integer> getKeyDescriptor() {
public @NotNull KeyDescriptor<Integer> getKeyDescriptor() {
return EnumeratorIntegerDescriptor.INSTANCE;
}
@NotNull
@Override
public FileBasedIndex.InputFilter getInputFilter() {
public @NotNull FileBasedIndex.InputFilter getInputFilter() {
return new DefaultFileTypeSpecificInputFilter(XmlFileType.INSTANCE) {
@Override
public boolean acceptInput(@NotNull VirtualFile file) {

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant;
import com.intellij.openapi.diagnostic.Logger;
@@ -38,8 +24,7 @@ public final class AntIntrospector {
myHelper = helper;
}
@Nullable
public static AntIntrospector getInstance(Class c) {
public static @Nullable AntIntrospector getInstance(Class c) {
Object helper = AntIntrospectorCache.getInstance().getHelper(c);
return helper == null ? null : new AntIntrospector(c, helper);
}
@@ -80,8 +65,7 @@ public final class AntIntrospector {
return invokeMethod("getNestedElements", false);
}
@Nullable
public Class getElementType(String name) {
public @Nullable Class getElementType(String name) {
try {
return invokeMethod("getElementType", false, name);
}
@@ -94,8 +78,7 @@ public final class AntIntrospector {
return invokeMethod("getAttributes", false);
}
@Nullable
public Class getAttributeType(final String attr) {
public @Nullable Class getAttributeType(final String attr) {
try {
return invokeMethod("getAttributeType", false, attr);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant;
import com.intellij.lang.ant.dom.AntDomAntlib;
@@ -34,8 +34,7 @@ public final class AntSupport {
// Managing ant files dependencies via the <import> task.
//
@Nullable
public static AntDomProject getAntDomProject(PsiFile psiFile) {
public static @Nullable AntDomProject getAntDomProject(PsiFile psiFile) {
if (psiFile instanceof XmlFile) {
final DomManager domManager = DomManager.getDomManager(psiFile.getProject());
final DomFileElement<AntDomProject> fileElement = domManager.getFileElement((XmlFile)psiFile, AntDomProject.class);
@@ -44,8 +43,7 @@ public final class AntSupport {
return null;
}
@Nullable
public static AntDomProject getAntDomProjectForceAntFile(PsiFile psiFile) {
public static @Nullable AntDomProject getAntDomProjectForceAntFile(PsiFile psiFile) {
if (psiFile instanceof XmlFile) {
final DomManager domManager = DomManager.getDomManager(psiFile.getProject());
DomFileElement<AntDomProject> fileElement = domManager.getFileElement((XmlFile)psiFile, AntDomProject.class);
@@ -58,8 +56,7 @@ public final class AntSupport {
return null;
}
@Nullable
public static AntDomAntlib getAntLib(PsiFile psiFile) {
public static @Nullable AntDomAntlib getAntLib(PsiFile psiFile) {
if (psiFile instanceof XmlFile) {
final DomManager domManager = DomManager.getDomManager(psiFile.getProject());
final DomFileElement<AntDomAntlib> fileElement = domManager.getFileElement((XmlFile)psiFile, AntDomAntlib.class);
@@ -68,14 +65,12 @@ public final class AntSupport {
return null;
}
@Nullable
public static AntDomElement getAntDomElement(XmlTag xmlTag) {
public static @Nullable AntDomElement getAntDomElement(XmlTag xmlTag) {
final DomElement domElement = DomManager.getDomManager(xmlTag.getProject()).getDomElement(xmlTag);
return domElement instanceof AntDomElement? (AntDomElement)domElement : null;
}
@Nullable
public static AntDomElement getInvocationAntDomElement(ConvertContext context) {
public static @Nullable AntDomElement getInvocationAntDomElement(ConvertContext context) {
return context.getInvocationElement().getParentOfType(AntDomElement.class, false);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant;
import com.intellij.openapi.diagnostic.Logger;
@@ -121,13 +121,11 @@ public final class ReflectedProject {
myProject = project;
}
@Nullable
public Map<String, Class<?>> getTaskDefinitions() {
public @Nullable Map<String, Class<?>> getTaskDefinitions() {
return myTaskDefinitions;
}
@Nullable
public Map<String, Class<?>> getDataTypeDefinitions() {
public @Nullable Map<String, Class<?>> getDataTypeDefinitions() {
return myDataTypeDefinitions;
}
@@ -143,8 +141,7 @@ public final class ReflectedProject {
return myTargetClass;
}
@Nullable
public Object getProject() {
public @Nullable Object getProject() {
return myProject;
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config;
@@ -24,7 +10,6 @@ import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
public interface AntBuildTarget {
@@ -40,8 +25,7 @@ public interface AntBuildTarget {
* For normal targets this is a singleton list with the target name that getName() method returns. For meta-targets this is
* a list of targets that form the meta-target
*/
@NotNull
default List<@NlsSafe String> getTargetNames() {
default @NotNull List<@NlsSafe String> getTargetNames() {
final String name = getName();
return ContainerUtil.createMaybeSingletonList(name);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config;
@@ -16,7 +16,7 @@ import java.util.List;
public abstract class AntConfiguration extends SimpleModificationTracker {
private final Project myProject;
@NonNls public static final String ACTION_ID_PREFIX = "Ant_";
public static final @NonNls String ACTION_ID_PREFIX = "Ant_";
protected AntConfiguration(@NotNull Project project) {
myProject = project;
@@ -53,8 +53,7 @@ public abstract class AntConfiguration extends SimpleModificationTracker {
public abstract List<AntBuildFileBase> getBuildFileList();
@Nullable
public abstract AntBuildFile addBuildFile(final VirtualFile file) throws AntNoFileException;
public abstract @Nullable AntBuildFile addBuildFile(final VirtualFile file) throws AntNoFileException;
public abstract void removeBuildFile(final AntBuildFile file);
@@ -66,13 +65,11 @@ public abstract class AntConfiguration extends SimpleModificationTracker {
public abstract void updateBuildFile(final AntBuildFile buildFile);
@Nullable
public abstract AntBuildModelBase getModelIfRegistered(@NotNull AntBuildFileBase buildFile);
public abstract @Nullable AntBuildModelBase getModelIfRegistered(@NotNull AntBuildFileBase buildFile);
public abstract AntBuildModel getModel(@NotNull AntBuildFile buildFile);
@Nullable
public abstract AntBuildFile findBuildFileByActionId(final String id);
public abstract @Nullable AntBuildFile findBuildFileByActionId(final String id);
public abstract boolean executeTargetBeforeCompile(CompileContext compileContext, DataContext dataContext);

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config;
import com.intellij.lang.ant.config.impl.AntInstallation;
@@ -44,8 +30,7 @@ public abstract class AntConfigurationBase extends AntConfiguration {
public abstract List<ExecutionEvent> getEventsForTarget(final AntBuildTarget target);
@Nullable
public abstract AntBuildTarget getTargetForEvent(final ExecutionEvent event);
public abstract @Nullable AntBuildTarget getTargetForEvent(final ExecutionEvent event);
public abstract void setTargetForEvent(final AntBuildFile buildFile, final String targetName, final ExecutionEvent event);
@@ -66,14 +51,11 @@ public abstract class AntConfigurationBase extends AntConfiguration {
public abstract void setContextFile(@NotNull XmlFile file, @Nullable XmlFile context);
@Nullable
public abstract XmlFile getContextFile(@Nullable XmlFile file);
public abstract @Nullable XmlFile getContextFile(@Nullable XmlFile file);
@Nullable
public abstract XmlFile getEffectiveContextFile(@Nullable XmlFile file);
public abstract @Nullable XmlFile getEffectiveContextFile(@Nullable XmlFile file);
@Nullable
public abstract AntBuildFileBase getAntBuildFile(@NotNull PsiFile file);
public abstract @Nullable AntBuildFileBase getAntBuildFile(@NotNull PsiFile file);
@Override
public abstract AntBuildFile[] getBuildFiles();

View File

@@ -47,7 +47,7 @@ final class AddAntBuildFile extends AnAction {
}
int filesAdded = 0;
@Nls final StringBuilder errors = new StringBuilder();
final @Nls StringBuilder errors = new StringBuilder();
for (VirtualFile file : files) {
try {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.actions;
import com.intellij.lang.ant.AntSupport;
@@ -67,8 +67,7 @@ public class RunTargetAction extends AnAction {
return ActionUpdateThread.BGT;
}
@Nullable
private static Pair<AntBuildFileBase, AntDomTarget> findAntTarget(@NotNull AnActionEvent e) {
private static @Nullable Pair<AntBuildFileBase, AntDomTarget> findAntTarget(@NotNull AnActionEvent e) {
final Editor editor = e.getData(CommonDataKeys.EDITOR);
final Project project = e.getProject();

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.actions;
@@ -38,7 +38,7 @@ public class TargetActionStub extends AnAction implements Disposable {
}
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
public void actionPerformed(final @NotNull AnActionEvent e) {
if (myProject == null) {
return;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.ide.CommonActionsManager;
@@ -90,8 +90,7 @@ public final class AntBuildMessageView extends JPanel
private volatile int myWarningCount;
private volatile boolean myIsOutputPaused;
@NotNull
private volatile AntOutputView myCurrentView;
private volatile @NotNull AntOutputView myCurrentView;
private final PlainTextView myPlainTextView;
private final TreeView myTreeView;
@@ -130,8 +129,7 @@ public final class AntBuildMessageView extends JPanel
AntBuildMessageView.this.expandAll();
}
};
@NonNls
private static final String FILE_PREFIX = "file:";
private static final @NonNls String FILE_PREFIX = "file:";
private AntBuildMessageView(Project project, AntBuildFileBase buildFile, List<String> targets, List<BuildFileProperty> additionalProperties) {
super(new BorderLayout(2, 0));
@@ -234,8 +232,7 @@ public final class AntBuildMessageView extends JPanel
/**
* @return can be null if user cancelled operation
*/
@Nullable
static AntBuildMessageView openBuildMessageView(Project project,
static @Nullable AntBuildMessageView openBuildMessageView(Project project,
AntBuildFileBase buildFile,
List<String> targets,
List<BuildFileProperty> additionalProperties) {
@@ -408,8 +405,7 @@ public final class AntBuildMessageView extends JPanel
addCommand(new AddMessageCommand(message));
}
@Nullable
private static AntMessage getCustomizedMessage(final @Nls String text, @AntMessage.Priority int priority) {
private static @Nullable AntMessage getCustomizedMessage(final @Nls String text, @AntMessage.Priority int priority) {
AntMessage customizedMessage = null;
for (AntMessageCustomizer customizer : AntMessageCustomizer.EP_NAME.getExtensionList()) {
@@ -668,8 +664,7 @@ public final class AntBuildMessageView extends JPanel
myMessage = message;
}
@NotNull
final AntMessage getMessage() {
final @NotNull AntMessage getMessage() {
return myMessage;
}
}
@@ -806,7 +801,7 @@ public final class AntBuildMessageView extends JPanel
return myWarningCount;
}
void buildFinished(boolean isProgressAborted, final long buildTimeInMilliseconds, @NotNull final AntBuildListener antBuildListener, OutputPacketProcessor dispatcher) {
void buildFinished(boolean isProgressAborted, final long buildTimeInMilliseconds, final @NotNull AntBuildListener antBuildListener, OutputPacketProcessor dispatcher) {
final boolean aborted = isProgressAborted || myIsAborted;
dispatcher.processOutput(__ -> {
@@ -962,15 +957,13 @@ public final class AntBuildMessageView extends JPanel
}
}
@NotNull
@Override
public String getNextOccurenceActionName() {
public @NotNull String getNextOccurenceActionName() {
return myTreeView.getNextOccurenceActionName();
}
@NotNull
@Override
public String getPreviousOccurenceActionName() {
public @NotNull String getPreviousOccurenceActionName() {
return myTreeView.getPreviousOccurenceActionName();
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.execution.CantRunException;
@@ -35,11 +35,11 @@ public class AntCommandLineBuilder {
private @NlsSafe String myBuildFilePath;
private List<BuildFileProperty> myProperties;
private boolean myDone = false;
@NonNls private final List<String> myExpandedProperties = new ArrayList<>();
@NonNls private static final String INPUT_HANDLER_PARAMETER = "-inputhandler";
@NonNls private static final String LOGFILE_PARAMETER = "-logfile";
@NonNls private static final String LOGFILE_SHORT_PARAMETER = "-l";
@NonNls private static final String LOGGER_PARAMETER = "-logger";
private final @NonNls List<String> myExpandedProperties = new ArrayList<>();
private static final @NonNls String INPUT_HANDLER_PARAMETER = "-inputhandler";
private static final @NonNls String LOGFILE_PARAMETER = "-logfile";
private static final @NonNls String LOGFILE_SHORT_PARAMETER = "-l";
private static final @NonNls String LOGGER_PARAMETER = "-logger";
public void calculateProperties(final DataContext dataContext, Project project, List<BuildFileProperty> additionalProperties) throws Macro.ExecutionCancelledException {
for (BuildFileProperty property : myProperties) {
@@ -98,7 +98,7 @@ public class AntCommandLineBuilder {
String[] urls = jdk.getRootProvider().getUrls(OrderRootType.CLASSES);
final String jdkHome = homeDirectory.getPath().replace('/', File.separatorChar);
@NonNls final String pathToJre = jdkHome + File.separator + "jre" + File.separator;
final @NonNls String pathToJre = jdkHome + File.separator + "jre" + File.separator;
for (String url : urls) {
final String path = PathUtil.toPresentableUrl(url);
if (!path.startsWith(pathToJre)) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.openapi.util.text.StringUtil;
@@ -75,8 +75,7 @@ public final class AntMessage {
return myColumn;
}
@NotNull
public AntMessage withText(@NotNull @Nls String text) {
public @NotNull AntMessage withText(@NotNull @Nls String text) {
return new AntMessage(getType(), getPriority(), text, getFile(), getLine(), getColumn());
}

View File

@@ -1,3 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.openapi.extensions.ExtensionPointName;
@@ -8,8 +9,7 @@ public abstract class AntMessageCustomizer {
public static final ExtensionPointName<AntMessageCustomizer> EP_NAME = ExtensionPointName.create("AntSupport.AntMessageCustomizer");
@Nullable
public AntMessage createCustomizedMessage(@Nls String text, @AntMessage.Priority int priority) {
public @Nullable AntMessage createCustomizedMessage(@Nls String text, @AntMessage.Priority int priority) {
return null;
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.rt.execution.CommandLineWrapper;
@@ -7,7 +7,7 @@ import com.intellij.util.PathsList;
import org.jetbrains.annotations.NonNls;
final class AntPathUtil {
@NonNls private static final String IDEA_PREPEND_RTJAR = "idea.prepend.rtjar";
private static final @NonNls String IDEA_PREPEND_RTJAR = "idea.prepend.rtjar";
private AntPathUtil() {
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.execution.ExecutionException;
@@ -36,40 +36,34 @@ public final class AntProcessHandler extends KillableColoredProcessHandler {
});
}
@NotNull
@Override
protected Reader createProcessOutReader() {
protected @NotNull Reader createProcessOutReader() {
return myOut.createReader();
}
@NotNull
@Override
protected Reader createProcessErrReader() {
protected @NotNull Reader createProcessErrReader() {
return myErr.createReader();
}
@NotNull
public Extractor getErr() {
public @NotNull Extractor getErr() {
return myErr;
}
@NotNull
public Extractor getOut() {
public @NotNull Extractor getOut() {
return myOut;
}
@NotNull
public static AntProcessHandler runCommandLine(@NotNull TargetedCommandLine commandLine,
@NotNull TargetEnvironment environment,
@NotNull ProgressIndicator progressIndicator) throws ExecutionException {
public static @NotNull AntProcessHandler runCommandLine(@NotNull TargetedCommandLine commandLine,
@NotNull TargetEnvironment environment,
@NotNull ProgressIndicator progressIndicator) throws ExecutionException {
final AntProcessHandler processHandler = new AntProcessHandler(commandLine, environment, progressIndicator);
ProcessTerminatedListener.attach(processHandler);
return processHandler;
}
@NotNull
@Override
protected BaseOutputReader.Options readerOptions() {
protected @NotNull BaseOutputReader.Options readerOptions() {
return BaseOutputReader.Options.NON_BLOCKING;
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.execution.Executor;
@@ -48,9 +48,8 @@ public final class AntRunConfiguration extends LocatableConfigurationBase implem
return configuration;
}
@NotNull
@Override
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
public @NotNull SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
return new AntConfigurationSettingsEditor();
}
@@ -70,9 +69,8 @@ public final class AntRunConfiguration extends LocatableConfigurationBase implem
return target == null ? null : target.getDisplayName();
}
@NotNull
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) {
public @NotNull RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) {
return new AntRunProfileState(env);
}
@@ -88,13 +86,11 @@ public final class AntRunConfiguration extends LocatableConfigurationBase implem
mySettings.writeExternal(element);
}
@Nullable
public AntBuildTarget getTarget() {
public @Nullable AntBuildTarget getTarget() {
return GlobalAntConfiguration.getInstance().findTarget(getProject(), mySettings.myFileUrl, mySettings.myTargetName);
}
@NotNull
public List<BuildFileProperty> getProperties() {
public @NotNull List<BuildFileProperty> getProperties() {
return Collections.unmodifiableList(mySettings.myProperties);
}
@@ -219,9 +215,8 @@ public final class AntRunConfiguration extends LocatableConfigurationBase implem
copyProperties(ContainerUtil.filter(myPropTable.getElements(), property -> !myPropTable.isEmpty(property)), config.mySettings.myProperties);
}
@NotNull
@Override
protected JComponent createEditor() {
protected @NotNull JComponent createEditor() {
myTextField = new ExtendableTextField().addBrowseExtension(myAction, this);
final JPanel panel = new JPanel(new BorderLayout());
@@ -239,9 +234,8 @@ public final class AntRunConfiguration extends LocatableConfigurationBase implem
@Override
protected ListTableModel<BuildFileProperty> createListModel() {
final ColumnInfo<BuildFileProperty, @NlsContexts.ListItem String> nameColumn = new TableColumn(AntBundle.message("column.name.ant.configuration.property.name")) {
@Nullable
@Override
public String valueOf(BuildFileProperty property) {
public @Nullable String valueOf(BuildFileProperty property) {
return property.getPropertyName();
}
@@ -251,9 +245,8 @@ public final class AntRunConfiguration extends LocatableConfigurationBase implem
}
};
final ColumnInfo<BuildFileProperty, @NlsContexts.ListItem String> valueColumn = new TableColumn(AntBundle.message("column.name.ant.configuration.property.value")) {
@Nullable
@Override
public String valueOf(BuildFileProperty property) {
public @Nullable String valueOf(BuildFileProperty property) {
return property.getPropertyValue();
}
@@ -300,9 +293,8 @@ public final class AntRunConfiguration extends LocatableConfigurationBase implem
return true;
}
@Nullable
@Override
protected String getDescription(BuildFileProperty element) {
protected @Nullable String getDescription(BuildFileProperty element) {
return null;
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.execution.configurations.ConfigurationTypeUtil;
@@ -21,14 +21,12 @@ public final class AntRunConfigurationType extends SimpleConfigurationType {
return "reference.dialogs.rundebug.AntRunConfiguration";
}
@NotNull
public static AntRunConfigurationType getInstance() {
public static @NotNull AntRunConfigurationType getInstance() {
return ConfigurationTypeUtil.findConfigurationType(AntRunConfigurationType.class);
}
@NotNull
@Override
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
public @NotNull RunConfiguration createTemplateConfiguration(@NotNull Project project) {
return new AntRunConfiguration(project, this);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.execution.DefaultExecutionResult;
@@ -25,9 +25,8 @@ final class AntRunProfileState implements RunProfileState {
myEnvironment = environment;
}
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner<?> runner) {
public @Nullable ExecutionResult execute(Executor executor, @NotNull ProgramRunner<?> runner) {
final RunProfile profile = myEnvironment.getRunProfile();
if (profile instanceof AntRunConfiguration runConfig) {
if (runConfig.getTarget() == null) {
@@ -39,9 +38,8 @@ final class AntRunProfileState implements RunProfileState {
}
return new DefaultExecutionResult(new ExecutionConsole() {
@NotNull
@Override
public JComponent getComponent() {
public @NotNull JComponent getComponent() {
return processHandler.getUserData(MESSAGE_VIEW);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.execution.ExecutionException;
@@ -29,9 +29,8 @@ final class AntRunner implements ProgramRunner<RunnerSettings> {
});
}
@NotNull
@Override
public @NonNls String getRunnerId() {
public @NotNull @NonNls String getRunnerId() {
return EXECUTOR_ID;
}

View File

@@ -49,16 +49,15 @@ import java.util.concurrent.TimeUnit;
public final class ExecutionHandler {
private static final Logger LOG = Logger.getInstance(ExecutionHandler.class);
@NonNls public static final String PARSER_JAR = "xerces1.jar";
public static final @NonNls String PARSER_JAR = "xerces1.jar";
private ExecutionHandler() {
}
@Nullable
public static ProcessHandler executeRunConfiguration(AntRunConfiguration antRunConfiguration,
final DataContext dataContext,
List<BuildFileProperty> additionalProperties,
@NotNull final AntBuildListener antBuildListener) {
public static @Nullable ProcessHandler executeRunConfiguration(AntRunConfiguration antRunConfiguration,
final DataContext dataContext,
List<BuildFileProperty> additionalProperties,
final @NotNull AntBuildListener antBuildListener) {
AntBuildTarget target = antRunConfiguration.getTarget();
if (target != null) {
try {
@@ -79,22 +78,21 @@ public final class ExecutionHandler {
*/
public static void runBuild(final AntBuildFileBase buildFile,
List<@NlsSafe String> targets,
@Nullable final AntBuildMessageView buildMessageViewToReuse,
final @Nullable AntBuildMessageView buildMessageViewToReuse,
final DataContext dataContext,
List<BuildFileProperty> additionalProperties, @NotNull final AntBuildListener antBuildListener) {
List<BuildFileProperty> additionalProperties, final @NotNull AntBuildListener antBuildListener) {
runBuildImpl(buildFile, targets, buildMessageViewToReuse, dataContext, additionalProperties, antBuildListener, true);
}
/**
* @param antBuildListener should not be null. Use {@link AntBuildListener#NULL}
*/
@NotNull
private static Future<ProcessHandler> runBuildImpl(final AntBuildFileBase buildFile,
private static @NotNull Future<ProcessHandler> runBuildImpl(final AntBuildFileBase buildFile,
List<@NlsSafe String> targets,
@Nullable final AntBuildMessageView buildMessageViewToReuse,
final @Nullable AntBuildMessageView buildMessageViewToReuse,
final DataContext dataContext,
List<BuildFileProperty> additionalProperties,
@NotNull final AntBuildListener antBuildListener, final boolean waitFor) {
final @NotNull AntBuildListener antBuildListener, final boolean waitFor) {
final Project project = buildFile.getProject();
CompletableFuture<ProcessHandler> future = new CompletableFuture<>();
@@ -133,7 +131,7 @@ public final class ExecutionHandler {
}
@Override
public void run(@NotNull final ProgressIndicator indicator) {
public void run(final @NotNull ProgressIndicator indicator) {
try {
TargetedCommandLineBuilder builder = javaParameters.toCommandLine(request);
TargetEnvironment environment = request.prepareEnvironment(TargetProgressIndicator.EMPTY);
@@ -181,13 +179,12 @@ public final class ExecutionHandler {
return future;
}
@Nullable
private static ProcessHandler runBuild(@NotNull final ProgressIndicator progress,
@NotNull final AntBuildMessageView errorView,
@NotNull final AntBuildFileBase buildFile,
@NotNull final AntBuildListener antBuildListener,
@NotNull TargetedCommandLine commandLine,
@NotNull TargetEnvironment targetEnvironment) {
private static @Nullable ProcessHandler runBuild(final @NotNull ProgressIndicator progress,
final @NotNull AntBuildMessageView errorView,
final @NotNull AntBuildFileBase buildFile,
final @NotNull AntBuildListener antBuildListener,
@NotNull TargetedCommandLine commandLine,
@NotNull TargetEnvironment targetEnvironment) {
final Project project = buildFile.getProject();
final long startTime = System.currentTimeMillis();
@@ -327,10 +324,8 @@ public final class ExecutionHandler {
}
private static class AntBuildListenerWrapper implements AntBuildListener {
@NotNull
private final AntBuildFile myBuildFile;
@NotNull
private final AntBuildListener myDelegate;
private final @NotNull AntBuildFile myBuildFile;
private final @NotNull AntBuildListener myDelegate;
AntBuildListenerWrapper(@NotNull AntBuildFile buildFile, @NotNull AntBuildListener delegate) {
myBuildFile = buildFile;

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.openapi.application.ApplicationManager;
@@ -27,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
import java.io.File;
final class HyperlinkUtil {
@NonNls public static final String AT_ATR = "at";
public static final @NonNls String AT_ATR = "at";
private HyperlinkUtil() {
}
@@ -122,13 +108,12 @@ final class HyperlinkUtil {
}
@NonNls private static final String RUNNING_SUBSTRING = "Running ";
@NonNls private static final String TEST_SUBSTRING = "TEST ";
@NonNls private static final String FAILED_SUBSTRING = " FAILED";
@NonNls private static final String FAILED_SUBSTRING_2 = " FAILED\n";
private static final @NonNls String RUNNING_SUBSTRING = "Running ";
private static final @NonNls String TEST_SUBSTRING = "TEST ";
private static final @NonNls String FAILED_SUBSTRING = " FAILED";
private static final @NonNls String FAILED_SUBSTRING_2 = " FAILED\n";
@Nullable
static PlaceInfo parseJUnitMessage(final Project project, String message) {
static @Nullable PlaceInfo parseJUnitMessage(final Project project, String message) {
int startIndex;
int endIndex;
if (message.startsWith(RUNNING_SUBSTRING)) {

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.lang.ant.AntBundle;
@@ -33,8 +19,7 @@ import javax.swing.tree.DefaultMutableTreeNode;
final class MessageNode extends DefaultMutableTreeNode {
private @Nls String[] myText;
private AntMessage myMessage;
@Nullable
private RangeMarker myRangeMarker;
private @Nullable RangeMarker myRangeMarker;
private Document myEditorDocument;
private boolean myAllowToShowPosition;
@@ -88,8 +73,7 @@ final class MessageNode extends DefaultMutableTreeNode {
return "(" + myMessage.getLine() + ", " + myMessage.getColumn() + ") ";
}
@Nullable
public @Nls String getTypeString() {
public @Nullable @Nls String getTypeString() {
AntBuildMessageView.MessageType type = myMessage.getType();
if (type == AntBuildMessageView.MessageType.BUILD) {
return AntBundle.message("ant.build.message.node.prefix.text");

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.compiler.impl.javaCompiler.javac.JavacOutputParser;
@@ -122,7 +108,7 @@ public class OutputParser{
}
protected final void processTag(char tagName, @NlsSafe final String tagValue, @AntMessage.Priority int priority) {
protected final void processTag(char tagName, final @NlsSafe String tagValue, @AntMessage.Priority int priority) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.valueOf(tagName) + priority + "=" + tagValue);
}
@@ -197,8 +183,7 @@ public class OutputParser{
private int myIndex = -1;
@Override
@Nullable
public String getCurrentLine() {
public @Nullable String getCurrentLine() {
if (myIndex >= javacMessages.size()) {
return null;
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.execution.filters.Filter;
@@ -69,8 +55,7 @@ public final class PlainTextView implements AntOutputView {
}
@Override
@Nullable
public Object addMessage(AntMessage message) {
public @Nullable Object addMessage(AntMessage message) {
print(message.getText() + "\n", ProcessOutputTypes.STDOUT);
return null;
}
@@ -155,8 +140,7 @@ public final class PlainTextView implements AntOutputView {
private final class JUnitFilter implements Filter {
@Override
@Nullable
public Result applyFilter(@NotNull String line, int entireLength) {
public @Nullable Result applyFilter(@NotNull String line, int entireLength) {
HyperlinkUtil.PlaceInfo placeInfo = HyperlinkUtil.parseJUnitMessage(myProject, line);
if (placeInfo == null) {
return null;
@@ -226,8 +210,7 @@ public final class PlainTextView implements AntOutputView {
}
@Override
@Nullable
public OutputStream getProcessInput() {
public @Nullable OutputStream getProcessInput() {
return null;
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.execution;
import com.intellij.ide.OccurenceNavigator;
@@ -48,8 +48,8 @@ public final class TreeView implements AntOutputView, OccurenceNavigator {
private final AutoScrollToSourceHandler myAutoScrollToSourceHandler;
private OccurenceNavigatorSupport myOccurenceNavigatorSupport;
private final boolean myAutoCollapseTargets;
@NonNls public static final String ROOT_TREE_USER_OBJECT = "root";
@NonNls public static final String JUNIT_TASK_NAME = "junit";
public static final @NonNls String ROOT_TREE_USER_OBJECT = "root";
public static final @NonNls String JUNIT_TASK_NAME = "junit";
public TreeView(final Project project, final AntBuildFile buildFile) {
myProject = project;
@@ -119,15 +119,13 @@ public final class TreeView implements AntOutputView, OccurenceNavigator {
.createNavigatable(myProject, messageNode.getFile(), messageNode.getOffset());
}
@NotNull
@Override
public String getNextOccurenceActionName() {
public @NotNull String getNextOccurenceActionName() {
return AntBundle.message("ant.execution.next.error.warning.action.name");
}
@NotNull
@Override
public String getPreviousOccurenceActionName() {
public @NotNull String getPreviousOccurenceActionName() {
return AntBundle.message("ant.execution.previous.error.warning.action.name");
}
};
@@ -217,8 +215,7 @@ public final class TreeView implements AntOutputView, OccurenceNavigator {
addJavacMessageImpl(message.withText(messagePrefix + message.getText()));
}
@NotNull
static @NlsSafe String printMessage(@NotNull AntMessage message, @NlsSafe String url) {
static @NotNull @NlsSafe String printMessage(@NotNull AntMessage message, @NlsSafe String url) {
final StringBuilder builder = new StringBuilder();
final VirtualFile file = message.getFile();
if (message.getLine() > 0) {
@@ -362,8 +359,7 @@ public final class TreeView implements AntOutputView, OccurenceNavigator {
menu.getComponent().show(component, x, y);
}
@Nullable
private MessageNode getSelectedItem() {
private @Nullable MessageNode getSelectedItem() {
TreePath path = myTree.getSelectionPath();
if (path == null) return null;
if (!(path.getLastPathComponent()instanceof MessageNode)) return null;
@@ -394,8 +390,7 @@ public final class TreeView implements AntOutputView, OccurenceNavigator {
});
}
@Nullable
private Navigatable getDescriptorForTargetNode(MessageNode node) {
private @Nullable Navigatable getDescriptorForTargetNode(MessageNode node) {
final String targetName = node.getText()[0];
final AntBuildTargetBase target = (AntBuildTargetBase)myBuildFile.getModel().findTarget(targetName);
return (target == null) ? null : target.getOpenFileDescriptor();
@@ -449,8 +444,7 @@ public final class TreeView implements AntOutputView, OccurenceNavigator {
}
}
@Nullable
private static TreePath getFirstErrorPath(TreePath treePath) {
private static @Nullable TreePath getFirstErrorPath(TreePath treePath) {
TreeNode treeNode = (TreeNode)treePath.getLastPathComponent();
if (treeNode instanceof MessageNode) {
AntBuildMessageView.MessageType type = ((MessageNode)treeNode).getType();
@@ -546,15 +540,13 @@ public final class TreeView implements AntOutputView, OccurenceNavigator {
return myAutoScrollToSourceHandler.createToggleAction();
}
@NotNull
@Override
public String getNextOccurenceActionName() {
public @NotNull String getNextOccurenceActionName() {
return myOccurenceNavigatorSupport.getNextOccurenceActionName();
}
@NotNull
@Override
public String getPreviousOccurenceActionName() {
public @NotNull String getPreviousOccurenceActionName() {
return myOccurenceNavigatorSupport.getPreviousOccurenceActionName();
}
@@ -603,9 +595,8 @@ public final class TreeView implements AntOutputView, OccurenceNavigator {
return ActionUpdateThread.EDT;
}
@Nullable
@Override
public Collection<String> getTextLinesToCopy() {
public @Nullable Collection<String> getTextLinesToCopy() {
TreePath selection = getSelectionPath();
Object value = selection == null ? null : selection.getLastPathComponent();
if (value instanceof MessageNode messageNode) {

View File

@@ -71,8 +71,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.io.File;
import java.util.List;
import java.util.*;
import java.util.List;
public final class AntExplorer extends SimpleToolWindowPanel implements Disposable {
private Project myProject;
@@ -273,7 +273,7 @@ public final class AntExplorer extends SimpleToolWindowPanel implements Disposab
}
if (ignoredFiles.size() != 0) {
String messageText;
@NlsSafe final StringBuilder message = new StringBuilder();
final @NlsSafe StringBuilder message = new StringBuilder();
String separator = "";
for (final VirtualFile virtualFile : ignoredFiles) {
message.append(separator);
@@ -413,14 +413,12 @@ public final class AntExplorer extends SimpleToolWindowPanel implements Disposab
return getCurrentBuildFile();
}
@Nullable
private AntBuildFileBase getCurrentBuildFile() {
private @Nullable AntBuildFileBase getCurrentBuildFile() {
final AntBuildFileNodeDescriptor descriptor = getCurrentBuildFileNodeDescriptor();
return (AntBuildFileBase)((descriptor == null) ? null : descriptor.getBuildFile());
}
@NotNull
private Collection<AntBuildFileBase> getSelectedBuildFiles() {
private @NotNull Collection<AntBuildFileBase> getSelectedBuildFiles() {
if (myTree == null) {
return Collections.emptyList();
}
@@ -446,8 +444,7 @@ public final class AntExplorer extends SimpleToolWindowPanel implements Disposab
return result;
}
@Nullable
private AntBuildFileNodeDescriptor getCurrentBuildFileNodeDescriptor() {
private @Nullable AntBuildFileNodeDescriptor getCurrentBuildFileNodeDescriptor() {
final Tree tree = myTree;
if (tree == null) {
return null;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.explorer;
import com.intellij.ide.util.treeView.AbstractTreeStructure;
@@ -39,7 +39,7 @@ final class AntExplorerTreeStructure extends AbstractTreeStructure {
}
@Override
public boolean isToBuildChildrenInBackground(@NotNull final Object element) {
public boolean isToBuildChildrenInBackground(final @NotNull Object element) {
return true;
}
@@ -49,8 +49,7 @@ final class AntExplorerTreeStructure extends AbstractTreeStructure {
}
@Override
@NotNull
public AntNodeDescriptor createDescriptor(@NotNull Object element, NodeDescriptor parentDescriptor) {
public @NotNull AntNodeDescriptor createDescriptor(@NotNull Object element, NodeDescriptor parentDescriptor) {
if (element == myRoot) {
return new RootNodeDescriptor(myProject, parentDescriptor);
}
@@ -99,8 +98,7 @@ final class AntExplorerTreeStructure extends AbstractTreeStructure {
}
@Override
@Nullable
public Object getParentElement(@NotNull Object element) {
public @Nullable Object getParentElement(@NotNull Object element) {
if (element instanceof AntBuildTarget) {
if (element instanceof MetaTarget) {
return ((MetaTarget)element).getBuildFile();
@@ -125,15 +123,13 @@ final class AntExplorerTreeStructure extends AbstractTreeStructure {
return PsiDocumentManager.getInstance(myProject).hasUncommitedDocuments();
}
@NotNull
@Override
public ActionCallback asyncCommit() {
public @NotNull ActionCallback asyncCommit() {
return asyncCommitDocuments(myProject);
}
@NotNull
@Override
public Object getRootElement() {
public @NotNull Object getRootElement() {
return myRoot;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.explorer;
import com.intellij.ide.util.treeView.NodeDescriptor;
@@ -20,8 +20,7 @@ abstract class AntNodeDescriptor extends NodeDescriptor implements CellAppearanc
}
@Override
@NotNull
public @Nls String getText() {
public @NotNull @Nls String getText() {
return toString();
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.icons.AllIcons;
@@ -37,7 +23,7 @@ public class AllJarsUnderDirEntry implements AntClasspathEntry {
private static final Function<VirtualFile, AntClasspathEntry> CREATE_FROM_VIRTUAL_FILE = file -> fromVirtualFile(file);
@NonNls static final String DIR = "dir";
static final @NonNls String DIR = "dir";
private final File myDir;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.execution.BeforeRunTaskProvider;
@@ -90,8 +90,7 @@ public final class AntBeforeRunTaskProvider extends BeforeRunTaskProvider<AntBef
return target == null || AntConfigurationImpl.executeTargetSynchronously(context, target);
}
@Nullable
private static AntBuildTarget findTargetToExecute(@NotNull AntBeforeRunTask task) {
private static @Nullable AntBuildTarget findTargetToExecute(@NotNull AntBeforeRunTask task) {
return GlobalAntConfiguration.getInstance().findTarget(task.getProject(), task.getAntFileUrl(), task.getTargetName());
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
@@ -32,7 +32,7 @@ import java.util.*;
public final class AntBuildFileImpl implements AntBuildFileBase {
private static final Logger LOG = Logger.getInstance(AntBuildFileImpl.class);
@NonNls private static final String ANT_LIB = "/.ant/lib";
private static final @NonNls String ANT_LIB = "/.ant/lib";
private volatile Map<String, String> myCachedExternalProperties;
private final Object myOptionsLock = new Object();
@@ -128,14 +128,12 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
}
@Override
@Nullable
public AntInstallation getDefault(AbstractProperty.AbstractPropertyContainer container) {
public @Nullable AntInstallation getDefault(AbstractProperty.AbstractPropertyContainer container) {
return get(container);
}
@Override
@Nullable
public AntInstallation get(AbstractProperty.AbstractPropertyContainer container) {
public @Nullable AntInstallation get(AbstractProperty.AbstractPropertyContainer container) {
return AntReference.findAnt(ANT_REFERENCE, container);
}
@@ -146,8 +144,7 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
};
private final VirtualFile myVFile;
@NotNull
private final Project myProject;
private final @NotNull Project myProject;
private final AntConfigurationBase myAntConfiguration;
private final ExternalizablePropertyContainer myWorkspaceOptions;
private final ExternalizablePropertyContainer myProjectOptions;
@@ -206,8 +203,7 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
}
@Override
@Nullable
public @NlsSafe String getName() {
public @Nullable @NlsSafe String getName() {
final VirtualFile vFile = getVirtualFile();
return vFile != null ? vFile.getName() : null;
}
@@ -219,8 +215,7 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
}
@Override
@Nullable
public AntBuildModelBase getModelIfRegistered() {
public @Nullable AntBuildModelBase getModelIfRegistered() {
return myAntConfiguration.getModelIfRegistered(this);
}
@@ -240,8 +235,7 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
}
@Override
@Nullable
public XmlFile getAntFile() {
public @Nullable XmlFile getAntFile() {
final PsiFile psiFile = myVFile.isValid()? PsiManager.getInstance(getProject()).findFile(myVFile) : null;
return (psiFile instanceof XmlFile xmlFile) && AntDomFileDescription.isAntFile(xmlFile)? xmlFile : null;
}
@@ -252,8 +246,7 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
}
@Override
@Nullable
public VirtualFile getVirtualFile() {
public @Nullable VirtualFile getVirtualFile() {
return myVFile;
}
@@ -263,8 +256,7 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
}
@Override
@Nullable
public @NlsSafe String getPresentableUrl() {
public @Nullable @NlsSafe String getPresentableUrl() {
final VirtualFile file = getVirtualFile();
return (file == null) ? null : file.getPresentableUrl();
}
@@ -413,8 +405,7 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
}
@Override
@NotNull
public Map<String, String> getExternalProperties() {
public @NotNull Map<String, String> getExternalProperties() {
Map<String, String> result = myCachedExternalProperties;
if (result == null) {
synchronized (myOptionsLock) {
@@ -448,8 +439,7 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
ANT_REFERENCE.set(getAllOptions(), ANT_REFERENCE.get(getAllOptions()).bind(GlobalAntConfiguration.getInstance()));
}
@Nullable
private TargetFilter findFilter(final String targetName) {
private @Nullable TargetFilter findFilter(final String targetName) {
final List<TargetFilter> filters;
synchronized (myOptionsLock) {
filters = TARGET_FILTERS.get(myAllOptions);
@@ -462,8 +452,7 @@ public final class AntBuildFileImpl implements AntBuildFileBase {
return null;
}
@NotNull
public ClassLoader getClassLoader() {
public @NotNull ClassLoader getClassLoader() {
return myClassloaderHolder.getClassloader();
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.lang.ant.AntSupport;
@@ -43,8 +43,7 @@ public class AntBuildModelImpl implements AntBuildModelBase {
}
@Override
@Nullable
public String getDefaultTargetName() {
public @Nullable String getDefaultTargetName() {
final AntDomProject antDomProject = getAntProject();
if (antDomProject != null) {
return antDomProject.getDefaultTarget().getRawText();
@@ -53,8 +52,7 @@ public class AntBuildModelImpl implements AntBuildModelBase {
}
@Override
@Nullable
public @NlsSafe String getName() {
public @Nullable @NlsSafe String getName() {
final AntDomProject project = getAntProject();
return project != null? project.getName().getRawText() : null;
}
@@ -76,8 +74,7 @@ public class AntBuildModelImpl implements AntBuildModelBase {
}
@Override
@Nullable
public @NonNls String getDefaultTargetActionId() {
public @Nullable @NonNls String getDefaultTargetActionId() {
if (StringUtil.isEmptyOrSpaces(getDefaultTargetName())) {
return null;
}
@@ -94,8 +91,7 @@ public class AntBuildModelImpl implements AntBuildModelBase {
}
@Override
@Nullable
public AntBuildTargetBase findTarget(final String name) {
public @Nullable AntBuildTargetBase findTarget(final String name) {
for (AntBuildTargetBase target : myTargets.getValue()) {
if (Comparing.strEqual(target.getName(), name)) {
return target;
@@ -105,8 +101,7 @@ public class AntBuildModelImpl implements AntBuildModelBase {
}
@Override
@Nullable
public BuildTask findTask(final String targetName, final String taskName) {
public @Nullable BuildTask findTask(final String targetName, final String taskName) {
final AntBuildTargetBase buildTarget = findTarget(targetName);
return (buildTarget == null) ? null : buildTarget.findTask(taskName);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.ide.util.PsiNavigationSupport;
@@ -84,20 +84,17 @@ public class AntBuildTargetImpl implements AntBuildTargetBase {
}
@Override
@Nullable
public @NlsSafe String getName() {
public @Nullable @NlsSafe String getName() {
return myName;
}
@Override
@Nullable
public @NlsSafe String getDisplayName() {
public @Nullable @NlsSafe String getDisplayName() {
return myDisplayName;
}
@Override
@Nullable
public @Nls(capitalization = Nls.Capitalization.Sentence) String getNotEmptyDescription() {
public @Nullable @Nls(capitalization = Nls.Capitalization.Sentence) String getNotEmptyDescription() {
return myDescription;
}
@@ -117,8 +114,7 @@ public class AntBuildTargetImpl implements AntBuildTargetBase {
}
@Override
@Nullable
public String getActionId() {
public @Nullable String getActionId() {
final StringBuilder name = new StringBuilder();
name.append(AntConfiguration.getActionIdPrefix(myModel.getBuildFile().getProject()));
@@ -131,8 +127,7 @@ public class AntBuildTargetImpl implements AntBuildTargetBase {
return name.toString();
}
@Nullable
public static String parseBuildFileName(@Nullable Project project, @NotNull String actionId) {
public static @Nullable String parseBuildFileName(@Nullable Project project, @NotNull String actionId) {
// expected format antIdPrefix{_modelName}_targetName
String idPrefix = project != null? AntConfiguration.getActionIdPrefix(project) : AntConfiguration.ACTION_ID_PREFIX;
if (actionId.length() <= idPrefix.length() || !actionId.startsWith(idPrefix)) {
@@ -146,8 +141,7 @@ public class AntBuildTargetImpl implements AntBuildTargetBase {
}
@Override
@Nullable
public BuildTask findTask(final String taskName) {
public @Nullable BuildTask findTask(final String taskName) {
final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(myFile);
final AntDomProject domProject = AntSupport.getAntDomProject(psiFile);
if (domProject != null) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.openapi.actionSystem.CommonDataKeys;
@@ -18,8 +18,7 @@ import static com.intellij.ide.macro.CompilerContextMakeMacro.COMPILER_CONTEXT_M
abstract class AntCompileTask implements CompileTask {
@NotNull
protected static DataContext createDataContext(CompileContext context) {
protected static @NotNull DataContext createDataContext(CompileContext context) {
Project project = context.getProject();
CompileScope scope = context.getCompileScope();
Module[] modules = ReadAction.compute(() -> scope.getAffectedModules());

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
@@ -71,14 +71,12 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
}
@Override
@Nullable
public String getDefault(final AbstractPropertyContainer container) {
public @Nullable String getDefault(final AbstractPropertyContainer container) {
return get(container);
}
@Override
@Nullable
public String get(@NotNull AbstractPropertyContainer container) {
public @Nullable String get(@NotNull AbstractPropertyContainer container) {
if (!container.hasProperty(this)) {
return null;
}
@@ -94,13 +92,13 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
};
private static final Logger LOG = Logger.getInstance(AntConfigurationImpl.class);
@NonNls private static final String BUILD_FILE = "buildFile";
@NonNls private static final String CONTEXT_MAPPING = "contextMapping";
@NonNls private static final String CONTEXT = "context";
@NonNls private static final String URL = "url";
@NonNls private static final String EXECUTE_ON_ELEMENT = "executeOn";
@NonNls private static final String EVENT_ELEMENT = "event";
@NonNls private static final String TARGET_ELEMENT = "target";
private static final @NonNls String BUILD_FILE = "buildFile";
private static final @NonNls String CONTEXT_MAPPING = "contextMapping";
private static final @NonNls String CONTEXT = "context";
private static final @NonNls String URL = "url";
private static final @NonNls String EXECUTE_ON_ELEMENT = "executeOn";
private static final @NonNls String EVENT_ELEMENT = "event";
private static final @NonNls String TARGET_ELEMENT = "target";
private final PsiManager myPsiManager;
private final List<AntBuildFileBase> myBuildFiles = new CopyOnWriteArrayList<>();
@@ -147,9 +145,8 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
VirtualFileManager.getInstance().addAsyncFileListener(new AsyncFileListener() {
private final ChangeApplier NO_OP = new ChangeApplier() {};
@Nullable
@Override
public ChangeApplier prepareChange(@NotNull List<? extends @NotNull VFileEvent> events) {
public @Nullable ChangeApplier prepareChange(@NotNull List<? extends @NotNull VFileEvent> events) {
Set<VirtualFile> toDelete = null;
for (VFileEvent event : events) {
if (event instanceof VFileDeleteEvent) {
@@ -258,7 +255,7 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
StartupManager.getInstance(getProject()).runAfterOpened(() -> {
queueLater(new Task.Backgroundable(getProject(), AntBundle.message("progress.text.loading.ant.config"), false) {
@Override
public void run(@NotNull final ProgressIndicator indicator) {
public void run(final @NotNull ProgressIndicator indicator) {
Project project = getProject();
if (project == null || project.isDisposed()) {
myInitialized = true; // ensure all clients waiting on isInitialized() are released
@@ -415,21 +412,19 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
return myBuildFiles;
}
@Nullable
@Override
public AntBuildFile addBuildFile(final VirtualFile file) throws AntNoFileException {
public @Nullable AntBuildFile addBuildFile(final VirtualFile file) throws AntNoFileException {
final Ref<AntBuildFile> result = Ref.create(null);
final Ref<AntNoFileException> ex = Ref.create(null);
final String title = AntBundle.message("dialog.title.register.ant.build.file", file.getPresentableUrl());
ProgressManager.getInstance().run(new Task.Modal(getProject(), title, false) {
@NotNull
@Override
public NotificationInfo getNotificationInfo() {
public @NotNull NotificationInfo getNotificationInfo() {
return new NotificationInfo("Ant", AntBundle.message("system.notification.title.ant.task.finished"), "");
}
@Override
public void run(@NotNull final ProgressIndicator indicator) {
public void run(final @NotNull ProgressIndicator indicator) {
indicator.setIndeterminate(true);
indicator.pushState();
try {
@@ -530,8 +525,7 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
}
@Override
@Nullable
public AntBuildTarget getTargetForEvent(final ExecutionEvent event) {
public @Nullable AntBuildTarget getTargetForEvent(final ExecutionEvent event) {
final Pair<AntBuildFile, String> pair = myEventToTargetMap.get(event);
if (pair == null) {
return null;
@@ -589,8 +583,7 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
}
@Override
@Nullable
public AntBuildModelBase getModelIfRegistered(@NotNull AntBuildFileBase buildFile) {
public @Nullable AntBuildModelBase getModelIfRegistered(@NotNull AntBuildFileBase buildFile) {
return myBuildFiles.contains(buildFile) ? getModel(buildFile) : null;
}
@@ -643,8 +636,7 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
}
@Override
@Nullable
public AntBuildFile findBuildFileByActionId(final String id) {
public @Nullable AntBuildFile findBuildFileByActionId(final String id) {
for (AntBuildFile buildFile : myBuildFiles) {
AntBuildModelBase model = (AntBuildModelBase)buildFile.getModel();
if (id.equals(model.getDefaultTargetActionId())) {
@@ -858,8 +850,7 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
}
@Override
@Nullable
public XmlFile getContextFile(@Nullable final XmlFile file) {
public @Nullable XmlFile getContextFile(final @Nullable XmlFile file) {
if (file == null) {
return null;
}
@@ -875,8 +866,7 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
}
@Override
@Nullable
public AntBuildFileBase getAntBuildFile(@NotNull PsiFile file) {
public @Nullable AntBuildFileBase getAntBuildFile(@NotNull PsiFile file) {
final VirtualFile vFile = file.getVirtualFile();
if (vFile != null) {
for (AntBuildFileBase bFile : myBuildFiles) {
@@ -889,8 +879,7 @@ public final class AntConfigurationImpl extends AntConfigurationBase implements
}
@Override
@Nullable
public XmlFile getEffectiveContextFile(final XmlFile file) {
public @Nullable XmlFile getEffectiveContextFile(final XmlFile file) {
return new Object() {
@Nullable XmlFile findContext(final XmlFile file, Set<? super PsiElement> processed) {
if (file != null) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.lang.ant.AntBundle;
@@ -28,13 +28,13 @@ public class AntInstallation {
public static final Convertor<AntInstallation, AntReference> REFERENCE_TO_ANT = antInstallation -> antInstallation.getReference();
public static final AbstractProperty<@Nls String> VERSION =
new StringProperty("version", AntBundle.message("ant.unknown.version.string.presentation"));
@NonNls private static final String PROPERTY_VERSION = "VERSION";
private static final @NonNls String PROPERTY_VERSION = "VERSION";
private final ClassLoaderHolder myClassLoaderHolder;
@NonNls public static final String PATH_TO_ANT_JAR = "lib/ant.jar";
@NonNls public static final String LIB_DIR = "lib";
@NonNls public static final String ANT_JAR_FILE = "ant.jar";
@NonNls public static final String VERSION_RESOURCE = "org/apache/tools/ant/version.txt";
public static final @NonNls String PATH_TO_ANT_JAR = "lib/ant.jar";
public static final @NonNls String LIB_DIR = "lib";
public static final @NonNls String ANT_JAR_FILE = "ant.jar";
public static final @NonNls String VERSION_RESOURCE = "org/apache/tools/ant/version.txt";
public AntReference getReference() {
return new AntReference.BindedReference(this);
@@ -104,8 +104,7 @@ public class AntInstallation {
return myProperties;
}
@NotNull
public ClassLoader getClassLoader() {
public @NotNull ClassLoader getClassLoader() {
return myClassLoaderHolder.getClassloader();
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.execution.CantRunException;
@@ -16,9 +16,9 @@ import java.util.Objects;
public abstract class AntReference {
private static final Logger LOG = Logger.getInstance(AntReference.class);
@NonNls private static final String PROJECT_DEFAULT_ATTR = "projectDefault";
@NonNls private static final String NAME_ATTR = "name";
@NonNls private static final String BUNDLED_ANT_ATTR = "bundledAnt";
private static final @NonNls String PROJECT_DEFAULT_ATTR = "projectDefault";
private static final @NonNls String NAME_ATTR = "name";
private static final @NonNls String BUNDLED_ANT_ATTR = "bundledAnt";
public static final Externalizer<AntReference> EXTERNALIZER = new Externalizer<>() {
@Override
@@ -132,8 +132,7 @@ public abstract class AntReference {
return obj instanceof AntReference && Objects.equals(getName(), ((AntReference)obj).getName());
}
@Nullable
public static AntInstallation findAnt(AbstractProperty<? extends AntReference> property, AbstractProperty.AbstractPropertyContainer container) {
public static @Nullable AntInstallation findAnt(AbstractProperty<? extends AntReference> property, AbstractProperty.AbstractPropertyContainer container) {
GlobalAntConfiguration antConfiguration = GlobalAntConfiguration.INSTANCE.get(container);
LOG.assertTrue(antConfiguration != null);
AntReference antReference = property.get(container);
@@ -157,8 +156,7 @@ public abstract class AntReference {
return antInstallation;
}
@Nullable
public static AntInstallation findAntOrBundled(AbstractProperty.AbstractPropertyContainer container) {
public static @Nullable AntInstallation findAntOrBundled(AbstractProperty.AbstractPropertyContainer container) {
GlobalAntConfiguration antConfiguration = GlobalAntConfiguration.INSTANCE.get(container);
if (container.hasProperty(AntBuildFileImpl.ANT_REFERENCE)) return findAnt(AntBuildFileImpl.ANT_REFERENCE, container);
return antConfiguration.getBundledAnt();

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.lang.ant.config.AntBuildFileBase;
@@ -27,8 +27,8 @@ public final class AntWorkspaceConfiguration implements PersistentStateComponent
private static final Logger LOG = Logger.getInstance(AntWorkspaceConfiguration.class);
private final Project myProject;
@NonNls private static final String BUILD_FILE = "buildFile";
@NonNls private static final String URL = "url";
private static final @NonNls String BUILD_FILE = "buildFile";
private static final @NonNls String URL = "url";
private final AtomicReference<Element> myProperties = new AtomicReference<>(null);
public boolean IS_AUTOSCROLL_TO_SOURCE;
@@ -88,8 +88,7 @@ public final class AntWorkspaceConfiguration implements PersistentStateComponent
}
}
@Nullable
private static Element findChildByUrl(Element parentNode, String url) {
private static @Nullable Element findChildByUrl(Element parentNode, String url) {
for (Element element : parentNode.getChildren(BUILD_FILE)) {
if (Objects.equals(element.getAttributeValue(URL), url)) {
return element;

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.ide.util.PsiNavigationSupport;
@@ -46,8 +32,7 @@ public final class BuildTask {
return myName;
}
@Nullable
public Navigatable getOpenFileDescriptor() {
public @Nullable Navigatable getOpenFileDescriptor() {
final VirtualFile vFile = myTarget.getContainingFile();
return vFile != null ? PsiNavigationSupport.getInstance()
.createNavigatable(myTarget.getProject(), vFile, myOffset) : null;

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.util.config.AbstractProperty;
@@ -29,8 +15,7 @@ public abstract class ClassLoaderHolder {
myOptions = options;
}
@NotNull
public ClassLoader getClassloader() {
public @NotNull ClassLoader getClassloader() {
if (myLoader == null) {
myLoader = buildClasspath();
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.lang.ant.AntBundle;
@@ -21,7 +7,7 @@ import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
public final class ExecuteAfterCompilationEvent extends ExecutionEvent {
@NonNls public static final String TYPE_ID = "afterCompilation";
public static final @NonNls String TYPE_ID = "afterCompilation";
private static final ExecuteAfterCompilationEvent ourInstance = new ExecuteAfterCompilationEvent();

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.lang.ant.AntBundle;
@@ -21,7 +7,7 @@ import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
public final class ExecuteBeforeCompilationEvent extends ExecutionEvent {
@NonNls public static final String TYPE_ID = "beforeCompilation";
public static final @NonNls String TYPE_ID = "beforeCompilation";
private static final ExecuteBeforeCompilationEvent ourInstance = new ExecuteBeforeCompilationEvent();

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.ant.config.impl;
import com.intellij.lang.ant.config.ExecutionEvent;
@@ -28,11 +14,11 @@ import java.util.List;
import java.util.StringTokenizer;
public final class ExecuteCompositeTargetEvent extends ExecutionEvent {
@NonNls public static final String TYPE_ID = "compositeTask";
public static final @NonNls String TYPE_ID = "compositeTask";
private final @Nls String myCompositeName;
private @Nls String myPresentableName;
private final List<@NlsSafe String> myTargetNames;
@NonNls public static final String PRESENTABLE_NAME = "presentableName";
public static final @NonNls String PRESENTABLE_NAME = "presentableName";
public ExecuteCompositeTargetEvent(final @NlsSafe String compositeName) throws WrongNameFormatException {
@@ -51,7 +37,7 @@ public final class ExecuteCompositeTargetEvent extends ExecutionEvent {
public ExecuteCompositeTargetEvent(List<@Nls String> targetNames) {
myTargetNames = targetNames;
@NlsSafe final StringBuilder builder = new StringBuilder();
final @NlsSafe StringBuilder builder = new StringBuilder();
boolean first = true;
builder.append("[");
for (String name : targetNames) {

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