@ CheckReturnValue private boolean populateTypesToEnforce ( MethodSymbol declaredMethod , Type calledMethodType , Type calledReceiverType , List < RequiredType > argumentTypeRequirements , VisitorState state ) { boolean foundAnyTypeToEnforce = false ; List < VarSymbol > params = declaredMethod . params ( ) ; for ( int i = 0 ; i < params . size ( ) ; i ++ ) { VarSymbol varSymbol = params . get ( i ) ; CompatibleWith anno = ASTHelpers . getAnnotation ( varSymbol , CompatibleWith . class ) ; if ( anno != null ) { foundAnyTypeToEnforce = true ; // Now we try and resolve the generic type argument in the annotation against the current // method call's projection of this generic type. RequiredType requiredType = resolveRequiredTypeForThisCall ( state , calledMethodType , calledReceiverType , declaredMethod , anno . value ( ) ) ; // @CW is on the varags parameter if ( declaredMethod . isVarArgs ( ) && i == params . size ( ) - 1 ) { if ( i >= argumentTypeRequirements . size ( ) ) { // varargs method with 0 args passed from the caller side, no arguments to enforce // void foo(String...); foo(); break ; } else { // Set this required type for all of the arguments in the varargs position. for ( int j = i ; j < argumentTypeRequirements . size ( ) ; j ++ ) { argumentTypeRequirements . set ( j , requiredType ) ; } } } else { argumentTypeRequirements . set ( i , requiredType ) ; } } } return foundAnyTypeToEnforce ; }
caller should explore super - methods .