private boolean compareTypesOld ( Type parmType , Type argType ) { // XXX equality not implemented for GenericObjectType // if (parmType.equals(argType)) return true; // Compare type signatures instead if ( GenericUtilities . getString ( parmType ) . equals ( GenericUtilities . getString ( argType ) ) ) { return true ; } if ( parmType instanceof GenericObjectType ) { GenericObjectType o = ( GenericObjectType ) parmType ; if ( o . getTypeCategory ( ) == GenericUtilities . TypeCategory . WILDCARD_EXTENDS ) { return compareTypesOld ( o . getExtension ( ) , argType ) ; } } // ignore type variables for now if ( parmType instanceof GenericObjectType && ! ( ( GenericObjectType ) parmType ) . hasParameters ( ) ) { return true ; } if ( argType instanceof GenericObjectType && ! ( ( GenericObjectType ) argType ) . hasParameters ( ) ) { return true ; } // Case: Both are generic containers if ( parmType instanceof GenericObjectType && argType instanceof GenericObjectType ) { return true ; } else { // Don't consider non reference types (should not be possible) if ( ! ( parmType instanceof ReferenceType && argType instanceof ReferenceType ) ) { return true ; } // Don't consider non object types (for now) if ( ! ( parmType instanceof ObjectType && argType instanceof ObjectType ) ) { return true ; } // Otherwise, compare base types ignoring generic information try { return Repository . instanceOf ( ( ( ObjectType ) argType ) . getClassName ( ) , ( ( ObjectType ) parmType ) . getClassName ( ) ) ; } catch ( ClassNotFoundException e ) { } } return true ; }
old version of compare types