Skip to content

Ensure ExpiringMap.shutdown() always runs in tests via try/finally#2820

Merged
tastybento merged 4 commits intofix/sonar-pr2-code-stylefrom
copilot/sub-pr-2812-another-one
Mar 3, 2026
Merged

Ensure ExpiringMap.shutdown() always runs in tests via try/finally#2820
tastybento merged 4 commits intofix/sonar-pr2-code-stylefrom
copilot/sub-pr-2812-another-one

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

  • Wrap all local ExpiringMap other instances in try/finally so shutdown() is always called, even if assertions fail
  • Fix malformed try blocks in testNotEqualsDifferentEntries and testNotEqualsDifferentValues that caused compilation errors

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…always runs

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 2, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • ci.mg-dev.eu
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country (dns block)
  • maven.devs.beer
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country (dns block)
  • mvn.lumine.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country (dns block)
  • piston-meta.mojang.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country (dns block)
  • repo.clojars.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country (dns block)
  • repo.extendedclip.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country (dns block)
  • repo.pyr.lol
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Address feedback on SonarCloud code style fixes for lambdas Ensure ExpiringMap.shutdown() always runs in tests via try/finally Mar 2, 2026
@tastybento tastybento marked this pull request as ready for review March 3, 2026 04:31
@tastybento
Copy link
Member

@copilot FAILURE: Build failed with an exception.
[Incubating] Problems report is available at: file:///home/runner/work/BentoBox/BentoBox/build/reports/problems/problems-report.html

  • What went wrong:
    Execution failed for task ':compileTestJava'.

Compilation failed; see the compiler output below.
/home/runner/work/BentoBox/BentoBox/src/test/java/world/bentobox/bentobox/util/ExpiringMapTest.java:151: error: reached end of file while parsing
}
^
/home/runner/work/BentoBox/BentoBox/src/test/java/world/bentobox/bentobox/util/ExpiringMapTest.java:83: error: 'try' without 'catch', 'finally' or resource declarations
try {
^
/home/runner/work/BentoBox/BentoBox/src/test/java/world/bentobox/bentobox/util/ExpiringMapTest.java:98: error: 'try' without 'catch', 'finally' or resource declarations
try {
^

/home/runner/work/BentoBox/BentoBox/src/test/java/world/bentobox/bentobox/util/ExpiringMapTest.java:94: error: ';' expected
void testNotEqualsDifferentValues() {
^
/home/runner/work/BentoBox/BentoBox/src/test/java/world/bentobox/bentobox/util/ExpiringMapTest.java:109: error: ';' expected
void testNotEqualsNull() {
^
/home/runner/work/BentoBox/BentoBox/src/test/java/world/bentobox/bentobox/util/ExpiringMapTest.java:114: error: ';' expected
void testNotEqualsNonMap() {
^
/home/runner/work/BentoBox/BentoBox/src/test/java/world/bentobox/bentobox/util/ExpiringMapTest.java:119: error: ';' expected
void testHashCodeConsistentWithEquals() {
^
/home/runner/work/BentoBox/BentoBox/src/test/java/world/bentobox/bentobox/util/ExpiringMapTest.java:136: error: ';' expected
void testHashCodeMatchesHashMap() {
^
/home/runner/work/BentoBox/BentoBox/src/test/java/world/bentobox/bentobox/util/ExpiringMapTest.java:148: error: ';' expected
void testEmptyMapHashCode() {
^
9 errors

… testNotEqualsDifferentValues

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot FAILURE: Build failed with an exception.
[Incubating] Problems report is available at: file:///home/runner/work/BentoBox/BentoBox/build/reports/problems/problems-report.htm...

Fixed in ecb6bcc. The previous edit had incorrectly placed the other.put(...) calls inside an unclosed try block, creating nested try statements without matching finally/catch. Both testNotEqualsDifferentEntries and testNotEqualsDifferentValues now have the correct structure.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2026

@tastybento tastybento merged commit a198d0f into fix/sonar-pr2-code-style Mar 3, 2026
3 checks passed
@tastybento tastybento deleted the copilot/sub-pr-2812-another-one branch March 3, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants