Enabling generics for MDR-generated interfaces

View: New views
1 Messages — Rating Filter:   Alert me  

Enabling generics for MDR-generated interfaces

by John V. Sichi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmmm, getting quiet around here.  Time to stir things up...

In regard to

http://mdr.netbeans.org/servlets/ReadMsg?list=users&msgNo=3377

I did an experiment and hand-edited the generated interfaces to
uncomment the generic collection return types which MDR generates in
commented-out form.  Then I wrote some enhanced-for loops to use them
typesafely.  And you know what?  It works!  Three cheers for
type-erasure.  So, if you can live without strict JMI 1.0 compliance,
give it a try.

Here's an ant macro which can be used to postprocess the output of the
code generator:

   <macrodef name="uncommentMdrGenerics">
     <attribute name="javadir" default="/unspecified/path"/>
     <sequential>
       <replace dir="@{javadir}">
         <replacefilter token="/*<" value="<" />
         <replacefilter token=">*/" value=">" />
       </replace>
     </sequential>
   </macrodef>

JVS
LightInTheBox - Buy quality products at wholesale price