Subclassing using type parameters

59 views
Skip to first unread message

Simon Hicks

unread,
Oct 29, 2010, 2:43:25 AM10/29/10
to The Mirah Programming Language
Hi,

I'm trying to subclass an abstract class that requires type parameters
and I can't figure out the correct syntax for doing so in mirah. The
code I want to write would look something like this in Java

private class DownloadFilesTask extends AsyncTask<URL, Integer, Long>
{
protected Long doInBackground(URL url) {
long result = 0
//... do stuff here
return result;
}
}

The type parameters refer to the params, the type used for progress
reports and the final result. I can't find any code samples of people
trying to do something similar in mirah, and can't figure out what the
correct syntax for this is. For reference the AsyncTask class is
documented at http://developer.android.com/reference/android/os/AsyncTask.html

thanks,

Simon

Charles Oliver Nutter

unread,
Nov 1, 2010, 7:27:08 AM11/1/10
to mi...@googlegroups.com
Mirah does not yet support parameterized types (generics, type
parameters) but that really shouldn't matter; since the JVM erases
generic types at runtime, you should just be able to extend AsyncTask
without the type parameters.

You won't get the automatic casting that generics gives you, but you
should be able to proceed.

- Charlie

Reply all
Reply to author
Forward
0 new messages