@@ -602,6 +602,7 @@ public void correctBuilder() throws Exception {
602602 " public abstract ImmutableList<T> anImmutableList();" ,
603603 " public abstract Optional<String> anOptionalString();" ,
604604 " public abstract NestedAutoValue<T> aNestedAutoValue();" ,
605+ " public abstract Optional<Object> anOptionalObject();" ,
605606 "" ,
606607 " public abstract Builder<T> toBuilder();" ,
607608 "" ,
@@ -616,6 +617,7 @@ public void correctBuilder() throws Exception {
616617 " public abstract Builder<T> anOptionalString(Optional<String> s);" ,
617618 " public abstract Builder<T> anOptionalString(String s);" ,
618619 " public abstract NestedAutoValue.Builder<T> aNestedAutoValueBuilder();" ,
620+ " public abstract Builder<T> anOptionalObject(@Nullable Object s);" ,
619621 "" ,
620622 " public Builder<T> aList(ArrayList<T> x) {" ,
621623 // ArrayList should not be imported in the generated class.
@@ -675,6 +677,7 @@ public void correctBuilder() throws Exception {
675677 " private final ImmutableList<T> anImmutableList;" ,
676678 " private final Optional<String> anOptionalString;" ,
677679 " private final NestedAutoValue<T> aNestedAutoValue;" ,
680+ " private final Optional<Object> anOptionalObject;" ,
678681 "" ,
679682 " private AutoValue_Baz(" ,
680683 " int anInt," ,
@@ -683,14 +686,16 @@ public void correctBuilder() throws Exception {
683686 " List<T> aList," ,
684687 " ImmutableList<T> anImmutableList," ,
685688 " Optional<String> anOptionalString," ,
686- " NestedAutoValue<T> aNestedAutoValue) {" ,
689+ " NestedAutoValue<T> aNestedAutoValue," ,
690+ " Optional<Object> anOptionalObject) {" ,
687691 " this.anInt = anInt;" ,
688692 " this.aByteArray = aByteArray;" ,
689693 " this.aNullableIntArray = aNullableIntArray;" ,
690694 " this.aList = aList;" ,
691695 " this.anImmutableList = anImmutableList;" ,
692696 " this.anOptionalString = anOptionalString;" ,
693697 " this.aNestedAutoValue = aNestedAutoValue;" ,
698+ " this.anOptionalObject = anOptionalObject;" ,
694699 " }" ,
695700 "" ,
696701 " @Override public int anInt() {" ,
@@ -724,6 +729,10 @@ public void correctBuilder() throws Exception {
724729 " return aNestedAutoValue;" ,
725730 " }" ,
726731 "" ,
732+ " @Override public Optional<Object> anOptionalObject() {" ,
733+ " return anOptionalObject;" ,
734+ " }" ,
735+ "" ,
727736 " @Override public String toString() {" ,
728737 " return \" Baz{\" " ,
729738 " + \" anInt=\" + anInt + \" , \" " ,
@@ -732,7 +741,8 @@ public void correctBuilder() throws Exception {
732741 " + \" aList=\" + aList + \" , \" " ,
733742 " + \" anImmutableList=\" + anImmutableList + \" , \" " ,
734743 " + \" anOptionalString=\" + anOptionalString + \" , \" " ,
735- " + \" aNestedAutoValue=\" + aNestedAutoValue" ,
744+ " + \" aNestedAutoValue=\" + aNestedAutoValue + \" , \" " ,
745+ " + \" anOptionalObject=\" + anOptionalObject" ,
736746 " + \" }\" ;" ,
737747 " }" ,
738748 "" ,
@@ -752,7 +762,8 @@ public void correctBuilder() throws Exception {
752762 " && (this.aList.equals(that.aList()))" ,
753763 " && (this.anImmutableList.equals(that.anImmutableList()))" ,
754764 " && (this.anOptionalString.equals(that.anOptionalString()))" ,
755- " && (this.aNestedAutoValue.equals(that.aNestedAutoValue()));" ,
765+ " && (this.aNestedAutoValue.equals(that.aNestedAutoValue()))" ,
766+ " && (this.anOptionalObject.equals(that.anOptionalObject()));" ,
756767 " }" ,
757768 " return false;" ,
758769 " }" ,
@@ -773,6 +784,8 @@ public void correctBuilder() throws Exception {
773784 " h ^= this.anOptionalString.hashCode();" ,
774785 " h *= 1000003;" ,
775786 " h ^= this.aNestedAutoValue.hashCode();" ,
787+ " h *= 1000003;" ,
788+ " h ^= this.anOptionalObject.hashCode();" ,
776789 " return h;" ,
777790 " }" ,
778791 "" ,
@@ -790,6 +803,7 @@ public void correctBuilder() throws Exception {
790803 " private Optional<String> anOptionalString = Optional.absent();" ,
791804 " private NestedAutoValue.Builder<T> aNestedAutoValueBuilder$;" ,
792805 " private NestedAutoValue<T> aNestedAutoValue;" ,
806+ " private Optional<Object> anOptionalObject = Optional.absent();" ,
793807 "" ,
794808 " Builder() {" ,
795809 " }" ,
@@ -802,6 +816,7 @@ public void correctBuilder() throws Exception {
802816 " this.anImmutableList = source.anImmutableList();" ,
803817 " this.anOptionalString = source.anOptionalString();" ,
804818 " this.aNestedAutoValue = source.aNestedAutoValue();" ,
819+ " this.anOptionalObject = source.anOptionalObject();" ,
805820 " }" ,
806821 "" ,
807822 " @Override" ,
@@ -921,6 +936,12 @@ public void correctBuilder() throws Exception {
921936 " }" ,
922937 "" ,
923938 " @Override" ,
939+ " public Baz.Builder<T> anOptionalObject(@Nullable Object anOptionalObject) {" ,
940+ " this.anOptionalObject = Optional.fromNullable(anOptionalObject);" ,
941+ " return this;" ,
942+ " }" ,
943+ "" ,
944+ " @Override" ,
924945 " public Baz<T> build() {" ,
925946 " if (anImmutableListBuilder$ != null) {" ,
926947 " this.anImmutableList = anImmutableListBuilder$.build();" ,
@@ -953,7 +974,8 @@ public void correctBuilder() throws Exception {
953974 " this.aList," ,
954975 " this.anImmutableList," ,
955976 " this.anOptionalString," ,
956- " this.aNestedAutoValue);" ,
977+ " this.aNestedAutoValue," ,
978+ " this.anOptionalObject);" ,
957979 " }" ,
958980 " }" ,
959981 "}" );
0 commit comments