aquarium 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,100 +1,134 @@
1
+ == Version 0.4.4
2
+
3
+ V0.4.4 changes no APIs. It upgrades compatibility with the latest JRuby (1.3.1), RSpec (1.2.8) and Webgen (0.5.10) for the build process. You'll only need to upgrade if you build Aquarium yourself.
4
+
5
+ Enhancements:
6
+ 27235 Support RSpec 1.2.8 (latest) and and JRuby 1.3.1 (latest)
7
+ 27236 Upgrade website generation to webgen 0.5.X
8
+
9
+ There are no API changes in this release, with one exception. Most of the code changes are minor fixes to RSpec files. The one exception is an apparent change in JRuby 1.3.1 w.r.t. the access restrictions on Java methods. It now appears that protected methods are public, that is they are in the method list returned by :public_methods, but not :protected_methods. Also, private methods are not returned by any of the :*_methods.
10
+
11
+ I used the upgrade to Webgen 0.5.X as an excuse to refresh the web site's appearance. The content is mostly the same as before.
12
+
1
13
  == Version 0.4.3
2
14
 
3
- V0.4.3 adds a few bug fixes and enhancements, and several internal refactorings to improve
4
- performance, etc.
15
+ V0.4.3 adds a few bug fixes and enhancements, and several internal
16
+ refactorings to improve performance, etc.
5
17
 
6
18
  Bug fixes:
7
19
  [none]
8
20
 
9
21
  Enhancements:
10
22
  14165 Support Ruby 1.8.2, 1.8.5, 1.8.6, 1.9.X and 2.0 releases and snapshots
11
- 21283 Allow "_of" suffix at end of "*_and_descendents", "*_and_ancestors", and "*_nested_types"
12
- 21924 Should be able to turn off contract-testing aspects globally in the Design by Contract extra module
13
- 21993 By default, don't advise "system" methods that being with "_", but provide an option to do so
14
-
15
- 14165: I closed this one because it's too broad. Aquarium currently runs with 1.8.6. I will open a
16
- new enhancement specifically for 1.9.
17
- 21283: Sometimes appending "_of" makes the specification read more smoothly, so it's now an option.
18
- 21924: To class-level methods in DesignByContract, enable_all and disable_all, globally turn contracts
19
- on or off. See their documentation for details.
20
- 21993: Now, by default, MethodFinder won't match any method that starts with two underscores ("__"), so
21
- you don't have to :exclude_ancestors as much just to avoid matching methods like "__id__" and
22
- "__send__". There is also a new :method_options called :include_system_methods that will not suppress
23
- matching these methods. So, I'm calling these special methods "system methods". I don't yet provide a
24
- way to configure this list (RSpec methods would be good additions...). The list is currently defined
25
- as an array of regex's, MethodFinder::IGNORED_SYSTEM_METHODS. NOTE: This is effectively a behavior
26
- change, although it's not likely to affect anyone.
23
+ 21283 Allow "_of" suffix at end of "*_and_descendents", "*_and_ancestors",
24
+ and "*_nested_types"
25
+ 21924 Should be able to turn off contract-testing aspects globally in the
26
+ Design by Contract extra module
27
+ 21993 By default, don't advise "system" methods that being with "_", but
28
+ provide an option to do so
29
+
30
+ Details:
31
+ 14165: I closed this one because it's too broad. Aquarium currently runs with
32
+ 1.8.6. I will open a new enhancement specifically for 1.9.
33
+ 21283: Sometimes appending "_of" makes the specification read more smoothly,
34
+ so it's now an option.
35
+ 21924: To class-level methods in DesignByContract, enable_all and disable_all,
36
+ globally turn contracts on or off. See their documentation for details.
37
+ 21993: Now, by default, MethodFinder won't match any method that starts with
38
+ two underscores ("__"), so you don't have to :exclude_ancestors as much just
39
+ to avoid matching methods like "__id__" and "__send__". There is also a new
40
+ :method_options called :include_system_methods that will not suppress
41
+ matching these methods. So, I'm calling these special methods "system
42
+ methods". I don't yet provide a way to configure this list (RSpec methods
43
+ would be good additions...). The list is currently defined as an array of
44
+ regex's, MethodFinder::IGNORED_SYSTEM_METHODS. NOTE: This is effectively a
45
+ behavior change, although it's not likely to affect anyone.
27
46
 
28
47
  == Version 0.4.2
29
48
 
30
- V0.4.2 adds a few bug fixes and enhancements, greatly improved RDoc output, and internal
31
- refactorings to improve performance.
49
+ V0.4.2 adds a few bug fixes and enhancements, greatly improved RDoc output,
50
+ and internal refactorings to improve performance.
32
51
 
33
52
  Bug fixes:
34
53
  15202 Intermittent confusion between classes and objects when invoking advice
35
- 19262 Just putting join_point argument in advice block causes mysterious method missing error.
54
+ 19262 Just putting join_point argument in advice block causes mysterious
55
+ method missing error.
36
56
  19321 Advice overhead is too high (ongoing improvements)
37
57
 
38
58
  Enhancements:
39
- 13403 Support recursion into nested types without requiring "tricky" regular expressions
59
+ 13403 Support recursion into nested types without requiring "tricky" regular
60
+ expressions
40
61
  13406 "Sugar" for adding methods and attributes to types
41
62
  18537 Provide a search for all pointcut constants
42
63
  19666 Improve the RDoc output
