Skip to content

Commit a20b528

Browse files
committed
feedback: styling
1 parent 24db59d commit a20b528

File tree

13 files changed

+339
-354
lines changed

13 files changed

+339
-354
lines changed

grails-controllers/src/main/groovy/grails/artefact/controller/support/ResponseRenderer.groovy

Lines changed: 100 additions & 121 deletions
Large diffs are not rendered by default.

grails-gsp/core/src/main/groovy/org/grails/gsp/compiler/GroovyPageParser.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
/**
4646
* NOTE: Based on work done by the GSP standalone project (https://gsp.dev.java.net/).
47-
*
47+
* <p>
4848
* Parsing implementation for GSP files
4949
*
5050
* @author Troy Heninger
@@ -699,6 +699,7 @@ private void makeName(String uri) {
699699

700700
/**
701701
* find the simple name of this gsp
702+
*
702703
* @param filename the fully qualified file name
703704
*/
704705
private void makeSourceName(String filename) {
@@ -905,6 +906,7 @@ private boolean isModelRecordingModeEnabled() {
905906

906907
/**
907908
* Determines if the line numbers array should be added to the generated Groovy class.
909+
*
908910
* @return true if they should
909911
*/
910912
private boolean shouldAddLineNumbers() {
@@ -943,6 +945,7 @@ private void addLineNumbers() {
943945

944946
/**
945947
* Filters trailing 0s from the line number array
948+
*
946949
* @param lineNumbers the line number array
947950
* @return a new array that removes all 0s from the end of it
948951
*/

grails-gsp/plugin/src/main/groovy/org/grails/plugins/web/GroovyPagesGrailsPlugin.groovy

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import grails.util.Metadata
2929
import grails.web.pages.GroovyPagesUriService
3030
import groovy.transform.CompileStatic
3131
import groovy.util.logging.Commons
32+
import groovy.util.logging.Slf4j
3233
import org.grails.core.artefact.gsp.TagLibArtefactHandler
3334
import org.grails.gsp.GroovyPageResourceLoader
3435
import org.grails.gsp.GroovyPagesTemplateEngine
@@ -58,7 +59,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver
5859
* @author Graeme Rocher
5960
* @since 1.1
6061
*/
61-
@Commons
62+
@Slf4j
6263
class GroovyPagesGrailsPlugin extends Plugin {
6364

6465
public static final String GSP_RELOAD_INTERVAL = "grails.gsp.reload.interval"
@@ -68,7 +69,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
6869
"file:./grails-app/taglib/**/*TagLib.groovy"]
6970

7071
def grailsVersion = "7.0.0-SNAPSHOT > *"
71-
def dependsOn = [core: GrailsUtil.getGrailsVersion(), i18n: GrailsUtil.getGrailsVersion()]
72+
def dependsOn = [core: GrailsUtil.grailsVersion, i18n: GrailsUtil.grailsVersion]
7273
def observe = ['controllers']
7374
def loadAfter = ['filters']
7475

@@ -101,10 +102,10 @@ class GroovyPagesGrailsPlugin extends Plugin {
101102
{ ->
102103
def application = grailsApplication
103104
Config config = application.config
104-
boolean developmentMode = isDevelopmentMode()
105+
boolean developmentMode = developmentMode
105106
Environment env = Environment.current
106107

107-
boolean enableReload = env.isReloadEnabled() ||
108+
boolean enableReload = env.reloadEnabled ||
108109
config.getProperty(GroovyPagesTemplateEngine.CONFIG_PROPERTY_GSP_ENABLE_RELOAD, Boolean, false) ||
109110
(developmentMode && env == Environment.DEVELOPMENT)
110111

@@ -134,7 +135,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
134135
// as oppose to in WAR deployment where views are loaded from /WEB-INF
135136

136137
if (viewsDir) {
137-
log.info "Configuring GSP views directory as '${viewsDir}'"
138+
log.info("Configuring GSP views directory as '${}'", viewsDir)
138139
customResourceLoader = true
139140
groovyPageResourceLoader(GroovyPageResourceLoader) {
140141
baseResource = "file:${viewsDir}"
@@ -158,7 +159,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
158159
}
159160
}
160161

161-
def deployed = !Metadata.getCurrent().isDevelopmentEnvironmentAvailable()
162+
def deployed = !Metadata.current.developmentEnvironmentAvailable
162163
groovyPageLocator(CachingGrailsConventionGroovyPageLocator) { bean ->
163164
bean.lazyInit = true
164165
if (customResourceLoader) {
@@ -187,15 +188,15 @@ class GroovyPagesGrailsPlugin extends Plugin {
187188
}
188189

189190
grailsResourceLocator(CachingGroovyPageStaticResourceLocator) { bean ->
190-
bean.parent = "abstractGrailsResourceLocator"
191+
bean.parent = 'abstractGrailsResourceLocator'
191192
if (enableReload) {
192193
cacheTimeout = gspCacheTimeout
193194
}
194195
}
195196

196197
// Setup the main templateEngine used to render GSPs
197198
groovyPagesTemplateEngine(GroovyPagesTemplateEngine) {
198-
classLoader = ref("classLoader")
199+
classLoader = ref('classLoader')
199200
groovyPageLocator = groovyPageLocator
200201
if (enableReload) {
201202
reloadEnabled = enableReload
@@ -209,7 +210,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
209210

210211
spring.addAlias('groovyTemplateEngine', 'groovyPagesTemplateEngine')
211212

212-
groovyPageRenderer(PageRenderer, ref("groovyPagesTemplateEngine")) { bean ->
213+
groovyPageRenderer(PageRenderer, ref('groovyPagesTemplateEngine')) { bean ->
213214
bean.lazyInit = true
214215
groovyPageLocator = groovyPageLocator
215216
}
@@ -227,7 +228,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
227228
}
228229

229230
boolean jstlPresent = ClassUtils.isPresent(
230-
"jakarta.servlet.jsp.jstl.core.Config", InternalResourceViewResolver.class.getClassLoader())
231+
'jakarta.servlet.jsp.jstl.core.Config', InternalResourceViewResolver.class.classLoader)
231232

232233
abstractViewResolver {
233234
prefix = GrailsApplicationAttributes.PATH_TO_VIEWS
@@ -242,7 +243,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
242243
// Configure a Spring MVC view resolver
243244
jspViewResolver(GroovyPageViewResolver) { bean ->
244245
bean.lazyInit = true
245-
bean.parent = "abstractViewResolver"
246+
bean.parent = 'abstractViewResolver'
246247
}
247248

248249
// Now go through tag libraries and configure them in Spring too. With AOP proxies and so on
@@ -262,9 +263,9 @@ class GroovyPagesGrailsPlugin extends Plugin {
262263
errorsViewStackTracePrinter(ErrorsViewStackTracePrinter, ref('grailsResourceLocator'))
263264
filteringCodecsByContentTypeSettings(FilteringCodecsByContentTypeSettings, application)
264265

265-
groovyPagesServlet(ServletRegistrationBean, new GroovyPagesServlet(), "*.gsp") {
266-
if (Environment.isDevelopmentMode()) {
267-
initParameters = [showSource: "1"]
266+
groovyPagesServlet(ServletRegistrationBean, new GroovyPagesServlet(), '*.gsp') {
267+
if (Environment.developmentMode) {
268+
initParameters = [showSource: '1']
268269
}
269270
}
270271

@@ -273,7 +274,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
273274
}
274275

275276
protected boolean isDevelopmentMode() {
276-
Metadata.getCurrent().isDevelopmentEnvironmentAvailable()
277+
Metadata.current.developmentEnvironmentAvailable
277278
}
278279

279280
static String transformToValidLocation(String location) {
@@ -298,7 +299,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
298299
}
299300
}
300301

301-
// The tag library lookup class caches "tag -> taglib class"
302+
// The tag library lookup class caches 'tag -> taglib class'
302303
// so we need to update it now.
303304
def lookup = applicationContext.getBean('gspTagLibraryLookup', TagLibraryLookup)
304305
lookup.registerTagLib(taglibClass)

grails-gsp/plugin/src/test/groovy/org/grails/web/mapping/RestfulReverseUrlRenderingTests.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class RestfulReverseUrlRenderingTests extends Specification implements UrlMappin
6262
@Artefact('UrlMappings')
6363
class RestfulReverseUrlMappings {
6464
static mappings = {
65-
"/car" (controller: "restfulCar", action: [GET: "create", POST: "save"])
65+
'/car' (controller: 'restfulCar', action: [GET: 'create', POST: 'save'])
6666
}
6767
}
6868

69-
@Artefact("Controller")
69+
@Artefact('Controller')
7070
class RestfulCarController {
7171
def create = {}
7272
def save = {}

0 commit comments

Comments
 (0)