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 243335 - Services for only one NamedServiceDefination gets generated in one module
Summary: Services for only one NamedServiceDefination gets generated in one module
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Lookup (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-28 04:20 UTC by tusharvjoshi
Modified: 2014-08-23 04:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample code which demonstrates the issue (27.98 KB, application/zip)
2014-03-28 04:20 UTC, tusharvjoshi
Details
Suite project with generated services (158.96 KB, application/zip)
2014-07-24 12:32 UTC, Martin Kozeny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tusharvjoshi 2014-03-28 04:20:49 UTC
Created attachment 146361 [details]
Sample code which demonstrates the issue

STEPS:
1) In a module define two named service definations, for example in attached code MyService and MoreActions are two different NamedServiceDefinations in same module named NamedServiceDefinitions
2) In another module add Service Providers using those annotations, for example WeeklyDinnerService and MoreActionsProvider in module named NamedServiceDemo
3) Compile suite and only one of the NamedServiceDefination gets generated, usually which comes alphabetically first


ACTUAL:
Compile suite and only one of the NamedServiceDefination gets generated, usually which comes alphabetically first

EXPECTED:
All services shall get created
Comment 1 Martin Kozeny 2014-07-24 12:31:26 UTC
When compiling your suite on this environment:

Product Version: NetBeans IDE Dev (Build 20140723-666f0eeaec1d)
Java: 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_51-b13
System: Linux version 3.5.0-51-generic running on amd64; UTF-8; en_US (nb)

I got following exception:

java.lang.NullPointerException
	at org.netbeans.modules.openide.util.NamedServiceProcessor.handleProcess(NamedServiceProcessor.java:94)
	at org.openide.util.lookup.implspi.AbstractServiceProviderProcessor.process(AbstractServiceProviderProcessor.java:117)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
	at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
	at com.sun.tools.javac.main.Main.compile(Main.java:439)
	at com.sun.tools.javac.main.Main.compile(Main.java:353)
	at com.sun.tools.javac.main.Main.compile(Main.java:342)
	at com.sun.tools.javac.main.Main.compile(Main.java:333)
	at com.sun.tools.javac.Main.compile(Main.java:76)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
	at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1159)
	at org.netbeans.nbbuild.CustomJavac.compile(CustomJavac.java:124)
	at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:935)
	at org.netbeans.nbbuild.CustomJavac.execute(CustomJavac.java:105)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
	at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:306)
	at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
	at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
	at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
	at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
/home/mkozeny/NetBeans_workspace/core-main/nbbuild/netbeans/harness/suite.xml:187: The following error occurred while executing this line:
/home/mkozeny/NetBeans_workspace/core-main/nbbuild/netbeans/harness/common.xml:220: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)

But as I create on this environment suite with two modules and in of them define two service and in other one use them, both are generated (see attached builed project).
Comment 2 Martin Kozeny 2014-07-24 12:32:02 UTC
Created attachment 148280 [details]
Suite project with generated services
Comment 3 Martin Kozeny 2014-07-31 15:06:16 UTC
Reassigning to platform/lookup for further investigation.
Comment 4 Jaroslav Tulach 2014-08-21 13:41:28 UTC
The example is broken:

> 1) In a module define two named service definations, for example in attached
> code MyService and MoreActions are two different NamedServiceDefinations in
> same module named NamedServiceDefinitions

MoreActions is not in a public package!
Comment 5 Jaroslav Tulach 2014-08-21 13:43:25 UTC
changeset:   88a80091e009
tag:         tip
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Thu Aug 21 15:42:38 2014 +0200
summary:     #243335: Making the processor more robust to not throw NPEs on uncompilable source
Comment 6 tusharvjoshi 2014-08-21 14:14:05 UTC
Thanks for all the time spent on this issue and for providing the solution.  I am glad that this issue made the NPE problem more visible and was eliminated.
Comment 7 Quality Engineering 2014-08-23 04:54:51 UTC
Integrated into 'main-silver', will be available in build *201408230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/88a80091e009
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #243335: Making the processor more robust to not throw NPEs on uncompilable source