use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class AtomicFieldUpdaterNotStaticFinalInspection method buildErrorString.
@NotNull
@Override
protected String buildErrorString(Object... infos) {
final PsiField field = (PsiField) infos[0];
final PsiType type = field.getType();
final String typeText = type.getPresentableText();
return InspectionGadgetsBundle.message("atomic.field.updater.not.static.final.problem.descriptor", typeText);
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class VolatileArrayFieldInspection method buildErrorString.
@Override
@NotNull
public String buildErrorString(Object... infos) {
final PsiType type = (PsiType) infos[0];
final String typeString = type.getPresentableText();
return InspectionGadgetsBundle.message("volatile.field.problem.descriptor", typeString);
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class ConvertIntegerToHexPredicate method satisfiedBy.
public boolean satisfiedBy(PsiElement element) {
if (!(element instanceof PsiLiteralExpression)) {
return false;
}
final PsiLiteralExpression expression = (PsiLiteralExpression) element;
final PsiType type = expression.getType();
if (PsiType.INT.equals(type) || PsiType.LONG.equals(type)) {
@NonNls final String text = expression.getText();
return !(text.startsWith("0x") || text.startsWith("0X"));
}
if (PsiType.DOUBLE.equals(type) || PsiType.FLOAT.equals(type)) {
if (!PsiUtil.isLanguageLevel5OrHigher(expression)) {
return false;
}
@NonNls final String text = expression.getText();
if (text == null) {
return false;
}
return !text.startsWith("0x") && !text.startsWith("0X");
}
return false;
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class ConvertIntegerToOctalPredicate method satisfiedBy.
public boolean satisfiedBy(PsiElement element) {
if (!(element instanceof PsiLiteralExpression)) {
return false;
}
final PsiLiteralExpression expression = (PsiLiteralExpression) element;
final PsiType type = expression.getType();
if (!(PsiType.INT.equals(type) || PsiType.LONG.equals(type))) {
return false;
}
@NonNls final String text = expression.getText();
if (text.charAt(0) != '0') {
return true;
}
if (text.length() < 2) {
return true;
}
final char c1 = text.charAt(1);
if (c1 != '_' && (c1 < '0' || c1 > '7')) {
return true;
}
return false;
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class UserExpressionDescriptorImpl method getEvaluationCode.
protected PsiCodeFragment getEvaluationCode(final StackFrameContext context) throws EvaluateException {
Pair<PsiElement, PsiType> psiClassAndType = DebuggerUtilsImpl.getPsiClassAndType(myTypeName, myProject);
if (psiClassAndType.first == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.invalid.type.name", myTypeName));
}
PsiCodeFragment fragment = createCodeFragment(psiClassAndType.first);
if (fragment instanceof JavaCodeFragment) {
((JavaCodeFragment) fragment).setThisType(psiClassAndType.second);
}
return fragment;
}
Aggregations