Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-1201

Data on demand generates incorrect data type for Float

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 1.1.0.M3
    • Component/s: TESTING
    • Labels:
      None

      Description

      When running the clinic.roo sample script the following method will be generated for PetDataOnDemand:

      public Pet PetDataOnDemand.getNewTransientPet(int index) {
              com.springsource.petclinic.domain.Pet obj = new com.springsource.petclinic.domain.Pet();
              obj.setName("name_" + index);
              obj.setOwner(null);
              obj.setSendReminders(true);
              obj.setType(com.springsource.petclinic.reference.PetType.class.getEnumConstants()[0]);
              java.lang.Float weight = new Integer(index).floatValue();
              if (weight < 0) {
                  weight = 0;
              }
              obj.setWeight(weight);
              return obj;
          }
      

      However, this gives error markers in STS for invalid type casting. A Integer type should be explicitly cast to Float:

              weight = new Float(0);
      

        Attachments

          Activity

            People

            Assignee:
            stewarta Alan Stewart
            Reporter:
            sschmidt Stefan Schmidt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: