Proxygen C#.net "List" class

417 views
Skip to first unread message

Frank Vhh

unread,
Jul 8, 2011, 9:16:11 AM7/8/11
to jni4net
Hi all,

We are using jni4net 0.8.3.0 to generate java proxies from C# classes.
These C# classes contains List objects. I was under the impression
that proxygen could handle these. In the generated files, however, all
List objects are converted to System.Object in stead of f.e.
java.util.List.

Is there any way to fix this?

Thanks a lot.

Regards,
Frank

Pavel Šavara

unread,
Jul 8, 2011, 9:20:10 AM7/8/11
to jni...@googlegroups.com
List is generic class on C# side.
Generics are not yet supported, it would take proxygen rework I'm
working on now.
If you could change the C# side, try to use nongeneric
System.Collections.IList instead

> --
> You received this message because you are subscribed to jni...@googlegroups.com
> http://groups.google.com/group/jni4net?hl=en-GB?hl=en-GB
> http://jni4net.sf.net/
>

Frank Vanhoenshoven

unread,
Jul 8, 2011, 9:48:20 AM7/8/11
to jni...@googlegroups.com
Yes, we can. :-)

Tx!

> Date: Fri, 8 Jul 2011 15:20:10 +0200
> Subject: Re: [jni4net] Proxygen C#.net "List" class
> From: pavel....@gmail.com
> To: jni...@googlegroups.com

Frank Vanhoenshoven

unread,
Jul 11, 2011, 5:46:18 AM7/11/11
to jni...@googlegroups.com
Hi all,

Does using system.colections.ILIst imply that we are bound to cast all our objects inside the IList to be able to use them on java-side?

f.e.
Person frank = (Person) personList.getItem(2);
String str = (String) stringList.getItem(2);
int value = (Integer) intList.getItem(2);

I am having problems casting from and to String, which forces me to use 2 intermediate classes, being system.Object and java.lang.Object. Is this correct or are there easier solutions?

Thanks a lot.

With kind regards,
Frank
Kind regards en nog vriendelijke groeten ook,

Frank Vanhoenshoven

Technical Consultant
AGServ
Kievermondeveld 87
2440 Geel, Belgium



frank.van...@agserv.eu
+32(0)484932129

Pavel Šavara

unread,
Jul 11, 2011, 5:59:09 AM7/11/11
to jni...@googlegroups.com
Yes, remember how was it in Java 1.4 and .NET 1.1 ?
You have the same thing with jni4net 0.8.x.
No generics (yet)

You could create or reuse specialized collections which are strongly
typed (hardcoded) for particullar type.
Something like System.Collections.Specialized.StringCollection on CLR
side. You have to generate Java proxy for that yourself.

Also make sure you understand that
java.lang.String and System.String are different beasts :)

Pavel

Jose Machicado

unread,
Jan 21, 2015, 1:02:13 PM1/21/15
to jni...@googlegroups.com
Pavel, is it possible to generate jar libs compatible with jre 1.4 environments? I've tried with jni4net 0.8.8.0 but it generates a jar that requires java 1.6.

Thanks

Pavel Šavara

unread,
Jan 21, 2015, 1:41:58 PM1/21/15
to jni...@googlegroups.com

I never tried.

--
---
You received this message because you are subscribed to the Google Groups "jni4net" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jni4net+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages