Commits

Jerry Lee committed 6a12eb8

move file

Comments (0)

Files changed (9)

src/main/java/com/oldratlee/innerclass/com/oldratlee/innerclass/serialization/FooA.java

+package com.oldratlee.innerclass.com.oldratlee.innerclass.serialization;
+
+public class FooA {
+    private int attrib;
+    private static int staticAttrib;
+
+    public class Inner1 {
+        private int a1;
+
+        public int method1() {
+            return attrib;
+        }
+    }
+
+    public static class StaticInner2 {
+        private int sa1;
+
+        public int method2() {
+            return staticAttrib;
+        }
+    }
+
+    public int method() {
+        int a = new Inner1().a1;
+        a += new StaticInner2().sa1;
+        return a;
+    }
+}

src/main/java/com/oldratlee/innerclass/com/oldratlee/innerclass/serialization/FooB.java

+package com.oldratlee.innerclass.com.oldratlee.innerclass.serialization;
+
+public class FooB {
+    private int foo;
+    private int age;
+
+    public class Inner {
+        private int foo;
+
+        public int method() {
+            return foo + FooB.this.foo + age;
+        }
+    }
+}

src/main/java/com/oldratlee/innerclass/com/oldratlee/innerclass/serialization/Util.java

+package com.oldratlee.innerclass.com.oldratlee.innerclass.serialization;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+public class Util {
+    public static <T> void writeObject(T data) throws IOException {
+        ObjectOutputStream out = null;
+        try {
+            out = new ObjectOutputStream(new ByteArrayOutputStream());
+            out.writeObject(data);
+        } finally {
+            if (null != out) {
+                try {
+                    out.close();
+                } catch (Exception e) {
+                }
+            }
+        }
+    }
+}

src/test/java/com/oldratlee/innerclass/serialization/FooA.java

-package com.oldratlee.innerclass.serialization;
-
-public class FooA {
-    private int attrib;
-    private static int staticAttrib;
-
-    public class Inner1 {
-        private int a1;
-
-        public int method1() {
-            return attrib;
-        }
-    }
-
-    public static class StaticInner2 {
-        private int sa1;
-
-        public int method2() {
-            return staticAttrib;
-        }
-    }
-
-    public int method() {
-        int a = new Inner1().a1;
-        a += new StaticInner2().sa1;
-        return a;
-    }
-}

src/test/java/com/oldratlee/innerclass/serialization/FooB.java

-package com.oldratlee.innerclass.serialization;
-
-public class FooB {
-    private int foo;
-    private int age;
-    
-    public class Inner {
-        private int foo;
-        
-        public int method() {
-            return foo + FooB.this.foo + age;
-        }
-    }
-}

src/test/java/com/oldratlee/innerclass/serialization/InnnerClassSerialization_FailTest.java

 package com.oldratlee.innerclass.serialization;
+import com.oldratlee.innerclass.com.oldratlee.innerclass.serialization.Util;
 import org.junit.Test;
 
 import java.io.Serializable;
 
 public class InnnerClassSerialization_FailTest {
-    interface GetDataInterface extends Serializable {
+    interface FooInterface1 extends Serializable {
         public Object getData();
     }
 
-    GetDataInterface attributeData = new GetDataInterface() {
+    FooInterface1 attributeData = new FooInterface1() {
            private static final long serialVersionUID = 1L;
            public Object getData() {
                return null;
            }
        };
 
-    public class InnerClassSerialize implements Serializable {
+    public class FooClass1 implements Serializable {
         private static final long serialVersionUID = 1L;
     }
     
     
     @Test
     public void testSerializable_LocalVar_AnonymousClass() throws Exception {
-        GetDataInterface local = new GetDataInterface() {
+        FooInterface1 local = new FooInterface1() {
             private static final long serialVersionUID = 1L;
             public Object getData() {
                 return null;
 
     @Test
     public void testSerializable_InnerClass() throws Exception {
-        InnerClassSerialize data = new InnerClassSerialize();
+        FooClass1 data = new FooClass1();
         Util.writeObject(data);
     }
 }

src/test/java/com/oldratlee/innerclass/serialization/StaticClassSerialization_JUnit3_Test.java

 package com.oldratlee.innerclass.serialization;
 
+import com.oldratlee.innerclass.com.oldratlee.innerclass.serialization.Util;
 import junit.framework.TestCase;
 
 import java.io.Serializable;
 
 public class StaticClassSerialization_JUnit3_Test extends TestCase {
     
-    interface GetDataInterface extends Serializable {
+    interface FooInterface2 extends Serializable {
         public Object getData();
     }
 
-    static GetDataInterface getData = new GetDataInterface() {
+    static FooInterface2 getData = new FooInterface2() {
         private static final long serialVersionUID = 1L;
 
         public Object getData() {
         }
     };
     
-    public static class ClassImplSerialize implements Serializable {
+    public static class FooClass2 implements Serializable {
         private static final long serialVersionUID = 88940079192401092L;
     }
     
     }
 
     public static void testSerializable_LocalVar_StaticAnonymousClass() throws Exception {
-        GetDataInterface local = new GetDataInterface() {
+        FooInterface2 local = new FooInterface2() {
             private static final long serialVersionUID = 1L;
             public Object getData() {
                 return null;
     }
     
     public void testSerializable_StaticInnerClass() throws Exception {
-        ClassImplSerialize data = new ClassImplSerialize();
+        FooClass2 data = new FooClass2();
         Util.writeObject(data);
     }
 }

src/test/java/com/oldratlee/innerclass/serialization/StaticInnerClassSerializationTest.java

 package com.oldratlee.innerclass.serialization;
 
+import com.oldratlee.innerclass.com.oldratlee.innerclass.serialization.Util;
 import org.junit.Test;
 
 import java.io.Serializable;
 
 public class StaticInnerClassSerializationTest {
 
-    interface GetDataInterface extends Serializable {
+    interface FooInterface3 extends Serializable {
         public Object getData();
     }
 
-    static GetDataInterface getData = new GetDataInterface() {
+    static FooInterface3 getData = new FooInterface3() {
         private static final long serialVersionUID = 1L;
 
         public Object getData() {
         }
     };
 
-    public static class ClassImplSerialize implements Serializable {
+    public static class FooClass3 implements Serializable {
         private static final long serialVersionUID = 88940079192401092L;
     }
 
 
     @Test
     public void testSerializable_StaticInnerClass() throws Exception {
-        ClassImplSerialize data = new ClassImplSerialize();
+        FooClass3 data = new FooClass3();
         Util.writeObject(data);
     }
 }

src/test/java/com/oldratlee/innerclass/serialization/Util.java

-package com.oldratlee.innerclass.serialization;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-public class Util {
-    public static <T> void writeObject(T data) throws IOException {
-        ObjectOutputStream out = null;
-        try {
-            out = new ObjectOutputStream(new ByteArrayOutputStream());
-            out.writeObject(data);
-        } finally {
-            if (null != out) {
-                try {
-                    out.close();
-                } catch (Exception e) {
-                }
-            }
-        }
-    }
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.