Methods annotated with @future in Apex execute asynchronously in a separate thread when system resources become available. This
asynchronous execution model has two fundamental requirements:
First, future methods must be static because they cannot rely on instance state. When a future method executes, it runs independently
of the original calling context, potentially long after the original object instance has been destroyed or modified. Static methods ensure the code
can execute without requiring access to instance variables or methods.
Second, future methods must return void because they cannot return values to the calling code. The calling thread continues execution
immediately after invoking the future method, without waiting for its completion. By the time the future method actually executes, the original caller
has already moved on, making it impossible to receive any return value.
These are not just recommendations but strict compilation requirements enforced by the Apex compiler. Any attempt to declare a future method as
non-static or with a non-void return type will result in compilation errors, preventing the code from being saved or deployed.
What is the potential impact?
Violating this rule will cause compilation errors, preventing the code from being saved, deployed, or executed. This breaks the build process and
blocks development progress until the method signature is corrected.