Relates :
|
|
Relates :
|
I originally filed this as JDK-6177893, repeated here: Date: Fri, 08 Oct 2004 16:38:18 -0700 From: Bill Shannon <###@###.###> In JavaMail the Transport class has a static "send" message and a non-static "sendMessage" method. A common error is to create your own Transport instance and then invoke the send method on the instance instead of the sendMessage method. I'd like javac to give me a warning when a static method is invoked on an instance. Seeing as how javac doesn't produce warnings by default, I assume this would be a lint-like warning that you would have to explicitly enable. I'd also like an annotation that I could apply to a static method that made it an error to invoke that method on an instance. Or, possibly this would just cause javac to produce this warning by default. ###@###.### 10/12/04 20:26 GMT The -Xlint:static option addresses the first part, but I'd still like the annotation that causes this warning (or better yet, failure) by default. (The people who make this mistake are not the type of people who use -Xlint.) The usage error with JavaMail described above still happens very frequently.