Prohibit data classes with no primary constructor

This commit is contained in:
Denis Zharkov
2015-02-27 13:10:17 +03:00
parent 40d7816575
commit 67f97fea42
10 changed files with 92 additions and 4 deletions
@@ -80,7 +80,9 @@ public abstract class DataClassMethodGenerator {
private void generateComponentFunctionsForDataClasses() {
ConstructorDescriptor constructor = classDescriptor.getUnsubstitutedPrimaryConstructor();
assert constructor != null : "Data class should have primary constructor";
// primary constructor should exist for data classes
// but when generating light-classes still need to check we have one
if (constructor == null) return;
for (ValueParameterDescriptor parameter : constructor.getValueParameters()) {
FunctionDescriptor function = bindingContext.get(BindingContext.DATA_CLASS_COMPONENT_FUNCTION, parameter);