Hershey Co. (HSY) - Get Report shares were rising Wednesday after analysts at Bank of America gave the stock a double upgrade. 

Hershey stock gained 3.11% to $107.61.  

Bank of America reversed course on Hershey, bringing its price target on the chocolate company from under the stock's current level to well above. The analysts raised the stock's rating to "buy" from "underperform" and raised the price target to $120 a share from $92, representing roughly 11.5% upside. 

The chocolate, candy and gum categories have been slowing down, but Hershey has made investments and divestitures to position itself for higher growth. The Bank of America's analysts have factored that into their valuation. Gross margins should also expand as commodity inflation cools. Operating profit should expand as well, as the new investments will create better organic sales growth.

The analysts also noted Hershey has a strong balance sheet, which could help it make any additional investments in the future.

Hershey has had a rough year, down 5.26% year to date. The stock hit a yearly low of $89.10 on May 3 before rebounding to a year high of $110 on Dec. 13. While the broader market has gotten hit in the past three months, Hershey has outperformed, gaining 4.7% in that span.