You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean R. Owen (Jira)" <ji...@apache.org> on 2023/10/22 16:46:00 UTC
[jira] [Resolved] (SPARK-45610) Fix "Auto-application to `()` is deprecated."
[ https://issues.apache.org/jira/browse/SPARK-45610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sean R. Owen resolved SPARK-45610.
----------------------------------
Fix Version/s: 4.0.0
Resolution: Fixed
Issue resolved by pull request 43472
[https://github.com/apache/spark/pull/43472]
> Fix "Auto-application to `()` is deprecated."
> ---------------------------------------------
>
> Key: SPARK-45610
> URL: https://issues.apache.org/jira/browse/SPARK-45610
> Project: Spark
> Issue Type: Sub-task
> Components: GraphX, MLlib, Spark Core, SQL, Structured Streaming
> Affects Versions: 4.0.0
> Reporter: Yang Jie
> Assignee: Yang Jie
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.0.0
>
>
> For the following case, a compile warning will be issued in Scala 2.13:
>
> {code:java}
> Welcome to Scala 2.13.12 (OpenJDK 64-Bit Server VM, Java 17.0.8).
> Type in expressions for evaluation. Or try :help.
> scala> class Foo {
> | def isEmpty(): Boolean = true
> | def isTrue(x: Boolean): Boolean = x
> | }
> class Foo
> scala> val foo = new Foo
> val foo: Foo = Foo@7061622
> scala> val ret = foo.isEmpty
> ^
> warning: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method isEmpty,
> or remove the empty argument list from its definition (Java-defined methods are exempt).
> In Scala 3, an unapplied method like this will be eta-expanded into a function. [quickfixable]
> val ret: Boolean = true {code}
> But for Scala 3, it is a compile error:
> {code:java}
> Welcome to Scala 3.3.1 (17.0.8, Java OpenJDK 64-Bit Server VM).
> Type in expressions for evaluation. Or try :help.
>
> scala> class Foo {
> | def isEmpty(): Boolean = true
> | def isTrue(x: Boolean): Boolean = x
> | }
> // defined class Foo
>
> scala> val foo = new Foo
> val foo: Foo = Foo@591f6f83
>
> scala> val ret = foo.isEmpty
> -- [E100] Syntax Error: --------------------------------------------------------
> 1 |val ret = foo.isEmpty
> | ^^^^^^^^^^^
> | method isEmpty in class Foo must be called with () argument
> |
> | longer explanation available when compiling with `-explain`
> 1 error found {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org