RFR: 8292671: Hotspot Style Guide should allow covariant returns [v2]
Roland Westrelin
roland at openjdk.org
Fri Sep 9 11:44:46 UTC 2022
> The style guide explicitly lists covariant returns as a disallowed
> feature of c++. I propose we allow that feature.
>
> This came up on the c2 side where, with JDK-8275201, I introduced some
> uses of covariant returns at a number of locations in the c2 code
> because I felt the code was cleaner that way. I wasn't aware it was
> mentioned on the style guide. This was noticed by another openjdk
> contributor and I prepared a change to revert the use of covariant
> returns I had introduced:
>
> https://github.com/openjdk/jdk/pull/9237
>
> But it feels that change actually makes the code less clear and
> comments on the PR indicates some other contributors feel the same
> way.
>
> It's unclear to me why covariant returns are disallowed in the first
> place and the (few) contributors I asked don't seem to know either. So
> I propose simply allowing covariant returns.
Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
remove Covariant return types from list of allowed features
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/9941/files
- new: https://git.openjdk.org/jdk/pull/9941/files/fea33592..ec5f1ac0
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=9941&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=9941&range=00-01
Stats: 4 lines in 2 files changed: 0 ins; 3 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/9941.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/9941/head:pull/9941
PR: https://git.openjdk.org/jdk/pull/9941
More information about the hotspot-dev
mailing list