JDK 9 RFR of JDK-8155963: Fix deprecation warning in windows java.net implementation
Phil Race
philip.race at oracle.com
Tue May 3 19:10:20 UTC 2016
+1
-phil.
On 05/03/2016 12:14 PM, joe darcy wrote:
> Hello,
>
> Please review the patch below is address windows-specific code which
> was overlooked on the cleanup passes ahead of fixing JDK-6850612:
> Deprecate Class.newInstance since it violates the checked exception
> language contract.
>
> Thanks,
>
> -Joe
>
>
> diff -r 03453120a011
> src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java
> ---
> a/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java
> Tue May 03 10:40:54 2016 -0700
> +++
> b/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java
> Tue May 03 12:12:09 2016 -0700
> @@ -90,7 +90,9 @@
> throws SocketException {
> if (prefixImplClass != null) {
> try {
> - return (DatagramSocketImpl)
> prefixImplClass.newInstance();
> + @SuppressWarnings("deprecation")
> + Object result = prefixImplClass.newInstance();
> + return (DatagramSocketImpl) result;
> } catch (Exception e) {
> throw new SocketException("can't instantiate
> DatagramSocketImpl");
> }
>
More information about the core-libs-dev
mailing list