Community
Participate
Working Groups
I'm not sure exactly what I did, but this appeared in my console: java.lang.NullPointerException at org.eclipse.jdt.internal.core.SourceMapper.enterClass (SourceMapper.java:389) at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest or(SourceElementParser.java:922) at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequest or(SourceElementParser.java:600) at org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit (SourceElementParser.java:1062) at org.eclipse.jdt.internal.core.SourceMapper.mapSource (SourceMapper.java:978) at org.eclipse.jdt.internal.core.SourceMapper.mapSource (SourceMapper.java:923) at org.eclipse.jdt.internal.core.ClassFile.openBuffer (ClassFile.java:407) at org.eclipse.jdt.internal.core.Openable.getBuffer(Openable.java:192) at org.eclipse.jdt.internal.corext.javadoc.JavaDocAccess.getJavaDoc (JavaDocAccess.java:38) at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo (JavadocHover.java:62) at org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover.getHover Info(AbstractJavaEditorTextHover.java:98) at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo (BestMatchHover.java:130) at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInf o(JavaEditorTextHoverProxy.java:72) at org.eclipse.jface.text.TextViewerHoverManager$2.run (TextViewerHoverManager.java:108)
Would you have the name of the .class file you tried to open? This is not a new problem (related to latest changes for better root path inference).
Do you remember what you did? I don't understand how the types collection can be null on the line I see in the stack trace. It might be a concurrency problem. I need to find out if this is possible.
I did open java.lang.System - but I might have been opening something from there (I can't remember).
Can you reproduce it? I guess not, but if you get it again, please let me know what you have done. It looks like the source mapper has been called twice to map source and the types collection have been reset before the second mapping is completed. mapSouce sets the types collection to an array with one element. At the end in a finally block it resets the collection to null. But the collection cannot be null during the notification except if the types has been reset to null before the second source mapping is completed.
I have not been able to reproduce it, but will let you know if I can.
Which VM are you using? IBM 1.3.1?
I was using IBM 1.4 in this case.
I really don't see how this types collection could be null. It doesn't seem to be a concurrency problem, because I don't think the hover calls are done concurrently. What version are you running? 0218?
I running the lastest JCORE from HEAD.
Then I have no idea how types can be null. It is set to new IType[1] at the beginning of mapSource and set to null at the end (in the finally block). If you have more details how you got this error, they are welcome.
This is a threading issue. The source mapper might be called from two different threads. The bug is that the source mapper is not thread safe. So we need to synchronize the method ISourceRange mapSource(IType type, char[] contents, IJavaElement searchedElement). We will do that for 2.1RC2. It is too risky now for RC1.
Fixed and released in 2.1 stream. I synchronize the method mapSource in the source mapper. The NPE was a consequence of the usage of the Source mapper instance concurrently. If you see it again or if you get dead-lock, please reopen it.
Verified. There is no test case for this PR. It is a concurrency problem.