[Git][java-team/gradle][master] 3 commits: Fixed the decoration of the generic classes with Java 24+

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Sun Oct 18 10:33:44 BST 2026



Emmanuel Bourg pushed to branch master at Debian Java Maintainers / gradle


Commits:
626dcdad by Emmanuel Bourg at 2026-10-18T11:19:06+02:00
Fixed the decoration of the generic classes with Java 24+

- - - - -
f94b774a by Emmanuel Bourg at 2026-10-18T11:19:55+02:00
Fixed the classpath of the OSGi plugin with bnd 6.4.1

- - - - -
94f2a02d by Emmanuel Bourg at 2026-10-18T11:20:22+02:00
Upload to unstable

- - - - -


5 changed files:

- debian/changelog
- debian/control
- + debian/patches/jdk24-generated-class-signature.patch
- debian/patches/normalize-classpath.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+gradle (4.6-4) unstable; urgency=medium
+
+  * Team upload.
+  * Fixed the decoration of the generic classes with Java 24+
+  * Fixed the classpath of the OSGi plugin with bnd 6.4.1
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Sun, 18 Oct 2026 11:20:14 +0200
+
 gradle (4.6-3) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -2,7 +2,7 @@ Source: gradle
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Section: java
 Build-Depends: ant,
-               bnd (>= 3.5.0),
+               bnd (>= 6.4.1),
                debhelper-compat (= 13),
                default-jdk-doc,
                default-jdk (>= 2:1.9),
@@ -140,7 +140,7 @@ Description: Powerful build system for the JVM - Core libraries
 Package: libgradle-plugins-java
 Architecture: all
 Depends: ant-optional,
-         bnd (>= 3.5.0),
+         bnd (>= 6.4.1),
          junit4,
          junit5,
          libantlr-java,


