This file is indexed.

/usr/share/doc/aspectj-doc/progguide/language-advice.html is in aspectj-doc 1.8.8-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Advice</title><link rel="stylesheet" type="text/css" href="aspectj-docs.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="The AspectJTM Programming Guide"><link rel="up" href="language.html" title="Chapter 2. The AspectJ Language"><link rel="prev" href="language-joinPoints.html" title="Join Points and Pointcuts"><link rel="next" href="language-interType.html" title="Inter-type declarations"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Advice</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="language-joinPoints.html">Prev</a> </td><th width="60%" align="center">Chapter 2. The AspectJ Language</th><td width="20%" align="right"> <a accesskey="n" href="language-interType.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="language-advice"></a>Advice</h2></div></div></div><p>
      Advice defines pieces of aspect implementation that execute at
      well-defined points in the execution of the program. Those points can
      be given either by named pointcuts (like the ones you've seen above)
      or by anonymous pointcuts. Here is an example of an advice on a named
      pointcut:
    </p><pre class="programlisting">
  pointcut setter(Point p1, int newval): target(p1) &amp;&amp; args(newval)
                                         (call(void setX(int) ||
                                          call(void setY(int)));

  before(Point p1, int newval): setter(p1, newval) {
      System.out.println("About to set something in " + p1 +
                         " to the new value " + newval);
  }
</pre><p>
      And here is exactly the same example, but using an anonymous
      pointcut:
    </p><pre class="programlisting">
  before(Point p1, int newval): target(p1) &amp;&amp; args(newval)
                                (call(void setX(int)) ||
                                 call(void setY(int))) {
      System.out.println("About to set something in " + p1 +
                         " to the new value " + newval);
  }
</pre><p>
      Here are examples of the different advice:
    </p><p>
      This before advice runs just before the join points picked out by the
      (anonymous) pointcut:
    </p><pre class="programlisting">
  before(Point p, int x): target(p) &amp;&amp; args(x) &amp;&amp; call(void setX(int)) {
      if (!p.assertX(x)) return;
  }
</pre><p>
      This after advice runs just after each join point picked out by the
      (anonymous) pointcut, regardless of whether it returns normally or throws
      an exception:
    </p><pre class="programlisting">
  after(Point p, int x): target(p) &amp;&amp; args(x) &amp;&amp; call(void setX(int)) {
      if (!p.assertX(x)) throw new PostConditionViolation();
  }
</pre><p>
      This after returning advice runs just after each join point picked
      out by the (anonymous) pointcut, but only if it returns normally.
      The return value can be accessed, and is named <code class="literal">x</code>
      here.  After the advice runs, the return value is returned:
    </p><pre class="programlisting">
  after(Point p) returning(int x): target(p) &amp;&amp; call(int getX()) {
      System.out.println("Returning int value " + x + " for p = " + p);
  }
</pre><p>
      This after throwing advice runs just after each join point picked out by
      the (anonymous) pointcut, but only when it throws an exception of type
      <code class="literal">Exception</code>.  Here the exception value can be accessed
      with the name <code class="literal">e</code>.  The advice re-raises the exception
      after it's done:
    </p><pre class="programlisting">
  after() throwing(Exception e): target(Point) &amp;&amp; call(void setX(int)) {
      System.out.println(e);
  }
</pre><p>
      This around advice traps the execution of the join point; it runs
      <span class="emphasis"><em>instead</em></span> of the join point.  The original action
      associated with the join point can be invoked through the special
      <code class="literal">proceed</code> call:
    </p><pre class="programlisting">
void around(Point p, int x): target(p)
                          &amp;&amp; args(x)
                          &amp;&amp; call(void setX(int)) {
    if (p.assertX(x)) proceed(p, x);
    p.releaseResources();
}
</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="language-joinPoints.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="language.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="language-interType.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Join Points and Pointcuts </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Inter-type declarations</td></tr></table></div></body></html>