Skip to content

false positive for local record classes, local enum classes: UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS #2120

@clo-vis

Description

@clo-vis

For the following example, I get several warnings "Uncallable method ... defined in anonymous class".

class FalsePositive {
    static void method() {
        record MyRecord(int from, int to) { /**/ }
        
        enum MyEnum {
            RED, BLUE;
        }
        
        System.out.println(new MyRecord(1, 2));
        System.out.println(MyEnum.RED);
    }
}

The example has no anonymous class (all classes have a name) and all uncallable methods pinpointed are callable (which doesn't mean I need to call them - they were generated by the compiler)

  • MyEnum.valueOf(String)
  • MyEnum.values()
  • MyRecord.from()
  • MyRecord.to()

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