Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18749
  
    For source compatibility, in the commit, 
https://github.com/apache/spark/pull/18749/commits/389fc6ef788bf971f846ca36f49cea6a1c98b0d0,
 I tried to move back to `extended` to show it passes the tests and keep the 
source compatibility.
    
    For binary compatibility, I tested in the way I described before - 
https://github.com/databricks/scala-style-guide/issues/46.
    
    With `ExpressionDescription.java` assuming this is Spark 2.2.0:
    
    ```java
    import java.lang.annotation.Retention;
    import java.lang.annotation.RetentionPolicy;
    @Retention(RetentionPolicy.RUNTIME)
    public @interface ExpressionDescription {
        String usage() default "";
        String extended() default "";
    }
    ```
    
    With `Main.scala` assuming this is the user application compiled with Spark 
2.2.0:
    
    ```scala
    @ExpressionDescription(
      usage = "I am usage",
      extended = """
        I am extended
      """)
    case class A()
    
    object Main {
      def main(args: Array[String]): Unit = {
        val df = 
scala.reflect.classTag[A].runtimeClass.getAnnotation(classOf[ExpressionDescription]).
        println(df.usage())
        println(df.extended())
      }
    }
    ```
    
    ```
    javac ExpressionDescription.java
    scalac Main.scala
    scala Main
    ```
    
    prints
    
    ```
    I am usage
    
        I am extended
    ```
    
    And then, I changed `ExpressionDescription.java` assuming we merged this 
change into Spark's next release:
    
    ```diff
     import java.lang.annotation.Retention;
     import java.lang.annotation.RetentionPolicy;
     @Retention(RetentionPolicy.RUNTIME)
     public @interface ExpressionDescription {
         String usage() default "";
         String extended() default "";
    +    String arguments() default "";
    +    String examples() default "";
    +    String note() default "";
    +    String since() default "";
     }
    ```
    
    and then I ran
    
    ```
    javac ExpressionDescription.java
    scala Main
    ```
    
    this looks working fine as below:
    
    ```
    I am usage
    
        I am extended
    
    ```
    
    
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to