Path: csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: unchecked conversion warning. Date: Sun, 10 Jun 2012 23:50:16 -0700 Organization: albasani.net Lines: 46 Message-ID: References: <3s7cs7hd18l0ffci55ns0286n4lc4cutlu@4ax.com> <265ea956-a3ed-4e76-8fc9-9ce9728f6b37@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.albasani.net KQb2lpWCMiSC+5/weNgQNbXDbKAzbSHrp4fDfllaGScic08RkAo3rgBdqwWPevt7B9qeYkY1jezmo+EyXCqRHZQ0dHPFixOQjnliSseL6ZtifSSMvaalun3XqJQ71Gpv NNTP-Posting-Date: Mon, 11 Jun 2012 06:50:13 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="/iOEXjXYjQdVW3MgvIwRJx0rSSnhLUrBevw+KPiYCBmcLq45Sfi5z9ixfNizAGhGBfmZn50MGlKGy3ctCWk7/E6CKqa/1ZnqeqBbnkn7IfktM2ULkmSwUBQ/tcV0Ggvs"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 In-Reply-To: <265ea956-a3ed-4e76-8fc9-9ce9728f6b37@googlegroups.com> Cancel-Lock: sha1:UKAKV71dt8KEEcCtmEsv+zmhbvc= Xref: csiph.com comp.lang.java.programmer:15202 Broad Liyn wrote: > (未知)写道: >> This code compiles with an 'unchecked conversion' warning. >> I have tried various corrections, for example casting like (Vector), but to no >> avail. >> What am I doing wrong?l >> The code is the smallest demo I could make from the original application. >> >> import java.util.Vector; >> public class genericsdemo >> { >> private static Vector vdata = new Vector(); //a Vector of Vectors Vector> >> private static Vector vrow = new Vector(); //a row >> >> public static void main(String args[]) { >> vrow.add(null); //two columns in the row >> vrow.add(null); >> >> vdata.add(vrow); //add the row to the Vector of Vectors >> >> Vector vtmp = getrow(); //test Raw types are bad. >> } >> >> private static Vector getrow() { >> return vdata.elementAt(0); //warning: [unchecked] unchecked conversion >> } >> } >> > 1.vector is no longer being supported. > 2. Do you mean 'Vector', as in 'java.util.Vector'? Because spelling counts in Java. If so, then you're mistaken, and if not, you need to explain what you mean. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg