Code review request: 7064075 Security libraries don't build with javac -Xlint:all,-deprecation -Werror

David Schlosnagle schlosna at gmail.com
Mon Jul 11 22:39:09 UTC 2011


On Mon, Jul 11, 2011 at 4:56 PM, Alexandre Boulgakov
<alexandre.boulgakov at oracle.com> wrote:
> Could you please review these changes?
>
> Bug detail: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7064075
> webrev: http://cr.openjdk.java.net/~jjg/7076075/
>
> Summary:
>
> Small changes to Java files to remove most build warnings.
> Small changes to relevant makefiles to prevent reintroduction of removed
> warnings.

Sasha,

You can avoid the need for the @SuppressWarnings("unchecked") in many
cases by using Class<T>.cast(Object) instead of (T). For example, in
BlockCipherParamsCore.java line 97:
  93     <T extends AlgorithmParameterSpec> T
getParameterSpec(Class<T> paramSpec)
  94         throws InvalidParameterSpecException
  95     {
  96         if (IvParameterSpec.class.isAssignableFrom(paramSpec)) {
  97             return paramSpec.cast(new IvParameterSpec(this.iv));
  98         } else {
  99             throw new InvalidParameterSpecException
 100                 ("Inappropriate parameter specification");
 101         }
 102     }

Also see these locations as well:
BlockCipherParamsCore.java line 97
DHKeyFactory.java lines 153, 158, 171, 176
DHParameters.java line 103
OAEPParameters.java line 187
PBEParameters.java line 106
RC2Parameters.java line 185
GSSUtil.java line 352
SubjectComber.java line 60
DSAKeyFactory.java lines 195, 201, 220, 226
DSAParameters.java line 106
RSAKeyFactory.java lines 355, 360, 368, 372, 388

- Dave



More information about the security-dev mailing list