@@ -0,0 +1,1516 @@
+package com.redhat.ceylon.compiler.java.language;%0A%0Aimport java.io.ObjectStreamException;%0Aimport java.io.Serializable;%0Aimport java.lang.reflect.Method;%0A%0A/**%0A * Helper class for %7B@code java.io.Serializable%7D %0A * %22singleton%22 instances (such as %0A * object declarations and value constructors). %0A * In their %7B@code writeReplace()%7D method they return a%0A * %7B@code SerializationProxy%7D instance whose %7B@link #readResolve()%7D%0A * will invoke the relevant getter during deserialization.%0A */%0Apublic class SerializationProxy implements Serializable %7B%0A%0A    private static final long serialVersionUID = 1L;%0A    %0A    private final Class%3C?%3E clazz;%0A    private final Object outer;%0A    private final String name;%0A%0A    public SerializationProxy(Class%3C?%3E clazz, String name) %7B%0A        this(null, clazz, name);%0A    %7D%0A    %0A    public SerializationProxy(Object outer, Class%3C?%3E clazz, String name) %7B%0A        this.outer = outer;%0A        this.clazz = clazz;%0A        this.name = name;%0A    %7D%0A    %0A    java.lang.Object readResolve() throws ObjectStreamException %7B%0A        Method method;%0A        try %7B%0A            method = clazz.getDeclaredMethod(name);%0A        %7D catch (ReflectiveOperationException e) %7B%0A            throw new RuntimeException(%22Could not find method %22 + name + %22 in %22 + clazz, e);%0A        %7D%0A        try %7B%0A            method.setAccessible(true);%0A            return method.invoke(outer);%0A        %7D catch (ReflectiveOperationException e) %7B%0A            throw new RuntimeException(%22Could not invoke %22 + method, e);%0A        %7D%0A    %7D%0A    %0A%7D%0A

Add SerializationProxy