Re: avalon-meta Plugin and Java 5.0

"Raffael Herzog" <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.user
Organization Organised? Me?
Message-ID <[email protected]>
On Wed, 15 Sep 2004 13:12:06 +0200, Stephen McConnell  
<[email protected]> wrote:

>> -----Original Message-----
>> From: news [mailto:[email protected]] On Behalf Of Raffael Herzog
>> Sent: 15 September 2004 12:13
>> To: [email protected]
>> Subject: avalon-meta Plugin and Java 5.0
>>
>> [Parse errors with Java5 constructs in avalon-meta-plugin-1.4]
>
> The difference between theory and practice is a patch!
>
> Any chance you could:
>
> a) provide details of the 1.5 issues
> b) provide a 1.3-1.5 complaint patch
>
> Either option will be highly appreciated ((b) more than (a) but (a)'s
> still an interesting scenario).

OK, I'll go for (a) because looking deeper into it, I saw that the problem  
is actually within QDox and has nothing to do with the avalon-meta plugin  
itself.

First I edited project.xml to use QDox 1.5 instead of 1.3, because I saw  
that 1.5 supports parsing of generics in the change log. I was hoping that  
the change log was just incomplete, but unfortunately, I was wrong.

So, these are my observations (using QDox 1.5):

1. Annotations:

@JMXDomain(value="MyDefaultDomain")
@JMXProperties(value={"type=Generator"})
public class Generator
     implements Serviceable,
                Configurable,
                Initializable,
                Disposable,
                MBeanable,
                GeneratorMBean

-> Parse error

2. Varargs:

public void setDescription(String description,
                            XResourceBundle bundle,
                            Object... args)
{
    this.description = new StringHolder(description, bundle, args);
}

-> Parse error

3. Enhanced for-loop:

for ( int i: new int[] { 1, 2, 3 } ) {
     System.out.println(i);
}

-> OK

4. Generics:

private List<String> l = new ArrayList<String>();

-> OK

5. Type-safe enumerations:

public enum Severity { DEBUG, INFO, WARNING, ERROR }

-> OK

I didn't test autoboxing/unboxing and static imports as they definitely  
should not pose any problem to the parser.

It seems like we'll have to wait for the next QDox release which will  
hopefully be able to handle the offending constructs. Another option would  
be to move the avalon-meta-plugin to XDoclet because this one uses the  
doclet API and should therefore work nicely with Java5 sources (assuming  
that the JavaDoc API is backwards compatible and the current JavaDoc  
parser is able to handle Java5 sources :). However, I don't think that  
Java will undergo such profound syntax changes in the near future again,  
so it would probably not be worth the trouble of moving the plugin to a  
different framework.

cu,
    Raffi

-- 
The difference between theory and practice is that in theory, there is no  
difference, but in practice, there is.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.