mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-54820 - assert: ClassMappingNameConverter.getVariants: diagnostics
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.util.xml;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiClassType;
|
||||
@@ -37,9 +38,11 @@ import java.util.List;
|
||||
*/
|
||||
public class ClassMappingNameConverter extends ResolvingConverter.StringConverter {
|
||||
|
||||
private final static Logger LOG = Logger.getInstance(ClassMappingNameConverter.class);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<? extends String> getVariants(ConvertContext context) {
|
||||
public Collection<String> getVariants(ConvertContext context) {
|
||||
DomElement parent = context.getInvocationElement().getParent();
|
||||
assert parent != null;
|
||||
List<DomElement> children = DomUtil.getDefinedChildren(parent, true, true);
|
||||
@@ -52,9 +55,13 @@ public class ClassMappingNameConverter extends ResolvingConverter.StringConverte
|
||||
if (classElement == null) return Collections.emptyList();
|
||||
Object value = ((GenericDomValue)classElement).getValue();
|
||||
if (value == null) return Collections.emptyList();
|
||||
assert value instanceof PsiClass : classElement + " should have PsiClass type, but was " + value;
|
||||
PsiClass psiClass = (PsiClass)value;
|
||||
if (!(value instanceof PsiClass)) {
|
||||
LOG.error(classElement.getGenericInfo() + " should have PsiClass type, but was " + value + "\n" +
|
||||
"element: " + classElement.getXmlElement());
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
PsiClass psiClass = (PsiClass)value;
|
||||
JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(context.getProject());
|
||||
PsiClassType classType = PsiTypesUtil.getClassType(psiClass);
|
||||
SuggestedNameInfo info = codeStyleManager.suggestVariableName(VariableKind.LOCAL_VARIABLE, null, null, classType);
|
||||
|
||||
Reference in New Issue
Block a user