Github user yongtang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11857#discussion_r56925452
  
    --- Diff: 
sql/core/src/test/java/test/org/apache/spark/sql/JavaDatasetSuite.java ---
    @@ -309,6 +309,7 @@ public void testSetOperation() {
       }
     
       @SafeVarargs
    +  @SuppressWarnings("varargs")
    --- End diff --
    
    Hi @srowen I played with different settings (with Java 8). If neither 
`@SafeVarargs` or `@SuppressWarnings("varargs")` is used, then there is the 
following warning:
    ```
    [warn] .../sql/JavaDatasetSuite.java:215: warning: [unchecked] unchecked 
generic array
    creation for varargs parameter of type Tuple2<Integer,String>[]
    [warn]       asSet(tuple2(1, "a"), tuple2(3, "foobar")),
    [warn]            ^
    [warn] ...sql/JavaDatasetSuite.java:313: warning: [unchecked] Possible heap 
pollution from
    parameterized vararg type T
    [warn]   private static <T> Set<T> asSet(T... records) {
    [warn]                                        ^
    [warn]   where T is a type-variable:
    [warn]     T extends Object declared in method <T>asSet(T...)
    ```
    
    If only `@SafeVarargs` is specified, the the warning changed to:
    ```
    [warn] ...spark/sql/JavaDatasetSuite.java:314: warning: [varargs] Varargs 
method could cause
    heap pollution from non-reifiable varargs parameter records
    [warn]     return toSet(Arrays.asList(records));
    ```
    With both `@SafeVarargs` and `@SuppressWarnings("varargs")` the warnings 
are gone.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to