You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yang Jie (Jira)" <ji...@apache.org> on 2023/10/22 17:35:00 UTC

[jira] [Updated] (SPARK-45627) Fix `symbol literal is deprecated`

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

Yang Jie updated SPARK-45627:
-----------------------------
    Description: 
For the code `val symbol = 'symbol`, it's a compile warning in Scala 2.13, but it's a compile error in Scala 3.
 - 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> val symbol = 'symbol
                    ^
       warning: symbol literal is deprecated; use Symbol("symbol") instead [quickfixable]
val symbol: Symbol = Symbol(symbol) {code}
 

 
 * Scala 3

 
{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> val symbol = 'symbol
-- Error: ----------------------------------------------------------------------
1 |val symbol = 'symbol
  |             ^
  |symbol literal 'symbol is no longer supported,
  |use a string literal "symbol" or an application Symbol("symbol") instead,
  |or enclose in braces '{symbol} if you want a quoted expression.
  |For now, you can also `import language.deprecated.symbolLiterals` to accept
  |the idiom, but this possibility might no longer be available in the future. {code}
 

  was:
For the code `val symbol = 'symbol`, it's a compile warning in Scala 2.13, but it's a compile error in Scala 3.

- 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> val symbol = 'symbol
                    ^
       warning: symbol literal is deprecated; use Symbol("symbol") instead [quickfixable]
val symbol: Symbol = Symbol(symbol) {code}
 

 

- Scala 3
{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> val symbol = 'symbol
-- Error: ----------------------------------------------------------------------
1 |val symbol = 'symbol
  |             ^
  |symbol literal 'symbol is no longer supported,
  |use a string literal "symbol" or an application Symbol("symbol") instead,
  |or enclose in braces '{symbol} if you want a quoted expression.
  |For now, you can also `import language.deprecated.symbolLiterals` to accept
  |the idiom, but this possibility might no longer be available in the future. {code}
 


> Fix `symbol literal is deprecated`
> ----------------------------------
>
>                 Key: SPARK-45627
>                 URL: https://issues.apache.org/jira/browse/SPARK-45627
>             Project: Spark
>          Issue Type: Sub-task
>          Components: Connect, GraphX, MLlib, Spark Core, SQL
>    Affects Versions: 4.0.0
>            Reporter: Yang Jie
>            Priority: Major
>
> For the code `val symbol = 'symbol`, it's a compile warning in Scala 2.13, but it's a compile error in Scala 3.
>  - 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> val symbol = 'symbol
>                     ^
>        warning: symbol literal is deprecated; use Symbol("symbol") instead [quickfixable]
> val symbol: Symbol = Symbol(symbol) {code}
>  
>  
>  * Scala 3
>  
> {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> val symbol = 'symbol
> -- Error: ----------------------------------------------------------------------
> 1 |val symbol = 'symbol
>   |             ^
>   |symbol literal 'symbol is no longer supported,
>   |use a string literal "symbol" or an application Symbol("symbol") instead,
>   |or enclose in braces '{symbol} if you want a quoted expression.
>   |For now, you can also `import language.deprecated.symbolLiterals` to accept
>   |the idiom, but this possibility might no longer be available in the future. {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