Do I need to worry about the compile warning "Note: MYPROG.java uses unchecked or unsafe operations?"

Question ID : 98
Created on 2009-09-02 at 2:28 PM
Author : Veryant Support [support@veryant.com]

Online URL : http://support.veryant.com/support/phpkb/question.php?ID=98



In isCOBOL you may get a Java warning when you use a deprecated API or a Generic class in Java 1.5+.
In this case, IsControlSet.cbl uses the Vector  generic class.
You can recompile the source code with -jo="-Xlint:unchecked" option to see the warning message:
   java com.iscobol.compiler.Pcc -jo="-Xlint:unchecked" *.cbl
   I --> IsControlSet.cbl
   Compiling result
   Informational(s) - 0
   Warning(s) - 0
   Error(s) - 0
   Severe error(s) - 0
   II--> ISCONTROLSET.java
   ISCONTROLSET.java:2852: warning: [unchecked] unchecked call to addElement(E) 
   as a member of the raw type java.util.Vector
      VECT.addElement("Year 2001");
You can:
  1. Ignore this warning.
  2. Compile the source with the -jo="-source 1.4 -target 1.4" option
   java com.iscobol.compiler.Pcc -jo="-source 1.4 -target 1.4" *.cbl
   I --> IsControlSet.cbl
   Compiling result
   Informational(s) - 0
   Warning(s) - 0
   Error(s) - 0
   Severe error(s) - 0
   II--> ISCONTROLSET.java
You may find this this link about "Generics" and java1.5+ useful:http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html


Back to Original Question