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 93767 - API review: Query for compiler output from sources is missing
Summary: API review: Query for compiler output from sources is missing
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 71986 94839
  Show dependency tree
 
Reported: 2007-02-01 08:52 UTC by Tomas Zezula
Modified: 2007-02-09 10:55 UTC (History)
1 user (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Patch file (31.19 KB, patch)
2007-02-01 08:54 UTC, Tomas Zezula
Details | Diff
Diff of apichanges.xml (1.63 KB, application/octet-stream)
2007-02-08 12:22 UTC, Tomas Zezula
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2007-02-01 08:52:42 UTC
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.
Comment 1 Tomas Zezula 2007-02-01 08:54:36 UTC
Created attachment 37907 [details]
Patch file
Comment 2 Tomas Zezula 2007-02-01 08:58:17 UTC
The API should be stable in NetBeans 6.0
Comment 3 Milos Kleint 2007-02-07 13:20:27 UTC
looks good to me.
Comment 4 Tomas Zezula 2007-02-08 12:22:09 UTC
Created attachment 38231 [details]
Diff of apichanges.xml
Comment 5 Tomas Zezula 2007-02-08 12:23:13 UTC
I am going to integrate it tomorrow.
Comment 6 Jesse Glick 2007-02-08 21:47:13 UTC
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.
Comment 7 Tomas Zezula 2007-02-09 10:03:54 UTC
I've fixed all the Jesse's comments.
Comment 8 Tomas Zezula 2007-02-09 10:55:36 UTC
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