Create the right ElementInfo for package declaration.

This resulted in a ClassCastException before.

Fixed #1000572.