From dc9500c513173a0f527e5edc7a8e9c26f1acd99a Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 3 Apr 2022 19:15:16 +0100 Subject: fix java deprecation notices --- sources/events/VSAbstractEvent.java | 45 +++--------- sources/events/VSCopyableEvent.java | 24 ------- sources/events/VSRegisteredEvents.java | 81 +++------------------- .../implementations/VSProcessCrashEvent.java | 32 +-------- .../implementations/VSProcessRecoverEvent.java | 32 +-------- .../events/internal/VSAbstractInternalEvent.java | 38 ++-------- sources/events/internal/VSMessageReceiveEvent.java | 30 +------- sources/events/internal/VSProtocolEvent.java | 44 +++--------- .../events/internal/VSProtocolScheduleEvent.java | 39 ++--------- 9 files changed, 49 insertions(+), 316 deletions(-) (limited to 'sources/events') diff --git a/sources/events/VSAbstractEvent.java b/sources/events/VSAbstractEvent.java index 934fbcf..f61f76f 100644 --- a/sources/events/VSAbstractEvent.java +++ b/sources/events/VSAbstractEvent.java @@ -1,36 +1,15 @@ -/* - * VS-Simulator (http://buetow.org) - * Copyright (c) 2008 - 2009 by Dipl.-Inform. (FH) Paul C. Buetow - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * All icons of the icons/ folder are under a Creative Commons - * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. - * - * The icon's homepage is http://code.google.com/p/ultimate-gnome/ - */ - package events; -import java.io.*; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import core.VSAbstractProcess; import core.VSInternalProcess; -import exceptions.*; -import prefs.*; -import serialize.*; +import exceptions.VSEventNotCopyableException; +import prefs.VSPrefs; +import prefs.VSSerializablePrefs; +import serialize.VSSerialize; /** * The class VSAbstractEvent. This abstract class defines the basic framework @@ -40,9 +19,6 @@ import serialize.*; * @author Paul C. Buetow */ abstract public class VSAbstractEvent extends VSSerializablePrefs { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - /** The prefs. */ public VSPrefs prefs; @@ -224,21 +200,20 @@ abstract public class VSAbstractEvent extends VSSerializablePrefs { System.out.println("Serializing: VSAbstractEvent; id="+getID()); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); - objectOutputStream.writeObject(new Integer(super.getID())); + objectOutputStream.writeObject(Integer.valueOf(super.getID())); objectOutputStream.writeObject(eventShortname); objectOutputStream.writeObject(eventClassname); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); } /* (non-Javadoc) * @see serialize.VSSerializable#deserialize(serialize.VSSerialize, * java.io.ObjectInputStream) */ - @SuppressWarnings("unchecked") public synchronized void deserialize(VSSerialize serialize, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { diff --git a/sources/events/VSCopyableEvent.java b/sources/events/VSCopyableEvent.java index 5862c6d..23125ce 100644 --- a/sources/events/VSCopyableEvent.java +++ b/sources/events/VSCopyableEvent.java @@ -1,29 +1,5 @@ -/* - * Copyright (c) 2008 Paul C. Buetow, vs-sim@dev.buetow.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * All icons of the icons/ folder are under a Creative Commons - * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. - * - * The icon's homepage is http://code.google.com/p/ultimate-gnome/ - */ - package events; - /** * The interface VSCopyableEvent, all events which implement this class * are copyable. diff --git a/sources/events/VSRegisteredEvents.java b/sources/events/VSRegisteredEvents.java index 0c53e98..57c28c7 100644 --- a/sources/events/VSRegisteredEvents.java +++ b/sources/events/VSRegisteredEvents.java @@ -1,33 +1,14 @@ -/* - * Copyright (c) 2008 Paul C. Buetow, vs-sim@dev.buetow.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * All icons of the icons/ folder are under a Creative Commons - * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. - * - * The icon's homepage is http://code.google.com/p/ultimate-gnome/ - */ - package events; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Set; +import java.util.Vector; -import prefs.*; -import core.*; -import utils.*; +import core.VSInternalProcess; +import prefs.VSPrefs; +import utils.VSClassLoader; /** * The class VSRegisteredEvents. This class is responsible to manage all @@ -38,9 +19,6 @@ import utils.*; * @author Paul C. Buetow */ public final class VSRegisteredEvents { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - /** The event classnames by eventnames. */ private static HashMap eventClassnamesByNames = new HashMap(); @@ -80,37 +58,6 @@ public final class VSRegisteredEvents { */ public static void init(VSPrefs prefs_) { prefs = prefs_; - - /* - registerEvent("events.implementations.VSProcessCrashEvent", - "Prozessabsturz"); - registerEvent("events.implementations.VSProcessRecoverEvent", - "Prozesswiederbelebung"); - registerEvent("protocols.implementations.VSBasicMulticastProtocol", - "Basic Multicast", "Basic Multicast"); - registerEvent("protocols.implementations.VSBerkelyTimeProtocol", - "Berkeley Algorithmus zur internen Sync.", "Berkeley"); - registerEvent("protocols.implementations.VSBroadcastProtocol", - "Broadcast"); - registerEvent("protocols.implementations.VSDummyProtocol", - "Beispiel/Dummy"); - registerEvent("protocols.implementations.VSExternalTimeSyncProtocol", - "Christians Methode zur externen Sync.", "Christians"); - registerEvent("protocols.implementations.VSInternalTimeSyncProtocol", - "Interne Synchronisation", "Interne Sync."); - registerEvent("protocols.implementations.VSOnePhaseCommitProtocol", - "Ein-Phasen Commit", "1-Phasen Commit"); - registerEvent("protocols.implementations.VSPingPongProtocol", - "Ping Pong"); - registerEvent("protocols.implementations.VSReliableMulticastProtocol", - "Reliable Multicast", "Reliable Multicast"); - registerEvent("protocols.implementations.VSTwoPhaseCommitProtocol", - "Zwei-Phasen Commit", "2-Phasen Commit"); - */ - - /* Using the NEW way. The old way above (specifying protocol names - in this file still works as well */ - registerEvent("events.implementations.VSProcessCrashEvent"); registerEvent("events.implementations.VSProcessRecoverEvent"); registerEvent("protocols.implementations.VSBasicMulticastProtocol"); @@ -161,7 +108,7 @@ public final class VSRegisteredEvents { if (serverProtocol.hasOnServerStart()) isOnServerStartProtocol.put(protocolClassname, - new Boolean(true)); + Boolean.valueOf(true)); } } } @@ -379,16 +326,6 @@ public final class VSRegisteredEvents { registerEvent(eventClassname, eventName, eventShortname); } - /** - * Registers an event. - * - * @param eventClassname the event classname - * @param eventName the event name - */ - private static void registerEvent(String eventClassname, String eventName) { - registerEvent(eventClassname, eventName, null); - } - /** * Registers an event. * diff --git a/sources/events/implementations/VSProcessCrashEvent.java b/sources/events/implementations/VSProcessCrashEvent.java index 84c4b36..d9d4df1 100644 --- a/sources/events/implementations/VSProcessCrashEvent.java +++ b/sources/events/implementations/VSProcessCrashEvent.java @@ -1,31 +1,8 @@ -/* - * VS-Simulator (http://buetow.org) - * Copyright (c) 2008 - 2009 by Dipl.-Inform. (FH) Paul C. Buetow - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * All icons of the icons/ folder are under a Creative Commons - * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. - * - * The icon's homepage is http://code.google.com/p/ultimate-gnome/ - */ - package events.implementations; -import events.*; -import simulator.*; +import events.VSAbstractEvent; +import events.VSCopyableEvent; +import simulator.VSMain; /** * The class VSProcessCrashEvent. This event makes a process to crash. @@ -34,9 +11,6 @@ import simulator.*; */ public class VSProcessCrashEvent extends VSAbstractEvent implements VSCopyableEvent { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - /* (non-Javadoc) * @see events.VSCopyableEvent#initCopy(events.VSAbstractEvent) */ diff --git a/sources/events/implementations/VSProcessRecoverEvent.java b/sources/events/implementations/VSProcessRecoverEvent.java index 9aba31d..fc47bbd 100644 --- a/sources/events/implementations/VSProcessRecoverEvent.java +++ b/sources/events/implementations/VSProcessRecoverEvent.java @@ -1,31 +1,8 @@ -/* - * VS-Simulator (http://buetow.org) - * Copyright (c) 2008 - 2009 by Dipl.-Inform. (FH) Paul C. Buetow - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * All icons of the icons/ folder are under a Creative Commons - * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. - * - * The icon's homepage is http://code.google.com/p/ultimate-gnome/ - */ - package events.implementations; -import events.*; -import simulator.*; +import events.VSAbstractEvent; +import events.VSCopyableEvent; +import simulator.VSMain; /** * The class VSProcessRecoverEvent. This event makes a process to recover if @@ -35,9 +12,6 @@ import simulator.*; */ public class VSProcessRecoverEvent extends VSAbstractEvent implements VSCopyableEvent { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - /* (non-Javadoc) * @see events.VSCopyableEvent#initCopy(events.VSAbstractEvent) */ diff --git a/sources/events/internal/VSAbstractInternalEvent.java b/sources/events/internal/VSAbstractInternalEvent.java index 3d2d6b3..e8e2d13 100644 --- a/sources/events/internal/VSAbstractInternalEvent.java +++ b/sources/events/internal/VSAbstractInternalEvent.java @@ -1,30 +1,8 @@ -/* - * VS-Simulator (http://buetow.org) - * Copyright (c) 2008 - 2009 by Dipl.-Inform. (FH) Paul C. Buetow - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * All icons of the icons/ folder are under a Creative Commons - * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. - * - * The icon's homepage is http://code.google.com/p/ultimate-gnome/ - */ - package events.internal; -import java.io.*; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import events.VSAbstractEvent; import serialize.VSSerialize; @@ -36,14 +14,11 @@ import serialize.VSSerialize; * @author Paul C. Buetow */ abstract public class VSAbstractInternalEvent extends VSAbstractEvent { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - /* (non-Javadoc) * @see events.VSAbstractEvent#createShortname()() */ protected String createShortname(String savedShortname) { - return savedShortname; + return savedShortname; } /* (non-Javadoc) @@ -56,17 +31,16 @@ abstract public class VSAbstractInternalEvent extends VSAbstractEvent { super.serialize(serialize, objectOutputStream); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); } /* (non-Javadoc) * @see serialize.VSSerializable#deserialize(serialize.VSSerialize, * java.io.ObjectInputStream) */ - @SuppressWarnings("unchecked") public synchronized void deserialize(VSSerialize serialize, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { diff --git a/sources/events/internal/VSMessageReceiveEvent.java b/sources/events/internal/VSMessageReceiveEvent.java index c7f9113..323a6d8 100644 --- a/sources/events/internal/VSMessageReceiveEvent.java +++ b/sources/events/internal/VSMessageReceiveEvent.java @@ -1,30 +1,5 @@ -/* - * Copyright (c) 2008 Paul C. Buetow, vs-sim@dev.buetow.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * All icons of the icons/ folder are under a Creative Commons - * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. - * - * The icon's homepage is http://code.google.com/p/ultimate-gnome/ - */ - package events.internal; -//import java.io.*; - import core.VSMessage; import protocols.VSAbstractProtocol; import serialize.VSNotSerializable; @@ -37,8 +12,6 @@ import serialize.VSNotSerializable; */ public class VSMessageReceiveEvent extends VSAbstractInternalEvent implements VSNotSerializable { - /** The serioal version uid */ - private static final long serialVersionUID = 1L; /** The message. */ private VSMessage message; @@ -63,8 +36,7 @@ public class VSMessageReceiveEvent extends VSAbstractInternalEvent * @see events.VSAbstractEvent#onStart() */ public void onStart() { - boolean onlyRelevantMessages = process.getPrefs().getBoolean( - "sim.messages.relevant"); + boolean onlyRelevantMessages = process.getPrefs().getBoolean("sim.messages.relevant"); //String eventName = message.getName(); String protocolClassname = message.getProtocolClassname(); diff --git a/sources/events/internal/VSProtocolEvent.java b/sources/events/internal/VSProtocolEvent.java index f9a531c..c39b639 100644 --- a/sources/events/internal/VSProtocolEvent.java +++ b/sources/events/internal/VSProtocolEvent.java @@ -1,33 +1,13 @@ -/* - * VS-Simulator (http://buetow.org) - * Copyright (c) 2008 - 2009 by Dipl.-Inform. (FH) Paul C. Buetow - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * All icons of the icons/ folder are under a Creative Commons - * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. - * - * The icon's homepage is http://code.google.com/p/ultimate-gnome/ - */ - package events.internal; -import java.io.*; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import core.VSInternalProcess; -import events.*; +import events.VSAbstractEvent; +import events.VSCopyableEvent; +import events.VSRegisteredEvents; import protocols.VSAbstractProtocol; import serialize.VSSerialize; @@ -42,9 +22,6 @@ import serialize.VSSerialize; */ public class VSProtocolEvent extends VSAbstractInternalEvent implements VSCopyableEvent { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - /** The protocol classname. */ private String protocolClassname; @@ -160,21 +137,20 @@ public class VSProtocolEvent extends VSAbstractInternalEvent super.serialize(serialize, objectOutputStream); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); objectOutputStream.writeObject(protocolClassname); - objectOutputStream.writeObject(new Boolean(isClientProtocol)); - objectOutputStream.writeObject(new Boolean(isProtocolActivation)); + objectOutputStream.writeObject(Boolean.valueOf(isClientProtocol)); + objectOutputStream.writeObject(Boolean.valueOf(isProtocolActivation)); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); } /* (non-Javadoc) * @see serialize.VSSerializable#deserialize(serialize.VSSerialize, * java.io.ObjectInputStream) */ - @SuppressWarnings("unchecked") public synchronized void deserialize(VSSerialize serialize, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { diff --git a/sources/events/internal/VSProtocolScheduleEvent.java b/sources/events/internal/VSProtocolScheduleEvent.java index 6a0eed5..9c708ad 100644 --- a/sources/events/internal/VSProtocolScheduleEvent.java +++ b/sources/events/internal/VSProtocolScheduleEvent.java @@ -1,33 +1,12 @@ -/* - * Copyright (c) 2008 Paul C. Buetow, vs-sim@dev.buetow.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * All icons of the icons/ folder are under a Creative Commons - * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. - * - * The icon's homepage is http://code.google.com/p/ultimate-gnome/ - */ - package events.internal; -import java.io.*; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; -//import events.*; import protocols.VSAbstractProtocol; -import serialize.*; +import serialize.VSNotSerializable; +import serialize.VSSerialize; /** * The class VSProtocolScheduleEvent, this event is used if a protocol (which @@ -38,9 +17,6 @@ import serialize.*; */ public class VSProtocolScheduleEvent extends VSAbstractInternalEvent implements VSNotSerializable { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - /** The event is a server protocol schedule. */ private boolean isServerSchedule; /* true = server, false = client */ @@ -125,17 +101,16 @@ public class VSProtocolScheduleEvent extends VSAbstractInternalEvent super.serialize(serialize, objectOutputStream); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); } /* (non-Javadoc) * @see serialize.VSSerializable#deserialize(serialize.VSSerialize, * java.io.ObjectInputStream) */ - @SuppressWarnings("unchecked") public synchronized void deserialize(VSSerialize serialize, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { -- cgit v1.2.3