Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #62 #64

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Less radical fix for #62
  • Loading branch information
gneuvill committed Feb 4, 2017
commit 54f4376e82853b97058c61b6640068c0acee5f9f
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public boolean process(final Set<? extends TypeElement> annotations, final Round
remainingElements.stream().map(path -> processingEnv.getElementUtils().getTypeElement(path)),
findAllElements(roundEnv.getRootElements().stream()).filter(e -> (e.getKind() == ElementKind.CLASS) ||
(e.getKind() == ElementKind.INTERFACE) ||
(e.getKind() == ElementKind.ENUM))).flatMap(e -> deriveConfigBuilder.findDeriveConfig((TypeElement) e))
(e.getKind() == ElementKind.ENUM))).sequential().flatMap(e -> deriveConfigBuilder.findDeriveConfig((TypeElement) e))
.collect(Collectors.toMap(P2s::get_1, P2s::get_2));

remainingElements.clear();
Expand All @@ -105,7 +105,7 @@ public boolean process(final Set<? extends TypeElement> annotations, final Round

private void processElements(final Map<TypeElement, DeriveConfig> dataTypes) {

dataTypes.entrySet().stream().<P2<TypeElement, Runnable>>map(entry -> {
dataTypes.entrySet().stream().parallel().<P2<TypeElement, Runnable>>map(entry -> {
TypeElement element = entry.getKey();
try {
DeriveConfig deriveConfig = entry.getValue();
Expand Down Expand Up @@ -173,6 +173,6 @@ private static List<Derivator> derivators() { //TODO
}

private static Stream<Element> findAllElements(Stream<? extends Element> elements) {
return elements.flatMap(e -> concat(Stream.of(e), findAllElements(e.getEnclosedElements().stream())));
return elements.parallel().flatMap(e -> concat(Stream.of(e), findAllElements(e.getEnclosedElements().stream())));
}
}