It's not a good idea, I promise you. iContract does the job very very well already. -And it implements a subset of OQL, with quantifiers like forall, exists and implies. XDoclet (or any other doclet) doesn't give you access to the source code of the classes being scanned, so you'd have to implement some pretty fancy parsing (JavaCC or ANTLR) to mix the code from the javadoc into the class' code. You'd even have to parse (JavaCC or ANTLR again) the assertion expressions (at least if you want to do anything fancy like iContract). It would be a huge job, and I don't see the point in reinventing the wheel anew.
-And nothing stops you from using iContract with XDoclet. See http://www.reliable-systems.com/tools/iContract/iContract.htm http://www.javaworld.com/javaworld/jw-02-2001/jw-0216-cooltools.html for more info about iContract. Cheers, <aslak/> > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of David > Sitsky > Sent: 17. oktober 2001 02:06 > To: [EMAIL PROTECTED] > Subject: Re: RE: [Xdoclet-devel] Re: [Xdoclet-user] xdoclet for JUnit? > > > On Tuesday 16 October 2001 03:02, [EMAIL PROTECTED] wrote: > > Not quite. iContract preprosesses code with @pre @post and @invariant > > tags and converts it to java code which is then inserted into the class > > itself. > > > > Basically it would take this code > > > > /** > > * @pre celcius > -273.15 > > */ > > public double convertCelciusToFahrenheit( double celcius ) { > > return 9.0/5.0 * celcius + 32.0; > > } > > > > and produce this code: > > > > public double convertCelciusToFahrenheit( double celcius ) { > > if( !(celcius > -273.15 ) ) { > > throw new Error( "precondition failed" ); > > } > > return 9.0/5.0 * celcius + 32.0; > > } > > Just out of interest, could this be done easily with XDoclet? > What do the > developers think would be the best way of implementing it? From a > developer point of view, if I define a class called ExampleClass, > then XDoclet should generate a new version of ExampleClass with the @pre, > @post and @invariant code in there. > > Clients using ExampleClass shouldn't be aware or care if it has contract > enforcement code in there. > > Cheers, > David > > _______________________________________________ > Xdoclet-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/xdoclet-devel _______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
