mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix: IDEA-64771 (Grails domain classes should have intention "make nullable")
This commit is contained in:
@@ -40,6 +40,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrApplic
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrParenthesizedExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrExtendsClause;
|
||||
@@ -196,4 +197,6 @@ public abstract class GroovyPsiElementFactory {
|
||||
public abstract GrExtendsClause createExtendsClause();
|
||||
|
||||
public abstract GrImplementsClause createImplementsClause();
|
||||
|
||||
public abstract GrLiteral createLiteralFromValue(@Nullable Object value);
|
||||
}
|
||||
|
||||
+17
@@ -44,6 +44,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArg
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrCodeBlock;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.*;
|
||||
@@ -654,4 +655,20 @@ public class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory {
|
||||
return clause;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GrLiteral createLiteralFromValue(@Nullable Object value) {
|
||||
if (value instanceof String) {
|
||||
return (GrLiteral)createStringLiteral((String)value);
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
return (GrLiteral)createExpressionFromText("null");
|
||||
}
|
||||
|
||||
if (value instanceof Boolean) {
|
||||
return (GrLiteral)createExpressionFromText(value.toString());
|
||||
}
|
||||
|
||||
throw new IncorrectOperationException("Can not create literal from type: " + value.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.impl.light.LightElement;
|
||||
import com.intellij.psi.impl.source.tree.LeafElement;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -1057,4 +1058,8 @@ public class PsiUtil {
|
||||
owner.getModifierList().setModifierProperty(modifier, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLeafElementOfType(@Nullable PsiElement element, IElementType type) {
|
||||
return element instanceof LeafElement && ((LeafElement)element).getElementType() == type;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user