Ensure a constructor has the required static methods

@author   Jelle De Loecker   <jelle@kipdola.be>
@since    0.3.4
@version  0.3.4

@param    {Function}   newConstructor
769461
function ensureConstructorStaticMethods(newConstructor) {

		if (typeof newConstructor.setMethod !== 'function') {
			Blast.defineValue(newConstructor, protoPrepareStaticProperty);
			Blast.defineValue(newConstructor, protoSetStaticProperty);
			Blast.defineValue(newConstructor, protoPrepareProperty);
			Blast.defineValue(newConstructor, protoEnforceProperty);
			Blast.defineValue(newConstructor, protoDecorateMethod);
			Blast.defineValue(newConstructor, protoStaticCompose);
			Blast.defineValue(newConstructor, protoGetChildren);
			Blast.defineValue(newConstructor, protoSetProperty);
			Blast.defineValue(newConstructor, protoConstitute);
			Blast.defineValue(newConstructor, protoSetStatic);
			Blast.defineValue(newConstructor, protoSetMethod);
			Blast.defineValue(newConstructor, protoCompose);

			if (newConstructor.extend == null) {
				Blast.defineValue(newConstructor, 'extend', protoExtend);
			}
		}
	}
758779
private Object initiateByConstructor(Class<?> targetClass, List<Object> objects) throws Exception {
        Constructor<?> constr = targetClass.getConstructor(getClassList(objects));
        return constr.newInstance(objects.toArray());
    }
1191934
function inherits(constructor, superConstructor) {
  constructor.prototype = Object.create(superConstructor.prototype, {
    constructor: {
      value: constructor
    }
  });
  return constructor;
}
1270645
function javaClassConstructorProxy() {
    var args = [name];
    for (var i = 0; i < arguments.length; i++) {
      args.push(arguments[i]);
    }
    return java.newInstanceSync.apply(java, args);
  }
495554
function (O, defaultConstructor) {
		// 7.3.20.1 Assert: Type(O) is Object.
		if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
			throw new TypeError('Assertion failed: Type(O) is not Object');
		}
		// 7.3.20.2 Let C be ? Get(O, "constructor").
		var C = O.constructor;
		// 7.3.20.3 If C is undefined, return defaultConstructor.
		if (typeof C === 'undefined') {
			return defaultConstructor;
		}
		// 7.3.20.4 If Type(C) is not Object, throw a TypeError exception
		if (!C || (typeof C !== 'object' && typeof C !== 'function')) {
			throw new TypeError('O.constructor is not an Object');
		}
		// 7.3.20.5 Let S be ? Get(C, @@species).
		var S = typeof Symbol === 'function' && typeof Symbol.species === 'symbol' ? C[Symbol.species] : undefined;
		// 7.3.20.6 If S is either undefined or null, return defaultConstructor.
		if (S === undefined || S === null) {
			return defaultConstructor;
		}
		// 7.3.20.7 If IsConstructor(S) is true, return S.
		if (typeof S === 'function' && S.prototype) {
			return S;
		}
		// 7.3.20.8 Throw a TypeError exception.
		throw new TypeError('no constructor found');
	}
209200
function Constructor() {
                // All construction is actually done in the init method.
                if (!initializing) {
                    return this.constructor !== Constructor && arguments.length ?
                    // We are being called without `new` or we are extending.
                    arguments.callee.extend.apply(arguments.callee, arguments) :
                    // We are being called with `new`.
                    this.constructor.newInstance.apply(this.constructor, arguments);
                }
            }
1190105
public boolean hasDefaultConstructor() {
	    if (!delegate.isPresent()) {
	        return false;
	    }
	    
	    final Constructor<?>[] constructors = delegateClass().getConstructors();
        for (final Constructor<?> constructor : constructors) {
            if (constructor.getParameterTypes().length == 0) {
                return true;
            }
        }
        
        return false;
	}
