Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » -----------------------
----------------------- [message #759301] Mon, 28 November 2011 10:15 Go to next message
Elmar Chen is currently offline Elmar Chen
Messages: 2
Registered: October 2011
Junior Member
--deleted--

[Updated on: Mon, 28 November 2011 10:17]

Report message to a moderator

Re: How to prevent eclipse generating return statement for auto generated method? [message #759349 is a reply to message #759301] Mon, 28 November 2011 13:14 Go to previous message
Deepak Azad is currently offline Deepak Azad
Messages: 545
Registered: July 2009
Senior Member
On 11/28/2011 3:45 PM, Elmar Chen wrote:
> When I create a class that implements an interface (or extends an
> abstract class), IDE will generate a stub for those abstract methods. By
> default, the non-void method would look like this:
> public boolean foo() {
> // TODO Auto-generated method stub
> return false;
> }
> Now, I want the IDE would generate a method like this:
> public boolean foo() {
> // TODO Auto-generated method stub
> throw new RuntimeException("not implemented yet.");
> }
> I tried to modify the code template, it dose generate the throw
> statement. But it also generate the return statement.
> Is there any way taht can stop eclipse from generating the return
> statemnet?

Change the 'method body' template to the following, the return statement
is not generated with this

// ${todo} Auto-generated method stub
throw new RuntimeException("not implemented yet.");

--
Deepak Azad
http://wiki.eclipse.org/JDT/FAQ
Previous Topic:How to Resolve JDT Conflicting Dependencies?
Next Topic:ASTVisitor - geting line number of MethodDeclaration
Goto Forum:
  


Current Time: Sat Oct 25 03:39:44 GMT 2014

Powered by FUDForum. Page generated in 0.01681 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software