Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3580

IncompatibleClassChangeError when form object is null and its declared type is an interface


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.5.0
    • 8.0.4
    • Databind 2
    • Security Level: Jimmy

      When the object to be proxied is null and its declared type is an interface, IncompatibleClassChangeError is thrown. It seems the declared type must always be a class which was not a requirement with ZK 7.

      public interface Concept {
        public String getCode();
        public String getDescription();
        public Concept setCode(String code);
        public Concept setDescription(String description);
      public class BasicConcept implements Concept {
        private String code;
        private String description;
        public String getCode() {
          return code;
        public String getDescription() {
          return description;
        public Concept setCode(String code) {
          this.code = code;
          return this;
        public Concept setDescription(String description) {
          this.description = description;
          return this;
      public class ConceptOne extends BasicConcept {
        private String propertyOne;
        public String getPropertyOne() {
          return propertyOne;
        public ConceptOne setPropertyOne(String propertyOne) {
          this.propertyOne = propertyOne;
          return this;
      public class ConceptTwo extends BasicConcept {
        private String propertyTwo;
        public String getPropertyTwo() {
          return propertyTwo;
        public ConceptTwo setPropertyTwo(String propertyTwo) {
          this.propertyTwo = propertyTwo;
          return this;
      public class Test {
        private List<Concept> concepts;
        private Concept selected;
        public void doReset(@BindingParam("form") Concept form) {
        public void doSave(@BindingParam("form") Concept form) {
        public List<Concept> getConcepts() {
          return concepts;
        public Concept getSelected() {
          return selected;
        public void init() {
          concepts = new ArrayList<>(2);
          concepts.add(new ConceptOne().setPropertyOne("Property 1").setCode("1").setDescription("Concept 1"));
          concepts.add(new ConceptOne().setPropertyOne("Property 2").setCode("2").setDescription("Concept 2"));
          selected = null;
        public void setSelected(Concept selected) {
          this.selected = selected;
      <vlayout viewModel="@id('vm') @init('Test')">
        <listbox height="100px" model="@load(vm.concepts)"
            <listheader label="Code" />
            <listheader label="Description" />
          <template name="model">
              <listcell label="${each.code}" />
              <listcell label="${each.description}" />
        <hlayout form="@id('fx') @load(vm.selected) @save(vm.selected, before='doSave')">
          <label value="Code" />
          <textbox constraint="no empty" instant="true" maxlength="64" value="@bind(fx.code)" disabled="@load(empty vm.selected)" />
          <label value="Description" />
          <textbox constraint="no empty" instant="true" maxlength="1000" value="@bind(fx.description)" disabled="@load(empty vm.selected)" />
          <button label="Reset" onClick="@command('doReset',form=fx)" disabled="@load(not fxStatus.dirty)" />
          <button label="Save" onClick="@command('doSave',form=fx)" disabled="@load(not fxStatus.dirty)" />

            bobpeng bobpeng
            benedetti benedetti
            0 Vote for this issue
            3 Start watching this issue