Could be a caching issue, definitely a bad bug if that's what it is.
What version of SQL Developer are you using?
How you open that package?
Apply filter and then get the code?
Or from history?
I wrote some changes into package body, successfully compiled and left SQL Developer opened.
On the next day I came to work, closed all the packages and connections from the GUI and opened the package again to continue.
When I tried to compile the package body, I recieved compilation errors.
The reason was: SQL Developer for some reason opened outdated package body without latest changes!
Sorry - but that sounds a little fishy to me.
It doesn't make much sense that someone would 'closed all the packages and connections' and then reopen a package they just closed and keep working with it. If they wanted to keep working with an open package they would just do that.
And if someone were going to 'close' everything the most logical thing to close is Sql Developer itself.
What makes MORE SENSE is that you just kept working with the opened package and others had made changes to it without you knowing it.
I'd be surprised if you can reproduce the problem after closing sql developer and then reopening it.
If you can reproduce the problem then post the test case AND the actual sql dev and platform versions you are using.