Details
-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
b95
-
x86
-
windows_xp
Description
A DESCRIPTION OF THE PROBLEM :
In the "Serialization" section of the documentation, two code examples are given. The first is deliberately flawed code. The second is intended to fix the problem in the first example, but it actually does not (a non-static inner class was used in example two where a *static* inner class should have been used).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
class MyApp java.io.Serializable
{
BigObjectThatShouldNotBeSerializedWithAButton bigOne;
Button aButton = new Button();
// Note that this inner class is declared "static"
static class MyActionListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Hello There");
}
}
MyApp()
{
aButton.addActionListener(new MyActionListener());
}
}
ACTUAL -
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
class MyApp java.io.Serializable
{
BigObjectThatShouldNotBeSerializedWithAButton bigOne;
Button aButton = new Button();
class MyActionListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Hello There");
}
}
MyApp()
{
aButton.addActionListener(new MyActionListener());
}
}
URL OF FAULTY DOCUMENTATION :
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html
###@###.### 2005-04-11 08:48:42 GMT
In the "Serialization" section of the documentation, two code examples are given. The first is deliberately flawed code. The second is intended to fix the problem in the first example, but it actually does not (a non-static inner class was used in example two where a *static* inner class should have been used).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
class MyApp java.io.Serializable
{
BigObjectThatShouldNotBeSerializedWithAButton bigOne;
Button aButton = new Button();
// Note that this inner class is declared "static"
static class MyActionListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Hello There");
}
}
MyApp()
{
aButton.addActionListener(new MyActionListener());
}
}
ACTUAL -
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
class MyApp java.io.Serializable
{
BigObjectThatShouldNotBeSerializedWithAButton bigOne;
Button aButton = new Button();
class MyActionListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Hello There");
}
}
MyApp()
{
aButton.addActionListener(new MyActionListener());
}
}
URL OF FAULTY DOCUMENTATION :
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html
###@###.### 2005-04-11 08:48:42 GMT