Unsupported Type as a return type or field is not recoagnized (mojo)
LZaruba opened this issue · 3 comments
LZaruba commented
Hi,
following example passes java17
check:
public class IllegalTypeReturn {
public LocalDateTime localDateTime() {
return null;
}
}
The return statement gets examined, but it is ignored due to the Mojo adding all classes to ignoredPackages. The return type of the method signature is not checked at all.
Similarily following code passes the check for java17
:
public class IllegalFieldSample {
private String stringField;
private LocalDateTime localDateTimeField;
}
Fields are not examined at all, and while there is no manipulation (calls) to the fields, it passes.
I will attach a pull request with a proposed solution to both of the issues shortly.
LZaruba commented
Hi, the test build of the PR fails on following part that as far as I am aware is not releated to the PR itself. Is there anything I can do about it? Thanks
INFO] [INFO] --- animal-sniffer-maven-plugin:1.19-SNAPSHOT:check (default) @ real-test ---
[INFO] [INFO] Checking unresolved references to org.codehaus.mojo.signature:java14:1.0
[INFO] [ERROR] /home/travis/build/mojohaus/animal-sniffer/animal-sniffer-maven-plugin/target/it/manimalsniffer-41/src/main/java/localhost/Bad.java:15: Undefined reference: java.util.concurrent.Callable
[INFO] [ERROR] /home/travis/build/mojohaus/animal-sniffer/animal-sniffer-maven-plugin/target/it/manimalsniffer-41/src/main/java/localhost/Bad.java:15: Undefined reference: java.util.concurrent.Callable java.util.concurrent.Executors.callable(Runnable)
[INFO] [ERROR] /home/travis/build/mojohaus/animal-sniffer/animal-sniffer-maven-plugin/target/it/manimalsniffer-41/src/main/java/localhost/Bad.java:15: Undefined reference: Object java.util.concurrent.Callable.call()
[INFO] [ERROR] /home/travis/build/mojohaus/animal-sniffer/animal-sniffer-maven-plugin/target/it/manimalsniffer-41/src/main/java/localhost/Bad.java:9: Undefined reference: void java.util.concurrent.DelayQueue.<init>()
[INFO] [ERROR] /home/travis/build/mojohaus/animal-sniffer/animal-sniffer-maven-plugin/target/it/manimalsniffer-41/src/main/java/localhost/Bad.java:11: Undefined reference: boolean java.util.concurrent.ScheduledFuture.isCancelled()
[INFO] [ERROR] /home/travis/build/mojohaus/animal-sniffer/animal-sniffer-maven-plugin/target/it/manimalsniffer-41/src/main/java/localhost/Bad.java:9: Undefined reference: java.util.concurrent.ScheduledFuture
[INFO] [ERROR] /home/travis/build/mojohaus/animal-sniffer/animal-sniffer-maven-plugin/target/it/manimalsniffer-41/src/main/java/localhost/Bad.java:9: Undefined reference: java.util.concurrent.ScheduledFuture
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 3.108 s
[INFO] [INFO] Finished at: 2019-10-15T14:47:31Z
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.19-SNAPSHOT:check (default) on project real-test: Signature errors found. Verify them and ignore them with the proper annotation if needed. -> [Help 1]
[INFO] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.19-SNAPSHOT:check (default) on project real-test: Signature errors found. Verify them and ignore them with the proper annotation if needed.
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
LZaruba commented
I've fixed the build, and it is now ready for review and merge.
olamy commented
pr merged thanks!