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

Zk Java 8 BinderImpl returns error on @Command @Override two methods error, make difficult DRY

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 8.0.3
    • 8.0.1
    • Databind
    • Security Level: Jimmy
    • Java 1.8

      If you have a Base class:

      public abstract BaseVM<T extends MyDomain> {
      
      @Command("save")
      public save(@BindingParam("item")  T model){
      //do base func
      myrepo.save(model)
      }
      }
      
      public ConcreteVM extends BaseVM<ConcreteModel>{
      
      @Override
      @Command("save")
      public save(@BindingParam("item")  T model){
      //do additional fun
      super.save(model)
      }
      }
      

      The BinderImpl will return an exception throw new UiException("there are more than one "+... because clz.getMethods return two methods with same name but different params, one for MyDomain and once for ConcreteModel.

      This only happen in java 1.8 not in java 1.7 or minor. I think is due to the reflection optimization in java 8.

        1. AbstractVM.java
          0.2 kB
        2. ErrorReproduce.zip
          1 kB
        3. reproducingcase.zip
          5 kB
        4. TestBean.java
          0.1 kB
        5. TestVM.java
          0.3 kB

            SEFI SEFI
            dgofast dgofast
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 hour Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h