Check for a valid prototype of a static constructor.

@param constructor the constructor to analyze.
771757
@Check
	public void checkStaticConstructorPrototype(XtendConstructor constructor) {
		if (constructor.isStatic()) {
			if (!constructor.getAnnotations().isEmpty()) {
				error(Messages.SARLValidator_23,
						constructor,
						XtendPackage.eINSTANCE.getXtendAnnotationTarget_Annotations(),
						ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
						ANNOTATION_WRONG_TARGET);
			}
			if (!constructor.getTypeParameters().isEmpty()) {
				error(Messages.SARLValidator_24,
						constructor,
						XtendPackage.eINSTANCE.getXtendExecutable_TypeParameters(),
						ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
						CONSTRUCTOR_TYPE_PARAMS_NOT_SUPPORTED);
			}
			if (!constructor.getParameters().isEmpty()) {
				error(Messages.SARLValidator_26,
						constructor,
						XtendPackage.eINSTANCE.getXtendExecutable_Parameters(),
						ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
						UNEXPECTED_FORMAL_PARAMETER);
			}
			if (!constructor.getExceptions().isEmpty()) {
				error(Messages.SARLValidator_27,
						constructor,
						XtendPackage.eINSTANCE.getXtendExecutable_Parameters(),
						ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
						UNEXPECTED_EXCEPTION_THROW);
			}
			if (constructor.getExpression() == null) {
				error(Messages.SARLValidator_83,
						constructor,
						XtendPackage.eINSTANCE.getXtendExecutable_Expression(),
						ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
						MISSING_BODY);
			}
		}
	}
761691
private boolean constructorMayHaveBeenAddedByCompiler(ConstructorNode constructor) {
    Parameter[] params = constructor.getParameters();
    Statement firstStat = constructor.getFirstStatement();
    return AstUtil.isJointCompiled(spec.getAst()) && constructor.isPublic()
      && params != null && params.length == 0 && firstStat == null;
  }
139481
function constructors(obj) {
		// supports: getter and normal function
		if (arguments.length === 0) obj = this;

		if (obj == null) return [];

		// convert to object from primitives
		if (typeof obj !== 'object' && typeof obj !== 'function')
			obj = Object(obj);

		if (obj === Array) return [Array, Function.prototype];
		if (obj === Error) return [Error, Function.prototype];
		if (obj === RegExp) return [RegExp, Function.prototype];
		if (obj === Object) return [Object, Function.prototype];
		if (obj === String) return [String, Function.prototype];
		if (obj === Number) return [Number, Function.prototype];
		if (obj === Boolean) return [Boolean, Function.prototype];
		if (obj === Function) return [Function, Function.prototype];
		if (obj.constructor === Array) return [Array, Object];
		if (obj.constructor === Error) return [Error, Object];
		if (obj.constructor === RegExp) return [RegExp, Object];
		if (obj.constructor === Object) return [Object];
		if (obj.constructor === String) return [String, Object];
		if (obj.constructor === Number) return [Number, Object];
		if (obj.constructor === Boolean) return [Boolean, Object];

		var classes = [];

		if (obj instanceof Function) {
			// for Class/constructor
			for (; obj; obj = (obj.super_ || obj['super'] || getProto(obj)))
				if (typeof obj === 'function')
					classes.push(obj);

			if (classes.length === 0 ||
					classes[classes.length - 1] !== Function.prototype)
				classes.push(Function.prototype);
		}
		else {
			var saveObj = obj;

			// for instance/object
			for (; obj; obj = getProto(obj)) {
				if (obj.hasOwnProperty) {
					if (obj.hasOwnProperty('constructor'))
						classes.push(obj.constructor);
				}
				else if (obj.constructor) {
					if (classes.length === 0 ||
							classes[classes.length - 1] !== obj.constructor)
						classes.push(obj.constructor);
				}
			}

			if (classes.length === 0 &&
					saveObj && typeof saveObj.constructor === 'function')
				classes = [saveObj.constructor];

			if (classes.length === 0 ||
					classes[classes.length - 1] !== Object)
				classes.push(Object);
		}

		return classes;
	}
1264096
public static boolean hasDefaultConstructor(TypeDef item) {
        if (item == null) {
            return false;
        } else if (item.getConstructors().isEmpty()) {
            return true;
        } else {
            for (Method constructor : item.getConstructors()) {
                if (constructor.getArguments().size() == 0) {
                    return true;
                }
            }
        }
        return false;
    }
