mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-74704 Groovy 1.9: Introduce Refactorings applied to multi-catch parameter should not suggest union type
This commit is contained in:
@@ -181,6 +181,7 @@ public abstract class GroovyRefactoringUtil {
|
||||
|
||||
// todo add type hierarchy
|
||||
public static Map<String, PsiType> getCompatibleTypeNames(@NotNull PsiType type) {
|
||||
if (type instanceof PsiDisjunctionType) type = ((PsiDisjunctionType)type).getLeastUpperBound();
|
||||
Map<String, PsiType> map = new LinkedHashMap<String, PsiType>();
|
||||
final PsiPrimitiveType unboxed = PsiPrimitiveType.getUnboxedType(type);
|
||||
if (unboxed != null) type = unboxed;
|
||||
|
||||
+6
-1
@@ -231,13 +231,18 @@ public class GrIntroduceConstantDialog extends DialogWrapper
|
||||
|
||||
|
||||
private void initializeTypeCombo() {
|
||||
final PsiType expressionType;
|
||||
PsiType expressionType;
|
||||
if (myContext.expression != null) {
|
||||
expressionType = myContext.expression.getType();
|
||||
}
|
||||
else {
|
||||
expressionType = myContext.var.getDeclaredType();
|
||||
}
|
||||
|
||||
if (expressionType instanceof PsiDisjunctionType) {
|
||||
expressionType = ((PsiDisjunctionType)expressionType).getLeastUpperBound();
|
||||
}
|
||||
|
||||
if (expressionType != null) {
|
||||
myTypes = GroovyRefactoringUtil.getCompatibleTypeNames(expressionType);
|
||||
for (String typeName : myTypes.keySet()) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.refactoring.ui;
|
||||
|
||||
import com.intellij.psi.PsiDisjunctionType;
|
||||
import com.intellij.psi.PsiType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringUtil;
|
||||
@@ -34,6 +35,7 @@ public class GrTypeComboBox extends JComboBox {
|
||||
|
||||
public GrTypeComboBox(PsiType type, boolean selectType) {
|
||||
super();
|
||||
if (type instanceof PsiDisjunctionType) type = ((PsiDisjunctionType)type).getLeastUpperBound();
|
||||
myType = type;
|
||||
initialize();
|
||||
if (selectType && getItemCount() > 1) {
|
||||
|
||||
Reference in New Issue
Block a user