We need to remember that 5e does more of grouping weapons together into one "weapon" (especially when qualities like versatile – see how bastard sword becomes part of longsword – or thrown come into play). I can see the javelin being both the traditional javelin and effectively what 3.x called the shortspear, thus including the pilum within it when used as a melee weapon. I'm reminded of the discussions elsewhere of where club versus mace now really break down and various other similar talks (and frankly, for the level of granularity that the weapon system is at, it's fine; else we get into that weird glaive versus halberd debate write large!).