harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject Re: [classlib][nio][compatibility] Harmony doesn't support to call FileLock.release by reflection.
Date Tue, 24 Apr 2007 14:15:09 GMT
On 4/24/07, Tim Ellison <t.p.ellison@gmail.com> wrote:
>
> Andrew Zhang wrote:
> > On 4/24/07, Tim Ellison <t.p.ellison@gmail.com> wrote:
> >>
> >> Andrew Zhang wrote:
> >> > Harmony doesn't support to call FileLock.release by reflection.
> >> Following
> >> > test case shows the problem. The failure reason is that our
> >> implementation
> >> > class FileLockImpl is not public. A jira issue (
> >> > https://issues.apache.org/jira/browse/HARMONY-3743) is filed. Shall
> we
> >> fix
> >> > it for compatibility reason? Thanks!
> >> <snip>
> >>
> >> Is there some application that does this, or is it hypothetical?
> >
> >
> > Yes, it's from a real application. The intention of this strange code is
> to
> > keep the code compatible with jdk1.1. (The real code even uses
> > reflection to
> > get the FileChannel and FileLock object). The application has some other
> > mechanism to identify which version of jre is running currently.
>
> Hmm. Can you fix the app to include a "getSuperclass()" to bring it up
> to the public FileLock type?
> e.g.
>   lock.getClass().getSuperclass().getMethod("release", (Class[]) null);
>
> (for extra credit, they should walk up until they reach the right type
> and not assume it is a direct subclass).


hm... ok, if we won't change the  FileLockImpl to public, I'll fix the app.
It can call "Class.forName("java.nio.channels.FileLock");" instead of
calling lock.getClass() directly.

Regards,
> Tim
>



-- 
Best regards,
Andrew Zhang

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message