This is an automated email from the ASF dual-hosted git repository.

pjfanning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-http.git


The following commit(s) were added to refs/heads/main by this push:
     new 8aa98a6ad Update classgraph to 5.0.0 (#1355)
8aa98a6ad is described below

commit 8aa98a6ade0fe4664dce831d383911e49aca4306
Author: Scala Steward <[email protected]>
AuthorDate: Fri Oct 16 19:30:26 2026 +0200

    Update classgraph to 5.0.0 (#1355)
    
    Motivation:
    classgraph 6.0.0 is compiled for Java 25 (class file version 69) and
    cannot run on Java 17. 5.0.0 targets Java 17 but has a reworked API.
    
    Modification:
    - Use classgraph 5.0.0 instead of 6.0.0.
    - Migrate test code to the 5.x API: getDirectSuperinterfaces,
      getAllSuperclasses and getDirectAnnotationInfo.
    - Pass the spec's ClassLoader via enableClassLoaders, since 5.x scans
      nothing unless a classpath source is enabled.
    - Pin classgraph to 5.x in .scala-steward.conf.
    
    Result:
    Test-only classgraph dependency is upgraded and still runs on Java 17.
    
    Tests:
    - sbt "http-tests/testOnly 
org.apache.pekko.http.javadsl.DirectivesConsistencySpec" (JDK 17): 321 
succeeded, same as with 4.8.199
    - sbt "docs/testOnly docs.ApiMayChangeDocCheckerSpec" (JDK 17): 2 
succeeded, same as with 4.8.199
    - scalafmt: no changes
    
    References:
    Refs #1355
    
    Co-authored-by: PJ Fanning <[email protected]>
---
 .scala-steward.conf                                                | 2 ++
 docs/src/test/scala/docs/ApiMayChangeDocCheckerSpec.scala          | 1 +
 .../org/apache/pekko/http/javadsl/DirectivesConsistencySpec.scala  | 7 ++++---
 project/Dependencies.scala                                         | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/.scala-steward.conf b/.scala-steward.conf
index 45b615684..bf741f20a 100644
--- a/.scala-steward.conf
+++ b/.scala-steward.conf
@@ -17,6 +17,8 @@ updates.pin = [
   { groupId = "org.scala-lang", artifactId = "scala3-library", version = 
"3.3." }
   # we have too many build plugins that need sbt 1.x
   { groupId = "org.scala-sbt", artifactId = "sbt", version = "1." }
+  # classgraph 6.x requires Java 25; 5.x supports Java 17
+  { groupId = "io.github.classgraph", artifactId = "classgraph", version = 
"5." }
 ]
 
 updatePullRequests = "always"
diff --git a/docs/src/test/scala/docs/ApiMayChangeDocCheckerSpec.scala 
b/docs/src/test/scala/docs/ApiMayChangeDocCheckerSpec.scala
index ad5278f06..2718ab56a 100644
--- a/docs/src/test/scala/docs/ApiMayChangeDocCheckerSpec.scala
+++ b/docs/src/test/scala/docs/ApiMayChangeDocCheckerSpec.scala
@@ -30,6 +30,7 @@ class ApiMayChangeDocCheckerSpec extends AnyWordSpec with 
Matchers with BeforeAn
 
   private lazy val scanResult =
     new ClassGraph()
+      .enableClassLoaders(getClass.getClassLoader)
       .acceptPackages("org.apache.pekko.http")
       .enableClassInfo()
       .enableMethodInfo()
diff --git 
a/http-tests/src/test/scala/org/apache/pekko/http/javadsl/DirectivesConsistencySpec.scala
 
b/http-tests/src/test/scala/org/apache/pekko/http/javadsl/DirectivesConsistencySpec.scala
index 78a514184..9353cf064 100644
--- 
a/http-tests/src/test/scala/org/apache/pekko/http/javadsl/DirectivesConsistencySpec.scala
+++ 
b/http-tests/src/test/scala/org/apache/pekko/http/javadsl/DirectivesConsistencySpec.scala
@@ -31,6 +31,7 @@ object ClassGraphMembers {
 
   private lazy val scanResult =
     new ClassGraph()
+      .enableClassLoaders(getClass.getClassLoader)
       .acceptPackages("org.apache.pekko.http")
       .enableClassInfo()
       .enableMethodInfo()
@@ -61,12 +62,12 @@ object ClassGraphMembers {
 
   def allInterfaces(clazz: Class[?]): Vector[String] =
     interfacesCache.getOrElseUpdate(clazz.getName,
-      
classInfo(clazz.getName).getInterfaces.directOnly.asScala.map(_.getName).toVector)
+      
classInfo(clazz.getName).getDirectSuperinterfaces.asScala.map(_.getName).toVector)
 
   def superclasses(clazz: Class[?]): Vector[String] =
     superclassesCache.getOrElseUpdate(
       clazz.getName,
-      (classInfo(clazz.getName) +: 
classInfo(clazz.getName).getSuperclasses.asScala.toVector)
+      (classInfo(clazz.getName) +: 
classInfo(clazz.getName).getAllSuperclasses.asScala.toVector)
         .map(_.getName)
         .filterNot(_ == "java.lang.Object"))
 
@@ -81,7 +82,7 @@ object ClassGraphMembers {
     MethodInfo(
       method.getName,
       method.isStatic,
-      Option(method.getAnnotationInfo(correspondsToAnnotation))
+      Option(method.getDirectAnnotationInfo(correspondsToAnnotation))
         .flatMap(annotation => 
Option(annotation.getParameterValues.getValue("value")).map(_.toString)))
 }
 
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index b475f06e4..5854dc4dd 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -29,7 +29,7 @@ object Dependencies {
   val h2specArtifactExtension = if (h2specExe.endsWith("exe")) "zip" else 
"tar.gz"
   val h2specUrl =
     
s"https://github.com/summerwind/h2spec/releases/download/v$h2specVersion/$h2specName.$h2specArtifactExtension";
-  val classGraphVersion = "4.8.199"
+  val classGraphVersion = "5.0.0"
 
   val scalaTestVersion = "3.2.20"
   val scalaCheckVersion = "1.19.0"


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

Reply via email to