Details

      Description

      When doing number arithmetic in SpEL the result type is apparently one of double, long or int.
      This has the unwanted effect that for example float or BigDecimal values will be changed to int.

      new java.math.BigDecimal("12.34")
      evaluates to 12.34

      -(new java.math.BigDecimal("12.34"))
      evaluates to -12

      see org.springframework.expression.spel.ast
      OpPlus, OpMinus, OpMultiply, OpDivide

        Issue Links

          Activity

          Hide
          Satyapal Reddy added a comment -

          @Giovanni

          Thanks for the feedback. I will open a new bug. The possible fix that I tried locally (and that resolved my issue) involved introducing FloatLiteral.java and adding additional instanceof for Float.

          Satyapal

          Show
          Satyapal Reddy added a comment - @Giovanni Thanks for the feedback. I will open a new bug. The possible fix that I tried locally (and that resolved my issue) involved introducing FloatLiteral.java and adding additional instanceof for Float. Satyapal
          Hide
          Andy Clement added a comment -

          I just reviewed the PR Giovanni again - made a couple of comments on it but in principal it is in reasonable shape. There seems to be some code duplication in the tests and the coding standards aren't quite right for the if blocks, but it works and all the existing expression tests are passing for me. Chris/Phil - would you expect the submitter to fix the code duplication and styling thing in the PR and resubmit or would you do that?

          Show
          Andy Clement added a comment - I just reviewed the PR Giovanni again - made a couple of comments on it but in principal it is in reasonable shape. There seems to be some code duplication in the tests and the coding standards aren't quite right for the if blocks, but it works and all the existing expression tests are passing for me. Chris/Phil - would you expect the submitter to fix the code duplication and styling thing in the PR and resubmit or would you do that?
          Hide
          Giovanni Dall'Oglio Risso added a comment -

          This weekend I'm out, if you can wait, the first days of the next week I'll rebase and clean everything...

          Thanks

          Show
          Giovanni Dall'Oglio Risso added a comment - This weekend I'm out, if you can wait, the first days of the next week I'll rebase and clean everything... Thanks
          Hide
          Giovanni Dall'Oglio Risso added a comment - - edited

          Hello.
          Everything is now OK, plus some additions:

          • From the original pull request to now, SpEL advanced [operator++, between function].
            • Now is everything covered (the new features), updated and tested.
          • In addition, some polish (like Phil Webb commit e83bdda)

          I rebased on master, hope is OK...
          Thanks

          Show
          Giovanni Dall'Oglio Risso added a comment - - edited Hello. Everything is now OK, plus some additions: From the original pull request to now, SpEL advanced [operator++, between function] . Now is everything covered (the new features), updated and tested. In addition, some polish (like Phil Webb commit e83bdda) I rebased on master, hope is OK... Thanks
          Hide
          Oliver Becker added a comment -

          Big thanks to Giovanni and Andy for fixing this!

          Show
          Oliver Becker added a comment - Big thanks to Giovanni and Andy for fixing this!

            People

            • Assignee:
              Phil Webb
              Reporter:
              Oliver Becker
              Last updater:
              Juergen Hoeller
            • Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                21 weeks, 1 day ago