Openpdf: Modernization and fixing Warnings compiling OpenPDF

Created on 13 Jun 2019  路  11Comments  路  Source: LibrePDF/OpenPDF

[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[2760,17] unchecked call to putAll(java.util.Map) as a member of the raw type java .util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[2799,26] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[2802,26] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[2828,29] unchecked call to setValue(V) as a member of the raw type java.util.Map.Entry
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[2895,21] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3139,15] unchecked call to push(E) as a member of the raw type java.util.Stack
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3166,23] unchecked call to push(E) as a member of the raw type java.util.Stack
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3175,16] unchecked conversion
required: java.util.List
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3194,23] unchecked call to push(E) as a member of the raw type java.util.Stack
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3197,23] unchecked call to push(E) as a member of the raw type java.util.Stack
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3199,21] unchecked call to push(E) as a member of the raw type java.util.Stack
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3214,23] unchecked call to push(E) as a member of the raw type java.util.Stack
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3217,23] unchecked call to push(E) as a member of the raw type java.util.Stack
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3219,21] unchecked call to push(E) as a member of the raw type java.util.Stack
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3284,54] unchecked call to toArray(T[]) as a member of the raw type java.util.Set
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3666,18] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java:[3757,25] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PRAcroForm.java:[173,31] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PRAcroForm.java:[174,36] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PRAcroForm.java:[209,18] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReaderInstance.java:[92,30] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReaderInstance.java:[100,26] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReaderInstance.java:[163,32] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/AcroFields.java:[2468,23] unchecked conversion
required: java.util.Map
found: java.util.Map
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/AcroFields.java:[2647,30] unchecked conversion
required: java.util.List
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPublicKeySecurityHandler.java:[155,19] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java:[1345,17] unchecked conversion
required: java.util.ArrayList
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java:[2624,20] unchecked call to add(E) as a member of the raw type java.util.Set
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java:[2710,34] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java:[2800,46] unchecked conversion
required: java.util.ArrayList
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java:[2948,29] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java:[2952,28] unchecked conversion
required: java.util.List
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java:[2963,21] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java:[2977,39] unchecked call to add(int,E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDocument.java:[3008,38] unchecked conversion
required: java.util.ArrayList
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[93,28] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[98,22] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[108,28] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[109,22] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[144,33] unchecked method invocation: constructor in class com.lowagie.text.pdf.PdfArray is applied t o given types
required: java.util.List
found: java.util.List
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[144,60] unchecked conversion
required: java.util.List
found: java.util.List
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[148,40] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[176,24] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[182,18] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java:[204,22] unchecked call to set(int,E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPageLabels.java:[126,16] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPageLabels.java:[272,49] unchecked call to toArray(T[]) as a member of the raw type java.util.Set
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfAcroForm.java:[98,30] unchecked method invocation: method putAll in interface java.util.Map is applied to given types
required: java.util.Map
found: java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfAcroForm.java:[98,31] unchecked conversion
required: java.util.Map
found: java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/FontDetails.java:[212,40] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/FontDetails.java:[232,44] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/FontDetails.java:[270,28] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Image.java:[923,44] unchecked call to getDeclaredConstructor(java.lang.Class...) as a member of the raw type java.lang.Clas s
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Table.java:[262,26] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Table.java:[854,25] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Table.java:[881,24] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Table.java:[912,21] unchecked call to set(int,E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Table.java:[940,17] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Table.java:[1113,28] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Table.java:[1286,29] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Table.java:[1470,27] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java:[625,40] unchecked method invocation: method addSomNameToSearchNodeChain in class com.lowagie.text.pdf.XfaFor m.Xml2Som is applied to given types
required: java.util.Map,com.lowagie.text.pdf.XfaForm.Stack2,java.lang.String
found: java.util.HashMap,com.lowagie.text.pdf.XfaForm.Stack2,java.lang.String
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java:[625,41] unchecked conversion
required: java.util.Map
found: java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java:[666,33] unchecked method invocation: method inverseSearch in class com.lowagie.text.pdf.XfaForm.Xml2Som is a pplied to given types
required: java.util.List
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java:[666,34] unchecked conversion
required: java.util.List
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java:[756,26] unchecked conversion
required: java.util.List
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java:[792,30] unchecked conversion
required: java.util.Map
found: java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java:[989,39] unchecked conversion
required: java.util.Map
found: java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/FdfWriter.java:[92,28] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/FdfWriter.java:[103,28] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/FdfWriter.java:[120,27] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/FdfWriter.java:[140,21] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/FdfWriter.java:[141,21] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/BaseField.java:[309,54] unchecked cast
required: java.util.List
found: java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java:[314,63] unchecked cast
required: java.util.Collection
found: java.util.Collection
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java:[440,68] unchecked cast
required: java.util.Collection
found: java.util.Collection
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java:[443,48] unchecked cast
required: java.util.List
found: java.util.Collection
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java:[1705,34] unchecked call to putAll(java.util.Map) as a member of the raw type java. util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfLine.java:[205,17] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PageResources.java:[84,39] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PageResources.java:[101,30] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java:[249,21] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java:[490,21] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java:[990,22] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java:[1178,17] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java:[1180,21] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[139,18] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[153,18] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[200,22] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[242,23] unchecked call to addAll(java.util.Collection) as a member of the raw type java.util.ArrayLi st
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[285,26] unchecked call to add(int,E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[293,26] unchecked call to add(int,E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[315,29] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[318,29] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[348,37] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[407,25] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/Phrase.java:[416,18] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java:[465,28] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java:[468,29] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[WARNING] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java:[541,19] unchecked call to add(E) as a member of the raw type java.util.ArrayList
[INFO] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/crypto/AESCipher.java: Some input files use or override a deprecated API.
[INFO] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/crypto/AESCipher.java: Recompile with -Xlint:deprecation for details.
[INFO] /C:/git/OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java: Some input files additionally use unchecked or unsafe operations.

bug help wanted

Most helpful comment

Hello,
Here comes the first MR #200 , #201 and #202
I tried to stay small, but cleaning some classes implies committing some others.
Hope it is not too much work for you.

All 11 comments

Hello,
I'm working on this issue, if it's ok with you.
You can find the branch here.
When I first build the project, there were 139 Warnings reported by Intellij. But whenever I fix a warning more seems to appear... I can't get this number down.
How do you want me to proceed? Do you want one big Pull Request? Multiple small ones?
As you can see, I've already changed 56 files.
I've also added locally a small project with some samples, build from resources found on internet, to test my modifications. Do you want me to push this too?

Cool. Please try to make many small changes, over one big change. It is simpler to review. You don't need to fix all at once. Just reducing the number of Warning is great.

Hello,
Here comes the first MR #200 , #201 and #202
I tried to stay small, but cleaning some classes implies committing some others.
Hope it is not too much work for you.

@asturio @bengolder Please help review these changes.

Thanks, @sixdouglas 馃憤

@rtfarte Please help review this.

Remember that we must be conservative and not break the existing API without good reasons.

I agree with you.
What do you think about going back to typed generic ArrayList instead of the typed generic List interface?
It won鈥檛 be the best practice but it will still remove the warnings.

Your changes seem to be moving the code into a more modern direction.
I will merge three PRs now. The next release of OpenPDF will then have breaking API changes. It's the price of progress.

@albfernandez I would appreciate if you could please review these changes also.
I think this is generally a modernization of the API, however we need to consider all the
effects of this change.
While the PRs are merged now, possibly you might have further feedback or questions.

@andreasrosdal I will do it.
Though, I still have a lot of changes hanging on my computer. Do you want me to push them? or do you prefer to slow down the changes?

@sixdouglas Thanks! Please submit more improvements, but please reduce the number of API changes as much as possible.

Only important changes, please! And update the JavaDoc also!

Was this page helpful?
0 / 5 - 0 ratings