mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix some empty stack exceptions during dfa analysis
This commit is contained in:
@@ -532,9 +532,10 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
generateBoxingUnboxingInstructionFor(caseExpression, PsiType.INT);
|
||||
if (TypeConversionUtil.isEnumType(caseExpression.getType())) {
|
||||
addInstruction(new FieldReferenceInstruction(caseExpression, "switch statement expression"));
|
||||
} else {
|
||||
addInstruction(new PopInstruction());
|
||||
}
|
||||
|
||||
addInstruction(new PopInstruction());
|
||||
}
|
||||
|
||||
PsiCodeBlock body = switchStmt.getBody();
|
||||
|
||||
@@ -161,7 +161,8 @@ public class DataFlowRunner {
|
||||
LOG.error(psiBlock.getText(), e); /* TODO[max] !!! hack (of 18186). Please fix in better times. */
|
||||
return RunnerResult.ABORTED;
|
||||
}
|
||||
catch (EmptyStackException e) /* TODO[max] !!! hack (of 18186). Please fix in better times. */ {
|
||||
catch (EmptyStackException e) {
|
||||
//LOG.error(psiBlock.getText(), e); /* TODO[max] !!! hack (of 18186). Please fix in better times. */
|
||||
return RunnerResult.ABORTED;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class MethodCallInstruction extends Instruction {
|
||||
public MethodCallInstruction(@NotNull PsiExpression context, MethodType methodType) {
|
||||
myContext = context;
|
||||
myMethodType = methodType;
|
||||
myCall = context instanceof PsiCallExpression ? (PsiCallExpression)context : null;
|
||||
myCall = methodType == MethodType.REGULAR_METHOD_CALL && context instanceof PsiCallExpression ? (PsiCallExpression)context : null;
|
||||
final PsiExpressionList argList = myCall == null ? null : myCall.getArgumentList();
|
||||
myArgs = argList != null ? argList.getExpressions() : PsiExpression.EMPTY_ARRAY;
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
class Foo {
|
||||
|
||||
boolean foo(Object o, final PairFunction<String, ElementType, Boolean> fun){
|
||||
boolean result = true;
|
||||
result |= fun.fun(path);
|
||||
if (o instanceof String) {
|
||||
o.subst<caret>
|
||||
}
|
||||
}
|
||||
|
||||
void foo(String s) {}
|
||||
}
|
||||
|
||||
interface PairFunction<T, V, U> {
|
||||
U fun(T t, V v);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
class Foo {
|
||||
|
||||
boolean foo(Object o, final PairFunction<String, ElementType, Boolean> fun){
|
||||
boolean result = true;
|
||||
result |= fun.fun(path);
|
||||
if (o instanceof String) {
|
||||
((String) o).substring(<caret>)
|
||||
}
|
||||
}
|
||||
|
||||
void foo(String s) {}
|
||||
}
|
||||
|
||||
interface PairFunction<T, V, U> {
|
||||
U fun(T t, V v);
|
||||
|
||||
}
|
||||
+2
@@ -809,6 +809,8 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
public void testQualifierCastingWithUnknownAssignments() throws Throwable { doTest(); }
|
||||
public void testQualifierCastingBeforeLt() throws Throwable { doTest(); }
|
||||
|
||||
public void testOrAssignmentDfa() throws Throwable { doTest(); }
|
||||
|
||||
public void testWildcardsInLookup() throws Exception {
|
||||
configure()
|
||||
assertNotNull(getLookup());
|
||||
|
||||
Reference in New Issue
Block a user