performance

This commit is contained in:
Alexey Kudravtsev
2014-06-09 15:55:47 +04:00
parent 2f0830187b
commit 732238fb13
2 changed files with 8 additions and 4 deletions
@@ -49,6 +49,7 @@ import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.PomNamedTarget;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -77,6 +78,7 @@ import java.util.*;
public class PostHighlightingPass extends ProgressableTextEditorHighlightingPass {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.PostHighlightingPass");
private static final Key<Long> LAST_POST_PASS_TIMESTAMP = Key.create("LAST_POST_PASS_TIMESTAMP");
private final LanguageLevel myLanguageLevel;
private RefCountHolder myRefCountHolder;
private final PsiFile myFile;
@Nullable private final Editor myEditor;
@@ -109,6 +111,7 @@ public class PostHighlightingPass extends ProgressableTextEditorHighlightingPass
myEndOffset = file.getTextLength();
myCurrentEntryIndex = -1;
myLanguageLevel = PsiUtil.getLanguageLevel(file);
}
static boolean isUpToDate(@NotNull PsiFile file) {
@@ -509,7 +512,7 @@ public class PostHighlightingPass extends ProgressableTextEditorHighlightingPass
//parameter is defined by functional interface
final PsiElement declarationScope = parameter.getDeclarationScope();
if (declarationScope instanceof PsiMethod &&
myRefCountHolder.isReferencedByMethodReference((PsiMethod)declarationScope)) {
myRefCountHolder.isReferencedByMethodReference((PsiMethod)declarationScope, myLanguageLevel)) {
return null;
}
String message = JavaErrorMessages.message("parameter.is.not.used", identifier.getText());
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* 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.
@@ -20,6 +20,7 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.UserDataHolderEx;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiMatcherImpl;
import com.intellij.psi.util.PsiMatchers;
@@ -204,8 +205,8 @@ public class RefCountHolder {
return usedStatus == Boolean.TRUE;
}
public boolean isReferencedByMethodReference(@NotNull PsiMethod method) {
if (!PsiUtil.isLanguageLevel8OrHigher(method)) return false;
public boolean isReferencedByMethodReference(@NotNull PsiMethod method, @NotNull LanguageLevel languageLevel) {
if (!languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) return false;
List<PsiReference> array;
synchronized (myLocalRefsMap) {