Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8254129 IR Test Framework to support regex-based matching on the IR in JTreg compiler tests
  3. JDK-8270073

Simplify the Arguments annotation when all arguments have the same Argument value

    XMLWordPrintable

    Details

      Description

      Sometimes a method has multiple parameters for which the user wants to specify the same argument value. At the moment, one need to specify an Argument value for each parameter:

      @Test
      @Arguments({Argument.DEFAULT, Argument.DEFAULT})
      public void twoArgsRandomOnce(char x, byte y) {
          // do something
      }

      This could be simplified such that the user only need to specify one argument which is applied to each parameter:

      @Test
      @Arguments(Argument.DEFAULT)
      public void twoArgsRandomOnce(char x, byte y) {
          // do something
      }

      A common use-case would be for methods that need to have random values (Argument.RANDOM_ONCE, Argument.RANDOM_EACH).

      There are multiple ways to do that:
      - @Arguments could either be processed differently to automatically apply a single Argument value to all remaining parameters. However, if the user specified only one Argument value by mistake, he will not be warned by the silent application.
      - Adding a new annotation to achieve this, for example, @ArgumentsAll (I would refrain from adding an additional attribute to @Arguments as we are then no longer able to feed it a list without specifying the single default attribute).

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            chagedorn Christian Hagedorn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: