-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update readme. Includes Java 21 patch
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
- Loading branch information
Showing
3 changed files
with
76 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Introduction | ||
|
||
Atom works better under Java 21 with virtual threads. Use the provided patch for Java 21. | ||
|
||
```shell | ||
git apply --ignore-space-change --ignore-whitespace contrib/java21.patch | ||
sbt clean stage createDistribution | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
diff --git a/build.sbt b/build.sbt | ||
index 271d8ed..25e6a8f 100644 | ||
--- a/build.sbt | ||
+++ b/build.sbt | ||
@@ -35,17 +35,17 @@ Compile / doc / scalacOptions ++= Seq("-doc-title", "atom apidocs", "-doc-versio | ||
ThisBuild / scalacOptions ++= Seq( | ||
"-deprecation", // Emit warning and location for usages of deprecated APIs. | ||
"--release", | ||
- "17", | ||
+ "21", | ||
) | ||
|
||
ThisBuild / compile / javacOptions ++= Seq( | ||
"-g", // debug symbols | ||
"-Xlint", | ||
- "--release=17" | ||
+ "--release=21" | ||
) ++ { | ||
// fail early if users with JDK11 try to run this | ||
val javaVersion = sys.props("java.specification.version").toFloat | ||
- assert(javaVersion.toInt >= 17, s"this build requires JDK17+ - you're using $javaVersion") | ||
+ assert(javaVersion.toInt >= 21, s"this build requires JDK21+ - you're using $javaVersion") | ||
Nil | ||
} | ||
|
||
diff --git a/src/main/scala/io/appthreat/atom/dataflows/DataFlowGraph.scala b/src/main/scala/io/appthreat/atom/dataflows/DataFlowGraph.scala | ||
index 9d1f9bb..52ff6fe 100644 | ||
--- a/src/main/scala/io/appthreat/atom/dataflows/DataFlowGraph.scala | ||
+++ b/src/main/scala/io/appthreat/atom/dataflows/DataFlowGraph.scala | ||
@@ -65,7 +65,7 @@ object DataFlowGraph: | ||
private def DF_EDGES = | ||
Set(EdgeTypes.REACHING_DEF, EdgeTypes.CALL, EdgeTypes.REF) | ||
val exec: ExecutorService = | ||
- Executors.newWorkStealingPool(Runtime.getRuntime.availableProcessors / 2) | ||
+ Executors.newVirtualThreadPerTaskExecutor() | ||
|
||
def buildFromSlice(slice: DataFlowSlice): DataFlowGraph = | ||
val dfNodes = slice.nodes | ||
diff --git a/src/main/scala/io/appthreat/atom/slicing/DataFlowSlicing.scala b/src/main/scala/io/appthreat/atom/slicing/DataFlowSlicing.scala | ||
index 7b39fb9..0a5855b 100644 | ||
--- a/src/main/scala/io/appthreat/atom/slicing/DataFlowSlicing.scala | ||
+++ b/src/main/scala/io/appthreat/atom/slicing/DataFlowSlicing.scala | ||
@@ -14,7 +14,7 @@ class DataFlowSlicing: | ||
|
||
implicit val resolver: ICallResolver = NoResolve | ||
protected val exec: ExecutorService = | ||
- Executors.newWorkStealingPool(Runtime.getRuntime.availableProcessors() / 2) | ||
+ Executors.newVirtualThreadPerTaskExecutor() | ||
private val excludeOperatorCalls = new AtomicBoolean(true) | ||
private val nodeCache = new TrieMap[Long, SliceNode]() | ||
private var language: Option[String] = _ | ||
diff --git a/src/main/scala/io/appthreat/atom/slicing/UsageSlicing.scala b/src/main/scala/io/appthreat/atom/slicing/UsageSlicing.scala | ||
index 75803d1..61f538b 100644 | ||
--- a/src/main/scala/io/appthreat/atom/slicing/UsageSlicing.scala | ||
+++ b/src/main/scala/io/appthreat/atom/slicing/UsageSlicing.scala | ||
@@ -20,7 +20,7 @@ object UsageSlicing: | ||
|
||
private val resolver = NoResolve | ||
val exec: ExecutorService = | ||
- Executors.newWorkStealingPool(Runtime.getRuntime.availableProcessors() / 2) | ||
+ Executors.newVirtualThreadPerTaskExecutor() | ||
private val constructorTypeMatcher = Pattern.compile(".*new (\\w+)\\(.*") | ||
private val excludeOperatorCalls = new AtomicBoolean(true) | ||
private val FRAMEWORK_ROUTE = "framework-route" |