mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8289274: Cleanup unnecessary null comparison before instanceof check in security modules
Reviewed-by: mullan
This commit is contained in:
parent
81ee7d28f8
commit
87aa3ce03e
14 changed files with 54 additions and 94 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2022, 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
|
||||
|
@ -241,12 +241,9 @@ public final class PrivateCredentialPermission extends Permission {
|
|||
* the specified {@code Permission}, false if not.
|
||||
*/
|
||||
public boolean implies(Permission p) {
|
||||
|
||||
if (p == null || !(p instanceof PrivateCredentialPermission))
|
||||
if (!(p instanceof PrivateCredentialPermission that))
|
||||
return false;
|
||||
|
||||
PrivateCredentialPermission that = (PrivateCredentialPermission)p;
|
||||
|
||||
if (!impliesCredentialClass(credentialClass, that.credentialClass))
|
||||
return false;
|
||||
|
||||
|
@ -524,11 +521,9 @@ public final class PrivateCredentialPermission extends Permission {
|
|||
}
|
||||
|
||||
public boolean implies(Object obj) {
|
||||
if (obj == null || !(obj instanceof CredOwner))
|
||||
if (!(obj instanceof CredOwner that))
|
||||
return false;
|
||||
|
||||
CredOwner that = (CredOwner)obj;
|
||||
|
||||
if (principalClass.equals("*") ||
|
||||
principalClass.equals(that.principalClass)) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue