linkedin / isolation-forest

A Spark/Scala implementation of the isolation forest unsupervised outlier detection algorithm with support for exporting in ONNX format.
Other
223 stars 47 forks source link

Fixed 39 build warnings due to upcoming Scala 3 changes and previously deprecated methods. #52

Closed jverbus closed 3 months ago

jverbus commented 3 months ago

Builds are generating a lot of warnings (39 in total) due to current and future deprecations. I've addressed all warnings in this PR.

Here is an example build before these changes:

(base) jv@Jamess-MBP isolation-forest % ./gradlew clean build --no-build-cache                         

> Configure project :
Building version '3.1.1'
  - reason: shipkit-auto-version deduced version based on previous tag: '3.1.0'

> Configure project :isolation-forest
Scala version: 2.13.14
Spark version: 3.5.1

> Task :isolation-forest:compileScala
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/main/scala/com/linkedin/relevance/isolationforest/IsolationForest.scala:49: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method head,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/main/scala/com/linkedin/relevance/isolationforest/IsolationForest.scala:97: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method toDS,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/main/scala/com/linkedin/relevance/isolationforest/IsolationForest.scala:109: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method get,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/main/scala/com/linkedin/relevance/isolationforest/IsolationForest.scala:127: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method get,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/main/scala/com/linkedin/relevance/isolationforest/IsolationForestModelReadWrite.scala:302: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method extractParamMap,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/main/scala/com/linkedin/relevance/isolationforest/IsolationTree.scala:127: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method nextDouble,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/main/scala/com/linkedin/relevance/isolationforest/IsolationForestModelReadWrite.scala:257: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/main/scala/com/linkedin/relevance/isolationforest/IsolationTree.scala:50: method seq in trait Iterable is deprecated (since 2.13.0): Iterable.seq always returns the iterable itself
8 warnings found

> Task :isolation-forest:compileTestScala
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/BaggedPointTest.scala:48: procedure syntax is deprecated: instead, add `: Unit =` to explicitly declare `testRandomArrays`'s return type [quickfixable]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:41: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method overwrite,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:47: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method extractParamMap,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:48: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method extractParamMap,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:67: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method collect,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:68: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method collect,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:105: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method overwrite,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:111: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method extractParamMap,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:112: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method extractParamMap,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:131: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method collect,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:132: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method collect,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:185: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method overwrite,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:200: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method collect,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:201: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method collect,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:217: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method overwrite,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:223: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method extractParamMap,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestModelWriteReadTest.scala:224: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method extractParamMap,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestTest.scala:35: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method overwrite,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestTest.scala:40: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method extractParamMap,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestTest.scala:41: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method extractParamMap,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestTest.scala:151: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method collect,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestTest.scala:198: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method count,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/IsolationForestTest.scala:201: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method count,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/TestUtils.scala:31: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method builder,
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]
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/BaggedPointTest.scala:66: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/BaggedPointTest.scala:83: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/BaggedPointTest.scala:104: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/BaggedPointTest.scala:124: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/BaggedPointTest.scala:145: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/BaggedPointTest.scala:171: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
[Warn] /Users/jv/Documents/git/isolation-forest/isolation-forest/src/test/scala/com/linkedin/relevance/isolationforest/BaggedPointTest.scala:190: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
31 warnings found

BUILD SUCCESSFUL in 1m 39s
12 actionable tasks: 11 executed, 1 up-to-date

And here is the same build after the changes in this PR:

(base) jv@Jamess-MBP isolation-forest % ./gradlew clean build --no-build-cache

> Configure project :
Building version '3.1.1'
  - reason: shipkit-auto-version deduced version based on previous tag: '3.1.0'

> Configure project :isolation-forest
Scala version: 2.13.14
Spark version: 3.5.1

BUILD SUCCESSFUL in 1m 42s
12 actionable tasks: 11 executed, 1 up-to-date