You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/07/06 14:00:31 UTC

(commons-bcel) 02/02: Bump org.apache.commons:commons-parent from 79 to 85

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit a744541f93e46f5bc326c9586bb177dd1ed3a8a1
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Sun Jul 6 10:00:25 2025 -0400

    Bump org.apache.commons:commons-parent from 79 to 85
    
    - Fix [ERROR] Medium: Operation on the "created" shared variable in
    "ConstantUtf8" class is not atomic
    [org.apache.bcel.classfile.ConstantUtf8] At ConstantUtf8.java:[line 119]
    AT_NONATOMIC_OPERATIONS_ON_SHARED_VARIABLE
    - Fix [ERROR] Medium: Operation on the "considered" shared variable in
    "ConstantUtf8" class is not atomic
    [org.apache.bcel.classfile.ConstantUtf8] At ConstantUtf8.java:[line 137]
    AT_NONATOMIC_OPERATIONS_ON_SHARED_VARIABLE
    - Fix [ERROR] Medium: Operation on the "skipped" shared variable in
    "ConstantUtf8" class is not atomic
    [org.apache.bcel.classfile.ConstantUtf8] At ConstantUtf8.java:[line 134]
    AT_NONATOMIC_OPERATIONS_ON_SHARED_VARIABLE
    - Update test for JUnit's junit-platform-commons-1.13.1
---
 .github/workflows/maven.yml                               |  2 +-
 pom.xml                                                   |  2 +-
 src/changes/changes.xml                                   |  5 ++++-
 src/main/java/org/apache/bcel/classfile/ConstantUtf8.java |  4 ++--
 .../bcel/classfile/ConstantPoolModuleAccessTest.java      | 15 +++++++++++----
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index b503f5ff..8605c0ef 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -56,4 +56,4 @@ jobs:
         distribution: 'temurin'
         java-version: ${{ matrix.java }}
     - name: Build with Maven
-      run: mvn --errors --show-version --batch-mode --no-transfer-progress -DtrimStackTrace=false
+      run: mvn --errors --show-version --batch-mode --no-transfer-progress -DtrimStackTrace=false -Ddoclint=none
diff --git a/pom.xml b/pom.xml
index 788ee5f5..c0257196 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.commons</groupId>
     <artifactId>commons-parent</artifactId>
-    <version>79</version>
+    <version>85</version>
   </parent>
   <groupId>org.apache.bcel</groupId>
   <artifactId>bcel</artifactId>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5556f5d1..b85d1755 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,13 +65,16 @@ The <action> type attribute can be add,update,fix,remove.
       <action issue="BCEL-375" type="fix" dev="ggregory" due-to="J. Lewis Muir, Gary Gregory">Wrong permissions on bcel .jar file in binary .tar.gz distribution file.</action>
       <action issue="BCEL-376" type="fix" dev="ggregory" due-to="Dominik Stadler, Gary Gregory">ClassPath.close() throws UnsupportedOperationException when created with system-classpath.</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">ClassPath.getResources(String) can use an ArrayList instead of a Vector.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs [ERROR] Medium: Operation on the "created" shared variable in "ConstantUtf8" class is not atomic [org.apache.bcel.classfile.ConstantUtf8] At ConstantUtf8.java:[line 119] AT_NONATOMIC_OPERATIONS_ON_SHARED_VARIABLE.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs [ERROR] Medium: Operation on the "considered" shared variable in "ConstantUtf8" class is not atomic [org.apache.bcel.classfile.ConstantUtf8] At ConstantUtf8.java:[line 137] AT_NONATOMIC_OPERATIONS_ON_SHARED_VARIABLE.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs [ERROR] Medium: Operation on the "skipped" shared variable in "ConstantUtf8" class is not atomic [org.apache.bcel.classfile.ConstantUtf8] At ConstantUtf8.java:[line 134] AT_NONATOMIC_OPERATIONS_ON_SHARED_VARIABLE.</action>      
       <!-- ADD -->
       <action                  type="update" dev="ggregory" due-to="Gary Gregory">Add Const.MAJOR_25.</action>
       <action                  type="update" dev="ggregory" due-to="Gary Gregory">Add Const.MINOR_25.</action>
       <!-- UPDATE -->
       <action                  type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #334, #341, #351.</action>
       <action                  type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump org.jetbrains.kotlin:kotlin-stdlib from 2.0.0 to 2.2.0 #340, #347, #369, #390, #407, #422, #434, #441.</action>
