Skip to content

3.49.5/maven: module jdk.compiler does not export com.sun.tools.javac.processing ? #7258

@DrMicrobit

Description

@DrMicrobit

Hi all,

would it be possible for the checkerframework to include a fully developed toy project for a maven integration?

I am battling an error that, for the life of me, I am unable to find out what the reason is. I am attaching to this issue

910_checkerframework_min.tar.gz

a minimal project for replication: unpack, cd to directory, then mvn install. The error I am encountering is this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project btool: Fatal error compiling: java.lang.IllegalAccessError: class org.checkerframework.javacutil.AbstractTypeProcessor (in unnamed module @0x23f86d8a) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x23f86d8a -> [Help 1]

As far as I can see, the needed export is present in the pom.xml and I looked into the docs and a bit everywhere on the net to find out what I am doing wrong, but I have no clue.

My environment: macOS Sequoia 15.6.1, Java 17 TEM installed via sdkman (sdk install java 17.0.16-tem), maven 3.9.11 installed via homebrew (brew install maven).

Maybe it's something obvious in the pom.xml, therefore I am including it here, too.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.bjtrain</groupId>
	<artifactId>btool</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>btool</name>
	<description>Small test</description>
	<properties>
		<java.version>17</java.version>
	</properties>


	<dependencies>
		<!-- BaCh -->
		<dependency>
			<groupId>org.checkerframework</groupId>
			<artifactId>checker</artifactId>
			<version>3.50.0</version>
		</dependency>
		<dependency>
			<groupId>org.checkerframework</groupId>
			<artifactId>checker-qual</artifactId>
			<version>3.50.0</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<!-- BaCh -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<release>17</release>
					<!-- Needed for checkerframework -->
					<compilerArgs combine.children="append">
						<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
						<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
						<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
						<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
						<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
						<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
						<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
						<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
						<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
						<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
					</compilerArgs>
					<annotationProcessorPaths>
						<path>
							<groupId>org.checkerframework</groupId>
							<artifactId>checker</artifactId>
							<version>3.50.0</version>
						</path>
					</annotationProcessorPaths>
					<annotationProcessors>
						<annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
					</annotationProcessors>
					<!-- /Needed for checkerframework -->
				</configuration>
			</plugin>

		</plugins>
	</build>

</project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions