Aspose.Words API

Dear Aspose.

One thing I can see with "aspose-words-14.8.0-jdk16.jar" when we are starting to use JRE1.6:

com.aspose.words.Body.iterator()
com.aspose.words.Story...
com.aspose.words.CompositeNode...
java.lang.Iterable

Should not be implementing java.lang.Iterable<? extends com.aspose.words.Node>?

Example:
- for each iteration over document.getSections do not need explicit casting
- for each iteration over body nodes need unchecked explicit casting (Iterable)

So are we right to do such explicit casting as it is also indicated in JavaDoc (but for different method) or do you expect to iterate over object that it is not an instance of Node?

Thank you in advance.

Hi Anne,


Thanks for your inquiry. Could you please upgrade to the latest version of Aspose.Words for Java 14.10.0 and see if you still have these concerns?
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx

Please also share your piece of code you’re currently using and a piece of code you expect should be the right one.

Best regards,

Dear Aspose.

It is very likely not possible to provide original code based on
set restrictions, but there is some other example. Additionally it is possible
to see that with "aspose-words-14.10.0-jdk16.jar" also.

------EXAMPLE-------------------------------------------------------------------

import com.aspose.words.Document;
import com.aspose.words.Node;
import com.aspose.words.Section;

public class MyTest {

public static void test(Document doc) throws Exception {

for (Section section : doc.getSections()) {

for (Node node : (Iterable) section.getBody()) {//warning about unchecked cast, but it is needed otherwise is error.

//do nothing
}
}
}
}

------EXAMPLE-------------------------------------------------------------------

I guess that this error is there due to fact com.aspose.words.Body implements
raw type java.lang.Iterable (based on some version of JavaDoc of Aspose.Words).

Hi Anne,


Thanks for the additional information. We are in communication with our development team and will get back to you soon.

Best regards,

Hi Anne,


Thanks for being patient. Please note that Aspose.Words for Java version is automatically ported from Aspose.Words for .NET baseline. .NET allows implicit unsafe casting of IEnumerable so it is ported as is to Java. Also, it is fully safe to use explicit ‘unsafe’ casting in his case - section.getBody() – i.e. Body iterator returns only com.aspose.words.Nodes. We have also logged a task for our development team to try to remove need of explicit casting in foreach loop for Body and other CompositeNode child nodes. We will keep you informed of any updates and let you know once this issue (WORDSJAVA-972) is resolved. We apologize for any inconvenience.

Best regards,

The issues you have found earlier (filed as WORDSJAVA-972) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.