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.
The query for getting the compiler output from sources in missing. Modules like aspectj, maven, java/source which need to do it in complicated way. They need to take ClassPath.EXECUTE iterate through it,use SourceForBinaryQuery to find the source roots and compare it with ClassPath.SOURCE. The new API introduces new BinaryForSourceQuery (API) and BinaryForSourceQueryImplementation (SPI) which return the output root(s) for source root. The behavior is very similar to SourceForBinaryQuery. The only difference is that the BinaryForSourceQuery.Result.getRoots() returns URLs rather than FileObjects since the output folder may not yet exist. When user calls BinaryForSourceQuery.findBinaryRoos(url) the API looks into global lookup to find all impls of BinaryForSourceQueryImplementation and delegates to them. If no answer is found it returns a default implementation which tries to find the binary root using the ClassPath.EXECUTE mechanism. The patch contains API,SPI, default project implementation of BFSQImp which delegates to BFSQImpl found in project's lookup and implementation of BFSQImpl for j2seproject. Both the j2seproject's BFSQImpl and the BFSQ.DefaultResult are covered by unit tests.
Created attachment 37907 [details] Patch file
The API should be stable in NetBeans 6.0
looks good to me.
Created attachment 38231 [details] Diff of apichanges.xml
I am going to integrate it tomorrow.
Javadoc should explain that this is intended to be the inverse of SourceForBinaryQuery. There is no particular reason to keep a Lookup.Result object statically if you are not listening to it anyway. Simpler to just use for (BinaryForSourceQueryImplementation impl : Lookup.getDefault().lookupAll(BinaryForSourceQueryImplementation.class)) 'static' on an interface is meaningless, as is 'public' on an interface method. Get rid of Lkp in the test and use MockServices. You should add an entry to the Javadoc of Project.getLookup, as well as to java/project/overview.html.
I've fixed all the Jesse's comments.
Checking in manifest.mf; /cvs/java/api/manifest.mf,v <-- manifest.mf new revision: 1.17; previous revision: 1.16 done Checking in doc/changes/apichanges.xml; /cvs/java/api/doc/changes/apichanges.xml,v <-- apichanges.xml new revision: 1.14; previous revision: 1.13 done RCS file: /cvs/java/api/src/org/netbeans/api/java/queries/BinaryForSourceQuery.java,v done Checking in src/org/netbeans/api/java/queries/BinaryForSourceQuery.java; /cvs/java/api/src/org/netbeans/api/java/queries/BinaryForSourceQuery.java,v <-- BinaryForSourceQuery.java initial revision: 1.1 done RCS file: /cvs/java/api/src/org/netbeans/spi/java/queries/BinaryForSourceQueryImplementation.java,v done Checking in src/org/netbeans/spi/java/queries/BinaryForSourceQueryImplementation.java; /cvs/java/api/src/org/netbeans/spi/java/queries/BinaryForSourceQueryImplementation.java,v <-- BinaryForSourceQueryImplementation.java initial revision: 1.1 done RCS file: /cvs/java/api/test/unit/src/org/netbeans/api/java/queries/BinaryForSourceQueryTest.java,v done Checking in test/unit/src/org/netbeans/api/java/queries/BinaryForSourceQueryTest.java; /cvs/java/api/test/unit/src/org/netbeans/api/java/queries/BinaryForSourceQueryTest.java,v <-- BinaryForSourceQueryTest.java initial revision: 1.1 done Checking in overview.html; /cvs/java/project/overview.html,v <-- overview.html new revision: 1.6; previous revision: 1.5 done RCS file: /cvs/java/project/src/META-INF/services/org.netbeans.spi.java.queries.BinaryForSourceQueryImplementation,v done Checking in src/META-INF/services/org.netbeans.spi.java.queries.BinaryForSourceQueryImplementation; /cvs/java/project/src/META-INF/services/org.netbeans.spi.java.queries.BinaryForSourceQueryImplementation,v <-- org.netbeans.spi.java.queries.BinaryForSourceQueryImplementation initial revision: 1.1 done RCS file: /cvs/java/project/src/org/netbeans/modules/java/project/ProjectBinaryForSourceQuery.java,v done Checking in src/org/netbeans/modules/java/project/ProjectBinaryForSourceQuery.java; /cvs/java/project/src/org/netbeans/modules/java/project/ProjectBinaryForSourceQuery.java,v <-- ProjectBinaryForSourceQuery.java initial revision: 1.1 done Checking in src/org/netbeans/modules/java/j2seproject/J2SEProject.java; /cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java,v <-- J2SEProject.java new revision: 1.73; previous revision: 1.72 done RCS file: /cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/queries/BinaryForSourceQueryImpl.java,v done Checking in src/org/netbeans/modules/java/j2seproject/queries/BinaryForSourceQueryImpl.java; /cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/queries/BinaryForSourceQueryImpl.java,v <-- BinaryForSourceQueryImpl.java initial revision: 1.1 done RCS file: /cvs/java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/queries/BinaryForSourceQueryImplTest.java,v done Checking in test/unit/src/org/netbeans/modules/java/j2seproject/queries/BinaryForSourceQueryImplTest.java; /cvs/java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/queries/BinaryForSourceQueryImplTest.java,v <-- BinaryForSourceQueryImplTest.java initial revision: 1.1 done Checking in projectapi/src/org/netbeans/api/project/Project.java; /cvs/projects/projectapi/src/org/netbeans/api/project/Project.java,v <-- Project.java new revision: 1.17; previous revision: 1.16 done