You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Steve Lawrence (Jira)" <ji...@apache.org> on 2020/06/22 16:37:00 UTC
[jira] [Comment Edited] (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:comment-tabpanel&focusedCommentId=17139539#comment-17139539 ]
Steve Lawrence edited comment on DAFFODIL-1673 at 6/22/20, 4:36 PM:
--------------------------------------------------------------------
Fixed in commit c9ca5d6665d2d17fe637b13595a8b244584fd977
was (Author: slawrence):
Fixed in commit c5114f6fd7c5b4551632370b9465de1f2fe2012d
> 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)