public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Class does not implement the requested interface
@ 2024-01-03 23:33 Panicz Maciej Godek
  2024-01-04  1:18 ` Per Bothner
  0 siblings, 1 reply; 4+ messages in thread
From: Panicz Maciej Godek @ 2024-01-03 23:33 UTC (permalink / raw)
  To: kawa

[-- Attachment #1: Type: text/plain, Size: 2408 bytes --]

I have another weird bug.
When I run a test suite for GRASP (by running Kawa directly, without
precompiling), I get the following error:

Exception in thread "main" java.lang.IncompatibleClassChangeError: Class
editor.interfaces.NoEditor does not implement the requested interface
editor.interfaces.WithCursor
at
;editor.CharPainter.markEditorCursor$Ex(text-painter.scm:85)
(stack trace continues)

The thing is, that all the required methods from the interface WithCursor
are implemented by NoEditor.

When I analyze the compiled classes, I get this (sorry for the formatting):

$ javap WithCursor.class
Compiled from "painting.scm"
public interface editor.interfaces.WithCursor {
public abstract void markCursor$Ex(gnu.math.RealNum, gnu.math.RealNum);
public abstract editor.interfaces.Position cursorPosition();
public abstract void setCursorColumn$Ex(gnu.math.RealNum);
public abstract gnu.math.RealNum cursorColumn();
public abstract gnu.math.RealNum currentLineHeight();
public abstract gnu.math.RealNum previousLineHeight();
}

$ javap Editor.class
Compiled from "elements.scm"
public interface editor.interfaces.Editor extends
editor.interfaces.Embeddable,java.lang.Cloneable,editor.interfaces.WithCursor
{
public abstract void addPostDrawAction$Ex(gnu.mapping.Procedure);
}

$ javap NoEditor.class
Compiled from "elements.scm"
public class editor.interfaces.NoEditor extends editor.interfaces.NullPane
implements editor.interfaces.Editor {
public editor.interfaces.Position marked;
public void addPostDrawAction$Ex(gnu.mapping.Procedure);
public void markCursor$Ex(gnu.math.RealNum, gnu.math.RealNum);
public gnu.math.RealNum currentLineHeight();
public gnu.math.RealNum previousLineHeight();
public editor.interfaces.Position cursorPosition();
public void setCursorColumn$Ex(gnu.math.RealNum);
public gnu.math.RealNum cursorColumn();
public editor.interfaces.NoEditor();
}

So it seems that all the requested methods of WithCursor (in particular
mark-cursor!) are present in the compiled code

NoEditor isn't used by the compiled code (it's a null-object that is
substituted by the actual instance early in the program's life time), but I
wanted to use it in the test suite to limit the dependencies of the test -
so I'm not sure if the compiled code wouldn't break here as well.

But I wonder why Kawa claims that the interface isn't implemented when
clearly all the required methods are present.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-04 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03 23:33 Class does not implement the requested interface Panicz Maciej Godek
2024-01-04  1:18 ` Per Bothner
2024-01-04  6:59   ` Panicz Maciej Godek
2024-01-04  9:49     ` Panicz Maciej Godek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).