Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c04ad9e
Add Java Platform Module System (JPMS) support
cowwoc Sep 21, 2025
ad1f8d1
Fix JPMS split package violations and enable documentation generation
cowwoc Sep 22, 2025
2659b4f
Update copyright year to 2025 for newly created file
cowwoc Sep 22, 2025
b78c9a0
Make module-info compilation CI-safe
cowwoc Sep 22, 2025
8aead27
Restore package documentation for proto extensions
cowwoc Sep 22, 2025
5760bfd
Update core/src/main/java/module-info.java
cowwoc Sep 24, 2025
6585167
Fix module-info setup and GWT compatibility issues
cpovirk May 15, 2026
7db6fde
Merge remote-tracking branch 'origin/master' into add-module-info
cpovirk May 15, 2026
28162cb
Remove unnecessary java.compiler requirement from module-info.java
cpovirk May 15, 2026
461d266
test under 25 instead of 11, use 999.0.0-SNAPSHOT throughout instead …
cpovirk May 15, 2026
4121459
Restore Employee sample extension and fix modular test visibility
cpovirk May 15, 2026
575a6ac
document add-exports
cpovirk May 15, 2026
3c8e545
remove autovalue annotations from module
cpovirk May 15, 2026
4136d0f
Move modular build configuration and GWT exclusions to core/pom.xml
cpovirk May 15, 2026
80455f7
restore comment about why add-exports
cpovirk May 15, 2026
c9496fc
add transitive for junit, where it is probably important for users of…
cpovirk May 15, 2026
caacd60
transitive for guava, too
cpovirk May 15, 2026
4319994
use java 26 for builds
cpovirk May 15, 2026
eb00006
pin artifacts
cpovirk May 15, 2026
1b70d3a
Fix CI failure by moving modular compilation to a JDK 9+ profile
cpovirk May 15, 2026
fd02f03
Skip main compilation in CI test job to preserve build artifacts
cpovirk May 15, 2026
bd6d3a1
Unpack build artifacts in CI test job to satisfy test-compilation
cpovirk May 15, 2026
0b7ad32
Merge branch 'master' into add-module-info
cpovirk May 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
<parent>
<groupId>com.google.truth</groupId>
<artifactId>truth-parent</artifactId>
<version>HEAD-SNAPSHOT</version>
<version>999.0.0-SNAPSHOT</version>
</parent>
<artifactId>truth</artifactId>
<name>Truth Core</name>
<properties>
<test.add.exports></test.add.exports>
</properties>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down Expand Up @@ -128,6 +131,9 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${test.add.exports}</argLine>
</configuration>
<executions>
<execution>
<id>default-test</id>
Expand Down Expand Up @@ -263,6 +269,42 @@
</plugins>
</reporting>
<profiles>
<profile>
<id>java9-plus</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<properties>
<!--
For tests of the sample Employee extension, which would otherwise fail:
java.lang.reflect.InaccessibleObjectException: Unable to make public void com.google.common.truth.extension.EmployeeSubjectTest.username() accessible: module com.google.truth does not "exports com.google.common.truth.extension" to module junit
-->
<test.add.exports>--add-exports com.google.truth/com.google.common.truth.extension=junit,ALL-UNNAMED</test.add.exports>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile-java9</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>false</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>java8</id>
<activation>
Expand Down
33 changes: 33 additions & 0 deletions core/src/main/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2025 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module com.google.truth {
requires transitive com.google.common;

/*
* AutoValue's annotations aren't ready for the module system:
* https://github.com/google/auto/issues/597. Let's hope that our usages are internal enough that
* we don't need to worry about listing them here.
*/

requires static transitive com.google.errorprone.annotations;
requires static transitive com.google.j2objc.annotations;
requires static transitive junit;
requires static transitive org.jspecify;
requires static transitive org.objectweb.asm;

exports com.google.common.truth;
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ private static void assertExpectedFacts(Iterable<Fact> facts, String expectedFir
+ "com.google.common.truth.TestCorrespondences\\$NullPointerExceptionFromWithin10Of"
// some whitespace:
+ "\\s+"
// the start of a stack trace, with the correct class:
+ "at com\\.google\\.common\\.truth\\.TestCorrespondences"
// the start of a stack trace, optionally with the module name and version,
// and the correct class:
+ "at (?:[^/]+/)?com\\.google\\.common\\.truth\\.TestCorrespondences"
// the rest of the stack trace, which we don't validate (and may contain newlines):
+ "(.|\\n)*"
// the expected separator
Expand Down
2 changes: 1 addition & 1 deletion extensions/java8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.google.truth.extensions</groupId>
<artifactId>truth-extensions-parent</artifactId>
<version>HEAD-SNAPSHOT</version>
<version>999.0.0-SNAPSHOT</version>
</parent>
<artifactId>truth-java8-extension</artifactId>
<name>Obsolete Truth Extension for Java8</name>
Expand Down
2 changes: 1 addition & 1 deletion extensions/liteproto/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.google.truth.extensions</groupId>
<artifactId>truth-extensions-parent</artifactId>
<version>HEAD-SNAPSHOT</version>
<version>999.0.0-SNAPSHOT</version>
</parent>
<artifactId>truth-liteproto-extension</artifactId>
<name>Truth Extension for Lite Protocol Buffers</name>
Expand Down
2 changes: 1 addition & 1 deletion extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.google.truth</groupId>
<artifactId>truth-parent</artifactId>
<version>HEAD-SNAPSHOT</version>
<version>999.0.0-SNAPSHOT</version>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error #1 from mvn clean install:

[INFO] Running com.google.common.truth.extension.EmployeeSubjectTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 s <<< FAILURE! -- in com.google.common.truth.extension.EmployeeSubjectTest
[ERROR] com.google.common.truth.extension.EmployeeSubjectTest.initializationError -- Time elapsed: 0 s <<< ERROR!
java.lang.reflect.InaccessibleObjectException: Unable to make public void com.google.common.truth.extension.EmployeeSubjectTest.username() accessible: module com.google.truth does not "exports com.google.common.truth.extension" to module junit
        at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:353)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:329)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:277)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:182)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:176)
        at junit@4.13.2/org.junit.runners.model.FrameworkMethod.<init>(FrameworkMethod.java:35)
        at junit@4.13.2/org.junit.runners.model.TestClass.scanAnnotatedMembers(TestClass.java:66)
        at junit@4.13.2/org.junit.runners.model.TestClass.<init>(TestClass.java:57)
        at junit@4.13.2/org.junit.runners.JUnit4.<init>(JUnit4.java:23)
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
        at junit@4.13.2/org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
        at junit@4.13.2/org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
        at junit@4.13.2/org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
        at junit@4.13.2/org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
        at junit@4.13.2/org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
        at junit@4.13.2/org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
        at junit@4.13.2/org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:314)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
 
