Fixed a couple of minor bugs.

This commit is contained in:
Kristian S. Stangeland 2012-09-29 22:25:09 +02:00
parent 721d92bd4f
commit 15b33925c0
3 changed files with 9 additions and 3 deletions

View File

@ -41,6 +41,11 @@ public class PrioritizedListener<TListener> implements Comparable<PrioritizedLis
}
}
@Override
public int hashCode() {
return Objects.hashCode(listener);
}
/**
* Retrieve the underlying listener.
* @return Underlying listener.

View File

@ -206,11 +206,12 @@ public final class StructureCompiler {
// Call the define method
try {
if (defineMethod == null) {
defineMethod = ClassLoader.class.getDeclaredMethod("defineClass",
Method defined = ClassLoader.class.getDeclaredMethod("defineClass",
new Class<?>[] { String.class, byte[].class, int.class, int.class });
// Awesome. Now, create and return it.
defineMethod.setAccessible(true);
defined.setAccessible(true);
defineMethod = defined;
}
@SuppressWarnings("rawtypes")

View File

@ -172,11 +172,11 @@ public class DefaultInstances {
}
Constructor<T> minimum = getMinimumConstructor(type);
int parameterCount = minimum.getParameterTypes().length;
// Create the type with this constructor using default values. This might fail, though.
try {
if (minimum != null) {
int parameterCount = minimum.getParameterTypes().length;
Object[] params = new Object[parameterCount];
Class<?>[] types = minimum.getParameterTypes();