865537
@Check(CheckType.FAST)
	public void checkSuperType(SarlEvent event) {
		checkSuperTypes(
				event,
				SARL_EVENT__EXTENDS,
				Utils.singletonList(event.getExtends()),
				Event.class,
				false);
	}
429658
def has_trivial_constructor(class_):
    """"""
    class_ = class_traits.get_declaration(class_)
    trivial = find_trivial_constructor(class_)
    if trivial and trivial.access_type == 'public':
        return trivial
601455
static <T> Pair<Boolean, T> constructViaConstructor(Class<T> type, String fromValue) {

		Constructor[] allConstructors = type.getDeclaredConstructors();
		for (Constructor ctor : allConstructors) {

			Class<?>[] pType = ctor.getParameterTypes();
			if (pType.length == 1) { // ok ... match ... might be possible to use

				try {

					for (Class primitive : SIMPLE_TYPE) {

						if (pType[0].isAssignableFrom(primitive)) {

							Object value = stringToPrimitiveType(fromValue, primitive);
							return new Pair(true, ctor.newInstance(value));
						}
					}
				}
				catch (IllegalAccessException | InstantiationException | InvocationTargetException e) {
					//continue; // try next one ... if any
					log.warn("Failed constructing: " + ctor, e);
				}
			}
		}

		return new Pair<>(false, null);
	}
905830
@Override
    public boolean hasInstance(Scriptable value) {
        Scriptable proto = value.getPrototype();
        while (proto != null) {
            if (proto.equals(this))
                return true;
            proto = proto.getPrototype();
        }

        return false;
    }
979780
function Validator() {
    this._roots = {
        stdlib: null,
        foreign: null,
        heap: null
    };
    this._globals = env(this);
    this._locals = null;
    this._src = null;
    this._result = null;
}
123472
private static boolean hasUnknownOrEmptySupertype(FunctionType ctor) {
    checkArgument(ctor.isConstructor() || ctor.isInterface());
    checkArgument(!ctor.isUnknownType());

    // The type system should notice inheritance cycles on its own
    // and break the cycle.
    while (true) {
      ObjectType maybeSuperInstanceType =
          ctor.getPrototype().getImplicitPrototype();
      if (maybeSuperInstanceType == null) {
        return false;
      }
      if (maybeSuperInstanceType.isUnknownType()
          || maybeSuperInstanceType.isEmptyType()) {
        return true;
      }
      ctor = maybeSuperInstanceType.getConstructor();
      if (ctor == null) {
        return false;
      }
      checkState(ctor.isConstructor() || ctor.isInterface());
    }
  }
106790
public static boolean isConstructor(JCTree tree) {
        if (tree.hasTag(METHODDEF)) {
            Name name = ((JCMethodDecl) tree).name;
            return name == name.table.names.init;
        } else {
            return false;
        }
    }
47985
function isConstructor(obj) {
    if (Type.isObject(obj)) {
        return Object.getPrototypeOf(obj).hasOwnProperty("constructor");
    }
    return false;
}
535022
function (prototype) {
      if (!_.isObject(prototype)) return {};
      if (nativeCreate) return nativeCreate(prototype);
      Ctor.prototype = prototype;
      var result = new Ctor();
      Ctor.prototype = null;
      return result;
    }
709535
protected void validateZeroArgConstructor(List<Throwable> errors) {
        if (!getTestClass().isANonStaticInnerClass()
                && hasOneConstructor()
                && (getTestClass().getOnlyConstructor().getParameterTypes().length != 0)) {
            String gripe = "Test class should have exactly one public zero-argument constructor";
            errors.add(new Exception(gripe));
        }
    }
786203
function inherits(constructor, superConstructor) {
  constructor.super_ = superConstructor;
  constructor.prototype = Object.create(superConstructor.prototype, {
    'constructor': {
      'value': constructor,
      'enumerable': false,
      'writable': true,
      'configurable': true
    }
  });
}
205411
static void throwExceptionIfConstructorWasNotFound(Class<?> type, Constructor<?> potentialConstructor,
                                                       Object... arguments) {
        if (potentialConstructor == null) {
            String message = "No constructor found in class '" + getOriginalUnmockedType(type).getName() + "' with "
                                     + "parameter types: [ " + getArgumentTypesAsString(arguments) + " ].";
            throw new ConstructorNotFoundException(message);
        }
    }
902975
def has_copy_constructor(class_):
    """"""
    class_ = class_traits.get_declaration(class_)
    copy_constructor = find_copy_constructor(class_)
    if copy_constructor and copy_constructor.access_type == 'public':
        return copy_constructor