-      <action                  type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump org.apache.commons:commons-parent from 72 to 79 #346, #349, #559, #364, #368, #378.</action>
+      <action                  type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump org.apache.commons:commons-parent from 72 to 85 #346, #349, #559, #364, #368, #378.</action>
       <action                  type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump commons-io:commons-io from 2.16.1 to 2.19.0 #357, #387.</action>
       <action                  type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump jna.version from 5.14.0 to 5.17.0 #358, #399.</action>
       <action                  type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump org.codehaus.mojo:taglist-maven-plugin from 3.1.0 to 3.2.1 #376.</action>
diff --git a/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java b/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java
index 559511f4..0e56ce03 100644
--- a/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java
+++ b/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java
@@ -115,7 +115,7 @@ public final class ConstantUtf8 extends Constant {
     }
 
     // Avoid Spotbugs complaint about Write to static field
-    private static void countCreated() {
+    private static synchronized void countCreated() {
         created++;
     }
 
@@ -129,7 +129,7 @@ public final class ConstantUtf8 extends Constant {
      * @return a new or cached instance of the given value.
      * @since 6.0
      */
-    public static ConstantUtf8 getCachedInstance(final String value) {
+    public static synchronized ConstantUtf8 getCachedInstance(final String value) {
         if (value.length() > Cache.MAX_ENTRY_SIZE) {
             skipped++;
             return new ConstantUtf8(value);
diff --git a/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleAccessTest.java b/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleAccessTest.java
index 9347cfbd..f24bec85 100644
--- a/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleAccessTest.java
+++ b/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleAccessTest.java
@@ -29,6 +29,8 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
 import java.util.stream.Stream;
 
 import org.apache.bcel.Const;
@@ -74,6 +76,10 @@ public final class ConstantPoolModuleAccessTest {
                         expected.add("org.junit.platform.launcher.PostDiscoveryFilter");
                         expected.add("org.junit.platform.launcher.TestExecutionListener");
                         assertEquals(expected, Arrays.asList(usedClassNames));
+                    } else if (urlPath.contains("junit-platform-common")) {
+                        final List<String> expected = new ArrayList<>();
+                        expected.add("org.junit.platform.commons.support.scanning.ClasspathScanner");
+                        assertEquals(expected, Arrays.asList(usedClassNames));
                     } else if (urlPath.contains("junit-platform-engine")) {
                         final List<String> expected = new ArrayList<>();
                         expected.add("org.junit.platform.engine.discovery.DiscoverySelectorIdentifierParser");
@@ -264,7 +270,7 @@ public final class ConstantPoolModuleAccessTest {
                         expected.add("jdk.internal.netscape.javascript.spi.JSObjectProvider");
                         assertEquals(expected, Arrays.asList(usedClassNames));
                     } else {
-                        assertEquals(0, usedClassNames.length, "Found " + Arrays.toString(usedClassNames) + " in " + urlPath);
+                        assertEquals(0, usedClassNames.length, () -> "Found " + Arrays.toString(usedClassNames) + " in " + urlPath);
                     }
                     super.visitModule(obj);
                 }
@@ -275,7 +281,7 @@ public final class ConstantPoolModuleAccessTest {
                     final String packageName = obj.getPackageName(constantPool);
                     final String[] toModuleNames = obj.getToModuleNames(constantPool);
                     if (url.getPath().contains("junit-platform-commons")) {
-                        final List<String> expected = new ArrayList<>();
+                        final Set<String> expected = new TreeSet<>();
                         expected.add("org.junit.jupiter.api");
                         expected.add("org.junit.jupiter.engine");
                         expected.add("org.junit.jupiter.migrationsupport");
@@ -292,13 +298,14 @@ public final class ConstantPoolModuleAccessTest {
                             expected.add("org.junit.platform.suite.engine");
                             expected.add("org.junit.platform.testkit");
                             expected.add("org.junit.vintage.engine");
-                            assertEquals(expected, Arrays.asList(toModuleNames));
+                            expected.add("org.junit.platform.jfr");
+                            assertEquals(expected, new TreeSet<>(Arrays.asList(toModuleNames)));
                             break;
                         case "org.junit.platform.commons.logging":
                             expected.add("org.junit.platform.suite.engine");
                             expected.add("org.junit.platform.testkit");
                             expected.add("org.junit.vintage.engine");
-                            assertEquals(expected, Arrays.asList(toModuleNames));
+                            assertEquals(expected, new TreeSet<>(Arrays.asList(toModuleNames)));
                             break;
                         default:
                             assertEquals(0, toModuleNames.length);