/* * @(#)Serializable.java 1.26 07/01/02 * * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package java.io; /** * Serializability of a class is enabled by the class implementing the * java.io.Serializable interface. Classes that do not implement this * interface will not have any of their state serialized or * deserialized. All subtypes of a serializable class are themselves * serializable. The serialization interface has no methods or fields * and serves only to identify the semantics of being serializable.
* * To allow subtypes of non-serializable classes to be serialized, the * subtype may assume responsibility for saving and restoring the * state of the supertype's public, protected, and (if accessible) * package fields. The subtype may assume this responsibility only if * the class it extends has an accessible no-arg constructor to * initialize the class's state. It is an error to declare a class * Serializable if this is not the case. The error will be detected at * runtime.
* * During deserialization, the fields of non-serializable classes will * be initialized using the public or protected no-arg constructor of * the class. A no-arg constructor must be accessible to the subclass * that is serializable. The fields of serializable subclasses will * be restored from the stream.
* * When traversing a graph, an object may be encountered that does not * support the Serializable interface. In this case the * NotSerializableException will be thrown and will identify the class * of the non-serializable object.
* * Classes that require special handling during the serialization and * deserialization process must implement special methods with these exact * signatures:
* *
* private void writeObject(java.io.ObjectOutputStream out) * throws IOException * private void readObject(java.io.ObjectInputStream in) * throws IOException, ClassNotFoundException; * private void readObjectNoData() * throws ObjectStreamException; ** *
The writeObject method is responsible for writing the state of the * object for its particular class so that the corresponding * readObject method can restore it. The default mechanism for saving * the Object's fields can be invoked by calling * out.defaultWriteObject. The method does not need to concern * itself with the state belonging to its superclasses or subclasses. * State is saved by writing the individual fields to the * ObjectOutputStream using the writeObject method or by using the * methods for primitive data types supported by DataOutput. * *
The readObject method is responsible for reading from the stream and * restoring the classes fields. It may call in.defaultReadObject to invoke * the default mechanism for restoring the object's non-static and * non-transient fields. The defaultReadObject method uses information in * the stream to assign the fields of the object saved in the stream with the * correspondingly named fields in the current object. This handles the case * when the class has evolved to add new fields. The method does not need to * concern itself with the state belonging to its superclasses or subclasses. * State is saved by writing the individual fields to the * ObjectOutputStream using the writeObject method or by using the * methods for primitive data types supported by DataOutput. * *
The readObjectNoData method is responsible for initializing the state of * the object for its particular class in the event that the serialization * stream does not list the given class as a superclass of the object being * deserialized. This may occur in cases where the receiving party uses a * different version of the deserialized instance's class than the sending * party, and the receiver's version extends classes that are not extended by * the sender's version. This may also occur if the serialization stream has * been tampered; hence, readObjectNoData is useful for initializing * deserialized objects properly despite a "hostile" or incomplete source * stream. * *
Serializable classes that need to designate an alternative object to be * used when writing an object to the stream should implement this * special method with the exact signature:
* *
* ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException; *
* * This writeReplace method is invoked by serialization if the method * exists and it would be accessible from a method defined within the * class of the object being serialized. Thus, the method can have private, * protected and package-private access. Subclass access to this method * follows java accessibility rules.
* * Classes that need to designate a replacement when an instance of it * is read from the stream should implement this special method with the * exact signature.
* *
* ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException; *
* * This readResolve method follows the same invocation rules and * accessibility rules as writeReplace.
*
* The serialization runtime associates with each serializable class a version
* number, called a serialVersionUID, which is used during deserialization to
* verify that the sender and receiver of a serialized object have loaded
* classes for that object that are compatible with respect to serialization.
* If the receiver has loaded a class for the object that has a different
* serialVersionUID than that of the corresponding sender's class, then
* deserialization will result in an {@link InvalidClassException}. A
* serializable class can declare its own serialVersionUID explicitly by
* declaring a field named "serialVersionUID"
that must be static,
* final, and of type long
:
* *
* ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L; ** * If a serializable class does not explicitly declare a serialVersionUID, then * the serialization runtime will calculate a default serialVersionUID value * for that class based on various aspects of the class, as described in the * Java(TM) Object Serialization Specification. However, it is strongly * recommended that all serializable classes explicitly declare * serialVersionUID values, since the default serialVersionUID computation is * highly sensitive to class details that may vary depending on compiler * implementations, and can thus result in unexpected *
InvalidClassException
s during deserialization. Therefore, to
* guarantee a consistent serialVersionUID value across different java compiler
* implementations, a serializable class must declare an explicit
* serialVersionUID value. It is also strongly advised that explicit
* serialVersionUID declarations use the private
modifier where
* possible, since such declarations apply only to the immediately declaring
* class--serialVersionUID fields are not useful as inherited members. Array
* classes cannot declare an explicit serialVersionUID, so they always have
* the default computed value, but the requirement for matching
* serialVersionUID values is waived for array classes.
*
* @author unascribed
* @version 1.26, 01/02/07
* @see java.io.ObjectOutputStream
* @see java.io.ObjectInputStream
* @see java.io.ObjectOutput
* @see java.io.ObjectInput
* @see java.io.Externalizable
* @since JDK1.1
*/
public interface Serializable {
}
----- Classpath: ---------------------------------------------
bootPath: ClassPath[Entry[jar:file:/space/jdk1.6.0/jre/lib/resources.jar!/], Entry[jar:file:/space/jdk1.6.0/jre/lib/rt.jar!/], Entry[jar:file:/space/jdk1.6.0/jre/lib/sunrsasign.jar!/], Entry[jar:file:/space/jdk1.6.0/jre/lib/jsse.jar!/], Entry[jar:file:/space/jdk1.6.0/jre/lib/jce.jar!/], Entry[jar:file:/space/jdk1.6.0/jre/lib/charsets.jar!/], Entry[file:/space/jdk1.6.0/jre/classes/], Entry[jar:file:/space/jdk1.6.0/jre/lib/ext/localedata.jar!/], Entry[jar:file:/space/jdk1.6.0/jre/lib/ext/dnsns.jar!/], Entry[jar:file:/space/jdk1.6.0/jre/lib/ext/sunjce_provider.jar!/], Entry[jar:file:/space/jdk1.6.0/jre/lib/ext/sunpkcs11.jar!/]]
classPath: ClassPath[Entry[file:/tmp/testud04/var/cache/index/0.1/s2/classes/]]
sourcePath: ClassPath[Entry[jar:file:/space/jdk7/src.zip!/]]
----- Original exception ---------------------------------------------
java.lang.IllegalStateException: invalid sig file: file:/tmp/testud04/var/cache/index/0.1/s2/classes/java/util/concurrent/ConcurrentHashMap$HashEntry.sig, cannot find annotation attribute "value in java.lang.SuppressWarnings
at org.netbeans.modules.java.source.usages.SymbolClassReader.readAnnotation(SymbolClassReader.java:878)
at org.netbeans.modules.java.source.usages.SymbolClassReader.readAnnotations(SymbolClassReader.java:851)
at org.netbeans.modules.java.source.usages.SymbolClassReader.readExecutableMember(SymbolClassReader.java:738)
at org.netbeans.modules.java.source.usages.SymbolClassReader.readMember(SymbolClassReader.java:657)
at org.netbeans.modules.java.source.usages.SymbolClassReader.fillInFromSig(SymbolClassReader.java:289)
at org.netbeans.modules.java.source.usages.SymbolClassReader.fillInImpl(SymbolClassReader.java:165)
at org.netbeans.modules.java.source.usages.SymbolClassReader.fillIn(SymbolClassReader.java:133)
at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1791)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:764)
at org.netbeans.modules.java.source.usages.SymbolClassReader.markInnerClassOwner(SymbolClassReader.java:394)
at org.netbeans.modules.java.source.usages.SymbolClassReader.fillInFromSig(SymbolClassReader.java:280)
at org.netbeans.modules.java.source.usages.SymbolClassReader.fillInImpl(SymbolClassReader.java:165)
at org.netbeans.modules.java.source.usages.SymbolClassReader.fillIn(SymbolClassReader.java:133)
at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1791)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:764)
at com.sun.tools.javac.jvm.ClassReader.loadClass(ClassReader.java:1966)
at com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:842)
at com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:1011)
at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:1936)
at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1850)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1526)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:368)
at com.sun.tools.javac.comp.Attr.attribType(Attr.java:398)
at com.sun.tools.javac.comp.MemberEnter.attribImportType(MemberEnter.java:727)
at com.sun.tools.javac.comp.MemberEnter.visitImport(MemberEnter.java:549)
at com.sun.tools.javac.tree.JCTree$JCImport.accept(JCTree.java:493)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:391)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:403)
at com.sun.tools.javac.comp.MemberEnter.visitTopLevel(MemberEnter.java:516)
at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:444)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:391)
at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:865)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:764)
at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:693)
at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:124)
at com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:843)
at com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:1011)
at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:1936)
at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1850)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1526)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:368)
at com.sun.tools.javac.comp.MemberEnter.visitImport(MemberEnter.java:531)
at com.sun.tools.javac.tree.JCTree$JCImport.accept(JCTree.java:493)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:391)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:403)
at com.sun.tools.javac.comp.MemberEnter.visitTopLevel(MemberEnter.java:516)
at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:444)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:391)
at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:865)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:764)
at com.sun.tools.javac.comp.Enter.complete(Enter.java:523)
at com.sun.tools.javac.main.JavaCompiler.complete(JavaCompiler.java:664)
at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:1884)
at org.netbeans.modules.java.source.usages.SymbolClassReader.fillInImpl(SymbolClassReader.java:154)
at org.netbeans.modules.java.source.usages.SymbolClassReader.fillIn(SymbolClassReader.java:133)
at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1791)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:764)
at com.sun.tools.javac.jvm.ClassReader.loadClass(ClassReader.java:1966)
at com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:842)
at com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:1011)
at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:1936)
at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1850)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1526)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:368)
at com.sun.tools.javac.comp.Attr.attribType(Attr.java:398)
at com.sun.tools.javac.comp.MemberEnter.visitVarDef(MemberEnter.java:630)
at com.sun.tools.javadoc.JavadocMemberEnter.visitVarDef(JavadocMemberEnter.java:61)
at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:695)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:391)
at com.sun.tools.javac.comp.MemberEnter.signature(MemberEnter.java:354)
at com.sun.tools.javac.comp.MemberEnter.visitMethodDef(MemberEnter.java:564)
at com.sun.tools.javadoc.JavadocMemberEnter.visitMethodDef(JavadocMemberEnter.java:47)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:643)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:391)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:403)
at com.sun.tools.javac.comp.MemberEnter.finishClass(MemberEnter.java:414)
at com.sun.tools.javac.comp.MemberEnter.finish(MemberEnter.java:1050)
at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:1017)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:764)
at com.sun.tools.javac.comp.Enter.complete(Enter.java:523)
at org.netbeans.api.java.source.JavaSource$ErrorHandlingJavadocEnter.main(JavaSource.java:808)
at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:824)
at com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:347)
at com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:293)
at org.netbeans.api.java.source.JavaSource.moveToPhase(JavaSource.java:874)
at org.netbeans.api.java.source.CompilationController.toPhase(CompilationController.java:81)
at org.netbeans.api.java.source.UiUtils$1.run(UiUtils.java:333)
at org.netbeans.api.java.source.UiUtils$1.run(UiUtils.java:331)
at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:448)
at org.netbeans.api.java.source.UiUtils.getOffset(UiUtils.java:326)
at org.netbeans.api.java.source.UiUtils.getOpenInfo(UiUtils.java:193)
at org.netbeans.api.java.source.UiUtils.getOpenInfo(UiUtils.java:183)
at org.netbeans.api.java.source.UiUtils.open(UiUtils.java:81)
at org.netbeans.modules.editor.java.GoToSupport$2.open(GoToSupport.java:566)
at org.netbeans.modules.editor.java.GoToSupport$1.run(GoToSupport.java:222)
at org.netbeans.modules.editor.java.GoToSupport$1.run(GoToSupport.java:103)
at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:448)
at org.netbeans.modules.editor.java.GoToSupport.performGoTo(GoToSupport.java:100)
at org.netbeans.modules.editor.java.GoToSupport.goTo(GoToSupport.java:235)
at org.netbeans.modules.editor.java.JavaKit$JavaGoToDeclarationAction.gotoDeclaration(JavaKit.java:553)
at org.netbeans.editor.ext.ExtKit$GotoDeclarationAction.actionPerformed(ExtKit.java:527)
at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:261)
at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
at javax.swing.JComponent.processKeyBinding(JComponent.java:2844)
at javax.swing.JComponent.processKeyBindings(JComponent.java:2879)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2807)
at java.awt.Component.processEvent(Component.java:5815)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:693)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:958)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:830)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:657)
at java.awt.Component.dispatchEventImpl(Component.java:4282)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)