<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: @Composite &#8211; Macro Annotations for Java</title>
	<atom:link href="http://blog.xebia.com/2009/06/23/composite-macro-annotations-for-java/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xebia.com/2009/06/23/composite-macro-annotations-for-java/</link>
	<description>Software development done right!</description>
	<lastBuildDate>Wed, 08 Feb 2012 14:41:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Andrew Phillips</title>
		<link>http://blog.xebia.com/2009/06/23/composite-macro-annotations-for-java/#comment-92313</link>
		<dc:creator>Andrew Phillips</dc:creator>
		<pubDate>Wed, 19 Aug 2009 15:42:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=2156#comment-92313</guid>
		<description>&lt;em&gt;@The sceptic&lt;/em&gt; Replacing three annotations on an element with a &quot;special&quot; annotation that contains those three annotations would indeed be rather pointless. However, it&#039;s not uncommon, to see a group of annotations repeated many times throughout a codebase. This aside from the potential benefits (and drawbacks, of course) of making the annotations runtime-configurable, for instance

&lt;em&gt;&gt; Sun/Java starts providing a preprocessor api&lt;/em&gt;
Something &lt;em&gt;in addition to&lt;/em&gt; the &lt;a href=&quot;http://java.sun.com/javase/6/docs/api/java/lang/instrument/package-summary.html&quot; target=&quot;_new&quot; rel=&quot;nofollow&quot;&gt;instrumentation API&lt;/a&gt;, or replacing it?

