The Source for Java Technology Collaboration
User: Password:



Vincent Brabant

Vincent Brabant's Blog

MetaData existed before JDK 1.5

Posted by vbrabant on June 03, 2004 at 12:57 PM | Comments (3)

Look at definition of Metadata:
The J2SE 1.5 metadata feature is a facility that allows developers to annotate their code so that tools can generate boilerplate code (e.g stub generation to remote procedure calls) as directed by annotations.

And think about those interfaces: Serializable and Cloneable.

Those interfaces are empty.
They contains nothing.

But they are used to give directive to the compiler to generate the correct code.
They are working like metadata but are recognized directly by the compiler.

My questions are the following:
  • Will we see a javac that will recognize standard metatag and generate directly the .class file(s) as it recognizes now the Cloneable and Serializable, that are ancestors of metatag.
    Serializable and Cloneable metadata are implemented as interface. And then, they have a clear Javadoc page, explaining exactly their meaning, etc.
  • Can we do the same with metadata ? When I look at examples, I haven't yet seen it it possible. And I find it's a bad thing.
Vincent Brabant

Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Now it's 'Official' Metadata
    I believe that's exactly what is been done. Thos 'tagging' interfaces are *really* bad, as they brake the interface concept. Although we won't see Seriazable and others as annotations, that feature was created to provide what tagging interfaces do now.

    Posted by: pcalcado on June 03, 2004 at 01:22 PM

  • RE: MetaData existed before JDK 1.5
    About Serializable interface:
    This one handled by JVM, not by javac. It not metadata.

    About Clonable:
    By convention, classes that implement this interface should override clone method. If your class will not override protected method clone from Object, then i get Exception while comparison performed.

    So. MetaData and your sample is different things.

    In JDK 1.5 MetaData will and must handle by compiler (not only javac).

    Thanks!

    Posted by: aefimov on June 04, 2004 at 01:34 AM

  • I think you are mistaken.
    The concepts behind a tagging interface are conventions; nothing more. You know that you can override any method from protected to public and that you can override clone() without implementing the interface, right?

    The examples you gave are normal ways of working in any object oriented language; I have plenty of 'instanceof myInterface' in applications I write. Sometimes I call a method on it, sometimes I don't. Its nothing more then inheritance.

    Maybe you should think about the concept like this:
    Why is an exception extending RunTimeException different from one extending Exception ? Why is it different from Error ? Where does the concept of checked and unchecked come from in this inheritance tree?
    The answer is because its designed and implemented that way on quite a high level.

    Metadata is about more flexible, more changeable and many more instances of data being placed on objects.

    Oh, and your examples are class based; metadata is more fine grained; its method based. I suggest you re-read the doc you linked from a different perspective :-)

    Posted by: zander on June 04, 2004 at 01:30 PM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds