leave the type checking of the arg to the concrete subclasses
- to avoid being forced to create an DomainEntityAbstract if i don't want to
546957
protected function doAdd($object)
    {
        $this->notifyAccess();
        $this->objectsArray[$this->total] = $object;
        $this->total++;
    }
133547
Object convertArgument(String arg, Type paramType) throws IllegalArgumentException {
		Object result = null;
		if (null == arg || "null".equals(arg)) {
			return result;
		}
		logger.debug("Try to convert {} : param = {} : {}", new Object[]{arg, paramType, paramType.getClass()});
		try { // GenericArrayType, ParameterizedType, TypeVariable<D>, WildcardType, Class
			if (ParameterizedType.class.isInstance(paramType)) {
				JavaType javaType = getJavaType(paramType);
				logger.debug("Try to convert '{}' to JavaType : '{}'", arg, paramType);
				result = getObjectMapper().readValue(arg, javaType);
				logger.debug("Conversion of '{}' to '{}' : OK", arg, paramType);
			} else if (Class.class.isInstance(paramType)) {
				Class cls = (Class) paramType;
				logger.debug("Try to convert '{}' to Class '{}'", arg, paramType);
				checkStringArgument(cls, arg);
				result = getObjectMapper().readValue(arg, cls);
				logger.debug("Conversion of '{}' to '{}' : OK", arg, paramType);
			} else { // GenericArrayType, TypeVariable<D>, WildcardType
				logger.warn("Conversion of '{}' to '{}' not yet supported", arg, paramType);
			}
		} catch (IOException ex) {
			logger.debug("Conversion of '{}' to '{}' failed", arg, paramType);
			throw new IllegalArgumentException(paramType.toString());
		}
		return result;
	}
475815
public final void typeArguments() throws RecognitionException {
		int typeArguments_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 53) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:553:5: ( '<' typeArgument ( ',' typeArgument )* '>' )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:553:7: '<' typeArgument ( ',' typeArgument )* '>'
			{
			match(input,53,FOLLOW_53_in_typeArguments1935); if (state.failed) return;
			pushFollow(FOLLOW_typeArgument_in_typeArguments1937);
			typeArgument();
			state._fsp--;
			if (state.failed) return;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:553:24: ( ',' typeArgument )*
			loop74:
			while (true) {
				int alt74=2;
				int LA74_0 = input.LA(1);
				if ( (LA74_0==43) ) {
					alt74=1;
				}

				switch (alt74) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:553:25: ',' typeArgument
					{
					match(input,43,FOLLOW_43_in_typeArguments1940); if (state.failed) return;
					pushFollow(FOLLOW_typeArgument_in_typeArguments1942);
					typeArgument();
					state._fsp--;
					if (state.failed) return;
					}
					break;

				default :
					break loop74;
				}
			}

			match(input,56,FOLLOW_56_in_typeArguments1946); if (state.failed) return;
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 53, typeArguments_StartIndex); }

		}
	}
379422
public static void checkArgument( Object argument, Class<?> expectedClass )
    {
        if ( !expectedClass.isInstance( argument ) )
        {
            throw new IllegalArgumentException( "Argument expected to be of type: " + expectedClass.getName() + " but was: " + argument );
        }
    }
320321
private String genericTypeAsString(GenericsType genericsType, boolean showRedirect) {
        String ret = genericsType.getName();
        if (genericsType.getUpperBounds() != null) {
            ret += " extends ";
            for (int i = 0; i < genericsType.getUpperBounds().length; i++) {
                ClassNode classNode = genericsType.getUpperBounds()[i];
                if (classNode.equals(this)) {
                    ret += classNode.getName();
                } else {
                    ret += classNode.toString(showRedirect);
                }
                if (i + 1 < genericsType.getUpperBounds().length) ret += " & ";
            }
        } else if (genericsType.getLowerBound() !=null) {
            ClassNode classNode = genericsType.getLowerBound();
            if (classNode.equals(this)) {
                ret += " super " + classNode.getName();
            } else {
                ret += " super " + classNode;
            }
        }
        return ret;
    }
923752
def checkSubstitute(self, typecode):
        '''
        '''
        if not isinstance(typecode, ElementDeclaration): 
            return False

        try:
            nsuri,ncname = typecode.substitutionGroup
        except (AttributeError, TypeError):
            return False

        if (nsuri,ncname) != (self.schema,self.literal):
            # allow slop with the empty namespace 
            if not nsuri and not self.schema and ncname == self.literal:
                 return True

            return False

        sub = GED(self.schema, self.literal)
        if sub is None or sub is not typecode:
            return False

        return True
209163
def _validate_argument(self, arg):
        """"""
        if arg is None:
            return arg

        if isinstance(arg, type):
            return InstanceOf(arg)
        if not isinstance(arg, BaseMatcher):
            raise TypeError(
                "argument of %s can be a type or a matcher (got %r)" % (
                    self.__class__.__name__, type(arg)))

        return arg
1209998
private static boolean shouldWaive(Method getter, Class<?> implementClass) {
        int modifiers = getter.getModifiers();
        if (Modifier.isTransient(modifiers) || Modifier.isStatic(modifiers)) {
            return true;
        }
        String fieldName = getter.getName().substring(3);
        Class<?> entityType = Generics.getReturnType(getter, implementClass);
        return ParamValueLoaderService.noBind(entityType)
                || getter.isAnnotationPresent(NoBind.class)
                || getter.isAnnotationPresent(Stateless.class)
                || getter.isAnnotationPresent(Global.class)
                || ParamValueLoaderService.isInBlackList(fieldName)
                || Object.class.equals(entityType)
                || Class.class.equals(entityType)
                || OsglConfig.globalMappingFilter_shouldIgnore(fieldName);
    }
