Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #25613

Re: limitations on using enum as generic parameter

From Daniele Futtorovic <da.futt.news@laposte.net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: limitations on using enum as generic parameter
Date 2011-02-08 20:33 +0100
Organization A noiseless patient Spider
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>

Show all headers | 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 | NextNext in thread | Find similar


Thread

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