diff --git a/java/compiler/impl/src/com/intellij/compiler/backwardRefs/JavaBackwardReferenceIndexReaderFactory.java b/java/compiler/impl/src/com/intellij/compiler/backwardRefs/JavaBackwardReferenceIndexReaderFactory.java index 97fa1da85890..f9eb00267509 100644 --- a/java/compiler/impl/src/com/intellij/compiler/backwardRefs/JavaBackwardReferenceIndexReaderFactory.java +++ b/java/compiler/impl/src/com/intellij/compiler/backwardRefs/JavaBackwardReferenceIndexReaderFactory.java @@ -13,16 +13,15 @@ import com.intellij.psi.search.GlobalSearchScope; import com.intellij.util.containers.Queue; import com.intellij.util.indexing.InvertedIndexUtil; import com.intellij.util.indexing.StorageException; -import com.intellij.util.indexing.ValueContainer; import gnu.trove.THashSet; import gnu.trove.TIntHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.jps.backwardRefs.JavaCompilerBackwardReferenceIndex; import org.jetbrains.jps.backwardRefs.CompilerRef; +import org.jetbrains.jps.backwardRefs.JavaCompilerBackwardReferenceIndex; import org.jetbrains.jps.backwardRefs.SignatureData; -import org.jetbrains.jps.backwardRefs.index.JavaCompilerIndices; import org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex; +import org.jetbrains.jps.backwardRefs.index.JavaCompilerIndices; import java.io.File; import java.io.IOException; @@ -90,15 +89,12 @@ public class JavaBackwardReferenceIndexReaderFactory implements CompilerReferenc public TIntHashSet findFileIdsWithImplicitToString(@NotNull CompilerRef ref) throws StorageException { TIntHashSet result = new TIntHashSet(); myIndex.get(JavaCompilerIndices.IMPLICIT_TO_STRING).getData(ref).forEach( - new ValueContainer.ContainerAction() { - @Override - public boolean perform(int id, Void value) { - final VirtualFile file = findFile(id); - if (file != null) { - result.add(((VirtualFileWithId)file).getId()); - } - return true; + (id, value) -> { + final VirtualFile file = findFile(id); + if (file != null) { + result.add(((VirtualFileWithId)file).getId()); } + return true; }); return result; } @@ -300,19 +296,16 @@ public class JavaBackwardReferenceIndexReaderFactory implements CompilerReferenc @NotNull private DefCount getDefinitionCount(CompilerRef.NamedCompilerRef def) throws StorageException { DefCount[] result = new DefCount[]{DefCount.NONE}; - myIndex.get(JavaCompilerIndices.BACK_CLASS_DEF).getData(def).forEach(new ValueContainer.ContainerAction() { - @Override - public boolean perform(int id, Void value) { - if (result[0] == DefCount.NONE) { - result[0] = DefCount.ONE; - return true; - } - if (result[0] == DefCount.ONE) { - result[0] = DefCount.MANY; - return true; - } - return false; + myIndex.get(JavaCompilerIndices.BACK_CLASS_DEF).getData(def).forEach((id, value) -> { + if (result[0] == DefCount.NONE) { + result[0] = DefCount.ONE; + return true; } + if (result[0] == DefCount.ONE) { + result[0] = DefCount.MANY; + return true; + } + return false; }); return result[0]; } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/IconLineMarkerProvider.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/IconLineMarkerProvider.java index 1df3cbda5655..62f96a2927e3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/IconLineMarkerProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/IconLineMarkerProvider.java @@ -33,7 +33,6 @@ import org.jetbrains.uast.evaluation.UEvaluationContextKt; import org.jetbrains.uast.values.*; import javax.swing.*; -import java.awt.event.MouseEvent; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; @@ -97,16 +96,11 @@ public class IconLineMarkerProvider extends LineMarkerProviderDescriptor { final Icon icon = ProjectIconsAccessor.getInstance(project).getIcon(file); if (icon == null) return null; - final GutterIconNavigationHandler navHandler = new GutterIconNavigationHandler() { - @Override - public void navigate(MouseEvent e, PsiElement elt) { - FileEditorManager.getInstance(project).openFile(file, true); - } - }; + final GutterIconNavigationHandler navHandler = (e, elt) -> FileEditorManager.getInstance(project).openFile(file, true); - return new LineMarkerInfo(bindingElement, bindingElement.getTextRange(), icon, - Pass.LINE_MARKERS, null, navHandler, - GutterIconRenderer.Alignment.LEFT); + return new LineMarkerInfo<>(bindingElement, bindingElement.getTextRange(), icon, + Pass.LINE_MARKERS, null, navHandler, + GutterIconRenderer.Alignment.LEFT); } @NotNull diff --git a/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java b/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java index 7c6c9417a216..92691b7d1017 100644 --- a/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java +++ b/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java @@ -27,13 +27,8 @@ import java.util.Set; */ public abstract class AbstractQualifiedReference> extends ASTWrapperPsiElement implements PsiPolyVariantReference, PsiQualifiedReferenceElement { - private static final ResolveCache.PolyVariantResolver MY_RESOLVER = new ResolveCache.PolyVariantResolver() { - @NotNull - @Override - public ResolveResult[] resolve(@NotNull final AbstractQualifiedReference expression, final boolean incompleteCode) { - return expression.resolveInner(); - } - }; + private static final ResolveCache.PolyVariantResolver MY_RESOLVER = + (expression, incompleteCode) -> expression.resolveInner(); protected AbstractQualifiedReference(@NotNull final ASTNode node) { super(node); diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java index ad042e6f0ea8..47897ed9ce9d 100644 --- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java +++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java @@ -643,17 +643,14 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{ return InferenceSession.isMoreSpecific(method2, method1, siteSubstitutor1, ((PsiExpressionList)myArgumentsList).getExpressions(), myArgumentsList, varargsPosition); } } - final PsiUtil.ApplicabilityChecker applicabilityChecker = new PsiUtil.ApplicabilityChecker() { - @Override - public boolean isApplicable(PsiType left, PsiType right, boolean allowUncheckedConversion, int argId) { - if (right instanceof PsiClassType) { - final PsiClass rightClass = ((PsiClassType)right).resolve(); - if (rightClass instanceof PsiTypeParameter) { - right = new PsiImmediateClassType(rightClass, siteSubstitutor1); - } + final PsiUtil.ApplicabilityChecker applicabilityChecker = (left, right, allowUncheckedConversion, argId) -> { + if (right instanceof PsiClassType) { + final PsiClass rightClass = ((PsiClassType)right).resolve(); + if (rightClass instanceof PsiTypeParameter) { + right = new PsiImmediateClassType(rightClass, siteSubstitutor1); } - return languageLevel.isAtLeast(LanguageLevel.JDK_1_8) ? isTypeMoreSpecific(left, right, argId) : TypeConversionUtil.isAssignable(left, right, allowUncheckedConversion); } + return languageLevel.isAtLeast(LanguageLevel.JDK_1_8) ? isTypeMoreSpecific(left, right, argId) : TypeConversionUtil.isAssignable(left, right, allowUncheckedConversion); }; final int applicabilityLevel = PsiUtil.getApplicabilityLevel(method1, methodSubstitutor1, types2AtSite, languageLevel, false, varargsPosition, applicabilityChecker); return applicabilityLevel > MethodCandidateInfo.ApplicabilityLevel.NOT_APPLICABLE; diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/SameParameterValueSlashesTest.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/SameParameterValueSlashesTest.java index c0bbbfb9b080..097407497b21 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/SameParameterValueSlashesTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/SameParameterValueSlashesTest.java @@ -47,34 +47,32 @@ public class SameParameterValueSlashesTest extends LightCodeInsightFixtureTestCa @Test public void testSlashes() { - Runnable runnable = new Runnable() { - public void run() { - String specialSymbol = "\\" + symbol; - String ourIntentionName = "Inline value '"; + Runnable runnable = () -> { + String specialSymbol = "\\" + symbol; + String ourIntentionName = "Inline value '"; - String before = "class C { " + - " void test() {" + - " String s = f(\"" + specialSymbol + "\");" + - " }" + - " String f(String p) {" + - " return \"123\" + p;" + - " }" + - "}"; - myFixture.configureByText("C.java", before); + String before = "class C { " + + " void test() {" + + " String s = f(\"" + specialSymbol + "\");" + + " }" + + " String f(String p) {" + + " return \"123\" + p;" + + " }" + + "}"; + myFixture.configureByText("C.java", before); - final IntentionAction singleIntention = myFixture.findSingleIntention(ourIntentionName); - myFixture.launchAction(singleIntention); + final IntentionAction singleIntention = myFixture.findSingleIntention(ourIntentionName); + myFixture.launchAction(singleIntention); - String after = "class C { " + - " void test() {" + - " String s = f();" + - " }" + - " String f() {" + - " return \"123\" + \"" + specialSymbol + "\";" + - " }" + - "}"; - myFixture.checkResult(after); - } + String after = "class C { " + + " void test() {" + + " String s = f();" + + " }" + + " String f() {" + + " return \"123\" + \"" + specialSymbol + "\";" + + " }" + + "}"; + myFixture.checkResult(after); }; doTest(runnable); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java index 35e038283ee7..19732b88c2b4 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java @@ -25,7 +25,10 @@ import com.intellij.navigation.NavigationItem; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; -import com.intellij.psi.*; +import com.intellij.psi.ElementDescriptionUtil; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiReference; import com.intellij.psi.search.PsiElementProcessor; import com.intellij.usageView.UsageViewShortNameLocation; import com.intellij.util.Consumer; @@ -139,12 +142,9 @@ public class GotoImplementationHandler extends GotoTargetHandler { ImplementationsUpdaterTask(@NotNull GotoData gotoData, @NotNull Editor editor, int offset, final PsiReference reference) { super(gotoData.source.getProject(), ImplementationSearcher.SEARCHING_FOR_IMPLEMENTATIONS, - createComparatorWrapper(Comparator.comparing(new Function() { - @Override - public Comparable apply(PsiElement e1) { - return getRenderer(e1, gotoData).getComparingObject(e1); - } - }))); + createComparatorWrapper(Comparator.comparing((Function)e1 -> { + return getRenderer(e1, gotoData).getComparingObject(e1); + }))); myEditor = editor; myOffset = offset; myGotoData = gotoData; diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java index 7fb05d18485b..0286e2c1c437 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java +++ b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java @@ -20,7 +20,6 @@ import com.intellij.openapi.editor.impl.EditorComponentImpl; import com.intellij.openapi.editor.impl.EditorImpl; import com.intellij.openapi.editor.impl.SoftWrapModelImpl; import com.intellij.openapi.editor.impl.event.MarkupModelListener; -import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapApplianceManager; import com.intellij.openapi.editor.markup.CustomHighlighterRenderer; import com.intellij.openapi.editor.markup.HighlighterLayer; import com.intellij.openapi.editor.markup.HighlighterTargetArea; @@ -236,13 +235,10 @@ public final class LanguageConsoleBuilder { final ConsoleGutterComponent lineEndGutter = new ConsoleGutterComponent(editor, gutterContentProvider, false); editor.getSoftWrapModel().forceAdditionalColumnsUsage(); - ((SoftWrapModelImpl)editor.getSoftWrapModel()).getApplianceManager().setWidthProvider(new SoftWrapApplianceManager.VisibleAreaWidthProvider() { - @Override - public int getVisibleAreaWidth() { - int guttersWidth = lineEndGutter.getPreferredWidth() + lineStartGutter.getPreferredWidth(); - EditorEx editor = getHistoryViewer(); - return editor.getScrollingModel().getVisibleArea().width - guttersWidth; - } + ((SoftWrapModelImpl)editor.getSoftWrapModel()).getApplianceManager().setWidthProvider(() -> { + int guttersWidth = lineEndGutter.getPreferredWidth() + lineStartGutter.getPreferredWidth(); + EditorEx editor1 = getHistoryViewer(); + return editor1.getScrollingModel().getVisibleArea().width - guttersWidth; }); editor.setHorizontalScrollbarVisible(true); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/Messages.java b/platform/platform-api/src/com/intellij/openapi/ui/Messages.java index 568103bf8736..952b593df534 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/Messages.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/Messages.java @@ -740,12 +740,8 @@ public class Messages { final int focusedOptionIndex, Icon icon) { return showCheckboxMessageDialog(message, title, new String[]{OK_BUTTON, CANCEL_BUTTON}, checkboxText, checked, defaultOptionIndex, - focusedOptionIndex, icon, new PairFunction() { - @Override - public Integer fun(final Integer exitCode, final JCheckBox cb) { - return exitCode == -1 ? CANCEL : exitCode + (cb.isSelected() ? 1 : 0); - } - }); + focusedOptionIndex, icon, + (exitCode, cb) -> exitCode == -1 ? CANCEL : exitCode + (cb.isSelected() ? 1 : 0)); } public static int showCheckboxMessageDialog(String message, diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/external/DiffManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/external/DiffManagerImpl.java index b02e2d7b84e3..002c5f7a4b3c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/external/DiffManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/external/DiffManagerImpl.java @@ -15,7 +15,6 @@ import com.intellij.openapi.diff.impl.DiffPanelImpl; import com.intellij.openapi.diff.impl.DiffUtil; import com.intellij.openapi.diff.impl.mergeTool.MergeTool; import com.intellij.openapi.diff.impl.processing.HighlightMode; -import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.markup.MarkupEditorFilter; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; @@ -73,12 +72,7 @@ public class DiffManagerImpl extends DiffManager implements PersistentStateCompo private final ExternalizablePropertyContainer myProperties; public static final DiffTool INTERNAL_DIFF = new FrameDiffTool(); - private static final MarkupEditorFilter DIFF_EDITOR_FILTER = new MarkupEditorFilter() { - @Override - public boolean avaliableIn(Editor editor) { - return DiffUtil.isDiffEditor(editor); - } - }; + private static final MarkupEditorFilter DIFF_EDITOR_FILTER = editor -> DiffUtil.isDiffEditor(editor); private ComparisonPolicy myComparisonPolicy = ComparisonPolicy.DEFAULT; private HighlightMode myHighlightMode = HighlightMode.BY_WORD; diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ColorThief.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ColorThief.java index dc62c8935be2..8f725c92c79d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ColorThief.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ColorThief.java @@ -748,29 +748,21 @@ public class ColorThief { } } - private static final Comparator COMPARATOR_COUNT = new Comparator() { - @Override - public int compare(VBox a, VBox b) { - return a.count(false) - b.count(false); + private static final Comparator COMPARATOR_COUNT = (a, b) -> a.count(false) - b.count(false); + + private static final Comparator COMPARATOR_PRODUCT = (a, b) -> { + int aCount = a.count(false); + int bCount = b.count(false); + int aVolume = a.volume(false); + int bVolume = b.volume(false); + + // If count is 0 for both (or the same), sort by volume + if (aCount == bCount) { + return aVolume - bVolume; } - }; - private static final Comparator COMPARATOR_PRODUCT = new Comparator() { - @Override - public int compare(VBox a, VBox b) { - int aCount = a.count(false); - int bCount = b.count(false); - int aVolume = a.volume(false); - int bVolume = b.volume(false); - - // If count is 0 for both (or the same), sort by volume - if (aCount == bCount) { - return aVolume - bVolume; - } - - // Otherwise sort by products - return Long.compare((long) aCount * aVolume, (long) bCount * bVolume); - } + // Otherwise sort by products + return Long.compare((long) aCount * aVolume, (long) bCount * bVolume); }; } diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/abstraction/OptionalUsedAsFieldOrParameterTypeInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/abstraction/OptionalUsedAsFieldOrParameterTypeInspectionTest.java index 73d8026b81dd..767aed7ac8ae 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/abstraction/OptionalUsedAsFieldOrParameterTypeInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/abstraction/OptionalUsedAsFieldOrParameterTypeInspectionTest.java @@ -61,12 +61,12 @@ public class OptionalUsedAsFieldOrParameterTypeInspectionTest extends LightInspe doTest("import java.util.Optional;" + "import java.util.function.Function;" + "class X {" + - " Function, Long> homebrewOrElseNull = new Function, Long>() {" + - " @Override\n" + - " public Long apply(Optional input) {" + - " return input.isPresent() ? input.get() : null;" + - " }" + - " };" + + "" + + "" + + "" + + "" + + " " + + "Function, Long> homebrewOrElseNull = input-> input.isPresent() ? input.get() : null;" + "}"); } diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/errorhandling/ThrownCaughtLocallyInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/errorhandling/ThrownCaughtLocallyInspectionTest.java index 588edc2bc727..0f9fb0fdf5ab 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/errorhandling/ThrownCaughtLocallyInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/errorhandling/ThrownCaughtLocallyInspectionTest.java @@ -32,11 +32,11 @@ public class ThrownCaughtLocallyInspectionTest extends LightInspectionTestCase { " Runnable runnable = () -> {\n" + " throw new RuntimeException();\n" + " };\n" + - " Runnable runnableLambda = new Runnable() {\n" + - " @Override\n" + - " public void run() {\n" + + "" + + " Runnable runnableLambda = ()-> {\n" + + "" + " throw new RuntimeException();\n" + - " }\n" + + " " + " };\n" + " }\n" + " catch (RuntimeException e){\n" + diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrNewExpressionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrNewExpressionImpl.java index 783bb57ab1f7..b722b89e7483 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrNewExpressionImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrNewExpressionImpl.java @@ -39,13 +39,8 @@ import java.util.List; */ public class GrNewExpressionImpl extends GrCallExpressionImpl implements GrNewExpression { - private static final ResolveCache.PolyVariantResolver RESOLVER = new ResolveCache.PolyVariantResolver() { - @NotNull - @Override - public GroovyResolveResult[] resolve(@NotNull MyFakeReference reference, boolean incompleteCode) { - return reference.getElement().resolveImpl(incompleteCode); - } - }; + private static final ResolveCache.PolyVariantResolver RESOLVER = + (reference, incompleteCode) -> reference.getElement().resolveImpl(incompleteCode); private final MyFakeReference myFakeReference = new MyFakeReference(); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/arithmetic/GrUnaryExpressionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/arithmetic/GrUnaryExpressionImpl.java index 80901464de97..45fff070b578 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/arithmetic/GrUnaryExpressionImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/arithmetic/GrUnaryExpressionImpl.java @@ -78,18 +78,14 @@ public class GrUnaryExpressionImpl extends GrExpressionImpl implements GrUnaryEx } }; - private static final ResolveCache.PolyVariantResolver OUR_RESOLVER = new ResolveCache.PolyVariantResolver() { - @NotNull - @Override - public GroovyResolveResult[] resolve(@NotNull GrUnaryExpressionImpl unary, boolean incompleteCode) { - final GrExpression operand = unary.getOperand(); - if (operand == null) return GroovyResolveResult.EMPTY_ARRAY; + private static final ResolveCache.PolyVariantResolver OUR_RESOLVER = (unary, incompleteCode) -> { + final GrExpression operand = unary.getOperand(); + if (operand == null) return GroovyResolveResult.EMPTY_ARRAY; - final PsiType type = operand.getType(); - if (type == null) return GroovyResolveResult.EMPTY_ARRAY; + final PsiType type = operand.getType(); + if (type == null) return GroovyResolveResult.EMPTY_ARRAY; - return TypesUtil.getOverloadedUnaryOperatorCandidates(type, unary.getOperationTokenType(), operand, PsiType.EMPTY_ARRAY); - } + return TypesUtil.getOverloadedUnaryOperatorCandidates(type, unary.getOperationTokenType(), operand, PsiType.EMPTY_ARRAY); }; public GrUnaryExpressionImpl(@NotNull ASTNode node) { diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltVariableContext.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltVariableContext.java index bab94dec70c0..1b3205a0ffa7 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltVariableContext.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltVariableContext.java @@ -46,12 +46,7 @@ import java.util.List; public class XsltVariableContext implements VariableContext { public static final XsltVariableContext INSTANCE = new XsltVariableContext(); - private final ResolveCache.Resolver RESOLVER = new ResolveCache.Resolver() { - @Nullable - public PsiElement resolve(@NotNull PsiReference psiReference, boolean incompleteCode) { - return resolveInner((XPathVariableReference)psiReference); - } - }; + private final ResolveCache.Resolver RESOLVER = (psiReference, incompleteCode) -> resolveInner((XPathVariableReference)psiReference); @NotNull public XsltVariable[] getVariablesInScope(XPathElement element) { diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/references/SimpleAttributeReference.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/references/SimpleAttributeReference.java index eccbc9c15592..32a91c65459c 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/references/SimpleAttributeReference.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/references/SimpleAttributeReference.java @@ -17,7 +17,10 @@ package org.intellij.lang.xpath.xslt.impl.references; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.TextRange; -import com.intellij.psi.*; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiPolyVariantReference; +import com.intellij.psi.PsiReference; +import com.intellij.psi.ResolveResult; import com.intellij.psi.impl.source.resolve.ResolveCache; import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlAttributeValue; @@ -75,12 +78,8 @@ abstract class SimpleAttributeReference implements PsiReference { @Nullable public final PsiElement resolve() { - return ResolveCache.getInstance(myAttribute.getProject()).resolveWithCaching(this, new ResolveCache.Resolver() { - @Nullable - public PsiElement resolve(@NotNull PsiReference psiReference, boolean b) { - return resolveImpl(); - } - }, false, false); + return ResolveCache.getInstance(myAttribute.getProject()).resolveWithCaching(this, + (ResolveCache.Resolver)(psiReference, b) -> resolveImpl(), false, false); } @Nullable diff --git a/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduConsoleInputFilterProvider.java b/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduConsoleInputFilterProvider.java index b3e19df57008..7c6ed7d631df 100644 --- a/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduConsoleInputFilterProvider.java +++ b/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduConsoleInputFilterProvider.java @@ -8,23 +8,19 @@ import com.intellij.openapi.util.Pair; import org.jetbrains.annotations.NotNull; import java.util.Collections; -import java.util.List; public class PyEduConsoleInputFilterProvider implements ConsoleInputFilterProvider { @NotNull @Override public InputFilter[] getDefaultFilters(@NotNull Project project) { - return new InputFilter[]{new InputFilter() { - @Override - public List> applyFilter(@NotNull String text, @NotNull ConsoleViewContentType outputType) { - if (outputType.equals(ConsoleViewContentType.SYSTEM_OUTPUT) && !text.contains("exit code")) { - return Collections.emptyList(); - } - if (text.startsWith("pydev debugger")) { - return Collections.emptyList(); - } - return Collections.singletonList(Pair.create(text, outputType)); + return new InputFilter[]{(text, outputType) -> { + if (outputType.equals(ConsoleViewContentType.SYSTEM_OUTPUT) && !text.contains("exit code")) { + return Collections.emptyList(); } + if (text.startsWith("pydev debugger")) { + return Collections.emptyList(); + } + return Collections.singletonList(Pair.create(text, outputType)); }}; } } diff --git a/python/src/com/jetbrains/python/pyi/PyiRelatedItemLineMarkerProvider.java b/python/src/com/jetbrains/python/pyi/PyiRelatedItemLineMarkerProvider.java index ad87f357d511..3dfc26acf63b 100644 --- a/python/src/com/jetbrains/python/pyi/PyiRelatedItemLineMarkerProvider.java +++ b/python/src/com/jetbrains/python/pyi/PyiRelatedItemLineMarkerProvider.java @@ -16,7 +16,6 @@ package com.jetbrains.python.pyi; import com.intellij.codeHighlighting.Pass; -import com.intellij.codeInsight.daemon.GutterIconNavigationHandler; import com.intellij.codeInsight.daemon.RelatedItemLineMarkerInfo; import com.intellij.codeInsight.daemon.RelatedItemLineMarkerProvider; import com.intellij.icons.AllIcons; @@ -33,7 +32,6 @@ import com.jetbrains.python.psi.PyTargetExpression; import org.jetbrains.annotations.NotNull; import javax.swing.*; -import java.awt.event.MouseEvent; import java.util.Collection; import java.util.Collections; @@ -73,9 +71,7 @@ public class PyiRelatedItemLineMarkerProvider extends RelatedItemLineMarkerProvi final String stubFileName = relatedElement.getContainingFile().getName(); return new RelatedItemLineMarkerInfo<>( element, element.getTextRange(), ICON, Pass.LINE_MARKERS, - element1 -> itemTitle + " in " + stubFileName, new GutterIconNavigationHandler() { - @Override - public void navigate(MouseEvent e, PsiElement elt) { + element1 -> itemTitle + " in " + stubFileName, (e, elt) -> { final PsiElement restoredRelatedElement = relatedElementPointer.getElement(); if (restoredRelatedElement == null) { return; @@ -87,7 +83,6 @@ public class PyiRelatedItemLineMarkerProvider extends RelatedItemLineMarkerProvi .createNavigatable(restoredRelatedElement.getProject(), virtualFile, offset) .navigate(true); } - } - }, GutterIconRenderer.Alignment.RIGHT, GotoRelatedItem.createItems(Collections.singletonList(relatedElement))); + }, GutterIconRenderer.Alignment.RIGHT, GotoRelatedItem.createItems(Collections.singletonList(relatedElement))); } } diff --git a/python/testSrc/com/jetbrains/python/PySurroundWithTest.java b/python/testSrc/com/jetbrains/python/PySurroundWithTest.java index e0952b1d24eb..adc734746a1d 100644 --- a/python/testSrc/com/jetbrains/python/PySurroundWithTest.java +++ b/python/testSrc/com/jetbrains/python/PySurroundWithTest.java @@ -73,12 +73,8 @@ public class PySurroundWithTest extends PyTestCase { } private void doTestSurroundWithCustomFoldingRegion() { - final Surrounder surrounder = ContainerUtil.find(CustomFoldingSurroundDescriptor.SURROUNDERS, new Condition() { - @Override - public boolean value(Surrounder surrounder) { - return surrounder.getTemplateDescription().contains(")surrounder1 -> surrounder1.getTemplateDescription().contains("