From fb9cf8efd97a0a7b9b53c859c2703339e3a53fb8 Mon Sep 17 00:00:00 2001 From: Prabhu Subramanian Date: Fri, 10 Nov 2023 17:38:24 +0000 Subject: [PATCH] Java 21 Signed-off-by: Prabhu Subramanian --- .github/workflows/nodejstests.yml | 4 ++-- .github/workflows/npm-release.yml | 4 ++-- .github/workflows/repotests.yml | 4 ++-- build.sbt | 10 +++++----- .../io/appthreat/atom/dataflows/DataFlowGraph.scala | 2 +- .../io/appthreat/atom/slicing/DataFlowSlicing.scala | 2 +- .../scala/io/appthreat/atom/slicing/UsageSlicing.scala | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/nodejstests.yml b/.github/workflows/nodejstests.yml index 1b85e1f..12a709c 100644 --- a/.github/workflows/nodejstests.yml +++ b/.github/workflows/nodejstests.yml @@ -7,8 +7,8 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - java-version: ['17', '19', '20', '21'] - node-version: ['20.x'] + java-version: ['21'] + node-version: ['21.x'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml index 2035452..33d1962 100644 --- a/.github/workflows/npm-release.yml +++ b/.github/workflows/npm-release.yml @@ -17,14 +17,14 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: '21.x' registry-url: https://registry.npmjs.org/ - uses: coursier/cache-action@v6 - name: Set up JDK uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: '19' + java-version: '21' - name: Release run: | sbt scalafmtCheck stage assembly createDistribution diff --git a/.github/workflows/repotests.yml b/.github/workflows/repotests.yml index 70c274f..35ce4f7 100644 --- a/.github/workflows/repotests.yml +++ b/.github/workflows/repotests.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - java-version: ['17', '19', '20', '21'] + java-version: ['21'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -57,7 +57,7 @@ jobs: - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: - node-version: '20.x' + node-version: '21.x' - run: | sbt stage astGenDlTask ./atom.sh -o /tmp/java.atom -l java $GITHUB_WORKSPACE/repotests/shiftleft-java-example -Dlog4j.configurationFile=log4j2.xml diff --git a/build.sbt b/build.sbt index 271d8ed..25e6a8f 100644 --- a/build.sbt +++ b/build.sbt @@ -12,8 +12,8 @@ val astGenVersion = "3.5.0" libraryDependencies ++= Seq( "com.github.pathikrit" %% "better-files" % "3.9.2", "com.github.scopt" %% "scopt" % "4.1.0", - "org.apache.logging.log4j" % "log4j-core" % "2.20.0" % Optional, - "org.apache.logging.log4j" % "log4j-slf4j2-impl" % "2.20.0" % Optional, + "org.apache.logging.log4j" % "log4j-core" % "2.21.1" % Optional, + "org.apache.logging.log4j" % "log4j-slf4j2-impl" % "2.21.1" % Optional, "io.appthreat" %% "c2cpg" % Versions.chen excludeAll ( ExclusionRule(organization = "com.ibm.icu", name = "icu4j"), ExclusionRule(organization = "org.eclipse.platform", name = "org.eclipse.jface"), @@ -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"