Bug 494718 - NPE in Scope.getMethod while compiling Java
Summary: NPE in Scope.getMethod while compiling Java
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.5.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2016-05-27 04:14 EDT by Paul Crockett CLA
Modified: 2020-04-14 02:33 EDT (History)
2 users (show)

See Also:


Attachments
Debug output and error event details (492.53 KB, text/plain)
2016-05-27 04:14 EDT, Paul Crockett CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Crockett CLA 2016-05-27 04:14:18 EDT
Created attachment 262049 [details]
Debug output and error event details

I believe I am experiencing the same, or at least very similar, bug as reported here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=490636


Error event details:

Errors running builder 'Java Builder' on project 'report'.

java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.lookup.Scope.getMethod(Scope.java:2816)
	at org.eclipse.jdt.internal.compiler.ast.ReferenceExpression.isPotentiallyCompatibleWith(ReferenceExpression.java:1003)
	at org.eclipse.jdt.internal.compiler.lookup.ConstraintExpressionFormula.reduce(ConstraintExpressionFormula.java:61)


eclipse.buildId=4.5.2.M20160212-1500
java.version=1.8.0_77
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product -debug


I have captured the debug output as described, but it doesn't show the NPE so I'm not sure how you can work out which class triggers the exception.

The NPE occurs quite frequently, and always on the same project (report) with the same stack trace. The build still completes successfully after the exception, so the error is mostly just an annoyance.

The error usually occurs when a build is performed after I switch branches in git, or another project is opened or closed. It does not occur when I do a clean and rebuild.

The attached file contains the eclipse debug output, plus the error event details appended at the end.
Comment 1 Jay Arthanareeswaran CLA 2016-06-14 04:28:34 EDT
Like I said in bug 490636 comment #3, you could try the tracing on. Without what source is causing this, it is difficult to make progress on this.
Comment 2 Stephan Herrmann CLA 2016-06-14 08:33:49 EDT
From the stack trace in the attachment I see (ignoring a line number offset of 2 at Scope.java:2816, should be 2814):

RE.isPotentiallyCompatibleWith() is probably called before resolveType(). If resolveType() would have produced a null this.receiverType, this would have caused an NPE already there (against lhs before the assignment).

I assume the line number offset is caused by using the groovy variant of JDT/Core. This could potentially imply, that some relevant fixes from JDT are not present in your installation.

@Jay, did you see the tracing output in attachment 262049 [details]? Is that not what you expected following bug 490636 comment #3? Unfortunately, the tracing output includes no timestamps, otherwise we might have guessed where in the sequence of events the NPE happened, since we do have the timestamp of the NPE.
Comment 3 Eclipse Genie CLA 2020-04-14 02:33:19 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.