Project: JDT
Bug 392847 Endless loop in AdvancedQuickAssistProcessor.getConvertIfElseToSwitchProposals
Reported: 2012-10-25 12:12:46 | Status: verified fixed

Endless loop in AdvancedQuickAssistProcessor.getConvertIfElseToSwitchProposals: void foo(String[] args) { int n = 42; if (n == args.length) // quick assist on 'if' System.out.println(); else { } } "main" prio=6 tid=0x008ebc00 nid=0xcd0 runnable [0x003dd000] java.lang.Thread.State: RUNNABLE at java.util.HashMap.get(HashMap.java:303) at org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveTypeBindingForName(DefaultBindingResolver.java:910) - locked <0x17b345b0> (a org.eclipse.jdt.core.dom.DefaultBindingResolver) at org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveExpressionType(DefaultBindingResolver.java:693) - locked <0x17b345b0> (a org.eclipse.jdt.core.dom.DefaultBindingResolver) at org.eclipse.jdt.core.dom.Expression.resolveTypeBinding(Expression.java:108) at org.eclipse.jdt.internal.ui.text.correction.AdvancedQuickAssistProcessor.getConvertIfElseToSwitchProposals(AdvancedQuickAssistProcessor.jav a:2494) at org.eclipse.jdt.internal.ui.text.correction.AdvancedQuickAssistProcessor.getConvertIfElseToSwitchProposals(AdvancedQuickAssistProcessor.jav a:2439) at org.eclipse.jdt.internal.ui.text.correction.AdvancedQuickAssistProcessor.getAssists(AdvancedQuickAssistProcessor.java:197) ... Furthermore, I saw code like this in that method: IVariableBinding binding= (IVariableBinding) qualifiedName.resolveBinding(); if (binding.isEnumConstant()) { ... }

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/AdvancedQuickAssistProcessor.java