DATACMNS-1451 - Consider more than 16 immutable Kotlin properties in generated PropertyAccessor.
We now consider more than 16 immutable and nullable Kotlin properties per bucket in generated PropertyAccessors. Previously only the first 16 properties were considered due to truncation of the defaulting bitmap. We used SIPUSH to render the defaulting mask in bytecode which is intended for 16 bit integers (short). Migrating to LDC (runtime constants) preserves the actual constant value of 32 bits and so we're considering now full buckets.
This commit is contained in:
committed by
Oliver Drotbohm
parent
04916ed176
commit
aa39b9ba3a
@@ -1115,9 +1115,7 @@ public class ClassGeneratingPropertyAccessorFactory implements PersistentPropert
|
||||
visitDefaultValue(parameterTypes[i], mv);
|
||||
}
|
||||
|
||||
copyByProperty.getDefaultMask().forEach(i -> {
|
||||
mv.visitIntInsn(Opcodes.SIPUSH, i);
|
||||
});
|
||||
copyByProperty.getDefaultMask().forEach(mv::visitLdcInsn);
|
||||
|
||||
mv.visitInsn(Opcodes.ACONST_NULL);
|
||||
|
||||
|
||||
@@ -140,6 +140,19 @@ public class PersistentPropertyAccessorTests {
|
||||
assertThatThrownBy(() -> accessor.setProperty(property, 1)).isInstanceOf(UnsupportedOperationException.class);
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1451
|
||||
public void shouldSet17thImmutableNullableKotlinProperty() {
|
||||
|
||||
With33Args bean = new With33Args();
|
||||
PersistentPropertyAccessor accessor = propertyAccessorFunction.apply(bean);
|
||||
SamplePersistentProperty property = getProperty(bean, "17");
|
||||
|
||||
accessor.setProperty(property, "foo");
|
||||
|
||||
With33Args updated = (With33Args) accessor.getBean();
|
||||
assertThat(updated.get17()).isEqualTo("foo");
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1322
|
||||
public void shouldWitherProperty() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user