Skip to content

Commit

Permalink
send errors to Log, completed javadoc and removed abbreviations from …
Browse files Browse the repository at this point in the history
…class names
  • Loading branch information
daans committed Apr 5, 2018
1 parent 377026f commit ea20871
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
Expand Up @@ -9,10 +9,10 @@
import static org.junit.Assert.assertNotEquals;


public class JPCollectionStrategyTest {
public class ParserCollectionStrategyTest {

private final Path root = CodeGenerationUtils.mavenModuleRoot(JPCollectionStrategyTest.class).resolve("").getParent();
private final ProjectRoot projectRoot = new CollectionContext(new JPCollectionStrategy()).collect(root);
private final Path root = CodeGenerationUtils.mavenModuleRoot(ParserCollectionStrategyTest.class).resolve("").getParent();
private final ProjectRoot projectRoot = new CollectionContext(new ParserCollectionStrategy()).collect(root);

@Test
public void getSourceRoots() {
Expand Down
Expand Up @@ -11,15 +11,15 @@
/**
* Strategy which collects all SourceRoots and returns them in a ProjectRoot object.
*/
public class JPCollectionStrategy implements CollectionStrategy {
public class ParserCollectionStrategy implements CollectionStrategy {

private final ParserConfiguration parserConfiguration;

public JPCollectionStrategy() {
public ParserCollectionStrategy() {
this(new ParserConfiguration());
}

public JPCollectionStrategy(ParserConfiguration parserConfiguration) {
public ParserCollectionStrategy(ParserConfiguration parserConfiguration) {
this.parserConfiguration = parserConfiguration;
}

Expand Down Expand Up @@ -60,7 +60,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException e) {
}
});
} catch (IOException e) {
e.printStackTrace();
Log.error(e, "Unable to walk %s", path);
}
return projectRoot;
}
Expand Down
Expand Up @@ -3,15 +3,15 @@
import com.github.javaparser.ParserConfiguration;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

/**
* A collection of SourceRoots. Provide the path to the root of the project, and
* A collection of SourceRoots. The ProjectRoot can be provided and populated with a CollectionContext together with
* a CollectionStrategy.
*/
public class ProjectRoot {

Expand Down
Expand Up @@ -7,6 +7,7 @@
import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver;
import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver;
import com.github.javaparser.utils.CollectionStrategy;
import com.github.javaparser.utils.Log;
import com.github.javaparser.utils.ProjectRoot;

import java.io.IOException;
Expand All @@ -20,16 +21,16 @@
* Strategy which collects all SourceRoots and initialises the TypeSolver and returns the SourceRoots configured
* with the TypeSolver in a ProjectRoot object.
*/
public class JSSCollectionStrategy implements CollectionStrategy {
public class SymbolSolverCollectionStrategy implements CollectionStrategy {

private final ParserConfiguration parserConfiguration;
private final CombinedTypeSolver typeSolver = new CombinedTypeSolver(new ReflectionTypeSolver(false));

public JSSCollectionStrategy() {
public SymbolSolverCollectionStrategy() {
this(new ParserConfiguration());
}

public JSSCollectionStrategy(ParserConfiguration parserConfiguration) {
public SymbolSolverCollectionStrategy(ParserConfiguration parserConfiguration) {
this.parserConfiguration = parserConfiguration.setSymbolResolver(new JavaSymbolSolver(typeSolver));
}

Expand Down Expand Up @@ -73,7 +74,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException e) {
}
});
} catch (IOException e) {
e.printStackTrace();
Log.error(e, "Unable to walk %s", path);
}
return projectRoot;
}
Expand Down
Expand Up @@ -12,10 +12,10 @@

import static org.junit.Assert.assertTrue;

public class JSSCollectionStrategyTest {
public class SymbolSolverCollectionStrategyTest {

private final Path root = CodeGenerationUtils.mavenModuleRoot(JSSCollectionStrategyTest.class).resolve("").getParent();
private final ProjectRoot projectRoot = new CollectionContext(new JSSCollectionStrategy()).collect(root);
private final Path root = CodeGenerationUtils.mavenModuleRoot(SymbolSolverCollectionStrategyTest.class).resolve("").getParent();
private final ProjectRoot projectRoot = new CollectionContext(new SymbolSolverCollectionStrategy()).collect(root);

@Test
public void resolveExpressions() throws IOException {
Expand Down

0 comments on commit ea20871

Please sign in to comment.