【问题标题】:eclipse checkstyle error cannot initialize module TreeWalker - TreeWalker is not allowed as a parent of FileLengtheclipse checkstyle 错误无法初始化模块 TreeWalker - TreeWalker 不允许作为 FileLength 的父级
【发布时间】:2013-06-24 22:43:20
【问题描述】:

当我尝试加载用户定义的检查样式模板时出现以下错误。

cannot initialize module TreeWalker - TreeWalker is not allowed as a parent of FileLength

我认为这可能是由于我的 Eclipse 中的 checkstyle 版本不兼容。 如何使用 checkstyle xml 文件找到合适的 checkstyle 版本

【问题讨论】:

    标签: java eclipse eclipse-plugin checkstyle


    【解决方案1】:

    这是模板中的错误,与 Checkstyle 版本无关。 FileLength 直接在Checker 之下,而不是在TreeWalker 之下。

    例子:

    <module name="Checker">
        <property name="severity" value="warning"/>
        <module name="TreeWalker">
            <property name="tabWidth" value="4"/>
            <module name="JavadocType"/>
            <!-- many others -->
        </module>
        <module name="NewlineAtEndOfFile"/>
        <module name="FileLength"/>
        <module name="JavadocPackage"/>
        <!-- others -->
    </module>
    

    【讨论】:

    • 我不知道您在 2013 年是如何正确回答这个问题的,因为 Checkstyle 在 September 1, 2019 的发行说明中将其作为一项重大更改引入。无论如何,谢谢!
    • 该死,我在穿越时非常注意不要改变过去! @noumenon
    • 或者可能是 FileLength,而不是 LineLength ... ? @noumenon
    • 好吧,感谢 Google 在我搜索 LineLength 时让我如此接近。这有帮助!
    猜你喜欢
    • 1970-01-01
    • 2015-05-17
    • 1970-01-01
    • 2015-05-22
    • 1970-01-01
    • 1970-01-01
    • 2014-08-25
    • 2018-09-11
    • 1970-01-01
    相关资源
    最近更新 更多