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.
As we discussed before, we need to be able to get source level for the whole classpath root (since it does not make sense for files in a single classpath to have different source roots). This can be done by simply removing the check (if the passed file is really a file rather than a folder) from SourceLevelQuery. Attached patch does it. I would like to propose its integration. One issue that still remains to be solved is that it seems that the query does not work if the cp root is a jar file.
Created attachment 15500 [details] Proposed patch.
Changing to RFE as recommended by Jesse.
Fixed in: Checking in src/org/netbeans/api/java/queries/SourceLevelQuery.java new revision: 1.2; previous revision: 1.1 Re. JAR: you should be using SourceForBinaryQuery to get sources for the JAR and on these sources you can again use SourceLevelQuery. However, this will work only for JAR produced by a project. For Library JAR this would not work. You would have to bother user to specify which SourceLevel the sources of the library JAR are. Or if you are able to detect that from bytecode then Java Library could implement SourceLevel query for library sources.
I don't care about jars with classfiles, but what about zip files with sources? (src.zip)
Sources for what? Java Library? Java Platform? Or a project? I was talking about project and library case. And I still do not know how to do that for library without asking user that question in Java Library Manager UI. For platform case it should be easy to do - Java Platform manager could implement the SourceLevelQuery and answer it for JDK's jar:file:/.../src.jar!/. Adding Tomas on CC, because that would be most probably his job.
Tomas, please impl the query for platform.
Added SLQ for J2SEPlatform RCS file: /cvs/java/j2seplatform/src/META-INF/services/org.netbeans.spi.java.queries.SourceLevelQueryImplementation,v done Checking in src/META-INF/services/org.netbeans.spi.java.queries.SourceLevelQueryImplementation; /cvs/java/j2seplatform/src/META-INF/services/org.netbeans.spi.java.queries.SourceLevelQueryImplementation,v <-- org.netbeans.spi.java.queries.SourceLevelQueryImplementation initial revision: 1.1 done Processing log script arguments... More commits to come... RCS file: /cvs/java/j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformSourceLevelQueryImpl.java,v done Checking in src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformSourceLevelQueryImpl.java; /cvs/java/j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformSourceLevelQueryImpl.java,v <-- J2SEPlatformSourceLevelQueryImpl.java initial revision: 1.1 done
Added SLQ fir J2SELibs: Checking in j2seplatform/src/META-INF/services/org.netbeans.spi.java.queries.SourceLevelQueryImplementation; /cvs/java/j2seplatform/src/META-INF/services/org.netbeans.spi.java.queries.SourceLevelQueryImplementation,v <-- org.netbeans.spi.java.queries.SourceLevelQueryImplementation new revision: 1.2; previous revision: 1.1 done Processing log script arguments... More commits to come... RCS file: /cvs/java/j2seplatform/src/org/netbeans/modules/java/j2seplatform/libraries/J2SELibrarySourceLevelQueryImpl.java,v done Checking in j2seplatform/src/org/netbeans/modules/java/j2seplatform/libraries/J2SELibrarySourceLevelQueryImpl.java; /cvs/java/j2seplatform/src/org/netbeans/modules/java/j2seplatform/libraries/J2SELibrarySourceLevelQueryImpl.java,v <-- J2SELibrarySourceLevelQueryImpl.java initial revision: 1.1 done