IDEA-66564 (parse indeterminate FP literals in compiled annotations, ultimate fix)

This commit is contained in:
Roman Shevchenko
2011-04-18 18:49:31 +02:00
parent 03bfc64512
commit e182ea6fee
8 changed files with 275 additions and 62 deletions
@@ -664,9 +664,9 @@ public class ClsRepositoryUseTest extends PsiTestCase{
assert method instanceof PsiAnnotationMethod : method;
try {
final PsiAnnotationMemberValue defaultValue = ((PsiAnnotationMethod)method).getDefaultValue();
assert defaultValue instanceof PsiReferenceExpression : defaultValue;
final String type = method.getName().startsWith("f") ? "Float." : "Double";
assert defaultValue.getText().contains(type) : defaultValue;
assert defaultValue instanceof PsiBinaryExpression : defaultValue;
final PsiPrimitiveType type = method.getName().startsWith("f") ? PsiType.FLOAT : PsiType.DOUBLE;
assertEquals(type, ((PsiBinaryExpression)defaultValue).getType());
}
catch (Exception e) {
final String valueText = ((PsiMethodStub)((StubBasedPsiElement)method).getStub()).getDefaultValueText();