The SPI concept is interesting, and would certainly offer a much cleaner way of making the annotation system pluggable, i.e. integrating it with &quot;standard&quot; Java annotation reflection.</description>
		<content:encoded><![CDATA[<p><em>@The sceptic</em> Replacing three annotations on an element with a &#8220;special&#8221; annotation that contains those three annotations would indeed be rather pointless. However, it&#8217;s not uncommon, to see a group of annotations repeated many times throughout a codebase. This aside from the potential benefits (and drawbacks, of course) of making the annotations runtime-configurable, for instance</p>
<p><em>&gt; Sun/Java starts providing a preprocessor api</em><br />
Something <em>in addition to</em> the <a href="http://java.sun.com/javase/6/docs/api/java/lang/instrument/package-summary.html" target="_new" rel="nofollow">instrumentation API</a>, or replacing it?</p>
<p>The SPI concept is interesting, and would certainly offer a much cleaner way of making the annotation system pluggable, i.e. integrating it with &#8220;standard&#8221; Java annotation reflection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The sceptic</title>
		<link>http://blog.xebia.com/2009/06/23/composite-macro-annotations-for-java/#comment-92292</link>
		<dc:creator>The sceptic</dc:creator>
		<pubDate>Sun, 16 Aug 2009 13:01:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=2156#comment-92292</guid>
		<description>Hi Andrew,

sorry, but  I didn&#039;t get the point. You just started to provide a shortcut for the tedious task of writing annotation triples (see your motivation example) and you end up with a composite-wrapper that contains literaly exactly that three annotations requiring to type even more characters for the wrapping-stuff? &quot;Yes, you can&quot; save typing effort in cases were you only want to use defaults for the members of a composite...but in any other case using the composition scheme is no better than using the original source annotations. You might argue that in cases I want to change all occurences of a certain scheme than I just have to change the composite. Yes, true, but then I would argue that it&#039;s probably never going to happen if you work with a set of stable annotations. And even if there&#039;s change then I would rather favour a text-processing tool. What you really wanted to do was to provide a c-style preprocessor, but disgiused it in some strange annotation scheme. I guess ant is capable of doing preprocessing stuff...
As I am &quot;The sceptic&quot; I have been waiting ever since annotations arrived for the first projects doing funny stuff with it: Now here&#039;s another example. When is &quot;jakarta commons annotations&quot; going to arrive, which is the (meta) annotation wrapper  (like this wrapper for logging frameworks...). And I like the Meta-Annotations of webbeans or what was the name of the next big thing. What I wanted to say with this rant is that you should concider using the right tool for a task, in oyur case a (macro) preprocessor...

My suggstions:
1.) Sun/Java starts providing a preprocessor api (I don&#039;t get the point why anybody refuses to concider a preprocessor, but any other funny stuff is discussed in epic breadth and blind enthusiasm, for instance making java functional...)

2.) The Java framework itself should provide a plugable SPI-API for resolving annotations. Annotations should be allowed to have any number of arguments. A Resolver-SPI-Plugin (SPI function) could analyze the source annotations and provide an interpretation/tranformation into a target set. We would require

2.1 Declaration
@AnnotationBlaBla
@AnnotationSPI(id=FunnyMapper)
public @interface FunnyInterpretedAnnotation {
   String useCaseID;
   AnnotaionParamList nameValueVarargs;
}

2.2 How to use the Annotation
@FunnyInterpretedAnnotation(UseCaseID=&quot;Bond&quot;)
Agent ofYourMajesty;

2.3 The SPI trafo function
function: SPI( @FunnyInterpretedAnnotation(UseCaseID=&quot;Bond&quot;) ) -&gt; { @NotNull, @CodeNumber(&quot;007&quot;), @Clearance(&quot;Clarence&quot;) }

2.4 SPI function configuration
And then we need some sort of configuration, mapping UseCaseIDs into sets of target annotations...well let&#039;s use xml for that. Oh, wait a minute! annotations were invented partially to overcome xml-hell. Well, seems to be a silly suggeestion then...</description>
		<content:encoded><![CDATA[<p>Hi Andrew,</p>
<p>sorry, but  I didn&#8217;t get the point. You just started to provide a shortcut for the tedious task of writing annotation triples (see your motivation example) and you end up with a composite-wrapper that contains literaly exactly that three annotations requiring to type even more characters for the wrapping-stuff? &#8220;Yes, you can&#8221; save typing effort in cases were you only want to use defaults for the members of a composite&#8230;but in any other case using the composition scheme is no better than using the original source annotations. You might argue that in cases I want to change all occurences of a certain scheme than I just have to change the composite. Yes, true, but then I would argue that it&#8217;s probably never going to happen if you work with a set of stable annotations. And even if there&#8217;s change then I would rather favour a text-processing tool. What you really wanted to do was to provide a c-style preprocessor, but disgiused it in some strange annotation scheme. I guess ant is capable of doing preprocessing stuff&#8230;<br />
As I am &#8220;The sceptic&#8221; I have been waiting ever since annotations arrived for the first projects doing funny stuff with it: Now here&#8217;s another example. When is &#8220;jakarta commons annotations&#8221; going to arrive, which is the (meta) annotation wrapper  (like this wrapper for logging frameworks&#8230;). And I like the Meta-Annotations of webbeans or what was the name of the next big thing. What I wanted to say with this rant is that you should concider using the right tool for a task, in oyur case a (macro) preprocessor&#8230;</p>
<p>My suggstions:<br />
1.) Sun/Java starts providing a preprocessor api (I don&#8217;t get the point why anybody refuses to concider a preprocessor, but any other funny stuff is discussed in epic breadth and blind enthusiasm, for instance making java functional&#8230;)</p>
<p>2.) The Java framework itself should provide a plugable SPI-API for resolving annotations. Annotations should be allowed to have any number of arguments. A Resolver-SPI-Plugin (SPI function) could analyze the source annotations and provide an interpretation/tranformation into a target set. We would require</p>
<p>2.1 Declaration<br />
@AnnotationBlaBla<br />
@AnnotationSPI(id=FunnyMapper)<br />
public @interface FunnyInterpretedAnnotation {<br />
   String useCaseID;<br />
   AnnotaionParamList nameValueVarargs;<br />
}</p>
<p>2.2 How to use the Annotation<br />
@FunnyInterpretedAnnotation(UseCaseID=&#8221;Bond&#8221;)<br />
Agent ofYourMajesty;</p>
<p>2.3 The SPI trafo function<br />
function: SPI( @FunnyInterpretedAnnotation(UseCaseID=&#8221;Bond&#8221;) ) -&gt; { @NotNull, @CodeNumber(&#8220;007&#8243;), @Clearance(&#8220;Clarence&#8221;) }</p>
<p>2.4 SPI function configuration<br />
And then we need some sort of configuration, mapping UseCaseIDs into sets of target annotations&#8230;well let&#8217;s use xml for that. Oh, wait a minute! annotations were invented partially to overcome xml-hell. Well, seems to be a silly suggeestion then&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Phillips</title>
		<link>http://blog.xebia.com/2009/06/23/composite-macro-annotations-for-java/#comment-91957</link>
		<dc:creator>Andrew Phillips</dc:creator>
		<pubDate>Fri, 26 Jun 2009 21:25:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=2156#comment-91957</guid>
		<description>&lt;em&gt;@fuzebest&lt;/em&gt; &quot;abandoned&quot; is perhaps an unfortunate choice of phrase - it was intentionally not considered for a number of reasons, chief among which is that it would limit factory classes to once again essentially producing static annotations. The &quot;leaf&quot; annotation(s) would namely have to be generated at the moment the bytecode were instrumented, as opposed to when the lookup is made.

But it is definitely an avenue worth pursuing, and certainly a possibility with regard to trying to integrate composite annotations with existing code.</description>
		<content:encoded><![CDATA[<p><em>@fuzebest</em> &#8220;abandoned&#8221; is perhaps an unfortunate choice of phrase &#8211; it was intentionally not considered for a number of reasons, chief among which is that it would limit factory classes to once again essentially producing static annotations. The &#8220;leaf&#8221; annotation(s) would namely have to be generated at the moment the bytecode were instrumented, as opposed to when the lookup is made.</p>
<p>But it is definitely an avenue worth pursuing, and certainly a possibility with regard to trying to integrate composite annotations with existing code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fuzebest</title>
		<link>http://blog.xebia.com/2009/06/23/composite-macro-annotations-for-java/#comment-91952</link>
		<dc:creator>fuzebest</dc:creator>
		<pubDate>Fri, 26 Jun 2009 08:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=2156#comment-91952</guid>
		<description>why did you abandon the idea of bytecode or runtime instrumentation?
Nowadays it is nothing wrong with it.</description>
		<content:encoded><![CDATA[<p>why did you abandon the idea of bytecode or runtime instrumentation?<br />
Nowadays it is nothing wrong with it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Phillips</title>
		<link>http://blog.xebia.com/2009/06/23/composite-macro-annotations-for-java/#comment-91937</link>
		<dc:creator>Andrew Phillips</dc:creator>
		<pubDate>Tue, 23 Jun 2009 09:12:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=2156#comment-91937</guid>
		<description>&lt;strong&gt;NB:&lt;/strong&gt; Trying to build this on a few different machines has thrown up some unexpected test failures in &lt;a href=&quot;http://code.google.com/p/aphillips/source/browse/at-composite/trunk/src/test/java/com/qrmedia/pattern/compositeannotation/validation/CompositeAnnotationValidationProcessorTest.java&quot; target=&quot;_new&quot; rel=&quot;nofollow&quot;&gt;CompositeAnnotationValidationProcessorTest&lt;/a&gt;. This uses the Java Compiler API and doesn&#039;t appear to be exactly bullet-proof yet - the tests in this class can be &lt;tt&gt;@Ignore&lt;/tt&gt;d, and I&#039;ll try to figure out what&#039;s going on asap.

Also, running &lt;tt&gt;eclipse:eclipse&lt;/tt&gt; or &lt;tt&gt;eclipse:m2eclipse&lt;/tt&gt; against the project will leave you with a

&lt;tt&gt;&lt;classpathentry kind=&quot;src&quot; path=&quot;src/test/java/com/qrmedia/pattern/compositeannotation/validation/sample&quot; output=&quot;target/test-classes/com/qrmedia/pattern/compositeannotation/validation/sample&quot; excluding=&quot;**/*.java&quot;/&gt;&lt;/tt&gt;

entry in your &lt;tt&gt;.classpath&lt;/tt&gt;. This is a (seemingly unavoidable) result of the way the test resources are configured in the POM - again, required for the validation processor tests - and needs to be removed.
Or right-click on the source folder in Eclipse and select &lt;tt&gt;Build Path -&gt; Remove from Build Path&lt;/tt&gt;.</description>
		<content:encoded><![CDATA[<p><strong>NB:</strong> Trying to build this on a few different machines has thrown up some unexpected test failures in <a href="http://code.google.com/p/aphillips/source/browse/at-composite/trunk/src/test/java/com/qrmedia/pattern/compositeannotation/validation/CompositeAnnotationValidationProcessorTest.java" target="_new" rel="nofollow">CompositeAnnotationValidationProcessorTest</a>. This uses the Java Compiler API and doesn&#8217;t appear to be exactly bullet-proof yet &#8211; the tests in this class can be <tt>@Ignore</tt>d, and I&#8217;ll try to figure out what&#8217;s going on asap.</p>
<p>Also, running <tt>eclipse:eclipse</tt> or <tt>eclipse:m2eclipse</tt> against the project will leave you with a</p>
<p><tt>&lt;classpathentry kind="src" path="src/test/java/com/qrmedia/pattern/compositeannotation/validation/sample" output="target/test-classes/com/qrmedia/pattern/compositeannotation/validation/sample" excluding="**/*.java"/&gt;</tt></p>
<p>entry in your <tt>.classpath</tt>. This is a (seemingly unavoidable) result of the way the test resources are configured in the POM &#8211; again, required for the validation processor tests &#8211; and needs to be removed.<br />
Or right-click on the source folder in Eclipse and select <tt>Build Path -> Remove from Build Path</tt>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wilfred Springer</title>
		<link>http://blog.xebia.com/2009/06/23/composite-macro-annotations-for-java/#comment-91936</link>
		<dc:creator>Wilfred Springer</dc:creator>
		<pubDate>Tue, 23 Jun 2009 08:59:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/?p=2156#comment-91936</guid>
		<description>Totally cool. I&#039;m just wondering if it would be possible to have a general purpose LeafAnnotationFactory that&#039;s built on top of some sort of EL. (Which would pull the derivation rule back into an annotation attribute.)</description>
		<content:encoded><![CDATA[<p>Totally cool. I&#8217;m just wondering if it would be possible to have a general purpose LeafAnnotationFactory that&#8217;s built on top of some sort of EL. (Which would pull the derivation rule back into an annotation attribute.)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.xebia.com/2009/06/23/composite-macro-annotations-for-java/feed/ ) in 0.54902 seconds, on Feb 9th, 2012 at 8:04 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 9th, 2012 at 9:04 pm UTC -->
