Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-1673

code quality: use non-deprecated syntax for methods that don't return a value

    XMLWordPrintableJSON

Details

    Description

      This syntax is officially deprecated.

      def someFun(x: String) { .... } 
      

      Instead one must write explicitly:

      def someFun(x:String): Unit = { ... }
      

      Meaning that the value of x.length is discarded and the function returns Unit (or () if you prefer) instead.

      I'd like to stress out that this is deprecated since Oct 29, 2013 (https://github.com/scala/scala/pull/3076/), but the warning only shows up if you compile with the -Xfuture flag.

      We should turn on the -Xfuture flag, and fix this and any other deprecations that come up.

      We may want to write a sed-script or other automation. I have generally preferred the now-deprecated style in my code, so there are many many cases.

      scala -Xfuture -deprecation
      
      scala> def foo {}
      <console>:1: warning: Procedure syntax is deprecated. Convert procedure `foo` to method by adding `: Unit =`.
             def foo {}
      foo: Unit
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbeckerle Mike Beckerle
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: