USPTO / PatentPublicData

Utility tools to help download and parse patent data made available to the public
Other
188 stars 80 forks source link

build fails with errors like `incompatible types: java.util.List<capture#8 of ? extends gov.uspto.patent.model.classification.Classification> cannot be converted to java.util.List<gov.uspto.patent.model.classification.Classification>` #3

Closed axb21 closed 8 years ago

axb21 commented 8 years ago

A clean clone of this project and mvn compile results in the following errors (truncated for brevity) in both jdk 1.7 and jdk 1.8, both openjdk as well as the Oracle jdk, on Ubuntu 16.04:

[INFO] 8 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] PatentPublicData ................................... SUCCESS [  0.002 s]
[INFO] Common ............................................. SUCCESS [  0.384 s]
[INFO] PatentDocument ..................................... SUCCESS [  0.042 s]
[INFO] BulkDownloader ..................................... FAILURE [  0.835 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.355 s
[INFO] Finished at: 2016-10-04T17:28:32-04:00
[INFO] Final Memory: 18M/356M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project BulkDownloader: Compilation failure: Compilation failure:
[ERROR] /home/abucci/dev/USPTO/PatentPublicData/BulkDownloader/src/main/java/gov/uspto/bulkdata/corpusbuilder/MatchClassificationPatent.java:[42,53] incompatible types: java.util.List<capture#1 of ? extends gov.uspto.patent.model.classification.Classification> cannot be converted to java.util.List<gov.uspto.patent.model.classification.Classification>
[ERROR] /home/abucci/dev/USPTO/PatentPublicData/BulkDownloader/src/main/java/gov/uspto/bulkdata/corpusbuilder/MatchClassificationPatent.java:[43,54] incompatible types: java.util.List<capture#2 of ? extends gov.uspto.patent.model.classification.Classification> cannot be converted to java.util.List<gov.uspto.patent.model.classification.Classification>
[ERROR] /home/abucci/dev/USPTO/PatentPublicData/BulkDownloader/src/main/java/gov/uspto/bulkdata/corpusbuilder/MatchClassificationPatent.java:[66,74] incompatible types: java.util.List<capture#3 of ? extends gov.uspto.patent.model.classification.Classification> cannot be converted to java.util.List<gov.uspto.patent.model.classification.Classification>
[ERROR] /home/abucci/dev/USPTO/PatentPublicData/BulkDownloader/src/main/java/gov/uspto/bulkdata/corpusbuilder/MatchClassificationPatent.java:[81,75] incompatible types: java.util.List<capture#4 of ? extends gov.uspto.patent.model.classification.Classification> cannot be converted to java.util.List<gov.uspto.patent.model.classification.Classification>
[ERROR] /home/abucci/dev/USPTO/PatentPublicData/BulkDownloader/src/main/java/gov/uspto/bulkdata/corpusbuilder/MatchClassificationXPath.java:[41,75] incompatible types: java.util.List<capture#5 of ? extends gov.uspto.patent.model.classification.Classification> cannot be converted to java.util.List<gov.uspto.patent.model.classification.Classification>
[ERROR] /home/abucci/dev/USPTO/PatentPublicData/BulkDownloader/src/main/java/gov/uspto/bulkdata/corpusbuilder/MatchClassificationXPath.java:[49,76] incompatible types: java.util.List<capture#6 of ? extends gov.uspto.patent.model.classification.Classification> cannot be converted to java.util.List<gov.uspto.patent.model.classification.Classification>
[ERROR] /home/abucci/dev/USPTO/PatentPublicData/BulkDownloader/src/main/java/gov/uspto/bulkdata/corpusbuilder/MatchClassificationXPathSGML.java:[39,75] incompatible types: java.util.List<capture#7 of ? extends gov.uspto.patent.model.classification.Classification> cannot be converted to java.util.List<gov.uspto.patent.model.classification.Classification>
[ERROR] /home/abucci/dev/USPTO/PatentPublicData/BulkDownloader/src/main/java/gov/uspto/bulkdata/corpusbuilder/MatchClassificationXPathSGML.java:[47,76] incompatible types: java.util.List<capture#8 of ? extends gov.uspto.patent.model.classification.Classification> cannot be converted to java.util.List<gov.uspto.patent.model.classification.Classification>

I had a look at the error on line 42 as an exemplar. It looks like MatchClassificationPatent.setup() is passing a List<Classification> into public static List<? extends Classification> getByType(Collection<? extends Classification> classes, ClassificationType type) declared in Classification. This call returns List<? extends Classification>, which setup() attempts to assign to a variable that is declared of type List<Classification>. The compiler throws an error here. The error on line 66 looks similar. I have not looked through all the errors but I imagine they have to do with this issue of java generics.

bgfeldm commented 8 years ago

I see the issue as you described. It arises from my failure to check in the updated code. I'll push an update soon, which will includes a good amount of other improvements that I've been waiting to push to the public repo.

Thank you, feel free to message me about any issues, questions or possible improvements.

brian.feldman@uspto.gov

bgfeldm commented 8 years ago

fix pushed to public repo

axb21 commented 8 years ago

@bgfeldm thank you! The code compiles correctly now. I have some tests I'd like to run with it and will let you know if I encounter any further issues. I'm pretty thrilled to get this working because I've more or less re-implemented some of what you've done here, and I'm sure I've made mistakes.

As far as suggesting improvements, I'd love to talk more with you about that. I will email you when I get my head straight about what I'm thinking and run some tests. I am planning to use this code with scala, and I have converted the multi-project pom.xml files into a corresponding multi-project build that works with SBT. This code builds correctly now both in maven and in SBT, so that's good. Java and scala interoperate pretty well but I'll probably write some more scala-friendly interfaces to some of this code. If there's any interest in that, or even just the scala build setup, I'd be happy to share.

Anyway, thanks again.