[ 
https://issues.apache.org/jira/browse/HTTPCORE-802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18123124#comment-18123124
 ] 

Oleg Kalnichevski commented on HTTPCORE-802:
--------------------------------------------

Hi Ryan

Unless I am mistaken but the option 1 ensures byte-code compatibility, not API 
/ platform compatibility. So, it is not 

Anyhow, given the omission of `jdk.net` from Java 8 profile was an oversight, 
let's wait and do nothing. It may still get fixed.

I will restart the discussion regarding Java 8 compatibility after the 
HttpClient 5.7 GA release.

Oleg  

> jdk.net.ExtendedSocketOptions causes compatibility problems with newer JDKs
> ---------------------------------------------------------------------------
>
>                 Key: HTTPCORE-802
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-802
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>            Reporter: Oleg Kalnichevski
>            Priority: Major
>
> jdk.net.ExtendedSocketOptions causes compatibility problems with newer JDKs 
> when using Java 8 as a release target (--release compile option).
> Newer JDKs fail to import jdk.net package when targeting Java 8 apparently 
> due this feature being considered invalid for Java 8
> {noformat}
> $ mvn -v
> Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
> Maven home: /home/oleg/opt/maven
> Java version: 17.0.17, vendor: Amazon.com Inc., runtime: 
> /home/oleg/opt/amazon-corretto-17.0.17.10.1
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "6.12.107+deb13-amd64", arch: "amd64", family: 
> "unix"
> {noformat}
> {noformat}
> $ mvn clean compile -P-use-toolchains -DjavaVersion=8
> {noformat}
> {noformat}
> [INFO] --- compiler:3.16.0:compile (default-compile) @ httpcore5 ---
> [INFO] Recompiling the module because of changed source code.
> [INFO] Compiling 570 source files with javac [debug deprecation release 8] to 
> target/classes
> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR : 
> [INFO] -------------------------------------------------------------
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java:[52,15]
>  package jdk.net does not exist
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java:[48,15]
>  package jdk.net does not exist
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java:[49,15]
>  package jdk.net does not exist
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpServer.java:[44,15]
>  package jdk.net does not exist
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpServer.java:[45,15]
>  package jdk.net does not exist
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java:[41,15]
>  package jdk.net does not exist
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java:[42,15]
>  package jdk.net does not exist
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/util/ReflectionUtils.java:[30,15]
>  package jdk.net does not exist
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/util/ReflectionUtils.java:[31,15]
>  package jdk.net does not exist
> [ERROR] 
> /home/oleg/src/apache.org/httpcomponents/httpcore/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java:[334,41]
>  cannot find symbol
> {noformat}
> When using the same JDK and targeting Java 11, the same code compiles 
> successfully
> {noformat}
> mvn clean compile -P-use-toolchains -DjavaVersion=11
> {noformat}
> {noformat}
>  
> [INFO] --- compiler:3.16.0:compile (default-compile) @ httpcore5 ---
> [INFO] Recompiling the module because of changed source code.
> [INFO] Compiling 570 source files with javac [debug deprecation release 11] 
> to target/classes
> ...
> [INFO] Reactor Summary for Apache HttpComponents Core 5.5-beta4-SNAPSHOT:
> [INFO] 
> [INFO] Apache HttpComponents Core ......................... SUCCESS [  1.089 
> s]
> [INFO] Apache HttpComponents Core HTTP/1.1 ................ SUCCESS [  9.346 
> s]
> [INFO] 
> {noformat}
> I had to disable release target validation due to this problem when upgrading 
> our maven POM. Please note the check was not used prior to the upgrade.
> Given that the animal sniffer plugin has been discontinued in favor of JDK 
> release target validation, we have lost a valuable quality control mechanism 
> and a safe-guard. 
> The best course of action would be just upgrade to Java 17 and forget about 
> Java 8 compatibility woes.
> Alternatively, we could consider removing direct import of jdk.net classes 
> and go back to using reflection.
> Oleg
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to