users@jaxb.java.net

RE: Re: minOccurs=maxOccurs=0 produces empty interface -- bug or feature?

From: Perry, Steve <Steve.Perry_at_fnf.com>
Date: Fri, 1 Apr 2005 12:40:10 -0600

Jon: my bad. The way your example was formatted on my display, coupled
with a poor decision to make only a cursory glance at it, resulted in my
comment. Sorry 'bout that.

I agree with you that generating an empty interface in this case is
incorrect. There should at least, as you say, be a getX/setX. Sounds
like maybe a bad boundary condition in the generator.

Kohsuke, Ryan: what do you guys think?

> -----Original Message-----
> From: jon gold [mailto:dev_at_samizdatdigital.org]
> Sent: Friday, April 01, 2005 12:18 PM
> To: users_at_jaxb.dev.java.net
> Subject: Re: minOccurs=maxOccurs=0 produces empty interface -- bug or
> feature?
>
> two things:
>
> 1. even if that was (see #2) an okay compiler optimization, it
shouldn't
> apply in this case -- even though "y" can never occur, "x" is declared
> to be mandatory and to occur one time, so there should at least be
getX
> and setX in the generated interface
>
> 2. i'd say that it's not a correct compiler optimization, regardless,
> since a FooType may itself (granted, it's not in my simple example
> below) be an extension of some other type, and it may be redefining
the
> "Y" element to not exist, but want to leave it open for further
subtypes
> to redefine it back in to existence. if the generated interface for
> FooType's supertype has getY/setY and then FooType doesn't, then a
> subtype of FooType can't redefine the cardinality of "y" without
> breaking the java interface inheritance chain.
>
> jon
>
> Perry, Steve wrote:
> > Maybe, if something can never occur, what's the point in generating
code
> > for it?
> >
> >
> >>-----Original Message-----
> >>From: jon gold [mailto:dev_at_samizdatdigital.org]
> >>Sent: Thursday, March 31, 2005 7:54 PM
> >>To: users_at_jaxb.dev.java.net
> >>Subject: minOccurs=maxOccurs=0 produces empty interface -- bug or
> >
> > feature?
> >
> >>i recently made a typo in a schema and accidentally set both
minOccurs
> >>and maxOccurs equal to 0 for an element in a sequence of a
> >
> > complexType,
> >
> >>let's say:
> >>
> >><complexType name="FooType">
> >> <sequence>
> >> <element name="x" type="string"/>
> >> <element name="y" type="string"
> >> minOccurs="0" maxOccurs="0"/>
> >> </...
> >></...
> >>
> >>and got an empty interface for FooType -- ie, no methods getX or
setX,
> >>even though they were defined to exist. is this a feature of schemas
> >
> > or
> >
> >>of xjc, or is it a bug?
> >>
> >>
> >>jon
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> >>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net