Issue Details (XML | Word | Printable)

Key: CDV-144
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: 2 Major 2 Major
Assignee: Hung Huynh
Reporter: Eugene Kuleshov
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Community Development

Support for matching on subtypes for class includes

Created: 19/Sep/06 03:27 PM   Updated: 24/Sep/07 01:57 PM   Resolved: 14/May/07 12:42 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: None

Issue Links:
Dependency
 
Duplicate
 


 Description  « Hide

Support for matching on subtypes for class includes is supported in AW and we even had it working in spring branch at some point.

This feature would be beneficial for Spring's class hierarchy walker because it will allow to add included classes based on their supertypes (that are captured from field types by the class crawler).



Sort Order: Ascending order - Click to sort in descending order
Eugene Kuleshov added a comment - 20/Sep/06 06:20 PM

Here is the old code Jonas wrote for subtype matching.

public boolean isAdaptable(ClassInfo classInfo) {
String fullName = classInfo.getName();
if (isInAdaptableCache(fullName)) { return isCachedAdaptable(fullName); }

// We make inner classes of logical classes not instrumented while logical
// bases are instrumented

String name = baseClassNameWithoutInners(fullName);
if (isLogical(name)) { return cacheIsAdaptable(fullName, name.equals(fullName)); }

if (hasCustomAdatper(fullName)) { return cacheIsAdaptable(fullName, true); }
if (getSpec(name) != null) { return cacheIsAdaptable(name, true); }
if (getSpec(fullName) != null) { return cacheIsAdaptable(name, true); }

classInfoFactory.setClassInfo(classInfo);

ExpressionContext ctxt = expressionHelper.createWithinExpressionContext(classInfo);
if (isExplicitlyExcluded(fullName, ctxt)) return cacheIsAdaptable(fullName, false);

if (isExplicitlyIncluded(ctxt)) { return cacheIsAdaptable(fullName, true); }

return cacheIsAdaptable(fullName, false);
}


Gary Keim added a comment - 25/Sep/06 02:54 PM

Passing the buck.


Fiona O'Shea added a comment - 16/Oct/06 04:34 PM

This will not be completed in Lawton.


Taylor Gautier added a comment - 07/Mar/07 03:41 PM

does this mean selecting by interfaces will work also?


Eugene Kuleshov added a comment - 26/Mar/07 03:48 PM

Implemented in trunk and tested with examples from the Wicket framework.


Hung Huynh added a comment - 11/May/07 05:48 PM

Hi Eugene,

I've added 2 tests that demonstrate these 2 cases:

  • Allow a user to specify an interface - all implementing classes will be instrumented
  • Allow a user to specify a parent class - all subclasses (including parent class) will be instrumented

And both of the tests fail if I just instrument the interface or the base class.

The tests name are:
InterfaceInstrumentTest
SubtypeInstrumentTest

They are currently disabled.


Eugene Kuleshov added a comment - 14/May/07 12:42 PM

Hung, your test cases are NOT using expression for subtype matching. Please check the existing SubtypeMatchingTest that I've added and incorporate your tests into that one. Anyways, I've committed fix for your test apps.