Ticket #112 (closed enhancement: fixed)
Improve signatures of some reflective methods
| Reported by: | stephan | Owned by: | stephan |
|---|---|---|---|
| Priority: | major | Milestone: | OTDT_1.1.10 |
| Component: | language | Version: | 1.1.9 |
| Keywords: | Cc: |
Description
Some reflective methods of class Team (defined in OTJLD §6.1.a) use Object in their signatures thus forcing clients to use casts for accessing role features.
Instead these methods should use type parameters to perform full type checking.
This is, what signatures should probably look like:
<T> T[] getAllRoles(Class<T> class_arg); <T> T getRole(Object aBase, Class<T>);
This will allow clients to write cast-free code like this:
team class MyTeam { protected class R playedBy B { void rm() {} } void test(B b) { R r= getRole(b, R.class); if (r != null) r.rm(); R[] rs= getAllRoles(R.class); if (rs.length > 0) rs[0].rm(); } }
Change History
Note: See
TracTickets for help on using
tickets.
all news
RSS feed