public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Panicz Maciej Godek <godek.maciek@gmail.com>
To: kawa <kawa@sourceware.org>
Subject: Class does not implement the requested interface
Date: Thu, 4 Jan 2024 00:33:43 +0100	[thread overview]
Message-ID: <CAMFYt2ZE01=RN_FWpS=qXzh1m6hDfTWcHcYd7cSAcKgTWj6y8A@mail.gmail.com> (raw)

[-- 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.

             reply	other threads:[~2024-01-03 23:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 23:33 Panicz Maciej Godek [this message]
2024-01-04  1:18 ` Per Bothner
2024-01-04  6:59   ` Panicz Maciej Godek
2024-01-04  9:49     ` Panicz Maciej Godek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMFYt2ZE01=RN_FWpS=qXzh1m6hDfTWcHcYd7cSAcKgTWj6y8A@mail.gmail.com' \
    --to=godek.maciek@gmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).