2

I have a file called MyFile.java and it contains multiple classes(none of them is public). Note that the file does not contain MyFile class. Apparently Javadoc is not happy about this and it generates a warning saying file does not contain class com.example.MyClass. A few solutions I looked into:

  1. Move classes into their own files. This looks like the proper way of fixing the warnings, but the new files won't obliviously have the source control history, so I am trying to avoid it.
  2. Create empty MyFile class. This is ugly.
  3. Hide Javadoc warnings, preferably per file. There is a high chance that this is not possible.

A few questions that I have:

  1. Why does Javadoc complain? I couldn't find any documentation, please point me to one. I think it is perfectly fine not to have a class with the same name as the file.
  2. Any other suggestions I can look into?
  3. Is it possible to hide warnings somehow? additionalparam="-Xdoclint:none" does not work.

Thank you all in advance

John
  • 21
  • 3

1 Answers1

0

When building with maven from the command line, I encountered this error from maven-javadoc-plugin.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.2.0:jar (default) on project code-mapping-database: MavenReportException: Error while generating Javadoc:
... error: cannot access DataSourceWrapper

Eclipse IDE reported a similar error.

This occurred after I had copied DataSourceWrapper.java to another (dependent) project and commented out all lines of DataSourceWrapper.java in the original project. After deleting the commented out version, the error went away. The effectively empty DataSourceWrapper.java file must have caused maven-javadoc-plugin to stop looking for class DataSourceWrapper.

ansonator
  • 11
  • 4