Merge branch 'master' of git+ssh://git.labs.intellij.net/jet

This commit is contained in:
Evgeny Goldin
2012-01-28 02:43:32 +02:00
6 changed files with 49 additions and 8 deletions
@@ -1118,7 +1118,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
}
else {
//noinspection ConstantConditions
if (isInsideClass && (propertyDescriptor.getGetter() == null || propertyDescriptor.getGetter().isDefault())) {
if (isInsideClass && (propertyDescriptor.getGetter() == null || propertyDescriptor.getGetter().isDefault() && propertyDescriptor.getGetter().getModality() == Modality.FINAL)) {
getter = null;
}
else {
@@ -1148,7 +1148,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
}
//noinspection ConstantConditions
if (isInsideClass && (propertyDescriptor.getSetter() == null || propertyDescriptor.getSetter().isDefault())) {
if (isInsideClass && (propertyDescriptor.getSetter() == null || propertyDescriptor.getSetter().isDefault() && propertyDescriptor.getSetter().getModality() == Modality.FINAL)) {
setter = null;
}
else {
@@ -308,7 +308,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
//noinspection AssignmentToForLoopParameter
reg += argType.getSize();
}
if(original.getVisibility() == Visibility.PRIVATE)
if(original.getVisibility() == Visibility.PRIVATE && original.getModality() == Modality.FINAL)
iv.putfield(typeMapper.getOwner(original, OwnerKind.IMPLEMENTATION), original.getName(), originalMethod.getArgumentTypes()[0].getDescriptor());
else
iv.invokespecial(typeMapper.getOwner(original, OwnerKind.IMPLEMENTATION), originalMethod.getName(), originalMethod.getDescriptor());
@@ -879,7 +879,9 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
if(propertyDescriptor.getOutType().isNullable())
type = JetTypeMapper.boxType(type);
codegen.gen(initializer, type);
codegen.intermediateValueForProperty(propertyDescriptor, false, null).store(iv);
// @todo write directly to the field. Fix test excloset.jet::test6
String owner = typeMapper.getOwner(propertyDescriptor, OwnerKind.IMPLEMENTATION);
StackValue.property(propertyDescriptor.getName(), owner, typeMapper.mapType(propertyDescriptor.getOutType()), false, false, false, null, null).store(iv);
}
}
@@ -0,0 +1,15 @@
public abstract class BaseClass() {
protected abstract val kind : String
protected open val kind2 : String = " kind1"
fun debug() = kind + kind2
}
public class Subclass : BaseClass() {
override val kind : String = "Physical"
override val kind2 : String = " kind2"
}
fun box():String = if(Subclass().debug() == "Physical kind2") "OK" else "fail"
@@ -0,0 +1,16 @@
public abstract class BaseClass() {
protected open val kind : String = "BaseClass "
fun getKindValue() : String {
return kind
}
}
public class Subclass : BaseClass() {
override val kind : String = "Subclass "
}
fun box(): String {
val r = Subclass().getKindValue() + Subclass().kind
return if(r == "Subclass Subclass ") "OK" else "fail"
}
@@ -265,8 +265,4 @@ public class ClassGenTest extends CodegenTestCase {
public void testKt471() throws Exception {
blackBoxFile("regressions/kt471.kt");
}
public void testKt1165() throws Exception {
blackBoxFile("regressions/kt1165.kt");
}
}
@@ -164,4 +164,16 @@ public class PropertyGenTest extends CodegenTestCase {
method.setAccessible(true);
assertEquals(method.invoke(null), "1.0");
}
public void testKt1165() throws Exception {
blackBoxFile("regressions/kt1165.kt");
}
public void testKt1168() throws Exception {
blackBoxFile("regressions/kt1168.kt");
}
public void testKt1170() throws Exception {
blackBoxFile("regressions/kt1170.kt");
}
}