This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 168445 - Warn of duplicate Classes in Classpath
Summary: Warn of duplicate Classes in Classpath
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Classpath (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-12 02:22 UTC by bht
Modified: 2012-01-11 09:15 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2009-07-12 02:22:46 UTC
It happens that multiply libraries/jars that are attached to a project classpath contain class files with the same
package and class names (duplicates). The order in which these appear in the list determines which of the duplicates are
used and which are ignored.

The developer MAY be aware of duplicates and may control them by ordering classpath entries, but usually duplicates are
not recognized and act like dangerous traps.

I am aware of a native compiler that warns of duplicates (JET) and there may be others. It would be very valuable if the
IDE could warn the developer by default of such duplicates in the build process.

It could be argued that this could be carried out by an optional process such as validation, but I would prefer the
check to be always on, mandatory, or optional and on by default.
Comment 1 bht 2012-01-11 03:13:40 UTC
Would it be possible to evaluate this?

I just discovered that it is not possible to deploy duplicate classes on Android, while the Eclipse IDE does not emit any warnings before it is too late.
Comment 2 Tomas Zezula 2012-01-11 09:15:44 UTC
The check will be probably better in time when you add a jar with duplicate on CP, not to slow down the build. The IDE will need to list at least packages of all jars and if there are the same packages in more jars it needs to list files in these packages.