mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
new inference: don't treat void as primitive type to boxing
This commit is contained in:
+2
-2
@@ -45,14 +45,14 @@ public class TypeCompatibilityConstraint implements ConstraintFormula {
|
||||
}
|
||||
return assignable;
|
||||
}
|
||||
if (myS instanceof PsiPrimitiveType) {
|
||||
if (myS instanceof PsiPrimitiveType && !PsiType.VOID.equals(myS)) {
|
||||
final PsiClassType boxedType = ((PsiPrimitiveType)myS).getBoxedType(session.getManager(), session.getScope());
|
||||
if (boxedType != null) {
|
||||
constraints.add(new TypeCompatibilityConstraint(myT, boxedType));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (myT instanceof PsiPrimitiveType) {
|
||||
if (myT instanceof PsiPrimitiveType && !PsiType.VOID.equals(myT)) {
|
||||
final PsiClassType boxedType = ((PsiPrimitiveType)myT).getBoxedType(session.getManager(), session.getScope());
|
||||
if (boxedType != null) {
|
||||
constraints.add(new TypeEqualityConstraint(boxedType, myS));
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class ABC {
|
||||
private <T> void <warning descr="Private method 'foo(java.util.function.Supplier<T>)' is never used">foo</warning>(Supplier<T> <warning descr="Parameter 'dictSeqs' is never used">dictSeqs</warning>) {
|
||||
}
|
||||
private void foo(Runnable <warning descr="Parameter 'r' is never used">r</warning>) {}
|
||||
|
||||
{
|
||||
foo(() -> bar());
|
||||
foo(this::bar);
|
||||
}
|
||||
|
||||
void bar(){}
|
||||
}
|
||||
+4
@@ -171,6 +171,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFunctionalInterfaceIncompatibilityBasedOnAbsenceOfVoidToTypeConvertion() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user