Java Eclipse 中的 Checkstyle 错误 - 无法实例化 Tab 字符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1212109/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:57:46  来源:igfitidea点击:

Checkstyle Error in Eclipse - Could not instantiate Tab character

javaeclipsecheckstyle

提问by Stefan Thyberg

Got this error today while trying to build a project with checkstyle. This works for other people in my office but I would rather not reinstall Eclipse yet again. Any idea what this error actually means?

今天在尝试使用 checkstyle 构建项目时遇到此错误。这适用于我办公室的其他人,但我宁愿不再重新安装 Eclipse。知道这个错误实际上意味着什么吗?

Errors occurred during the build.
 Errors running builder 'Checkstyle Builder' on project 'myproject'.
  cannot initialize module TreeWalker - Unable to instantiate TabCharacter
  cannot initialize module TreeWalker - Unable to instantiate TabCharacter
 cannot initialize module TreeWalker - Unable to instantiate TabCharacter
 cannot initialize module TreeWalker - Unable to instantiate TabCharacter

I'm gathering that it has something to do with the tab character but not much else.

我正在收集它与制表符有关,但与其他无关。

UPDATE: Version of Eclipse is 3.5, Checkstyle is 5.0.0.200906281855-final.

更新:Eclipse 版本为 3.5,Checkstyle 为 5.0.0.200906281855-final。

(Java is jdk 1.6.0_10)

(Java 是 jdk 1.6.0_10)

采纳答案by VonC

As mentioned in this bug, Checkstyle Plugin version 5.0.0.200906281855:

正如这个 bug 中提到的,Checkstyle 插件版本 5.0.0.200906281855:

Release notes of Checkstyle 5state that some of the modules and checks we are using are not backwards compatible.
E.g. the module TabCharacterdoes not occur in v5 any more(was replaced by FileTabCharacter), hence can't work.
The check FileLengthdoes not require a syntax tree, hence is not any longer under parent TreeWalker.

Checkstyle 5 的发行说明指出,我们使用的某些模块和检查不向后兼容。
例如,该模块TabCharacter不再出现在 v5 中(被替换为FileTabCharacter),因此无法工作。
检查FileLength不需要语法树,因此不再在 parent 下TreeWalker

That means your issue could be with an automatic update of the Checkstyle plugin in your eclipse configuration.

这意味着您的问题可能与 eclipse 配置中 Checkstyle 插件的自动更新有关。

回答by childno?.de

"Same" problem will occur, if you use a checkstyle configuration with self defined cs plugin classes and your plugin.jar is not in your eclipse/plugin path.

如果您使用带有自定义 cs 插件类的 checkstyle 配置并且您的 plugin.jar 不在您的 eclipse/plugin 路径中,则会出现“相同”问题。

So in this case error will just say: Hey dude: can't find your classes, please give it to me ;)

所以在这种情况下,错误只会说:嘿伙计:找不到你的课程,请给我;)