Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 486823

Summary: NPE logged as warning, error reporter does not pop up
Product: [Eclipse Project] JDT Reporter: Ralf Sternberg <rsternberg>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: marcel.bruch, mateusz.matela, stephan.herrmann
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Ralf Sternberg CLA 2016-01-29 09:00:54 EST
I get the following NPE frequently when content assist tries (and fails) to replace some parameter type or return type. This error ends up as a warning in the error log and the error reporting tool does not pop up.

Not sure what to make of this. Is it a JFace issue that reports the NPE only as a warning? Is it aeri that ignores it?

If this stacktrace is not already in your database, could you please delegate the issue? Thanks.

The IDE is Neon, RCP package, a recent milestone:
Eclipse for RCP and RAP Developers	4.6.0.20151218-1543	epp.package.rcp

java.lang.NullPointerException
	at org.eclipse.jdt.internal.formatter.TokenManager.firstIndexBefore(TokenManager.java:216)
	at org.eclipse.jdt.internal.formatter.TokenManager.firstTokenBefore(TokenManager.java:220)
	at org.eclipse.jdt.internal.formatter.SpacePreparator.handleTokenBefore(SpacePreparator.java:946)
	at org.eclipse.jdt.internal.formatter.SpacePreparator.visit(SpacePreparator.java:197)
	at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:611)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782)
	at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:470)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
	at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.prepareSpaces(DefaultCodeFormatter.java:354)
	at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.prepareFormattedCode(DefaultCodeFormatter.java:195)
	at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:157)
	at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:141)
	at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.formatString(ASTRewriteFormatter.java:246)
	at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.formatNode(ASTRewriteFormatter.java:376)
	at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.getFormattedResult(ASTRewriteFormatter.java:187)
	at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doTextInsert(ASTRewriteAnalyzer.java:1357)
	at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.rewriteRequiredNode(ASTRewriteAnalyzer.java:824)
	at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.rewriteReturnType(ASTRewriteAnalyzer.java:1822)
	at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:2017)
	at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:611)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
	at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.internalRewriteAST(ASTRewrite.java:302)
	at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST(ASTRewrite.java:291)
	at org.eclipse.jdt.ui.text.java.correction.ASTRewriteCorrectionProposal.addEdits(ASTRewriteCorrectionProposal.java:113)
	at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.createTextChange(CUCorrectionProposal.java:231)
	at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.createChange(CUCorrectionProposal.java:238)
	at org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal.getChange(ChangeCorrectionProposal.java:366)
	at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.getTextChange(CUCorrectionProposal.java:248)
	at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.getAdditionalProposalInfo(CUCorrectionProposal.java:141)
	at org.eclipse.jface.text.contentassist.AdditionalInfoController$Timer$2$1.run(AdditionalInfoController.java:113)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 Marcel Bruch CLA 2016-01-29 09:15:22 EST
Ralf,

by convention AERI (automated *error* reporting) does not respond to warnings. That explains why you don't get an error popup.

This particular problem belongs to JDT UI I guess.  Moving it there for triage.
Comment 2 Stephan Herrmann CLA 2016-01-29 14:58:55 EST
@Mateusz, do you think this qualifies as a duplicate of bug 475746?
Comment 3 Mateusz Matela CLA 2016-01-29 16:37:48 EST
(In reply to Stephan Herrmann from comment #2)
> @Mateusz, do you think this qualifies as a duplicate of bug 475746?

Well, identical stack trace and matching time frame suggest that this particular exception will almost certainly not occur with newer builds.

This bug report is more general though, isn't it? Ralf suggests that when a problem like that occurs in the formatter (or other components), the user should be able to send a report on it. I agree it may help catching more bugs.

I've seen some automated reports for exceptions from the formatter, so I'm not sure why it's not the case here. Maybe it's because the formatting was called from ASTRewrite which decided that failure at this point is not important enough, or maybe something has changed recently in this context.
Comment 4 Eclipse Genie CLA 2019-10-26 16:14:06 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.

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.