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


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

Re: Cannot create a generic array of <type>

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Cannot create a generic array of <type>
Date Wed, 19 Oct 2011 10:00:03 -0700 (PDT)
Organization http://groups.google.com
Lines 20
Message-ID <2010013.9.1319043603285.JavaMail.geo-discussion-forums@vbat14> (permalink)
References <j7lic6$lob$1@speranza.aioe.org> <11633107.472.1319005728890.JavaMail.geo-discussion-forums@prfp13> <j7m7nv$766$4@speranza.aioe.org>
Reply-To comp.lang.java.programmer@googlegroups.com
NNTP-Posting-Host 2620:0:1000:2404:224:d7ff:fe69:5838
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1319043603 1555 127.0.0.1 (19 Oct 2011 17:00:03 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Wed, 19 Oct 2011 17:00:03 +0000 (UTC)
In-Reply-To <j7m7nv$766$4@speranza.aioe.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=2620:0:1000:2404:224:d7ff:fe69:5838; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
User-Agent G2/1.0
X-Google-Web-Client true
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9003

Show key headers only | View raw


Warren Tang wrote:
> Thanks for the info. If I use the reified version of the generic - i.e. 
> the erased version of the generic - ArrayList instead of 
> ArrayList<Integer>, the compile error goes away and there is no run-time 
> error either.
> 
> ArrayList<Integer>[] indexedValues = new ArrayList[5];
> 
> Although there is still a type safety warning.

DO NOT USE RAW TYPES!!!

You get a warning because your code is not type safe.  BAD!

DO NOT MIX ARRAYS AND GENERICS!!!

DO NOT USE RAW TYPES!!!

-- 
Lew

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-19 12:06 +0800
  Re: Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-19 13:22 +0800
  Re: Cannot create a generic array of <type> Lew <lewbloch@gmail.com> - 2011-10-18 23:28 -0700
    Re: Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-19 18:11 +0800
      Re: Cannot create a generic array of <type> markspace <-@.> - 2011-10-19 04:50 -0700
        Re: Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-20 00:43 +0800
          Re: Cannot create a generic array of <type> markspace <-@.> - 2011-10-19 12:21 -0700
            Re: Cannot create a generic array of <type> Warren Tang <nospam@tangcs.com> - 2011-10-21 11:05 +0800
      Re: Cannot create a generic array of <type> Lew <lewbloch@gmail.com> - 2011-10-19 10:00 -0700

csiph-web