src/main/java/me/senseiwells/arucas/values/classes/ArucasWrapperCreator.java
private boolean addOperator(Method method, ArucasOperator operatorAnnotation) {
		if (Modifier.isStatic(method.getModifiers())) {
			throw invalidWrapperMethod(this.clazz, method, "Operator methods cannot be static");
		}
		MethodHandle handle = this.getMethodHandle(this.clazz, method, false, false);
		if (handle == null) {
			throw invalidWrapperMethod(this.clazz, method, "Failed to get method handle");
		}

		Class<?>[] parameters = method.getParameterTypes();
		final int parameterLength = parameters.length;

		Token.Type operatorToken = operatorAnnotation.value();

		if (!Token.Type.isOperatorOverridable(parameterLength, operatorToken)) {
			throw invalidWrapperMethod(
				this.clazz,
				method,
				"No such operator %s with %d parameters".formatted(operatorToken, parameterLength)
			);
		}

		ArucasMethodHandle methodHandle = new ArucasMethodHandle(handle, getMethodReturnType(this.clazz, method));
		WrapperMemberFunction function = WrapperMemberFunction.of(this.classDefinition, method.getName(), parameterLength, methodHandle, false);

		this.classDefinition.addOperatorMethod(operatorToken, function);
		return true;
	}
/**
	 * Returns true if the operator was added.
	 */
Returns true if the operator was added.
Returns true if the operator was added .
private boolean addOperator(Method method, ArucasOperator operatorAnnotation) {
		if (Modifier.isStatic(method.getModifiers())) {
			throw invalidWrapperMethod(this.clazz, method, "Operator methods cannot be static");
		}
		MethodHandle handle = this.getMethodHandle(this.clazz, method, false, false);
		if (handle == null) {
			throw invalidWrapperMethod(this.clazz, method, "Failed to get method handle");
		}
		Class<?>[] parameters = method.getParameterTypes();
		final int parameterLength = parameters.length;
		Token.Type operatorToken = operatorAnnotation.value();
		if (!Token.Type.isOperatorOverridable(parameterLength, operatorToken)) {
			throw invalidWrapperMethod(
				this.clazz,
				method,
				"No such operator %s with %d parameters".formatted(operatorToken, parameterLength)
			);
		}
		ArucasMethodHandle methodHandle = new ArucasMethodHandle(handle, getMethodReturnType(this.clazz, method));
		WrapperMemberFunction function = WrapperMemberFunction.of(this.classDefinition, method.getName(), parameterLength, methodHandle, false);
		this.classDefinition.addOperatorMethod(operatorToken, function);
		return true;
	}
private boolean addOperator ( Method method , ArucasOperator operatorAnnotation ) { if ( Modifier . isStatic ( method . getModifiers ( ) ) ) { throw invalidWrapperMethod ( this . clazz , method , "Operator methods cannot be static" ) ; } MethodHandle handle = this . getMethodHandle ( this . clazz , method , false , false ) ; if ( handle == null ) { throw invalidWrapperMethod ( this . clazz , method , "Failed to get method handle" ) ; } Class < ? > [ ] parameters = method . getParameterTypes ( ) ; final int parameterLength = parameters . length ; Token . Type operatorToken = operatorAnnotation . value ( ) ; if ( ! Token . Type . isOperatorOverridable ( parameterLength , operatorToken ) ) { throw invalidWrapperMethod ( this . clazz , method , "No such operator %s with %d parameters" . formatted ( operatorToken , parameterLength ) ) ; } ArucasMethodHandle methodHandle = new ArucasMethodHandle ( handle , getMethodReturnType ( this . clazz , method ) ) ; WrapperMemberFunction function = WrapperMemberFunction . of ( this . classDefinition , method . getName ( ) , parameterLength , methodHandle , false ) ; this . classDefinition . addOperatorMethod ( operatorToken , function ) ; return true ; }
Returns true if the operator was added.
Returns true if the operator was added .