allow build on JDK13 (#1379)

* allow build on JDK13

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/.travis.yml b/.travis.yml
index 5f85058..454a9e7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,7 @@
 
 jdk:
   - oraclejdk11
-  - openjdk11
+  - oraclejdk13
 
 cache:
   directories:
diff --git a/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/package-info.java b/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/package-info.java
index e5dac66..6e292aa 100644
--- a/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/package-info.java
+++ b/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -9,7 +9,7 @@
  */
 
 /**
- * <h1>Library for generating Java source code</h1>.
+ * <h2>Library for generating Java source code</h2>.
  *
  * <p>
  * CodeModel is a library that allows you to generate Java source
@@ -26,7 +26,7 @@
  * create a {@link JMethod} from {@link JDefinedClass}, and so on.
  *
  * <p>
- * This design brings the following beneefits:
+ * This design brings the following benefits:
  *
  * <ul>
  *  <li>source code can be written in random order
@@ -42,7 +42,7 @@
  * more discussions about the performance and possible improvements.
  *
  *
- * <h2>Using CodeModel</h2>
+ * <h3>Using CodeModel</h3>
  * <p>
  * {@link com.sun.codemodel.JCodeModel} is the entry point to
  * the library. See its javadoc for more details about how to use
@@ -50,7 +50,7 @@
  *
  *
  *
- * <h2>Performance</h2>
+ * <h3>Performance</h3>
  * <p>
  * Generally speaking, CodeModel is expected to be used in
  * an environment where the resource constraint is not severe.
diff --git a/jaxb-ri/codemodel/pom.xml b/jaxb-ri/codemodel/pom.xml
index fd79ce0..4cd895a 100644
--- a/jaxb-ri/codemodel/pom.xml
+++ b/jaxb-ri/codemodel/pom.xml
@@ -84,6 +84,9 @@
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-javadoc-plugin</artifactId>
                     <version>3.1.1</version>
+                    <configuration>
+                        <release>11</release>
+                    </configuration>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
diff --git a/jaxb-ri/external/pom.xml b/jaxb-ri/external/pom.xml
index 0946a90..da0070f 100644
--- a/jaxb-ri/external/pom.xml
+++ b/jaxb-ri/external/pom.xml
@@ -86,6 +86,9 @@
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-javadoc-plugin</artifactId>
                     <version>3.1.1</version>
+                    <configuration>
+                        <release>11</release>
+                    </configuration>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
diff --git a/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/api/package-info.java b/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/api/package-info.java
index 5a5a1e5..afbba24 100644
--- a/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/api/package-info.java
+++ b/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/api/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -9,7 +9,7 @@
  */
 
 /**
- * <h1>Runtime API for the JAX-WS RI</h1>.
+ * <h2>Runtime API for the JAX-WS RI</h2>.
  *
  * This API is designed for the use by the JAX-WS RI runtime. The API is is subject to
  * change without notice.
diff --git a/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/package-info.java b/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/package-info.java
index 75fa94a..4de76a0 100644
--- a/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/package-info.java
+++ b/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/package-info.java
@@ -9,9 +9,9 @@
  */
 
 /**
- * <h1>The JAXB 2.0 runtime</h1>.
+ * <h2>The JAXB 2.0 runtime</h2>.
  *
- * <h1>Overview</h1>
+ * <h2>Overview</h2>
  * <p>
  * This module provides code that implements {@link javax.xml.bind.JAXBContext}.
  * Roughly speaking the runtime works like this:
@@ -26,7 +26,7 @@
  *      composing unmarshallers and marshallers.
  * </ol>
  *
- * <h1>Interesting Pieces inside Runtime</h1>
+ * <h2>Interesting Pieces inside Runtime</h2>
  * <p>
  * The followings are the interesting pieces inside the runtime.
  *
@@ -44,7 +44,7 @@
  * The classes <b>NOT</b> in the {@link com.sun.xml.bind.v2} package (and its subpackages)
  * are also used by old JAXB 1.0 clients.
  *
- * <h1>Models</h1>
+ * <h2>Models</h2>
  * <p>
  * "Model" is the portion of the code that represents JAXB-bound types.
  *
@@ -108,7 +108,7 @@
  *
  *
  *
- * <h1>Performance Characteristics</h1>
+ * <h2>Performance Characteristics</h2>
  * <p>
  * Model construction happens inside {@link javax.xml.bind.JAXBContext#newInstance(Class[])}.
  * It's desirable for this step to be fast and consume less memory,
@@ -122,7 +122,7 @@
  *
  *
  *
- * <h1>Bootstrap Sequence</h1>
+ * <h2>Bootstrap Sequence</h2>
  * <p>
  * The following picture illustrates how the {@link javax.xml.bind.JAXBContext#newInstance(Class[])} method
  * triggers activities.
diff --git a/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/runtime/IllegalAnnotationException.java b/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/runtime/IllegalAnnotationException.java
index cc3ebc7..2126ec2 100644
--- a/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/runtime/IllegalAnnotationException.java
+++ b/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/runtime/IllegalAnnotationException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -122,7 +122,7 @@
      * if you see this behavior.
      *
      *
-     * <h3>List of {@link Location}</h3>
+     * <p><strong>List of {@link Location}</strong></p>
      * <p>
      * Each error location is identified not just by one {@link Location}
      * object, but by a sequence of {@link Location}s that shows why
diff --git a/jaxb-ri/runtime/impl/src/test/java/com/sun/xml/bind/v2/runtime/reflect/opt/OptimizationTest.java b/jaxb-ri/runtime/impl/src/test/java/com/sun/xml/bind/v2/runtime/reflect/opt/OptimizationTest.java
index 1546244..b7520d6 100644
--- a/jaxb-ri/runtime/impl/src/test/java/com/sun/xml/bind/v2/runtime/reflect/opt/OptimizationTest.java
+++ b/jaxb-ri/runtime/impl/src/test/java/com/sun/xml/bind/v2/runtime/reflect/opt/OptimizationTest.java
@@ -18,6 +18,8 @@
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 import java.io.StringReader;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.VarHandle;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 
@@ -32,6 +34,16 @@
     private static final String EXPECTED_ACCESSOR_CLASS_REF = Book.class.getName() + "$JaxbAccessorM_getAuthor_setAuthor_java_lang_String";
     private static final String OPTIMIZATION_ON = "AUTHOR_EXPECTING_OPTIMIZATION_ON";
     private static final String OPTIMIZATION_OFF = "AUTHOR_EXPECTING_OPTIMIZATION_OFF";
+    private static final VarHandle MODIFIERS;
+
+    static {
+        try {
+            MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(Field.class, MethodHandles.lookup());
+            MODIFIERS = lookup.findVarHandle(Field.class, "modifiers", int.class);
+        } catch (IllegalAccessException | NoSuchFieldException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
 
     @Test
     public void checkNoOptimizationFlagFalse() throws JAXBException {
@@ -61,10 +73,10 @@
 
     private void setNoOptimizationFlag(boolean flag) throws NoSuchFieldException, IllegalAccessException {
         Field noOptimizationField = OptimizedAccessorFactory.class.getField("noOptimization");
-        Field modifiersField = Field.class.getDeclaredField("modifiers");
-        modifiersField.setAccessible(true);
         noOptimizationField.setAccessible(true);
-        modifiersField.setInt(noOptimizationField, noOptimizationField.getModifiers() & ~Modifier.FINAL);
+        if (Modifier.isFinal(noOptimizationField.getModifiers())) {
+            MODIFIERS.set(noOptimizationField, noOptimizationField.getModifiers() & ~Modifier.FINAL);
+        }
         noOptimizationField.setBoolean(OptimizedAccessorFactory.class, true);
     }
 
diff --git a/jaxb-ri/txw/runtime/src/main/java/com/sun/xml/txw2/annotation/package.html b/jaxb-ri/txw/runtime/src/main/java/com/sun/xml/txw2/annotation/package.html
index a1ff744..06b971a 100644
--- a/jaxb-ri/txw/runtime/src/main/java/com/sun/xml/txw2/annotation/package.html
+++ b/jaxb-ri/txw/runtime/src/main/java/com/sun/xml/txw2/annotation/package.html
@@ -1,7 +1,7 @@
 <html>
 <!--
 
-    Copyright (c) 2005, 2018 Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 2005, 2019 Oracle and/or its affiliates. All rights reserved.
 
     This program and the accompanying materials are made available under the
     terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -15,17 +15,17 @@
   <p>
     Defines a set of annotations that can be used on TypedXmlWriter interfaces.
 
-  <h3>Package-level Annotation</h3>
+  <h2>Package-level Annotation</h2>
   <p>
     {@link XmlNamespace} can be used on a package to designate the namespace URI for the
     whole package.
 
-  <h3>Interface Annotation</h3>
+  <h2>Interface Annotation</h2>
   <p>
     {@link XmlElement} can be used on TypedXmlWriter-derived interfaces to associate
     a tag name to that interface.
 
-  <h3>Method Annotations</h3>
+  <h2>Method Annotations</h2>
   <p>
     {@link XmlElement}, {@link XmlAttribute}, or {@link XmlValue} can be used on a method
     declared on a TypedXmLWriter-derived interface. Those annotations are mutually-exclusive.
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/package-info.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/package-info.java
index 9ea4285..66850ac 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/package-info.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/package-info.java
@@ -9,7 +9,7 @@
  */
 
 /**
- * <h1>Schema to Java compiler</h1>.
+ * <h2>Schema to Java compiler</h2>.
  *
  * <p>
  * This module contains the code that implements the schema compiler 'XJC'.
diff --git a/jaxb-ri/xsom/pom.xml b/jaxb-ri/xsom/pom.xml
index 651bffe..52e9481 100644
--- a/jaxb-ri/xsom/pom.xml
+++ b/jaxb-ri/xsom/pom.xml
@@ -98,6 +98,9 @@
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-javadoc-plugin</artifactId>
                     <version>3.1.1</version>
+                    <configuration>
+                        <release>11</release>
+                    </configuration>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/parser/NGCCRuntimeEx.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/parser/NGCCRuntimeEx.java
index 78b0635..e92197d 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/parser/NGCCRuntimeEx.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/parser/NGCCRuntimeEx.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -271,7 +271,7 @@
      * document will be parsed multiple times if they are for different
      * target namespaces.
      *
-     * <h2>Document Graph Model</h2>
+     * <p><strong>Document Graph Model</strong></p>
      * <p>
      * The challenge we are facing here is that you have a graph of
      * documents that reference each other. Each document has an unique