RFR: 8263358: Update java.lang to use instanceof pattern variable [v5]
Rémi Forax
github.com+828220+forax at openjdk.java.net
Mon Mar 15 09:38:19 UTC 2021
On Mon, 15 Mar 2021 09:21:22 GMT, Patrick Concannon <pconcannon at openjdk.org> wrote:
>> Hi,
>>
>> Could someone please review my code for updating the code in the `java.lang` package to make use of the `instanceof` pattern variable?
>>
>> Kind regards,
>> Patrick
>
> Patrick Concannon has updated the pull request incrementally with one additional commit since the last revision:
>
> 8263358: Refactored missed equals method
src/java.base/share/classes/java/lang/StackTraceElement.java line 413:
> 411: && Objects.equals(moduleName, e.moduleName)
> 412: && Objects.equals(moduleVersion, e.moduleVersion)
> 413: && e.declaringClass.equals(declaringClass)
testing the declaring class and the line number should be done first given they are primitive values, it will be a little more efficient if two StackTraceElement are not equals and one is using non interned String.
return (obj instanceof StackTraceElement e)
&& e.lineNumber == lineNumber
&& e.declaringClass == declaringClass
&& ...
-------------
PR: https://git.openjdk.java.net/jdk/pull/2913
More information about the core-libs-dev
mailing list