This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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@redhat.com>

	* 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]