LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Need help with java warnings (http://www.linuxquestions.org/questions/programming-9/need-help-with-java-warnings-344784/)

Hockeyfan 07-19-2005 06:40 PM

Need help with java warnings
 
I wrote a java application and when I compile I get a warning that tells me that I am doing some unsafe operations in my java code and to recompile with -Xlint:unchecked as a comand line argumennt. When I did I was able to see my warnings. I am not sure how to get rid of these warnings. I like zero errors, zero warnings. I know in the java compiler doesn't output 0 errors, 0 warnings. Here are the warnings I get when I compile:

[javac] /home/paul/Documents/java/PersonalInfo/src/personalInfo/logic/DB.java:45: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector
[javac] information.add(person);
[javac] ^
[javac] /home/paul/Documents/java/PersonalInfo/src/personalInfo/logic/DB.java:76: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector
[javac] information.add(array[i]);
[javac] ^
[javac] /home/paul/Documents/java/PersonalInfo/src/personalInfo/logic/DB.java:105: warning: [unchecked] unchecked conversion
[javac] found : personalInfo.logic.FNComparator
[javac] required: java.util.Comparator<? super java.lang.Object>
[javac] Arrays.sort(sort, fn);
[javac] ^
[javac] /home/paul/Documents/java/PersonalInfo/src/personalInfo/logic/DB.java:105: warning: [unchecked] unchecked method invocation: <T>sort(T[],java.util.Comparator<? super T>) in java.util.Arrays is applied to (java.lang.Object[],personalInfo.logic.FNComparator)
[javac] Arrays.sort(sort, fn);
[javac] ^
[javac] /home/paul/Documents/java/PersonalInfo/src/personalInfo/logic/DB.java:109: warning: [unchecked] unchecked conversion
[javac] found : personalInfo.logic.LNComparator
[javac] required: java.util.Comparator<? super java.lang.Object>
[javac] Arrays.sort(sort, ln);
[javac] ^
[javac] /home/paul/Documents/java/PersonalInfo/src/personalInfo/logic/DB.java:109: warning: [unchecked] unchecked method invocation: <T>sort(T[],java.util.Comparator<? super T>) in java.util.Arrays is applied to (java.lang.Object[],personalInfo.logic.LNComparator)
[javac] Arrays.sort(sort, ln);
[javac] ^
[javac] 6 warnings

If anyone knows how to get rid of these warnings please let me know

-Hockeyfan

mickyg 07-22-2005 02:01 PM

Any chance of you posting the source code to DB.java so we can see what exactly the class is doing.


All times are GMT -5. The time now is 03:28 PM.