apply SS replace #findAnnotation -> #hasAnnotation

This commit is contained in:
Daniil Ovchinnikov
2018-04-11 19:15:51 +03:00
parent 75e319ad72
commit 0830617b9d
29 changed files with 55 additions and 271 deletions
@@ -108,8 +108,8 @@ public class InferredAnnotationsManagerImpl extends InferredAnnotationsManager {
if (!(owner instanceof PsiMethodImpl)) return null;
PsiMethodImpl method = (PsiMethodImpl)owner;
PsiModifierList modifiers = (method).getModifierList();
if (modifiers.findAnnotation(Mutability.UNMODIFIABLE_ANNOTATION) != null ||
modifiers.findAnnotation(Mutability.UNMODIFIABLE_VIEW_ANNOTATION) != null) {
if (modifiers.hasAnnotation(Mutability.UNMODIFIABLE_ANNOTATION) ||
modifiers.hasAnnotation(Mutability.UNMODIFIABLE_VIEW_ANNOTATION)) {
return null;
}
return JavaSourceInference.inferMutability(method).asAnnotation(myProject);
@@ -117,7 +117,7 @@ public class InferredAnnotationsManagerImpl extends InferredAnnotationsManager {
@Nullable
private PsiAnnotation getInferredContractAnnotation(PsiMethodImpl method) {
if (method.getModifierList().findAnnotation(ORG_JETBRAINS_ANNOTATIONS_CONTRACT) != null) {
if (method.getModifierList().hasAnnotation(ORG_JETBRAINS_ANNOTATIONS_CONTRACT)) {
return null;
}
@@ -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-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.
package com.intellij.codeInsight;
import com.intellij.psi.PsiAnnotation;
@@ -46,7 +32,7 @@ public class NullityAnnotationModifier extends TypeAnnotationModifier {
String qName = annotation.getQualifiedName();
return qName != null &&
(NullableNotNullManager.isNullableAnnotation(annotation) || NullableNotNullManager.isNotNullAnnotation(annotation)) &&
boundType.findAnnotation(qName) != null;
boundType.hasAnnotation(qName);
}
@Nullable
@@ -137,7 +137,7 @@ public class AddAnnotationPsiFix extends LocalQuickFixOnPsiElement {
final ExternalAnnotationsManager annotationsManager = ExternalAnnotationsManager.getInstance(project);
final PsiModifierList modifierList = myModifierListOwner.getModifierList();
if (modifierList == null || modifierList.findAnnotation(myAnnotation) != null) return;
if (modifierList == null || modifierList.hasAnnotation(myAnnotation)) return;
PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(myAnnotation, myModifierListOwner.getResolveScope());
final ExternalAnnotationsManager.AnnotationPlace annotationAnnotationPlace;
if (aClass != null && aClass.getManager().isInProject(aClass) && AnnotationsHighlightUtil.getRetentionPolicy(aClass) == RetentionPolicy.RUNTIME) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2013 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-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.
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.CodeInsightSettings;
@@ -46,7 +32,6 @@ import com.intellij.psi.util.FileTypeUtils;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.containers.ContainerUtil;
import java.util.HashSet;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -260,7 +245,7 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
PsiElement granny = parent.getParent();
if (granny instanceof PsiMethod) {
final PsiMethod method = (PsiMethod)granny;
if (method.getModifierList().findAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE) != null) {
if (method.getModifierList().hasAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE)) {
PsiClass aClass = method.getContainingClass();
final Set<PsiClass> probableTypes = new HashSet<>();
InheritanceUtil.processSupers(aClass, false, psiClass -> {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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-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.
package com.intellij.codeInsight.generation;
import com.intellij.codeInsight.ExceptionUtil;
@@ -600,7 +586,7 @@ public class GenerateMembersUtil {
public static void copyAnnotations(@NotNull PsiModifierList source, @NotNull PsiModifierList target, String... skipAnnotations) {
for (PsiAnnotation annotation : source.getAnnotations()) {
String qualifiedName = annotation.getQualifiedName();
if (qualifiedName == null || ArrayUtil.contains(qualifiedName, skipAnnotations) || target.findAnnotation(qualifiedName) != null) {
if (qualifiedName == null || ArrayUtil.contains(qualifiedName, skipAnnotations) || target.hasAnnotation(qualifiedName)) {
continue;
}
AddAnnotationPsiFix.addPhysicalAnnotation(qualifiedName, annotation.getParameterList().getAttributes(), target);
@@ -264,7 +264,7 @@ public class AnnotationUtil {
else if (listOwner instanceof PsiVariable) {
type = ((PsiVariable)listOwner).getType();
}
if (type != null && type.findAnnotation(annotationFQN) != null) {
if (type != null && type.hasAnnotation(annotationFQN)) {
return true;
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2017 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-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.
package com.intellij.codeInsight;
import com.intellij.openapi.components.ServiceManager;
@@ -14,10 +14,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
import static com.intellij.codeInsight.AnnotationUtil.CHECK_HIERARCHY;
import static com.intellij.codeInsight.AnnotationUtil.CHECK_EXTERNAL;
import static com.intellij.codeInsight.AnnotationUtil.CHECK_INFERRED;
import static com.intellij.codeInsight.AnnotationUtil.CHECK_TYPE;
import static com.intellij.codeInsight.AnnotationUtil.*;
/**
* @author anna
@@ -157,7 +154,7 @@ public abstract class NullableNotNullManager {
String qualifiedName = checkContainer(annotation);
if (qualifiedName != null) {
PsiModifierList modifierList = target.getModifierList();
if (modifierList != null && modifierList.findAnnotation(qualifiedName) == null) {
if (modifierList != null && !modifierList.hasAnnotation(qualifiedName)) {
return modifierList.addAnnotation(qualifiedName);
}
}
@@ -1,26 +1,11 @@
/*
* 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-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.
package com.intellij.patterns;
import com.intellij.openapi.util.Condition;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.psi.PsiModifierList;
import com.intellij.psi.PsiModifierListOwner;
import com.intellij.util.ProcessingContext;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.codeInsight.AnnotationUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -56,7 +41,7 @@ public class PsiModifierListOwnerPattern<T extends PsiModifierListOwner, Self ex
return with(new PatternCondition<T>("withAnnotation") {
public boolean accepts(@NotNull final T t, final ProcessingContext context) {
final PsiModifierList modifierList = t.getModifierList();
return modifierList != null && modifierList.findAnnotation(qualifiedName) != null;
return modifierList != null && modifierList.hasAnnotation(qualifiedName);
}
});
}
@@ -46,7 +46,7 @@ public interface PsiAnnotationOwner {
* @since 2018.2
*/
default boolean hasAnnotation(@NotNull @NonNls String qualifiedName) {
return findAnnotation(qualifiedName) != null;
return hasAnnotation(qualifiedName);
}
/**
@@ -1,4 +1,4 @@
// Copyright 2000-2017 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-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.
package com.siyeh.ig.inheritance;
import com.intellij.codeInspection.*;
@@ -181,7 +181,7 @@ public class MissingOverrideAnnotationInspection extends AbstractBaseJavaLocalIn
private boolean hasOverrideAnnotation(PsiModifierListOwner element) {
final PsiModifierList modifierList = element.getModifierList();
return modifierList != null && modifierList.findAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE) != null;
return modifierList != null && modifierList.hasAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE);
}
private boolean isJdk6Override(PsiMethod method, PsiClass methodClass) {
@@ -171,7 +171,7 @@ public class MissingDeprecatedAnnotationInspection extends BaseInspection {
private boolean hasDeprecatedAnnotation(PsiModifierListOwner element) {
final PsiModifierList modifierList = element.getModifierList();
return modifierList != null && modifierList.findAnnotation(CommonClassNames.JAVA_LANG_DEPRECATED) != null;
return modifierList != null && modifierList.hasAnnotation(CommonClassNames.JAVA_LANG_DEPRECATED);
}
private boolean hasDeprecatedComment(PsiJavaDocumentedElement element, boolean checkContent) {
@@ -172,7 +172,7 @@ public class JUnit4AnnotatedMethodInJUnit3TestCaseInspection extends JUnit4Annot
}
private static void addAnnotationIfNotPresent(PsiModifierList modifierList, String qualifiedAnnotationName) {
if (modifierList.findAnnotation(qualifiedAnnotationName) != null) {
if (modifierList.hasAnnotation(qualifiedAnnotationName)) {
return;
}
final PsiAnnotation annotation = modifierList.addAnnotation(qualifiedAnnotationName);
@@ -149,7 +149,7 @@ public class AnnotateOverriddenMethodsIntention extends MutablyNamedIntention {
if (modifierList == null) {
return;
}
if (modifierList.findAnnotation(annotationName) != null) return;
if (modifierList.hasAnnotation(annotationName)) return;
final ExternalAnnotationsManager.AnnotationPlace annotationAnnotationPlace = annotationsManager.chooseAnnotationsPlace(modifierListOwner);
if (annotationAnnotationPlace == ExternalAnnotationsManager.AnnotationPlace.NOWHERE) {
return;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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-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.
package org.jetbrains.idea.devkit.testAssistant;
import com.intellij.openapi.util.Computable;
@@ -108,7 +94,7 @@ public class TestDataReferenceCollector {
for (int i = 0, psiParametersLength = psiParameters.length; i < psiParametersLength; i++) {
PsiParameter psiParameter = psiParameters[i];
final PsiModifierList modifierList = psiParameter.getModifierList();
if (modifierList != null && modifierList.findAnnotation(TEST_DATA_FILE_ANNOTATION_QUALIFIED_NAME) != null) {
if (modifierList != null && modifierList.hasAnnotation(TEST_DATA_FILE_ANNOTATION_QUALIFIED_NAME)) {
myFoundTestDataParameters = true;
if (psiParameter.isVarArgs()) {
processVarargCallArgument(expression, argumentMap, result);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2014 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-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.
package org.jetbrains.plugins.groovy.annotator.checkers;
import com.intellij.lang.annotation.AnnotationHolder;
@@ -49,7 +35,7 @@ public class DelegatesToAnnotationChecker extends CustomAnnotationChecker {
final PsiElement parent = parent1.getParent();
if (parent instanceof GrParameterList) {
for (GrParameter parameter : ((GrParameterList)parent).getParameters()) {
if (parameter.getModifierList().findAnnotation(GroovyCommonClassNames.GROOVY_LANG_DELEGATES_TO_TARGET) != null) {
if (parameter.getModifierList().hasAnnotation(GroovyCommonClassNames.GROOVY_LANG_DELEGATES_TO_TARGET)) {
return true;
}
}
@@ -1,26 +1,10 @@
/*
* Copyright 2000-2014 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-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.
package org.jetbrains.plugins.groovy.gpp;
import com.intellij.codeInsight.generation.OverrideImplementExploreUtil;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
import com.intellij.psi.infos.CandidateInfo;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -190,6 +174,6 @@ public class GppClosureParameterTypeProvider extends AbstractClosureParameterEnh
}
private static boolean hasTraitImplementation(PsiMethod method) {
return method.getModifierList().findAnnotation("org.mbte.groovypp.runtime.HasDefaultImplementation") != null;
return method.getModifierList().hasAnnotation("org.mbte.groovypp.runtime.HasDefaultImplementation");
}
}
@@ -757,8 +757,8 @@ public class PsiImplUtil {
}
public static boolean hasImmutableAnnotation(PsiModifierList modifierList) {
return modifierList.findAnnotation(GroovyCommonClassNames.GROOVY_LANG_IMMUTABLE) != null ||
modifierList.findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_IMMUTABLE) != null;
return modifierList.hasAnnotation(GroovyCommonClassNames.GROOVY_LANG_IMMUTABLE) ||
modifierList.hasAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_IMMUTABLE);
}
public static boolean isWhiteSpaceOrNls(@Nullable PsiElement sibling) {
@@ -1,6 +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-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.
package org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions;
import com.intellij.openapi.project.Project;
@@ -15,7 +13,6 @@ import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.containers.ComparatorUtil;
import com.intellij.util.containers.ContainerUtil;
import java.util.HashMap;
import gnu.trove.THashMap;
import gnu.trove.TIntObjectHashMap;
import gnu.trove.TObjectIntHashMap;
@@ -40,10 +37,7 @@ import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrTypeConverter.Appli
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
import static org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.HardcodedGroovyMethodConstants.*;
@@ -665,7 +659,7 @@ public class TypesUtil implements TypeConstants {
for (PsiClass psiClass : classMap.values()) {
PsiModifierList modifierList = psiClass.getModifierList();
if (modifierList != null) {
if (modifierList.findAnnotation(annotationFQN) != null) {
if (modifierList.hasAnnotation(annotationFQN)) {
return true;
}
}
@@ -1,6 +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-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.
package org.jetbrains.plugins.groovy.lang.psi.uast
import com.intellij.psi.*
@@ -66,7 +64,7 @@ class GrUMethod(val grElement: GrMethod,
override val uastParameters: List<UParameter> by lazy { grElement.parameters.map { GrUParameter(it, { this }) } }
override val isOverride: Boolean by lazy { psi.modifierList.findAnnotation("java.lang.Override") != null }
override val isOverride: Boolean by lazy { psi.modifierList.hasAnnotation("java.lang.Override") }
override val uastAnchor: UIdentifier
get() = UIdentifier(grElement.nameIdentifierGroovy, this)
@@ -355,7 +355,7 @@ public class GrClassImplUtil {
private static boolean shouldProcessInstanceMembers(@NotNull GrTypeDefinition grType, @Nullable PsiElement lastParent) {
if (lastParent != null) {
final GrModifierList modifierList = grType.getModifierList();
if (modifierList != null && modifierList.findAnnotation(GroovyCommonClassNames.GROOVY_LANG_CATEGORY) != null) {
if (modifierList != null && modifierList.hasAnnotation(GroovyCommonClassNames.GROOVY_LANG_CATEGORY)) {
return false;
}
}
@@ -1,24 +1,9 @@
/*
* Copyright 2000-2017 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-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.
package org.jetbrains.plugins.groovy.lang.resolve.ast;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.util.PropertyUtil;
import com.intellij.psi.util.PropertyUtilBase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -51,7 +36,7 @@ public class ConstructorAnnotationsProcessor implements AstTransformationSupport
final PsiAnnotation tupleConstructor = modifierList.findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_TUPLE_CONSTRUCTOR);
final boolean immutable = PsiImplUtil.hasImmutableAnnotation(modifierList);
final boolean canonical = modifierList.findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_CANONICAL) != null;
final boolean canonical = modifierList.hasAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_CANONICAL);
if (!immutable && !canonical && tupleConstructor == null) {
return;
}
@@ -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-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.
package org.jetbrains.plugins.groovy.lang.resolve.ast;
import com.intellij.openapi.util.text.StringUtil;
@@ -64,6 +50,6 @@ public class InheritConstructorContributor implements AstTransformationSupport {
public static boolean hasInheritConstructorsAnnotation(PsiClass psiClass) {
final PsiModifierList modifierList = psiClass.getModifierList();
return modifierList != null && modifierList.findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_INHERIT_CONSTRUCTORS) != null;
return modifierList != null && modifierList.hasAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_INHERIT_CONSTRUCTORS);
}
}
@@ -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-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.
package org.jetbrains.plugins.groovy.transformations.impl;
import com.intellij.psi.PsiArrayType;
@@ -97,7 +83,7 @@ public class BaseScriptTransformationSupport implements AstTransformationSupport
return null;
}
for (GrVariableDeclaration declaration : file.getScriptDeclarations(false)) {
if (declaration.getModifierList().findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_BASE_SCRIPT) != null) {
if (declaration.getModifierList().hasAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_BASE_SCRIPT)) {
return declaration;
}
}
@@ -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-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.
package org.jetbrains.plugins.groovy.transformations.impl;
import org.jetbrains.annotations.NotNull;
@@ -35,7 +21,7 @@ public class FieldScriptTransformationSupport implements AstTransformationSuppor
return;
}
for (GrVariableDeclaration declaration : scriptClass.getContainingFile().getScriptDeclarations(true)) {
if (declaration.getModifierList().findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD) != null) {
if (declaration.getModifierList().hasAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD)) {
for (GrVariable variable : declaration.getVariables()) {
context.addField(new GrScriptField(variable, scriptClass));
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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-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.
package org.jetbrains.plugins.groovy.util;
import com.intellij.codeInsight.generation.GenerateMembersUtil;
@@ -126,7 +112,7 @@ public class GroovyOverrideImplementUtil {
final GrModifierList modifierList = parameter.getModifierList();
String qname = annotation.getQualifiedName();
if (qname != null && modifierList.findAnnotation(qname) == null) {
if (qname != null && !modifierList.hasAnnotation(qname)) {
if (annotation instanceof GrAnnotation) {
modifierList.add(annotation);
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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-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.
package org.jetbrains.plugins.groovy.overrideImplement;
import com.intellij.codeInsight.MethodImplementor;
@@ -109,7 +95,7 @@ public class GroovyMethodImplementor implements MethodImplementor {
if (myInsertOverrideIfPossible) {
if (OverrideImplementUtil.canInsertOverride(method, myTargetClass) &&
JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_LANG_OVERRIDE, myTargetClass.getResolveScope()) != null &&
method.getModifierList().findAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE) == null) {
!method.getModifierList().hasAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE)) {
method.getModifierList().addAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE);
}
}
@@ -1,6 +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-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.
package org.jetbrains.plugins.groovy.refactoring.convertToStatic;
import com.intellij.openapi.diagnostic.Logger;
@@ -191,7 +189,7 @@ public class ConvertToStaticProcessor extends BaseRefactoringProcessor {
void addAnnotation(@NotNull PsiModifierListOwner owner, boolean isStatic) {
PsiModifierList modifierList = owner.getModifierList();
String annotation = isStatic ? GROOVY_TRANSFORM_COMPILE_STATIC : GROOVY_TRANSFORM_COMPILE_DYNAMIC;
if (modifierList != null && modifierList.findAnnotation(annotation) == null) {
if (modifierList != null && !modifierList.hasAnnotation(annotation)) {
modifierList.addAnnotation(annotation);
}
}
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2017 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-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.
package com.intellij.codeInspection.i18n;
@@ -636,7 +634,7 @@ public class I18nInspection extends AbstractBaseJavaLocalInspectionTool implemen
return false;
}
final PsiModifierList pkgModifierList = psiPackage.getAnnotationList();
return pkgModifierList != null && pkgModifierList.findAnnotation(AnnotationUtil.NON_NLS) != null
return pkgModifierList != null && pkgModifierList.hasAnnotation(AnnotationUtil.NON_NLS)
|| isPackageNonNls(psiPackage.getParentPackage());
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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-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.
package org.jetbrains.uast.java
@@ -43,7 +29,7 @@ open class JavaUMethod(
}
override val isOverride: Boolean
get() = psi.modifierList.findAnnotation("java.lang.Override") != null
get() = psi.modifierList.hasAnnotation("java.lang.Override")
override val uastAnchor: UIdentifier
get() = UIdentifier((psi.originalElement as? PsiNameIdentifierOwner)?.nameIdentifier ?: psi.nameIdentifier, this)