Faster project loading in classpath computation

Loading projects is recursive and in case where:

A -> (depends on) B, A -> C, B -> D, C -> D

D is loaded twice.

In some big projects this causes a lot of wasted time when projects are
loaded dozens of times.

This commit introduces cache for already computed projects thet prevents
multiple loading of single projects.
Simplify HashSet usage for computed Classpaths

Since the LinkedHashSet prevents duplicates, processing classpaths in
topological order produces the same output, but would make the code more
complicated.

Fixes #1002311
Add cycle avoidance to classpath computation.

Fixes #1002179.
Merge pull request #848 from huitseeker/pr/840

Faster project loading in classpath computation