public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* gnu.bytecode.ParameterizedType does not implement Externalizable
@ 2022-10-15 15:55 Panicz Maciej Godek
  2022-10-15 17:07 ` Per Bothner
  0 siblings, 1 reply; 3+ messages in thread
From: Panicz Maciej Godek @ 2022-10-15 15:55 UTC (permalink / raw)
  To: kawa

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

Hi,
as some of you may know, I've been working on a visual Scheme environment
that I called GRASP.

Currently it supports two front-ends.
The first one uses Java's AWT for displaying stuff and handling the input,
and the second one uses a Java library called Lanterna for displaying stuff
in the terminal.

So far, I've been running the AWT client by typing

kawa -f grasp-desktop.scm

and the terminal client by typing

CLASSPATH=./lanterna-3.1.1.jar kawa -f grasp-terminal.scm

(the appropriate jar is located in the same directory).

However - since it takes a while to load all the dependencies, I thought
that I could perhaps compile them to .class files.

Compiling the desktop client was fairly unproblematic. However, when I try
to compile the terminal client (also providing lanterna jar in CLASSPATH),
I get the following:

Exception in thread "main" java.lang.Error: gnu.bytecode.ParameterizedType
does not implement Externalizable
        at gnu.expr.LitTable.error(LitTable.java:122)
        at gnu.expr.LitTable.writeObject(LitTable.java:282)
        at gnu.expr.LitTable.emit(LitTable.java:85)
        at gnu.expr.Compilation.generateBytecode(Compilation.java:2039)
        at gnu.expr.Compilation.process(Compilation.java:1832)
        at gnu.expr.ModuleInfo.loadEager(ModuleInfo.java:337)
        at kawa.standard.require.importDefinitions(require.java:291)
        at
kawa.standard.ImportFromLibrary.handleImport(ImportFromLibrary.java:487)
                                                                       at
kawa.standard.ImportFromLibrary.scanImportSet1(ImportFromLibrary.java:296)
        at
kawa.standard.ImportFromLibrary.scanImportSet(ImportFromLibrary.java:264)
                                                                        at
kawa.standard.ImportFromLibrary.scanForm(ImportFromLibrary.java:97)
        at kawa.lang.Translator.scanForm(Translator.java:1615)
        at kawa.lang.Translator.scanBody(Translator.java:1672)
        at kawa.standard.begin.scanForm(begin.java:23)
        at kawa.lang.Translator.scanForm(Translator.java:1615)
        at gnu.kawa.lispexpr.LispLanguage.parse(LispLanguage.java:117)
        at gnu.expr.Language.parse(Language.java:765)
        at gnu.expr.Language.parse(Language.java:759)
        at gnu.expr.Language.parse(Language.java:753)
        at kawa.repl.compileFiles(repl.java:768)
        at kawa.repl.processArgs(repl.java:451)
        at kawa.repl.main(repl.java:830)


I can provide more details about the compilation process, if they could be
helpful in resolving that issue.

Best regards,
Panicz

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

* Re: gnu.bytecode.ParameterizedType does not implement Externalizable
  2022-10-15 15:55 gnu.bytecode.ParameterizedType does not implement Externalizable Panicz Maciej Godek
@ 2022-10-15 17:07 ` Per Bothner
  2022-10-15 20:11   ` Panicz Maciej Godek
  0 siblings, 1 reply; 3+ messages in thread
From: Per Bothner @ 2022-10-15 17:07 UTC (permalink / raw)
  To: Panicz Maciej Godek, kawa

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

Please try the attached patch.
I haven't tested it, except to verify that it compiles.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

[-- Attachment #2: ptype.patch --]
[-- Type: text/x-patch, Size: 1583 bytes --]

diff --git a/gnu/bytecode/ParameterizedType.java b/gnu/bytecode/ParameterizedType.java
index b9d35945d..5d4adc0f4 100644
--- a/gnu/bytecode/ParameterizedType.java
+++ b/gnu/bytecode/ParameterizedType.java
@@ -2,8 +2,9 @@
 // This is free software;  for terms and warranty disclaimer see ./COPYING.
 
 package gnu.bytecode;
+import java.io.*;
 
-public class ParameterizedType extends ObjectType
+public class ParameterizedType extends ObjectType implements Externalizable
 {
     ClassType rawType;
     Type[] typeArgumentTypes;
@@ -146,4 +147,27 @@ public class ParameterizedType extends ObjectType
         this.rawType = rawType;
         this.typeArgumentTypes = typeArgumentTypes;
     }
+    public static final ParameterizedType make(ClassType rawType,
+                                               Type[] typeArgumentTypes,
+                                               char[] typeArgumentBounds) {
+        ParameterizedType ptype =
+            new ParameterizedType(rawType, typeArgumentTypes);
+        ptype.typeArgumentBounds = typeArgumentBounds;
+        return ptype;
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException
+    {
+        out.writeObject(rawType);
+        out.writeObject(typeArgumentTypes);
+        out.writeObject(typeArgumentBounds);
+    }
+
+    public void readExternal(ObjectInput in)
+        throws IOException, ClassNotFoundException
+    {
+        rawType = (ClassType) in.readObject();
+        typeArgumentTypes = (Type[]) in.readObject();
+        typeArgumentBounds = (char[]) in.readObject();
+    }
 }

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

* Re: gnu.bytecode.ParameterizedType does not implement Externalizable
  2022-10-15 17:07 ` Per Bothner
@ 2022-10-15 20:11   ` Panicz Maciej Godek
  0 siblings, 0 replies; 3+ messages in thread
From: Panicz Maciej Godek @ 2022-10-15 20:11 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa

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

Thanks.
This seems to resolve the issue (at least as long as the compilation
process is concerned) - now the process issues some warnings and terminates
normally, and the .class files appear in the desired directory.



sob., 15 paź 2022, 19:08 użytkownik Per Bothner <per@bothner.com> napisał:

> Please try the attached patch.
> I haven't tested it, except to verify that it compiles.
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/

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

end of thread, other threads:[~2022-10-15 20:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-15 15:55 gnu.bytecode.ParameterizedType does not implement Externalizable Panicz Maciej Godek
2022-10-15 17:07 ` Per Bothner
2022-10-15 20:11   ` 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).