Jim,
Here's an update: this issue has been fixed in SVN HEAD and in the 1.7
branch. The 1.7.6 release and the subsequent trunk releases will
contain the fix.
Igor
Igor Peshansky/Watson/i...@ibmus wrote on 07/22/2009 07:55:42 PM:
> Jim LaGrone <[email protected]> wrote on 07/22/2009 11:22:52 AM:
>
> > I'm trying to use the following to read input from a text file
> >
> > ============================
> > import x10.io.Console;
> > import x10.util.*;
> > import x10.io.*;
> >
> > public class Tester {
> > public static def main(args:Rail[String]) {
> > try {
> > val inputFile = new File("./param_file.txt");
> > val input = inputFile.openRead();
> >
> > for( l in input.lines()) {
> > Console.OUT.println(l);
> > }
> > } catch(e:IOException) {
> > Console.OUT.println("Problem:");
> > e.printStackTrace(Console.ERR);
> > }
> > }
> > }
> > =====================================
> >
> > but receive the following
> >
> > =====================================
> >
> > $ x10 Tester
> > java.lang.ClassCastException
> > at x10.io.ReaderIterator$1.cast(ReaderIterator.java:123)
> > at x10.io.ReaderIterator.next(ReaderIterator.java:128)
> > at Tester.main(Tester.java:89)
> > at Tester$Main$1.apply(Tester.java:48)
> > at x10.runtime.Activity.now(Activity.java:214)
> > at x10.runtime.Activity.run(Activity.java:131)
> > at x10.runtime.Worker$3.apply(Worker.java:308)
> > at x10.runtime.impl.java.Runtime.runAt(Runtime.java:96)
> > at x10.runtime.Worker.loop(Worker.java:303)
> > at x10.runtime.Runtime.start(Runtime.java:141)
> > at Tester$Main.main(Tester.java:35)
> > at x10.runtime.impl.java.Runtime.run(Runtime.java:46)
> > at java.lang.Thread.run(Thread.java:613)
> >
> > =====================================
> >
> > Any suggestions?
>
> Hi, Jim,
>
> Thank you for using X10.
>
> You have encountered an X10 typechecker bug that manifests as
> invalid code generated by the Java backend. I've opened a JIRA
> issue for this: http://jira.codehaus.org/browse/XTENLANG-473 .
> Note that this issue only affects the Java backend - your code
> works fine in the C++ backend.
>
> In the meantime, you can work around this problem by replacing
> your for loop with the following:
>
> try {
> while (true) {
> val l = input.readLine();
> Console.OUT.println(l);
> }
> } catch(e:EOFException) { }
>
> This essentially inlines the code of ReaderIterator, and should
> work even after the above bug is fixed.
>
> In the future, if you encounter a problem that looks like a bug,
> please open a JIRA issue with a test case. This would make it
> easier for us to track the problem and provide a fix.
>
> Thanks,
> Igor
--
Igor Peshansky (note the spelling change!)
IBM T.J. Watson Research Center
XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/)
X10: Parallel Productivity and Performance (http://x10.sf.net/)
------------------------------------------------------------------------------
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users