Skip to content

Commit

Permalink
Spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
smowton authored Jan 6, 2025
1 parent d0eab59 commit 03c6529
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
| Test.java:12:7:12:7 | A | This class is serializable, but its non-serializable super-class $@ does not declare a no-argument constructor. | Test.java:4:7:4:20 | NonSerialzable | NonSerialzable |
| Test.java:12:7:12:7 | A | This class is serializable, but its non-serializable super-class $@ does not declare a no-argument constructor. | Test.java:4:7:4:21 | NonSerializable | NonSerializable |
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import java.io.ObjectStreamException;
import java.io.Serializable;

class NonSerialzable {
class NonSerializable {

// Has no default constructor
public NonSerialzable(int x) { }
public NonSerializable(int x) { }

}

// BAD: Serializable but its parent cannot be instantiated
class A extends NonSerialzable implements Serializable {
class A extends NonSerializable implements Serializable {
public A() { super(1); }
}

// GOOD: writeReplaces itself, so unlikely to be deserialized
// according to default rules.
class B extends NonSerialzable implements Serializable {
class B extends NonSerializable implements Serializable {
public B() { super(2); }

public Object writeReplace() throws ObjectStreamException {
Expand Down

0 comments on commit 03c6529

Please sign in to comment.