JDK 9 RFR of JDK-8048014: Update java.lang.SafeVararags for private methods

Remi Forax forax at univ-mlv.fr
Wed Jun 25 08:35:38 UTC 2014


Hi Joe,

Just for completeness, there is another case where @SafeVarargs is safe,
any methods of an internal class (inner class static or not) declared 
private that is not overridden.

because the internal class is private, the compiler can easily check all 
possible subclasses in the compilation unit of that class.

cheers,
Rémi

On 06/24/2014 07:13 PM, Joe Darcy wrote:
> Hello,
>
> Please review the libraries update portion of allowing @SafeVarargs on 
> private instance methods:
>
>     JDK-8048014: Update java.lang.SafeVararags for private methods
>
> The patch is
>
> diff -r 6c26f18d9bc0 src/share/classes/java/lang/SafeVarargs.java
> --- a/src/share/classes/java/lang/SafeVarargs.java    Mon Jun 23 
> 12:12:30 2014 -0700
> +++ b/src/share/classes/java/lang/SafeVarargs.java    Tue Jun 24 
> 10:03:21 2014 -0700
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -45,7 +45,7 @@
>   * <li>  the declaration is a fixed arity method or constructor
>   *
>   * <li> the declaration is a variable arity method that is neither
> - * {@code static} nor {@code final}.
> + * {@code static} nor {@code final} nor {@code private}.
>   *
>   * </ul>
>   *
>
> The bulk of the change to allow @SafeVarargs on private methods, 
> including the tests, are over in the langtools repo with javac 
> updates. The javac changes have been reviewed and approved on 
> compiler-dev:
>
> http://mail.openjdk.java.net/pipermail/compiler-dev/2014-June/008855.html
>
> Thanks,
>
> -Joe




More information about the core-libs-dev mailing list