RFR: 8370983: Add methods for primitive operators to support method handles
Shaojin Wen
swen at openjdk.org
Fri Oct 31 16:55:43 UTC 2025
On Fri, 31 Oct 2025 04:55:31 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> Initial draft of a partial set of methods wrapping primitive operators to get feedback on the class providing this functionality.
src/java.base/share/classes/java/lang/invoke/Operators.java line 73:
> 71: *
> 72: * @implSpec
> 73: * This method wraps the {@code <} operator on {@code int} augments.
Suggestion:
* This method wraps the {@code <} operator on {@code int} arguments.
typo
src/java.base/share/classes/java/lang/invoke/Operators.java line 219:
> 217: * @param subtrahend the second operand
> 218: */
> 219: public static int substract(int minuend, int subtrahend) {return minuend - subtrahend;}
Suggestion:
public static int subtract(int minuend, int subtrahend) {return minuend - subtrahend;}
src/java.base/share/classes/java/lang/invoke/Operators.java line 231:
> 229: * @param a the operand
> 230: */
> 231: public static int increment(int a) {return a++;}
Suggestion:
public static int increment(int a) {return ++a;}
src/java.base/share/classes/java/lang/invoke/Operators.java line 241:
> 239: * @param a the operand
> 240: */
> 241: public static int decrement(int a) {return a--;}
Suggestion:
public static int decrement(int a) {return --a;}
src/java.base/share/classes/java/lang/invoke/Operators.java line 698:
> 696: * This method corresponds to the {@code nop} JVM instruction.
> 697: */
> 698: public void nop() {return;}
Suggestion:
public static void nop() {return;}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28081#discussion_r2482094079
PR Review Comment: https://git.openjdk.org/jdk/pull/28081#discussion_r2482099634
PR Review Comment: https://git.openjdk.org/jdk/pull/28081#discussion_r2482091037
PR Review Comment: https://git.openjdk.org/jdk/pull/28081#discussion_r2482091703
PR Review Comment: https://git.openjdk.org/jdk/pull/28081#discussion_r2482101678
More information about the core-libs-dev
mailing list