Fix @Nullable annotation for JetClassObject.getObjectDeclaration()
This commit is contained in:
@@ -289,9 +289,7 @@ public class PositioningStrategies {
|
||||
|
||||
if (element instanceof JetClassObject) {
|
||||
JetObjectDeclaration objectDeclaration = ((JetClassObject) element).getObjectDeclaration();
|
||||
if (objectDeclaration != null) {
|
||||
return ImmutableList.of(objectDeclaration.getObjectKeyword().getTextRange());
|
||||
}
|
||||
return ImmutableList.of(objectDeclaration.getObjectKeyword().getTextRange());
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
|
||||
@@ -38,9 +38,15 @@ public class JetClassObject extends JetDeclarationImpl implements JetStatementEx
|
||||
return visitor.visitClassObject(this, data);
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
@NotNull
|
||||
public JetObjectDeclaration getObjectDeclaration() {
|
||||
return (JetObjectDeclaration) findChildByType(JetNodeTypes.OBJECT_DECLARATION);
|
||||
JetObjectDeclaration objectDeclaration = (JetObjectDeclaration) findChildByType(JetNodeTypes.OBJECT_DECLARATION);
|
||||
|
||||
assert objectDeclaration != null :
|
||||
String.format("It should be impossible to produce class object element without object child:\n %s",
|
||||
this.getParent().getText());
|
||||
|
||||
return objectDeclaration;
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
|
||||
@@ -514,7 +514,6 @@ public class TypeHierarchyResolver {
|
||||
@Override
|
||||
public void visitClassObject(@NotNull JetClassObject classObject) {
|
||||
JetObjectDeclaration objectDeclaration = classObject.getObjectDeclaration();
|
||||
if (objectDeclaration == null) return;
|
||||
|
||||
DeclarationDescriptor container = owner.getOwnerForChildren();
|
||||
|
||||
|
||||
+1
-3
@@ -259,9 +259,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
||||
public JetClassLikeInfo getClassObjectInfo(JetClassObject classObject) {
|
||||
if (classObject != null) {
|
||||
JetObjectDeclaration objectDeclaration = classObject.getObjectDeclaration();
|
||||
if (objectDeclaration != null) {
|
||||
return JetClassInfoUtil.createClassLikeInfo(objectDeclaration);
|
||||
}
|
||||
return JetClassInfoUtil.createClassLikeInfo(objectDeclaration);
|
||||
}
|
||||
else if (getKind() == ClassKind.OBJECT || getKind() == ClassKind.ENUM_ENTRY || getKind() == ClassKind.ENUM_CLASS) {
|
||||
return new SyntheticClassObjectInfo(originalClassInfo, this);
|
||||
|
||||
@@ -138,9 +138,7 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
||||
}
|
||||
else if (myElement instanceof JetClassObject) {
|
||||
JetObjectDeclaration objectDeclaration = ((JetClassObject) myElement).getObjectDeclaration();
|
||||
if (objectDeclaration != null) {
|
||||
return wrapDeclarations(objectDeclaration.getDeclarations());
|
||||
}
|
||||
return wrapDeclarations(objectDeclaration.getDeclarations());
|
||||
}
|
||||
|
||||
return EMPTY_ARRAY;
|
||||
|
||||
-1
@@ -89,7 +89,6 @@ public class DeclarationBodyVisitor extends TranslatorVisitor<Void> {
|
||||
@Override
|
||||
public Void visitClassObject(@NotNull JetClassObject classObject, TranslationContext context) {
|
||||
JetObjectDeclaration declaration = classObject.getObjectDeclaration();
|
||||
assert declaration != null : "Declaration for class object must be not null";
|
||||
ClassDescriptor descriptor = getClassDescriptor(context.bindingContext(), declaration);
|
||||
JsExpression value = ClassTranslator.generateClassCreation(declaration, descriptor, context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user