Fixed failed assertions on navigating to 'Assertions' class of Kotlin runtime

This commit is contained in:
Evgeny Gerashchenko
2012-04-24 17:50:57 +04:00
parent 8c2457195e
commit cc7284c67e
3 changed files with 9 additions and 8 deletions
@@ -336,7 +336,11 @@ public class DescriptorRenderer implements Renderer<DeclarationDescriptor> {
} }
private void renderVisibility(Visibility visibility, StringBuilder builder) { private void renderVisibility(Visibility visibility, StringBuilder builder) {
builder.append(renderKeyword(visibility.toString())).append(" "); if ("package".equals(visibility.toString())) {
builder.append("public/*package*/ ");
} else {
builder.append(renderKeyword(visibility.toString())).append(" ");
}
} }
private void renderModality(Modality modality, StringBuilder builder) { private void renderModality(Modality modality, StringBuilder builder) {
@@ -21,10 +21,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.compiled.*; import com.intellij.psi.impl.compiled.*;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetClass; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.psi.JetDeclaration;
import org.jetbrains.jet.lang.psi.JetFunction;
import org.jetbrains.jet.lang.psi.JetProperty;
/** /**
* @author Evgeny Gerashchenko * @author Evgeny Gerashchenko
@@ -39,7 +36,7 @@ public class JetClsNavigationPolicy implements ClsCustomNavigationPolicy {
} }
JetClass jetClass = (JetClass) getJetDeclarationByClsElement(clsClass); JetClass jetClass = (JetClass) getJetDeclarationByClsElement(clsClass);
if (jetClass != null) { if (jetClass != null) {
JetClass sourceClass = JetSourceNavigationHelper.getSourceClass(jetClass); JetClassOrObject sourceClass = JetSourceNavigationHelper.getSourceClass(jetClass);
if (sourceClass != null) { if (sourceClass != null) {
return sourceClass; return sourceClass;
} }
@@ -93,7 +93,7 @@ public class JetSourceNavigationHelper {
} }
@Nullable @Nullable
public static JetClass getSourceClass(@NotNull JetClass decompiledClass) { public static JetClassOrObject getSourceClass(@NotNull JetClass decompiledClass) {
Tuple2<BindingContext, ClassDescriptor> bindingContextAndClassDescriptor = getBindingContextAndClassDescriptor(decompiledClass); Tuple2<BindingContext, ClassDescriptor> bindingContextAndClassDescriptor = getBindingContextAndClassDescriptor(decompiledClass);
if (bindingContextAndClassDescriptor == null) return null; if (bindingContextAndClassDescriptor == null) return null;
PsiElement declaration = BindingContextUtils.classDescriptorToDeclaration( PsiElement declaration = BindingContextUtils.classDescriptorToDeclaration(
@@ -101,7 +101,7 @@ public class JetSourceNavigationHelper {
if (declaration == null) { if (declaration == null) {
throw new IllegalStateException("class not found by " + bindingContextAndClassDescriptor._2); throw new IllegalStateException("class not found by " + bindingContextAndClassDescriptor._2);
} }
return (JetClass) declaration; return (JetClassOrObject) declaration;
} }
@NotNull @NotNull