Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

annotations not following inheritance

Posts: 4686
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Bear's frontman, and have to classes, the top explicitly says "implements Command" and the subclass has the annotation.

public abstract class CommandBase implements Command {

public class ConfirmEmail extends CommandBase{

This fails at runtime, as FrontMan can't find a class that has the annotation and does the implementation.

To my eyes, this version is exactly the same, expect it explicitly includes the "implements Command" rather than just inheriting
that it does the "implements Command"

public class ConfirmEmail extends CommandBase implements Command {

Is this a bug in FrontMan? or my thinking? or something else?
Posts: 67289
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a "pseudo bug".

Java has no way of asking "please find all the classes that are annotated with such-and-such an annotation", so everyone kind of rolls their own, and I've yet to find a bullet-proof implementation. Apparently, it's not an easy problem as evidenced by the sounds of crickets when I asked how Hibernate does it.

The algorithm that FrontMan is currently using requires that the implements Command be on the class that posesses the annotation. If it's an extending class (something I also frequently do), you just need to remember to repeat the implements on the extended class.

I still search for a better way.
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are some implementation in Struts 2's convention plugin if you're interested; haven't looked at them myself. I assume you've seen the Bill Burke project ( for some info).
Won't you be my neighbor? - Fred Rogers. tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!