Source:
public ProgramState checkPostStatement(CheckerContext context, Tree syntaxNode) { ProgramState programState = context.getState(); if (syntaxNode.is(Tree.Kind.NEW_CLASS)) { NewClassTree newClassTree = (NewClassTree) syntaxNode; if (newClassTree.symbolType().is("java.io.FileOutputStream") && newClassTree.arguments().size() == 2) { ProgramState psBeforeInvocation = context.getNode().programState; BooleanConstraint argConstraint = psBeforeInvocation.getConstraint(psBeforeInvocation.peekValue(), BooleanConstraint.class); if (argConstraint == BooleanConstraint.TRUE) { programState = programState.addConstraint(programState.peekValue(), FileOutputStreamConstraint.APPEND); } } } else if (syntaxNode.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree mit = (MethodInvocationTree) syntaxNode; if (FILES_NEW_OUTPUT_STREAM.matches(mit)) { ProgramState psBeforeInvocation = context.getNode().programState; int optionsNumber = mit.arguments().size() - 1 ; for (int i = 0; i < optionsNumber; i++) { FileOutputStreamConstraint argConstraint = psBeforeInvocation.getConstraint(psBeforeInvocation.peekValue(i), FileOutputStreamConstraint.class); if (argConstraint == FileOutputStreamConstraint.APPEND) { programState = programState.addConstraint(programState.peekValue(), FileOutputStreamConstraint.APPEND); } } } } else if (syntaxNode.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree member = (MemberSelectExpressionTree) syntaxNode; if (member.symbolType().is("java.nio.file.StandardOpenOption") && "APPEND".equals(member.identifier().name())) { programState = programState.addConstraint(programState.peekValue(), FileOutputStreamConstraint.APPEND); } } return programState; }

Target:
public ProgramState checkPostStatement(CheckerContext context, Tree syntaxNode) { ProgramState programState = context.getState(); switch (syntaxNode.kind()) { case NEW_CLASS: NewClassTree newClassTree = (NewClassTree) syntaxNode; if (newClassTree.symbolType().is("java.io.FileOutputStream") && newClassTree.arguments().size() == 2) { ProgramState psBeforeInvocation = context.getNode().programState; BooleanConstraint argConstraint = psBeforeInvocation.getConstraint(psBeforeInvocation.peekValue(), BooleanConstraint.class); if (argConstraint == BooleanConstraint.TRUE) { programState = programState.addConstraint(programState.peekValue(), new FileOutputStreamAppendConstraint(newClassTree)); } } break; case METHOD_INVOCATION: MethodInvocationTree mit = (MethodInvocationTree) syntaxNode; if (FILES_NEW_OUTPUT_STREAM.matches(mit)) { ProgramState psBeforeInvocation = context.getNode().programState; int optionsNumber = mit.arguments().size() - 1; for (int i = 0; i < optionsNumber; i++) { FileOutputStreamAppendConstraint argConstraint = psBeforeInvocation.getConstraint(psBeforeInvocation.peekValue(i), FileOutputStreamAppendConstraint.class); if (argConstraint != null) { programState = programState.addConstraint(programState.peekValue(), new FileOutputStreamAppendConstraint(mit)); break; } } } break; case MEMBER_SELECT: programState = handleOpenOptionAppend(programState, ((MemberSelectExpressionTree) syntaxNode).identifier()); break; case IDENTIFIER: programState = handleOpenOptionAppend(programState, (IdentifierTree) syntaxNode); break; } return programState; }