Hi, As you wrote, Managed-X10 compiles Rail[T] to x10.core.Rail<"Java representation of T">, and you are asking why it is not T[].
If you look at the implementation of x10.core.Rail class, you will find that it has three fields: value, length, type. At runtime, "value" holds a Java array object where the contents of the Rail are stored. In order to store primitive types (e.g. Java int) without boxing, the declared type of value field is Object instead of Object[]. "type" has the runtime type (RTT) information of the contents of the Rail. It is used to cast value field to the actual Java array type (e.g. int[]), and to implement runtime type checking such as cast from Any or instanceof operator. x10.core.Rail class is used to represent contents and meta data such as RTT as a single object. If you carefully look at the generated Java code, X10 main method takes "final x10.core.Rail<java.lang.String> args". You can access the value field by calling getBackingArray() method. For your second question, x10.jar should include x10.core.Rail class. Please check your jar file with the following command. And please add x10.jar to the classpath of both compile-time and runtime. >jar tvf x10.jar | grep x10/core/Rail.class 8547 Fri Jun 11 11:02:46 JST 2010 x10/core/Rail.class If you have further question, please let us know. Regards, - Mikio 2010/7/8 Tetsu Soh <tetsu.soh....@gmail.com>: > Hello everyone, > > First of all, sorry for posting this question on both developers and > users list. > > I have a question on accessing array object through native java code > integration feature which is available in version 2.0.4. > Hope you can help out there. > > I have following X10 code: > > @Native("java", "Stub.send(#1, #2)") > static native def send(recv:String, args:Rail[Any]):Any; > > And after compile the code, I get following Java code: > > native static java.lang.Object > send( > final java.lang.String recv, > final x10.core.Rail<java.lang.Object> args); > > Please notice that the Rail[Any] in X10 is converted to > x10.core.Rail<java.lang.Object> in Java. > It means at the runtime the X10 code expect a Java method with > x10.core.Rail as parameter. > > Is it appropriate code generation? > IMHO, the Rail object should be convert to an array in Java, just like > the Rail[String] parameter in X10 main method is translated to String[] > object. > > Well, if the above code generation is correct, > how can I create a corresponding Java method that uses the x10.core.Rail > object in java? > I had tried to compile such Java code with X10 runtime library > (X10_HOME/lib/x10.jar) but failed. > > Thanks in advanced. > -Tetsu > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > X10-users mailing list > X10-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/x10-users > ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users