Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334077 - [QuickFix] Adding missing methods with UnsupportedOperationException as body
Summary: [QuickFix] Adding missing methods with UnsupportedOperationException as body
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-12 07:37 EST by Aaron Digulla CLA
Modified: 2011-01-24 05:29 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Digulla CLA 2011-01-12 07:37:26 EST
Build Identifier: 3.6.1

Please add an option to the QuickFix "Implement missing methods" that allows to generate the missing methods with a body that throws an UnsupportedOperationException.

That would make it much more safe to implement huge interfaces like ResultSet partially.

Reproducible: Always
Comment 1 Markus Keller CLA 2011-01-17 10:07:03 EST
You can configure the body of generated methods in Preferences > Java > Code Style > Code Templates. Edit "Method Body" and use a pattern like this:

// ${todo} Auto-generated method stub
throw new UnsupportedOperationException("${enclosing_method}");
${body_statement}
Comment 2 Aaron Digulla CLA 2011-01-21 22:32:50 EST
The workaround works for me, too. It's just a bit tedious to change the body all the time. Is it possible to change the UI so I can assign *several* templates and then select them in the quick fix?

Might be useful for other things as well, like when you work on different projects (say OSS ones and for your company). You probably don't want the EPL header in your company's sources...
Comment 3 Markus Keller CLA 2011-01-24 05:29:00 EST
(In reply to comment #2)
You can set project-specific code templates.