Fix error when superclass has final String fields

This commit is contained in:
Alexey Andreev 2018-01-25 21:53:28 +03:00
parent a9f70b76a0
commit caaf2114bf
2 changed files with 14 additions and 1 deletions

View File

@ -441,7 +441,7 @@ function $rt_metadata(data) {
m.supertypes = data[i + 3]; m.supertypes = data[i + 3];
if (m.superclass) { if (m.superclass) {
m.supertypes.push(m.superclass); m.supertypes.push(m.superclass);
cls.prototype = new m.superclass(); cls.prototype = Object.create(m.superclass.prototype);
} else { } else {
cls.prototype = {}; cls.prototype = {};
} }

View File

@ -440,4 +440,17 @@ public class VMTest {
a[0] = "bar"; a[0] = "bar";
assertEquals("foo", b[0]); assertEquals("foo", b[0]);
} }
@Test
public void stringConstantsInBaseClass() {
new DerivedClassWithConstantFields();
}
static class BaseClassWithConstantFields {
public final String foo = "bar";
}
static class DerivedClassWithConstantFields extends BaseClassWithConstantFields {
}
} }