Skip to content

Instantly share code, notes, and snippets.

@YannRobert
Last active December 11, 2015 06:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YannRobert/4557761 to your computer and use it in GitHub Desktop.
Save YannRobert/4557761 to your computer and use it in GitHub Desktop.
Patch proposal for linkedin/glu#196
--- a/utils/org.linkedin.glu.utils/src/main/java/org/linkedin/glu/utils/core/DisabledFeatureProxy.java
+++ b/utils/org.linkedin.glu.utils/src/main/java/org/linkedin/glu/utils/core/DisabledFeatureProxy.java
@@ -39,6 +39,14 @@ public class DisabledFeatureProxy implements InvocationHandler
@Override
public Object invoke(Object o, Method method, Object[] objects) throws Throwable
{
- throw new DisabledFeatureException(_feature);
+ final String methodName = method.getName();
+ if (methodName.equals("hashCode") && method.getParameterTypes().length == 0) {
+ return o.hashCode();
+ } else {
+ if (methodName.equals("equals") && method.getParameterTypes().length == 1) {
+ return o.equals(objects[0]);
+ }
+ throw new DisabledFeatureException(_feature);
+ }
}
}
@YannRobert
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment