• New Feature
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • hhuynh
  • Reporter: ekulesho
  • September 19, 2006
  • 0
  • Watchers: 1
  • September 24, 2007
  • May 14, 2007

Description

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).

Comments

Eugene Kuleshov 2006-09-20

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 2006-09-25

Passing the buck.

Fiona OShea 2006-10-16

This will not be completed in Lawton.

Taylor Gautier 2007-03-07

does this mean selecting by interfaces will work also?

Eugene Kuleshov 2007-03-07

That is the plan

Eugene Kuleshov 2007-03-26

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

Fiona OShea 2007-04-24

Eugene with this fix is the following true? Requirements: * 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

Acceptance Criteria: * Sample app that has an interface and a concrete implementation. Specify the interface, ensure that the concrete class is portable. * Sample app that has a subclass of a parent. Specify the parent class and all subclasses. Ensure that the subclass is portable.

Eugene Kuleshov 2007-04-24

I think so. There is a test SubtypeMatchingTest that cover this functionality and matching on interface expressions are also used in the upcoming module for Wicket framework.

Hung Huynh 2007-05-11

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 2007-05-14

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.