Skip to content

Commit 6a62136

Browse files
authored
Merge pull request #314 from domaframework/google-java-format-1.7
Upgrade google-java-format to 1.7
2 parents c240741 + 4528901 commit 6a62136

File tree

13 files changed

+22
-54
lines changed

13 files changed

+22
-54
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ext {
1717

1818
spotless {
1919
java {
20-
googleJavaFormat('1.6')
20+
googleJavaFormat('1.7')
2121
}
2222
}
2323

src/main/java/org/seasar/doma/internal/apt/annot/DaoAnnot.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ public class DaoAnnot extends AbstractAnnot {
2828
this.config = assertNonNullValue(values, CONFIG);
2929
this.accessLevel = assertNonNullValue(values, ACCESS_LEVEL);
3030
this.hasUserDefinedConfig =
31-
annotationMirror
32-
.getElementValues()
33-
.keySet()
34-
.stream()
31+
annotationMirror.getElementValues().keySet().stream()
3532
.anyMatch(e -> e.getSimpleName().contentEquals(CONFIG));
3633
}
3734

src/main/java/org/seasar/doma/internal/apt/cttype/CtTypes.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ public DomainCtType newDomainCtType(TypeMirror type) {
193193
}
194194
Iterator<? extends TypeMirror> typeArgs = declaredType.getTypeArguments().iterator();
195195
List<CtType> typeArgCtTypes =
196-
typeElement
197-
.getTypeParameters()
198-
.stream()
196+
typeElement.getTypeParameters().stream()
199197
.map(__ -> typeArgs.hasNext() ? newCtType(typeArgs.next()) : newNoneCtType())
200198
.collect(toList());
201199
Name binaryName = ctx.getMoreElements().getBinaryName(typeElement);
@@ -523,8 +521,7 @@ private CtType newCtTypeInternal(
523521
this::newResultCtType,
524522
this::newBatchResultCtType);
525523
CtType ctType =
526-
functions
527-
.stream()
524+
functions.stream()
528525
.map(f -> f.apply(type))
529526
.filter(Objects::nonNull)
530527
.findFirst()

src/main/java/org/seasar/doma/internal/apt/decl/TypeDeclaration.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ public Optional<ConstructorDeclaration> getConstructorDeclaration(
177177
if (typeElement == null) {
178178
return Optional.empty();
179179
}
180-
return constructorsIn(typeElement.getEnclosedElements())
181-
.stream()
180+
return constructorsIn(typeElement.getEnclosedElements()).stream()
182181
.filter(c -> c.getModifiers().contains(Modifier.PUBLIC))
183182
.filter(c -> c.getParameters().size() == parameterTypeDeclarations.size())
184183
.filter(c -> isAssignable(parameterTypeDeclarations, c.getParameters()))
@@ -201,16 +200,13 @@ private Optional<FieldDeclaration> getFieldDeclarationInternal(String name, bool
201200
}
202201

203202
private List<FieldDeclaration> getCandidateFieldDeclarations(String name, boolean statik) {
204-
return typeParameterDeclarationsMap
205-
.entrySet()
206-
.stream()
203+
return typeParameterDeclarationsMap.entrySet().stream()
207204
.map(e -> new Pair<>(e.getKey(), e.getValue()))
208205
.map(p -> new Pair<>(ctx.getMoreElements().getTypeElement(p.fst), p.snd))
209206
.filter(p -> Objects.nonNull(p.fst))
210207
.flatMap(
211208
p ->
212-
fieldsIn(p.fst.getEnclosedElements())
213-
.stream()
209+
fieldsIn(p.fst.getEnclosedElements()).stream()
214210
.filter(f -> !statik || f.getModifiers().contains(Modifier.STATIC))
215211
.filter(f -> f.getSimpleName().contentEquals(name))
216212
.map(f -> ctx.getDeclarations().newFieldDeclaration(f, p.snd)))
@@ -251,16 +247,13 @@ private Optional<MethodDeclaration> getMethodDeclarationInternal(
251247

252248
private List<MethodDeclaration> getCandidateMethodDeclarations(
253249
String name, List<TypeDeclaration> parameterTypeDeclarations, boolean statik) {
254-
return typeParameterDeclarationsMap
255-
.entrySet()
256-
.stream()
250+
return typeParameterDeclarationsMap.entrySet().stream()
257251
.map(e -> new Pair<>(e.getKey(), e.getValue()))
258252
.map(p -> new Pair<>(ctx.getMoreElements().getTypeElement(p.fst), p.snd))
259253
.filter(p -> Objects.nonNull(p.fst))
260254
.flatMap(
261255
p ->
262-
methodsIn(p.fst.getEnclosedElements())
263-
.stream()
256+
methodsIn(p.fst.getEnclosedElements()).stream()
264257
.filter(m -> !statik || m.getModifiers().contains(Modifier.STATIC))
265258
.filter(m -> m.getModifiers().contains(Modifier.PUBLIC))
266259
.filter(m -> m.getSimpleName().contentEquals(name))

src/main/java/org/seasar/doma/internal/apt/def/TypeParametersDef.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ public TypeParametersDef(Map<TypeParameterElement, String> typeParameterNameMap)
2222
}
2323

2424
public List<String> getTypeVariables() {
25-
return typeParameterNameMap
26-
.keySet()
27-
.stream()
25+
return typeParameterNameMap.keySet().stream()
2826
.map(Element::getSimpleName)
2927
.map(Name::toString)
3028
.collect(collectingAndThen(toList(), Collections::unmodifiableList));

src/main/java/org/seasar/doma/internal/apt/meta/dao/DaoMetaFactory.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ private void validateUserDefinedConfig(
155155
ExecutableElement constructor = ctx.getMoreElements().getNoArgConstructor(configElement);
156156
if (constructor == null || !constructor.getModifiers().contains(Modifier.PUBLIC)) {
157157
Optional<VariableElement> field =
158-
ElementFilter.fieldsIn(configElement.getEnclosedElements())
159-
.stream()
158+
ElementFilter.fieldsIn(configElement.getEnclosedElements()).stream()
160159
.filter(e -> e.getSimpleName().contentEquals(SINGLETON_CONFIG_FIELD_NAME))
161160
.filter(
162161
e ->
@@ -179,8 +178,7 @@ private void validateUserDefinedConfig(
179178
} else {
180179
String methodName = singletonConfig.method();
181180
boolean present =
182-
ElementFilter.methodsIn(configElement.getEnclosedElements())
183-
.stream()
181+
ElementFilter.methodsIn(configElement.getEnclosedElements()).stream()
184182
.filter(
185183
m -> m.getModifiers().containsAll(EnumSet.of(Modifier.STATIC, Modifier.PUBLIC)))
186184
.filter(
@@ -224,10 +222,7 @@ private void doAnnotateWith(DaoMeta daoMeta) {
224222

225223
private void doParentDao(DaoMeta daoMeta) {
226224
List<TypeElement> interfaces =
227-
daoMeta
228-
.getTypeElement()
229-
.getInterfaces()
230-
.stream()
225+
daoMeta.getTypeElement().getInterfaces().stream()
231226
.map(type -> ctx.getMoreTypes().toTypeElement(type))
232227
.peek(
233228
element -> {
@@ -258,8 +253,7 @@ private void doParentDao(DaoMeta daoMeta) {
258253

259254
private ExecutableElement findNonDefaultMethod(TypeElement interfaceElement) {
260255
Optional<ExecutableElement> method =
261-
ElementFilter.methodsIn(interfaceElement.getEnclosedElements())
262-
.stream()
256+
ElementFilter.methodsIn(interfaceElement.getEnclosedElements()).stream()
263257
.filter(m -> !m.isDefault())
264258
.findAny();
265259
if (method.isPresent()) {

src/main/java/org/seasar/doma/internal/apt/meta/domain/DomainMetaFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,7 @@ String inferAccessorMethod(VariableElement field) {
386386

387387
VariableElement findSingleField(TypeElement classElement, DomainMeta domainMeta) {
388388
List<VariableElement> fields =
389-
ElementFilter.fieldsIn(classElement.getEnclosedElements())
390-
.stream()
389+
ElementFilter.fieldsIn(classElement.getEnclosedElements()).stream()
391390
.filter(field -> !field.getModifiers().contains(Modifier.STATIC))
392391
.collect(Collectors.toList());
393392
if (fields.size() == 0) {

src/main/java/org/seasar/doma/internal/apt/processor/SingletonConfigProcessor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ protected void validateClass(TypeElement typeElement, SingletonConfigAnnot mirro
5757
}
5858

5959
protected void validateConstructors(TypeElement typeElement) {
60-
ElementFilter.constructorsIn(typeElement.getEnclosedElements())
61-
.stream()
60+
ElementFilter.constructorsIn(typeElement.getEnclosedElements()).stream()
6261
.filter(c -> !c.getModifiers().contains(Modifier.PRIVATE))
6362
.findAny()
6463
.ifPresent(
@@ -69,8 +68,7 @@ protected void validateConstructors(TypeElement typeElement) {
6968

7069
protected void validateMethod(TypeElement typeElement, String methodName) {
7170
Optional<ExecutableElement> method =
72-
ElementFilter.methodsIn(typeElement.getEnclosedElements())
73-
.stream()
71+
ElementFilter.methodsIn(typeElement.getEnclosedElements()).stream()
7472
.filter(m -> m.getModifiers().containsAll(EnumSet.of(Modifier.STATIC, Modifier.PUBLIC)))
7573
.filter(
7674
m -> ctx.getMoreTypes().isAssignableWithErasure(m.getReturnType(), Config.class))

src/main/java/org/seasar/doma/internal/apt/validator/ExpressionValidator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,7 @@ public TypeDeclaration visitStaticFieldOperatorNode(StaticFieldOperatorNode node
598598
private TypeDeclaration convertIfOptional(TypeDeclaration typeDeclaration) {
599599
if (typeDeclaration.is(Optional.class)) {
600600
TypeParameterDeclaration typeParameterDeclaration =
601-
typeDeclaration
602-
.getTypeParameterDeclarations()
603-
.stream()
601+
typeDeclaration.getTypeParameterDeclarations().stream()
604602
.findFirst()
605603
.orElseThrow(() -> new AptIllegalStateException(typeDeclaration.toString()));
606604
return ctx.getDeclarations().newTypeDeclaration(typeParameterDeclaration.getActualType());

src/main/java/org/seasar/doma/internal/apt/validator/SqlValidator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ public void validate(SqlNode sqlNode) {
7575
sqlNode.accept(this, null);
7676
Set<String> unreferredName = new HashSet<>(parameterTypeMap.keySet());
7777
unreferredName.removeAll(expressionValidator.getValidatedParameterNames());
78-
methodElement
79-
.getParameters()
80-
.stream()
78+
methodElement.getParameters().stream()
8179
.filter(e -> unreferredName.contains(e.getSimpleName().toString()))
8280
.forEach(this::reportUnreferredParameter);
8381
} catch (AptException e) {

0 commit comments

Comments
 (0)