Workaround for issue with fake Object field type during indexing

This commit is contained in:
Ben Gruver 2015-04-03 21:29:07 -07:00
parent 4bc2334c39
commit 660d4b5fd9

View File

@ -32,6 +32,8 @@
package org.jf.smalidea.psi.stub.element;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.psi.PsiTypeElement;
import com.intellij.psi.stubs.IndexSink;
import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.stubs.StubInputStream;
@ -62,7 +64,20 @@ public class SmaliFieldElementType extends SmaliStubElementType<SmaliFieldStub,
}
@Override public SmaliFieldStub createStub(@NotNull SmaliField psi, StubElement parentStub) {
return new SmaliFieldStub(parentStub, psi.getName(), psi.getType().getCanonicalText());
try {
String fieldType;
PsiTypeElement typeElement = psi.getTypeElement();
if (typeElement != null) {
fieldType = typeElement.getType().getCanonicalText();
} else {
fieldType = "java.lang.Object";
}
return new SmaliFieldStub(parentStub, psi.getName(), fieldType);
} catch (IndexNotReadyException ex) {
System.out.println(psi.getName());
throw ex;
}
}
@Override