Skip to content

[bug] Can't use methods on annotations after scan result is closed. #930

@Skater901

Description

@Skater901

I've found a bug with annotations that are loaded via classgraph.

When invoking the equals method on the annotation after the scan result is closed, a NullPointerException is thrown here.

From what I can tell, the reason for this is that the preceding code is checking the wrong thing. When the scan result is closed, annotationInfo.scanResult is not touched. However, annotationInfo.scanResult.reflectionUtils IS set to null. I think the fix is to change the condition of that ternary to check for annotationInfo.scanResult.reflectionUtils == null.

I've created a small reproducible example here: https://github.com/Skater901/classgraph-annotation-equals-problem/blob/main/src/main/kotlin/au/com/skater901/main.kt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions