{
StringBuilder code = new StringBuilder();
code.append("public class NotSerializable {\n");
code.append("}\n");
resources.add(new StaticJavaResource("NotSerializable", code));
}
{
StringBuilder code = new StringBuilder();
code.append("import java.io.Serializable;\n");
code.append("public class OuterClass {\n");
code.append(" static class StaticNested implements Serializable {};\n");
code.append(" class NonStaticNested implements Serializable {};\n");
code.append("}\n");
resources.add(new StaticJavaResource("OuterClass", code));
}
{
StringBuilder code = new StringBuilder();
code.append("import java.io.Serializable;\n");
code.append("public abstract class AbstractSerializableClass implements Serializable {\n");
code.append("}\n");
resources.add(new StaticJavaResource("AbstractSerializableClass", code));
}
{
StringBuilder code = new StringBuilder();
code.append("import java.io.Serializable;\n");
code.append("public class NonDefaultInstantiableSerializable implements Serializable {\n");
code.append(" NonDefaultInstantiableSerializable(int i) {}\n");
code.append("}\n");
resources.add(new StaticJavaResource("NonDefaultInstantiableSerializable", code));
}
{
StringBuilder code = new StringBuilder();
code.append("import java.io.Serializable;\n");
code.append("public class PublicOuterClass {\n");
code.append(" private static class PrivateStaticInner {\n");
code.append(" public static class PublicStaticInnerInner implements Serializable {\n");
code.append(" }\n");
code.append(" }\n");
code.append(" static class DefaultStaticInner {\n");
code.append(" static class DefaultStaticInnerInner implements Serializable {\n");
code.append(" }\n");
code.append(" }\n");
code.append("}\n");
resources.add(new StaticJavaResource("PublicOuterClass", code));
}
{
StringBuilder code = new StringBuilder();
code.append("public enum EnumWithSubclasses {\n");
code.append(" A {\n");
code.append(" @Override\n");
code.append(" public String value() {\n");
code.append(" return \"X\";\n");
code.append(" }\n");
code.append(" },\n");
code.append(" B {\n");
code.append(" @Override\n");
code.append(" public String value() {\n");
code.append(" return \"Y\";\n");
code.append(" };\n");
code.append(" };\n");
code.append(" public abstract String value();\n");
code.append("};\n");
resources.add(new StaticJavaResource("EnumWithSubclasses", code));
}
{
StringBuilder code = new StringBuilder();
code.append("public enum EnumWithNonDefaultCtors {\n");
code.append(" A(\"X\"), B(\"Y\");\n");
code.append(" String value;");
code.append(" private EnumWithNonDefaultCtors(String value) {\n");
code.append(" this.value = value;\n");
code.append(" }\n");
code.append("};\n");
resources.add(new StaticJavaResource("EnumWithNonDefaultCtors", code));
}
TreeLogger logger = createLogger();
TypeOracle to = TypeOracleTestingUtils.buildTypeOracle(logger, resources);
SerializableTypeOracleBuilder sob = createSerializableTypeOracleBuilder(logger, to);