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-1.8.3.adoc 5.3KB

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