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 230558 - org.​netbeans.​modules.​parsing.​spi.TaskFactory is not being registered when debugging a module suite
Summary: org.​netbeans.​modules.​parsing.​spi.TaskFactory is not being registered when...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P2 normal with 1 vote (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-31 06:06 UTC by bbll
Modified: 2013-07-01 15:58 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test Project to reproduce mentioned issue. (60.51 KB, application/x-zip-compressed)
2013-06-04 10:19 UTC, bbll
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bbll 2013-05-31 06:06:47 UTC
I have the following modules:

MyParser
- registers implementation of org.​netbeans.​modules.​parsing.​spi.ParserFactory

MyEditor
- registers implementation of org.​netbeans.​modules.​parsing.​spi.TaskFactory
- has dependency on MyParser

MyProject
- registers implementation of org.​netbeans.​spi.​project.ProjectFactory2
- has dependency on MyEditor

MyModuleSuite
- contains all modules mentioned above

When I debug MyModuleSuite it loads all modules (all modules set to ModuleType="regular") and everything works except of the TaskFactory service in MyEditor. Its "create" method is not being called, letting me assume that the service hasn't been registered.

When I clean MyModuleSuite and debug MyEditor directly, it works as expected.

I'm not sure if this is a bug or not, but I couldn't find a reasonable answer to this behavior yet.
Comment 1 Jaroslav Tulach 2013-06-04 06:24:26 UTC
Am I supposed to write the whole code myself? I would expect you attach a sample application here!
Comment 2 bbll 2013-06-04 10:19:01 UTC
Created attachment 135308 [details]
Test Project to reproduce mentioned issue.

Open KittenSuite project, "Clean and build" it and then debug it.

In the debug session open the attached project "KittenTestProject".
Once it's opened, open the source.kitten file from the Projects window (logical view). At this point the file should now be parsed, but it's not.

Exit the debug session, "Clean and build" the KittenSuite project and debug it once again.

Now, don't open the test project but the containing source.kitten file via "File|Open File...". Parsing now works.
Comment 3 bbll 2013-06-05 07:48:21 UTC
See attachment.
Comment 4 bbll 2013-06-17 06:12:24 UTC
Any update on this one?
It is kind of a blocker, since I cannot even apply a workaround.
Comment 5 Jaroslav Tulach 2013-06-19 06:54:53 UTC
Nice kitty icons...
Comment 6 Jaroslav Tulach 2013-06-19 07:12:03 UTC
Problems using parsing API, should probably be reported to parsing API owners.

> comment #2
> Now, don't open the test project but the 
> containing source.kitten file via
> "File|Open File...". Parsing now works.

A bit of debugging (surprisingly) shows that the createParser method is called by following six(!) threads at one moment:

"parsing-event-collector"
org.kitten.parser.KittenParserFactory.createParser(KittenParserFactory.java:16)
org.netbeans.modules.parsing.impl.SourceCache.getParser(SourceCache.java:201)
org.netbeans.modules.parsing.impl.SourceCache.createTasks(SourceCache.java:474)
org.netbeans.modules.parsing.impl.SourceCache.sourceModified(SourceCache.java:565)
org.netbeans.modules.parsing.impl.event.EventSupport.resetStateImpl(EventSupport.java:232)
org.netbeans.modules.parsing.impl.event.EventSupport.access$000(EventSupport.java:96)
org.netbeans.modules.parsing.impl.event.EventSupport$1.run(EventSupport.java:118)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)

"OpenIDE-request-processor-3" "OpenIDE-request-processor-4" "OpenIDE-request-processor-5" "OpenIDE-request-processor-6" "OpenIDE-request-processor-7" have all the same stacktrace:

org.kitten.parser.KittenParserFactory.createParser(KittenParserFactory.java:16)
org.netbeans.modules.parsing.impl.SourceCache.getParser(SourceCache.java:201)
org.netbeans.modules.parsing.impl.SourceCache.createTasks(SourceCache.java:474)
org.netbeans.modules.parsing.impl.SourceCache.scheduleTasks(SourceCache.java)
org.netbeans.modules.parsing.spi.Scheduler$1.run(Scheduler.java:160)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)

When the project is opened first, the KittenParserFactory is not instantiated at all.
Comment 7 Jaroslav Tulach 2013-06-19 07:19:02 UTC
The SourceCache.createTasks is not called at all when one opens the project.
Comment 8 Tomas Zezula 2013-06-28 08:30:47 UTC
In fact the problem is not in parsing.api but "over optimised" Lookup. The Lookup.lookupAll() does not create the object instances, you need to iterate the returned collection. Nice way how to safe some milliseconds on start up and break everyone else code.
So I will workaround it.
Comment 9 Tomas Zezula 2013-06-28 10:24:29 UTC
Fixed jet-main a600132f16ca
Comment 10 bbll 2013-07-01 01:06:08 UTC
Great that it has been fixed. Thank you.

Just curious though, how did other plugins work properly with a similar setup, like Java or C/C++?
Comment 11 Tomas Zezula 2013-07-01 08:04:24 UTC
They (Java, PHP, Javascript, HTML, and others) register paths in GlobalPathRegistry which forces the Schedulers to be loaded. The C++ is different it's not yet migrated to parsing.api. The C++ team is working on prototype using the parsing.api and as they had the same problem as you.
Comment 12 Quality Engineering 2013-07-01 15:58:45 UTC
Integrated into 'main-silver', will be available in build *201307011244* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/a600132f16ca
User: Tomas Zezula <tzezula@netbeans.org>
Log: #230558:org.netbeans.modules.parsing.spi.TaskFactory is not being registered when debugging a module suite