private void handleDeprecatedAnnotations ( List < JCAnnotation > annotations , Symbol sym ) { for ( List < JCAnnotation > al = annotations ; ! al . isEmpty ( ) ; al = al . tail ) { JCAnnotation a = al . head ; if ( a . annotationType . type == syms . deprecatedType ) { sym . flags_field |= ( Flags . DEPRECATED | Flags . DEPRECATED_ANNOTATION ) ; a . args . stream ( ) . filter ( e -> e . hasTag ( ASSIGN ) ) . map ( e -> ( JCAssign ) e ) . filter ( assign -> TreeInfo . name ( assign . lhs ) == names . forRemoval ) . findFirst ( ) . ifPresent ( assign -> { JCExpression rhs = TreeInfo . skipParens ( assign . rhs ) ; if ( rhs . hasTag ( LITERAL ) && Boolean . TRUE . equals ( ( ( JCLiteral ) rhs ) . getValue ( ) ) ) { sym . flags_field |= DEPRECATED_REMOVAL ; } } ) ; } } }
If a list of annotations contains a reference to java . lang . Deprecated set the DEPRECATED flag . If the annotation is marked forRemoval = true also set DEPRECATED_REMOVAL .