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 Newsgroups: comp.lang.java.programmer Subject: Re: Cannot create a generic array of 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> References: <11633107.472.1319005728890.JavaMail.geo-discussion-forums@prfp13> 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: 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 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, the compile error goes away and there is no run-time > error either. > > ArrayList[] 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