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 205475

Summary: NullPointerException at org.netbeans.modules.java.hints.jackpot.impl.Utilities$NbSPIImpl.createUniversalCPInfo
Product: java Reporter: alesak <alesak>
Component: HintsAssignee: Jan Lahoda <jlahoda>
Status: VERIFIED FIXED    
Severity: normal CC: alesak, jiriprox, mmirilovic, tzezula
Priority: P1    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 183121
Attachments: stacktrace
Binary patch for testing
messages.log
Project in which the problem might be reproduced.

Description alesak 2011-11-23 12:42:53 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-8314-on-20111123)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.4-b02, Java(TM) SE Runtime Environment, 1.6.0_29-b11
OS: Linux

User Comments:
alesak: opened java source file




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.java.hints.jackpot.impl.Utilities$NbSPIImpl.createUniversalCPInfo(Utilities.java:923)
   at org.netbeans.modules.java.hints.jackpot.impl.Utilities.createUniversalCPInfo(Utilities.java:757)
   at org.netbeans.modules.java.hints.declarative.Hacks.createUniversalCPInfo(Hacks.java:196)
   at org.netbeans.modules.java.hints.declarative.DeclarativeHintsParser.resolve(DeclarativeHintsParser.java:410)
   at org.netbeans.modules.java.hints.declarative.DeclarativeHintsParser.access$000(DeclarativeHintsParser.java:97)
   at org.netbeans.modules.java.hints.declarative.DeclarativeHintsParser$Impl.parseCondition(DeclarativeHintsParser.java:315)
Comment 1 alesak 2011-11-23 12:42:55 UTC
Created attachment 113465 [details]
stacktrace
Comment 2 alesak 2011-11-25 04:31:53 UTC
It is very annoying as it happens every single time I touch any line in Java source code and some hint should appear but instead I'm getting this NPE.
Comment 3 Jan Lahoda 2011-11-25 10:01:55 UTC
Created attachment 113525 [details]
Binary patch for testing
Comment 4 Jan Lahoda 2011-11-25 10:05:07 UTC
Not quite sure what went wrong - it would be very helpful if you could install the attached patch, run the IDE and attach the messages.log, which will contain debugging data. The NPE should not happen with the patch.

To install the patch, create:
java/modules/patches/org-netbeans-modules-java-hints
directory inside you NB installation (java/modules should already exist, the other two need to be created) and place the jar attached above there.

Thank you very much.
Comment 5 alesak 2011-11-25 10:21:11 UTC
Created attachment 113526 [details]
messages.log

here is the log with patch installed (You were right NPE is gone)
Comment 6 Jan Lahoda 2011-11-25 16:54:38 UTC
I did not reproduce manually, but it is probably sufficient to use a custom hint like this (place in META-INF/upgrade/x.hint in a source root):
$coll.size() == 0 :: $coll instanceof java.util.Collection && elementKindMatches($coll, ElementKind.INTERFACE)
=>$coll.isEmpty()
;;

have a J2ME/CLDC platform installed and have a code like:
List l = ...
boolean b = l.size() == 0;

Fix:
http://hg.netbeans.org/jet-main/rev/45eeccaa7cde

I think it would be useful to port this for 7.1. Any objections?
Comment 7 Marian Mirilovic 2011-11-25 16:57:55 UTC
(In reply to comment #6)
> I think it would be useful to port this for 7.1. Any objections?

I agree
Comment 8 Quality Engineering 2011-11-27 16:59:54 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/45eeccaa7cde
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #205475: preventing NPE: should not touch non-J2SE platforms, platforms are not required to specify a version.
Comment 9 Jan Lahoda 2011-11-27 21:21:56 UTC
Created attachment 113556 [details]
Project in which the problem might be reproduced.

I believe that the problem might be reproducible using this project - unpack, open it and open javaapplication5.JavaApplication5. It will be necessary to have a CLDC platform installed in the running IDE (i.e. a J2ME support enabled and configured).
Comment 10 Jan Lahoda 2011-11-27 21:25:04 UTC
Jirka, could you please try to verify (I think the above project should show the project is there is a CLDC platform installed/registered).

Tomas, could you please review the patch?

Thanks.
Comment 11 Tomas Zezula 2011-11-28 14:28:29 UTC
Seems fine to me.
Comment 12 Jiri Prox 2011-11-28 15:25:18 UTC
verified in trunk
Comment 13 Jan Lahoda 2011-11-28 21:48:52 UTC
release71:
http://hg.netbeans.org/releases/rev/f7c225c624e3
Comment 14 Quality Engineering 2011-11-29 18:46:07 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/f7c225c624e3
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #205475: preventing NPE: should not touch non-J2SE platforms, platforms are not required to specify a version.
Comment 15 Jiri Prox 2011-12-02 15:05:02 UTC
verified