cvs: /php4/ext/java reflect.java
| From: | Sam Ruby | Date: | Thu, 17 Feb 2000 06:44:42 +0000 |
| Subject: | cvs: /php4/ext/java reflect.java | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-10387@lists.php.net to get a copy of this message | ||
rubys Wed Feb 16 22:44:42 2000 EDT
Modified files:
/php4/ext/java reflect.java
Log:
Allow non-public enumerations to be accessed
Index: php4/ext/java/reflect.java
diff -u php4/ext/java/reflect.java:1.4 php4/ext/java/reflect.java:1.5
--- php4/ext/java/reflect.java:1.4 Fri Dec 31 17:31:39 1999
+++ php4/ext/java/reflect.java Wed Feb 16 22:44:12 2000
@@ -197,6 +197,23 @@
public static void Invoke
(Object object, String method, Object args[], long result)
{
+
+ // Apparently, if a class is not declared "public" it is illegal to
+ // access a method of this class via Invoke. We can't work around
+ // all such cases, but enumeration does appear to be a common case.
+ if (object instanceof Enumeration && args.length == 0) {
+
+ if (method.equalsIgnoreCase("hasMoreElements")) {
+ setResultFromBoolean(result, ((Enumeration)object).hasMoreElements());
+ return;
+ }
+
+ if (method.equalsIgnoreCase("nextElement")) {
+ setResultFromObject(result, ((Enumeration)object).nextElement());
+ return;
+ }
+ }
+
try {
Vector matches = new Vector();