Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Objectteams » Problems with Brole playedBy Arole
Problems with Brole playedBy Arole [message #568060] Fri, 12 February 2010 12:06
Eugene Hutorny is currently offline Eugene Hutorny
Messages: 109
Registered: January 2010
Senior Member
Hi Stephan,

I've made some more experiments with OT/J and got some more questions.

My teams are declares as the following (complete source http://hutorny.in.ua/wp-content/uploads/2010/02/exer14.zip)

public team class Ateam {
public class Arole playedBy Aclass {
//...
}
}

public team class Bteam {
private final Ateam ateam;
public class Brole playedBy Arole<@ateam> {
//...
}
public Brole lift(Arole<@ateam> as Brole brole) {
return brole;
}
}

public team class Cteam extends Ateam {
public class Crole extends Arole playedBy Aclass {
}
}



For the following code compiler generates error: The method lift(Arole<@bteam.ateam>) in the type Bteam is not applicable for the arguments (Arole<@ateam>)


Arole<@ateam> arole = ateam.lift(aclass);
bteam.lift(arole);


How to make the type applicable?

The following code fails with class cast exception:

final Cteam cteam = new Cteam();
final Bteam dteam = new Bteam(cteam);

within(cteam) {
within(dteam) {
aclass.run();
}
}

Exception in thread "main" java.lang.ClassCastException: ua.in.hutorny.otj.exer14.Cteam$__OT__Crole
at ua.in.hutorny.otj.exer14.Bteam$__OT__Brole._OT$run$base(Btea m.java)
at ua.in.hutorny.otj.exer14.Bteam$__OT__Brole.run(Bteam.java:21 )
Previous Topic:OTDT 1.4.0M3 released
Next Topic:Problems with Brole playedBy Arole
Goto Forum:
  


Current Time: Mon Oct 20 18:17:23 GMT 2014

Powered by FUDForum. Page generated in 0.02788 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software