src/main/java/js/container/ManagedClass.java
private static Constructor<?> getDeclaredConstructor(Class<?> implementationClass) {
		if (implementationClass == null) {
			return null;
		}
		Constructor<?>[] declaredConstructors = (Constructor<?>[]) implementationClass.getDeclaredConstructors();
		if (declaredConstructors.length == 0) {
			throw new BugError("Invalid implementation class |%s|. Missing constructor.", implementationClass);
		}
		Constructor<?> constructor = null;

		for (Constructor<?> declaredConstructor : declaredConstructors) {
			// synthetic constructors are created by compiler to circumvent JVM limitations, JVM that is not evolving with
			// the same speed as the language; for example, to allow outer class to access private members on a nested class
			// compiler creates a constructor with a single argument of very nested class type
			if (declaredConstructor.isSynthetic()) {
				continue;
			}
			if (declaredConstructor.getParameterTypes().length == 0) {
				continue;
			}
			if (declaredConstructor.getAnnotation(Test.class) != null) {
				continue;
			}
			if (constructor != null) {
				throw new BugError("Implementation class |%s| has not a single constructor with parameters.", implementationClass);
			}
			constructor = declaredConstructor;
		}

		if (constructor == null) {
			constructor = declaredConstructors[0];
		}
		constructor.setAccessible(true);
		return constructor;
	}
private static Constructor<?> getDeclaredConstructor(Class<?> implementationClass) {
		if (implementationClass == null) {
			return null;
		}
		Constructor<?>[] declaredConstructors = (Constructor<?>[]) implementationClass.getDeclaredConstructors();
		if (declaredConstructors.length == 0) {
			throw new BugError("Invalid implementation class |%s|. Missing constructor.", implementationClass);
		}
		Constructor<?> constructor = null;

		for (Constructor<?> declaredConstructor : declaredConstructors) {
			// synthetic constructors are created by compiler to circumvent JVM limitations, JVM that is not evolving with
			// the same speed as the language; for example, to allow outer class to access private members on a nested class
			// compiler creates a constructor with a single argument of very nested class type
			if (declaredConstructor.isSynthetic()) {
				continue;
			}
			if (declaredConstructor.getParameterTypes().length == 0) {
				continue;
			}
			if (declaredConstructor.getAnnotation(Test.class) != null) {
				continue;
			}
			if (constructor != null) {
				throw new BugError("Implementation class |%s| has not a single constructor with parameters.", implementationClass);
			}
			constructor = declaredConstructor;
		}

		if (constructor == null) {
			constructor = declaredConstructors[0];
		}
		constructor.setAccessible(true);
		return constructor;
	}
private static Constructor < ? > getDeclaredConstructor ( Class < ? > implementationClass ) { if ( implementationClass == null ) { return null ; } Constructor < ? > [ ] declaredConstructors = ( Constructor < ? > [ ] ) implementationClass . getDeclaredConstructors ( ) ; if ( declaredConstructors . length == 0 ) { throw new BugError ( "Invalid implementation class |%s|. Missing constructor." , implementationClass ) ; } Constructor < ? > constructor = null ; for ( Constructor < ? > declaredConstructor : declaredConstructors ) { // synthetic constructors are created by compiler to circumvent JVM limitations, JVM that is not evolving with
 // the same speed as the language; for example, to allow outer class to access private members on a nested class
 // compiler creates a constructor with a single argument of very nested class type
 if ( declaredConstructor . isSynthetic ( ) ) { continue ; } if ( declaredConstructor . getParameterTypes ( ) . length == 0 ) { continue ; } if ( declaredConstructor . getAnnotation ( Test . class ) != null ) { continue ; } if ( constructor != null ) { throw new BugError ( "Implementation class |%s| has not a single constructor with parameters." , implementationClass ) ; } constructor = declaredConstructor ; } if ( constructor == null ) { constructor = declaredConstructors [ 0 ] ; } constructor . setAccessible ( true ) ; return constructor ; }
Get implementation class constructor. Managed class mandates a single constructor with parameters, no matter if private
or formal parameters count. If both default constructor and constructor with parameters are defined this method returns
constructor with parameters. Returns null if implementation class is missing.

@param implementationClass implementation class, possible null.
@return implementation class constructor or null if given implementation class is null.
@throws BugError if implementation class is an interface, primitive or array and has no constructor at all.
@throws BugError if implementation class has more constructors with parameters.
Get implementation class constructor . Managed class mandates a single constructor with parameters no matter if private or formal parameters count . If both default constructor and constructor with parameters are defined this method returns constructor with parameters . Returns null if implementation class is missing .