Record requires ASM8 Java17

Hello
While using records and Java17, all rest endpoints returns 404 and the error appears in logs:

[c.a.p.r.module.scanner.AnnotatedClassScanner] Exception while processing file

java.lang.UnsupportedOperationException: Record requires ASM8
at org.objectweb.asm.ClassVisitor.visitRecordComponent(ClassVisitor.java:323)
at org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:953)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:731)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:424)
at com.atlassian.plugins.rest.module.scanner.AnnotatedClassScanner.analyzeClassFile(AnnotatedClassScanner.java:153)
at com.atlassian.plugins.rest.module.scanner.AnnotatedClassScanner.indexJar(AnnotatedClassScanner.java:126)
at com.atlassian.plugins.rest.module.scanner.AnnotatedClassScanner.scan(AnnotatedClassScanner.java:58)
at com.atlassian.plugins.rest.module.OsgiResourceConfig.scanForAnnotatedClasses(OsgiResourceConfig.java:94)
at com.atlassian.plugins.rest.module.OsgiResourceConfig.getClasses(OsgiResourceConfig.java:86)
… 6 filtered
I tried update dependencies but with no results:

<dependency>
    <groupId>com.atlassian.plugins.rest</groupId>
    <artifactId>atlassian-rest-common</artifactId>
    <version>6.1.2</version>
    <scope>provided</scope>
    <exclusions>
        <exclusion>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.ow2.asm</groupId>
    <artifactId>asm</artifactId>
    <version>9.2</version>
    <scope>provided</scope>
</dependency>

Does anyone have any suggestions how to solve it? Thanks!

Hello Karolina,
it sounds like you’re encountering an issue with ASM (Abstract Syntax Tree) compatibility when using Java 17 records. The error message indicates that the current version of ASM being used is not compatible with Java 17 records, which require ASM81.

Here are a few steps you can take to resolve this issue maybe it will help :slight_smile:

  1. Update ASM Dependency: Ensure that you are using the latest version of ASM that supports Java 17 records. You can update your pom.xml to use ASM version 9.2 or higher.
<dependency>
    <groupId>org.ow2.asm</groupId>
    <artifactId>asm</artifactId>
    <version>9.2</version>
    <scope>provided</scope>
</dependency>
  1. Check Compatibility: Verify that all other dependencies in your project are compatible with Java 17 and ASM8. Sometimes, other libraries might need updates to work correctly with newer Java versions.
  2. Clear Plugin Caches: If you’re still facing issues, try clearing the plugin caches in your development environment. This can sometimes resolve unexpected behavior.
  3. Consult Documentation: Review the documentation for both Java 17 and ASM to ensure that you’re following the recommended practices for using records and ASM8.

If you’ve already tried updating the dependencies and it didn’t resolve the issue, could you share more details about your project setup? This might help identify any other potential conflicts or misconfigurations.

Best regards
Daniel