eclipse-modisco / org.eclipse.modisco

Eclipse Public License 2.0
0 stars 0 forks source link

NPE when generics are used in inline imports #1032

Open eclipse-modisco-bot opened 3 days ago

eclipse-modisco-bot commented 3 days ago

| --- | --- | | Bugzilla Link | 545880 | | Status | NEW | | Importance | P3 normal | | Reported | Mar 28, 2019 04:58 EDT | | Modified | Mar 28, 2019 04:58 EDT | | Version | 1.2.0 | | Reporter | Sven Peldszus |

Description

Created attachment 278053\ Minimal example

When discovering sonarcube version 7.6 I got the following NullPointerException:

java.lang.NullPointerException\ at org.eclipse.modisco.java.discoverer.internal.io.java.MethodRedefinitionManager.getRawSignature(MethodRedefinitionManager.java:108)\ at org.eclipse.modisco.java.discoverer.internal.io.java.MethodRedefinitionManager.getRawSignature(MethodRedefinitionManager.java:98)\ at org.eclipse.modisco.java.discoverer.internal.io.java.MethodRedefinitionManager.resolveMethodRedefinitions(MethodRedefinitionManager.java:57)\ at org.eclipse.modisco.java.discoverer.internal.io.java.JavaReader.resolveMethodRedefinition(JavaReader.java:348)\ at org.eclipse.modisco.java.discoverer.internal.io.java.JavaReader.terminate(JavaReader.java:405)\ at org.eclipse.modisco.java.discoverer.AbstractDiscoverJavaModelFromProject.analyzeJavaProject(AbstractDiscoverJavaModelFromProject.java:165)\ at org.eclipse.modisco.java.discoverer.DiscoverJavaModelFromJavaProject.basicDiscoverElement(DiscoverJavaModelFromJavaProject.java:38)\ at org.eclipse.modisco.java.discoverer.DiscoverJavaModelFromJavaProject.basicDiscoverElement(DiscoverJavaModelFromJavaProject.java:1)\ at org.eclipse.modisco.infra.discovery.core.AbstractDiscoverer.discoverElement(AbstractDiscoverer.java:93)\ at org.eclipse.modisco.infra.discovery.core.AbstractModelDiscoverer.discoverElement(AbstractModelDiscoverer.java:184)

The reason for this exception is that the type of a method parameter hasn't been discovered.\ To be more precise it is the third parameter of the following method:

org.sonar.ce.task.projectanalysis.issue.IntegrateIssuesVisitor.fillExistingOpenIssues(Component, Map<DefaultIssue, DefaultIssue>, DiskCache.DiskAppender):void

The problem seems to be the usage of generics in the inline import.

I also created a minimal example for simple reproduction of the problem which is attached.

:notepad_spiral: OuterClass.java