作者:夏晶阳--艺术 | 2023-08-27 15:52
我编译程序后得到一堆警告声明,我知道我可以关闭它们,但我想让它们正确,但我不知道正确的方法来修复它们,因为它们中的一些抱怨方式,像这样:
BS=(TreeSet)B.next()
BS=(TreeSet
有什么帮助吗?这里是其中的一些 :
170: warning: [unchecked] unchecked call to getMethod(java.lang.String,java.lang.Class>...) as a member of the raw type java.lang.Class
Method createMethod=factory.getMethod("create"+currentValue, parameters);
---------------------------------------------------------------------------------------------------------------------------------
168 Class factory=Class.forName("net.sourceforge.barbecue.BarcodeFactory");
169 Class [] parameters={ "".getClass() };
170 Method createMethod=factory.getMethod("create"+currentValue, parameters);
=======================================================================================================
76: warning: [unchecked] unchecked conversion
found : java.util.Vector[]
required: java.util.Vector[]
static Vector Region[]=new Vector[Nm_Lib.Region_Num];
---------------------------------------------------------------------------------------------------------------------------------
76 static Vector Region[]=new Vector[Nm_Lib.Region_Num];
=======================================================================================================
1365: warning: [unchecked] unchecked cast
found : java.lang.Object
required: java.util.Vector
Loaded_Contact_Info_Entry_Vector=(Vector)XML_Decoder.readObject();
---------------------------------------------------------------------------------------------------------------------------------
1358 Vector Loaded_Contact_Info_Entry_Vector=new Vector();
1359
1360 if (new File(A_Path).exists())
1361 try
1362 {
1363// Out("A_Path="+A_Path);
1364 XML_Decoder=new XMLDecoder(new BufferedInputStream(new FileInputStream(A_Path)));
1365 Loaded_Contact_Info_Entry_Vector=(Vector)XML_Decoder.readObject();
=======================================================================================================
1902: warning: [unchecked] unchecked cast
found : java.lang.Object
required: java.util.Vector
if (textToUse == FILE_TEXT) backupLineBreakTLs=(Vector) lineBreakTLs.clone();
---------------------------------------------------------------------------------------------------------------------------------
1692 private Vector lineBreakTLs=null;
1693 for (int i=0; i < fileText.length; i++)
1694 {
1695 AttributedString as=new AttributedString(fileText[i],g2.getFont().getAttributes());
1696 LineBreakMeasurer lbm=new LineBreakMeasurer(as.getIterator(),g2.getFontRenderContext());
1697 while (lbm.getPosition() < fileText[i].length()) lineBreakTLs.add(lbm.nextLayout((float) w));
1698 }
......
1901 Vector backupLineBreakTLs=null;
1902 if (textToUse == FILE_TEXT) backupLineBreakTLs=(Vector) lineBreakTLs.clone();
=======================================================================================================
143: warning: [unchecked] unchecked conversion
found : java.util.TreeSet
required: java.util.TreeSet
BS=(TreeSet)B.next();
---------------------------------------------------------------------------------------------------------------------------------
139 TreeSet
Kees de Koot..
8
你应该阅读泛型.Angelika Langer的网站是一个很好的资源.
1> Kees de Koot..:
你应该阅读泛型.Angelika Langer的网站是一个很好的资源.