Community
Participate
Working Groups
Created attachment 209964 [details] compiler preferences Errors running builder 'Java Builder' on project 'org.eclipse.jdt.compiler.apt'. java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:66) at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:37) at org.eclipse.jdt.internal.compiler.ast.IfStatement.analyseCode(IfStatement.java:102) at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:37) at org.eclipse.jdt.internal.compiler.ast.TryStatement.analyseCode(TryStatement.java:156) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:109) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:722) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:251) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:111) 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:736)
Which build? I20120122-2000?
I have 4.2 I20120123-1210 which would use an earlier 3.8 build. o.e.jdt.core version is - org.eclipse.jdt.core_3.8.1.v20120122-0307
I cannot reproduce using o.e.jdt.compiler.apt , compiled using org.eclipse.jdt.core_3.8.1.v20120122-0307 and attached prefs.
The line of code on which there's an NPE hasn't changed recently. Deepak could reproduce with a lot of other projects imported in the workspace and a few of them closed. Some weird combination results in this NPE. So not an urgent issue for M5. Will investigate if and when a reproducible case becomes available.
If line 66 really is the first line of analyseCode where the only deref is this.binding.isStatic() then I'd assume there should be *something* in the logs from the time when resolving this MessageSend failed? Deepak, anything? Or any compile errors at that time?
I got the same situation during build: !ENTRY org.eclipse.core.resources 4 2 2012-01-31 14:00:47.661 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources". !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:61) at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:36) at org.eclipse.jdt.internal.compiler.ast.ForeachStatement.analyseCode(ForeachStatement.java:103) at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:36) at org.eclipse.jdt.internal.compiler.ast.IfStatement.analyseCode(IfStatement.java:99) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:104) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:696) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:254) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:111) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:769) at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137) at java.lang.Thread.run(Thread.java:680) !ENTRY org.eclipse.core.resources 4 75 2012-01-31 14:00:55.931 !MESSAGE Errors occurred during the build. !SUBENTRY 1 org.eclipse.jdt.core 4 75 2012-01-31 14:00:55.932 !MESSAGE Errors running builder 'Java Builder' on project 'XXXXXX.EJB'. !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:61) at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:36) at org.eclipse.jdt.internal.compiler.ast.ForeachStatement.analyseCode(ForeachStatement.java:103) at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:36) at org.eclipse.jdt.internal.compiler.ast.IfStatement.analyseCode(IfStatement.java:99) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:104) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:696) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:254) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:111) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:769) at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137) at java.lang.Thread.run(Thread.java:680) Eclipse: Version: Indigo Service Release 1 Build id: 20110916-0149 Operatin system: MacOs Lion I observed that it does not occur always. When I close all projects, reopen, refresh, clean and build everything is fine but when I refresh and rebuild next time I get this exception. I changed last time structure of projects too a little more complex. Unfortunately I can not say how to reproduce this easily.
I tried on Eclipse Helios: Version: Helios Service Release 2 Build id: 20110218-0911 and I still the same problem: !ENTRY org.eclipse.core.resources 4 75 2012-01-31 14:37:40.232 !MESSAGE Errors occurred during the build. !SUBENTRY 1 org.eclipse.jdt.core 4 75 2012-01-31 14:37:40.232 !MESSAGE Errors running builder 'Java Builder' on project 'XXXXXXXX.EJB'. !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:59) at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:36) at org.eclipse.jdt.internal.compiler.ast.ForeachStatement.analyseCode(ForeachStatement.java:103) at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:36) at org.eclipse.jdt.internal.compiler.ast.IfStatement.analyseCode(IfStatement.java:95) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:89) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:695) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:253) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:111) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:765) at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137) at java.lang.Thread.run(Thread.java:680)
(In reply to comment #6) > I got the same situation during build: Hi, can you answer comment 5 ? It'll be good to have the exact test case which triggers this NPE to really fix this problem. Thanks! If you can, please attach your project too.
Unfortunately I can not attach my projects. Only message which I receive in workspaceNew/.metadata/.log I copied to comment 6. Afterwards I see in eclipse "Problems" tab at first place: "Internal compiler error: java.lang.NullPointerException" and on next places that some types from another connected project are missing but this is probably because of NPE
my problem I solved by change in eclipse "preferences"->"Build order" to manual one project with model I just moved above another project with model which is used by first one
(In reply to comment #10) > my problem I solved by change in eclipse "preferences"->"Build order" to manual > one project with model I just moved above another project with model which is >used by first one Thanks for the investigation. I still want to find out why the binding obtained is null, because just adding a null check may hide a bigger bug.
Investigating further in MessageSend.resolveType(...), I can see that there's a possibility of obtaining a null binding via org.eclipse.jdt.internal.compiler.lookup.Scope.findMethod(ReferenceBinding, char[], TypeBinding[], InvocationSite, boolean) if one of its arguments cannot be resolved. SO, adding a null check might actually be the correct fix here.
Srikanth, can we be more resilient than just returning null from findMethod(..)? It seems to have been introduced by bug 69471.
(In reply to comment #13) > Srikanth, can we be more resilient than just returning null from > findMethod(..)? It seems to have been introduced by bug 69471. My 2c: I like the idea to avoid null, most clients seem to be unaffected by such change, with *possibly* one exception: have you checked getImplicitMethod() for different behavior with null vs. ProblemMethodBinding? Given that you see a difference, it *is* probably exactly in getImplicitMethod(), right? Do you have a test case for the difference?
(In reply to comment #14) > Given that you see a difference, it *is* probably exactly in > getImplicitMethod(), right? Delete that part, I didn't look at the obvious direct impact in MessageSend.
*** Bug 404994 has been marked as a duplicate of this bug. ***
Got this too. !ENTRY org.eclipse.core.resources 4 2 2013-04-05 13:31:11.469 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources". !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:83) at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:42) at org.eclipse.jdt.internal.compiler.ast.ForeachStatement.analyseCode(ForeachStatement.java:125) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:113) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:732) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:257) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:111) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:776) at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137) at java.lang.Thread.run(Thread.java:722)
(In reply to comment #17) > Got this too. You don't by any chance have a reproducing example?
(In reply to comment #18) > (In reply to comment #17) > > Got this too. > > You don't by any chance have a reproducing example? No, if so, I would have provided them :-(.
This is still present in Eclipse 4.4 (build 20140612-0600). I'll try to create a reproducing example.
No test case, but I think I was changing the default JRE environment for the workspace when it happened. Note that there are other bugs reported for similar issues, at least one allegedly fixed. This is the stacktrace generated in 4.11 (buildId=4.11.0.I20190307-0500) java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:146) at org.eclipse.jdt.internal.compiler.ast.ReturnStatement.analyseCode(ReturnStatement.java:90) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:128) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:772) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:271) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:130) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:898) at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:145) at java.lang.Thread.run(Thread.java:748)
we will happily work on this once we have an example.
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. If you have further information on the current state of the bug, please add it. 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.