Bug 15330 NPE with quickfix
build 0425 JButton desktop=new JButton("Hintergrund"); desktop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JDesktopPane pane=SwingUtilities<ERROR>(JDesktopPane.class,this); } }); <ERROR> it should be SwingUtilities.getAnchestorOfClass Of course the above code snippet produceed an error and quickfix notified to have an idea. I pressed ctrl+1 and got informed it could create a method, short after that a NPE occured. org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.StringIndexOutOfBoundsException: String index out of range: 0) at org.eclipse.swt.SWT.error(SWT.java:1887) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:96) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1389) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1211) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:833) at org.eclipse.ui.internal.Workbench.run(Workbench.java:816) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:643) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:349) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:160) at org.eclipse.core.launcher.Main.run(Main.java:548) at org.eclipse.core.launcher.Main.main(Main.java:403) *** Stack trace of contained exception *** java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:516) at org.eclipse.jdt.internal.corext.codemanipulation.NameProposer.proposeParameterNa me(NameProposer.java:87) at org.eclipse.jdt.internal.ui.text.correction.NewMethodCompletionProposal.getParam eterNames(NewMethodCompletionProposal.java:199) at org.eclipse.jdt.internal.ui.text.correction.NewMethodCompletionProposal.generate Stub(NewMethodCompletionProposal.java:139) at org.eclipse.jdt.internal.ui.text.correction.NewMethodCompletionProposal.addEdits (NewMethodCompletionProposal.java:91) at org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal.getChange (CUCorrectionProposal.java:58) at org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal.getCompilationU nitChange(CUCorrectionProposal.java:132) at org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal.getAdditionalPr oposalInfo(CUCorrectionProposal.java:74) at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformation (AdditionalInfoController.java:185) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation (AbstractInformationControlManager.java:536) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run (AdditionalInfoController.java:145) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:29) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:93) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1389) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1211) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:833) at org.eclipse.ui.internal.Workbench.run(Workbench.java:816) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:643) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:349) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:160) at org.eclipse.core.launcher.Main.run(Main.java:548) at org.eclipse.core.launcher.Main.main(Main.java:403)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/NewMethodCompletionProposal.java
import org.eclipse.swt.graphics.Image;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.corext.codemanipulation.ImportEdit;
import org.eclipse.jdt.internal.corext.codemanipulation.MemberEdit;
import org.eclipse.jdt.internal.corext.codemanipulation.NameProposer;
import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
import org.eclipse.jdt.internal.corext.dom.Bindings;
import org.eclipse.jdt.internal.corext.refactoring.changes.CompilationUnitChange;
import org.eclipse.jdt.internal.corext.textmanipulation.TextRange;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
public class NewMethodCompletionProposal extends CUCorrectionProposal {