Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » The type package-info is already defined
The type package-info is already defined [message #1753247] Thu, 02 February 2017 23:43 Go to next message
Ahmed Ashour is currently offline Ahmed AshourFriend
Messages: 4
Registered: July 2009
Junior Member
Hi all,

With a maven project, where we have /src/main and /src/test folders, putting 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 gives:

warning: a 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.

[Updated on: Thu, 02 February 2017 23:52]

Report message to a moderator

Re: The type package-info is already defined [message #1753326 is a reply to message #1753247] Fri, 03 February 2017 21:05 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
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.
Previous Topic:Just a question
Next Topic:RCP Framework can't list serial port
Goto Forum:

Current Time: Sun Apr 14 02:39:50 GMT 2024

Powered by FUDForum. Page generated in 0.09760 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top