mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
redundant cast: ignore foreach iter values with functional expressions inside casts (IDEA-126641)
This commit is contained in:
@@ -518,7 +518,9 @@ public class RedundantCastUtil {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parent instanceof PsiThrowStatement) {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems/>
|
||||
@@ -0,0 +1,10 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
class IterableMain {
|
||||
public static void main(final String... args) {
|
||||
for (final String s : (Iterable<String>) XIterator::new) {}
|
||||
}
|
||||
|
||||
public static interface XIterator extends Iterator<String> {}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ package com.intellij.codeInspection;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
@@ -33,6 +32,7 @@ public class RedundantCast18Test extends InspectionTestCase {
|
||||
public void testLambdaContext() throws Exception { doTest(); }
|
||||
public void testMethodRefContext() throws Exception { doTest(); }
|
||||
public void testExpectedSupertype() throws Exception { doTest(); }
|
||||
public void testForeachValue() throws Exception { doTest(); }
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
|
||||
Reference in New Issue
Block a user