mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Merge remote-tracking branch 'origin/master'
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();
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
Cleaning output files:
|
||||
out/production/AddParameterToConstructor/Derived.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/Derived.java
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/AddParameterToConstructor/Client.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/Client.java
|
||||
End of files
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
public class Base {
|
||||
public Base() {
|
||||
}
|
||||
public Base(int param) {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class Client {
|
||||
public static void main(String[] args) {
|
||||
Derived der = new Derived();
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
public class Derived extends Base {
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
public class Derived extends Base {
|
||||
public Derived(int ppp) {
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,8 @@ class X {
|
||||
else if (c == ' ') { }
|
||||
else if (c == ':' || prevIsUppercase) { }
|
||||
}
|
||||
|
||||
System.out.println(forCompletion);
|
||||
System.out.println(exactPrefixLen);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class FooWithComments {
|
||||
void unimportantMethod() {
|
||||
AnEnum ae = nullableGetter();
|
||||
if (ae != null) {
|
||||
if (ae == AnEnum.ENUM_VALUE) {
|
||||
anotherMethod(ae.name()); // IDEA warns that ae.name() could cause NPE
|
||||
} else {
|
||||
// do something else
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private native void anotherMethod(String name);
|
||||
|
||||
@Nullable
|
||||
private native AnEnum nullableGetter();
|
||||
|
||||
enum AnEnum {
|
||||
ENUM_VALUE, FOO2
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,9 @@ class Some {
|
||||
i10 == 2 ||
|
||||
i10 == 3 ||
|
||||
i10 == 4) { }
|
||||
if (i1 == 10 || i2 == 10 || i3 == 10 || i4 == 10 || i5 == 10 || i6 == 10 || i7 == 10 || i8 == 10 || i9 == 10 || i10 == 10) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
@@ -23,6 +23,16 @@ class Some {
|
||||
else if (line.startsWith("8")) field8 = someString();
|
||||
else if (line.startsWith("9")) field9 = someString();
|
||||
}
|
||||
System.out.println(field1);
|
||||
System.out.println(field2);
|
||||
System.out.println(field3);
|
||||
System.out.println(field4);
|
||||
System.out.println(field5);
|
||||
System.out.println(field6);
|
||||
System.out.println(field7);
|
||||
System.out.println(field8);
|
||||
System.out.println(field9);
|
||||
|
||||
}
|
||||
|
||||
@NotNull String someString() { return ""; }
|
||||
|
||||
@@ -16,6 +16,21 @@ class Some {
|
||||
if (i11 == 0) System.out.println(foo.getBar11().length());
|
||||
if (i12 == 0) System.out.println(foo.getBar12().length());
|
||||
if (i13 == 0) System.out.println(foo.getBar13().length());
|
||||
|
||||
System.out.println(i1);
|
||||
System.out.println(i2);
|
||||
System.out.println(i3);
|
||||
System.out.println(i4);
|
||||
System.out.println(i5);
|
||||
System.out.println(i6);
|
||||
System.out.println(i7);
|
||||
System.out.println(i8);
|
||||
System.out.println(i9);
|
||||
System.out.println(i10);
|
||||
System.out.println(i11);
|
||||
System.out.println(i12);
|
||||
System.out.println(i13);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testVisitFinallyOnce() throws Throwable { doTest(); }
|
||||
public void testNotEqualsDoesntImplyNotNullity() throws Throwable { doTest(); }
|
||||
public void testEqualsEnumConstant() throws Throwable { doTest(); }
|
||||
public void testEnumConstantNotNull() throws Throwable { doTest(); }
|
||||
public void testEqualsConstant() throws Throwable { doTest(); }
|
||||
public void testFinalLoopVariableInstanceof() throws Throwable { doTest(); }
|
||||
public void testGreaterIsNotEquals() throws Throwable { doTest(); }
|
||||
|
||||
@@ -558,4 +558,25 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
|
||||
"}"
|
||||
);
|
||||
}
|
||||
|
||||
public void testClassObjectAccessExpression_BeforeDot() {
|
||||
String before = "Test \n .class";
|
||||
|
||||
getSettings().KEEP_LINE_BREAKS = true;
|
||||
doMethodTest(before, "Test\n .class");
|
||||
|
||||
getSettings().KEEP_LINE_BREAKS = false;
|
||||
doMethodTest(before, "Test.class");
|
||||
}
|
||||
|
||||
public void testClassObjectAccessExpression_AfterDot() {
|
||||
String before = "Test. \n class";
|
||||
|
||||
getSettings().KEEP_LINE_BREAKS = true;
|
||||
doMethodTest(before, "Test.\n class");
|
||||
|
||||
getSettings().KEEP_LINE_BREAKS = false;
|
||||
doMethodTest(before, "Test.class");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user