1348128
function LogicalType(schema, opts) {
  this._logicalTypeName = schema.logicalType;
  Type.call(this);
  LOGICAL_TYPE = this;
  try {
    this._underlyingType = Type.forSchema(schema, opts);
  } finally {
    LOGICAL_TYPE = null;
    // Remove the underlying type now that we're done instantiating. Note that
    // in some (rare) cases, it might not have been inserted; for example, if
    // this constructor was manually called with an already instantiated type.
    var l = UNDERLYING_TYPES.length;
    if (l && UNDERLYING_TYPES[l - 1][0] === this) {
      UNDERLYING_TYPES.pop();
    }
  }
  // We create a separate branch constructor for logical types to keep them
  // monomorphic.
  if (Type.isType(this.underlyingType, 'union')) {
    this._branchConstructor = this.underlyingType._branchConstructor;
  } else {
    this._branchConstructor = this.underlyingType._createBranchConstructor();
  }
  // We don't freeze derived types to allow arbitrary properties. Implementors
  // can still do so in the subclass' constructor at their convenience.
}
490621
private void ensureTyped(Node n, JSType type) {
    // Make sure FUNCTION nodes always get function type.
    checkState(!n.isFunction() || type.isFunctionType() || type.isUnknownType());
    if (n.getJSType() == null) {
      n.setJSType(type);
    }
  }
156933
void expectAllInterfaceProperties(Node n, FunctionType type) {
    ObjectType instance = type.getInstanceType();
    for (ObjectType implemented : type.getAllImplementedInterfaces()) {
      if (implemented.getImplicitPrototype() != null) {
        for (String prop :
             implemented.getImplicitPrototype().getOwnPropertyNames()) {
          expectInterfaceProperty(n, instance, implemented, prop);
        }
      }
    }
  }
1093094
function _gpfDefineCheck$TypeProperty (definition) {
    var typedEntityBuilder = _gpfDefineTypedBuilders[definition.$type];
    if (undefined === typedEntityBuilder) {
        gpf.Error.invalidEntityType();
    }
    return typedEntityBuilder;
}
477752
private void checkCallConventions(NodeTraversal t, Node n) {
    SubclassRelationship relationship =
        compiler.getCodingConvention().getClassesDefinedByCall(n);
    TypedScope scope = t.getTypedScope();
    if (relationship != null) {
      ObjectType superClass =
          TypeValidator.getInstanceOfCtor(
              scope.lookupQualifiedName(QualifiedName.of(relationship.superclassName)));
      ObjectType subClass =
          TypeValidator.getInstanceOfCtor(
              scope.lookupQualifiedName(QualifiedName.of(relationship.subclassName)));
      if (relationship.type == SubclassType.INHERITS
          && superClass != null
          && !superClass.isEmptyType()
          && subClass != null
          && !subClass.isEmptyType()) {
        validator.expectSuperType(n, superClass, subClass);
      }
    }
  }
1214418
@Override
    protected void checkType() {
        if (!isDependent() && getEnhancedAnnotated().isParameterizedType()) {
            throw BeanLogger.LOG.managedBeanWithParameterizedBeanClassMustBeDependent(type);
        }
        boolean passivating = beanManager.isPassivatingScope(getScope());
        if (passivating && !isPassivationCapableBean()) {
            if (!getEnhancedAnnotated().isSerializable()) {
                throw BeanLogger.LOG.passivatingBeanNeedsSerializableImpl(this);
            } else if (hasDecorators() && !allDecoratorsArePassivationCapable()) {
                throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableDecorator(this, getFirstNonPassivationCapableDecorator());
            } else if (hasInterceptors() && !allInterceptorsArePassivationCapable()) {
                throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableInterceptor(this, getFirstNonPassivationCapableInterceptor());
            }
        }
    }
1214004
def typechecked_func(func, force = False, argType = None, resType = None, prop_getter = False):
    
    if not pytypes.checking_enabled and not pytypes.do_logging_in_typechecked:
        return func
    assert(_check_as_func(func))
    if not force and is_no_type_check(func):
        return func
    if hasattr(func, 'do_typecheck'):
        func.do_typecheck = True
        return func
    elif hasattr(func, 'do_logging'):
        # actually shouldn't happen
        return _typeinspect_func(func, True, func.do_logging, argType, resType, prop_getter)
    else:
        return _typeinspect_func(func, True, False, argType, resType, prop_getter)
693345
def _ValidateArguments(arg_dict, type_check_dict):
  """"""
  messages = []
  for arg_name, arg_value in arg_dict.items():
    if arg_name in type_check_dict:
      type_check = type_check_dict[arg_name]
      res = _ValidateValue(arg_value, type_check)
      if not res:
        message = ("Invalid value '%s' for argument %s. Expected %s" %
                   (arg_value, arg_name, _FormatTypeCheck(type_check)))
        messages.append(message)
  return messages
1031644
public Violation checkInstantiation(
      Collection<TypeVariableSymbol> typeParameters, Collection<Type> typeArguments) {
    return Streams.zip(
            typeParameters.stream(),
            typeArguments.stream(),
            (sym, type) -> {
              if (!hasThreadSafeTypeParameterAnnotation(sym)) {
                return Violation.absent();
              }
              Violation info =
                  isThreadSafeType(
                      /* allowContainerTypeParameters= */ true,
                      /* containerTypeParameters= */ ImmutableSet.of(),
                      type);
              if (!info.isPresent()) {
                return Violation.absent();
              }
              return info.plus(
                  String.format(
                      "instantiation of '%s' is %s", sym, purpose.mutableOrNotThreadSafe()));
            })
        .filter(Violation::isPresent)
        .findFirst()
        .orElse(Violation.absent());
  }