diff --git a/build.gradle b/build.gradle index c08a2f2fcd8..7b67e1242cc 100644 --- a/build.gradle +++ b/build.gradle @@ -500,6 +500,8 @@ subprojects { project -> testImplementation "org.junit.platform:junit-platform-runner:1.10.2" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.2" + compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.6' + if (project.name != "grails-docs") { // Logging api "org.slf4j:slf4j-api:$slf4jVersion" diff --git a/gradle/integration-test.gradle b/gradle/integration-test.gradle index 67bd14e961a..f0170b7cdcc 100644 --- a/gradle/integration-test.gradle +++ b/gradle/integration-test.gradle @@ -21,7 +21,7 @@ dependencies { task integrationTest(type: Test) { testClassesDirs = sourceSets.integrationTest.output.classesDirs classpath = sourceSets.integrationTest.runtimeClasspath - reports.html.enabled = false + reports.html.getRequired().set(false) } // Make sure 'check' task calls integration test @@ -29,7 +29,7 @@ check.dependsOn integrationTest // Merge test reports task mergeTestReports(type: TestReport) { - destinationDir = file("$buildDir/reports/tests") + destinationDirectory = file("$buildDir/reports/tests") // These must point to the binary test results directory generated by a Test task instance. // If Test task instances are specified directly, this task would depend on them and run them. diff --git a/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java b/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java index f169490fa39..13cb17dbe9e 100644 --- a/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java +++ b/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java @@ -67,7 +67,7 @@ public class GrailsConsole implements ConsoleLogger { public static final String HISTORYFILE = ".grails_history"; public static final String STACKTRACE_FILTERED_MESSAGE = " (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)"; public static final String STACKTRACE_MESSAGE = " (Use --stacktrace to see the full trace)"; - public static final Character SECURE_MASK_CHAR = new Character('*'); + public static final Character SECURE_MASK_CHAR = Character.valueOf('*'); private PrintStream originalSystemOut; private PrintStream originalSystemErr; private StringBuilder maxIndicatorString; diff --git a/grails-test-suite-uber/src/test/groovy/org/grails/commons/GrailsClassUtilsTests.java b/grails-test-suite-uber/src/test/groovy/org/grails/commons/GrailsClassUtilsTests.java index a5771596090..d3870fd5925 100644 --- a/grails-test-suite-uber/src/test/groovy/org/grails/commons/GrailsClassUtilsTests.java +++ b/grails-test-suite-uber/src/test/groovy/org/grails/commons/GrailsClassUtilsTests.java @@ -377,21 +377,21 @@ public void testIsAssignableOrConvertibleFrom() { @Test public void testIsPropertyGetter() throws Exception { - assertTrue(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("getName", null))); - assertFalse(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("setName", null))); - assertFalse(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("getSurname", null))); - assertFalse(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("getNewYear", null))); + assertTrue(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("getName"))); + assertFalse(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("setName"))); + assertFalse(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("getSurname"))); + assertFalse(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("getNewYear"))); assertFalse(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("getFilename", String.class))); - assertFalse(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("getTitle", null))); + assertFalse(GrailsClassUtils.isPropertyGetter(ClassHavingPropertyGetters.class.getDeclaredMethod("getTitle"))); } @Test @Issue("https://github.com/grails/grails-core/issues/10343") public void testPropertiesBeginningWithSingleLowerCaseLetter() throws Exception { - assertTrue(GrailsClassUtils.isPropertyGetter(SomeGroovyClass.class.getDeclaredMethod("getaString", null))); - assertTrue(GrailsClassUtils.isPropertyGetter(SomeGroovyClass.class.getDeclaredMethod("isaBoolean", null))); - assertTrue(GrailsClassUtils.isPropertyGetter(SomeGroovyClass.class.getDeclaredMethod("getS", null))); - assertTrue(GrailsClassUtils.isPropertyGetter(SomeGroovyClass.class.getDeclaredMethod("isB", null))); + assertTrue(GrailsClassUtils.isPropertyGetter(SomeGroovyClass.class.getDeclaredMethod("getaString"))); + assertTrue(GrailsClassUtils.isPropertyGetter(SomeGroovyClass.class.getDeclaredMethod("isaBoolean"))); + assertTrue(GrailsClassUtils.isPropertyGetter(SomeGroovyClass.class.getDeclaredMethod("getS"))); + assertTrue(GrailsClassUtils.isPropertyGetter(SomeGroovyClass.class.getDeclaredMethod("isB"))); } } diff --git a/grails-web-common/src/main/groovy/grails/web/servlet/mvc/GrailsHttpSession.java b/grails-web-common/src/main/groovy/grails/web/servlet/mvc/GrailsHttpSession.java index 7f346f5cf64..2a6d47a64cb 100644 --- a/grails-web-common/src/main/groovy/grails/web/servlet/mvc/GrailsHttpSession.java +++ b/grails-web-common/src/main/groovy/grails/web/servlet/mvc/GrailsHttpSession.java @@ -168,7 +168,7 @@ public void putValue(String name, Object value) { */ /** - * @see jakarta.servlet.http.HttpSession#removeValue(java.lang.String) + * @see jakarta.servlet.http.HttpSession * @deprecated */ /* @@ -184,6 +184,7 @@ public void removeValue(String name) { /* (non-Javadoc) * @see jakarta.servlet.http.HttpSession#invalidate() */ + @Deprecated public void invalidate() { createSessionIfNecessary(); synchronized (this) { diff --git a/grails-web-common/src/main/groovy/org/grails/web/json/parser/JSONParser.java b/grails-web-common/src/main/groovy/org/grails/web/json/parser/JSONParser.java index ed291bbfe87..529105ea43e 100644 --- a/grails-web-common/src/main/groovy/org/grails/web/json/parser/JSONParser.java +++ b/grails-web-common/src/main/groovy/org/grails/web/json/parser/JSONParser.java @@ -255,9 +255,9 @@ final private Object JsonNumber() throws ParseException { // See if the number fits in an integer, or long // Use BigInteger only if it is big enough. if (intpart.length() < 10) { - n = new Integer(intpart); + n = Integer.valueOf(intpart); } else if (intpart.length() < 19) { - n = new Long(intpart); + n = Long.valueOf(intpart); } else { n = new java.math.BigInteger(intpart); } diff --git a/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java b/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java index ef86bdf7b19..06d3ac854f0 100644 --- a/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java +++ b/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java @@ -240,7 +240,7 @@ public static void cleanupIncludeRequestAttributes(HttpServletRequest request, M } /** - * Expose the current request URI and paths as {@link javax.servlet.http.HttpServletRequest} + * Expose the current request URI and paths as {@link jakarta.servlet.http.HttpServletRequest} * attributes under the keys defined in the Servlet 2.4 specification, * for containers that implement 2.3 or an earlier version of the Servlet API: * javax.servlet.forward.request_uri,