1212import javax .lang .model .element .TypeElement ;
1313import javax .lang .model .type .TypeMirror ;
1414import org .checkerframework .checker .modifiability .qual .ThrowsUOE ;
15- import org .checkerframework .checker .modifiability .qual .UnmodParam ;
15+ import org .checkerframework .checker .modifiability .qual .UnmodifiableParam ;
1616import org .checkerframework .common .basetype .BaseAnnotatedTypeFactory ;
1717import org .checkerframework .common .basetype .BaseTypeChecker ;
1818import org .checkerframework .common .basetype .BaseTypeVisitor ;
@@ -75,8 +75,8 @@ public void processClassTree(ClassTree classTree) {
7575
7676 @ Override
7777 public Void visitAnnotation (AnnotationTree tree , Void p ) {
78- if (shouldCheckUnmodParamLocation () && isUnmodParamAnnotation (tree )) {
79- if (!isWithinAllowedUnmodParamLocation ()) {
78+ if (shouldCheckUnmodifiableParamLocation () && isUnmodifiableParamAnnotation (tree )) {
79+ if (!isWithinAllowedUnmodifiableParamLocation ()) {
8080 checker .reportError (tree , "unmodparam.location" );
8181 }
8282 }
@@ -114,14 +114,14 @@ protected boolean shouldCheckThrowsUOE() {
114114 }
115115
116116 /**
117- * Returns true if this checker should report {@code @UnmodParam } location errors.
117+ * Returns true if this checker should report {@code @UnmodifiableParam } location errors.
118118 *
119119 * <p>The default is {@code true}. Shrink and Replace override this to avoid tripling diagnostics
120120 * when running under the aggregate {@link ModifiabilityChecker}.
121121 *
122- * @return true if this visitor should report {@code @UnmodParam } location errors
122+ * @return true if this visitor should report {@code @UnmodifiableParam } location errors
123123 */
124- protected boolean shouldCheckUnmodParamLocation () {
124+ protected boolean shouldCheckUnmodifiableParamLocation () {
125125 return true ;
126126 }
127127
@@ -139,30 +139,31 @@ protected boolean shouldCheckCustomModifiabilityAnnotation() {
139139 }
140140
141141 /**
142- * Returns true if {@code tree} is an {@link UnmodParam } annotation.
142+ * Returns true if {@code tree} is an {@link UnmodifiableParam } annotation.
143143 *
144144 * @param tree an annotation tree
145- * @return true if {@code tree} is an {@code @UnmodParam } annotation
145+ * @return true if {@code tree} is an {@code @UnmodifiableParam } annotation
146146 */
147- private boolean isUnmodParamAnnotation (AnnotationTree tree ) {
147+ private boolean isUnmodifiableParamAnnotation (AnnotationTree tree ) {
148148 String annotationName = tree .getAnnotationType ().toString ();
149149 // Quick check to avoid expensive annotation resolution for most annotations.
150- if (!annotationName .equals ("UnmodParam" ) && !annotationName .endsWith (".UnmodParam" )) {
150+ if (!annotationName .equals ("UnmodifiableParam" )
151+ && !annotationName .endsWith (".UnmodifiableParam" )) {
151152 return false ;
152153 }
153154
154155 AnnotationMirror annotation = TreeUtils .annotationFromAnnotationTree (tree );
155- return annotation != null && atypeFactory .areSameByClass (annotation , UnmodParam .class );
156+ return annotation != null && atypeFactory .areSameByClass (annotation , UnmodifiableParam .class );
156157 }
157158
158159 /**
159160 * Returns true if the current annotation path is inside a method/constructor parameter type or
160161 * explicit receiver parameter type.
161162 *
162- * @return true if {@code @UnmodParam } is allowed at the current location
163+ * @return true if {@code @UnmodifiableParam } is allowed at the current location
163164 */
164165 @ SuppressWarnings ("interning:not.interned" ) // AST node comparison
165- private boolean isWithinAllowedUnmodParamLocation () {
166+ private boolean isWithinAllowedUnmodifiableParamLocation () {
166167 // Find the declaration that contains the annotation, if any.
167168 TreePath path = getCurrentPath ();
168169 TreePath variablePath = null ;
0 commit comments