Skip to content

Add Check Support for Java 21 Unnamed Variables & Patterns Syntax: AnnotationLocation #15060

@mahfouz72

Description

@mahfouz72

child of #14942 :
Check documentation:https://checkstyle.org/checks/annotation/annotationlocation.html#AnnotationLocation

PS D:\CS\test> cat src/Test.java                                                
record ColoredPoint(int p, int x, int c) { }
record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) { }

public class Test {
    void test(Object obj) {
        if (obj instanceof ColoredPoint( @Deprecated int _,_,_)){
        }
        @Deprecated
        int _ = 0;
    }
}

PS D:\CS\test> cat config.xml                                                   
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
        "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
        "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
    <property name="charset" value="UTF-8"/>
    <module name="TreeWalker">
        <module name="AnnotationLocation">
        </module>
    </module>
</module>
PS D:\CS\test> java  -jar checkstyle-10.17.0-all.jar -c config.xml src/Test.java
Starting audit...
Audit done.
PS D:\CS\test> 

No update is needed for this check.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions