Fix possible NPE in maven ModuleInfoSelector#9181
Conversation
SourceLevelQuery may return null.
neilcsmith-net
left a comment
There was a problem hiding this comment.
Makes sense, thanks!
Aside - looking at uses of System.getProperty("java.version") suggests we might have quite a few things that could be removed in future.
|
I guess I wonder the "polarity" should be reversed, i.e. if there's no source level, then maybe we should consider the source level to be 9+ nowadays? Or does that have some known severe impact? |
like if (sourceLevel == null || !sourceLevel.startsWith("1.")) { //NOI18N
// both sourceLevel and ideJDK are 9+
ret = hasModuleInfoCP.get();
}? changing the bias should be possible I think. But I am not sure why the source level query exists in the first place, if there is a module-info file, it can't be <=8 anymore which seems to be the purpose of the check. I would prefer to keep it as is for NB 29 and consider reverting #2037 for NB 30. |
|
I had actually written the same thing as @lahodaj in my comment, and then decided to remove before posting for a similar reason that it's probably better to keep the code like this for NB29 and review more later. |
|
will merge this as more works will be done in NB30 |
SourceLevelQuerymay return null. (e.g if the version string isn't valid)code section was introduced a while ago #2037
fixes #9180