@SuppressWarnings("rawtypes")
	public static void compareAccumulatorTypes(
			Object name,
			Class<? extends Accumulator> first,
			Class<? extends Accumulator> second) throws UnsupportedOperationException {
		if (first == null || second == null) {
			throw new NullPointerException();
		}

		if (first != second) {
			if (!first.getName().equals(second.getName())) {
				throw new UnsupportedOperationException("The accumulator object '" + name
					+ "' was created with two different types: " + first.getName() + " and " + second.getName());
			} else {
				// damn, name is the same, but different classloaders
				throw new UnsupportedOperationException("The accumulator object '" + name
						+ "' was created with two different classes: " + first + " and " + second
						+ " Both have the same type (" + first.getName() + ") but different classloaders: "
						+ first.getClassLoader() + " and " + second.getClassLoader());
			}
		}
	}
@ SuppressWarnings ( "rawtypes" ) public static void compareAccumulatorTypes ( Object name , Class < ? extends Accumulator > first , Class < ? extends Accumulator > second ) throws UnsupportedOperationException { if ( first == null || second == null ) { throw new NullPointerException ( ) ; } if ( first != second ) { if ( ! first . getName ( ) . equals ( second . getName ( ) ) ) { throw new UnsupportedOperationException ( "The accumulator object '" + name + "' was created with two different types: " + first . getName ( ) + " and " + second . getName ( ) ) ; } else { throw new UnsupportedOperationException ( "The accumulator object '" + name + "' was created with two different classes: " + first + " and " + second + " Both have the same type (" + first . getName ( ) + ") but different classloaders: " + first . getClassLoader ( ) + " and " + second . getClassLoader ( ) ) ; } } }
Compare both classes and throw {@link UnsupportedOperationException} if
they differ.