mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PsiType#annotate: unsupported operation error replaced with log.error
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
@@ -45,6 +46,8 @@ public abstract class PsiType implements PsiAnnotationOwner {
|
||||
return count == 0 ? EMPTY_ARRAY : new PsiType[count];
|
||||
}
|
||||
};
|
||||
private static final Logger LOG = Logger.getInstance("#" + PsiType.class.getName());
|
||||
|
||||
@NotNull
|
||||
public static PsiType[] createArray(int count) {
|
||||
return ARRAY_FACTORY.create(count);
|
||||
@@ -68,7 +71,8 @@ public abstract class PsiType implements PsiAnnotationOwner {
|
||||
|
||||
@NotNull
|
||||
public PsiType annotate(@NotNull TypeAnnotationProvider provider) {
|
||||
throw new UnsupportedOperationException("Not implemented for " + getClass());
|
||||
LOG.error("Not implemented for " + getClass());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.roots.FileIndexFacade;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.PsiClassReferenceType;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.Function;
|
||||
@@ -105,7 +106,7 @@ class TypeCorrector extends PsiTypeMapper {
|
||||
if (vFile == null) {
|
||||
return psiClass;
|
||||
}
|
||||
|
||||
|
||||
final FileIndexFacade index = FileIndexFacade.getInstance(file.getProject());
|
||||
if (!index.isInSource(vFile) && !index.isInLibrarySource(vFile) && !index.isInLibraryClasses(vFile)) {
|
||||
return psiClass;
|
||||
@@ -167,7 +168,14 @@ class TypeCorrector extends PsiTypeMapper {
|
||||
public PsiCorrectedClassType(LanguageLevel languageLevel,
|
||||
PsiClassType delegate,
|
||||
CorrectedResolveResult resolveResult) {
|
||||
super(languageLevel, delegate.getAnnotationProvider());
|
||||
this(languageLevel, delegate, resolveResult, delegate.getAnnotationProvider());
|
||||
}
|
||||
|
||||
public PsiCorrectedClassType(LanguageLevel languageLevel,
|
||||
PsiClassType delegate,
|
||||
CorrectedResolveResult resolveResult,
|
||||
TypeAnnotationProvider delegateAnnotationProvider) {
|
||||
super(languageLevel, delegateAnnotationProvider);
|
||||
myDelegate = delegate;
|
||||
myResolveResult = resolveResult;
|
||||
}
|
||||
@@ -204,6 +212,13 @@ class TypeCorrector extends PsiTypeMapper {
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiCorrectedClassType annotate(@NotNull TypeAnnotationProvider provider) {
|
||||
return provider == getAnnotationProvider() ? this
|
||||
: new PsiCorrectedClassType(myLanguageLevel, myDelegate, myResolveResult, provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getParameterCount() {
|
||||
return myDelegate.getParameters().length;
|
||||
|
||||
Reference in New Issue
Block a user