@@ -604,6 +604,7 @@ public void correctBuilder() throws Exception {
604604 " public abstract List<T> aList();" ,
605605 " public abstract ImmutableList<T> anImmutableList();" ,
606606 " public abstract Optional<String> anOptionalString();" ,
607+ " public abstract Optional<Object> anOptionalObject();" ,
607608 "" ,
608609 " public abstract Builder<T> toBuilder();" ,
609610 "" ,
@@ -617,6 +618,7 @@ public void correctBuilder() throws Exception {
617618 " public abstract ImmutableList.Builder<T> anImmutableListBuilder();" ,
618619 " public abstract Builder<T> anOptionalString(Optional<String> s);" ,
619620 " public abstract Builder<T> anOptionalString(String s);" ,
621+ " public abstract Builder<T> anOptionalObject(@Nullable Object s);" ,
620622 "" ,
621623 " public Builder<T> aList(ArrayList<T> x) {" ,
622624 // ArrayList should not be imported in the generated class.
@@ -653,20 +655,23 @@ public void correctBuilder() throws Exception {
653655 " private final List<T> aList;" ,
654656 " private final ImmutableList<T> anImmutableList;" ,
655657 " private final Optional<String> anOptionalString;" ,
658+ " private final Optional<Object> anOptionalObject;" ,
656659 "" ,
657660 " private AutoValue_Baz(" ,
658661 " int anInt," ,
659662 " byte[] aByteArray," ,
660663 " @Nullable int[] aNullableIntArray," ,
661664 " List<T> aList," ,
662665 " ImmutableList<T> anImmutableList," ,
663- " Optional<String> anOptionalString) {" ,
666+ " Optional<String> anOptionalString," ,
667+ " Optional<Object> anOptionalObject) {" ,
664668 " this.anInt = anInt;" ,
665669 " this.aByteArray = aByteArray;" ,
666670 " this.aNullableIntArray = aNullableIntArray;" ,
667671 " this.aList = aList;" ,
668672 " this.anImmutableList = anImmutableList;" ,
669673 " this.anOptionalString = anOptionalString;" ,
674+ " this.anOptionalObject = anOptionalObject;" ,
670675 " }" ,
671676 "" ,
672677 " @Override public int anInt() {" ,
@@ -696,14 +701,19 @@ public void correctBuilder() throws Exception {
696701 " return anOptionalString;" ,
697702 " }" ,
698703 "" ,
704+ " @Override public Optional<Object> anOptionalObject() {" ,
705+ " return anOptionalObject;" ,
706+ " }" ,
707+ "" ,
699708 " @Override public String toString() {" ,
700709 " return \" Baz{\" " ,
701710 " + \" anInt=\" + anInt + \" , \" " ,
702711 " + \" aByteArray=\" + Arrays.toString(aByteArray) + \" , \" " ,
703712 " + \" aNullableIntArray=\" + Arrays.toString(aNullableIntArray) + \" , \" " ,
704713 " + \" aList=\" + aList + \" , \" " ,
705714 " + \" anImmutableList=\" + anImmutableList + \" , \" " ,
706- " + \" anOptionalString=\" + anOptionalString" ,
715+ " + \" anOptionalString=\" + anOptionalString + \" , \" " ,
716+ " + \" anOptionalObject=\" + anOptionalObject" ,
707717 " + \" }\" ;" ,
708718 " }" ,
709719 "" ,
@@ -722,7 +732,8 @@ public void correctBuilder() throws Exception {
722732 + "? ((AutoValue_Baz) that).aNullableIntArray : that.aNullableIntArray()))" ,
723733 " && (this.aList.equals(that.aList()))" ,
724734 " && (this.anImmutableList.equals(that.anImmutableList()))" ,
725- " && (this.anOptionalString.equals(that.anOptionalString()));" ,
735+ " && (this.anOptionalString.equals(that.anOptionalString()))" ,
736+ " && (this.anOptionalObject.equals(that.anOptionalObject()));" ,
726737 " }" ,
727738 " return false;" ,
728739 " }" ,
@@ -741,6 +752,8 @@ public void correctBuilder() throws Exception {
741752 " h ^= this.anImmutableList.hashCode();" ,
742753 " h *= 1000003;" ,
743754 " h ^= this.anOptionalString.hashCode();" ,
755+ " h *= 1000003;" ,
756+ " h ^= this.anOptionalObject.hashCode();" ,
744757 " return h;" ,
745758 " }" ,
746759 "" ,
@@ -756,6 +769,7 @@ public void correctBuilder() throws Exception {
756769 " private ImmutableList.Builder<T> anImmutableListBuilder$;" ,
757770 " private ImmutableList<T> anImmutableList;" ,
758771 " private Optional<String> anOptionalString = Optional.absent();" ,
772+ " private Optional<Object> anOptionalObject = Optional.absent();" ,
759773 "" ,
760774 " Builder() {" ,
761775 " this.anImmutableList = ImmutableList.of();" ,
@@ -768,6 +782,7 @@ public void correctBuilder() throws Exception {
768782 " this.aList = source.aList();" ,
769783 " this.anImmutableList = source.anImmutableList();" ,
770784 " this.anOptionalString = source.anOptionalString();" ,
785+ " this.anOptionalObject = source.anOptionalObject();" ,
771786 " }" ,
772787 "" ,
773788 " @Override" ,
@@ -852,6 +867,12 @@ public void correctBuilder() throws Exception {
852867 " }" ,
853868 "" ,
854869 " @Override" ,
870+ " public Baz.Builder<T> anOptionalObject(@Nullable Object anOptionalObject) {" ,
871+ " this.anOptionalObject = Optional.fromNullable(anOptionalObject);" ,
872+ " return this;" ,
873+ " }" ,
874+ "" ,
875+ " @Override" ,
855876 " public Baz<T> build() {" ,
856877 " if (anImmutableListBuilder$ != null) {" ,
857878 " anImmutableList = anImmutableListBuilder$.build();" ,
@@ -875,7 +896,8 @@ public void correctBuilder() throws Exception {
875896 " this.aNullableIntArray," ,
876897 " this.aList," ,
877898 " this.anImmutableList," ,
878- " this.anOptionalString);" ,
899+ " this.anOptionalString," ,
900+ " this.anOptionalObject);" ,
879901 " }" ,
880902 " }" ,
881903 "}" );
0 commit comments