a bit of nullability cleanup
This commit is contained in:
@@ -84,10 +84,12 @@ public class CallableMethod implements Callable {
|
||||
return signature.getValueParameterTypes();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JvmClassName getThisType() {
|
||||
return thisClass;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Type getReceiverClass() {
|
||||
return receiverParameterType;
|
||||
}
|
||||
|
||||
@@ -1516,6 +1516,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
||||
}
|
||||
if (enclosed != context.getThisDescriptor()) {
|
||||
CodegenContext c = context;
|
||||
//noinspection ConstantConditions
|
||||
while (!(c instanceof CodegenContexts.ClassContext) ||
|
||||
!DescriptorUtils.isSubclass(c.getThisDescriptor(), enclosed)) {
|
||||
c = c.getParentContext();
|
||||
@@ -1720,6 +1721,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static JetExpression getReceiverForSelector(PsiElement expression) {
|
||||
if (expression.getParent() instanceof JetDotQualifiedExpression && !isReceiver(expression)) {
|
||||
final JetDotQualifiedExpression parent = (JetDotQualifiedExpression) expression.getParent();
|
||||
@@ -1793,9 +1795,11 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
||||
|
||||
|
||||
assert cur != null;
|
||||
if (DescriptorUtils.isSubclass(cur.getThisDescriptor(), calleeContainingClass)) {
|
||||
if (!isObject || (cur.getThisDescriptor() == calleeContainingClass)) {
|
||||
return castToRequiredTypeOfInterfaceIfNeeded(result, cur.getThisDescriptor(), calleeContainingClass);
|
||||
final ClassDescriptor thisDescriptor = cur.getThisDescriptor();
|
||||
assert thisDescriptor != null;
|
||||
if (DescriptorUtils.isSubclass(thisDescriptor, calleeContainingClass)) {
|
||||
if (!isObject || (thisDescriptor == calleeContainingClass)) {
|
||||
return castToRequiredTypeOfInterfaceIfNeeded(result, thisDescriptor, calleeContainingClass);
|
||||
}
|
||||
else {
|
||||
v.getstatic(type.getInternalName(), "$instance", type.getDescriptor());
|
||||
@@ -2447,6 +2451,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
||||
v.invokevirtual("java/lang/StringBuilder", "append", appendDescriptor.getDescriptor());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static JetSimpleNameExpression targetLabel(JetExpression expression) {
|
||||
if (expression.getParent() instanceof JetPrefixExpression) {
|
||||
JetPrefixExpression parent = (JetPrefixExpression) expression.getParent();
|
||||
|
||||
@@ -205,6 +205,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static ClassDescriptor getContainingClassDescriptor(ClassDescriptor decl) {
|
||||
DeclarationDescriptor container = decl.getContainingDeclaration();
|
||||
while (container != null && !(container instanceof NamespaceDescriptor)) {
|
||||
@@ -768,6 +769,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
typeMapper.getClosureAnnotator().getEclosingClassDescriptor(descriptor).getDefaultType(), MapTypeMode.VALUE));
|
||||
}
|
||||
Method superCallMethod = new Method("<init>", Type.VOID_TYPE, parameterTypes.toArray(new Type[parameterTypes.size()]));
|
||||
//noinspection ConstantConditions
|
||||
iv.invokespecial(typeMapper.mapType(superClassDescriptor.getDefaultType(), MapTypeMode.VALUE).getInternalName(), "<init>",
|
||||
superCallMethod.getDescriptor());
|
||||
}
|
||||
|
||||
@@ -341,6 +341,7 @@ public class JetTypeMapper {
|
||||
return mapType(jetType, signatureVisitor, MapTypeMode.VALUE);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getLocalNameForObject(JetObjectDeclaration object) {
|
||||
PsiElement parent = object.getParent();
|
||||
if (parent instanceof JetClassObject) {
|
||||
@@ -596,11 +597,7 @@ public class JetTypeMapper {
|
||||
}
|
||||
}
|
||||
|
||||
public CallableMethod mapToCallableMethod(FunctionDescriptor functionDescriptor, boolean superCall, OwnerKind kind) {
|
||||
if (functionDescriptor == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public CallableMethod mapToCallableMethod(@NotNull FunctionDescriptor functionDescriptor, boolean superCall, OwnerKind kind) {
|
||||
final DeclarationDescriptor functionParent = functionDescriptor.getOriginal().getContainingDeclaration();
|
||||
|
||||
while (functionDescriptor.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
|
||||
|
||||
Reference in New Issue
Block a user