Skip to content

Instantly share code, notes, and snippets.

@sliskiCode
Last active October 29, 2016 10:57
Show Gist options
  • Save sliskiCode/78a803dd845fffed3d647b73f23010e5 to your computer and use it in GitHub Desktop.
Save sliskiCode/78a803dd845fffed3d647b73f23010e5 to your computer and use it in GitHub Desktop.
Zero boilerplate delegation in Kotlin 3
public final class CopyPrinter implements Copy, Print {
// $FF: synthetic field
private final Copy $$delegate_0;
// $FF: synthetic field
private final Print $$delegate_1;
public CopyPrinter(@NotNull Copy copier, @NotNull Print printer) {
Intrinsics.checkParameterIsNotNull(copier, "copier");
Intrinsics.checkParameterIsNotNull(printer, "printer");
super();
this.$$delegate_0 = copier;
this.$$delegate_1 = printer;
}
@NotNull
public Page copy(@NotNull Page page) {
Intrinsics.checkParameterIsNotNull(page, "page");
return this.$$delegate_0.copy(page);
}
public void print(@NotNull Page page) {
Intrinsics.checkParameterIsNotNull(page, "page");
this.$$delegate_1.print(page);
}
}
public interface Copy {
@NotNull
Page copy(@NotNull Page var1);
}
public interface Print {
void print(@NotNull Page var1);
}
public final class Page {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment