diff options
| author | Sam Ruby <rubys@php.net> | 2000-02-17 06:44:14 +0000 | 
|---|---|---|
| committer | Sam Ruby <rubys@php.net> | 2000-02-17 06:44:14 +0000 | 
| commit | 08dc9ba24f7d4ab12dc61b2097dc3626bc3c25dc (patch) | |
| tree | 1ba01b7ee55926eb59ef58825c9f5c3c1a0fb3a9 /ext/java/reflect.java | |
| parent | 18f57df605b9414a7fbb2df422f5ddf5c48872d3 (diff) | |
| download | php-git-08dc9ba24f7d4ab12dc61b2097dc3626bc3c25dc.tar.gz | |
Allow non-public enumerations to be accessed
Diffstat (limited to 'ext/java/reflect.java')
| -rw-r--r-- | ext/java/reflect.java | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/ext/java/reflect.java b/ext/java/reflect.java index b282aa0932..52d39857db 100644 --- a/ext/java/reflect.java +++ b/ext/java/reflect.java @@ -197,6 +197,23 @@ class reflect {    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(); | 
