File tree Expand file tree Collapse file tree
src/main/java/org/checkerframework/checker/index/samelen Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .checkerframework .checker .index .samelen ;
22
33import org .checkerframework .common .basetype .BaseTypeChecker ;
4- import org .checkerframework .framework .qual .RelevantJavaTypes ;
54import org .checkerframework .framework .source .SuppressWarningsPrefix ;
65
76/**
109 *
1110 * @checker_framework.manual #index-checker Index Checker
1211 */
13- @ RelevantJavaTypes ({CharSequence .class , Object [].class , Object .class })
12+ // This @RelevantJavaTypes annotation is incorrect, because @SameLen can apply to an arbitrary
13+ // user-defined datatype: https://checkerframework.org/manual/#index-annotating-fixed-size .
14+ // @RelevantJavaTypes({CharSequence.class, Object[].class, Object.class})
1415@ SuppressWarningsPrefix ({"index" , "samelen" })
1516public class SameLenChecker extends BaseTypeChecker {
1617 /** Create a new SameLenChecker. */
Original file line number Diff line number Diff line change 11// Tests that adding an @SameLen annotation to a primitive type is still
22// an error.
33
4+ // All the errors in this test case are disabled. They were issued when `@SameLen` was restricted
5+ // to arrays and CharSequence, but @SameLen can be written on an arbitrary user-defined type:
6+ // https://checkerframework.org/manual/#index-annotating-fixed-size .
7+
48import org .checkerframework .checker .index .qual .SameLen ;
59
610public class SameLenIrrelevant {
7- // :: error: (anno.on.irrelevant)
11+ // NO :: error: (anno.on.irrelevant)
812 public void test (@ SameLen ("#2" ) int x , int y ) {
913 // do nothing
1014 }
1115
12- // :: error: (anno.on.irrelevant)
16+ // NO :: error: (anno.on.irrelevant)
1317 public void test (@ SameLen ("#2" ) double x , double y ) {
1418 // do nothing
1519 }
1620
17- // :: error: (anno.on.irrelevant)
21+ // NO :: error: (anno.on.irrelevant)
1822 public void test (@ SameLen ("#2" ) char x , char y ) {
1923 // do nothing
2024 }
You can’t perform that action at this time.
0 commit comments