Invalid ejbPostCreate% Definitions in Entity-Beans

This query determines all the ejbPostCreate% methods of an entity-bean that do not follow the specification rules.

Pre-packaged Query

Query name="Semmle/StyleChecks/J2EE/Entity-Bean/Check ejbPostCreate%(..) methods' definition"

Reports all Entity-Bean types that contain ejbPostCreate%(..) methods that are not public, or that are final or static or that do not have a return type void.

from EntityBean ebean, Method m
where m.getName().matches("ejbPostCreate%") and
      ebean.inherits(m) and
      (not(m.hasModifier("public")) or 
       m.hasModifier("final") or 
       m.hasModifier("static") or
       not(m.getType().hasName("void")))
select m, m.toString() + " must be public, not final, not static"
                       + " and have the return type void"

References

Enterprise JavaBeans 2.1 - Specification, section 10.6.5 and 12.2.4

Digg!Reddit!Del.icio.us!Facebook!Slashdot!Technorati!StumbleUpon!Ma.gnolia!

Comments
Only registered users can write comments!
 
< Prev   Next >