nullability tweaks

This commit is contained in:
Alex Tkachman
2012-08-23 18:03:36 +03:00
parent a11511eaf6
commit 08c5032734
3 changed files with 9 additions and 11 deletions
@@ -1378,9 +1378,10 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
}
}
//noinspection ConstantConditions
if (isInsideClass &&
(propertyDescriptor.getSetter() == null ||
propertyDescriptor.getSetter().isDefault() && propertyDescriptor.getSetter().getModality() == Modality.FINAL)) {
if (!propertyDescriptor.isVar() || isInsideClass &&
(propertyDescriptor.getSetter() == null ||
propertyDescriptor.getSetter().isDefault() &&
propertyDescriptor.getSetter().getModality() == Modality.FINAL)) {
setter = null;
}
else {
@@ -18,6 +18,7 @@ package org.jetbrains.jet.codegen;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.asm4.Label;
import org.jetbrains.asm4.MethodVisitor;
@@ -420,7 +421,7 @@ public class FunctionCodegen {
GenerationState state,
ClassBuilder v,
Method jvmSignature,
@Nullable FunctionDescriptor functionDescriptor,
@NotNull FunctionDescriptor functionDescriptor,
OwnerKind kind
) {
DeclarationDescriptor contextClass = owner.getContextDescriptor().getContainingDeclaration();
@@ -431,9 +432,7 @@ public class FunctionCodegen {
return;
}
boolean needed = isDefaultNeeded(functionDescriptor);
if (!needed) {
if (!isDefaultNeeded(functionDescriptor)) {
return;
}
@@ -908,11 +908,9 @@ public class JetTypeMapper {
return new JvmPropertyAccessorSignature(jvmMethodSignature, jvmMethodSignature.getKotlinReturnType());
}
@Nullable
@NotNull
public JvmPropertyAccessorSignature mapSetterSignature(PropertyDescriptor descriptor, OwnerKind kind) {
if (!descriptor.isVar()) {
return null;
}
assert descriptor.isVar();
// TODO: generics signature is not always needed
BothSignatureWriter signatureWriter = new BothSignatureWriter(BothSignatureWriter.Mode.METHOD, true);