Bug: Pass all UTs in `repl` with Java 17
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 20/Oct/21 12:57
Affects Version/s: 3.3.0

Run `mvn clean install -pl repl` with Java 17
{code:java}
Run completed in 30 seconds, 826 milliseconds.
Total number of tests run: 42
Suites: completed 6, aborted 0
Tests: succeeded 33, failed 9, canceled 0, ignored 0, pending 0
*** 9 TESTS FAILED ***
{code}
The test failed as similar reasons:
{code:java}
- broadcast vars *** FAILED ***
  isContain was true Interpreter output contained 'Exception':
  Welcome to
        ____              __
       / __/__  ___ _____/ /__
      _\ \/ _ \/ _ `/ __/  '_/
     /___/ .__/\_,_/_/ /_/\_\   version 3.3.0-SNAPSHOT
        /_/
           
  Using Scala version 2.12.15 (OpenJDK 64-Bit Server VM, Java 17)
  Type in expressions to have them evaluated.
  Type :help for more information.
  
  scala> 
  scala> array: Array[Int] = Array(0, 0, 0, 0, 0)
  
  scala> broadcastArray: org.apache.spark.broadcast.Broadcast[Array[Int]] = Broadcast(0)
  
  scala> java.lang.IllegalAccessException: Can not set final $iw field $Lambda$2879/0x000000080188b928.arg$1 to $iw
    at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:76)
    at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:80)
    at java.base/jdk.internal.reflect.UnsafeQualifiedObjectFieldAccessorImpl.set(UnsafeQualifiedObjectFieldAccessorImpl.java:79)
    at java.base/java.lang.reflect.Field.set(Field.java:799)
    at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:398)
    at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:162)
    at org.apache.spark.SparkContext.clean(SparkContext.scala:2490)
    at org.apache.spark.rdd.RDD.$anonfun$map$1(RDD.scala:414)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.RDD.map(RDD.scala:413)
    ... 95 elided
  
  scala> 
  scala> java.lang.IllegalAccessException: Can not set final $iw field $Lambda$2907/0x00000008019536f8.arg$1 to $iw
    at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:76)
    at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:80)
    at java.base/jdk.internal.reflect.UnsafeQualifiedObjectFieldAccessorImpl.set(UnsafeQualifiedObjectFieldAccessorImpl.java:79)
    at java.base/java.lang.reflect.Field.set(Field.java:799)
    at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:398)
    at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:162)
    at org.apache.spark.SparkContext.clean(SparkContext.scala:2490)
    at org.apache.spark.rdd.RDD.$anonfun$map$1(RDD.scala:414)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.RDD.map(RDD.scala:413)
    ... 95 elided
  
  scala>      | 
  scala> :quit (ReplSuite.scala:83)
{code}