Bug 306464 - NPE in ProblemReporter.missingTypeInMethod(ProblemReporter.java:5113)
Summary: NPE in ProblemReporter.missingTypeInMethod(ProblemReporter.java:5113)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: 3.6.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 309396 321277 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-18 20:46 EDT by Chris Aniszczyk CLA
Modified: 2010-09-02 12:31 EDT (History)
8 users (show)

See Also:
srikanth_sankaran: review+


Attachments
.log file (727.98 KB, text/plain)
2010-04-15 19:18 EDT, Antoine Toulmé CLA
no flags Details
full egit workspace (21.26 MB, application/zip)
2010-04-22 15:58 EDT, Benjamin Muskalla CLA
no flags Details
test project with 2 classes (6.00 KB, application/zip)
2010-05-21 17:21 EDT, Karen Butzke CLA
no flags Details
Proposed fix + regression test (21.66 KB, patch)
2010-05-25 13:02 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + regression test (23.83 KB, patch)
2010-05-26 12:06 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Aniszczyk CLA 2010-03-18 20:46:43 EDT
What steps will reproduce the problem?
1. 
2. 
3. 


-- Error Details --
Date: Thu Mar 18 19:45:16 CDT 2010
Message: Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
Severity: Error
Product: Eclipse SDK 3.6.0.v201003062000 (org.eclipse.sdk.ide)
Plugin: org.eclipse.core.resources
Session Data:
eclipse.buildId=N20100306-2000
java.version=1.6.0_17
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=cocoa, NL=en_US
Framework arguments:  -keyring /Users/chrisaniszczyk/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86 -keyring /Users/chrisaniszczyk/.eclipse_keyring -showlocation


Exception Stack Trace:
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.missingTypeInMethod(ProblemReporter.java:5113)
at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:448)
at org.eclipse.jdt.internal.compiler.ast.ReturnStatement.resolve(ReturnStatement.java:221)
at org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:90)
at org.eclipse.jdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:263)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:451)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:212)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:410)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1147)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1226)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1046)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1235)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:531)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:759)
at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
at java.lang.Thread.run(Thread.java:637)
Comment 1 Olivier Thomann CLA 2010-03-18 21:50:34 EDT
Chris, would you have steps to reproduce?
We had that problem in the past, but we were never capable of reproducing it.
Comment 2 Olivier Thomann CLA 2010-03-19 09:35:32 EDT
This would occur when we tagged a method binding with the missing tag bits and we cannot find a missing type binding in it.
If you could reproduce, please send me your workspace. This would fix a problem reported in the past that we could never reproduce.
Comment 3 Olivier Thomann CLA 2010-03-19 09:39:50 EDT
This looks like a duplicate of bug 269208.
It would be nice if we could get a reproducable case for it, so that we finally fix it once for all.
Comment 4 Olivier Thomann CLA 2010-03-19 11:47:42 EDT
I might have found what path is causing this problem.
Are you calling generic methods using type arguments in your code ? If yes, this might be the cause of the problem when missing types are located inside the type arguments.
Comment 5 Chris Aniszczyk CLA 2010-03-19 11:50:40 EDT
I'm simply getting this on a save in my workspace occasionally.
Comment 6 Olivier Thomann CLA 2010-03-19 12:11:35 EDT
Do you have some classpath issues that could lead to getting missing type bindings ?
Comment 7 Olivier Thomann CLA 2010-03-19 13:21:21 EDT
Do you have anything in the .log file ?
Comment 8 Olivier Thomann CLA 2010-03-19 13:39:32 EDT
If you get it frequently enough, would you mind trying a patched version of JDT/Core ?
Comment 9 Antoine Toulmé CLA 2010-04-15 17:43:30 EDT
*** Bug 309396 has been marked as a duplicate of this bug. ***
Comment 10 Antoine Toulmé CLA 2010-04-15 17:44:05 EDT
Olivier, I'm all for trying a patch.
Comment 11 Olivier Thomann CLA 2010-04-15 19:12:51 EDT
Antoine,

