We started getting this error on our tests a week ago. It was turned on and off - sometimes people get it, and in other cases they won't.
/.../product/integration/src/test/java/com/acme/integration/code/CodeTestUtils.java:74: error: invalid use of @throws
* @throws Exception if an error occurs.
I think the error message is a bit vague. Wrong? The code looks good to me:
public static void checkProject(String subPath, DirectoryStream.Filter<Path> filter, CheckFile checkFile) throws Exception
{
for (Path file : listFiles(EnvironmentUtils.getDevelopmentRoot().toPath()))
{
if (FileUtils.isDirectory(file) && FileUtils.exists(file.resolve("src/java")))
{
checkModule(file, subPath, filter, checkFile);
}
}
}
We enable doclint at compile time because we want to find out about Javadoc errors without having to run Javadoc separately.
What exactly should this error mean? Is there anything invalid about what we are doing here? Are we looking at a compiler error? Of course, an error like this will hit the first person who tried to declare that the method throws an exception ... :(
The study is still ...
- , . , Travis CI Linux, macOS, ( , !), Windows .
- Gradle, javac , javac.
javac :
javac -source 1.8 -target 1.8 -d build/classes/test \
-classpath build/classes/main:build/resources/main:$HOME/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.8.2/979fc0cf8460302e4ffbfe38c1b66a99450b0bb7/log4j-core-2.8.2.jar:$HOME/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.8.2/e590eeb783348ce8ddef205b82127f9084d82bf3/log4j-api-2.8.2.jar \
-Xdoclint:all,-missing \
src/test/java/com/acme/CodeTestUtils.java
, Gradle . (Gradle -processorpath -g .)