←Older revision | Revision as of 05:53, 26 March 2022 | ||
Line 7: | Line 7: | ||
This happened to me few times with [http://bits.netbeans.org/7.1/javadoc/org-openide-util-lookup/org/openide/util/Lookup.Result.html Lookup.Result] - its listeners are supposed to keep hard-reference to the result instance otherwise it may disappear. Sometimes the users forget to do so and then they get broken code. Well, half-broken code. Why half-broken? | This happened to me few times with [http://bits.netbeans.org/7.1/javadoc/org-openide-util-lookup/org/openide/util/Lookup.Result.html Lookup.Result] - its listeners are supposed to keep hard-reference to the result instance otherwise it may disappear. Sometimes the users forget to do so and then they get broken code. Well, half-broken code. Why half-broken? | ||
- | However, the results were partially cached and as such it was enough if only one user of the same result kept the reference. This resulted in funny situations when some [[PHP]] functionality in [[NetBeans]] worked correctly only if [[C]]/[[C++]] support was also installed. Moreover problems of this kind are hard to debug (especially few beginners): when you debug your application everything works initially. Only after few full garbage collector cycles the listener actually gets garbage collected - may seem a bit mysterious for those who use [[debugger]] blindly. | + | However, the results were partially cached and as such it was enough if only one user of the same result kept the reference. This resulted in funny situations when some [[PHP]] functionality in [[NetBeans]] worked correctly only if [[C]]/[[C++]] support was also installed. Moreover problems of this kind are hard to debug (especially few beginners): when you debug your application everything works initially. Only after few full [[Garbage Collection|garbage collector]] cycles the listener actually gets [[Garbage Collection|garbage collected]] - may seem a bit mysterious for those who use [[debugger]] blindly. |
=== Caching May Change Any [[API]] === | === Caching May Change Any [[API]] === |