Bug 205475 - NullPointerException at org.netbeans.modules.java.hints.jackpot.impl.Utilities$NbSPIImpl.createUniversalCPInfo
NullPointerException at org.netbeans.modules.java.hints.jackpot.impl.Utilitie...
Product: java
Classification: Unclassified
Component: Hints
All All
: P1 (vote)
: 7.1
Assigned To: Jan Lahoda
Depends on:
  Show dependency treegraph
Reported: 2011-11-23 12:42 UTC by alesak
Modified: 2011-12-02 15:05 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT

stacktrace (3.07 KB, text/plain)
2011-11-23 12:42 UTC, alesak
Binary patch for testing (94.24 KB, application/java-archive)
2011-11-25 10:01 UTC, Jan Lahoda
messages.log (160.85 KB, text/plain)
2011-11-25 10:21 UTC, alesak
Project in which the problem might be reproduced. (13.07 KB, application/zip)
2011-11-27 21:21 UTC, Jan Lahoda

Note You need to log in before you can comment on or make changes to this bug.
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

   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]
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:
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]

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)

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


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?

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
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

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo