Fix deprecated API usages

This commit is contained in:
Roman Shevchenko
2012-05-11 22:03:34 +04:00
parent c6c028883b
commit 73f8db9d5f
11 changed files with 27 additions and 23 deletions
@@ -40,16 +40,19 @@ public enum LanguageLevel {
}
/** @deprecated (to remove in IDEA 13) */
@SuppressWarnings("UnusedDeclaration")
public int getIndex() {
return ordinal() + 3; // solely for backward compatibility
}
/** @deprecated (to remove in IDEA 13) */
@SuppressWarnings("UnusedDeclaration")
public boolean hasAssertKeyword() {
return isAtLeast(JDK_1_4);
}
/** @deprecated use {@linkplain com.intellij.psi.util.PsiUtil#isLanguageLevel5OrHigher(com.intellij.psi.PsiElement)} (to remove in IDEA 13) */
@SuppressWarnings("UnusedDeclaration")
public boolean hasEnumKeywordAndAutoboxing() {
return isAtLeast(JDK_1_5);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -104,7 +104,7 @@ public class PsiPrimitiveType extends PsiType {
@Nullable
public static PsiPrimitiveType getUnboxedType(PsiType type) {
if (!(type instanceof PsiClassType)) return null;
if (!((PsiClassType)type).getLanguageLevel().hasEnumKeywordAndAutoboxing()) return null;
if (!((PsiClassType)type).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_5)) return null;
final PsiClass psiClass = ((PsiClassType)type).resolve();
if (psiClass == null) return null;
return ourQNameToUnboxed.get(psiClass.getQualifiedName());
@@ -124,7 +124,7 @@ public class PsiPrimitiveType extends PsiType {
@Nullable
public PsiClassType getBoxedType(PsiElement context) {
LanguageLevel languageLevel = PsiUtil.getLanguageLevel(context);
if (!languageLevel.hasEnumKeywordAndAutoboxing()) return null;
if (!languageLevel.isAtLeast(LanguageLevel.JDK_1_5)) return null;
final String boxedQName = getBoxedTypeName();
//[ven]previous call returns null for NULL, VOID
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -780,7 +780,7 @@ public class TypeConversionUtil {
private static final Key<CachedValue<Set<String>>> POSSIBLE_BOXED_HOLDER_TYPES = Key.create("Types that may be possibly assigned from primitive ones");
private static boolean isBoxable(final PsiClassType left, final PsiPrimitiveType right) {
if (!left.getLanguageLevel().hasEnumKeywordAndAutoboxing()) return false;
if (!left.getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_5)) return false;
final PsiClass psiClass = left.resolve();
if (psiClass == null) return false;