private void handle ( final JCTree . JCFieldAccess fieldAccess , final Stack < MethodAndParameter > stack , final MethodInvocationTree node , final StatementInfo statementInfo , final ScannerParams scannerParams ) { if ( fieldAccess . getExpression ( ) . getKind ( ) . equals ( Tree . Kind . MEMBER_SELECT ) ) { //to handle when structlogger field is referenced through this.field and ClassName.field final MemberSelectTree expression = ( MemberSelectTree ) fieldAccess . getExpression ( ) ; final Name name = expression . getIdentifier ( ) ; if ( scannerParams . getFields ( ) . containsKey ( name ) ) { handleStructLogExpression ( stack , node , name , statementInfo , scannerParams ) ; } } else if ( fieldAccess . getExpression ( ) . getKind ( ) . equals ( Tree . Kind . IDENTIFIER ) ) { // to handle when structlogger field is referenced directly final JCTree . JCIdent ident = ( JCTree . JCIdent ) fieldAccess . getExpression ( ) ; final Name name = ident . getName ( ) ; if ( scannerParams . getFields ( ) . containsKey ( name ) ) { handleStructLogExpression ( stack , node , name , statementInfo , scannerParams ) ; } } }
checks whether fieldAccess node s expression is MEMBER_SELECT or IDENTIFIER and if so then checks that accessed field name corresponds with some declared structlogger field and if it does correspond then whole statement is handled as structlogger expression