False positive: return in finally block #269

Closed
romani opened this Issue Nov 6, 2014 · 0 comments

Projects

None yet

2 participants

@romani
Member
romani commented Nov 6, 2014

Warning: "Forbid return statement in finally block: Finally block should not contain return statements."

https://github.com/sevntu-checkstyle/sevntu.checkstyle/blob/master/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinalBlockCheck.java

    public void test() {
        try {
                         /// some code
        } finally { 
            // remove test data
            csf.doIn(new Callback<Void>() {
                @Override
                public Void execute(ISession session) {
                    session.delete(this);
                    return null;  // WARNING !!!!!!
                }
            }, "");
        }
    }

it is also required to rename Check, as block is "finally" not a "final"

@Andrew0701 Andrew0701 was assigned by romani Dec 24, 2014
@Andrew0701 Andrew0701 pushed a commit to Andrew0701/sevntu.checkstyle that referenced this issue Jan 3, 2015
Andrew Uljanenko Fixed false positive in check ForbidReturnInFinallyBlockChech. Fixes #… c3f8e73
@Andrew0701 Andrew0701 pushed a commit to Andrew0701/sevntu.checkstyle that referenced this issue Jan 9, 2015
Andrew Uljanenko Fixed false positive in check ForbidReturnInFinallyBlockChech. Fixes #… 3bec89e
@Andrew0701 Andrew0701 pushed a commit to Andrew0701/sevntu.checkstyle that referenced this issue Jan 9, 2015
Andrew Uljanenko Fixed false positive in check ForbidReturnInFinallyBlockChech. Fixes #… 0e377a7
@Andrew0701 Andrew0701 pushed a commit to Andrew0701/sevntu.checkstyle that referenced this issue Jan 12, 2015
Andrew Uljanenko Fixed false positive in check ForbidReturnInFinallyBlockChech. Fixes #… 01541b8
@Andrew0701 Andrew0701 pushed a commit to Andrew0701/sevntu.checkstyle that referenced this issue Jan 12, 2015
Andrew Uljanenko Fixed false positive in check ForbidReturnInFinallyBlockChech. Fixes #… 2aa7285
@Andrew0701 Andrew0701 pushed a commit to Andrew0701/sevntu.checkstyle that referenced this issue Jan 14, 2015
Andrew Uljanenko Fixed false positive in check ForbidReturnInFinallyBlockChech. Fixes #… 1d5ebd4
@romani romani closed this in 5f9164c Jan 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment