-
Enhancement
-
Resolution: Duplicate
-
P4
-
5.0
-
generic
-
generic
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
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
- duplicates
-
JDK-4880220 Add a warning when accessing a static method via an reference
-
- Closed
-
- relates to
-
JDK-8024820 need annotation that causes compiler to complain when invoking static methods through instance variables
-
- Closed
-