Javadoc warning - bad source file: file does not contain class com.example.MyClass
NickName:John Ask DateTime:2018-05-10T00:10:21

Javadoc warning - bad source file: file does not contain class com.example.MyClass

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

Copyright Notice:Content Author:「John」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50257769/javadoc-warning-bad-source-file-file-does-not-contain-class-com-example-mycla

More about “Javadoc warning - bad source file: file does not contain class com.example.MyClass” related questions

Javadoc warning - bad source file: file does not contain class com.example.MyClass

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 genera...

Show Detail

Java Error: bad source file: file does not contain class

The directory of QueryFeatureExtract.java is like gen-java/ └── query_feature └── QueryFeatureExtract.java and the java file ThriftClient.java which use QueryFeatureExtract is in the

Show Detail

Programatically run the javadoc command on entire package gives javadoc: warning - No source files for package

I was able to run it against a single Java file with the following code. Main.execute(new String[]{"-doclet", "com.prime.ListTags", "-docletpath" , "." , "./src/com/prim

Show Detail

Java error - bad source file: file does not contain class x . Please remove or make sure it appears

Recently started studying Java for an exam. While learning packages, tried this and got an error message. What I did was //Creating class A (Within package the package: com.test.helpers) pack...

Show Detail

Java error - bad source file: file does not contain class x . Please remove or make sure it appears

Recently started studying Java for an exam. While learning packages, tried this and got an error message. What I did was //Creating class A (Within package the package: com.test.helpers) pack...

Show Detail

Why does IntelliJ IDEA give a warning that this file javadoc is dangling?

I'm using IntelliJ IDEA and I tried to add a Javadoc comment at the top of the file like this: /** * @file ProcessJson.java * @author Tim Sloane * @date 2017-05-09 */ But IntelliJ gives me the

Show Detail

Error in creating Javadoc

I am using NetBeans ID 8.0.1 to generate a javadoc, but whenever i try to create javadoc following error occurs: Constructing Javadoc information... 1 error D:\EFConnect\libs\activemq-all-5.9.1.ja...

Show Detail

the source attachment does not contain the source for the file Thread.class

error image i am getting this error while running my anylogic application therefore not able to run the application "The source attachment does not contain the source for the file Throwables.c...

Show Detail

Source attachment does not contain the source for the file drivermanager.class

I am trying to connect to DB using JDBC My code :- public static Connection getConnection() { String dbName = "test"; String userName = "test"; String password = "";&#x

Show Detail

java package does not exist and bad source file

So I made a folder called util and placed four classes along with program named unit10Assignment in it. I created a package util and typed " package util; " at the top of each one of the classes code

Show Detail