来自命令行的 Lint4J 给出 NullPointerException

Lint4J from command line gives NullPointerException

我正在尝试从 mac 上的命令行启动 Lint4J (0.9.1)。我想 运行 对其进行小测试 class。但不幸的是,我总是得到一个空指针异常。 我有 JDK 1.8.0

我的测试class:

package ch.ntb.sir.testmain;
public class TestMain {}

我已经从官网下载了lint4j包。它与测试 class.

不在同一个文件夹中

这是我执行的命令:

/Users/.../lib/lint4j-0.9.1/bin/lint4j -sourcepath /Users/.../ClassToCheck/src ch.ntb.sir.testmain

我从我测试的项目文件夹中的终端执行它 class。

我得到的输出:

Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
at lint4j.aZ.a(Unknown Source)
at lint4j.aZ.a(Unknown Source)
at lint4j.fx.b(Unknown Source)
at lint4j.fx.b(Unknown Source)
at lint4j.fx.b(Unknown Source)
at lint4j.fx.a(Unknown Source)
at lint4j.aw.c(Unknown Source)
at lint4j.aw.e(Unknown Source)
at lint4j.ai.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.dq.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.eO.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.by.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.dP.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.dI.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.ap.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at com.jutils.lint4j.Lint4j.initialize(Unknown Source)
at com.jutils.lint4j.Lint4j.execute(Unknown Source)
at com.jutils.lint4j.cmdline.Main.main(Unknown Source)
Caused by: java.lang.NullPointerException
at lint4j.q.a(Unknown Source)
... 25 more

我在这些网站上找不到对我有帮助的东西:

http://www.jutils.com/uguide.html

http://www.jutils.com/auditingcode.html

并且在 lint4j.pdf 中也没有任何帮助

欢迎所有提示!感谢您的帮助。

我了解到,Lint4J 是一个 "dead" 项目。最后更新于 2007 年

Static Analysis tool recommendation for Java?

https://github.com/checkstyle/checkstyle/wiki/Java-static-code-analysis-tools

所以将它用于新项目是个坏主意。

我会尝试:FindBugs、Checkstyle、PMD,...他们的最后一次更新是在 2015-2016 年间