private void checkLockExpressionInGuardedByAnnotation(AnnotationTree tree,AnnotationMirror guardedByAnnotation){
  List<String> guardedByValue=AnnotationUtils.getElementValueArray(guardedByAnnotation,"value",String.class,true);
  if (guardedByValue.isEmpty()) {
    return;
  }
  TreePath path=getCurrentPath();
  MethodTree enclMethod=TreeUtils.enclosingMethod(path);
  FlowExpressionContext flowExprContext;
  if (enclMethod != null) {
    flowExprContext=FlowExpressionContext.buildContextForMethodDeclaration(enclMethod,path,checker.getContext());
  }
 else {
    ClassTree enclosingClass=TreeUtils.enclosingClass(path);
    flowExprContext=FlowExpressionContext.buildContextForClassDeclaration(enclosingClass,checker.getContext());
  }
  if (flowExprContext == null) {
    checker.report(Result.failure("lock.expression.possibly.not.final",guardedByValue),tree);
    return;
  }
  TreePath pathForLocalVariableRetrieval=getPathForLocalVariableRetrieval(path);
  if (pathForLocalVariableRetrieval == null) {
    checker.report(Result.failure("lock.expression.possibly.not.final",guardedByValue),tree);
    return;
  }
  for (  String lockExpression : guardedByValue) {
    try {
      parseExpressionString(lockExpression,flowExprContext,pathForLocalVariableRetrieval,null,tree,true);
    }
 catch (    FlowExpressionParseException e) {
      checker.report(e.getResult(),tree);
    }
  }
}

private void checkLockExpressionInGuardedByAnnotation ( AnnotationTree tree , AnnotationMirror guardedByAnnotation ) { List < String > guardedByValue = AnnotationUtils . getElementValueArray ( guardedByAnnotation , "value" , String . class , true ) ; if ( guardedByValue . isEmpty ( ) ) { return ; } TreePath path = getCurrentPath ( ) ; MethodTree enclMethod = TreeUtils . enclosingMethod ( path ) ; FlowExpressionContext flowExprContext ; if ( enclMethod != null ) { flowExprContext = FlowExpressionContext . buildContextForMethodDeclaration ( enclMethod , path , checker . getContext ( ) ) ; } else { ClassTree enclosingClass = TreeUtils . enclosingClass ( path ) ; flowExprContext = FlowExpressionContext . buildContextForClassDeclaration ( enclosingClass , checker . getContext ( ) ) ; } if ( flowExprContext == null ) { checker . report ( Result . failure ( "lock.expression.possibly.not.final" , guardedByValue ) , tree ) ; return ; } TreePath pathForLocalVariableRetrieval = getPathForLocalVariableRetrieval ( path ) ; if ( pathForLocalVariableRetrieval == null ) { checker . report ( Result . failure ( "lock.expression.possibly.not.final" , guardedByValue ) , tree ) ; return ; } for ( String lockExpression : guardedByValue ) { try { parseExpressionString ( lockExpression , flowExprContext , pathForLocalVariableRetrieval , null , tree , true ) ; } catch ( FlowExpressionParseException e ) { checker . report ( e . getResult ( ) , tree ) ; } } }
check that the lock expression in a guardedby annotation is a valid flow expression and is effectively final
