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

Summary: Warn of duplicate Classes in Classpath
Product: java Reporter: bht <bht>
Component: ClasspathAssignee: Tomas Zezula <tzezula>
Status: NEW ---    
Severity: blocker    
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

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.