If you are getting the NPE very often, I'll send you a patched version of JDT/Core tomorrow.
Comment 12 Antoine Toulmé CLA 2010-04-15 19:18:18 EDT
Created attachment 165033 [details]
.log file

Olivier, here is my .log file. I can not reproduce the bug anymore, I got rid of it by adding a few more package imports and going on with the resolution of the dependencies of the project.

Nevertheless, there are quite a few exceptions in there that could be of interest for you.
Comment 13 Olivier Thomann CLA 2010-04-20 14:27:26 EDT
I released a debug trace that will show the method binding in the console in case this happens again.
This might help us to reproduce this issue and get it fixed.
Comment 14 Benjamin Muskalla CLA 2010-04-22 15:54:10 EDT
I20100414-1200

Just happend to me with a fresh egit workspace. A clean and fullbuild fixed it.
Will try to attach the whole workspace if that helps. Stacktrace is:


java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.missingTypeInMethod(ProblemReporter.java:5150)
at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:448)
at org.eclipse.jdt.internal.compiler.ast.ReturnStatement.resolve(ReturnStatement.java:221)
at org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:90)
at org.eclipse.jdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:263)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:451)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:212)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:410)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1147)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1235)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:531)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:759)
at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
at java.lang.Thread.run(Thread.java:619)
Comment 15 Benjamin Muskalla CLA 2010-04-22 15:58:09 EDT
Created attachment 165843 [details]
full egit workspace