43
- 19119 Provide an "after_raising" type of advice that lets you handle the exception.
44
-
45
- #15202: I never figured out the cause of this problem, but it hasn't been seen since late last
46
- year, so I suspect it disappeared as a side effect of on-going refactoring and enhancements.
47
-
48
- #19262: If you just specified "|jp|" for an advice block, you would sometimes get a method missing
49
- error. I never figured out exactly why, but it was somehow related to passing the usual three
50
- arguments internally, where the last two would be ignored in this case. Now, the code checks the
51
- arity and only passes the join point in this case.
52
-
53
- #19321: I removed some of the wasted object creation and initialization in advice invocation,
54
- improving the overhead by about 40%. However, it is still at least 10x higher than simple method
55
- aliasing, so I want to make more improvements. (I did not close this item.)
56
-
57
- #13403: I added new options :types_and_nested_types and :types_and_nested that are analogous to
58
- the similar "ancestors" and "descendents" options. The nested option will return the specified
59
- types and any types they "enclose". There are also corresponding "exclude" options.
60
-
61
- #13406: I've decided not to do this, as it really isn't the "simplest thing that could possibly
62
- work." It's easy enough for the user to define a module of new behavior and just use
63
- "obj.extend(module)". However, when the user needs to do this over a set of types, Aquarium's
64
- TypeFinder can be helpful, so I added an example to the Examples code and page.
65
-
66
- #18537: I've provided an example of the design approach where you define pointcuts in a class,
67
- as a kind of "aspect interface" and write aspects that specify those pointcuts. The problem has
68
- been that you had to name every single such pointcut explicitly. There was no "finder" option,
69
- as for types, methods, etc. Now there is a pointcut finder option with a new option
70
- ":named_pointcuts" for Aspect.new to specify a search for pointcuts in a set of types matching
71
- a name specification. Either constants or class variables will be matched (or both).
72
-
73
- #19666: The rdoc for the key classes was cleaned up so it "renders" better. Feedback is welcome.
74
-
75
- #19119: I finished the previously-incomplete support for allowing advice to change the raised
76
- exception, in both after and after_raising advice. A common scenario is to wrap the thrown
77
- exception in another. For example, a low-level, service-specific exception (like a database
78
- error) in a higher-level, more generic application exception.
79
-
80
- You still can't rescue the exception completely in after_raising and after advice; the value
81
- for the exception in
64
+ 19119 Provide an "after_raising" type of advice that lets you handle the
65
+ exception.
66
+
67
+ #15202: I never figured out the cause of this problem, but it hasn't been seen
68
+ since late last
69
+ year, so I suspect it disappeared as a side effect of on-going refactoring and
70
+ enhancements.
71
+
72
+ #19262: If you just specified "|jp|" for an advice block, you would sometimes
73
+ get a method missing error. I never figured out exactly why, but it was
74
+ somehow related to passing the usual three arguments internally, where the
75
+ last two would be ignored in this case. Now, the code checks the arity and
76
+ only passes the join point in this case.
77
+
78
+ #19321: I removed some of the wasted object creation and initialization in
79
+ advice invocation,
80
+ improving the overhead by about 40%. However, it is still at least 10x higher
81
+ than simple method aliasing, so I want to make more improvements. (I did not
82
+ close this item.)
83
+
84
+ #13403: I added new options :types_and_nested_types and :types_and_nested that
85
+ are analogous to the similar "ancestors" and "descendents" options. The
86
+ nested option will return the specified types and any types they "enclose".
87
+ There are also corresponding "exclude" options.
88
+
89
+ #13406: I've decided not to do this, as it really isn't the "simplest thing
90
+ that could possibly work." It's easy enough for the user to define a module
91
+ of new behavior and just use "obj.extend(module)". However, when the user
92
+ needs to do this over a set of types, Aquarium's TypeFinder can be helpful,
93
+ so I added an example to the Examples code and page.
94
+
95
+ #18537: I've provided an example of the design approach where you define
96
+ pointcuts in a class, as a kind of "aspect interface" and write aspects that
97
+ specify those pointcuts. The problem has been that you had to name every
98
+ single such pointcut explicitly. There was no "finder" option, as for types,
99
+ methods, etc. Now there is a pointcut finder option with a new option
100
+ ":named_pointcuts" for Aspect.new to specify a search for pointcuts in a set
101
+ of types matching a name specification. Either constants or class variables
102
+ will be matched (or both).
103
+
104
+ #19666: The rdoc for the key classes was cleaned up so it "renders" better.
105
+ Feedback is welcome.
106
+
107
+ #19119: I finished the previously-incomplete support for allowing advice to
108
+ change the raised exception, in both after and after_raising advice. A
109
+ common scenario is to wrap the thrown exception in another. For example, a
110
+ low-level, service-specific exception (like a database error) in a
111
+ higher-level, more generic application exception.
112
+
113
+ You still can't rescue the exception completely in :after_raising and :after
114
+ advice; the value for the exception in
82
115
  joinpoint.context.raised_exception
