< prev index next >

jdk/test/javax/xml/bind/JAXBContext/JAXBContextWithAbstractFactory.java

Print this page




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 import java.security.Permission;
  24 import java.security.Policy;
  25 import java.security.ProtectionDomain;
  26 import java.util.Map;
  27 import javax.xml.bind.JAXBContext;
  28 import javax.xml.bind.JAXBContextFactory;
  29 import javax.xml.bind.JAXBException;
  30 
  31 /**
  32  * @test
  33  * @bug 8150173
  34  * @summary Verifies that a factory which inherit its createContext method
  35  *          from an abstract subclass of JAXBContextFactory can be instantiated.
  36  * @compile -addmods java.xml.bind JAXBContextWithAbstractFactory.java
  37  * @run main/othervm -addmods java.xml.bind JAXBContextWithAbstractFactory
  38  */
  39 public class JAXBContextWithAbstractFactory {
  40     private static JAXBContext tmp;
  41 
  42     public static abstract class FactoryBase implements JAXBContextFactory {
  43         @Override
  44         public JAXBContext createContext(Class<?>[] classesToBeBound,
  45                 Map<String, ?> properties) throws JAXBException {
  46             return tmp;
  47         }
  48 
  49         @Override
  50         public JAXBContext createContext(String contextPath,
  51                 ClassLoader classLoader, Map<String, ?> properties)
  52                 throws JAXBException {
  53             return tmp;
  54         }
  55     }
  56 
  57     public static class Factory extends FactoryBase {}




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 import java.security.Permission;
  24 import java.security.Policy;
  25 import java.security.ProtectionDomain;
  26 import java.util.Map;
  27 import javax.xml.bind.JAXBContext;
  28 import javax.xml.bind.JAXBContextFactory;
  29 import javax.xml.bind.JAXBException;
  30 
  31 /**
  32  * @test
  33  * @bug 8150173
  34  * @summary Verifies that a factory which inherit its createContext method
  35  *          from an abstract subclass of JAXBContextFactory can be instantiated.
  36  * @modules java.xml.bind
  37  * @run main/othervm JAXBContextWithAbstractFactory
  38  */
  39 public class JAXBContextWithAbstractFactory {
  40     private static JAXBContext tmp;
  41 
  42     public static abstract class FactoryBase implements JAXBContextFactory {
  43         @Override
  44         public JAXBContext createContext(Class<?>[] classesToBeBound,
  45                 Map<String, ?> properties) throws JAXBException {
  46             return tmp;
  47         }
  48 
  49         @Override
  50         public JAXBContext createContext(String contextPath,
  51                 ClassLoader classLoader, Map<String, ?> properties)
  52                 throws JAXBException {
  53             return tmp;
  54         }
  55     }
  56 
  57     public static class Factory extends FactoryBase {}


< prev index next >