Archived
This forum has been archived. Please start a new discussion on GitHub.
java 5 custom sequence mapping warnings
xdm
La Coruña, Spain
in Help Center
I get a javac warning when use java-5 Ice-3.2.0 and custom sequence mapping
java version is Sun JDK 1.5.0.11
Sample Slice
Compiler output
Is this code safe envent with the warnings or must i use other slice2java options to avoid this warnings?
For use the java-2 mapping is needed to add the --meta java:java2 when compile slice files?
Thanks
java version is Sun JDK 1.5.0.11
Sample Slice
class ObjectMetadata{
string objectId;
string content;
StringMap indexedKeys;
StringMap storedKeys;
};
["java:type:java.util.ArrayList"]sequence<ObjectMetadata>ObjectMetadataSeq;
Compiler output
generate:
[slice2java] slice2java --output-dir /home/pepone/proyects/hydra-0.5.5/Services/java/SearchServer/generated -I/opt/Ice-3.2/slice -I/home/pepone/proyects/hydra-0.5.5/Services/slice /home/pepone/proyects/hydra-0.5.5/Services/slice/SearchServer/SearchServer.ice
compile:
[javac] Compiling 63 source files to /home/pepone/proyects/hydra-0.5.5/Services/java/SearchServer/classes
[javac] Note: /home/pepone/proyects/hydra-0.5.5/Services/java/SearchServer/generated/Oz/ObjectMetadataSeqHelper.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
Is this code safe envent with the warnings or must i use other slice2java options to avoid this warnings?
For use the java-2 mapping is needed to add the --meta java:java2 when compile slice files?
Thanks
0
Comments
-
The generated code is still safe to use. The Java compiler emits a warning because your metadata uses an untyped container (java.util.ArrayList). You could eliminate this warning by using java.util.ArrayList<ObjectMetadata> instead. Of course, if you are trying to remain compatible with both Java2 and Java5, then you should leave the metadata as it is and simply ignore the warning when compiling with Java5.Is this code safe envent with the warnings or must i use other slice2java options to avoid this warnings?
Yes, in Ice 3.2.0 the default mapping uses Java5 types; if you want to generate code that is compatible with Java2, you have to specify that metadata.For use the java-2 mapping is needed to add the --meta java:java2 when compile slice files?
Take care,
- Mark0