Fixed FELIX-3271
The proxy must supports hashCode and equals.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1214130 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
index 36a17f3..64475f4 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
@@ -863,7 +863,7 @@
/**
* A method is invoked on the proxy object.
* If the method is the {@link IPOJOServiceFactory#getService(ComponentInstance)}
- * method, this method creates a service object if no already created for the asking
+ * method, this method creates a service object if not already created for the asking
* component instance.
* If the method is {@link IPOJOServiceFactory#ungetService(ComponentInstance, Object)}
* the service object is unget (i.e. removed from the map and deleted).
@@ -887,9 +887,18 @@
return null;
}
+ // Regular methods from java.lang.Object : equals and hashCode
+ if (arg1.getName().equals("equals") && arg2 != null && arg2.length == 1) {
+ return this.equals(arg2[0]);
+ }
+
+ if (arg1.getName().equals("hashCode")) {
+ return this.hashCode();
+ }
+
throw new UnsupportedOperationException("This service requires an advanced creation policy. "
+ "Before calling the service, call the getService(ComponentInstance) method to get "
- + "the service object. ");
+ + "the service object. - Method called: " + arg1.getName());
}
/**