Re: RFR: 8273484: Cleanup unnecessary null comparison before instanceof check in java.naming [v2]

2021-09-10 Thread Daniel Fuchs
On Thu, 9 Sep 2021 13:24:27 GMT, Andrey Turbanov 
 wrote:

>> Update code checks both non-null and instance of a class in java.naming 
>> module classes.
>> The checks and explicit casts could also be replaced with pattern matching 
>> for the instanceof operator.
>> For example:
>> The following code:
>> 
>> return (obj != null &&
>> obj instanceof CompoundName &&
>> impl.equals(((CompoundName)obj).impl));
>> 
>> 
>> Can be simplified to:
>> 
>> 
>> return (obj instanceof CompoundName other) &&
>> impl.equals(other.impl);
>> 
>> 
>> See similar cleanup in java.base - 
>> https://bugs.openjdk.java.net/browse/JDK-8258422
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8273484: Cleanup unnecessary null comparison before instanceof check in 
> java.naming

Nice simplification and usage of the new instanceof pattern. Thanks Andrey for 
this patch!
LGTM - Aleksei or I will sponsor this if needed.

-

Marked as reviewed by dfuchs (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/5374


Re: RFR: 8273484: Cleanup unnecessary null comparison before instanceof check in java.naming [v2]

2021-09-09 Thread Aleksei Efimov
On Thu, 9 Sep 2021 13:24:27 GMT, Andrey Turbanov 
 wrote:

>> Update code checks both non-null and instance of a class in java.naming 
>> module classes.
>> The checks and explicit casts could also be replaced with pattern matching 
>> for the instanceof operator.
>> For example:
>> The following code:
>> 
>> return (obj != null &&
>> obj instanceof CompoundName &&
>> impl.equals(((CompoundName)obj).impl));
>> 
>> 
>> Can be simplified to:
>> 
>> 
>> return (obj instanceof CompoundName other) &&
>> impl.equals(other.impl);
>> 
>> 
>> See similar cleanup in java.base - 
>> https://bugs.openjdk.java.net/browse/JDK-8258422
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8273484: Cleanup unnecessary null comparison before instanceof check in 
> java.naming

The latest version looks good to me.
Our CI system is also happy with this patch - no `java.naming` test failures 
observed.

-

Marked as reviewed by aefimov (Committer).

PR: https://git.openjdk.java.net/jdk/pull/5374


Re: RFR: 8273484: Cleanup unnecessary null comparison before instanceof check in java.naming [v2]

2021-09-09 Thread Andrey Turbanov
> Update code checks both non-null and instance of a class in java.naming 
> module classes.
> The checks and explicit casts could also be replaced with pattern matching 
> for the instanceof operator.
> For example:
> The following code:
> 
> return (obj != null &&
> obj instanceof CompoundName &&
> impl.equals(((CompoundName)obj).impl));
> 
> 
> Can be simplified to:
> 
> 
> return (obj instanceof CompoundName other) &&
> impl.equals(other.impl);
> 
> 
> See similar cleanup in java.base - 
> https://bugs.openjdk.java.net/browse/JDK-8258422

Andrey Turbanov has updated the pull request incrementally with one additional 
commit since the last revision:

  8273484: Cleanup unnecessary null comparison before instanceof check in 
java.naming

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/5374/files
  - new: https://git.openjdk.java.net/jdk/pull/5374/files/0c72cddc..4b1bc753

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5374&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5374&range=00-01

  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5374.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5374/head:pull/5374

PR: https://git.openjdk.java.net/jdk/pull/5374