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: | Find Usages doesn't work after attaching sources to wrapped Library | ||
---|---|---|---|
Product: | apisupport | Reporter: | Vladimir Voskresensky <vv159170> |
Component: | Project | Assignee: | Tomas Zezula <tzezula> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 8.1 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Vladimir Voskresensky
2015-04-09 14:40:55 UTC
For some reason text was incomplete. Here it is again: I have the following layout of projects opened in IDE: - NBModuleClosed. It produces closed.jar and has i.e. ClosedClass - NBModuleWrapper which wraps copy of jar file closed.jar - NBClient which depends on NBModuleWrapper to use closed.jar functionality I'm in NBClient's file. Ctrl+Click on ClosedClass jumps to ClosedClass.class (it doesn't have attached sources yet). When I use Find Usages of ClosedClass from this opened ClosedClass.class file => usages in NBClient are found - great. Now I want to attach sources to ClosedClass and use "Attach Sources..." button on top of ClosedClass.class file editor. I choose the "src" folder (which is inside module NBModuleClosed abs path). Now Ctrl+Click on ClosedClass from NBClient jumps to ClosedClass.java. And if Select In Project, then NBModuleClosed is expanded - really great! The problem: - go to use of ClosedClass in NBClient. Try Find Usages in all opened projects => only usages inside NBModuleClosed are found and Nothing in NBClient. Even the start point of Find Usages itself. - go to ClosedClass.java and try Find Usages from there => the same result. Nothing is found in NBClient. And there is no any way to find anything in NBClient anymore (while it worked before I attached sources) This behavior also affects "is overridden" annotations, because java files in NBModuleClosed do not see overridden methods in NBClient. FYI, probably I'm doing something wrong, but I opened wrapper's project properties, chose one of wrapped files (org-clang-tools-services.jar), selected "Edit..." and in Sources and Javadoc fields specified path to src folder. I see that wrapped jar got the extra badge - "package". + changes in project.properties like: file.reference.org-clang-tools-services.jar=external/org-clang-tools-services.jar source.reference.org-clang-tools-services.jar=/net/volvo/export/devarea/sputnik-model_34/modules/org.clang.tools.services/src I closed IDE, cleaned cache dir, reopened IDE for reindexing and tried Find Usages starting in NBClient's file for class declared in this jars and still failed to find usage under caret :-( For another wrapped jar I tried path without "src" postfix, but in properties file I see that test/unit/src was appended: source.reference.org-clang-lex.jar=/net/volvo/export/devarea/sputnik-model_34/modules/org.clang.lex/test/unit/src => after that I was able to find usage position under caret (class Token) starting from NBClient's file, but ctrl+Click opens gray file again. Find Usage from gray file Token doesn't find anything in NBClient. Find Usage from real source of class Token doesn't find anything in NBClient again Also there are a lot of exceptions in log like INFO [org.netbeans.core.startup.layers.ArchiveURLMapper]: checking jar:file:/net/volvo/export/devarea/sputnik-model_34/modules/org.clang.lex/!/ msg Caused: org.openide.filesystems.FSException: Error in file /net/volvo/export/devarea/sputnik-model_34/modules/org.clang.lex. at org.openide.filesystems.JarFileSystem.setJarFile(JarFileSystem.java:296) at org.openide.filesystems.JarFileSystem.<init>(JarFileSystem.java:186) at org.netbeans.core.startup.layers.ArchiveURLMapper.getFileSystem(ArchiveURLMapper.java:169) [catch] at org.netbeans.core.startup.layers.ArchiveURLMapper.getFileObjects(ArchiveURLMapper.java:141) at org.openide.filesystems.URLMapper.findFileObject(URLMapper.java:213) at org.openide.filesystems.FileUtil.getArchiveRoot(FileUtil.java:1842) at org.netbeans.modules.apisupport.project.queries.ClassPathProviderImpl.findClassPath(ClassPathProviderImpl.java:274) at org.netbeans.modules.java.project.ProjectClassPathProvider.findClassPath(ProjectClassPathProvider.java:75) at org.netbeans.api.java.classpath.ClassPath.getClassPath(ClassPath.java:673) at org.netbeans.modules.parsing.impl.indexing.errors.Utilities.getSourceClassPathFor(Utilities.java:84) at org.netbeans.modules.parsing.ui.indexing.errors.ErrorAnnotator$1.run(ErrorAnnotator.java:313) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1425) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2038) ALL [null]: Error in file /net/volvo/export/devarea/sputnik-model_34/modules/org.clang.lex. INFO [org.netbeans.core.startup.layers.ArchiveURLMapper]: checking jar:file:/net/volvo/export/devarea/sputnik-model_34/modules/org.clang.tools.services/src/!/ msg Caused: org.openide.filesystems.FSException: Error in file /net/volvo/export/devarea/sputnik-model_34/modules/org.clang.tools.services/src. at org.openide.filesystems.JarFileSystem.setJarFile(JarFileSystem.java:296) at org.openide.filesystems.JarFileSystem.<init>(JarFileSystem.java:186) at org.netbeans.core.startup.layers.ArchiveURLMapper.getFileSystem(ArchiveURLMapper.java:169) [catch] at org.netbeans.core.startup.layers.ArchiveURLMapper.getFileObjects(ArchiveURLMapper.java:141) at org.openide.filesystems.URLMapper.findFileObject(URLMapper.java:213) at org.openide.filesystems.FileUtil.getArchiveRoot(FileUtil.java:1842) at org.netbeans.modules.apisupport.project.queries.ClassPathProviderImpl.findClassPath(ClassPathProviderImpl.java:274) at org.netbeans.modules.java.project.ProjectClassPathProvider.findClassPath(ProjectClassPathProvider.java:75) at org.netbeans.api.java.classpath.ClassPath.getClassPath(ClassPath.java:673) at org.netbeans.modules.parsing.impl.indexing.errors.Utilities.getSourceClassPathFor(Utilities.java:84) at org.netbeans.modules.parsing.ui.indexing.errors.ErrorAnnotator$1.run(ErrorAnnotator.java:313) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1425) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2038) ALL [null]: Error in file /net/volvo/export/devarea/sputnik-model_34/modules/org.clang.tools.services/src. INFO [org.netbeans.core.startup.layers.ArchiveURLMapper]: checking jar:file:/net/volvo/export/devarea/sputnik-model_34/modules/org.clang.lex/!/ msg Caused: org.openide.filesystems.FSException: Error in file /net/volvo/export/devarea/sputnik-model_34/modules/org.clang.lex. at org.openide.filesystems.JarFileSystem.setJarFile(JarFileSystem.java:296) at org.openide.filesystems.JarFileSystem.<init>(JarFileSystem.java:186) at org.netbeans.core.startup.layers.ArchiveURLMapper.getFileSystem(ArchiveURLMapper.java:169) [catch] at org.netbeans.core.startup.layers.ArchiveURLMapper.getFileObjects(ArchiveURLMapper.java:141) at org.openide.filesystems.URLMapper.findFileObject(URLMapper.java:213) at org.openide.filesystems.FileUtil.getArchiveRoot(FileUtil.java:1842) at org.netbeans.modules.apisupport.project.queries.ClassPathProviderImpl.findClassPath(ClassPathProviderImpl.java:274) at org.netbeans.modules.csl.core.ProjectClassPathProvider.findClassPath(ProjectClassPathProvider.java:70) at org.netbeans.api.java.classpath.ClassPath.getClassPath(ClassPath.java:673) at org.netbeans.modules.parsing.impl.indexing.errors.Utilities.getSourceClassPathFor(Utilities.java:84) at org.netbeans.modules.parsing.ui.indexing.errors.ErrorAnnotator$1.run(ErrorAnnotator.java:313) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1425) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2038) ALL [null]: Error in file /net/volvo/export/devarea/sputnik-model_34/modules/org.clang.lex. INFO [org.netbeans.core.startup.layers.ArchiveURLMapper]: checking jar:file:/net/volvo/export/devarea/sputnik-model_34/modules/org.clang.tools.services/src/!/ msg Caused: org.openide.filesystems.FSException: Error in file /net/volvo/export/devarea/sputnik-model_34/modules/org.clang.tools.services/src. at org.openide.filesystems.JarFileSystem.setJarFile(JarFileSystem.java:296) at org.openide.filesystems.JarFileSystem.<init>(JarFileSystem.java:186) at org.netbeans.core.startup.layers.ArchiveURLMapper.getFileSystem(ArchiveURLMapper.java:169) [catch] at org.netbeans.core.startup.layers.ArchiveURLMapper.getFileObjects(ArchiveURLMapper.java:141) at org.openide.filesystems.URLMapper.findFileObject(URLMapper.java:213) at org.openide.filesystems.FileUtil.getArchiveRoot(FileUtil.java:1842) at org.netbeans.modules.apisupport.project.queries.ClassPathProviderImpl.findClassPath(ClassPathProviderImpl.java:274) at org.netbeans.modules.csl.core.ProjectClassPathProvider.findClassPath(ProjectClassPathProvider.java:70) at org.netbeans.api.java.classpath.ClassPath.getClassPath(ClassPath.java:673) at org.netbeans.modules.parsing.impl.indexing.errors.Utilities.getSourceClassPathFor(Utilities.java:84) at org.netbeans.modules.parsing.ui.indexing.errors.ErrorAnnotator$1.run(ErrorAnnotator.java:313) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1425) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2038) ALL [null]: Error in file /net/volvo/export/devarea/sputnik-model_34/modules/org.clang.tools.services/src. Reassigning to Tomas, he is looking into it. Problem evaluation: The problem is that the attach source comes from the project but the SourceForBinaryQuery.Resul2.preferSources() returns false. So the IDE uses the binary as a dependency not the source. But the source is also scanned as there is opened project for the wrapped jar. The funny thing is that closing the project for wrapped jar fixes the problem (no source roots are registered in GlobalPathRegistry). There are two possibilities how to resolve the problem: 1st) In the Source4BinaryQuery.Res.prefferSources() - return true when root is owned by some project 2nd) Somehow change the dependent root calculation to be prepared for this. Fixed jet-main bb5dd48d237e Integrated into 'main-silver', will be available in build *201504160452* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/bb5dd48d237e User: Tomas Zezula <tzezula@netbeans.org> Log: #251738:Find Usages doesn't work after attaching sources to wrapped Library |