[INFO] Running com.google.common.truth.extension.FakeHrDatabaseTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 s <<< FAILURE! -- in com.google.common.truth.extension.FakeHrDatabaseTest
[ERROR] com.google.common.truth.extension.FakeHrDatabaseTest.initializationError -- Time elapsed: 0 s <<< ERROR!
java.lang.reflect.InaccessibleObjectException: Unable to make public void com.google.common.truth.extension.FakeHrDatabaseTest.relocatePresent() accessible: module com.google.truth does not "exports com.google.common.truth.extension" to module junit
        at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:353)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:329)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:277)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:182)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:176)
        at junit@4.13.2/org.junit.runners.model.FrameworkMethod.<init>(FrameworkMethod.java:35)
        at junit@4.13.2/org.junit.runners.model.TestClass.scanAnnotatedMembers(TestClass.java:66)
        at junit@4.13.2/org.junit.runners.model.TestClass.<init>(TestClass.java:57)
        at junit@4.13.2/org.junit.runners.JUnit4.<init>(JUnit4.java:23)
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
        at junit@4.13.2/org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
        at junit@4.13.2/org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
        at junit@4.13.2/org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
        at junit@4.13.2/org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
        at junit@4.13.2/org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
        at junit@4.13.2/org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
        at junit@4.13.2/org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:314)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) 

That's kind of just a weird case: We probably "should" have a separate pom.xml and a separate module for the example extension. Then it could export this extension package.

I am 100% on board with just removing the sample extension from the testing: It's just a sample, and we'll continue to build and test it internally, so it will remain up to date.

</parent>
<groupId>com.google.truth.extensions</groupId>
<artifactId>truth-extensions-parent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extensions/proto/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.google.truth.extensions</groupId>
<artifactId>truth-extensions-parent</artifactId>
<version>HEAD-SNAPSHOT</version>
<version>999.0.0-SNAPSHOT</version>
</parent>
<artifactId>truth-proto-extension</artifactId>
<name>Truth Extension for Protocol Buffers</name>
Expand Down
2 changes: 1 addition & 1 deletion extensions/re2j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.google.truth.extensions</groupId>
<artifactId>truth-extensions-parent</artifactId>
<version>HEAD-SNAPSHOT</version>
<version>999.0.0-SNAPSHOT</version>
</parent>
<artifactId>truth-re2j-extension</artifactId>
<name>Truth Extension for RE2J</name>
Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.truth</groupId>
<artifactId>truth-parent</artifactId>
<version>HEAD-SNAPSHOT</version>
<version>999.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Truth (Parent)</name>
<properties>
Expand Down Expand Up @@ -249,6 +249,7 @@
<additionalOptions>
<additionalOption>-Xdoclint:-html ${conditionalJavadoc9PlusOptions}</additionalOption>
</additionalOptions>
<legacyMode>true</legacyMode>
<doctitle>Truth ${project.version}</doctitle>
<windowtitle>Truth ${project.version}</windowtitle>
<quiet>true</quiet>
Expand Down
Loading