#172: default factory class name

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/jaxb-api/src/main/java/jakarta/xml/bind/ContextFinder.java b/jaxb-api/src/main/java/jakarta/xml/bind/ContextFinder.java
index 704d3df..3aa8b76 100644
--- a/jaxb-api/src/main/java/jakarta/xml/bind/ContextFinder.java
+++ b/jaxb-api/src/main/java/jakarta/xml/bind/ContextFinder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2021 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
@@ -43,6 +43,22 @@
 
     private static final Logger logger;
 
+    /**
+     * When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
+     * However, rt.jar cannot have META-INF/services/jakarta.xml.bind.JAXBContext
+     * because if it has, it will take precedence over any file that applications have
+     * in their jar files.
+     *
+     * <p>
+     * When the user bundles his own Jakarta XML Binding implementation, we'd like to use it, and we
+     * want the platform default to be used only when there's no other Jakarta XML Binding provider.
+     *
+     * <p>
+     * For this reason, we have to hard-code the class name into the API.
+     */
+    //XXX: should we define and rely on "default" in jakarta?
+    static final String DEFAULT_FACTORY_CLASS = "org.glassfish.jaxb.runtime.v2.ContextFactory";
+
     static {
         logger = Logger.getLogger("jakarta.xml.bind");
         try {
@@ -125,7 +141,7 @@
                                    Map properties) throws JAXBException {
 
         try {
-            Class spFactory = ServiceLoaderUtil.safeLoadClass(className, ModuleUtil.DEFAULT_FACTORY_CLASS, classLoader);
+            Class spFactory = ServiceLoaderUtil.safeLoadClass(className, DEFAULT_FACTORY_CLASS, classLoader);
             return newInstance(contextPath, contextPathClasses, spFactory, classLoader, properties);
         } catch (ClassNotFoundException x) {
             throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), x);
@@ -227,7 +243,7 @@
 
         Class spi;
         try {
-            spi = ServiceLoaderUtil.safeLoadClass(className, ModuleUtil.DEFAULT_FACTORY_CLASS, getContextClassLoader());
+            spi = ServiceLoaderUtil.safeLoadClass(className, DEFAULT_FACTORY_CLASS, getContextClassLoader());
         } catch (ClassNotFoundException e) {
             throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), e);
         }
@@ -315,7 +331,7 @@
 
         // else no provider found
         logger.fine("Trying to create the platform default provider");
-        return newInstance(contextPath, contextPathClasses, ModuleUtil.DEFAULT_FACTORY_CLASS, classLoader, properties);
+        return newInstance(contextPath, contextPathClasses, DEFAULT_FACTORY_CLASS, classLoader, properties);
     }
 
     static JAXBContext find(Class<?>[] classes, Map<String, ?> properties) throws JAXBException {
@@ -372,7 +388,7 @@
 
         // else no provider found
         logger.fine("Trying to create the platform default provider");
-        return newInstance(classes, properties, ModuleUtil.DEFAULT_FACTORY_CLASS);
+        return newInstance(classes, properties, DEFAULT_FACTORY_CLASS);
     }
 
 
diff --git a/jaxb-api/src/main/java/jakarta/xml/bind/ModuleUtil.java b/jaxb-api/src/main/java/jakarta/xml/bind/ModuleUtil.java
index a23eb1d..e43bd5e 100644
--- a/jaxb-api/src/main/java/jakarta/xml/bind/ModuleUtil.java
+++ b/jaxb-api/src/main/java/jakarta/xml/bind/ModuleUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021 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
@@ -21,22 +21,6 @@
 class ModuleUtil {
 
     /**
-     * When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
-     * However, rt.jar cannot have META-INF/services/jakarta.xml.bind.JAXBContext
-     * because if it has, it will take precedence over any file that applications have
-     * in their jar files.
-     *
-     * <p>
-     * When the user bundles his own Jakarta XML Binding implementation, we'd like to use it, and we
-     * want the platform default to be used only when there's no other Jakarta XML Binding provider.
-     *
-     * <p>
-     * For this reason, we have to hard-code the class name into the API.
-     */
-    // NOTICE: .toString() is used to prevent constant inlining by Java Compiler
-    static final String DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory".toString();
-
-    /**
      * Resolves classes from context path.
      * Only one class per package is needed to access its {@link java.lang.Module}
      */
diff --git a/jaxb-api/src/main/mr-jar/jakarta/xml/bind/ModuleUtil.java b/jaxb-api/src/main/mr-jar/jakarta/xml/bind/ModuleUtil.java
index ff62117..87f0cf8 100644
--- a/jaxb-api/src/main/mr-jar/jakarta/xml/bind/ModuleUtil.java
+++ b/jaxb-api/src/main/mr-jar/jakarta/xml/bind/ModuleUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021 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
@@ -14,7 +14,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.lang.Module;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Level;
@@ -30,12 +29,6 @@
     private static Logger logger = Logger.getLogger("jakarta.xml.bind");
 
     /**
-     * Jakarta XML Binding-RI default context factory.
-     */
-    // NOTICE: .toString() is used to prevent constant inlining by Java Compiler
-    static final String DEFAULT_FACTORY_CLASS = "com.sun.xml.bind.v2.ContextFactory".toString();
-
-    /**
      * Resolves classes from context path.
      * Only one class per package is needed to access its {@link java.lang.Module}
      */