Skip to content

[Native Image] ClassCastException during points-to analysis on JDK 25 (LambdaSubstitutionType -> HotSpotResolvedObjectTypeImpl) #14211

Description

@lwx-tplink

Describe the Issue

Native Image fails during points-to analysis with an internal ClassCastException when building a large Spring Boot 4.1.0 application on Linux AArch64.

The failing cast is:
com.oracle.svm.hosted.lambda.LambdaSubstitutionType
-> jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl

The same issue reproduces on:

  1. GraalVM CE 25.0.1
  2. BellSoft Liberica NIK 25.0.2

Spring AOT (spring-boot:process-aot) succeeds. The failure happens only during Native Image analysis.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

Environment A (GraalVM CE):

  • Java version: 25.0.1+8
  • Vendor version: GraalVM CE 25.0.1+8.1
  • Graal compiler optimization level: 2
  • Target machine: compatibility
  • Garbage collector: Serial GC
  • C compiler: gcc 10.3.0 (Linux AArch64)

Environment B (Liberica NIK):

  • Java version: 25.0.2+13-LTS
  • Vendor version: Liberica-NIK-25.0.2-1
  • Graal compiler optimization level: 2
  • Target machine: compatibility
  • Garbage collector: Parallel GC
  • C compiler: gcc 10.3.0 (Linux AArch64)

Operating System and Version

Linux (AArch64)

Build Command

mvn -Pnative -Dmaven.test.skip=true native:compile

Expected Behavior

Native Image should complete points-to analysis and generate the native executable.

If unsupported code is encountered, the tool should report actionable method/type/signature context instead of terminating with an internal ClassCastException.

Actual Behavior

Native Image reaches:
[2/8] Performing analysis...

After ~40–50 minutes, it fails with:

java.lang.ClassCastException:
class com.oracle.svm.hosted.lambda.LambdaSubstitutionType
cannot be cast to
class jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl

Representative stack frames:

  • HotSpotResolvedObjectTypeImpl.isDefinitelyResolvedWithRespectTo
  • HotSpotSignature.checkValidCache
  • HotSpotSignature.getParameterType
  • AnalysisUniverse.lookup
  • AnalysisMethod.
  • NativeImagePointsToAnalysis.fallbackResolveConcreteMethod
  • AnalysisType.resolveConcreteMethod

In one GraalVM CE run before failure:

  • 70,412 types, 236,383 fields, 94,107 methods reachable
  • 59,501 types, 277,202 fields, 567,595 methods registered for reflection

Steps to Reproduce

  1. Run Spring AOT processing:
    mvn -Dmaven.test.skip=true spring-boot:process-aot

  2. Confirm Spring AOT completes successfully.

  3. Build native image:
    mvn -Pnative -Dmaven.test.skip=true native:compile

  4. Wait until points-to analysis phase ([2/8] Performing analysis...).

  5. After ~40–50 minutes, build fails with the internal ClassCastException above.

Additional Context

Application/build context:

  • Spring Boot: 4.1.0
  • Build tool: Maven
  • Available processors: 14
  • Native Image Builder max heap: 48 GB
  • Application is proprietary; no minimal reproducer is currently available.

Additional warnings before crash:

  • Unknown attribute(s) [module] in bundle descriptor object
  • Unknown attribute(s) [comment] in regex resource descriptor object
  • Netty warning around sun.misc.Unsafe::allocateMemory
  • RecomputeFieldValue.ArrayIndexScale warning for shaded JCTools class

These warnings are included for completeness and do not appear in the fatal stack trace.

Diagnostics mode was enabled.
I can provide:

  • full diagnostics archive
  • full build log
  • exact expanded native-image command line
  • additional test results with snapshot/nightly builds

Build Log Output and Error Messages

Fatal error:
java.lang.ClassCastException:
class com.oracle.svm.hosted.lambda.LambdaSubstitutionType
cannot be cast to
class jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl

Representative stack frames:
at jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.isDefinitelyResolvedWithRespectTo
at jdk.vm.ci.hotspot.HotSpotSignature.checkValidCache
at jdk.vm.ci.hotspot.HotSpotSignature.getParameterType
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup
at com.oracle.graal.pointsto.meta.AnalysisMethod.
at com.oracle.svm.hosted.analysis.NativeImagePointsToAnalysis.fallbackResolveConcreteMethod
at com.oracle.graal.pointsto.meta.AnalysisType.resolveConcreteMethod

Same essential exception and stack pattern reproduced on Liberica NIK 25.0.2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions