Class AuditedSelfInvocationRuleTest

java.lang.Object
ubic.gemma.core.architecture.AuditedSelfInvocationRuleTest

public class AuditedSelfInvocationRuleTest extends Object
An audit annotation only records an event when the call reaches the method through its Spring proxy.

AuditedAspect matches @annotation(...): the advice runs on a call that goes through the bean's proxy, and on nothing else. A call on this bypasses the proxy, so the event is silently not written; a private or static method is never proxied at all. The Phase C migration replaced imperative addUpdateEvent calls, which fired whatever the entry path, with these annotations, so an entry path that reaches the annotated method through this lost its event without anything failing. Two were found by reading on 2026-09-18: switchExperimentToMergedPlatform calling switchExperimentToArrayDesign, and the two-argument createProcessedDataVectors calling the three-argument one.

The fix is to call through a @Lazy @Autowired self-reference, or through a co-bean.

How a call on this is told apart from a call on a self-reference

The bytecode records the static type the method was invoked on, not the receiver. An interface-typed self-reference is therefore invisible to this rule: the call's owner is the interface. A class-typed one looks exactly like this, except that the same line reads the self-reference field first; a call whose line reads a field of the caller's own type is taken to be through that field.
  • Field Details

    • audited_methods_are_not_called_on_this

      public static final com.tngtech.archunit.lang.ArchRule audited_methods_are_not_called_on_this
    • audited_methods_can_be_proxied

      public static final com.tngtech.archunit.lang.ArchRule audited_methods_can_be_proxied
  • Constructor Details

    • AuditedSelfInvocationRuleTest

      public AuditedSelfInvocationRuleTest()
  • Method Details

    • classes_are_actually_imported

      public static void classes_are_actually_imported(com.tngtech.archunit.core.domain.JavaClasses classes)