Skip to content

'auto' for instanceof record pattern #763

@renshengongji

Description

@renshengongji

Is your feature request related to a problem? Please describe.
the 'auto' not support for record pattern(destructuring)
if (obj instanceof Test(String str, var obj)) { ... }

Describe the solution you'd like
support auto in record pattern

if (test instanceof Test(auto str, auto obj)) {
    ...
}

Describe alternatives you've considered
explicitly write the types or use var keyword

Additional context
Example

public class Test {
    public static void main(String[] args) {
        Test test = new Test("", 1);
        if (test instanceof Test(auto str, auto num)) {
            System.out.println(str + " | " + num);
        }
    }

    record Test(String str, float num) {}
}

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