You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Dave Thompson (Jira)" <ji...@apache.org> on 2020/06/22 17:07:00 UTC

[jira] [Closed] (DAFFODIL-1673) code quality: use non-deprecated syntax for methods that don't return a value

     [ https://issues.apache.org/jira/browse/DAFFODIL-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dave Thompson closed DAFFODIL-1673.
-----------------------------------

Verified the specified commit (actually commit c9ca5d6665d2d17fe637b13595a8b244584fd977) is included in the latest pull from the incubator-daffodil repository.

Verified all sbt test execute successfully.

Modified several tests to remove the ": Unit =" and re-ran the sbt tests. Verified that the tests the were modified got the specified deprecation messages. 

> code quality: use non-deprecated syntax for methods that don't return a value
> -----------------------------------------------------------------------------
>
>                 Key: DAFFODIL-1673
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1673
>             Project: Daffodil
>          Issue Type: Improvement
>          Components: Clean Ups, Infrastructure
>            Reporter: Mike Beckerle
>            Priority: Major
>              Labels: beginner
>             Fix For: 3.0.0
>
>
> This syntax is officially deprecated.
> {code}def someFun(x: String) { .... } 
> {code}
> Instead one must write explicitly:
> {code}
> def someFun(x:String): Unit = { ... }
> {code}
> 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.
> {code}
> 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
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)