class PersistentCookieDetector extends OpcodeStackDetector {

    private BugReporter bugReporter;

    public PersistentCookieDetector(BugReporter bugReporter) {
        this.bugReporter = bugReporter;
    }

    @Override
    public void sawOpcode(int seen) {<FILL_FUNCTION_BODY>}
}


        if (seen == Const.INVOKEVIRTUAL && getClassConstantOperand().equals("javax/servlet/http/Cookie")
                && getNameConstantOperand().equals("setMaxAge")) {

            Object maxAge = stack.getStackItem(0).getConstant();
            Integer n = (maxAge instanceof Integer) ? (Integer)maxAge : 0;

            //Max age equal or greater than one year
            if (n >= 31536000) {
                bugReporter.reportBug(new BugInstance(this, "COOKIE_PERSISTENT", Priorities.NORMAL_PRIORITY) //
                        .addClass(this).addMethod(this).addSourceLine(this));
            }
        }
    
<no_super_class>