You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README-183.html 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  2. <html> <head>
  3. <title>AspectJ 1.8.3 Readme</title>
  4. <style type="text/css">
  5. <!--
  6. P { margin-left: 20px; }
  7. PRE { margin-left: 20px; }
  8. LI { margin-left: 20px; }
  9. H4 { margin-left: 20px; }
  10. H3 { margin-left: 10px; }
  11. -->
  12. </style>
  13. </head>
  14. <body>
  15. <div align="right"><small>
  16. &copy; Copyright 2014 Contributors.
  17. All rights reserved.
  18. </small></div>
  19. <h1>AspectJ 1.8.3 Readme</h1>
  20. <p>The full list of resolved issues in 1.8.3 is available
  21. <a href="https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced;bug_status=RESOLVED;bug_status=VERIFIED;bug_status=CLOSED;product=AspectJ;target_milestone=1.8.3;">here</a></h2>.</p>
  22. <ul>
  23. <li>1.8.3 available 22-Oct-2014
  24. </ul>
  25. <h2>Notable changes</h2>
  26. <h3>Conditional aspect activation with <tt>@RequiredTypes</tt> - <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=436653">Issue 436653</a></h3>
  27. <p>AspectJ is sometimes used to create aspect libraries. These libraries contain a number of aspects often covering
  28. a variety of domains. The library might typically be available as a jar and contains a single aop.xml file that
  29. names all the aspects. The library is then consumed by some application.
  30. However, the application may not need to use all those aspects
  31. but because they are listed in the aop.xml they will be 'active'. Now the pointcuts in those unused aspects
  32. may not match anything in the application and could be considered harmless but the pointcuts and the aspects
  33. themselves may have references to types in other libraries that the application does not have around. This can lead
  34. to unhelpful <tt>"can't find type"</tt> messages and currently requires the user to add unnecessary entries to their
  35. build dependencies just to keep the unused aspects happy.
  36. </p>
  37. <p>With AspectJ 1.8.3 it is now possible to express a constraint on an aspect. The <tt>@RequiredTypes</tt>
  38. annotation specifies one or more fully qualified types that must be discoverable on the classpath in
  39. order for the aspect to activate. Using this there is no need to add those extraneous dependencies to
  40. an applications build classpath.
  41. </p>
  42. <p>Example:</p>
  43. <pre><code>import org.aspectj.lang.annotation.*;
  44. @RequiredTypes("com.foo.Bar")
  45. public aspect Foo {
  46. before(): execution(@com.foo.Bar * *(..)) {}
  47. }
  48. </code></pre>
  49. <p>
  50. If the above aspect is listed in an aop.xml for loadtime weaving or passed on the aspectpath for
  51. compile time weaving, if the type <tt>'com.foo.Bar'</tt> is not accessible on the classpath then the
  52. aspect will be turned off and the pointcut will have no effect. There will be no attempt made to
  53. match it and so no unhelpful <tt>"can't find type"</tt> messages.
  54. </p>
  55. <h3>cflow and the pre-initialization joinpoint changes due to Java 7 verifier modifications - <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=443477">Issue 443477</a></h3>
  56. <p>There has been a change in the Java7 verifier in a recent patch release of Java7 (update 67) that causes
  57. a verify error for usage of a particular AspectJ construct. The problem occurs if you are using
  58. cflow and it hits the preinitialization join point. The pattern of code generated in that case causes
  59. the verifyerror. In this release of AspectJ we have taken the 'quick' approach to solving this, namely
  60. to avoid advising preinitialization with the cflow construct. This problem appears to come up
  61. when the aspect is non-optimal anyway and hitting preinitialization was never really intended by the
  62. pointcut writer. For example:
  63. <pre><code>execution(* foo(..)) && cflow(within(Bar))</code></pre>
  64. <p>The use of cflow and within there will actually hit *a lot* of joinpoints, many of which the user probably didn't mean to.
  65. It feels like we actually need a warning to indicate the pointcut is probably suboptimal. What the user probably
  66. meant was something more like this:</p>
  67. <pre><code>execution(* foo(..)) && cflow(execution(* Bar.*(..))</code></pre>
  68. <p>or</p>
  69. <pre><code>execution(* foo(..)) && cflow(within(Bar) && execution(* *(..)))</code></pre>
  70. <p>
  71. But even if they did want the less optimal form of cflow there still seems little use in applying it to
  72. pre-initialization - that is your cue to raise an AspectJ bug with a realistic use case inside that proves this
  73. an invalid assumption :)</p>
  74. <h3>around advice and lambdas - <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=445395">Issue 445395</a></h3>
  75. <p>For optimal performance, where possible, AspectJ tries to inline around advice when it applies
  76. at a joinpoint. There are few characteristics of a joinpoint match that can prevent this but we
  77. do try to inline where we can (the inlining can be manually turned off via <tt>-XnoInline</tt>).</p>
  78. <p>Inlining of around advice basically means copying the advice instructions into the target class. This causes
  79. a problem when the advice uses lambdas. Lambda usage is currently implemented in java compilers by generating
  80. invokedynamic bytecode instructions that reference bootstrap methods created in the class and a helper method
  81. generated in the class containing the lambda code. When the invokedynamic is encountered at runtime, some magic
  82. happens and the bootstrap method is used to generate a class on the fly that calls the particular lambda method.
  83. All this 'extra stuff' breaks the basic inlining algorithm that simply copies the advice bytecode into the target.
  84. Effectively the inlining process needs to become much more sophisticated and copy the bootstrap methods and
  85. the lambda helper methods, avoiding clashes with existing bootstrap/helpers in the target.</p>
  86. <p>
  87. Prior to AspectJ 1.8.3 when the inlining failed you would get a horrible class cast exception that mentions
  88. constant pool entries (because the bootstrap method hadn't been copied over to the target). Temporarily in
  89. 1.8.3 we are turning off inlining of around advice containing lambdas, which will at least avoid the failure,
  90. with the longer term goal of improving the inlining process to do all the necessary extra work.
  91. </p>
  92. <!-- ============================== -->
  93. </body>
  94. </html>