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