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

Bug 319100

Summary: Throw new RuntimeException ("This method has not been implemented yet"); instead of return null;
Product: [Eclipse Project] JDT Reporter: Lars Svensson <oxvalley>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, remy.suen
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Lars Svensson CLA 2010-07-07 06:36:07 EDT
Build Identifier: 

In Netbeans they have another approach whne you refactor->Extract Metod than in Eclipse:

Eclipse:
private String getString(){

// TODO auto-generated message stub
return null;
}

Netbeans:
private String getString(){

Throw new RuntimeException ("This method has not been implemneted yet");
}


I think the Netbeans way is better since it will compile but will automaticallyfail if you try to run this method. 

In Eclipse I sometimes forget to implemnet this method and can get strange errors since the method is actually working but most certain return a value I do not want.


Reproducible: Always
Comment 1 Lars Svensson CLA 2010-07-07 06:39:26 EDT
Yes, I know you can write your own Code Template that does this, but I am suggesting the default code template should do this...
Comment 2 Lars Svensson CLA 2010-07-07 06:52:21 EDT
Of Cource I ment selecting "Create new Method" from Lightbulb menu, not "Refactoring" to get this template method...sorry..
Comment 3 Dani Megert CLA 2010-07-28 08:46:01 EDT
Sorry, but we won't change the default. It is very practical that the generated code doesn't fail while filling in the code for all the generated code. And as you said: you can change this via template if you want. We actually also run code that has compile errors.