src/core/se/jbee/inject/Utils.java
public static <T> Constructor<T> commonConstructor(Class<T> type)
			throws NoMethodForDependency {
		Constructor<?>[] cs = type.getDeclaredConstructors();
		if (cs.length == 0)
			throw new NoMethodForDependency(raw(type));
		Constructor<?> mostParamsConstructor = null;
		for (Constructor<?> c : cs) {
			if (!arrayContains(c.getParameterTypes(), type, (a, b) -> a == b) // avoid self referencing constructors (synthetic) as they cause endless loop
				&& (mostParamsConstructor == null //
					|| (moreVisible(c, mostParamsConstructor) == c
						&& (moreVisible(mostParamsConstructor, c) == c
							|| c.getParameterCount() > mostParamsConstructor.getParameterCount())))) {
				mostParamsConstructor = c;
			}
		}
		if (mostParamsConstructor == null)
			throw new NoMethodForDependency(raw(type));
		@SuppressWarnings("unchecked")
		Constructor<T> c = (Constructor<T>) mostParamsConstructor;
		return c;
	}
public static <T> Constructor<T> commonConstructor(Class<T> type)
			throws NoMethodForDependency {
		Constructor<?>[] cs = type.getDeclaredConstructors();
		if (cs.length == 0)
			throw new NoMethodForDependency(raw(type));
		Constructor<?> mostParamsConstructor = null;
		for (Constructor<?> c : cs) {
			if (!arrayContains(c.getParameterTypes(), type, (a, b) -> a == b) // avoid self referencing constructors (synthetic) as they cause endless loop
				&& (mostParamsConstructor == null //
					|| (moreVisible(c, mostParamsConstructor) == c
						&& (moreVisible(mostParamsConstructor, c) == c
							|| c.getParameterCount() > mostParamsConstructor.getParameterCount())))) {
				mostParamsConstructor = c;
			}
		}
		if (mostParamsConstructor == null)
			throw new NoMethodForDependency(raw(type));
		@SuppressWarnings("unchecked")
		Constructor<T> c = (Constructor<T>) mostParamsConstructor;
		return c;
	}
public static < T > Constructor < T > commonConstructor ( Class < T > type ) throws NoMethodForDependency { Constructor < ? > [ ] cs = type . getDeclaredConstructors ( ) ; if ( cs . length == 0 ) throw new NoMethodForDependency ( raw ( type ) ) ; Constructor < ? > mostParamsConstructor = null ; for ( Constructor < ? > c : cs ) { if ( ! arrayContains ( c . getParameterTypes ( ) , type , ( a , b ) -> a == b ) // avoid self referencing constructors (synthetic) as they cause endless loop && ( mostParamsConstructor == null // || ( moreVisible ( c , mostParamsConstructor ) == c && ( moreVisible ( mostParamsConstructor , c ) == c || c . getParameterCount ( ) > mostParamsConstructor . getParameterCount ( ) ) ) ) ) { mostParamsConstructor = c ; } } if ( mostParamsConstructor == null ) throw new NoMethodForDependency ( raw ( type ) ) ; @ SuppressWarnings ( "unchecked" ) Constructor < T > c = ( Constructor < T > ) mostParamsConstructor ; return c ; }
Returns the constructor with most visible visibility and longest argument
list. Self-referencing constructors are ignored.

@param type constructed type
@return The highest visibility constructor with the most parameters that
does not have the declaring class itself as parameter type (some
compiler seam to generate such a synthetic constructor)
@throws NoMethodForDependency in case the type is not constructible (has
no constructors at all)
Returns the constructor with most visible visibility and longest argument list . Self - referencing constructors are ignored .