The type package-info is already defined [message #1753247] |
Thu, 02 February 2017 18:43  |
Eclipse User |
|
|
|
Hi all,
With a maven project, where we have /src/main and /src/test folders, putting package-info.java in the same package name in those two folders, makes JDT complains "The type package-info is already defined".
Testing this with javac, with two folders having the same package-info.java gives:
warning: a package-info.java file has already been seen for package unnamed package
But there is no compiler error.
As far as I understand, this special file is not compiled.
Also, as you know, maven javadoc generates two output, one for'main' and another for 'test' folders, and if JDT restricts to only one, then there is no way to define package javadoc except by going to package.html which is outdated.
I hesitated before posting a bug, since many people complain on the internet, and I don't know why don't JDT just ignores that file or even gives a warning, but not a compiler error.
Thanks for your input.
Ahmed
[Updated on: Thu, 02 February 2017 18:52] by Moderator
|
|
|
Re: The type package-info is already defined [message #1753326 is a reply to message #1753247] |
Fri, 03 February 2017 16:05  |
Eclipse User |
|
|
|
Quote:As far as I understand, this special file is not compiled.
This is wrong. Compilers do create package-info.class. And in case you wonder why this would be relevant: this is the location where annotations on a package are written. If there are two competing files, then this is just as wrong as defining two classes of the same name.
OTOH, everything that JLS says about package-info starts with "The following scheme is strongly recommended for file-system-based implementations...". There are no definite requirements, handling of this file is thus at the discretion of any implementation.
|
|
|
Powered by
FUDForum. Page generated in 1.03407 seconds