Attached is the whole workspace where this happend.
Comment 16 Olivier Thomann CLA 2010-04-22 19:41:41 EDT
(In reply to comment #14)
> I20100414-1200
> Just happend to me with a fresh egit workspace. A clean and fullbuild fixed it.
How did you build it initially?
Comment 17 Benjamin Muskalla CLA 2010-04-23 05:48:59 EDT
Checked out the JGit and Egit bundles (http://wiki.eclipse.org/EGit/Contributor_Guide#Obtaining_Sources), so far so good (some compile errors left due to missing deps). Then I checked out the dependencies from Orbit with the psf (http://wiki.eclipse.org/EGit/Contributor_Guide#Libraries_from_Orbit) and as far as I remember, it crashed after checking out the deps and recompiling the workspace.
Comment 18 Olivier Thomann CLA 2010-04-26 13:02:19 EDT
(In reply to comment #17)
> Checked out the JGit and Egit bundles
> (http://wiki.eclipse.org/EGit/Contributor_Guide#Obtaining_Sources), so far so
> good (some compile errors left due to missing deps). Then I checked out the
> dependencies from Orbit with the psf
> (http://wiki.eclipse.org/EGit/Contributor_Guide#Libraries_from_Orbit) and as
> far as I remember, it crashed after checking out the deps and recompiling the
> workspace.
Did you use sources from master or 0.7 ?
I tried to reproduce, but for now unsuccessfully.
Comment 19 Olivier Thomann CLA 2010-04-26 13:16:18 EDT
(In reply to comment #15)
> Created an attachment (id=165843) [details]
> full egit workspace
> Attached is the whole workspace where this happend.
I could not directly use this workspace. I cannot open it properly without tons of errors.

When I tried to rebuild it from scratch, the problem doesn't happen. I don't have a Mac though.
Comment 20 Benjamin Muskalla CLA 2010-04-26 13:36:18 EDT
I used the sources from master. And what I'm a little confused about: it happend once and after a clean build, it didn't happen anymore. Maybe is only occurs without all projects (eg. compiler jumps in while checking out the dependencies but not everything is there yet). Is there anything I could do when it happens again to provide more informations?

And btw: the workspace was build on linux, Chris has a Mac as platform.
Comment 21 Olivier Thomann CLA 2010-04-26 13:59:59 EDT
(In reply to comment #20)
> I used the sources from master. And what I'm a little confused about: it
> happend once and after a clean build, it didn't happen anymore. Maybe is only
> occurs without all projects (eg. compiler jumps in while checking out the
> dependencies but not everything is there yet). Is there anything I could do
> when it happens again to provide more informations?
In latest builds, I adding a debug statement, so the .log file should contain the toString() of the corresponding method binding.
Hopefully this will help to narrow this issue down.
We could never get it more than once which makes it really difficult to fix.
Comment 22 Karen Butzke CLA 2010-05-21 17:21:08 EDT
Created attachment 169560 [details]
test project with 2 classes

Here is a test project that reproduces this NPE very easily. The debug trace displays:
Writing new class file JoinImpl.class
...
Could not find missing types in public Set#RAW getJoins().

It's hard to narrow the test case down much further than this since if you open the FromImpl class you get a continuous stream of NPEs in the error log. The example is non-compiling, I don't hit the NPE when properly compiling this code in it's original project (it's from the EclipseLink project, part of Eclipse RT)

I am on Windows with a 1.6 JRE.
Comment 23 Olivier Thomann CLA 2010-05-24 20:48:14 EDT
OK, thanks Karen.
I am getting it easily now. Investigating to see if this is still fixable for 3.6.
We might have to wait for 3.6.1.
Comment 24 Olivier Thomann CLA 2010-05-25 13:02:11 EDT
Created attachment 169857 [details]
Proposed fix + regression test
Comment 25 Olivier Thomann CLA 2010-05-26 12:06:40 EDT
Created attachment 170031 [details]
Proposed fix + regression test

This new patch will definitely remove the NPE. I keep a log entry when the collected missing types are still null.
Comment 26 Olivier Thomann CLA 2010-06-17 10:05:02 EDT
Srikanth, please review.
Comment 27 Olivier Thomann CLA 2010-06-23 09:47:50 EDT
Released for 3.7M1.
Waiting for code review to release in 3.6.1.
Comment 28 Srikanth Sankaran CLA 2010-07-02 03:46:33 EDT
(In reply to comment #27)
> Released for 3.7M1.
> Waiting for code review to release in 3.6.1.

Sorry for the delay, patch looks good.

The methods

org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding.ParameterizedGenericMethodBinding(MethodBinding, RawTypeBinding, LookupEnvironment)

org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding.ParameterizedGenericMethodBinding(MethodBinding, TypeBinding[], LookupEnvironment)

org.eclipse.jdt.internal.compiler.lookup.ParameterizedMethodBinding.instantiateGetClass(TypeBinding, MethodBinding, Scope)

continue to copy over the tagbits from the original methods without
clearing the missing types bit -- Is this intentional ?
Comment 29 Olivier Thomann CLA 2010-07-05 15:25:28 EDT
(In reply to comment #28)
> (In reply to comment #27)org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding.ParameterizedGenericMethodBinding(MethodBinding,
> RawTypeBinding, LookupEnvironment)
org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding.ParameterizedGenericMethodBinding(MethodBinding,
> TypeBinding[], LookupEnvironment)
org.eclipse.jdt.internal.compiler.lookup.ParameterizedMethodBinding.instantiateGetClass(TypeBinding,
> MethodBinding, Scope)
> continue to copy over the tagbits from the original methods without
> clearing the missing types bit -- Is this intentional ?
I would say yes, since we are not clearing any part of the method binding. The problem was coming from the raw instantiation that was clearing part of the binding without also clearing the corresponding bits.

I'll release the patch shortly.
Comment 30 Olivier Thomann CLA 2010-07-13 14:45:48 EDT
Released for 3.6 maintenance.
Comment 31 Jay Arthanareeswaran CLA 2010-08-04 11:51:02 EDT
Verified for 3.7M1 using build I20100802-1800.
Comment 32 Jay Arthanareeswaran CLA 2010-08-05 03:55:04 EDT
Keeping the RESOLVED STATUS as this needs to be verified for 3.6.1
Comment 33 Satyam Kandula CLA 2010-08-26 05:57:21 EDT
Verified for 3.6.1 RC2 using Build id: M20100825-0800
Comment 34 Olivier Thomann CLA 2010-09-02 12:31:31 EDT
*** Bug 321277 has been marked as a duplicate of this bug. ***