Retirement tax questions

Dana, I am in the same situation and have amended my 2017 return, but I have an additional question and am hoping you can help.  I too contributed to a Roth IRA in 2017 and withdrew before the filing date in 2018, and I am amending my 2017 return to report the earnings.  My additional problem is this: in February, 2017, I opened the Roth IRA and contributed $6500 for the 2016 tax year.  All excess contributions were withdrawn in January, 2018.  What year do I report this excess contribution made in February, 2017, for the Tax Year of 2016, which is being reported on a 2018 1099R which I received in 2019?  The Code is just "J" and not "PJ" or "8J".  Many thanks in advance.