From: Sara S. <sar...@gm...> - 2014-05-16 03:04:00
|
Hello, I have a problem with the below Entry class. It compiles correctly using x10c++, but when I add it to the x10.lang package (<X10-SRC-DIR>/x10.runtime/src-x10/x10/lang) and try to compile X10 using *ant dist*, I get an error at the statement when I use the GlobalRef to access a remote Entry object. *The error is: Method or static constructor not found for given call.* Below is the Entry class, and a main method describing how I use it. How can I fix this error to get the class compiling as part of x10.lang package? class Entry{ private var name:String; private var parentEntryGR:GlobalRef[Entry]; //constructor for the parent:only the parent has a name public def this(var name:String){ this.name = name; } //constructor for the children, just pointing at the parent entry public def this(parentEntry:GlobalRef[Entry]){ this.parentEntryGR = parentEntry; } public def printParentEntryName(){ at(parentEntryGR) { Console.OUT.println(parentEntryGR().name); /*Error: Method or static constructor not found for given call.*/ } } public def getParentEntryGR():GlobalRef[Entry] = parentEntryGR; public def setParentEntryGR(var parentGR:GlobalRef[Entry]) {this.parentEntryGR = parentGR;} } //Test class public class TestGlobalRef { public static def main(val args:Rail[String]){ //create the parent entry at place 0 val parentEnt:Entry = new Entry("parent name"); val parentEntGR = GlobalRef[Entry](parentEnt); parentEnt.setParentEntryGR(parentEntGR); for (p in Place.places()) { at(p) { val entry:Entry; if (p.id != parentEntGR.home.id) entry = new Entry(parentEntGR); //create children Entries on other places else entry = at (parentEntGR) {parentEntGR()}; entry.printParentEntryName(); } } } } Thank you, Sara |