Skip to content

Commit dfc1ce0

Browse files
Update OSGiManifestIT not to depend on order. (#2965)
* Update `OSGiManifestIT` not to depend on order. It appears that sometimes the clauses being checked for appear in the other order, possibly because of a `HashMap` or the like somewhere in the guts of OSGi. I haven't seen this on GitHub, but I do see it when running locally with Google's JDK, which has more hash randomization. * Fix use of assignment expression. * Remove the parser, which was overkill. It's enough just to swap the two clauses of a line when they are not in the expected order. Also, unrelatedly, update `protobuf-maven-plugin`. * Update comments and undo an unnecessary split.
1 parent d437954 commit dfc1ce0

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

gson/src/test/java/com/google/gson/integration/OSGiManifestIT.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,12 @@ public void testImports() throws Exception {
130130
public void testExports() {
131131
String gsonVersion = GSON_VERSION.replace("-SNAPSHOT", "");
132132

133-
List<String> exports = splitPackages(getAttribute("Export-Package"));
133+
// Sometimes the `uses` and `exports` clauses can end up in the opposite order, so we use a
134+
// quick substitution to canonicalize them.
135+
List<String> exports =
136+
splitPackages(getAttribute("Export-Package")).stream()
137+
.map(line -> line.replaceAll("(;version=\".*\")(;uses:=\".*\")", "$2$1"))
138+
.collect(Collectors.toList());
134139
// When not running `mvn clean` the exports might differ slightly, see
135140
// https://github.com/bndtools/bnd/issues/6221
136141
assertWithMessage("Unexpected exports; make sure you are running `mvn clean ...`")

proto/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<plugin>
8080
<groupId>io.github.ascopes</groupId>
8181
<artifactId>protobuf-maven-plugin</artifactId>
82-
<version>4.0.2</version>
82+
<version>4.0.3</version>
8383
<configuration>
8484
<skip>${maven.test.skip}</skip>
8585
<protoc>${protobufVersion}</protoc>

0 commit comments

Comments
 (0)