Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #25613
| Path | csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Daniele Futtorovic <da.futt.news@laposte.net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: limitations on using enum as generic parameter |
| Date | Tue, 08 Feb 2011 20:33:37 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 18 |
| Message-ID | <iis5qe$6o3$1@news.eternal-september.org> (permalink) |
| References | <76e9be77-f846-4559-82ec-1d774a8a6a0b@q36g2000yqn.googlegroups.com> <4d518f96$1@news.x-privat.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Tue, 8 Feb 2011 19:33:34 +0000 (UTC) |
| Injection-Info | mx01.eternal-september.org; posting-host="/vAN9LwPLXAylUBw+QRt4g"; logging-data="6915"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18nygek88IhrMbZ2yt8Wcrb" |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 |
| In-Reply-To | <4d518f96$1@news.x-privat.org> |
| Cancel-Lock | sha1:wvyrm403pvTI7JlPG8XmSixQcIM= |
| Xref | csiph.com comp.lang.java.programmer:25613 |
Show key headers only | View raw
On 08/02/2011 19:46, Ken Wesson allegedly wrote:
> On Tue, 08 Feb 2011 09:50:32 -0800, dalamb@cs.queensu.ca wrote:
>
>> Is there any way around this, or is there just no way to refer to an
>> enum's values() method when the enum is a generic parameter?
>>
>> public EnumCodeSet() {
>> enums = E.values();
>> }
>
> That's not going to work. It's a static method of a class that isn't
> determined at this point in the code, so the compiler simply has no clue
> what to call. Hence the error message.
>
> If you really need to do something like this, you'll need to use
> reflection on a class object.
For the record: no. See my and ninja markspace's replies.
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar
Re: limitations on using enum as generic parameter Daniele Futtorovic <da.futt.news@laposte.net.invalid> - 2011-02-08 20:33 +0100
Re: limitations on using enum as generic parameter Lew <lew@lewscanon.com> - 2011-02-09 10:07 -0800
Re: limitations on using enum as generic parameter Daniele Futtorovic <da.futt.news@laposte.net.invalid> - 2011-02-08 23:44 +0100
Re: limitations on using enum as generic parameter Daniele Futtorovic <da.futt.news@laposte.net.invalid> - 2011-02-08 20:47 +0100
Re: limitations on using enum as generic parameter Lew <lew@lewscanon.com> - 2011-02-08 12:31 -0800
Re: limitations on using enum as generic parameter Ken Wesson <kwesson@gmail.com> - 2011-02-08 20:40 +0100
csiph-web