Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 2 additions & 5 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ name: "JMH Benchmark Comparison"
# to that code through a privileged pull_request_target workflow.
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
paths-ignore:
- '**/*.md'
- '**/*.adoc'
- 'grails-doc/**'
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}-${{ github.event.action == 'labeled' && github.event.label.name != 'performance' && github.run_id || 'benchmark' }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ on:
branches:
- '[0-9]+.[0-9]+.x'
pull_request:
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
workflow_dispatch:
# queue jobs and only allow 1 run per branch due to the likelihood of hitting GitHub resource limits
concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeanalysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ on:
- '[0-9]+.[0-9]+.x'
- '8.0.x-hibernate7.*'
pull_request:
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
workflow_dispatch:
# queue jobs and only allow 1 run per branch due to the likelihood of hitting GitHub resource limits
concurrency:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ on:
- '[4-9]+.[0-9]+.x'
- '8.0.x-hibernate7.*'
pull_request:
# The branches below must be a subset of the branches above
branches:
- '[4-9]+.[0-9]+.x'
- '8.0.x-hibernate7.*'
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
# queue jobs and only allow 1 run per branch due to the likelihood of hitting GitHub resource limits
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ on:
- '[0-9]+.[0-9]+.x'
- '8.0.x-hibernate7.*'
pull_request:
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
workflow_dispatch:
# queue jobs and only allow 1 run per branch due to the likelihood of hitting GitHub resource limits
concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ on:
- '[0-9]+.[0-9]+.x'
- '8.0.x-hibernate7.*'
pull_request:
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
workflow_dispatch:

concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ on:
branches:
- '[0-9]+.[0-9]+.x'
pull_request:
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ on:
branches:
- '[0-9]+.[0-9]+.x'
pull_request:
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
workflow_dispatch:
# Queue jobs - cancel in-progress PR runs when new commits pushed, but allow branch builds to complete
concurrency:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/groovy-snapshot-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ on:
branches:
- '[0-9]+.[0-9]+.x'
pull_request:
branches:
- '[0-9]+.[0-9]+.x'
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
workflow_dispatch:
# queue jobs and only allow 1 run per branch due to the likelihood of hitting GitHub resource limits
concurrency:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/rat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ on:
- '[0-9]+.[0-9]+.x'
- '8.0.x-hibernate7.*'
pull_request:
branches:
- '[0-9]+.[0-9]+.x'
- '8.0.x-hibernate7.*'
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
workflow_dispatch:
# queue jobs and only allow 1 run per branch due to the likelihood of hitting GitHub resource limits
concurrency:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/sitemesh2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ on:
- 'grails-dependencies/**'
- '.github/workflows/sitemesh2.yml'
pull_request:
paths:
- 'grails-gsp/**'
- 'grails-test-suite-uber/**'
- 'grails-test-examples/**'
- 'grails-dependencies/**'
- '.github/workflows/sitemesh2.yml'
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
# Queue jobs - cancel in-progress PR runs when new commits pushed, but allow branch builds to complete
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/validate-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ on:
- 'build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/ValidateActionsTask.groovy'
- 'build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsValidateActionsPlugin.groovy'
pull_request:
paths:
- '.github/workflows/**'
- 'build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/ValidateActionsTask.groovy'
- 'build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsValidateActionsPlugin.groovy'
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
schedule:
- cron: '0 6 * * 1' # weekly Monday 06:00 UTC — catches ASF delisting a pinned SHA
workflow_dispatch:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/vulnerability-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ on:
# Opt in per pull request by applying the "vulnerability scan" label. Applying a label
# requires write access, so only a committer can start a scan.
pull_request:
types: [labeled, synchronize, reopened]
# CHANGEME FOR ACCEPTANCE: PR triggers disabled on this stacked branch; revert before merge
branches: ['CHANGEME-FOR-ACCEPTANCE']
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class StringEscapeCategory {
private StringEscapeCategory() {
}

public static String encodeAsUrlPath(String str) {
static String encodeAsUrlPath(String str) {
try {
String uri = new URI('http', 'localhost', '/' + str, '').toASCIIString()
return uri.substring(17, uri.length() - 1)
Expand All @@ -38,7 +38,7 @@ class StringEscapeCategory {
}
}

public static String encodeAsUrlFragment(String str) {
static String encodeAsUrlFragment(String str) {
try {
String uri = new URI('http', 'localhost', '/', str).toASCIIString()
return uri.substring(18, uri.length())
Expand All @@ -48,7 +48,7 @@ class StringEscapeCategory {
}
}

public static String encodeAsHtml(String str) {
static String encodeAsHtml(String str) {
return StringEscapeUtils.escapeHtml4(str)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ class CollectionUtils {
* @return The child map
*/
static Map getOrCreateChildMap(Map parent, String key) {
Object o = parent.get(key)
Object o = parent[key]
if (o instanceof Map) {
return (Map) o
return o
}
return new LinkedHashMap()
return [:]
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class GrailsNameUtils {
* @param cls The class name
*/
static String getFullClassName(Class cls) {
String className = cls.getName()
String className = cls.name

return getFullClassName(className)
}
Expand Down Expand Up @@ -126,7 +126,7 @@ class GrailsNameUtils {
* @return The property name representation
*/
static String getClassNameRepresentation(String name) {
if (name == null || name.length() == 0) {
if (name == null || name.isEmpty()) {
return ''
}

Expand All @@ -136,9 +136,9 @@ class GrailsNameUtils {
String token = token1.trim()
int length = token.length()
if (length > 0) {
buf.append(token.substring(0, 1).toUpperCase(Locale.ENGLISH))
buf << token.substring(0, 1).toUpperCase(Locale.ENGLISH)
if (length > 1) {
buf.append(token.substring(1))
buf << token.substring(1)
}
}
}
Expand All @@ -163,9 +163,8 @@ class GrailsNameUtils {
StringBuilder buf = new StringBuilder()
String[] tokens = name.split('-')
for (String token in tokens) {
if (token == null || token.length() == 0) continue
buf.append(token.substring(0, 1).toUpperCase())
.append(token.substring(1))
if (token == null || token.isEmpty()) continue
buf << token.substring(0, 1).toUpperCase() << token.substring(1)
}
return buf.toString()
}
Expand All @@ -179,7 +178,7 @@ class GrailsNameUtils {
* @return The logical class name
*/
static String getLogicalName(Class<?> clazz, String trailingName) {
return getLogicalName(clazz.getName(), trailingName)
return getLogicalName(clazz.name, trailingName)
}

/**
Expand Down Expand Up @@ -285,7 +284,7 @@ class GrailsNameUtils {
* @return The short name of the class
*/
static String getShortName(Class<?> targetClass) {
return getShortName(targetClass.getName())
return getShortName(targetClass.name)
}

/**
Expand Down Expand Up @@ -325,7 +324,7 @@ class GrailsNameUtils {
* @return The script name representation
*/
static String getScriptName(Class<?> clazz) {
return clazz == null ? null : getScriptName(clazz.getName())
return clazz == null ? null : getScriptName(clazz.name)
}

/**
Expand Down Expand Up @@ -368,7 +367,7 @@ class GrailsNameUtils {
* not valid, i.e. if it doesn't end with "GrailsPlugin.groovy".
*/
static String getPluginName(String descriptorName) {
if (descriptorName == null || descriptorName.length() == 0) {
if (descriptorName == null || descriptorName.isEmpty()) {
return descriptorName
}

Expand Down Expand Up @@ -401,7 +400,7 @@ class GrailsNameUtils {
}

if (Character.isLowerCase(c) || Character.isDigit(c)) {
if (Character.isLowerCase(c) && w.length() == 0) {
if (Character.isLowerCase(c) && w.isEmpty()) {
c = Character.toUpperCase(c)
}
else if (w.length() > 1 && Character.isUpperCase(w.charAt(w.length() - 1))) {
Expand All @@ -412,7 +411,7 @@ class GrailsNameUtils {
words.set(i, w + c)
}
else if (Character.isUpperCase(c)) {
if ((i == 0 && w.length() == 0) || (Character.isUpperCase(w.charAt(w.length() - 1)) && Character.isUpperCase(chars[j - 1]))) {
if ((i == 0 && w.isEmpty()) || (Character.isUpperCase(w.charAt(w.length() - 1)) && Character.isUpperCase(chars[j - 1]))) {
words.set(i, w + c)
}
else {
Expand All @@ -424,9 +423,9 @@ class GrailsNameUtils {
StringBuilder buf = new StringBuilder()
for (Iterator<String> j = words.iterator(); j.hasNext();) {
String word = j.next()
buf.append(word)
buf << word
if (j.hasNext()) {
buf.append(' ')
buf << ' '
}
}
return buf.toString()
Expand All @@ -445,7 +444,7 @@ class GrailsNameUtils {
* blank.
*/
static boolean isBlank(String str) {
return str == null || str.trim().length() == 0
return str == null || str.trim().isEmpty()
}

/**
Expand Down Expand Up @@ -508,12 +507,12 @@ class GrailsNameUtils {
static String getPropertyNameConvention(Object object, String suffix) {
if (object != null) {
Class<?> type = object.getClass()
if (type.isArray()) {
return getPropertyName(type.getComponentType()) + suffix + 'Array'
if (type.array) {
return getPropertyName(type.componentType) + suffix + 'Array'
}

if (object instanceof Collection) {
Collection coll = (Collection) object
Collection coll = object
if (coll.isEmpty()) {
return 'emptyCollection'
}
Expand All @@ -529,7 +528,7 @@ class GrailsNameUtils {
}

if (object instanceof Map) {
Map map = (Map) object
Map map = object

if (map.isEmpty()) {
return 'emptyMap'
Expand Down Expand Up @@ -567,7 +566,7 @@ class GrailsNameUtils {
* @return The property name equivalent
*/
static String getPropertyForGetter(String getterName, Class returnType) {
return getPropertyForGetter(getterName, returnType.getName())
return getPropertyForGetter(getterName, returnType.name)
}

/**
Expand All @@ -579,13 +578,13 @@ class GrailsNameUtils {
* @return The property name equivalent
*/
static String getPropertyForGetter(String getterName, String returnType) {
if (getterName == null || getterName.length() == 0) return null
if (getterName == null || getterName.isEmpty()) return null

if (getterName.startsWith('get')) {
String prop = getterName.substring(3)
return convertValidPropertyMethodSuffix(prop)
}
if (getterName.startsWith('is') && returnType.equals('boolean')) {
if (getterName.startsWith('is') && returnType == 'boolean') {
String prop = getterName.substring(2)
return convertValidPropertyMethodSuffix(prop)
}
Expand All @@ -600,7 +599,7 @@ class GrailsNameUtils {
* @return The property name or null
*/
static String convertValidPropertyMethodSuffix(String suffix) {
if (suffix.length() == 0) return null
if (suffix.isEmpty()) return null

// We assume all characters are Character.isJavaIdentifierPart, but the first one may not be a valid
// starting character.
Expand Down Expand Up @@ -646,7 +645,7 @@ class GrailsNameUtils {
* @return true if it is a javabean property getter
*/
static boolean isGetter(String name, Class returnType, Class<?>[] args) {
if (name == null || name.length() == 0 || args == null) return false
if (name == null || name.isEmpty() || args == null) return false
if (args.length != 0) return false

if (name.startsWith('get')) {
Expand Down Expand Up @@ -701,7 +700,7 @@ class GrailsNameUtils {
* @return true if suffix indicates a property name
*/
protected static boolean isPropertyMethodSuffix(String suffix) {
if (suffix.length() == 0) return false
if (suffix.isEmpty()) return false
if (!Character.isJavaIdentifierStart(suffix.charAt(0))) return false
if (suffix.length() == 1) return Character.isUpperCase(suffix.charAt(0))
return Character.isUpperCase(suffix.charAt(0)) || Character.isUpperCase(suffix.charAt(1))
Expand All @@ -715,7 +714,7 @@ class GrailsNameUtils {
* @return The property name equivalent
*/
static String getPropertyForSetter(String setterName) {
if (setterName == null || setterName.length() == 0) return null
if (setterName == null || setterName.isEmpty()) return null

if (setterName.startsWith('set')) {
String prop = setterName.substring(3)
Expand Down
Loading