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.
|Summary:||Compile on Save utility class to work with bytecode without running it|
|Product:||java||Reporter:||Jesse Glick <jglick>|
|Component:||Source||Assignee:||Svata Dedic <sdedic>|
|Issue Type:||ENHANCEMENT||Exception Reporter:|
Description Jesse Glick 2009-12-08 19:54:24 UTC
BuildArtifactMapper has some capabilities which could be useful for CoS if all you need to do is run the code using JavaRunner. However if you are interested in doing something else with the code, such as static analysis (*), BAM cannot be used reliably: 1. It will not work if the project does not have CoS enabled, even though the IDE still maintains internal bytecode in this case. 2. It does not work if the project is not currently synchronized, according to details of when a full build was last run and so on. We need something that will give you reliable access to an up-to-date copy of the Java indexer cache (with *.sig translated to *.class) for any source root. For SQE, I have a prototype which calls into java.source using reflection and accomplishes this: https://hg.kenai.com/hg/sqe~trunk/raw-file/nb68/core.java/src/org/nbheaven/sqe/core/java/utils/CompileOnSaveHelper.java It only deals with one classpath entry at a time, which I think is OK (but we could consider passing in an entire ClassPath object). You can either pass a source root, or a (binary) classpath entry which will be matched to a source root if appropriate (preferSources). You get back a usable Java classpath entry; this could be the public output directory, if both #1 and #2 above in fact hold; otherwise it will be a copy of the indexer cache. Currently there is no event firing support (such as ArtifactsUpdated), since FileUtil.addRecursiveListener does not work on indexer cache, but of course if this were implemented in java.source the problem would be solved since BuildArtifactMapperImpl.classCacheUpdated would notify the appropriate listeners directly. (*) E.g.: http://kenai.com/jira/browse/SQE-9