Bug 284357 Code in ReflectionContributionFactory duplicates #invoke() - with a twist
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ReflectionContributionFactory.java
}
		}
		Method targetMethod = null;
		Method[] methods = object.getClass().getMethods();
		
		if (methods.length == 1) {
			targetMethod = methods[0];
		} else {
			ArrayList<Method> toSort = new ArrayList<Method>();
			for (int i = 0; i < methods.length; i++) {
				Method method = methods[i];
				
				if ((method.getModifiers() & Modifier.PUBLIC) != 0
						&& method.getName().equals(methodName)) {
					toSort.add(method);
				}
			}
			
			
			Collections.sort(toSort, new Comparator<Method>() {
				/*
				 * (non-Javadoc)
				 * 
				 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
				 */
				public int compare(Method m1, Method m2) {
					int l1 = m1.getParameterTypes().length;
					int l2 = m2.getParameterTypes().length;
					return l1 - l2;
				}