Skip to content

Commit a744541

Browse files
committed
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
1 parent 5824eae commit a744541

5 files changed

Lines changed: 19 additions & 9 deletions

File tree

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ jobs:
5656
distribution: 'temurin'
5757
java-version: ${{ matrix.java }}
5858
- name: Build with Maven
59-
run: mvn --errors --show-version --batch-mode --no-transfer-progress -DtrimStackTrace=false
59+
run: mvn --errors --show-version --batch-mode --no-transfer-progress -DtrimStackTrace=false -Ddoclint=none

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<parent>
2626
<groupId>org.apache.commons</groupId>
2727
<artifactId>commons-parent</artifactId>
28-
<version>79</version>
28+
<version>85</version>
2929
</parent>
3030
<groupId>org.apache.bcel</groupId>
3131
<artifactId>bcel</artifactId>

src/changes/changes.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,16 @@ The <action> type attribute can be add,update,fix,remove.
6565
<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>
6666
<action issue="BCEL-376" type="fix" dev="ggregory" due-to="Dominik Stadler, Gary Gregory">ClassPath.close() throws UnsupportedOperationException when created with system-classpath.</action>
6767
<action type="fix" dev="ggregory" due-to="Gary Gregory">ClassPath.getResources(String) can use an ArrayList instead of a Vector.</action>
68+
<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>
69+
<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>
70+
<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>
6871
<!-- ADD -->
6972
<action type="update" dev="ggregory" due-to="Gary Gregory">Add Const.MAJOR_25.</action>
7073
<action type="update" dev="ggregory" due-to="Gary Gregory">Add Const.MINOR_25.</action>
7174
<!-- UPDATE -->
7275
<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>
7376
<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>
74-
<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>
77+
<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>
7578
<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>
7679
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump jna.version from 5.14.0 to 5.17.0 #358, #399.</action>
7780
<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>

src/main/java/org/apache/bcel/classfile/ConstantUtf8.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static synchronized void clearStats() {
115115
}
116116

117117
// Avoid Spotbugs complaint about Write to static field
118-
private static void countCreated() {
118+
private static synchronized void countCreated() {
119119
created++;
120120
}
121121

@@ -129,7 +129,7 @@ private static void countCreated() {
129129
* @return a new or cached instance of the given value.
130130
* @since 6.0
131131
*/
132-
public static ConstantUtf8 getCachedInstance(final String value) {
132+
public static synchronized ConstantUtf8 getCachedInstance(final String value) {
133133
if (value.length() > Cache.MAX_ENTRY_SIZE) {
134134
skipped++;
135135
return new ConstantUtf8(value);

src/test/java/org/apache/bcel/classfile/ConstantPoolModuleAccessTest.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import java.util.HashMap;
3030
import java.util.List;
3131
import java.util.Map;
32+
import java.util.Set;
33+
import java.util.TreeSet;
3234
import java.util.stream.Stream;
3335

3436
import org.apache.bcel.Const;
@@ -74,6 +76,10 @@ public void visitModule(final Module obj) {
7476
expected.add("org.junit.platform.launcher.PostDiscoveryFilter");
7577
expected.add("org.junit.platform.launcher.TestExecutionListener");
7678
assertEquals(expected, Arrays.asList(usedClassNames));
79+
} else if (urlPath.contains("junit-platform-common")) {
80+
final List<String> expected = new ArrayList<>();
81+
expected.add("org.junit.platform.commons.support.scanning.ClasspathScanner");
82+
assertEquals(expected, Arrays.asList(usedClassNames));
7783
} else if (urlPath.contains("junit-platform-engine")) {
7884
final List<String> expected = new ArrayList<>();
7985
expected.add("org.junit.platform.engine.discovery.DiscoverySelectorIdentifierParser");
@@ -264,7 +270,7 @@ public void visitModule(final Module obj) {
264270
expected.add("jdk.internal.netscape.javascript.spi.JSObjectProvider");
265271
assertEquals(expected, Arrays.asList(usedClassNames));
266272
} else {
267-
assertEquals(0, usedClassNames.length, "Found " + Arrays.toString(usedClassNames) + " in " + urlPath);
273+
assertEquals(0, usedClassNames.length, () -> "Found " + Arrays.toString(usedClassNames) + " in " + urlPath);
268274
}
269275
super.visitModule(obj);
270276
}
@@ -275,7 +281,7 @@ public void visitModuleExports(final ModuleExports obj) {
275281
final String packageName = obj.getPackageName(constantPool);
276282
final String[] toModuleNames = obj.getToModuleNames(constantPool);
277283
if (url.getPath().contains("junit-platform-commons")) {
278-
final List<String> expected = new ArrayList<>();
284+
final Set<String> expected = new TreeSet<>();
279285
expected.add("org.junit.jupiter.api");
280286
expected.add("org.junit.jupiter.engine");
281287
expected.add("org.junit.jupiter.migrationsupport");
@@ -292,13 +298,14 @@ public void visitModuleExports(final ModuleExports obj) {
292298
expected.add("org.junit.platform.suite.engine");
293299
expected.add("org.junit.platform.testkit");
294300
expected.add("org.junit.vintage.engine");
295-
assertEquals(expected, Arrays.asList(toModuleNames));
301+
expected.add("org.junit.platform.jfr");
302+
assertEquals(expected, new TreeSet<>(Arrays.asList(toModuleNames)));
296303
break;
297304
case "org.junit.platform.commons.logging":
298305
expected.add("org.junit.platform.suite.engine");
299306
expected.add("org.junit.platform.testkit");
300307
expected.add("org.junit.vintage.engine");
301-
assertEquals(expected, Arrays.asList(toModuleNames));
308+
assertEquals(expected, new TreeSet<>(Arrays.asList(toModuleNames)));
302309
break;
303310
default:
304311
assertEquals(0, toModuleNames.length);

0 commit comments

Comments
 (0)