Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RedundantReturn: false negative in lambda #700

Open
rnveach opened this issue Jun 12, 2018 · 0 comments
Open

RedundantReturn: false negative in lambda #700

rnveach opened this issue Jun 12, 2018 · 0 comments
Labels

Comments

@rnveach
Copy link
Contributor

rnveach commented Jun 12, 2018

Talked about in #686

ATTENTION: If there are some child token under RETURN that is not semi - it is not redundant RETURN.
such condition should be in Check code.

$ cat TestClass.java
public class TestClass {
    public interface Something {
        void action();
    }

    public static void main(String args[]) {
        Something l = () -> {
            System.out.println("Do nothing!");
            return;
        };
        l.action();
    }
}

$ cat TestConfig.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<module name="Checker">
    <property name="charset" value="UTF-8"/>

    <module name="TreeWalker">
<module name="com.github.sevntu.checkstyle.checks.coding.RedundantReturnCheck"/>
    </module>
</module>

$ java -jar checkstyle-8.9-sevntu-1.29.0-all.jar -c TestConfig.xml TestClass.java
Starting audit...
Audit done.

Expecting a violation on line 9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants