Skip to content

Commit e3a6ad2

Browse files
committed
style: reformat grails-core per styling rules
1 parent 30a1f02 commit e3a6ad2

File tree

532 files changed

+8332
-8622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

532 files changed

+8332
-8622
lines changed

etc/config/checkstyle/checkstyle.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,13 @@
9797
<module name="SuppressWarningsFilter"/>
9898

9999
<!-- See http://checkstyle.sourceforge.net/config_filters.html#SuppressionFilter -->
100-
<!-- <module name="SuppressionFilter">-->
101-
<!-- <property name="file" value="${config_loc}/suppressions.xml"/>-->
102-
<!-- <property name="optional" value="false"/>-->
103-
<!-- </module>-->
100+
<module name="SuppressionFilter">
101+
<property name="file" value="${config_loc}/suppressions.xml"/>
102+
<property name="optional" value="false"/>
103+
</module>
104104

105105
<module name="TreeWalker">
106+
<module name="AvoidStarImport"/>
106107

107108
<!-- Needed for SuppressWarningsFilter -->
108109
<module name="SuppressWarningsHolder"/>
@@ -228,6 +229,8 @@
228229
<module name="TodoComment">
229230
<property name="severity" value="warning"/>
230231
</module>
232+
233+
<module name="SuppressionCommentFilter"/>
231234
</module>
232235

233236
</module>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ https://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
<!DOCTYPE suppressions PUBLIC
21+
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
22+
"http://checkstyle.sourceforge.net/dtds/suppressions_1_1.dtd">
23+
<suppressions>
24+
<suppress checks="FileLength"
25+
files="GrailsDomainBinder.java|AbstractHibernateCriteriaBuilder.java"/>
26+
</suppressions>

gradle/style-enforcement-config.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ spotless {
3737
}
3838

3939
checkstyle {
40-
configFile = project.rootProject.file('etc/config/checkstyle/checkstyle.xml')
40+
configFile = project.rootProject.layout.projectDirectory.file('etc/config/checkstyle/checkstyle.xml').asFile
41+
configDirectory = project.rootProject.layout.projectDirectory.dir('etc/config/checkstyle').asFile
4142

4243
// Per submodule
4344
maxErrors = 1

grails-async/core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ apply {
5050
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
5151
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
5252
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
53+
from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
5354
}

grails-async/core/src/main/groovy/grails/async/DelegateAsync.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import org.codehaus.groovy.transform.GroovyASTTransformationClass
3939
* If the annotation is applied to a new class:
4040
*
4141
* <pre><code>
42-
* @DelegateAsync(BookApi)
42+
* @DelegateAsync (BookApi)
4343
* class AsyncBookApi {}
4444
* </code></pre>
4545
*
@@ -65,5 +65,6 @@ import org.codehaus.groovy.transform.GroovyASTTransformationClass
6565
@Target([ElementType.TYPE, ElementType.FIELD])
6666
@GroovyASTTransformationClass("org.grails.async.transform.internal.DelegateAsyncTransformation")
6767
@interface DelegateAsync {
68+
6869
Class value() default DelegateAsync
6970
}

grails-async/core/src/main/groovy/grails/async/PromiseFactory.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ interface PromiseFactory {
5050
/**
5151
* Creates a promise with a value pre-bound to it
5252
* @param value The value
53-
* @param <T> The type of the value
53+
* @param <T> The type of the value
5454
* @return A Promise
5555
*/
5656
<T> Promise<T> createBoundPromise(T value)
5757

5858
/**
5959
* Creates an unfulfilled promise that returns the given type
6060
* @param returnType The return type
61-
* @param <T> The type of the class
61+
* @param <T> The type of the class
6262
* @return The unfulfilled promise
6363
*/
6464
<T> Promise<T> createPromise(Class<T> returnType)
@@ -76,23 +76,23 @@ interface PromiseFactory {
7676
* @param map The map
7777
* @return A promise
7878
*/
79-
<K,V> Promise<Map<K,V>> createPromise(Map<K, V> map)
79+
<K, V> Promise<Map<K, V>> createPromise(Map<K, V> map)
8080

8181
/**
8282
* Creates a promise from the given map where the values of the map are either closures or Promise instances
8383
*
8484
* @param map The map
8585
* @return A promise
8686
*/
87-
<K,V> Promise<Map<K,V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators)
87+
<K, V> Promise<Map<K, V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators)
8888

8989
/**
9090
* Creates a promise from one or more other promises
9191
*
9292
* @param promises The promises
9393
* @return The promise
9494
*/
95-
<T> Promise<List<T>> createPromise(Promise<T>...promises)
95+
<T> Promise<List<T>> createPromise(Promise<T>... promises)
9696

9797
/**
9898
* Creates a promise from one or many closures
@@ -132,7 +132,7 @@ interface PromiseFactory {
132132
* @param promises The promises
133133
* @return The list of bound values
134134
*/
135-
<T> List<T> waitAll(Promise<T>...promises)
135+
<T> List<T> waitAll(Promise<T>... promises)
136136
/**
137137
* Synchronously waits for all promises to complete returning a list of values
138138
*

grails-async/core/src/main/groovy/grails/async/PromiseList.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class PromiseList<T> implements Promise<List<T>> {
138138

139139
@Override
140140
boolean isDone() {
141-
return promises.every {promise -> promise.isDone() }
141+
return promises.every { promise -> promise.isDone() }
142142
}
143143

144144
@Override

grails-async/core/src/main/groovy/grails/async/PromiseMap.groovy

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ import java.util.concurrent.TimeUnit
3232
*/
3333
@AutoFinal
3434
@CompileStatic
35-
class PromiseMap<K,V> implements Promise<Map<K,V>> {
35+
class PromiseMap<K, V> implements Promise<Map<K, V>> {
3636

3737
protected LinkedHashMap<K, Promise<V>> promises = [:]
3838
protected LinkedHashMap<Promise<V>, K> promisesKeys = [:]
3939

4040
PromiseMap() {}
4141

42-
PromiseMap(Map<K,V> values) {
42+
PromiseMap(Map<K, V> values) {
4343
accept(values)
4444
}
4545

@@ -55,11 +55,11 @@ class PromiseMap<K,V> implements Promise<Map<K,V>> {
5555

5656
@Override
5757
boolean isDone() {
58-
return promisesKeys.keySet().every {it.isDone() }
58+
return promisesKeys.keySet().every { it.isDone() }
5959
}
6060

6161
@Override
62-
Promise<Map<K,V>> accept(Map<K,V> values) {
62+
Promise<Map<K, V>> accept(Map<K, V> values) {
6363
values.each { K key, Object value ->
6464
if (value instanceof Promise) {
6565
put(key, value as Promise<V>)
@@ -210,10 +210,10 @@ class PromiseMap<K,V> implements Promise<Map<K,V>> {
210210
*
211211
* @return A map where the values are obtained from the promises
212212
*/
213-
Map<K,V> get() throws Throwable {
213+
Map<K, V> get() throws Throwable {
214214
def promises = promises.values()
215-
Map<K,V> resultMap = [:]
216-
for(Promise<V> promise : promises) {
215+
Map<K, V> resultMap = [:]
216+
for (Promise<V> promise : promises) {
217217
V value = promise.get()
218218
resultMap.put(promisesKeys.get(promise), value)
219219
}
@@ -224,28 +224,28 @@ class PromiseMap<K,V> implements Promise<Map<K,V>> {
224224
* Synchronously return the populated map with all values obtained from promises used
225225
* inside the populated map
226226
*
227-
* @param timeout The timeout period
227+
* @param timeout The timeout period
228228
* @param units The timeout units
229229
* @return A map where the values are obtained from the promises
230230
*/
231-
Map<K,V> get(long timeout, TimeUnit units) throws Throwable {
231+
Map<K, V> get(long timeout, TimeUnit units) throws Throwable {
232232
List<Promise<V>> promises = new ArrayList<Promise<V>>(promises.values())
233233
Promises.waitAll(promises, timeout, units)
234-
Map<K,V> resultMap = [:]
235-
for(Promise<V> promise : promises) {
234+
Map<K, V> resultMap = [:]
235+
for (Promise<V> promise : promises) {
236236
V value = promise.get()
237237
resultMap.put(promisesKeys.get(promise), value)
238238
}
239239
return resultMap
240240
}
241241

242242
@Override
243-
Promise<Map<K,V>> onComplete(Closure<Map<K,V>> callable) {
243+
Promise<Map<K, V>> onComplete(Closure<Map<K, V>> callable) {
244244
List<Promise<V>> promises = new ArrayList<Promise<V>>(promises.values())
245245
Promises.onComplete(promises) { List<V> values ->
246-
Map<K,V> resultMap = [:]
246+
Map<K, V> resultMap = [:]
247247
int i = 0
248-
for(V value in values) {
248+
for (V value in values) {
249249
Promise<V> promise = promises[i]
250250
K key = promisesKeys.get(promise)
251251
resultMap.put(key, value)
@@ -258,13 +258,13 @@ class PromiseMap<K,V> implements Promise<Map<K,V>> {
258258
}
259259

260260
@Override
261-
Promise<Map<K,V>> onError(Closure<Map<K,V>> callable) {
261+
Promise<Map<K, V>> onError(Closure<Map<K, V>> callable) {
262262
Promises.onError(new ArrayList<Promise<V>>(promises.values()), callable)
263263
return this
264264
}
265265

266266
@Override
267-
Promise<Map<K, V>> then(Closure<Map<K,V>> callable) {
267+
Promise<Map<K, V>> then(Closure<Map<K, V>> callable) {
268268
return onComplete(callable)
269269
}
270270

grails-async/core/src/main/groovy/grails/async/Promises.groovy

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,79 +51,79 @@ class Promises {
5151
}
5252

5353
/**
54-
* @see PromiseFactory#waitAll(grails.async.Promise[])
54+
* @see PromiseFactory#waitAll(grails.async.Promise [ ])
5555
*/
56-
static<T> List<T> waitAll(Promise<T>... promises) {
56+
static <T> List<T> waitAll(Promise<T>... promises) {
5757
return getPromiseFactory().waitAll(promises)
5858
}
5959

6060
/**
6161
* @see PromiseFactory#waitAll(java.util.List)
6262
*/
63-
static<T> List<T> waitAll(List<Promise<T>> promises) {
63+
static <T> List<T> waitAll(List<Promise<T>> promises) {
6464
return getPromiseFactory().waitAll(promises)
6565
}
6666

6767
/**
6868
* @see PromiseFactory#waitAll(java.util.List)
6969
*/
70-
static<T> List<T> waitAll(List<Promise<T>> promises, long timeout, TimeUnit units) {
70+
static <T> List<T> waitAll(List<Promise<T>> promises, long timeout, TimeUnit units) {
7171
return getPromiseFactory().waitAll(promises, timeout, units)
7272
}
7373

7474
/**
7575
* @see PromiseFactory#onComplete(java.util.List, groovy.lang.Closure)
7676
*/
77-
static<T> Promise<List<T>> onComplete(List<Promise<T>> promises, Closure<T> callable) {
77+
static <T> Promise<List<T>> onComplete(List<Promise<T>> promises, Closure<T> callable) {
7878
return getPromiseFactory().onComplete(promises, callable)
7979
}
8080
/**
8181
* @see PromiseFactory#onError(java.util.List, groovy.lang.Closure)
8282
*/
83-
static<T> Promise<List<T>> onError(List<Promise<T>> promises, Closure<?> callable) {
83+
static <T> Promise<List<T>> onError(List<Promise<T>> promises, Closure<?> callable) {
8484
return getPromiseFactory().onError(promises, callable)
8585
}
8686
/**
8787
* @see PromiseFactory#createPromise(java.util.Map)
8888
*/
89-
static<K,V> Promise<Map<K,V>> createPromise(Map<K, V> map) {
89+
static <K, V> Promise<Map<K, V>> createPromise(Map<K, V> map) {
9090
return getPromiseFactory().createPromise(map)
9191
}
9292
/**
9393
* @see PromiseFactory#createPromise(java.util.Map)
9494
*/
95-
static<K,V> Promise<Map<K,V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators) {
95+
static <K, V> Promise<Map<K, V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators) {
9696
return getPromiseFactory().createPromise(map, decorators)
9797
}
9898
/**
99-
* @see PromiseFactory#createPromise(groovy.lang.Closure[])
99+
* @see PromiseFactory#createPromise(groovy.lang.Closure [ ])
100100
*/
101-
static<T> Promise<T> createPromise(Closure<T>... closures) {
101+
static <T> Promise<T> createPromise(Closure<T>... closures) {
102102
return getPromiseFactory().createPromise(closures)
103103
}
104104

105105
/**
106106
* @see PromiseFactory#createPromise(java.util.Map)
107107
*/
108-
static<K,V> Promise<Map<K,V>> tasks(Map<K, V> map) {
108+
static <K, V> Promise<Map<K, V>> tasks(Map<K, V> map) {
109109
return getPromiseFactory().createPromise(map)
110110
}
111111
/**
112-
* @see PromiseFactory#createPromise(groovy.lang.Closure[])
112+
* @see PromiseFactory#createPromise(groovy.lang.Closure [ ])
113113
*/
114-
static<T> Promise<T> task(Closure<T> closure) {
114+
static <T> Promise<T> task(Closure<T> closure) {
115115
return getPromiseFactory().createPromise(closure)
116116
}
117117
/**
118-
* @see PromiseFactory#createPromise(groovy.lang.Closure[])
118+
* @see PromiseFactory#createPromise(groovy.lang.Closure [ ])
119119
*/
120-
static<T> Promise<T> tasks(Closure<T>... closures) {
120+
static <T> Promise<T> tasks(Closure<T>... closures) {
121121
return getPromiseFactory().createPromise(closures)
122122
}
123123
/**
124-
* @see PromiseFactory#createPromise(groovy.lang.Closure[])
124+
* @see PromiseFactory#createPromise(groovy.lang.Closure [ ])
125125
*/
126-
static<T> Promise<List<T>> tasks(List<Closure<T>> closures) {
126+
static <T> Promise<List<T>> tasks(List<Closure<T>> closures) {
127127
return getPromiseFactory().createPromise(closures)
128128
}
129129

@@ -137,33 +137,33 @@ class Promises {
137137
/**
138138
* @see grails.async.PromiseFactory#createPromise(Class)
139139
*/
140-
static<T> Promise<T> createPromise(Class<T> returnType) {
140+
static <T> Promise<T> createPromise(Class<T> returnType) {
141141
return getPromiseFactory().createPromise(returnType)
142142
}
143143

144144
/**
145145
* @see PromiseFactory#createPromise(groovy.lang.Closure, java.util.List)
146146
*/
147-
static<T> Promise<T> createPromise(Closure<T> closure, List<PromiseDecorator> decorators) {
147+
static <T> Promise<T> createPromise(Closure<T> closure, List<PromiseDecorator> decorators) {
148148
return getPromiseFactory().createPromise(closure, decorators)
149149
}
150150
/**
151151
* @see PromiseFactory#createPromise(java.util.List, java.util.List)
152152
*/
153-
static<T> Promise<List<T>> createPromise(List<Closure<T>> closures, List<PromiseDecorator> decorators) {
153+
static <T> Promise<List<T>> createPromise(List<Closure<T>> closures, List<PromiseDecorator> decorators) {
154154
return getPromiseFactory().createPromise(closures, decorators)
155155
}
156156
/**
157-
* @see PromiseFactory#createPromise(grails.async.Promise[])
157+
* @see PromiseFactory#createPromise(grails.async.Promise [ ])
158158
*/
159-
static <T> Promise<List<T>> createPromise(Promise<T>...promises) {
159+
static <T> Promise<List<T>> createPromise(Promise<T>... promises) {
160160
return getPromiseFactory().createPromise(promises)
161161
}
162162

163163
/**
164164
* @see PromiseFactory#createBoundPromise(java.lang.Object)
165165
*/
166-
static<T> Promise<T> createBoundPromise(T value) {
167-
return getPromiseFactory().createBoundPromise(value)
166+
static <T> Promise<T> createBoundPromise(T value) {
167+
return getPromiseFactory().createBoundPromise(value)
168168
}
169169
}

0 commit comments

Comments
 (0)