BZ #14: Loading constraint on instance method instance parameter is too strict

Status fields:

creation_ts:2005-12-18 00:14
I had trouble installing SnipSnap in Expert mode on Cacao 0.93. I got this
exception in the log:

java.lang.LinkageError: loading constraint violated XXX add message

I think I diagnosed the problem to this line in resolve.c:

name = container->name; /* XXX should this be declarer->name? */

Yes, I think it should be declarer->name (or maybe this case doesn't need to be
checked at all? I'm not really familiar with class loading constraints). Anyway,
when I changed it to declarer->name, the exception went away. But I don't really
understand loading constraints, so I could be wrong.

Comment #1 by on 2005-12-20 18:30:58

resolve_method imposed an invalid loading constraint on the 'this' parameter
of instance methods. The bogus constraint was that the loader of the caller
(referer) and the loader of the *declarer* of the method agree on the class
called container->name. This is incorrect, as the loader of the declarer
is not responsible for the container class -- a subclass of declarer -- in
any way. The correct constraint is: the loader of the caller (referer) and the
loader of the callee (*container*) must agree on container->name.

The subclass relation from container to declarer is protected by loading
constraints imposed during preparation of container, so we do not have to
address that here.

This only affects the 'this' parameter, as it implicitely has the type
`container`. All other parameters have the same type as in the declaration
by `declarer` and so are unaffected.

Note: The proposed change to constrain on declarer->name would create a
valid but insufficiently strict constraint.