Cleanup (unnecessary 'this')

This commit is contained in:
Roman Shevchenko
2017-04-20 17:50:08 +02:00
parent af57b8414a
commit 38b09b1c61
18 changed files with 51 additions and 52 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* 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.
@@ -128,14 +128,14 @@ public class MethodCandidateInfo extends CandidateInfo{
}
final PsiMethod method = getElement();
if (isToInferApplicability()) {
if (!isOverloadCheck()) {
//ensure applicability check is performed
getSubstitutor(false);
}
//already performed checks, so if inference failed, error message should be saved
//already performed checks, so if inference failed, error message should be saved
if (myInferenceError != null || isPotentiallyCompatible() != ThreeState.YES) {
return ApplicabilityLevel.NOT_APPLICABLE;
}
@@ -288,7 +288,7 @@ public class MethodCandidateInfo extends CandidateInfo{
}
return incompleteSubstitutor;
}
@NotNull
@Override
public PsiSubstitutor getSubstitutor() {
@@ -387,14 +387,14 @@ public class MethodCandidateInfo extends CandidateInfo{
@NotNull final PsiExpression[] arguments,
boolean includeReturnConstraint) {
return computeForOverloadedCandidate(() -> {
final PsiMethod method = MethodCandidateInfo.this.getElement();
final PsiMethod method = this.getElement();
PsiTypeParameter[] typeParameters = method.getTypeParameters();
if (MethodCandidateInfo.this.isRawSubstitution()) {
if (this.isRawSubstitution()) {
return JavaPsiFacade.getInstance(method.getProject()).getElementFactory().createRawSubstitutor(mySubstitutor, typeParameters);
}
final PsiElement parent = MethodCandidateInfo.this.getParent();
final PsiElement parent = this.getParent();
if (parent == null) return PsiSubstitutor.EMPTY;
Project project = method.getProject();
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
@@ -414,7 +414,7 @@ public class MethodCandidateInfo extends CandidateInfo{
}
return false;
}
protected PsiElement getMarkerList() {
return myArgumentList;
}
@@ -523,7 +523,7 @@ public class MethodCandidateInfo extends CandidateInfo{
}
return null;
}
public CurrentCandidateProperties createProperties() {
return new CurrentCandidateProperties(this, getSiteSubstitutor(), isVarargs(), false);
}
@@ -573,7 +573,7 @@ public class MethodCandidateInfo extends CandidateInfo{
myApplicabilityCheck = applicabilityCheck;
}
}
public static class ApplicabilityLevel {
public static final int NOT_APPLICABLE = 1;
public static final int VARARGS = 2;
@@ -103,7 +103,7 @@ public abstract class BaseExternalAnnotationsManager extends ExternalAnnotations
public PsiAnnotation[] findExternalAnnotations(@NotNull final PsiModifierListOwner listOwner) {
final List<AnnotationData> result = collectExternalAnnotations(listOwner);
return result.isEmpty() ? null : ContainerUtil.map2Array(result, PsiAnnotation.EMPTY_ARRAY,
data -> data.getAnnotation(BaseExternalAnnotationsManager.this));
data -> data.getAnnotation(this));
}
private static final List<AnnotationData> NO_DATA = new ArrayList<>(1);
@@ -210,7 +210,7 @@ public abstract class BaseExternalAnnotationsManager extends ExternalAnnotations
final VirtualFile virtualFile = containingFile.getVirtualFile();
if (virtualFile == null) return null;
final List<PsiFile> files = myExternalAnnotationsCache.get(virtualFile);
if (files == NULL_LIST) return null;
@@ -370,9 +370,9 @@ public class ClsFileImpl extends ClsRepositoryPsiElement<PsiClassHolderFileStub>
}
return CachedValuesManager.getCachedValue(this, () -> {
PsiElement target = JavaPsiImplementationHelper.getInstance(getProject()).getClsFileNavigationElement(ClsFileImpl.this);
PsiElement target = JavaPsiImplementationHelper.getInstance(getProject()).getClsFileNavigationElement(this);
ModificationTracker tracker = FileIndexFacade.getInstance(getProject()).getRootModificationTracker();
return CachedValueProvider.Result.create(target, ClsFileImpl.this, target.getContainingFile(), tracker);
return CachedValueProvider.Result.create(target, this, target.getContainingFile(), tracker);
});
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -108,7 +108,7 @@ public class PsiClassImpl extends JavaStubPsiElement<PsiClassStub<?>> implements
public PsiElement getOriginalElement() {
return CachedValuesManager.getCachedValue(this, () -> {
final JavaPsiImplementationHelper helper = JavaPsiImplementationHelper.getInstance(getProject());
final PsiClass result = helper != null ? helper.getOriginalClass(PsiClassImpl.this) : PsiClassImpl.this;
final PsiClass result = helper != null ? helper.getOriginalClass(this) : this;
return CachedValueProvider.Result.create(result, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
});
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* 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.
@@ -43,7 +43,7 @@ public class PsiJavaModuleReferenceElementImpl extends CompositePsiElement imple
@Override
public PsiPolyVariantReference getReference() {
return CachedValuesManager.getCachedValue(this, () -> {
PsiJavaModuleReferenceElementImpl refElement = PsiJavaModuleReferenceElementImpl.this;
PsiJavaModuleReferenceElementImpl refElement = this;
PsiJavaModuleReference ref = refElement.getParent() instanceof PsiJavaModule ? null : new PsiJavaModuleReference(refElement);
return CachedValueProvider.Result.create(ref, refElement);
});
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* 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.
@@ -304,7 +304,7 @@ public class PsiMethodImpl extends JavaStubPsiElement<PsiMethodStub> implements
public MethodSignature getSignature(@NotNull PsiSubstitutor substitutor) {
if (substitutor == PsiSubstitutor.EMPTY) {
return CachedValuesManager.getCachedValue(this, () -> {
MethodSignature signature = MethodSignatureBackedByPsiMethod.create(PsiMethodImpl.this, PsiSubstitutor.EMPTY);
MethodSignature signature = MethodSignatureBackedByPsiMethod.create(this, PsiSubstitutor.EMPTY);
return CachedValueProvider.Result.create(signature, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
});
}
@@ -347,7 +347,7 @@ public class PsiMethodImpl extends JavaStubPsiElement<PsiMethodStub> implements
@NotNull
public SearchScope getUseScope() {
return ApplicationManager.getApplication().runReadAction(
(Computable<SearchScope>)() -> PsiImplUtil.getMemberUseScope(PsiMethodImpl.this));
(Computable<SearchScope>)() -> PsiImplUtil.getMemberUseScope(this));
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -135,7 +135,7 @@ public class PsiMethodReferenceExpressionImpl extends JavaStubPsiElement<Functio
@Override
public PsiMember getPotentiallyApplicableMember() {
return CachedValuesManager.getCachedValue(this, () -> CachedValueProvider.Result
.create(getPotentiallyApplicableMemberInternal(), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, PsiMethodReferenceExpressionImpl.this));
.create(getPotentiallyApplicableMemberInternal(), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, this));
}
private PsiMember getPotentiallyApplicableMemberInternal() {
@@ -210,7 +210,7 @@ public class PsiMethodReferenceExpressionImpl extends JavaStubPsiElement<Functio
}
return null;
}
@Override
public PsiExpression getQualifierExpression() {
final PsiElement qualifier = getQualifier();
@@ -399,8 +399,8 @@ public class PsiMethodReferenceExpressionImpl extends JavaStubPsiElement<Functio
// The function type identifies a single compile-time declaration corresponding to the reference.
// One of the following is true:
// i)The return type of the function type is void.
// ii)The return type of the function type is R;
// the result of applying capture conversion (5.1.10) to the return type of the invocation type (15.12.2.6) of the chosen declaration is R',
// ii)The return type of the function type is R;
// the result of applying capture conversion (5.1.10) to the return type of the invocation type (15.12.2.6) of the chosen declaration is R',
// where R is the target type that may be used to infer R'; neither R nor R' is void; and R' is compatible with R in an assignment context.
Map<PsiElement, PsiType> map = LambdaUtil.getFunctionalTypeMap();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* 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.
@@ -338,14 +338,14 @@ public class CanonicalTypes {
@Override
public Type visitDisjunctionType(PsiDisjunctionType type) {
List<Type> types = ContainerUtil.map(type.getDisjunctions(), type1 -> type1.accept(Creator.this));
List<Type> types = ContainerUtil.map(type.getDisjunctions(), type1 -> type1.accept(this));
return new LogicalOperationType(types, true);
}
@Nullable
@Override
public Type visitIntersectionType(PsiIntersectionType type) {
List<Type> types = ContainerUtil.map(type.getConjuncts(), type1 -> type1.accept(Creator.this));
List<Type> types = ContainerUtil.map(type.getConjuncts(), type1 -> type1.accept(this));
return new LogicalOperationType(types, false);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* 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.
@@ -48,7 +48,7 @@ public abstract class WriteAction<T> extends BaseActionRunnable<T> {
}
TransactionGuard.getInstance().submitTransactionAndWait(() -> {
AccessToken token = start(WriteAction.this.getClass());
AccessToken token = start(this.getClass());
try {
result.run();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* 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.
@@ -18,7 +18,6 @@ package com.intellij.openapi.util;
import com.intellij.openapi.diagnostic.Logger;
import javax.swing.*;
import java.awt.*;
/**
* @author Konstantin Bulenkov
@@ -48,9 +47,9 @@ public class TimedOutCallback extends ActionCallback implements Runnable {
myTask = SimpleTimer.getInstance().setUp(() -> {
myShouldDumpError = System.currentTimeMillis() - current > timeOut; //double check is necessary :-(
if (isEdt) {
SwingUtilities.invokeLater(TimedOutCallback.this);
SwingUtilities.invokeLater(this);
} else {
TimedOutCallback.this.run();
this.run();
}
}, timeOut);
}
@@ -138,7 +138,7 @@ public class DebugReflectionUtil {
}
}
}
private static void queueStronglyReferencedValues(Queue<BackLink> queue,
@NotNull Object root,
@NotNull Condition<Object> shouldExamineValue,
@@ -213,7 +213,7 @@ public class DebugReflectionUtil {
@Override
public String toString() {
String result = "";
BackLink backLink = BackLink.this;
BackLink backLink = this;
while (backLink != null) {
String valueStr;
Object value = backLink.value;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* 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.
@@ -93,7 +93,7 @@ public class CheckResourcesTarget extends BuildTarget<GroovyResourceRootDescript
BuildDataPaths dataPaths) {
ResourcesTarget target = new ResourcesTarget(myModule, ResourcesTargetType.getInstance(isTests()));
List<ResourceRootDescriptor> resources = target.computeRootDescriptors(model, index, ignoredFileIndex, dataPaths);
return ContainerUtil.map(resources, descriptor -> new GroovyResourceRootDescriptor(descriptor, CheckResourcesTarget.this));
return ContainerUtil.map(resources, descriptor -> new GroovyResourceRootDescriptor(descriptor, this));
}
@NotNull
@@ -146,7 +146,7 @@ public class CheckResourcesTarget extends BuildTarget<GroovyResourceRootDescript
@NotNull
@Override
public List<CheckResourcesTarget> computeAllTargets(@NotNull JpsModel model) {
return ContainerUtil.map(model.getProject().getModules(), module -> new CheckResourcesTarget(module, Type.this));
return ContainerUtil.map(model.getProject().getModules(), module -> new CheckResourcesTarget(module, this));
}
@NotNull
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* 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.
@@ -45,7 +45,7 @@ public abstract class MoreAction extends AnAction implements CustomComponentAct
myPanel.setLayout(layout);
myLoadMoreBtn = new JButton(name);
myLoadMoreBtn.setMargin(JBUI.insets(2));
myLoadMoreBtn.addActionListener(e -> MoreAction.this.actionPerformed(null));
myLoadMoreBtn.addActionListener(e -> this.actionPerformed(null));
myPanel.add(myLoadMoreBtn);
myLabel = new JLabel("Loading...");
myLabel.setForeground(UIUtil.getInactiveTextColor());
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -242,7 +242,7 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable {
}
private void stepToNextChangeList() {
ApplicationManager.getApplication().invokeLater(() -> ProgressManager.getInstance().run(SvnIntegrateChangesTask.this));
ApplicationManager.getApplication().invokeLater(() -> ProgressManager.getInstance().run(this));
}
/**
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -167,7 +167,7 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
verify(runSvn("co", myRepoUrl, myWcRoot.getPath()));
initProject(myWcRoot, SvnTestCase.this.getTestName());
initProject(myWcRoot, this.getTestName());
activateVCS(SvnVcs.VCS_NAME);
myGate = new MockChangeListManagerGate(ChangeListManager.getInstance(myProject));
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* 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.
@@ -63,7 +63,7 @@ public class IgnoredFilesTest extends Svn17TestCase {
myClientRoot = new File(myTempDirFixture.getTempDirPath(), "clientroot");
myClientRoot.mkdir();
initProject(myClientRoot, IgnoredFilesTest.this.getTestName());
initProject(myClientRoot, this.getTestName());
((StartupManagerImpl)StartupManager.getInstance(myProject)).runPostStartupActivities();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* 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.
@@ -81,7 +81,7 @@ public class SvnAuthenticationTest extends PlatformTestCase {
protected void tearDown() throws Exception {
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> {
try {
SvnAuthenticationTest.super.tearDown();
super.tearDown();
}
catch (Exception e) {
throw new RuntimeException(e);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* 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.
@@ -61,7 +61,7 @@ public class IgnoredFilesTest extends Svn16TestCase {
myClientRoot = new File(myTempDirFixture.getTempDirPath(), "clientroot");
myClientRoot.mkdir();
initProject(myClientRoot, IgnoredFilesTest.this.getTestName());
initProject(myClientRoot, this.getTestName());
((StartupManagerImpl)StartupManager.getInstance(myProject)).runPostStartupActivities();