=====================================
debian/patches/jdk24-generated-class-signature.patch
=====================================
@@ -0,0 +1,80 @@
+Description: Declare the type variables of the decorated classes
+ Since Java 24 (JDK-8337302) an undefined type variable in a generic signature
+ throws TypeNotPresentException instead of resolving to null. The decorated
+ subclasses copy the constructor signatures of their generic superclass without
+ declaring its type variables, which breaks the cpp-library plugin on Java 25.
+Origin: backport, https://github.com/gradle/gradle/commit/8c9327df9c90409eb1024d582ac686918eb55d30
+Author: Octavia Togami <otogami at gradle.com>
+Forwarded: not-needed
+--- a/subprojects/core/src/main/java/org/gradle/api/internal/AsmBackedClassGenerator.java
++++ b/subprojects/core/src/main/java/org/gradle/api/internal/AsmBackedClassGenerator.java
+@@ -36,6 +36,7 @@
+ import org.gradle.internal.reflect.JavaReflectionUtil;
+ import org.gradle.internal.service.ServiceRegistry;
+ import org.gradle.model.internal.asm.AsmClassGenerator;
++import org.gradle.model.internal.asm.AsmClassGeneratorUtils;
+ import org.gradle.util.CollectionUtils;
+ import org.gradle.util.ConfigureUtil;
+ import org.objectweb.asm.AnnotationVisitor;
+@@ -171,7 +172,7 @@
+ 
+             includeNotInheritedAnnotations();
+ 
+-            visitor.visit(V1_5, ACC_PUBLIC | ACC_SYNTHETIC, generatedType.getInternalName(), null,
++            visitor.visit(V1_5, ACC_PUBLIC | ACC_SYNTHETIC, generatedType.getInternalName(), AsmClassGeneratorUtils.encodeTypeVariablesAsSignature(type),
+                 superclassType.getInternalName(), interfaceTypes.toArray(EMPTY_STRINGS));
+         }
+ 
+--- a/subprojects/model-core/src/main/java/org/gradle/model/internal/asm/AsmClassGeneratorUtils.java
++++ b/subprojects/model-core/src/main/java/org/gradle/model/internal/asm/AsmClassGeneratorUtils.java
+@@ -17,10 +17,50 @@
+ package org.gradle.model.internal.asm;
+ 
+ import org.objectweb.asm.Type;
++import org.objectweb.asm.signature.SignatureVisitor;
++import org.objectweb.asm.signature.SignatureWriter;
+ 
+ import java.lang.reflect.*;
+ 
+ public class AsmClassGeneratorUtils {
++    private static final String OBJECT_INTERNAL_NAME = Object.class.getName().replace('.', '/');
++
++    /**
++     * Take the type variables defined by {@code javaClass} and encode them into a signature string,
++     * appropriate for use as the signature of a subclass.
++     *
++     * <p>
++     * This allows us to refer to the same type variables in our method signatures without generating undefined type variables that are
++     * <a href="https://bugs.openjdk.org/browse/JDK-8337302">an error in JDK 24</a>.
++     * </p>
++     *
++     * @param javaClass the Java class to take the type variables from
++     */
++    public static String encodeTypeVariablesAsSignature(Class<?> javaClass) {
++        TypeVariable<? extends Class<?>>[] typeParameters = javaClass.getTypeParameters();
++        if (typeParameters.length == 0) {
++            return null;
++        }
++
++        SignatureWriter writer = new SignatureWriter();
++        for (TypeVariable<? extends Class<?>> typeParameter : typeParameters) {
++            writer.visitFormalTypeParameter(typeParameter.getName());
++            // The bounds are not copied, but some bound must be specified
++            SignatureVisitor typeParameterBoundWriter = writer.visitClassBound();
++            typeParameterBoundWriter.visitClassType(OBJECT_INTERNAL_NAME);
++            typeParameterBoundWriter.visitEnd();
++        }
++
++        // Pass the variables to the superclass as well
++        SignatureVisitor superVisitor = writer.visitSuperclass();
++        superVisitor.visitClassType(Type.getType(javaClass).getInternalName());
++        for (TypeVariable<? extends Class<?>> typeParameter : typeParameters) {
++            superVisitor.visitTypeArgument('=').visitTypeVariable(typeParameter.getName());
++        }
++        superVisitor.visitEnd();
++
++        return writer.toString();
++    }
+ 
+     /**
+      * Generates the signature for the given constructor


=====================================
debian/patches/normalize-classpath.patch
=====================================
@@ -38,7 +38,7 @@ Subject: Normalize the generated classpath in every JAR Gradle uses its own
      }
  
      Properties createProperties() {
-@@ -73,4 +78,51 @@
+@@ -73,4 +78,54 @@
      def generate() {
          ReproduciblePropertiesWriter.store(createProperties(), manifestFile)
      }
@@ -56,6 +56,9 @@ Subject: Normalize the generated classpath in every JAR Gradle uses its own
 +        if (name.startsWith('biz.aQute.bndlib-')) {
 +            return 'bndlib.jar'
 +        }
++        if (name.startsWith('biz.aQute.bnd.util-')) {
++            return 'bnd-util.jar'
++        }
 +        if (name.startsWith('commons-collections-')) {
 +            return 'commons-collections3.jar'
 +        }


=====================================
debian/patches/series
=====================================
@@ -46,3 +46,4 @@ snakeyaml-2-compatibility.patch
 java9-modules-compatibility.patch
 serializer-equality.patch
 gradle-debian-helper-plugin-filter.patch
+jdk24-generated-class-signature.patch



View it on GitLab: https://salsa.debian.org/java-team/gradle/-/compare/5d857c0a0cc6f4dccaab628f055f4a2c2d87624a...94f2a02d76bb8753b03b78c11dc63cb4bc5d2c76

-- 
View it on GitLab: https://salsa.debian.org/java-team/gradle/-/compare/5d857c0a0cc6f4dccaab628f055f4a2c2d87624a...94f2a02d76bb8753b03b78c11dc63cb4bc5d2c76
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261018/d19f30ba/attachment.htm>


More information about the pkg-java-commits mailing list