properly read fields of array type from java bytecode
KT-1086
This commit is contained in:
+14
-7
@@ -7,6 +7,7 @@ import com.intellij.openapi.project.Project;
|
|||||||
import com.intellij.openapi.util.Pair;
|
import com.intellij.openapi.util.Pair;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
import com.intellij.psi.JavaPsiFacade;
|
import com.intellij.psi.JavaPsiFacade;
|
||||||
|
import com.intellij.psi.PsiArrayType;
|
||||||
import com.intellij.psi.PsiClass;
|
import com.intellij.psi.PsiClass;
|
||||||
import com.intellij.psi.PsiClassType;
|
import com.intellij.psi.PsiClassType;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
@@ -825,13 +826,19 @@ public class JavaDescriptorResolver {
|
|||||||
} else if (typeSource.getTypeString().length() > 0) {
|
} else if (typeSource.getTypeString().length() > 0) {
|
||||||
return typeSource.getTypeString();
|
return typeSource.getTypeString();
|
||||||
} else {
|
} else {
|
||||||
if (typeSource.getPsiType() instanceof PsiClassType) {
|
return psiTypeToKey(typeSource.getPsiType());
|
||||||
return ((PsiClassType) typeSource.getPsiType()).getClassName();
|
}
|
||||||
} else if (typeSource.getPsiType() instanceof PsiPrimitiveType) {
|
}
|
||||||
return typeSource.getPsiType().getPresentableText();
|
|
||||||
} else {
|
private Object psiTypeToKey(PsiType psiType) {
|
||||||
throw new IllegalStateException("" + typeSource.getPsiType().getClass());
|
if (psiType instanceof PsiClassType) {
|
||||||
}
|
return ((PsiClassType) psiType).getClassName();
|
||||||
|
} else if (psiType instanceof PsiPrimitiveType) {
|
||||||
|
return psiType.getPresentableText();
|
||||||
|
} else if (psiType instanceof PsiArrayType) {
|
||||||
|
return Pair.create("[", psiTypeToKey(((PsiArrayType) psiType).getComponentType()));
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("" + psiType.getClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
class FieldOfArrayType {
|
||||||
|
public java.io.File[] files;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
open class FieldOfArrayType() {
|
||||||
|
var files: Array<java.io.File?>? = null
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user