New feature in the eclipse compiler, please?
Warning when a class (or instance) variable is declared as not private and not final. Pretty please?
I'd pay to have that.
« Answer to the first question everyone asks about my new car | Main | Kind of a cute little bug »
Warning when a class (or instance) variable is declared as not private and not final. Pretty please?
I'd pay to have that.
Comments
If you'd pay to have that, I'd suggest you download yourself a copy of IDEA (www.intellij.com). You'll get that feature and a ton more not found in Eclipse.
Posted by: Anonymous | March 23, 2006 10:50 AM
"class varibale" --> I'm assuming that means a static variable? I'm sure CheckStyle could accomplish this(http://checkstyle.sourceforge.net), but I don't know how nicely it fits into eclipse. PMD (http://pmd.sourceforge.net) might have something too. I can't say for sure, but the AST eclipse has should make writing a plugin to perform this check fairly trivial. Of course, like you said, it'd be nice if the compiler could just provide the warning out the box ;-)
Posted by: tim | March 23, 2006 10:55 AM
Yah, I really meant both class and instance variables.
Posted by: kasia | March 23, 2006 11:00 AM
Okay.
Install PMD plugin for Eclipse.
Write an example of code that violates your rule.
Right click on the class in the package explorer, then select Generate AST (abstract syntax tree)
Open the AST file in XPath Explorer. Go find what the offending code equates to as an XPath expression.
Write an XPath rule, and stick it into a PMD ruleset file.
Import the PMD ruleset file into the PMD Eclipse plugin.
I've already done some custom rules, and you can see that it's not that hard to put together. :-)
http://tersesystems.com/code/?overview=pmd
Hope that helps.
Will.
Posted by: Will Sargent | March 25, 2006 09:40 PM
hi kasia, sorry for "spam-comment" but could you please awnser my email? would be great! greetings from switzerland :)
Posted by: Sven | March 28, 2006 06:43 AM
Hi, Kasia,
I've featured one of your blog posts verbatim (with attribution, of course) in my blog.
Here's the link:
http://www.bookofjoe.com/2006/04/geek_conference.html
I'm totally in agreement with you although the one commenter isn't.
Best,
Joe
http://www.bookofjoe.com
'World's most popular blogging anesthesiologist'
Posted by: Joe Stirt aka bookofjoe | April 7, 2006 07:22 AM