public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Panicz Maciej Godek <godek.maciek@gmail.com>, kawa@sourceware.org
Subject: Re: gnu.bytecode.ParameterizedType does not implement Externalizable
Date: Sat, 15 Oct 2022 10:07:39 -0700	[thread overview]
Message-ID: <9ca0f114-ec5e-b932-f4b2-8d9323e76cb6@bothner.com> (raw)
In-Reply-To: <CAMFYt2aq8ggXH2wK2eqHmB0EkA3O+ABKpRjUG6gLHh7cGU-0-Q@mail.gmail.com>

[-- 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();
+    }
 }

  reply	other threads:[~2022-10-15 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-15 15:55 Panicz Maciej Godek
2022-10-15 17:07 ` Per Bothner [this message]
2022-10-15 20:11   ` 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=9ca0f114-ec5e-b932-f4b2-8d9323e76cb6@bothner.com \
    --to=per@bothner.com \
    --cc=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).