mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
do not highlight method unused if referenced via overridden
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package x;
|
||||
|
||||
interface I {
|
||||
void <warning descr="Method 'ffffff()' is never used">ffffff</warning>();
|
||||
}
|
||||
|
||||
class <warning descr="Class 'XI' is never used">XI</warning> implements I {
|
||||
public void ffffff() {
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package x;
|
||||
|
||||
public interface I {
|
||||
void ffffff();
|
||||
}
|
||||
|
||||
class XI implements I {
|
||||
public void ffffff() {
|
||||
}
|
||||
public void <warning descr="Method 'ffffff2()' is never used">ffffff2</warning>() {
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package x;
|
||||
|
||||
public class X {
|
||||
void g(XI xi) {
|
||||
xi.ffffff();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,9 @@ package com.intellij.codeInsight.daemon;
|
||||
import com.intellij.analysis.PackagesScopesProvider;
|
||||
import com.intellij.application.options.colors.ScopeAttributesUtil;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
@@ -324,4 +327,19 @@ public class AdvHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
public void testPublicClassInRightFile2() throws Exception {
|
||||
doTest(BASE_PATH + "/publicClassInRightFile/x/Y.java", BASE_PATH + "/publicClassInRightFile", false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LocalInspectionTool[] configureLocalInspectionTools() {
|
||||
boolean needUnusedSymbol = getTestName(true).toLowerCase().contains("unused");
|
||||
return needUnusedSymbol ? new LocalInspectionTool[]{new UnusedSymbolLocalInspection()} : new LocalInspectionTool[0];
|
||||
}
|
||||
|
||||
public void testUnusedPublicMethodReferencedViaSubclass() throws Exception {
|
||||
UnusedDeclarationInspection deadCodeInspection = new UnusedDeclarationInspection();
|
||||
enableInspectionTool(deadCodeInspection);
|
||||
//String ref = getTestDataPath() + BASE_PATH + "/unusedPublicMethodRefViaSubclass/x/X.java";
|
||||
allowTreeAccessForAllFiles();
|
||||
|
||||
doTest(BASE_PATH + "/unusedPublicMethodRefViaSubclass/x/I.java", BASE_PATH + "/unusedPublicMethodRefViaSubclass", true, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user