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 71675 - Verify class linkage during module build
Summary: Verify class linkage during module build
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Harness (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-20 17:14 UTC by Jesse Glick
Modified: 2006-01-30 00:37 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 Jesse Glick 2006-01-20 17:14:38 UTC
Three RFEs implemented for 5.0u1 help detect misuse of public packages or
unavailable modules when compiling sources. However this leaves open problems
with misconfiguration of lib wrapper modules. It is common for people to create
several lib wrapper modules whose JARs need to refer to one another, but forget
that they need to set up module dependencies for these wrapper JARs too.

Some build target included in 'netbeans' should verify linkage of class files.
Could try to actually load the classes, as netbeans.preresolve.classes=true
does; but this might too slow or unreliable in the face of static initializers,
so an alternate approach would be to examine the constant pool for class
references and look for any that are missing.

Ant syntax should be roughly

<verifyclasses jar="${cluster}/${module.jar}" failonerror="false"
warnondefaultpackage="true" verifymainjar="false" verifyclasspathextensions="true">
  <path refid="cp"/>
</verifyclasses>

and could play with settings to give useful enough diagnostics without adding
too much time to the build.
Comment 1 Jesse Glick 2006-01-29 23:34:35 UTC
Implemented. Scanning the constant pool for class constants is actually not too
difficult and pretty fast. Seems to work well: tried to make a suite with one
lib wrapper per JAR for a bunch of the JARs in Maven 1.0's lib directory.
Warnings revealed exactly which deps were missing. Can just take a warning like

Warning: class org.apache.commons.first.Whatever refers to nonexistent class
org.apache.commons.second.Whatever

copy the second class name, right-click the the commons-first Libraries node,
click Add Dep..., paste into filter field, and press Enter, and you have the dep
commons-first -> commons-second set up correctly.
Comment 2 Jesse Glick 2006-01-30 00:37:51 UTC
committed   * Up-To-Date  1.7         apisupport/harness/taskdefs.properties
committed   * Up-To-Date  1.14       
apisupport/harness/nbproject/project.properties
committed   * Up-To-Date  1.39        apisupport/harness/release/README
committed   * Up-To-Date  1.22        nbbuild/default.xml
added       * Up-To-Date  1.1        
nbbuild/antsrc/org/netbeans/nbbuild/VerifyClassLinkage.java
committed   * Up-To-Date  1.34        nbbuild/templates/common.xml