[ 
https://issues.apache.org/jira/browse/SPARK-45610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17777405#comment-17777405
 ] 

Sean R. Owen commented on SPARK-45610:
--------------------------------------

I think it's better to make big changes at major version boundaries. I'd expect 
we support Scala 3 at some point for Spark 4.x. Therefore I think it'd be OK to 
proceed with these changes now for 4.0.

> Handle "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
>            Priority: Major
>
> 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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to