83
- when the advice returns will be raised by Aquarium. I think that permitting after_raising or
84
- after advice to "eat" the exception could cause subtle issues with scope and variable binding.
85
- It would also probably violate the "principle of least surprise"; the advice code that rescues
86
- the exception would not be as "obvious" to the reader as the familiar idiom of rescue clauses
87
- that we are accustomed to using. Therefore, if you want to recover completely from an exception,
88
- use rescue clauses in around advice.
89
-
116
+ when the advice returns will be raised by Aquarium. I think that permitting
117
+ :after_raising or :after advice to "eat" the exception could cause subtle
118
+ issues with scope and variable binding. It would also probably violate the
119
+ "principle of least surprise"; the advice code that rescues the exception would
120
+ not be as "obvious" to the reader as the familiar idiom of rescue clauses
121
+ that we are accustomed to using. Therefore, if you want to recover completely
122
+ from an exception, use rescue clauses in around advice.
90
123
 
91
124
  == Version 0.4.1
92
125
 
93
- V0.4.1 adds a few bug fixes, a few more user examples, internal refactoring and some performance
94
- improvements.
126
+ V0.4.1 adds a few bug fixes, a few more user examples, internal refactoring and
127
+ some performance improvements.
95
128
 
96
129
  Bug fixes:
97
- 19116 When an exception is thrown during advice execution, the error message always reports the advice type is :before!
130
+ 19116 When an exception is thrown during advice execution, the error message
131
+ always reports the advice type is :before!
98
132
  19261 after_raising DSL method provides no way to specify exceptions
99
133
 
100
134
  Enhancements:
@@ -102,17 +136,20 @@ Enhancements:
102
136
  19320 Move the Aquarium::...::AspectDSL file to Aquarium::DSL for convenience
103
137
  19399 Improve the Design by Contract example
104
138
 
105
- I added a new :exceptions argument (synonym :exception) that takes a single exception or list thereof.
106
- You can only use this argument with :after_raising. If you specify exceptions with the latter and use
107
- the :exceptions argument, the values will be merged.
139
+ I added a new :exceptions argument (synonym :exception) that takes a single
140
+ exception or list thereof. You can only use this argument with :after_raising.
141
+ If you specify exceptions with the latter and use the :exceptions argument,
142
+ the values will be merged.
108
143
 
109
- I thought it was ugly to have to type "include Aquarium::Aspects::DSL::AspectDSL", so I moved the code so
110
- now it's "include Aquarium::DSL". However, for backwards compatibility, the old module still works.
144
+ I thought it was ugly to have to type "include
145
+ Aquarium::Aspects::DSL::AspectDSL", so I moved the code so now it's "include
146
+ Aquarium::DSL". However, for backwards compatibility, the old module still
147
+ works.
111
148
 
112
149
  == Version 0.4.0
113
150
 
114
- V0.4.0 adds specs to characterize and test advising Java classes when running on JRuby and adds several
115
- API enhancements.
151
+ V0.4.0 adds specs to characterize and test advising Java classes when running
152
+ on JRuby and adds several API enhancements.
116
153
 
117
154
  Bug fixes:
118
155
  17844 JRuby - Advising types, Aquarium thinks the type is a string
@@ -123,89 +160,101 @@ Enhancements:
123
160
  17834 Allow :class and :module (and variants) wherever :type is allowed
124
161
  17881 Add specs that exercise advising Java types and objects using JRuby
125
162
 
126
- #17844 occurred because of the way JRuby encodes Java packages into modules. Aquarium now properly handles
127
- JRuby types.
163
+ #17844 occurred because of the way JRuby encodes Java packages into modules.
164
+ Aquarium now properly handles JRuby types.
128
165
 
129
166
  #17883 reflected a JRuby bug, so a workaround was required.
130
167
 
131
- #17834 allows the user to substitute the words "class", "classes", "module" or "modules" anywhere the words
132
- "type" and "types" are used in the API, since some users might naturally want to write aspects like this:
168
+ #17834 allows the user to substitute the words "class", "classes", "module" or
169
+ "modules" anywhere the words "type" and "types" are used in the API, since some
170
+ users might naturally want to write aspects like this:
133
171
 
134
172
  around :calls_to => :my_method, :in_class => MyClass do ...; end
135
173
 
