diff --git a/annotations/.classpath b/annotations/.classpath
index 1a5cf8ed5b..0240069cde 100644
--- a/annotations/.classpath
+++ b/annotations/.classpath
@@ -3,5 +3,5 @@
-
+
diff --git a/annotations/.gitignore b/annotations/.gitignore
new file mode 100644
index 0000000000..ea8c4bf7f3
--- /dev/null
+++ b/annotations/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/annotations/Makefile b/annotations/Makefile
index 199e01b59c..00c200af07 100644
--- a/annotations/Makefile
+++ b/annotations/Makefile
@@ -25,17 +25,26 @@ DIST_JAR = $(DIST_JAR_DIR)/$(JAR_NAME)
CLASSES_DIR = $(BUILD_DIR)/classes
JAVA_SOURCE_DIR = src/main/java
+JAVA9_CLASSES_DIR = $(BUILD_DIR)/classes-java9
+JPMS_CLASS = $(JAVA9_CLASSES_DIR)/module-info.class
SOURCE_JAVA_FULL = $(ANNOTATION_SOURCE_JAVA:%=$(JAVA_SOURCE_DIR)/%)
+SOURCE_JAVA9_MODULE = $(ANNOTATION_MODULE_INFO:%=$(JAVA_SOURCE_DIR)/%)
-$(BUILD_DIR) $(CLASSES_DIR) $(DIST_JAR_DIR):
+$(BUILD_DIR) $(CLASSES_DIR) $(JAVA9_CLASSES_DIR) $(DIST_JAR_DIR):
@mkdir -p $@
-$(JAR): $(SOURCE_JAVA_FULL) | $(BUILD_DIR) $(CLASSES_DIR)
+$(JPMS_CLASS):
+ @echo Building j2objc annotations JPMS module
+ @$(JAVAC) -sourcepath $(JAVA_SOURCE_DIR) -encoding UTF-8 --release 9 -d $(JAVA9_CLASSES_DIR) \
+ -nowarn $(SOURCE_JAVA9_MODULE)
+ @rm -fr $(JAVA9_CLASSES_DIR)/com
+
+$(JAR): $(SOURCE_JAVA_FULL) | $(BUILD_DIR) $(CLASSES_DIR) $(JAVA9_CLASSES_DIR) $(JPMS_CLASS)
@echo Building j2objc annotations
@$(JAVAC) -encoding UTF-8 -d $(CLASSES_DIR) -source 1.8 -target 1.8 \
-nowarn $^
- @jar cf $(JAR) -C $(CLASSES_DIR) .
+ @jar cf $(JAR) -C $(CLASSES_DIR) . --release 9 -C $(JAVA9_CLASSES_DIR) .
$(DIST_JAR): $(JAR) | $(DIST_JAR_DIR)
@install -m 0644 $< $@
diff --git a/annotations/classes.mk b/annotations/classes.mk
index dffdabfa16..a289f517b2 100644
--- a/annotations/classes.mk
+++ b/annotations/classes.mk
@@ -10,6 +10,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+ANNOTATION_MODULE_INFO = \
+ module-info.java
+
ANNOTATION_SOURCE_JAVA = \
com/google/j2objc/annotations/AutoreleasePool.java \
com/google/j2objc/annotations/GenerateObjectiveCGenerics.java \
diff --git a/annotations/pom.xml b/annotations/pom.xml
index 217e3bbbd0..31d0f10322 100644
--- a/annotations/pom.xml
+++ b/annotations/pom.xml
@@ -58,6 +58,49 @@
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.12.1
+
+
+ default-compile
+
+
+ 1.8
+
+ module-info.java
+
+
+
+
+ compile-java9
+ compile
+
+ compile
+
+
+ 9
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.3.0
+
+
+
+ true
+
+
+
+ META-INF/versions/9/com/**
+
+
+
org.apache.maven.plugins
maven-javadoc-plugin
diff --git a/annotations/src/main/java/module-info.java b/annotations/src/main/java/module-info.java
new file mode 100644
index 0000000000..dca23f9723
--- /dev/null
+++ b/annotations/src/main/java/module-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2012 Google Inc. All Rights Reserved.
+ *
+ * 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.
+ */
+
+open module com.google.j2objc.annotations {
+ requires java.base;
+ exports com.google.j2objc.annotations;
+}