You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by "Michael Beckerle (JIRA)" <ji...@apache.org> on 2018/09/07 15:11:00 UTC

[jira] [Updated] (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 ]

Michael Beckerle updated DAFFODIL-1673:
---------------------------------------
    Labels: beginner  (was: )

> 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: Michael Beckerle
>            Priority: Major
>              Labels: beginner
>             Fix For: deferred
>
>
> 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
(v7.6.3#76005)