From 347a436cda422df04d6dcbcbe2e5f9f0c9321736 Mon Sep 17 00:00:00 2001 From: Filip Hrisafov Date: Sun, 15 Jul 2018 10:56:06 +0200 Subject: [PATCH] #1382 Change module for java.annotation.Generated in the documentation closes #1382 --- .../main/asciidoc/mapstruct-reference-guide.asciidoc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc b/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc index 1620564d1..df25b4038 100644 --- a/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc +++ b/documentation/src/main/asciidoc/mapstruct-reference-guide.asciidoc @@ -271,16 +271,22 @@ If a policy is given for a specific mapper via `@Mapper#unmappedTargetPolicy()`, === Using MapStruct on Java 9 -MapStruct can be used with Java 9, but as that Java version has not been finalized yet, support for it is experimental. +MapStruct can be used with Java 9 (JPMS), support for it is experimental. A core theme of Java 9 is the modularization of the JDK. One effect of this is that a specific module needs to be enabled for a project in order to use the `javax.annotation.Generated` annotation. `@Generated` is added by MapStruct to generated mapper classes to tag them as generated code, stating the date of generation, the generator version etc. -To allow usage of the `@Generated` annotation the module _java.annotations.common_ must be enabled. When using Maven, this can be done like this: +To allow usage of the `@Generated` annotation the module _java.xml.ws.annotation_ must be enabled. When using Maven, this can be done like this: - export MAVEN_OPTS="--add-modules java.annotations.common" + export MAVEN_OPTS="--add-modules java.xml.ws.annotation" If the `@Generated` annotation is not available, MapStruct will detect this situation and not add it to generated mappers. +[NOTE] +===== +In Java 9 `java.annotation.processing.Generated` was added, which is considered as a general purpose annotation for any code generators +and is part of the `java.compiler` module. Support for it is planned within https://github.com/mapstruct/mapstruct/issues/1551[#1551] +===== + [[defining-mapper]] == Defining a mapper