273816
function extend(constructor, superConstructor, methods){
  util.inherits(constructor, superConstructor);

  for (var i in methods){
    constructor.prototype[i] = methods[i];
  }
}
472420
public PojoBuilder withCompleteConstructor() {
		pojoCreationCheck();

		// first we need to check if there are any fields to add to constructor
		// because default constructor (without fields) is already present
		Map<String, JFieldVar> nonTransientAndNonStaticFields = getNonTransientAndNonStaticFields();

		// if nonTransientAndNonStaticFields is not empty
		if (!Optional.ofNullable(nonTransientAndNonStaticFields).map(Map::isEmpty).orElse(true)) {
			// Create complete constructor
			JMethod constructor = this.pojo.constructor(JMod.PUBLIC);
			Map<String, JVar> superParametersToAdd = getSuperParametersToAdd(this.pojo);
			addSuperConstructorInvocation(constructor, superParametersToAdd);
			constructor.javadoc().add("Creates a new " + this.pojo.name() + ".");

			Iterator<Map.Entry<String, JFieldVar>> iterator = nonTransientAndNonStaticFields.entrySet().iterator();

			while (iterator.hasNext()) {
				Map.Entry<String, JFieldVar> pair = iterator.next();

				constructor.param(pair.getValue().type(), pair.getKey());
				constructor.body().assign(JExpr._this().ref(pair.getKey()), JExpr.ref(pair.getKey()));
			}
		}

		return this;
	}
1133911
public static Constructor<?> getEmptyConstructor(Class<?> clazz) {
        Constructor<?> c = clazz.getDeclaredConstructors()[0];
        for (int i = 0; i < clazz.getDeclaredConstructors().length; i++) {
            if (clazz.getDeclaredConstructors()[i].getParameterTypes().length < 1) {
                c = clazz.getDeclaredConstructors()[i];
                break;
            }
        }

        return c;
    }
783057
function ElementConstructor() {

	var attr,
	    i;

	// Trigger an initial attribute change
	for (i = 0; i < this.attributes.length; i++) {
		attr = this.attributes[i];
		this.attributeChangedCallback(attr.name, null, attr.value, true);
	}
}
32266
@Check
	public void checkSuperConstructor(SarlSkill skill) {
		checkSuperConstructor(
				skill,
				XTEND_TYPE_DECLARATION__NAME,
				doGetConstructorParameterTypes(Skill.class, skill));
	}
561669
private void buildConstructor( TypeSpec.Builder typeBuilder ) {
        MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder().addModifiers( Modifier.PUBLIC );

        if ( !beanInfo.getParameterizedTypes().isEmpty() ) {
            Class mapperClass;
            String mapperNameFormat;
            if ( isSerializer() ) {
                mapperClass = Serializer.class;
                mapperNameFormat = TYPE_PARAMETER_SERIALIZER_FIELD_NAME;
            } else {
                mapperClass = Deserializer.class;
                mapperNameFormat = TYPE_PARAMETER_DESERIALIZER_FIELD_NAME;
            }

            for ( int i = 0; i < beanInfo.getParameterizedTypes().size(); i++ ) {
                JClassType argType = beanInfo.getParameterizedTypes().get( i );
                String mapperName = String.format( mapperNameFormat, i );
                TypeName mapperType = parameterizedName( mapperClass, argType );

                FieldSpec field = FieldSpec.builder( mapperType, mapperName, Modifier.PRIVATE, Modifier.FINAL ).build();
                typeBuilder.addField( field );

                ParameterSpec parameter = ParameterSpec.builder( mapperType, mapperName ).build();
                constructorBuilder.addParameter( parameter );
                constructorBuilder.addStatement( "this.$N = $N", field, parameter );
            }
        }

        typeBuilder.addMethod( constructorBuilder.build() );
    }
58945
@SuppressWarnings("unchecked")
    public static <T> Constructor<T> findBestTypedConstructor( Class<T> klass, Object... args ) throws NoSuchMethodException
    {
        for (Constructor constructor : klass.getConstructors())
        {
            if (typesMatch( constructor, args )) return constructor;
        }

        throw noSuitableConstructorException(klass, args);
    }
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;
    }
663909
function checkForConstructor(node) {
            if (node.kind !== "constructor") {
                return;
            }

            const body = node.value.body.body;
            const ctorParams = node.value.params;
            const superClass = node.parent.parent.superClass;

            if (superClass ? isRedundantSuperCall(body, ctorParams) : (body.length === 0)) {
                context.report({
                    node,
                    message: "Useless constructor."
                });
            }
        }
1161097
function isConstructor(name) {
            const match = CTOR_PREFIX_REGEX.exec(name);

            // Not a constructor if name has no characters apart from '_', '$' and digits e.g. '_', '$$', '_8'
            if (!match) {
                return false;
            }

            const firstChar = name.charAt(match.index);

            return firstChar === firstChar.toUpperCase();
        }