In Eclipse, how do I change the default modifiers in the class/type template?
coding-style, eclipse, java, templates
Solution
Looks like it is not possible. The `${type_declaration}` is internal stuff.
What you can do is to click everytime the final checkbox in the "New Java Class"-Dialog. But that's not something you want to.
Problem
Eclipse's default template for new types (Window > Preferences > Code Style > Code Templates > New Java Files) looks like this: ``` ${filecomment} ${package_declaration} ${typecomment} ${type_declaration} ``` Creating a new class, it'll look something like this: ``` package pkg; import blah.blah; public class FileName { // Class is accessible to everyone, and can be inherited } ``` Now, I'm fervent in my belief that access should be as restricted as possible, and inheritance should be forbidden unless explicitly permitted, so I'd like to change the `${type_declaration}` to declare all classes as `final` rather than `public`: ``` package pkg; import blah.blah; final class FileName { // Class is only accessible in package, and can't be inherited } ``` That seems easier said than done. The only thing I've found googling is a 2004 question on Eclipse's mailing list which was unanswered. So, the question in short: How can I change the default class/type modifiers in Eclipse? I'm using Eclipse Galileo (3.5) if that matters.