136
- However, there is no enforcement to ensure that "class" is only used for classes and "module" is only used
137
- for modules, etc. Note: it's possible we'll enforce this in some future release, as a way of saying things
138
- like "only advise classes that match ...", etc. Caveat Emptor!
139
-
140
- For #18090, a bug prevented JoinPoint#invoke_original_join_point (which allows you to bypass all advices at
141
- the join point) from working except for :around advice (and yes, the specs didn't cover this adequately -
142
- gasp!). Now fixed.
143
-
144
- For #17881, I created a separate set of specs for JRuby, so it's easier to run the "regular" Aquarium
145
- specs using MRI and the JRuby-specific specs separately with JRuby. The new "jruby" directory contains a
146
- Rakefile, another set of specs, and Java example code for the specs to use. The default Rakefile task
147
- re-runs the main Aquarium spec suite using JRuby, to confirm that the suite passes successfully, then it
148
- runs a set of different specs that load sample Java interfaces and classes into JRuby and then advises
149
- them with Aquarium.
150
-
151
- I found a few JRuby bugs and other behavior differences between MRI during this release. I was able to handle
152
- them with modifications to the Aquarium code. If you "grep" the Aquarium "lib" and "spec" directories for the
153
- word "jruby" (ignoring case), you'll find notes about these issues and the workarounds I implemented.
154
-
155
- The separate JRuby spec suite shows what you can and cannot do with Java types. As a side benefit, it also
156
- demonstrates how Java types, objects, and methods are mapped to Ruby. There are some important limitations,
157
- however. See the jruby.html page on the website or the README for more details.
174
+ However, there is no enforcement to ensure that "class" is only used for
175
+ classes and "module" is only used for modules, etc. Note: it's possible we'll
176
+ enforce this in some future release, as a way of saying things like "only advise
177
+ classes that match ...", etc. Caveat Emptor!
178
+
179
+ For #18090, a bug prevented JoinPoint#invoke_original_join_point (which allows
180
+ you to bypass all advices at the join point) from working except for :around
181
+ advice (and yes, the specs didn't cover this adequately - gasp!). Now fixed.
182
+
183
+ For #17881, I created a separate set of specs for JRuby, so it's easier to run
184
+ the "regular" Aquarium specs using MRI and the JRuby-specific specs separately
185
+ with JRuby. The new "jruby" directory contains a Rakefile, another set of specs,
186
+ and Java example code for the specs to use. The default Rakefile task re-runs
187
+ the main Aquarium spec suite using JRuby, to confirm that the suite passes
188
+ successfully, then it runs a set of different specs that load sample Java
189
+ interfaces and classes into JRuby and then advises them with Aquarium.
190
+
191
+ I found a few JRuby bugs and other behavior differences between MRI during this
192
+ release. I was able to handle them with modifications to the Aquarium code. If
193
+ you "grep" the Aquarium "lib" and "spec" directories for the word "jruby"
194
+ (ignoring case), you'll find notes about these issues and the workarounds I
195
+ implemented.
196
+
197
+ The separate JRuby spec suite shows what you can and cannot do with Java types.
198
+ As a side benefit, it also demonstrates how Java types, objects, and methods
199
+ are mapped to Ruby. There are some important limitations, however. See the
200
+ jruby.html page on the website or the README for more details.
158
201
 
159
202
  Note: JRuby 1.1RC2 was used.
160
-
161
203
 
162
204
  == Version 0.3.1
163
205
 
164
- V0.3.1 adds numerous performance improvements, especially in the RSpec suite, and some minor API additions.
206
+ V0.3.1 adds numerous performance improvements, especially in the RSpec suite,
207
+ and some minor API additions.
165
208
 
166
209
  Bug fixes:
167
210
  N.A.
168
211
 
169
212
  Enhancements:
170
213
  14447 Unify internal handling of reporting errors to the user
171
- 17514 Provide an Aquarium library-wide logger with configuration parameters and instance overrides
214
+ 17514 Provide an Aquarium library-wide logger with configuration parameters and
215
+ instance overrides
172
216
  17515 Add an optional warning if an aspect doesn't match any join points
173
- 17516 Remove unnecessary examples that use :types_and_descendents to shorten time to run the RSpec suite
174
- 17565 JoinPoint.new should convert a type name, symbol, or regex to the type and only allow one type
175
-
176
- These first two enhancements are related. There is a now an Aquarium::Utils::DefaultLogger
177
- module with static accessors for getting and setting the "system-wide" logger.
178
-
179
- When instance-level overrides are necessary, the Aquarium::Utils::OptionsUtils provides
180
- "universal" options (but currently used only by Aspect and Pointcut) for specifying a logger
181
- (with the new :logger parameter), or alternatively, specifying just the output stream
182
- (:logger_stream) and/or the severity (:severity, one of the standard library's
183
- Logger::Severity-defined constants). If either of the latter two options is specified, a
184
- separate logger instance is created, rather than changing parameters for the global logger.
185
-
186
- OptionsUtils also supports a :noop parameter, which classes interpret to mean do none (or
187
- perhaps only some) of the processing. Useful for debugging.
188
-
189
- #17515 adds a helpful warning to the system (or aspect-instance's) logger if an aspect
190
- matches no join points. This warning will be suppressed if (i) the severity level for the
191
- logger is above WARN or (ii) the aspect was created with the option
192
- :ignore_no_matching_join_points => true.
193
-
194
- #17516 fixes halved the long execution times for the whole RSpec suite by refactoring some examples
195
- that used type finders with the :types_and_descendents option unnecessarily. It is a very intensive
196
- computation! Note that I stubbed out these calls using an aspect with around advise, a useful
197
- "development-time" aspect. See Aquarium::TypeUtilsStub (in spec_example_types.rb) and how it's used
198
- in pointcut_spec.rb. Using this technique and other optimizations, the time to run the suite was
199
- reduced from ~5 minutes to about 1 minute.
217
+ 17516 Remove unnecessary examples that use :types_and_descendents to shorten
218
+ time to run the RSpec suite
219
+ 17565 JoinPoint.new should convert a type name, symbol, or regex to the type
220
+ and only allow one type
221
+
222
+ These first two enhancements are related. There is a now an
223
+ Aquarium::Utils::DefaultLogger module with static accessors for getting and
224
+ setting the "system-wide" logger.
225
+
226
+ When instance-level overrides are necessary, the Aquarium::Utils::OptionsUtils
227
+ provides "universal" options (but currently used only by Aspect and Pointcut)
228
+ for specifying a logger (with the new :logger parameter), or alternatively,
229
+ specifying just the output stream (:logger_stream) and/or the severity
230
+ (:severity, one of the standard library's Logger::Severity-defined constants).
231
+ If either of the latter two options is specified, a separate logger instance is
232
+ created, rather than changing parameters for the global logger.
233
+
234
+ OptionsUtils also supports a :noop parameter, which classes interpret to mean
235
+ do none (or perhaps only some) of the processing. Useful for debugging.
236
+
237
+ #17515 adds a helpful warning to the system (or aspect-instance's) logger if
238
+ an aspect matches no join points. This warning will be suppressed if (i) the
239
+ severity level for the logger is above WARN or (ii) the aspect was created
240
+ with the option :ignore_no_matching_join_points => true.
241
+
242
+ #17516 fixes halved the long execution times for the whole RSpec suite by
243
+ refactoring some examples that used type finders with the :types_and_descendents
244
+ option unnecessarily. It is a very intensive computation! Note that I stubbed
245
+ out these calls using an aspect with around advise, a useful "development-time"
246
+ aspect. See Aquarium::TypeUtilsStub (in spec_example_types.rb) and how it's used
247
+ in pointcut_spec.rb. Using this technique and other optimizations, the time to
248
+ run the suite was reduced from ~5 minutes to about 1 minute.
200
249
 
201
- #17565 fixes a "hole" in JoinPoint, where it doesn't confirm that a specified type string, symbol
202
- or regex matches a class that exists and only one class. Now it does and it stores the type, rather
203
- than the original "specification" for it.
250
+ #17565 fixes a "hole" in JoinPoint, where it doesn't confirm that a specified
251
+ type string, symbol or regex matches a class that exists and only one class. Now
252
+ it does and it stores the type, rather than the original "specification" for it.
204
253
 
205
254
  == Version 0.3.0
206
255
 
207
- V0.3.0 adds numerous improvements to the DSL, making aspect specification more intuitive and
208
- English-like. For example, where you previously wrote, e.g.,
256
+ V0.3.0 adds numerous improvements to the DSL, making aspect specification more
257
+ intuitive and English-like. For example, where you previously wrote, e.g.,
209
258
 
210
259
  around :methods => :all, :types => [Foo, Bar], :advice => advice_proc
211
260
  after :attribute => name, :attribute_options => [:readers], :objects => [foo, bar] ...
@@ -215,8 +264,8 @@ Now you can write the same aspects as follows:
215
264
  around :calls_to => :all_methods, :within_types => [Foo, Bar], :use_advice => advice_proc
216
265
  after :reading => name, :on_objects => [foo, bar] ...
217
266
 
218
- Other improvements include performance and robustness enhancements and miscellaneous internal
219
- refactoring and DRY improvements.
267
+ Other improvements include performance and robustness enhancements and
268
+ miscellaneous internal refactoring and DRY improvements.
220
269
 
221
270
  Bug fixes:
222
271
  16267 gem not updating
@@ -226,78 +275,89 @@ Enhancements:
226
275
 
227
276
  For #17154, the following changes were made:
228
277
  Added :all_methods as a synonym for the :all special value.
229
- Added :reading as a synonym for :attributes => ..., :attribute_options => [:readers]
230
- Added :writing and :changing as synonyms for :attributes => ..., :attribute_options => [:writers]
278
+ Added :reading as a synonym for :attributes => ..., :attribute_options =>
279
+ [:readers]
280
+ Added :writing and :changing as synonyms for :attributes => ...,
281
+ :attribute_options => [:writers]
231
282
  Added :accessing as a synonym for :attributes => ...
232
- Added :calls_to, :calling, :invoking, :sending_message_to as synonyms for :methods.
233
- Added :on_types, :in_types, :within_types and :for_types as synonyms for :types. The same
234
- set of prefixes is supported for :type, :objects, :object, and the various :exclude_*,
235
- :*_and_ancestors, and :*_and_descendents.
236
-
237
- The full list of possible synonyms are shown in the spec examples. In particular, see "pointcut_spec.rb".
283
+ Added :calls_to, :calling, :invoking, :sending_message_to as synonyms for
284
+ :methods.
285
+ Added :on_types, :in_types, :within_types and :for_types as synonyms for :types.
286
+ The same set of prefixes is supported for :type, :objects, :object, and the
287
+ various :exclude_*, :*_and_ancestors, and :*_and_descendents.
238
288
 
289
+ The full list of possible synonyms are shown in the spec examples. In
290
+ particular, see "pointcut_spec.rb".
239
291
 
240
292
  == Version 0.2.0
241
293
 
242
- V0.2.0 changes the parameter list used for advice blocks and adds numerous enhancements, robustness
243
- improvements and more complete "spec'ing".
294
+ V0.2.0 changes the parameter list used for advice blocks and adds numerous
295
+ enhancements, robustness improvements and more complete "spec'ing".
244
296
 
245
297
  Bug fixes:
246
298
  none
247
299
 
248
300
  Enhancements:
249
- 13402 Support a subclass syntax like AspectJ's "Type+"
250
- 13984 More flexible argument list to the advise block
251
- 14053 Remove JoinPoint#type, JoinPoint#type=, JoinPoint#object, and JoinPoint#object=
301
+ 13402 Support a subclass syntax like AspectJ's "Type+".
302
+ 13984 More flexible argument list to the advise block.
303
+ 14053 Remove JoinPoint#type, JoinPoint#type=, JoinPoint#object, and
304
+ JoinPoint#object=
252
305
  14061 Add a control flow mechanism to skipping (sic) intermediate advice
253
306
  15164 Deprecate ObjectFinder
254
307
  15413 Remove ObjectFinder
255
308
  15710 Eliminate redundant public methods in various "finders"
256
309
 
257
- #13402 adds new invocation options to specify types and their descendents (subclasses or modules
258
- that include the specified module(s)) and ancestors. The latter should be used cautiously as it
259
- will include things like Kernel, Object, and Class! I used new command options rather than the
260
- AspectJ "+" suffix (and the proposed, but never implemented "-" suffix for ancestors), because
261
- the "+" would be confusing with regular expressions and not in the spirit of trying to make
262
- the pointcut language "easy to read". So, the following are now available:
263
- :type_and_ancestors
264
- :types_and_ancestors
265
- :type_and_descendents
266
- :types_and_descendents
267
- And the corresponding:
268
- :exclude_type_and_ancestors
269
- :exclude_types_and_ancestors
270
- :exclude_type_and_descendents
271
- :exclude_types_and_descendents
272
- If you want both the ancestors and descendents, just use both options with the same value.
273
-
274
- #13984 adds the object as the second argument to the advice block parameter list. This change
275
- reflects the fact that the object is often needed, but calling jp.context.advised_object is a
276
- bit tedious. THIS CHANGE BREAKS BACKWARDS COMPATIBILITY!! An exception is raised if advice has
277
- the signature |jp, *args|.
278
-
279
- #14061 adds a new method, JoinPoint#invoke_original_join_point, which will invoke the original
280
- method without intermediate advice. If called within around advice, you can write advice that
281
- vetoes all subsequent advice, yet invokes the original method. Use this technique cautiously,
282
- however, since you may not always know what other advices are involved and what side effects
283
- this control-flow change might cause.
284
-
285
- #15164 and 15413 remove ObjectFinder because it is not used and it requires ObjectSpace, which
286
- has high overhead and won't be enabled, by default, in JRuby (it will be optional).
287
-
288
- #15710 removes redundant methods that were becoming a maintenance issue, in particular,
289
- MethodFinder#find_all_by and TypeFinder#find_by_name. This is a non-backwards-compatible API
290
- change.
291
-
292
- Finally, note that I have not yet been able to resolve bug #15202, "Intermittent confusion
293
- between classes and objects when invoking advice." I believe this is a very rare occurrence
294
- and only likely to ever happen during the "torture-test" of running the RSpec suite. Please post
295
- a comment to Tracker if you encounter it!
310
+ #13402 adds new invocation options to specify types and their descendents
311
+ (subclasses or modules that include the specified module(s)) and ancestors.
312
+ The latter should be used cautiously as it will include things like Kernel,
313
+ Object, and Class! I used new command options rather than the AspectJ "+"
314
+ suffix (and the proposed, but never implemented "-" suffix for ancestors),
315
+ because the "+" would be confusing with regular expressions and not in the
316
+ spirit of trying to make the pointcut language "easy to read". So, the
317
+ following are now available:
318
+ :type_and_ancestors
319
+ :types_and_ancestors
320
+ :type_and_descendents
321
+ :types_and_descendents
322
+ And the corresponding:
323
+ :exclude_type_and_ancestors
324
+ :exclude_types_and_ancestors
325
+ :exclude_type_and_descendents
326
+ :exclude_types_and_descendents
327
+ If you want both the ancestors and descendents, just use both options with
328
+ the same value.
329
+
330
+ #13984 adds the object as the second argument to the advice block parameter
331
+ list. This change reflects the fact that the object is often needed, but
332
+ calling jp.context.advised_object is a bit tedious. THIS CHANGE BREAKS
333
+ BACKWARDS COMPATIBILITY!! An exception is raised if advice has the signature
334
+ |jp, *args|.
335
+
336
+ #14061 adds a new method, JoinPoint#invoke_original_join_point, which will
337
+ invoke the original method without intermediate advice. If called within
338
+ around advice, you can write advice that vetoes all subsequent advice, yet
339
+ invokes the original method. Use this technique cautiously, however, since you
340
+ may not always know what other advices are involved and what side effects this
341
+ control-flow change might cause.
342
+
343
+ #15164 and 15413 remove ObjectFinder because it is not used and it requires
344
+ ObjectSpace, which has high overhead and won't be enabled, by default, in
345
+ JRuby (it will be optional).
346
+
347
+ #15710 removes redundant methods that were becoming a maintenance issue, in
348
+ particular, MethodFinder#find_all_by and TypeFinder#find_by_name. This is a
349
+ non-backwards-compatible API change.
350
+
351
+ Finally, note that I have not yet been able to resolve bug #15202, "Intermittent
352
+ confusion between classes and objects when invoking advice." I believe this is a
353
+ very rare occurrence and only likely to ever happen during the "torture-test" of
354
+ running the RSpec suite. Please post a comment to Tracker if you encounter it!
296
355
 
297
356
  == Version 0.1.8
298
357
 
299
- V0.1.7 did not successfully "register" at rubyforge. This releases fixes that problem and also
300
- adds several feature enhancements and refactorings. There are no known upgrade issues.
358
+ V0.1.7 did not successfully "register" at rubyforge. This releases fixes that
359
+ problem and also adds several feature enhancements and refactorings. There are
360
+ no known upgrade issues.
301
361
 
302
362
  Bug fixes:
303
363
  none
@@ -306,13 +366,15 @@ Enhancements:
306
366
  13399 Add :exclusion options for methods and types.
307
367
  14707 :exclude_ancestor_methods as synonym for :suppress_ancestor_methods
308
368
 
309
- 13399 adds new :exclude_(pointcuts|join_points|types|objects|methods|attributes) options for
310
- Aspect.new, and Pointcut.new that make it easier to specify a list or regular expression for
311
- various "items" and then to exclude particular items, e.g.,
312
- Aspect.new :around, :types => /nterestingType/, :exclude_types => UninterestingType ...
369
+ 13399 adds new :exclude_(pointcuts|join_points|types|objects|methods|attributes)
370
+ options for Aspect.new, and Pointcut.new that make it easier to specify a list
371
+ or regular expression for various "items" and then to exclude particular
372
+ items, e.g., Aspect.new :around, :types => /nterestingType/, :exclude_types =>
373
+ UninterestingType ...
313
374
 
314
- The :exclude_ancestor_methods option is now preferred over :suppress_ancestor_methods,
315
- since the former is more consistent with the new :exclude_* options.
375
+ The :exclude_ancestor_methods option is now preferred over
376
+ :suppress_ancestor_methods, since the former is more consistent with the new
377
+ :exclude_* options.
316
378
 
317
379
  == Version 0.1.7
318
380
 
@@ -320,47 +382,51 @@ Bug fixes:
320
382
  14946 Advice fails when instrumenting methods containing special characters
321
383
  15038 Spec for pointcut example variation #1
322
384
  15039 Spec for pointcut example variation #2
323
- 15085 Specifying just :attributes for aspects also matches all methods, as if :methods => :all specified
385
+ 15085 Specifying just :attributes for aspects also matches all methods, as if
386
+ :methods => :all specified
324
387
 
325
388
  Enhancements:
326
389
  13396 Unify internal handling of types vs. objects
327
390
 
328
- 15038 and 15039 were bugs in one of the examples (actually in the comments). However,
329
- experimenting with them also revealed the nasty 15085 bug!
330
-
331
- I previously handled some special characters in method names, but not all the possible
332
- ones, hence 14946. Aquarium should now properly handle any valid Ruby method name.
391
+ 15038 and 15039 were bugs in one of the examples (actually in the comments).
392
+ However, experimenting with them also revealed the nasty 15085 bug!
333
393
 
394
+ I previously handled some special characters in method names, but not all the
395
+ possible ones, hence 14946. Aquarium should now properly handle any valid Ruby
396
+ method name.
334
397
 
335
398
  == Version 0.1.6
336
399
 
337
400
  Bug fixes:
338
- 14353 Advising subclass method that calls super raises exception when method executed
339
- 14356 Regexps for types must cover the whole name, which is inconsistent with method/attribute regexps
401
+ 14353 Advising subclass method that calls super raises exception when method
402
+ executed
403
+ 14356 Regexps for types must cover the whole name, which is inconsistent with
404
+ method/attribute regexps
340
405
  14384 Design by Contract "extra" does not return correct value "invar" handling
341
406
  13410 Fix funky navigation bar on website
342
407
 
343
- 14353 was kind of bad, but it's actually a Ruby bug with a good workaround. If you
344
- advised a method that called "super", Ruby would use the wrong method name to lookup the
345
- class in the parent. See the bug description for the details.
408
+ 14353 was kind of bad, but it's actually a Ruby bug with a good workaround. If
409
+ you advised a method that called "super", Ruby would use the wrong method name
410
+ to lookup the class in the parent. See the bug description for the details.
346
411
 
347
- For 14356, type regular expressions now match on parts of names; they don't have to match
348
- the whole name. The exception is regular expressions with module separators "::". In this
349
- case, it seems to make more sense for the regular expression to be interpreted as follows:
350
- If the expression is /A::B::C::D/, then for the the outermost types, the expression behaves
351
- as /^.*A/, for the types between two "::", the expressions behave as /^B$/ and /^C$/, and
352
- the trailing expression behaves as /D.*$/.
412
+ For 14356, type regular expressions now match on parts of names; they don't have
413
+ to match the whole name. The exception is regular expressions with module
414
+ separators "::". In this case, it seems to make more sense for the regular
415
+ expression to be interpreted as follows: If the expression is /A::B::C::D/,
416
+ then for the the outermost types, the expression behaves as /^.*A/, for the
417
+ types between two "::", the expressions behave as /^B$/ and /^C$/, and the
418
+ trailing expression behaves as /D.*$/.
353
419
 
354
- 14384 was an easy mistake to make with "around" advice; you have to remember to return the
355
- result of the "join_point.proceed" call, unless you specifically want to change the returned
356
- value! Here are two ways to do it:
420
+ 14384 was an easy mistake to make with "around" advice; you have to remember to
421
+ return the result of the "join_point.proceed" call, unless you specifically
422
+ want to change the returned value! Here are two ways to do it:
357
423
 
358
424
  do_something_before(...)
359
425
  result = join_point.proceed
360
426
  do_something_after(...)
361
427
  return result
362
428
 
363
- or
429
+ or
364
430
 
365
431
  begin
366
432
  do_something_before(...)
@@ -369,8 +435,9 @@ or
369
435
  do_something_after(...)
370
436
  end
371
437
 
372
- The latter approach looks "asymmetrical" and it will behave differently if "proceed" raises!
373
- However, it eliminates the temporary, if you find that desirable.
438
+ The latter approach looks "asymmetrical" and it will behave differently if
439
+ "proceed" raises! However, it eliminates the temporary, if you find that
440
+ desirable.
374
441
 
375
442
  Enhancements:
376
443
  13407 Pick a better method name for JoinPoint#type, which hides the Module#type
@@ -384,22 +451,25 @@ For 13407, new attribute methods have been added
384
451
  * JoinPoint#target_object return the object that the join_point matches.
385
452
  * JoinPoint#target_object= set the object that the join_point matches.
386
453
 
387
- The following, older methods are now deprecated and will be removed in the 0.2.0 release (#14053):
454
+ The following, older methods are now deprecated and will be removed in the 0.2.0
455
+ release (#14053):
388
456
  * JoinPoint#type
389
457
  * JoinPoint#type=
390
458
  * JoinPoint#object
391
459
  * JoinPoint#object=
392
460
 
393
- JoinPoint#type method is deprecated because it hides Module#type, which returns the type of
394
- the corresponding object. For "symmetry", the other three methods are also now deprecated and
395
- they will be removed in a future release. Until then, all will print a warning message to
396
- STDOUT. (If you really want the type of what could be a JoinPoint object, you should use #class
397
- anyway, as Module#type is also deprecated!)
461
+ JoinPoint#type method is deprecated because it hides Module#type, which returns
462
+ the type of the corresponding object. For "symmetry", the other three methods
463
+ are also now deprecated and they will be removed in a future release. Until
464
+ then, all will print a warning message to STDOUT. (If you really want the type
465
+ of what could be a JoinPoint object, you should use #class anyway, as
466
+ Module#type is also deprecated!)
398
467
 
399
468
  == Version 0.1.5
400
469
 
401
470
  Bug fixes:
402
- 13514 Protected and private methods are made public when advised and left that way when unadvised
471
+ 13514 Protected and private methods are made public when advised and left that
472
+ way when unadvised
403
473
  13650 Loading Aquarium interferes with Rails filters
404
474
  13864 Bug with negative object_id
405
475
 
@@ -407,21 +477,24 @@ Enhancements:
407
477
  13392 Convert examples to specs.
408
478
  13463 Support running in JRuby
409
479
 
410
- Fixing 13650 required an API change, which is why I've tagged this release "0.1.5" instead of
411
- something like "0.1.1" (and the changes don't seem big enough to warrant "0.2.0"...).
480
+ Fixing 13650 required an API change, which is why I've tagged this release
481
+ "0.1.5" instead of something like "0.1.1" (and the changes don't seem big enough
482
+ to warrant "0.2.0"...).
412
483
 
413
- Previously, requiring "aquarium.rb" in the top-level "lib" directory would implicitly require
414
- lib/aquarium/dsl/aspect_dsl.rb, which
415
- has Object include the AspectDSL module. This module adds methods like :before and :after to Object.
416
- Unfortunately, those methods collide with methods of the same name that Rails adds to Object. It was
417
- also a bit presumptuous of me to assume that everyone wanted those methods on Object ;)
484
+ Previously, requiring "aquarium.rb" in the top-level "lib" directory would
485
+ implicitly require lib/aquarium/dsl/aspect_dsl.rb, which has Object include the
486
+ AspectDSL module. This module adds methods like :before and :after to Object.
487
+ Unfortunately, those methods collide with methods of the same name that Rails
488
+ adds to Object. It was also a bit presumptuous of me to assume that everyone
489
+ wanted those methods on Object ;)
418
490
 
419
- In this release, aspect_dsl.rb is still implicitly included and it still defines the AspectDSL
420
- module. Now, however, it does not include the AspectDSL module in Object. Instead, if you want this
421
- behavior for all types, you must require the new lib/aquarium/aspects/dsl/object_dsl.rb explicitly.
491
+ In this release, aspect_dsl.rb is still implicitly included and it still defines
492
+ the AspectDSL module. Now, however, it does not include the AspectDSL module in
493
+ Object. Instead, if you want this behavior for all types, you must require the
494
+ new lib/aquarium/aspects/dsl/object_dsl.rb explicitly.
422
495
 
423
- As an alternative, if you just want the AspectDSL module included selectively in certain types,
424
- then do the following:
496
+ As an alternative, if you just want the AspectDSL module included selectively in
497
+ certain types, then do the following:
425
498
 
426
499
  class MyClass # reopen "MyClass"
427
500
  # Add the methods as _class_ methods
@@ -443,11 +516,13 @@ To add the methods as _instance_ methods on individual objects:
443
516
  object.extend(Aquarium::DSL)
444
517
 
445
518
 
446
- Note: as discussed at http://practicalruby.blogspot.com/2007/02/reopen-with-moduleeval.html,
519
+ Note: as discussed at
520
+ http://practicalruby.blogspot.com/2007/02/reopen-with-moduleeval.html,
447
521
  using "class_eval" or "module_eval" is safer that just reopening a class if
448
- you're not sure that "MyClass" has actually been defined yet. However, in our particular case, it
449
- probably doesn't matter, as AspectDSL doesn't change anything about the type, like aliasing existing
450
- methods. Still, we can't guarantee that this won't change in the future.
522
+ you're not sure that "MyClass" has actually been defined yet. However, in our
523
+ particular case, it probably doesn't matter, as AspectDSL doesn't change
524
+ anything about the type, like aliasing existing methods. Still, we can't
525
+ guarantee that this won't change in the future.
451
526
 
452
527
  == Version 0.1.0
453
528