[Kaffe] yet another invocation bug found!

Moses DeJong dejong at cs.umn.edu
Thu Feb 4 15:31:56 PST 1999

Hello all.

I seem to have found another problem with the invocation system.
It looks like package access is not getting checked on dynamic
method invocations. Here is a small example that shows the problem.

// File NonMember.java

import java.lang.reflect.*;
import testpkg.PkgMember;

public class NonMember {
    public static void main(String[] argv) throws Exception {
	PkgMember mem = new PkgMember();

	Method foo = PkgMember.class.getDeclaredMethod("foo", null);
	System.out.println("foo is " + foo);

	// This should raise an IllegalAccessException


// File testpkg/PkgMember.java

package testpkg;

import java.util.*;

public class PkgMember {

    // This constructor is public

    public PkgMember() {}

    // This method has package access
    void foo() {}

JDK output

% java NonMember
foo is void testpkg.PkgMember.foo()
java.lang.IllegalAccessException: testpkg/PkgMember
        at NonMember.main(Compiled Code)

Kaffe output

% kaffe NonMember
foo is void testpkg.PkgMember.foo()

I hope that helps
Mo DeJong
dejong at cs.umn.edu

More information about the kaffe mailing list