Re: Method.invoke() on a non-public class from another package

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Haley writes:
 > Robert Lougher writes:
 > 
 >  > Had a quick look, and in Classpath-0.93 java.util.AbstractMap contains
 >  > a class BasicMapEntry which implements getValue().  BasicMapEntry is
 >  > package-private.  This isn't accessible outside the package.
 >  > 
 >  > In CVS HEAD, this has changed and java.util.AbstractMap contains a
 >  > class SimpleEntry which implements getValue().  SimpleEntry is public.
 >  >  Obviously, this is accessible...
 > 
 > OK, thanks.  I'm working on a gcj patch now.

Done.

Andrew.


2007-04-10  Andrew Haley  <aph@xxxxxxxxxx>

	* java/lang/reflect/natMethod.cc (Method::invoke): In invoke also
	check that the method's declaring class is accessible.

Index: natMethod.cc
===================================================================
*** natMethod.cc	(revision 123473)
--- natMethod.cc	(working copy)
***************
*** 173,182 ****
      }
  
    // Check accessibility, if required.
!   if (! (Modifier::isPublic (meth->accflags) || this->isAccessible()))
      {
        Class *caller = _Jv_StackTrace::GetCallingClass (&Method::class$);
!       if (! _Jv_CheckAccess(caller, declaringClass, meth->accflags))
  	throw new IllegalAccessException;
      }
  
--- 173,186 ----
      }
  
    // Check accessibility, if required.
!   if (! ((Modifier::isPublic (meth->accflags)
! 	  && Modifier::isPublic (declaringClass->accflags))
! 	 || this->isAccessible()))
      {
        Class *caller = _Jv_StackTrace::GetCallingClass (&Method::class$);
!       if (! _Jv_CheckAccess(caller, declaringClass, meth->accflags)
! 	  || ! _Jv_CheckAccess(caller, declaringClass,
! 			       declaringClass->accflags))
  	throw new IllegalAccessException;
      }
  


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux