Merge jdk8-b124 jdk8-b125

Wed, 15 Jan 2014 10:49:40 -0800

author
lana
date
Wed, 15 Jan 2014 10:49:40 -0800
changeset 460
ef71ecbcd7bc
parent 459
9ed8a0577511
parent 456
6547da5c3277
child 461
b14885a461b3
child 468
c0040f0b75e2

Merge

     1.1 --- a/src/share/jaxws_classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java	Mon Jan 13 22:31:58 2014 -0800
     1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java	Wed Jan 15 10:49:40 2014 -0800
     1.3 @@ -65,7 +65,7 @@
     1.4   *
     1.5   * @author Kohsuke Kawaguchi (kk@kohsuke.org)
     1.6   */
     1.7 -public class ApNavigator implements Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> {
     1.8 +public final class ApNavigator implements Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> {
     1.9  
    1.10      private final ProcessingEnvironment env;
    1.11  
    1.12 @@ -236,7 +236,7 @@
    1.13      }
    1.14  
    1.15      public boolean isFinal(TypeElement clazz) {
    1.16 -        return hasModifier(clazz,Modifier.FINAL);
    1.17 +        return hasModifier(clazz, Modifier.FINAL);
    1.18      }
    1.19  
    1.20      public VariableElement[] getEnumConstants(TypeElement clazz) {
    1.21 @@ -258,8 +258,9 @@
    1.22          return env.getElementUtils().getPackageOf(clazz).getQualifiedName().toString();
    1.23      }
    1.24  
    1.25 -    public TypeElement findClass(String className, TypeElement referencePoint) {
    1.26 -        return env.getElementUtils().getTypeElement(className);
    1.27 +    @Override
    1.28 +    public TypeElement loadObjectFactory(TypeElement referencePoint, String packageName) {
    1.29 +        return env.getElementUtils().getTypeElement(packageName + ".ObjectFactory");
    1.30      }
    1.31  
    1.32      public boolean isBridgeMethod(ExecutableElement method) {
     2.1 --- a/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/EagerNType.java	Mon Jan 13 22:31:58 2014 -0800
     2.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/EagerNType.java	Wed Jan 15 10:49:40 2014 -0800
     2.3 @@ -30,7 +30,6 @@
     2.4  import com.sun.codemodel.internal.JType;
     2.5  import com.sun.tools.internal.xjc.outline.Aspect;
     2.6  import com.sun.tools.internal.xjc.outline.Outline;
     2.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
     2.8  
     2.9  /**
    2.10   * @author Kohsuke Kawaguchi
    2.11 @@ -69,6 +68,6 @@
    2.12      }
    2.13  
    2.14      public String fullName() {
    2.15 -        return Navigator.REFLECTION.getTypeName(t);
    2.16 +        return Utils.REFLECTION_NAVIGATOR.getTypeName(t);
    2.17      }
    2.18  }
     3.1 --- a/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/NavigatorImpl.java	Mon Jan 13 22:31:58 2014 -0800
     3.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/NavigatorImpl.java	Wed Jan 15 10:49:40 2014 -0800
     3.3 @@ -56,7 +56,7 @@
     3.4              EagerNType ent = (EagerNType) nt;
     3.5              if (base instanceof EagerNClass) {
     3.6                  EagerNClass enc = (EagerNClass) base;
     3.7 -                return create(REFLECTION.getBaseClass(ent.t, enc.c));
     3.8 +                return create(Utils.REFLECTION_NAVIGATOR.getBaseClass(ent.t, enc.c));
     3.9              }
    3.10              // lazy class can never be a base type of an eager type
    3.11              return null;
    3.12 @@ -176,7 +176,7 @@
    3.13      public NType getTypeArgument(NType nt, int i) {
    3.14          if (nt instanceof EagerNType) {
    3.15              EagerNType ent = (EagerNType) nt;
    3.16 -            return create(REFLECTION.getTypeArgument(ent.t,i));
    3.17 +            return create(Utils.REFLECTION_NAVIGATOR.getTypeArgument(ent.t,i));
    3.18          }
    3.19          if (nt instanceof NClassByJClass) {
    3.20              NClassByJClass nnt = (NClassByJClass) nt;
    3.21 @@ -189,7 +189,7 @@
    3.22      public boolean isParameterizedType(NType nt) {
    3.23          if (nt instanceof EagerNType) {
    3.24              EagerNType ent = (EagerNType) nt;
    3.25 -            return REFLECTION.isParameterizedType(ent.t);
    3.26 +            return Utils.REFLECTION_NAVIGATOR.isParameterizedType(ent.t);
    3.27          }
    3.28          if (nt instanceof NClassByJClass) {
    3.29              NClassByJClass nnt = (NClassByJClass) nt;
    3.30 @@ -304,8 +304,8 @@
    3.31          throw new UnsupportedOperationException();
    3.32      }
    3.33  
    3.34 -    public NClass findClass(String className, NClass referencePoint) {
    3.35 -        // TODO: implement this method later
    3.36 +    @Override
    3.37 +    public NClass loadObjectFactory(NClass referencePoint, String pkg) {
    3.38          throw new UnsupportedOperationException();
    3.39      }
    3.40  
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java	Wed Jan 15 10:49:40 2014 -0800
     4.3 @@ -0,0 +1,82 @@
     4.4 +/*
     4.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 + *
     4.8 + * This code is free software; you can redistribute it and/or modify it
     4.9 + * under the terms of the GNU General Public License version 2 only, as
    4.10 + * published by the Free Software Foundation.  Oracle designates this
    4.11 + * particular file as subject to the "Classpath" exception as provided
    4.12 + * by Oracle in the LICENSE file that accompanied this code.
    4.13 + *
    4.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.17 + * version 2 for more details (a copy is included in the LICENSE file that
    4.18 + * accompanied this code).
    4.19 + *
    4.20 + * You should have received a copy of the GNU General Public License version
    4.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.23 + *
    4.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.25 + * or visit www.oracle.com if you need additional information or have any
    4.26 + * questions.
    4.27 + */
    4.28 +
    4.29 +package com.sun.tools.internal.xjc.model.nav;
    4.30 +
    4.31 +import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    4.32 +
    4.33 +import java.lang.reflect.Field;
    4.34 +import java.lang.reflect.InvocationTargetException;
    4.35 +import java.lang.reflect.Method;
    4.36 +import java.lang.reflect.Type;
    4.37 +import java.util.logging.Level;
    4.38 +import java.util.logging.Logger;
    4.39 +
    4.40 +/**
    4.41 + * Utils class.
    4.42 + * Has *package private* access to avoid inappropriate usage.
    4.43 + */
    4.44 +/* package */ final class Utils {
    4.45 +
    4.46 +    private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
    4.47 +
    4.48 +    /**
    4.49 +     * static ReflectionNavigator field to avoid usage of reflection every time we use it.
    4.50 +     */
    4.51 +    /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
    4.52 +
    4.53 +    static { // we statically initializing REFLECTION_NAVIGATOR property
    4.54 +        Class refNav = null;
    4.55 +        try {
    4.56 +            refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
    4.57 +            //noinspection unchecked
    4.58 +            Method getInstance = refNav.getDeclaredMethod("getInstance");
    4.59 +            getInstance.setAccessible(true);
    4.60 +            //noinspection unchecked
    4.61 +            REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
    4.62 +        } catch (ClassNotFoundException e) {
    4.63 +            e.printStackTrace();
    4.64 +            throw new IllegalStateException("Can't find ReflectionNavigator class");
    4.65 +        } catch (InvocationTargetException e) {
    4.66 +            e.printStackTrace();
    4.67 +            throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception");
    4.68 +        } catch (NoSuchMethodException e) {
    4.69 +            e.printStackTrace();
    4.70 +            throw new IllegalStateException("ReflectionNavigator.getInstance can't be found");
    4.71 +        } catch (IllegalAccessException e) {
    4.72 +            e.printStackTrace();
    4.73 +            throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible");
    4.74 +        } catch (SecurityException e) {
    4.75 +            LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
    4.76 +            throw e;
    4.77 +        }
    4.78 +    }
    4.79 +
    4.80 +    /**
    4.81 +     * private constructor to avoid util class instantiating
    4.82 +     */
    4.83 +    private Utils() {
    4.84 +    }
    4.85 +}
     5.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/api/JAXBRIContext.java	Mon Jan 13 22:31:58 2014 -0800
     5.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/api/JAXBRIContext.java	Wed Jan 15 10:49:40 2014 -0800
     5.3 @@ -45,7 +45,6 @@
     5.4  import com.sun.xml.internal.bind.api.impl.NameConverter;
     5.5  import com.sun.xml.internal.bind.v2.ContextFactory;
     5.6  import com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader;
     5.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
     5.8  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfoSet;
     5.9  import java.util.HashMap;
    5.10  
    5.11 @@ -417,7 +416,7 @@
    5.12       * @since 2.0 FCS
    5.13       */
    5.14      public static @Nullable Type getBaseType(@NotNull Type type, @NotNull Class baseType) {
    5.15 -        return Navigator.REFLECTION.getBaseClass(type,baseType);
    5.16 +        return Utils.REFLECTION_NAVIGATOR.getBaseClass(type, baseType);
    5.17      }
    5.18  
    5.19      /**
     6.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/api/TypeReference.java	Mon Jan 13 22:31:58 2014 -0800
     6.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/api/TypeReference.java	Wed Jan 15 10:49:40 2014 -0800
     6.3 @@ -32,8 +32,6 @@
     6.4  
     6.5  import javax.xml.namespace.QName;
     6.6  
     6.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
     6.8 -
     6.9  /**
    6.10   * A reference to a JAXB-bound type.
    6.11   *
    6.12 @@ -105,12 +103,11 @@
    6.13          // if we are to reinstitute this check, check JAXB annotations only
    6.14          // assert annotations.length==0;   // not designed to work with adapters.
    6.15  
    6.16 -        Type base = Navigator.REFLECTION.getBaseClass(type, Collection.class);
    6.17 +        Type base = Utils.REFLECTION_NAVIGATOR.getBaseClass(type, Collection.class);
    6.18          if(base==null)
    6.19              return this;    // not a collection
    6.20  
    6.21 -        return new TypeReference(tagName,
    6.22 -            Navigator.REFLECTION.getTypeArgument(base,0));
    6.23 +        return new TypeReference(tagName, Utils.REFLECTION_NAVIGATOR.getTypeArgument(base,0));
    6.24      }
    6.25  
    6.26      @Override
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java	Wed Jan 15 10:49:40 2014 -0800
     7.3 @@ -0,0 +1,82 @@
     7.4 +/*
     7.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.  Oracle designates this
    7.11 + * particular file as subject to the "Classpath" exception as provided
    7.12 + * by Oracle in the LICENSE file that accompanied this code.
    7.13 + *
    7.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.17 + * version 2 for more details (a copy is included in the LICENSE file that
    7.18 + * accompanied this code).
    7.19 + *
    7.20 + * You should have received a copy of the GNU General Public License version
    7.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.23 + *
    7.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.25 + * or visit www.oracle.com if you need additional information or have any
    7.26 + * questions.
    7.27 + */
    7.28 +
    7.29 +package com.sun.xml.internal.bind.api;
    7.30 +
    7.31 +import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    7.32 +
    7.33 +import java.lang.reflect.Field;
    7.34 +import java.lang.reflect.InvocationTargetException;
    7.35 +import java.lang.reflect.Method;
    7.36 +import java.lang.reflect.Type;
    7.37 +import java.util.logging.Level;
    7.38 +import java.util.logging.Logger;
    7.39 +
    7.40 +/**
    7.41 + * Utils class.
    7.42 + * Has *package private* access to avoid inappropriate usage.
    7.43 + */
    7.44 +/* package */ final class Utils {
    7.45 +
    7.46 +    private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
    7.47 +
    7.48 +    /**
    7.49 +     * static ReflectionNavigator field to avoid usage of reflection every time we use it.
    7.50 +     */
    7.51 +    /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
    7.52 +
    7.53 +    static { // we statically initializing REFLECTION_NAVIGATOR property
    7.54 +        Class refNav = null;
    7.55 +        try {
    7.56 +            refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
    7.57 +            //noinspection unchecked
    7.58 +            Method getInstance = refNav.getDeclaredMethod("getInstance");
    7.59 +            getInstance.setAccessible(true);
    7.60 +            //noinspection unchecked
    7.61 +            REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
    7.62 +        } catch (ClassNotFoundException e) {
    7.63 +            e.printStackTrace();
    7.64 +            throw new IllegalStateException("Can't find ReflectionNavigator class");
    7.65 +        } catch (InvocationTargetException e) {
    7.66 +            e.printStackTrace();
    7.67 +            throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception");
    7.68 +        } catch (NoSuchMethodException e) {
    7.69 +            e.printStackTrace();
    7.70 +            throw new IllegalStateException("ReflectionNavigator.getInstance can't be found");
    7.71 +        } catch (IllegalAccessException e) {
    7.72 +            e.printStackTrace();
    7.73 +            throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible");
    7.74 +        } catch (SecurityException e) {
    7.75 +            LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
    7.76 +            throw e;
    7.77 +        }
    7.78 +    }
    7.79 +
    7.80 +    /**
    7.81 +     * private constructor to avoid util class instantiating
    7.82 +     */
    7.83 +    private Utils() {
    7.84 +    }
    7.85 +}
     8.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.java	Mon Jan 13 22:31:58 2014 -0800
     8.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.java	Wed Jan 15 10:49:40 2014 -0800
     8.3 @@ -289,23 +289,12 @@
     8.4          String pkg = nav.getPackageName(clazz);
     8.5          if (!registries.containsKey(pkg)) {
     8.6              // insert the package's object factory
     8.7 -            C c = loadObjectFactory(clazz, pkg);
     8.8 +            C c = nav.loadObjectFactory(clazz, pkg);
     8.9              if (c != null)
    8.10                  addRegistry(c, p);
    8.11          }
    8.12      }
    8.13  
    8.14 -    private C loadObjectFactory(C clazz, String pkg) {
    8.15 -        C c;
    8.16 -        try {
    8.17 -            c = nav.findClass(pkg + ".ObjectFactory", clazz);
    8.18 -        } catch (SecurityException ignored) {
    8.19 -            // treat SecurityException in same way as ClassNotFoundException in this case
    8.20 -            c = null;
    8.21 -        }
    8.22 -        return c;
    8.23 -    }
    8.24 -
    8.25      /**
    8.26       * Getting parametrized classes of {@code JAXBElement<...>} property
    8.27       * @param p property which parametrized types we will try to get
     9.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeAnyTypeImpl.java	Mon Jan 13 22:31:58 2014 -0800
     9.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeAnyTypeImpl.java	Wed Jan 15 10:49:40 2014 -0800
     9.3 @@ -36,7 +36,7 @@
     9.4   */
     9.5  final class RuntimeAnyTypeImpl extends AnyTypeImpl<Type,Class> implements RuntimeNonElement {
     9.6      private RuntimeAnyTypeImpl() {
     9.7 -        super(Navigator.REFLECTION);
     9.8 +        super(Utils.REFLECTION_NAVIGATOR);
     9.9      }
    9.10  
    9.11      public <V> Transducer<V> getTransducer() {
    10.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java	Mon Jan 13 22:31:58 2014 -0800
    10.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java	Wed Jan 15 10:49:40 2014 -0800
    10.3 @@ -91,9 +91,6 @@
    10.4  import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext;
    10.5  import com.sun.xml.internal.bind.v2.util.ByteArrayOutputStreamEx;
    10.6  import com.sun.xml.internal.bind.v2.util.DataSourceSource;
    10.7 -import java.util.logging.Logger;
    10.8 -import com.sun.xml.internal.bind.Util;
    10.9 -import java.util.logging.Level;
   10.10  
   10.11  import org.xml.sax.SAXException;
   10.12  
   10.13 @@ -108,8 +105,6 @@
   10.14  public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl<Type,Class>
   10.15      implements RuntimeBuiltinLeafInfo, Transducer<T> {
   10.16  
   10.17 -    private static final Logger logger = Util.getClassLogger();
   10.18 -
   10.19      private RuntimeBuiltinLeafInfoImpl(Class type, QName... typeNames) {
   10.20          super(type, typeNames);
   10.21          LEAVES.put(type,this);
   10.22 @@ -201,7 +196,6 @@
   10.23      public static final List<RuntimeBuiltinLeafInfoImpl<?>> builtinBeanInfos;
   10.24  
   10.25      public static final String MAP_ANYURI_TO_URI = "mapAnyUriToUri";
   10.26 -    public static final String USE_OLD_GMONTH_MAPPING = "jaxb.ri.useOldGmonthMapping";
   10.27  
   10.28      static {
   10.29  
   10.30 @@ -966,14 +960,7 @@
   10.31          m.put(DatatypeConstants.DATETIME,   "%Y-%M-%DT%h:%m:%s"+ "%z");
   10.32          m.put(DatatypeConstants.DATE,       "%Y-%M-%D" +"%z");
   10.33          m.put(DatatypeConstants.TIME,       "%h:%m:%s"+ "%z");
   10.34 -        if (System.getProperty(USE_OLD_GMONTH_MAPPING) == null) {
   10.35 -            m.put(DatatypeConstants.GMONTH, "--%M%z");      //  E2-12 Error. http://www.w3.org/2001/05/xmlschema-errata#e2-12
   10.36 -        } else {                                            //  backw. compatibility
   10.37 -            if (logger.isLoggable(Level.FINE)) {
   10.38 -                logger.log(Level.FINE, "Old GMonth mapping used.");
   10.39 -            }
   10.40 -            m.put(DatatypeConstants.GMONTH, "--%M--%z");
   10.41 -        }
   10.42 +        m.put(DatatypeConstants.GMONTH,     "--%M--%z");
   10.43          m.put(DatatypeConstants.GDAY,       "---%D" + "%z");
   10.44          m.put(DatatypeConstants.GYEAR,      "%Y" + "%z");
   10.45          m.put(DatatypeConstants.GYEARMONTH, "%Y-%M" + "%z");
    11.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeElementInfoImpl.java	Mon Jan 13 22:31:58 2014 -0800
    11.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeElementInfoImpl.java	Wed Jan 15 10:49:40 2014 -0800
    11.3 @@ -42,7 +42,6 @@
    11.4  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement;
    11.5  import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo;
    11.6  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeRef;
    11.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    11.8  import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException;
    11.9  import com.sun.xml.internal.bind.v2.runtime.Transducer;
   11.10  import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor;
   11.11 @@ -122,7 +121,8 @@
   11.12      }
   11.13  
   11.14      public Class<? extends JAXBElement> getType() {
   11.15 -        return Navigator.REFLECTION.erasure(super.getType());
   11.16 +        //noinspection unchecked
   11.17 +        return (Class<? extends JAXBElement>) Utils.REFLECTION_NAVIGATOR.erasure(super.getType());
   11.18      }
   11.19  
   11.20      public RuntimeClassInfo getScope() {
    12.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeModelBuilder.java	Mon Jan 13 22:31:58 2014 -0800
    12.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeModelBuilder.java	Wed Jan 15 10:49:40 2014 -0800
    12.3 @@ -38,7 +38,6 @@
    12.4  import com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader;
    12.5  import com.sun.xml.internal.bind.v2.model.core.ID;
    12.6  import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    12.7 -import com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator;
    12.8  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement;
    12.9  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElementRef;
   12.10  import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo;
   12.11 @@ -75,7 +74,7 @@
   12.12      public final @Nullable JAXBContextImpl context;
   12.13  
   12.14      public RuntimeModelBuilder(JAXBContextImpl context, RuntimeAnnotationReader annotationReader, Map<Class, Class> subclassReplacements, String defaultNamespaceRemap) {
   12.15 -        super(annotationReader, Navigator.REFLECTION, subclassReplacements, defaultNamespaceRemap);
   12.16 +        super(annotationReader, Utils.REFLECTION_NAVIGATOR, subclassReplacements, defaultNamespaceRemap);
   12.17          this.context = context;
   12.18      }
   12.19  
   12.20 @@ -109,10 +108,6 @@
   12.21          return new RuntimeArrayInfoImpl(this, upstream, (Class)arrayType);
   12.22      }
   12.23  
   12.24 -    public ReflectionNavigator getNavigator() {
   12.25 -        return (ReflectionNavigator)nav;
   12.26 -    }
   12.27 -
   12.28      @Override
   12.29      protected RuntimeTypeInfoSetImpl createTypeInfoSet() {
   12.30          return new RuntimeTypeInfoSetImpl(reader);
    13.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeTypeInfoSetImpl.java	Mon Jan 13 22:31:58 2014 -0800
    13.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeTypeInfoSetImpl.java	Wed Jan 15 10:49:40 2014 -0800
    13.3 @@ -35,7 +35,6 @@
    13.4  import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader;
    13.5  import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet;
    13.6  import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    13.7 -import com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator;
    13.8  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement;
    13.9  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfoSet;
   13.10  
   13.11 @@ -46,7 +45,7 @@
   13.12   */
   13.13  final class RuntimeTypeInfoSetImpl extends TypeInfoSetImpl<Type,Class,Field,Method> implements RuntimeTypeInfoSet {
   13.14      public RuntimeTypeInfoSetImpl(AnnotationReader<Type,Class,Field,Method> reader) {
   13.15 -        super(Navigator.REFLECTION,reader,RuntimeBuiltinLeafInfoImpl.LEAVES);
   13.16 +        super(Utils.REFLECTION_NAVIGATOR,reader,RuntimeBuiltinLeafInfoImpl.LEAVES);
   13.17      }
   13.18  
   13.19      @Override
   13.20 @@ -54,10 +53,6 @@
   13.21          return RuntimeAnyTypeImpl.theInstance;
   13.22      }
   13.23  
   13.24 -    public ReflectionNavigator getNavigator() {
   13.25 -        return (ReflectionNavigator)super.getNavigator();
   13.26 -    }
   13.27 -
   13.28      public RuntimeNonElement getTypeInfo( Type type ) {
   13.29          return (RuntimeNonElement)super.getTypeInfo(type);
   13.30      }
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java	Wed Jan 15 10:49:40 2014 -0800
    14.3 @@ -0,0 +1,82 @@
    14.4 +/*
    14.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.7 + *
    14.8 + * This code is free software; you can redistribute it and/or modify it
    14.9 + * under the terms of the GNU General Public License version 2 only, as
   14.10 + * published by the Free Software Foundation.  Oracle designates this
   14.11 + * particular file as subject to the "Classpath" exception as provided
   14.12 + * by Oracle in the LICENSE file that accompanied this code.
   14.13 + *
   14.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   14.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14.17 + * version 2 for more details (a copy is included in the LICENSE file that
   14.18 + * accompanied this code).
   14.19 + *
   14.20 + * You should have received a copy of the GNU General Public License version
   14.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   14.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   14.23 + *
   14.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   14.25 + * or visit www.oracle.com if you need additional information or have any
   14.26 + * questions.
   14.27 + */
   14.28 +
   14.29 +package com.sun.xml.internal.bind.v2.model.impl;
   14.30 +
   14.31 +import com.sun.xml.internal.bind.v2.model.nav.Navigator;
   14.32 +
   14.33 +import java.lang.reflect.Field;
   14.34 +import java.lang.reflect.InvocationTargetException;
   14.35 +import java.lang.reflect.Method;
   14.36 +import java.lang.reflect.Type;
   14.37 +import java.util.logging.Level;
   14.38 +import java.util.logging.Logger;
   14.39 +
   14.40 +/**
   14.41 + * Utils class.
   14.42 + * Has *package private* access to avoid inappropriate usage.
   14.43 + */
   14.44 +/* package */ final class Utils {
   14.45 +
   14.46 +    private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
   14.47 +
   14.48 +    /**
   14.49 +     * static ReflectionNavigator field to avoid usage of reflection every time we use it.
   14.50 +     */
   14.51 +    /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
   14.52 +
   14.53 +    static { // we statically initializing REFLECTION_NAVIGATOR property
   14.54 +        Class refNav = null;
   14.55 +        try {
   14.56 +            refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
   14.57 +            //noinspection unchecked
   14.58 +            Method getInstance = refNav.getDeclaredMethod("getInstance");
   14.59 +            getInstance.setAccessible(true);
   14.60 +            //noinspection unchecked
   14.61 +            REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
   14.62 +        } catch (ClassNotFoundException e) {
   14.63 +            e.printStackTrace();
   14.64 +            throw new IllegalStateException("Can't find ReflectionNavigator class");
   14.65 +        } catch (InvocationTargetException e) {
   14.66 +            e.printStackTrace();
   14.67 +            throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception");
   14.68 +        } catch (NoSuchMethodException e) {
   14.69 +            e.printStackTrace();
   14.70 +            throw new IllegalStateException("ReflectionNavigator.getInstance can't be found");
   14.71 +        } catch (IllegalAccessException e) {
   14.72 +            e.printStackTrace();
   14.73 +            throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible");
   14.74 +        } catch (SecurityException e) {
   14.75 +            LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
   14.76 +            throw e;
   14.77 +        }
   14.78 +    }
   14.79 +
   14.80 +    /**
   14.81 +     * private constructor to avoid util class instantiating
   14.82 +     */
   14.83 +    private Utils() {
   14.84 +    }
   14.85 +}
    15.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/Navigator.java	Mon Jan 13 22:31:58 2014 -0800
    15.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/Navigator.java	Wed Jan 15 10:49:40 2014 -0800
    15.3 @@ -25,6 +25,10 @@
    15.4  
    15.5  package com.sun.xml.internal.bind.v2.model.nav;
    15.6  
    15.7 +import java.lang.reflect.Field;
    15.8 +import java.lang.reflect.Method;
    15.9 +import java.lang.reflect.Proxy;
   15.10 +import java.lang.reflect.Type;
   15.11  import java.util.Collection;
   15.12  
   15.13  import com.sun.xml.internal.bind.v2.runtime.Location;
   15.14 @@ -240,10 +244,6 @@
   15.15       */
   15.16      T getComponentType(T t);
   15.17  
   15.18 -
   15.19 -    /** The singleton instance. */
   15.20 -    public static final ReflectionNavigator REFLECTION = new ReflectionNavigator();
   15.21 -
   15.22      /**
   15.23       * Gets the i-th type argument from a parameterized type.
   15.24       *
   15.25 @@ -357,14 +357,14 @@
   15.26      String getPackageName(C clazz);
   15.27  
   15.28      /**
   15.29 -     * Finds the class/interface/enum/annotation of the given name.
   15.30 +     * Finds ObjectFactory for the given referencePoint.
   15.31       *
   15.32       * @param referencePoint
   15.33       *      The class that refers to the specified class.
   15.34       * @return
   15.35       *      null if not found.
   15.36       */
   15.37 -    C findClass(String className, C referencePoint);
   15.38 +    C loadObjectFactory(C referencePoint, String packageName);
   15.39  
   15.40      /**
   15.41       * Returns true if this method is a bridge method as defined in JLS.
    16.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java	Mon Jan 13 22:31:58 2014 -0800
    16.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java	Wed Jan 15 10:49:40 2014 -0800
    16.3 @@ -44,16 +44,19 @@
    16.4   * {@link Navigator} implementation for {@code java.lang.reflect}.
    16.5   *
    16.6   */
    16.7 -public final class ReflectionNavigator implements Navigator<Type, Class, Field, Method> {
    16.8 +/*package*/final class ReflectionNavigator implements Navigator<Type, Class, Field, Method> {
    16.9  
   16.10 -    /**
   16.11 -     * Singleton.
   16.12 -     *
   16.13 -     * Use {@link Navigator#REFLECTION}
   16.14 -     */
   16.15 -    ReflectionNavigator() {
   16.16 +//  ----------  Singleton -----------------
   16.17 +    private static final ReflectionNavigator INSTANCE = new ReflectionNavigator();
   16.18 +
   16.19 +    /*package*/static ReflectionNavigator getInstance() {
   16.20 +        return INSTANCE;
   16.21      }
   16.22  
   16.23 +    private ReflectionNavigator() {
   16.24 +    }
   16.25 +//  ---------------------------------------
   16.26 +
   16.27      public Class getSuperClass(Class clazz) {
   16.28          if (clazz == Object.class) {
   16.29              return null;
   16.30 @@ -64,6 +67,7 @@
   16.31          }
   16.32          return sc;
   16.33      }
   16.34 +
   16.35      private static final TypeVisitor<Type, Class> baseClassFinder = new TypeVisitor<Type, Class>() {
   16.36  
   16.37          public Type onClass(Class c, Class sup) {
   16.38 @@ -496,7 +500,7 @@
   16.39              c.getDeclaredConstructor();
   16.40              return true;
   16.41          } catch (NoSuchMethodException e) {
   16.42 -            return false;
   16.43 +            return false; // todo: do this WITHOUT exception throw
   16.44          }
   16.45      }
   16.46  
   16.47 @@ -544,13 +548,14 @@
   16.48          }
   16.49      }
   16.50  
   16.51 -    public Class findClass(String className, Class referencePoint) {
   16.52 +    @Override
   16.53 +    public Class loadObjectFactory(Class referencePoint, String pkg) {
   16.54 +        ClassLoader cl= SecureLoader.getClassClassLoader(referencePoint);
   16.55 +        if (cl == null)
   16.56 +            cl = SecureLoader.getSystemClassLoader();
   16.57 +
   16.58          try {
   16.59 -            ClassLoader cl = SecureLoader.getClassClassLoader(referencePoint);
   16.60 -            if (cl == null) {
   16.61 -                cl = SecureLoader.getSystemClassLoader();
   16.62 -            }
   16.63 -            return cl.loadClass(className);
   16.64 +            return cl.loadClass(pkg + ".ObjectFactory");
   16.65          } catch (ClassNotFoundException e) {
   16.66              return null;
   16.67          }
    17.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeTypeInfoSet.java	Mon Jan 13 22:31:58 2014 -0800
    17.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeTypeInfoSet.java	Wed Jan 15 10:49:40 2014 -0800
    17.3 @@ -33,7 +33,6 @@
    17.4  import javax.xml.namespace.QName;
    17.5  
    17.6  import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet;
    17.7 -import com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator;
    17.8  
    17.9  /**
   17.10   * {@link TypeInfoSet} refined for runtime.
   17.11 @@ -51,5 +50,4 @@
   17.12      RuntimeElementInfo getElementInfo( Class scope, QName name );
   17.13      Map<QName,? extends RuntimeElementInfo> getElementMappings( Class scope );
   17.14      Iterable<? extends RuntimeElementInfo> getAllElements();
   17.15 -    ReflectionNavigator getNavigator();
   17.16  }
    18.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ClassBeanInfoImpl.java	Mon Jan 13 22:31:58 2014 -0800
    18.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ClassBeanInfoImpl.java	Wed Jan 15 10:49:40 2014 -0800
    18.3 @@ -48,7 +48,6 @@
    18.4  import com.sun.xml.internal.bind.v2.ClassFactory;
    18.5  import com.sun.xml.internal.bind.v2.WellKnownNamespace;
    18.6  import com.sun.xml.internal.bind.v2.model.core.ID;
    18.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    18.8  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo;
    18.9  import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo;
   18.10  import com.sun.xml.internal.bind.v2.runtime.property.AttributeProperty;
   18.11 @@ -347,7 +346,7 @@
   18.12                  } else if (isThereAnOverridingProperty) {
   18.13                      // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
   18.14                      Class beanClass = bean.getClass();
   18.15 -                    if (Navigator.REFLECTION.getDeclaredField(beanClass, p.getFieldName()) == null) {
   18.16 +                    if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) {
   18.17                          p.serializeBody(bean, target, null);
   18.18                      }
   18.19                  }
    19.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java	Mon Jan 13 22:31:58 2014 -0800
    19.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java	Wed Jan 15 10:49:40 2014 -0800
    19.3 @@ -36,7 +36,6 @@
    19.4  
    19.5  import com.sun.xml.internal.bind.api.AccessorException;
    19.6  import com.sun.xml.internal.bind.v2.model.core.PropertyKind;
    19.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    19.8  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementInfo;
    19.9  import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo;
   19.10  import com.sun.xml.internal.bind.v2.runtime.property.Property;
   19.11 @@ -81,10 +80,10 @@
   19.12          this.property = PropertyFactory.create(grammar,rei.getProperty());
   19.13  
   19.14          tagName = rei.getElementName();
   19.15 -        expectedType = Navigator.REFLECTION.erasure(rei.getContentInMemoryType());
   19.16 +        expectedType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(rei.getContentInMemoryType());
   19.17          scope = rei.getScope()==null ? JAXBElement.GlobalScope.class : rei.getScope().getClazz();
   19.18  
   19.19 -        Class type = Navigator.REFLECTION.erasure(rei.getType());
   19.20 +        Class type = (Class) Utils.REFLECTION_NAVIGATOR.erasure(rei.getType());
   19.21          if(type==JAXBElement.class)
   19.22              constructor = null;
   19.23          else {
    20.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java	Mon Jan 13 22:31:58 2014 -0800
    20.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java	Wed Jan 15 10:49:40 2014 -0800
    20.3 @@ -65,7 +65,6 @@
    20.4  import javax.xml.transform.Transformer;
    20.5  import javax.xml.transform.TransformerConfigurationException;
    20.6  import javax.xml.transform.TransformerFactory;
    20.7 -import javax.xml.transform.sax.SAXResult;
    20.8  import javax.xml.transform.sax.SAXTransformerFactory;
    20.9  import javax.xml.transform.sax.TransformerHandler;
   20.10  
   20.11 @@ -90,7 +89,6 @@
   20.12  import com.sun.xml.internal.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl;
   20.13  import com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder;
   20.14  import com.sun.xml.internal.bind.v2.model.nav.Navigator;
   20.15 -import com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator;
   20.16  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeArrayInfo;
   20.17  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeBuiltinLeafInfo;
   20.18  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo;
   20.19 @@ -118,7 +116,6 @@
   20.20  import org.w3c.dom.Node;
   20.21  import org.xml.sax.SAXException;
   20.22  import org.xml.sax.SAXParseException;
   20.23 -import org.xml.sax.helpers.DefaultHandler;
   20.24  
   20.25  /**
   20.26   * This class provides the implementation of JAXBContext.
   20.27 @@ -363,7 +360,7 @@
   20.28              beanInfoMap.put( e.getKey(), beanInfoMap.get(e.getValue()) );
   20.29  
   20.30          // build bridges
   20.31 -        ReflectionNavigator nav = typeSet.getNavigator();
   20.32 +        Navigator<Type, Class, Field, Method> nav = typeSet.getNavigator();
   20.33  
   20.34          for (TypeReference tr : typeRefs) {
   20.35              XmlJavaTypeAdapter xjta = tr.get(XmlJavaTypeAdapter.class);
   20.36 @@ -371,7 +368,7 @@
   20.37              XmlList xl = tr.get(XmlList.class);
   20.38  
   20.39              // eventually compute the in-memory type
   20.40 -            Class erasedType = nav.erasure(tr.type);
   20.41 +            Class erasedType = (Class) nav.erasure(tr.type);
   20.42  
   20.43              if(xjta!=null) {
   20.44                  a = new Adapter<Type,Class>(xjta.value(),nav);
   20.45 @@ -382,7 +379,7 @@
   20.46              }
   20.47  
   20.48              if(a!=null) {
   20.49 -                erasedType = nav.erasure(a.defaultType);
   20.50 +                erasedType = (Class) nav.erasure(a.defaultType);
   20.51              }
   20.52  
   20.53              Name name = nameBuilder.createElementName(tr.tagName);
   20.54 @@ -877,7 +874,7 @@
   20.55                  // this is a special class we introduced for JAX-WS that we *don't* want in the schema
   20.56              } else {
   20.57                  NonElement<Type,Class> typeInfo = getXmlType(tis,tr);
   20.58 -                xsdgen.add(tr.tagName, !Navigator.REFLECTION.isPrimitive(tr.type),typeInfo);
   20.59 +                xsdgen.add(tr.tagName, !tis.getNavigator().isPrimitive(tr.type),typeInfo);
   20.60              }
   20.61          }
   20.62          return xsdgen;
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java	Wed Jan 15 10:49:40 2014 -0800
    21.3 @@ -0,0 +1,82 @@
    21.4 +/*
    21.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 + *
    21.8 + * This code is free software; you can redistribute it and/or modify it
    21.9 + * under the terms of the GNU General Public License version 2 only, as
   21.10 + * published by the Free Software Foundation.  Oracle designates this
   21.11 + * particular file as subject to the "Classpath" exception as provided
   21.12 + * by Oracle in the LICENSE file that accompanied this code.
   21.13 + *
   21.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   21.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.17 + * version 2 for more details (a copy is included in the LICENSE file that
   21.18 + * accompanied this code).
   21.19 + *
   21.20 + * You should have received a copy of the GNU General Public License version
   21.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   21.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.23 + *
   21.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   21.25 + * or visit www.oracle.com if you need additional information or have any
   21.26 + * questions.
   21.27 + */
   21.28 +
   21.29 +package com.sun.xml.internal.bind.v2.runtime;
   21.30 +
   21.31 +import com.sun.xml.internal.bind.v2.model.nav.Navigator;
   21.32 +
   21.33 +import java.lang.reflect.Field;
   21.34 +import java.lang.reflect.InvocationTargetException;
   21.35 +import java.lang.reflect.Method;
   21.36 +import java.lang.reflect.Type;
   21.37 +import java.util.logging.Level;
   21.38 +import java.util.logging.Logger;
   21.39 +
   21.40 +/**
   21.41 + * Utils class.
   21.42 + * Has *package private* access to avoid inappropriate usage.
   21.43 + */
   21.44 +/* package */ final class Utils {
   21.45 +
   21.46 +    private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
   21.47 +
   21.48 +    /**
   21.49 +     * static ReflectionNavigator field to avoid usage of reflection every time we use it.
   21.50 +     */
   21.51 +    /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
   21.52 +
   21.53 +    static { // we statically initializing REFLECTION_NAVIGATOR property
   21.54 +        Class refNav = null;
   21.55 +        try {
   21.56 +            refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
   21.57 +            //noinspection unchecked
   21.58 +            Method getInstance = refNav.getDeclaredMethod("getInstance");
   21.59 +            getInstance.setAccessible(true);
   21.60 +            //noinspection unchecked
   21.61 +            REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
   21.62 +        } catch (ClassNotFoundException e) {
   21.63 +            e.printStackTrace();
   21.64 +            throw new IllegalStateException("Can't find ReflectionNavigator class");
   21.65 +        } catch (InvocationTargetException e) {
   21.66 +            e.printStackTrace();
   21.67 +            throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception");
   21.68 +        } catch (NoSuchMethodException e) {
   21.69 +            e.printStackTrace();
   21.70 +            throw new IllegalStateException("ReflectionNavigator.getInstance can't be found");
   21.71 +        } catch (IllegalAccessException e) {
   21.72 +            e.printStackTrace();
   21.73 +            throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible");
   21.74 +        } catch (SecurityException e) {
   21.75 +            LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
   21.76 +            throw e;
   21.77 +        }
   21.78 +    }
   21.79 +
   21.80 +    /**
   21.81 +     * private constructor to avoid util class instantiating
   21.82 +     */
   21.83 +    private Utils() {
   21.84 +    }
   21.85 +}
    22.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayProperty.java	Mon Jan 13 22:31:58 2014 -0800
    22.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayProperty.java	Wed Jan 15 10:49:40 2014 -0800
    22.3 @@ -27,7 +27,6 @@
    22.4  
    22.5  
    22.6  import com.sun.xml.internal.bind.api.AccessorException;
    22.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    22.8  import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo;
    22.9  import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
   22.10  import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor;
   22.11 @@ -49,7 +48,7 @@
   22.12  
   22.13          assert prop.isCollection();
   22.14          lister = Lister.create(
   22.15 -            Navigator.REFLECTION.erasure(prop.getRawType()),prop.id(),prop.getAdapter());
   22.16 +            Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()),prop.id(),prop.getAdapter());
   22.17          assert lister!=null;
   22.18          acc = prop.getAccessor().optimize(context);
   22.19          assert acc!=null;
    23.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Mon Jan 13 22:31:58 2014 -0800
    23.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Wed Jan 15 10:49:40 2014 -0800
    23.3 @@ -42,7 +42,6 @@
    23.4  import com.sun.xml.internal.bind.v2.ClassFactory;
    23.5  import com.sun.xml.internal.bind.v2.util.QNameMap;
    23.6  import com.sun.xml.internal.bind.v2.model.core.PropertyKind;
    23.7 -import com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator;
    23.8  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeMapPropertyInfo;
    23.9  import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
   23.10  import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo;
   23.11 @@ -98,7 +97,8 @@
   23.12          this.valueBeanInfo = context.getOrCreate(prop.getValueType());
   23.13  
   23.14          // infer the implementation class
   23.15 -        Class<ValueT> sig = ReflectionNavigator.REFLECTION.erasure(prop.getRawType());
   23.16 +        //noinspection unchecked
   23.17 +        Class<ValueT> sig = (Class<ValueT>) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType());
   23.18          mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses);
   23.19          // TODO: error check for mapImplClass==null
   23.20          // what is the error reporting path for this part of the code?
   23.21 @@ -140,23 +140,22 @@
   23.22       */
   23.23      private final Loader itemsLoader = new Loader(false) {
   23.24  
   23.25 -        private ThreadLocal<Stack<BeanT>> target = new ThreadLocal<Stack<BeanT>>();
   23.26 -        private ThreadLocal<Stack<ValueT>> map = new ThreadLocal<Stack<ValueT>>();
   23.27 +        private ThreadLocal<BeanT> target = new ThreadLocal<BeanT>();
   23.28 +        private ThreadLocal<ValueT> map = new ThreadLocal<ValueT>();
   23.29 +        private int depthCounter = 0; // needed to clean ThreadLocals
   23.30  
   23.31          @Override
   23.32          public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
   23.33              // create or obtain the Map object
   23.34              try {
   23.35 -                BeanT target = (BeanT) state.prev.target;
   23.36 -                ValueT mapValue = acc.get(target);
   23.37 -                if(mapValue == null)
   23.38 -                    mapValue = ClassFactory.create(mapImplClass);
   23.39 -                else
   23.40 -                    mapValue.clear();
   23.41 -
   23.42 -                Stack.push(this.target, target);
   23.43 -                Stack.push(map, mapValue);
   23.44 -                state.target = mapValue;
   23.45 +                target.set((BeanT)state.prev.target);
   23.46 +                map.set(acc.get(target.get()));
   23.47 +                depthCounter++;
   23.48 +                if(map.get() == null) {
   23.49 +                    map.set(ClassFactory.create(mapImplClass));
   23.50 +                }
   23.51 +                map.get().clear();
   23.52 +                state.target = map.get();
   23.53              } catch (AccessorException e) {
   23.54                  // recover from error by setting a dummy Map that receives and discards the values
   23.55                  handleGenericException(e,true);
   23.56 @@ -168,7 +167,11 @@
   23.57          public void leaveElement(State state, TagName ea) throws SAXException {
   23.58              super.leaveElement(state, ea);
   23.59              try {
   23.60 -                acc.set(Stack.pop(target), Stack.pop(map));
   23.61 +                acc.set(target.get(), map.get());
   23.62 +                if (--depthCounter == 0) {
   23.63 +                    target.remove();
   23.64 +                    map.remove();
   23.65 +                }
   23.66              } catch (AccessorException ex) {
   23.67                  handleGenericException(ex,true);
   23.68              }
   23.69 @@ -286,36 +289,4 @@
   23.70              return acc;
   23.71          return null;
   23.72      }
   23.73 -
   23.74 -    private static final class Stack<T> {
   23.75 -        private Stack<T> parent;
   23.76 -        private T value;
   23.77 -
   23.78 -        private Stack(Stack<T> parent, T value) {
   23.79 -            this.parent = parent;
   23.80 -            this.value = value;
   23.81 -        }
   23.82 -
   23.83 -        private Stack(T value) {
   23.84 -            this.value = value;
   23.85 -        }
   23.86 -
   23.87 -        private static <T> void push(ThreadLocal<Stack<T>> holder, T value) {
   23.88 -            Stack<T> parent = holder.get();
   23.89 -            if (parent == null)
   23.90 -                holder.set(new Stack<T>(value));
   23.91 -            else
   23.92 -                holder.set(new Stack<T>(parent, value));
   23.93 -        }
   23.94 -
   23.95 -        private static <T> T pop(ThreadLocal<Stack<T>> holder) {
   23.96 -            Stack<T> current = holder.get();
   23.97 -            if (current.parent == null)
   23.98 -                holder.remove();
   23.99 -            else
  23.100 -                holder.set(current.parent);
  23.101 -            return current.value;
  23.102 -        }
  23.103 -
  23.104 -    }
  23.105  }
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java	Wed Jan 15 10:49:40 2014 -0800
    24.3 @@ -0,0 +1,82 @@
    24.4 +/*
    24.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    24.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.7 + *
    24.8 + * This code is free software; you can redistribute it and/or modify it
    24.9 + * under the terms of the GNU General Public License version 2 only, as
   24.10 + * published by the Free Software Foundation.  Oracle designates this
   24.11 + * particular file as subject to the "Classpath" exception as provided
   24.12 + * by Oracle in the LICENSE file that accompanied this code.
   24.13 + *
   24.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   24.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   24.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   24.17 + * version 2 for more details (a copy is included in the LICENSE file that
   24.18 + * accompanied this code).
   24.19 + *
   24.20 + * You should have received a copy of the GNU General Public License version
   24.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   24.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   24.23 + *
   24.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   24.25 + * or visit www.oracle.com if you need additional information or have any
   24.26 + * questions.
   24.27 + */
   24.28 +
   24.29 +package com.sun.xml.internal.bind.v2.runtime.property;
   24.30 +
   24.31 +import com.sun.xml.internal.bind.v2.model.nav.Navigator;
   24.32 +
   24.33 +import java.lang.reflect.Field;
   24.34 +import java.lang.reflect.InvocationTargetException;
   24.35 +import java.lang.reflect.Method;
   24.36 +import java.lang.reflect.Type;
   24.37 +import java.util.logging.Level;
   24.38 +import java.util.logging.Logger;
   24.39 +
   24.40 +/**
   24.41 + * Utils class.
   24.42 + * Has *package private* access to avoid inappropriate usage.
   24.43 + */
   24.44 +/* package */ final class Utils {
   24.45 +
   24.46 +    private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
   24.47 +
   24.48 +    /**
   24.49 +     * static ReflectionNavigator field to avoid usage of reflection every time we use it.
   24.50 +     */
   24.51 +    /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
   24.52 +
   24.53 +    static { // we statically initializing REFLECTION_NAVIGATOR property
   24.54 +        Class refNav = null;
   24.55 +        try {
   24.56 +            refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
   24.57 +            //noinspection unchecked
   24.58 +            Method getInstance = refNav.getDeclaredMethod("getInstance");
   24.59 +            getInstance.setAccessible(true);
   24.60 +            //noinspection unchecked
   24.61 +            REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
   24.62 +        } catch (ClassNotFoundException e) {
   24.63 +            e.printStackTrace();
   24.64 +            throw new IllegalStateException("Can't find ReflectionNavigator class");
   24.65 +        } catch (InvocationTargetException e) {
   24.66 +            e.printStackTrace();
   24.67 +            throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception");
   24.68 +        } catch (NoSuchMethodException e) {
   24.69 +            e.printStackTrace();
   24.70 +            throw new IllegalStateException("ReflectionNavigator.getInstance can't be found");
   24.71 +        } catch (IllegalAccessException e) {
   24.72 +            e.printStackTrace();
   24.73 +            throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible");
   24.74 +        } catch (SecurityException e) {
   24.75 +            LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
   24.76 +            throw e;
   24.77 +        }
   24.78 +    }
   24.79 +
   24.80 +    /**
   24.81 +     * private constructor to avoid util class instantiating
   24.82 +     */
   24.83 +    private Utils() {
   24.84 +    }
   24.85 +}
    25.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java	Mon Jan 13 22:31:58 2014 -0800
    25.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java	Wed Jan 15 10:49:40 2014 -0800
    25.3 @@ -46,7 +46,6 @@
    25.4  import com.sun.xml.internal.bind.api.JAXBRIContext;
    25.5  import com.sun.xml.internal.bind.v2.model.core.Adapter;
    25.6  import com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder;
    25.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    25.8  import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
    25.9  import com.sun.xml.internal.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory;
   25.10  import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader;
   25.11 @@ -198,7 +197,7 @@
   25.12  
   25.13      public final <T> Accessor<BeanT, T> adapt(Adapter<Type, Class> adapter) {
   25.14          return new AdaptedAccessor<BeanT, ValueT, T>(
   25.15 -                (Class<T>) Navigator.REFLECTION.erasure(adapter.defaultType),
   25.16 +                (Class<T>) Utils.REFLECTION_NAVIGATOR.erasure(adapter.defaultType),
   25.17                  this,
   25.18                  adapter.adapterType);
   25.19      }
    26.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Lister.java	Mon Jan 13 22:31:58 2014 -0800
    26.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Lister.java	Wed Jan 15 10:49:40 2014 -0800
    26.3 @@ -51,7 +51,6 @@
    26.4  import com.sun.xml.internal.bind.v2.TODO;
    26.5  import com.sun.xml.internal.bind.v2.model.core.Adapter;
    26.6  import com.sun.xml.internal.bind.v2.model.core.ID;
    26.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    26.8  import com.sun.xml.internal.bind.v2.runtime.XMLSerializer;
    26.9  import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Patcher;
   26.10  import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext;
   26.11 @@ -116,7 +115,7 @@
   26.12      public static <BeanT,PropT,ItemT,PackT>
   26.13          Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) {
   26.14  
   26.15 -        Class rawType = Navigator.REFLECTION.erasure(fieldType);
   26.16 +        Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType);
   26.17          Class itemType;
   26.18  
   26.19          Lister l;
   26.20 @@ -125,9 +124,9 @@
   26.21              l = getArrayLister(itemType);
   26.22          } else
   26.23          if( Collection.class.isAssignableFrom(rawType) ) {
   26.24 -            Type bt = Navigator.REFLECTION.getBaseClass(fieldType,Collection.class);
   26.25 +            Type bt = Utils.REFLECTION_NAVIGATOR.getBaseClass(fieldType,Collection.class);
   26.26              if(bt instanceof ParameterizedType)
   26.27 -                itemType = Navigator.REFLECTION.erasure(((ParameterizedType)bt).getActualTypeArguments()[0]);
   26.28 +                itemType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)bt).getActualTypeArguments()[0]);
   26.29              else
   26.30                  itemType = Object.class;
   26.31              l = new CollectionLister(getImplClass(rawType));
    27.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/TransducedAccessor.java	Mon Jan 13 22:31:58 2014 -0800
    27.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/TransducedAccessor.java	Wed Jan 15 10:49:40 2014 -0800
    27.3 @@ -39,7 +39,6 @@
    27.4  import com.sun.xml.internal.bind.api.AccessorException;
    27.5  import com.sun.xml.internal.bind.v2.model.core.ID;
    27.6  import com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder;
    27.7 -import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    27.8  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElementRef;
    27.9  import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo;
   27.10  import com.sun.xml.internal.bind.v2.runtime.Name;
   27.11 @@ -144,8 +143,7 @@
   27.12  
   27.13          if(prop.isCollection()) {
   27.14              return new ListTransducedAccessorImpl(xducer,prop.getAccessor(),
   27.15 -                    Lister.create(Navigator.REFLECTION.erasure(prop.getRawType()),prop.id(),
   27.16 -                    prop.getAdapter()));
   27.17 +                    Lister.create(Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()), prop.id(), prop.getAdapter()));
   27.18          }
   27.19  
   27.20          if(prop.id()==ID.IDREF)
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java	Wed Jan 15 10:49:40 2014 -0800
    28.3 @@ -0,0 +1,82 @@
    28.4 +/*
    28.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.7 + *
    28.8 + * This code is free software; you can redistribute it and/or modify it
    28.9 + * under the terms of the GNU General Public License version 2 only, as
   28.10 + * published by the Free Software Foundation.  Oracle designates this
   28.11 + * particular file as subject to the "Classpath" exception as provided
   28.12 + * by Oracle in the LICENSE file that accompanied this code.
   28.13 + *
   28.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   28.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   28.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   28.17 + * version 2 for more details (a copy is included in the LICENSE file that
   28.18 + * accompanied this code).
   28.19 + *
   28.20 + * You should have received a copy of the GNU General Public License version
   28.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   28.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   28.23 + *
   28.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   28.25 + * or visit www.oracle.com if you need additional information or have any
   28.26 + * questions.
   28.27 + */
   28.28 +
   28.29 +package com.sun.xml.internal.bind.v2.runtime.reflect;
   28.30 +
   28.31 +import com.sun.xml.internal.bind.v2.model.nav.Navigator;
   28.32 +
   28.33 +import java.lang.reflect.Field;
   28.34 +import java.lang.reflect.InvocationTargetException;
   28.35 +import java.lang.reflect.Method;
   28.36 +import java.lang.reflect.Type;
   28.37 +import java.util.logging.Level;
   28.38 +import java.util.logging.Logger;
   28.39 +
   28.40 +/**
   28.41 + * Utils class.
   28.42 + * Has *package private* access to avoid inappropriate usage.
   28.43 + */
   28.44 +/* package */ final class Utils {
   28.45 +
   28.46 +    private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
   28.47 +
   28.48 +    /**
   28.49 +     * static ReflectionNavigator field to avoid usage of reflection every time we use it.
   28.50 +     */
   28.51 +    /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
   28.52 +
   28.53 +    static { // we statically initializing REFLECTION_NAVIGATOR property
   28.54 +        Class refNav = null;
   28.55 +        try {
   28.56 +            refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
   28.57 +            //noinspection unchecked
   28.58 +            Method getInstance = refNav.getDeclaredMethod("getInstance");
   28.59 +            getInstance.setAccessible(true);
   28.60 +            //noinspection unchecked
   28.61 +            REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
   28.62 +        } catch (ClassNotFoundException e) {
   28.63 +            e.printStackTrace();
   28.64 +            throw new IllegalStateException("Can't find ReflectionNavigator class");
   28.65 +        } catch (InvocationTargetException e) {
   28.66 +            e.printStackTrace();
   28.67 +            throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception");
   28.68 +        } catch (NoSuchMethodException e) {
   28.69 +            e.printStackTrace();
   28.70 +            throw new IllegalStateException("ReflectionNavigator.getInstance can't be found");
   28.71 +        } catch (IllegalAccessException e) {
   28.72 +            e.printStackTrace();
   28.73 +            throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible");
   28.74 +        } catch (SecurityException e) {
   28.75 +            LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
   28.76 +            throw e;
   28.77 +        }
   28.78 +    }
   28.79 +
   28.80 +    /**
   28.81 +     * private constructor to avoid util class instantiating
   28.82 +     */
   28.83 +    private Utils() {
   28.84 +    }
   28.85 +}
    29.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java	Mon Jan 13 22:31:58 2014 -0800
    29.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java	Wed Jan 15 10:49:40 2014 -0800
    29.3 @@ -1,5 +1,5 @@
    29.4  /*
    29.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    29.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    29.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.8   *
    29.9   * This code is free software; you can redistribute it and/or modify it
   29.10 @@ -58,6 +58,12 @@
   29.11  import java.lang.reflect.Constructor;
   29.12  import java.lang.reflect.Field;
   29.13  import java.lang.reflect.Method;
   29.14 +import java.lang.reflect.ReflectPermission;
   29.15 +import java.security.AccessControlContext;
   29.16 +import java.security.AccessController;
   29.17 +import java.security.Permissions;
   29.18 +import java.security.PrivilegedAction;
   29.19 +import java.security.ProtectionDomain;
   29.20  import java.util.Iterator;
   29.21  import java.util.Map;
   29.22  import java.util.logging.Level;
   29.23 @@ -556,11 +562,40 @@
   29.24              // ignore
   29.25          }
   29.26          captureStackTrace = tmpVal;
   29.27 +        JAXB_CONTEXT = createJAXBContext();
   29.28 +    }
   29.29  
   29.30 -        try {
   29.31 -            JAXB_CONTEXT = JAXBContext.newInstance(SOAP11Fault.class, SOAP12Fault.class);
   29.32 -        } catch (JAXBException e) {
   29.33 -            throw new Error(e); // this must be a bug in our code
   29.34 +    private static JAXBContext createJAXBContext() {
   29.35 +
   29.36 +        // in jdk runtime doPrivileged is necessary since JAX-WS internal classes are in restricted packages
   29.37 +        if (isJDKRuntime()) {
   29.38 +            Permissions permissions = new Permissions();
   29.39 +            permissions.add(new RuntimePermission("accessClassInPackage.com.sun." + "xml.internal.ws.fault"));
   29.40 +            permissions.add(new ReflectPermission("suppressAccessChecks"));
   29.41 +            return AccessController.doPrivileged(
   29.42 +                    new PrivilegedAction<JAXBContext>() {
   29.43 +                        @Override
   29.44 +                        public JAXBContext run() {
   29.45 +                            try {
   29.46 +                                return JAXBContext.newInstance(SOAP11Fault.class, SOAP12Fault.class);
   29.47 +                            } catch (JAXBException e) {
   29.48 +                                throw new Error(e);
   29.49 +                            }
   29.50 +                        }
   29.51 +                    },
   29.52 +                    new AccessControlContext(new ProtectionDomain[]{new ProtectionDomain(null, permissions)})
   29.53 +            );
   29.54 +
   29.55 +        } else {
   29.56 +            try {
   29.57 +                return JAXBContext.newInstance(SOAP11Fault.class, SOAP12Fault.class);
   29.58 +            } catch (JAXBException e) {
   29.59 +                throw new Error(e);
   29.60 +            }
   29.61          }
   29.62      }
   29.63 +
   29.64 +    private static boolean isJDKRuntime() {
   29.65 +        return SOAPFaultBuilder.class.getName().contains("internal");
   29.66 +    }
   29.67  }
    30.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/RuntimeModeler.java	Mon Jan 13 22:31:58 2014 -0800
    30.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/RuntimeModeler.java	Wed Jan 15 10:49:40 2014 -0800
    30.3 @@ -45,7 +45,6 @@
    30.4  import com.sun.xml.internal.ws.resources.ModelerMessages;
    30.5  import com.sun.xml.internal.ws.resources.ServerMessages;
    30.6  import com.sun.xml.internal.ws.spi.db.BindingContext;
    30.7 -import com.sun.xml.internal.ws.spi.db.BindingHelper;
    30.8  import com.sun.xml.internal.ws.spi.db.TypeInfo;
    30.9  import com.sun.xml.internal.ws.spi.db.WrapperComposite;
   30.10  
   30.11 @@ -886,7 +885,7 @@
   30.12              //set the actual type argument of Holder in the TypeReference
   30.13              if (isHolder) {
   30.14                  if(clazzType==Holder.class){
   30.15 -                    clazzType = BindingHelper.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
   30.16 +                    clazzType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
   30.17                  }
   30.18              }
   30.19              Mode paramMode = isHolder ? Mode.INOUT : Mode.IN;
   30.20 @@ -1101,7 +1100,7 @@
   30.21              //set the actual type argument of Holder in the TypeReference
   30.22              if (isHolder) {
   30.23                  if (clazzType==Holder.class)
   30.24 -                    clazzType = BindingHelper.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
   30.25 +                    clazzType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
   30.26              }
   30.27              Mode paramMode = isHolder ? Mode.INOUT : Mode.IN;
   30.28              for (Annotation annotation : pannotations[pos]) {
   30.29 @@ -1347,7 +1346,7 @@
   30.30              //set the actual type argument of Holder in the TypeReference
   30.31              if (isHolder) {
   30.32                  if (clazzType==Holder.class)
   30.33 -                    clazzType = BindingHelper.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
   30.34 +                    clazzType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
   30.35              }
   30.36  
   30.37              Mode paramMode = isHolder ? Mode.INOUT : Mode.IN;
   30.38 @@ -1435,14 +1434,14 @@
   30.39      private Class getAsyncReturnType(Method method, Class returnType) {
   30.40          if(Response.class.isAssignableFrom(returnType)){
   30.41              Type ret = method.getGenericReturnType();
   30.42 -            return BindingHelper.erasure(((ParameterizedType)ret).getActualTypeArguments()[0]);
   30.43 +            return (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)ret).getActualTypeArguments()[0]);
   30.44          }else{
   30.45              Type[] types = method.getGenericParameterTypes();
   30.46              Class[] params = method.getParameterTypes();
   30.47              int i = 0;
   30.48              for(Class cls : params){
   30.49                  if(AsyncHandler.class.isAssignableFrom(cls)){
   30.50 -                    return BindingHelper.erasure(((ParameterizedType)types[i]).getActualTypeArguments()[0]);
   30.51 +                    return (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)types[i]).getActualTypeArguments()[0]);
   30.52                  }
   30.53                  i++;
   30.54              }
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java	Wed Jan 15 10:49:40 2014 -0800
    31.3 @@ -0,0 +1,85 @@
    31.4 +/*
    31.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.7 + *
    31.8 + * This code is free software; you can redistribute it and/or modify it
    31.9 + * under the terms of the GNU General Public License version 2 only, as
   31.10 + * published by the Free Software Foundation.  Oracle designates this
   31.11 + * particular file as subject to the "Classpath" exception as provided
   31.12 + * by Oracle in the LICENSE file that accompanied this code.
   31.13 + *
   31.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   31.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   31.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   31.17 + * version 2 for more details (a copy is included in the LICENSE file that
   31.18 + * accompanied this code).
   31.19 + *
   31.20 + * You should have received a copy of the GNU General Public License version
   31.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   31.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   31.23 + *
   31.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   31.25 + * or visit www.oracle.com if you need additional information or have any
   31.26 + * questions.
   31.27 + */
   31.28 +
   31.29 +package com.sun.xml.internal.ws.model;
   31.30 +
   31.31 +import com.sun.xml.internal.bind.v2.model.nav.Navigator;
   31.32 +
   31.33 +import java.lang.reflect.Field;
   31.34 +import java.lang.reflect.InvocationTargetException;
   31.35 +import java.lang.reflect.Method;
   31.36 +import java.lang.reflect.Type;
   31.37 +import java.util.logging.Level;
   31.38 +import java.util.logging.Logger;
   31.39 +
   31.40 +/**
   31.41 + * Utils class.
   31.42 + *
   31.43 + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages.
   31.44 + *
   31.45 + * Has *package private* access to avoid inappropriate usage.
   31.46 + */
   31.47 +/* package */ final class Utils {
   31.48 +
   31.49 +    private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
   31.50 +
   31.51 +    /**
   31.52 +     * static ReflectionNavigator field to avoid usage of reflection every time we use it.
   31.53 +     */
   31.54 +    /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
   31.55 +
   31.56 +    static { // we statically initializing REFLECTION_NAVIGATOR property
   31.57 +        Class refNav = null;
   31.58 +        try {
   31.59 +            refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
   31.60 +            //noinspection unchecked
   31.61 +            Method getInstance = refNav.getDeclaredMethod("getInstance");
   31.62 +            getInstance.setAccessible(true);
   31.63 +            //noinspection unchecked
   31.64 +            REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
   31.65 +        } catch (ClassNotFoundException e) {
   31.66 +            e.printStackTrace();
   31.67 +            throw new IllegalStateException("Can't find ReflectionNavigator class");
   31.68 +        } catch (InvocationTargetException e) {
   31.69 +            e.printStackTrace();
   31.70 +            throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception");
   31.71 +        } catch (NoSuchMethodException e) {
   31.72 +            e.printStackTrace();
   31.73 +            throw new IllegalStateException("ReflectionNavigator.getInstance can't be found");
   31.74 +        } catch (IllegalAccessException e) {
   31.75 +            e.printStackTrace();
   31.76 +            throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible");
   31.77 +        } catch (SecurityException e) {
   31.78 +            LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
   31.79 +            throw e;
   31.80 +        }
   31.81 +    }
   31.82 +
   31.83 +    /**
   31.84 +     * private constructor to avoid util class instantiating
   31.85 +     */
   31.86 +    private Utils() {
   31.87 +    }
   31.88 +}
    32.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/WrapperBeanGenerator.java	Mon Jan 13 22:31:58 2014 -0800
    32.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/WrapperBeanGenerator.java	Wed Jan 15 10:49:40 2014 -0800
    32.3 @@ -61,7 +61,7 @@
    32.4  
    32.5      private static final AbstractWrapperBeanGenerator RUNTIME_GENERATOR =
    32.6              new RuntimeWrapperBeanGenerator(new RuntimeInlineAnnotationReader(),
    32.7 -                    Navigator.REFLECTION, FIELD_FACTORY);
    32.8 +                    (Navigator<java.lang.reflect.Type, Class, ?, Method>) Utils.REFLECTION_NAVIGATOR, FIELD_FACTORY);
    32.9  
   32.10      private static final class RuntimeWrapperBeanGenerator extends AbstractWrapperBeanGenerator<java.lang.reflect.Type, Class, java.lang.reflect.Method, Field> {
   32.11  
    33.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java	Mon Jan 13 22:31:58 2014 -0800
    33.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java	Wed Jan 15 10:49:40 2014 -0800
    33.3 @@ -136,10 +136,10 @@
    33.4       * @since 2.0 FCS
    33.5       */
    33.6      public static @Nullable Type getBaseType(@NotNull Type type, @NotNull Class baseType) {
    33.7 -        return Navigator.REFLECTION.getBaseClass(type,baseType);
    33.8 +        return Utils.REFLECTION_NAVIGATOR.getBaseClass(type,baseType);
    33.9      }
   33.10  
   33.11      public static <T> Class<T> erasure(Type t) {
   33.12 -        return Navigator.REFLECTION.erasure(t);
   33.13 +        return (Class<T>) Utils.REFLECTION_NAVIGATOR.erasure(t);
   33.14      }
   33.15  }
    34.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java	Mon Jan 13 22:31:58 2014 -0800
    34.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java	Wed Jan 15 10:49:40 2014 -0800
    34.3 @@ -119,12 +119,11 @@
    34.4          // if we are to reinstitute this check, check JAXB annotations only
    34.5          // assert annotations.length==0;   // not designed to work with adapters.
    34.6          Type t = (genericType != null)? genericType : type;
    34.7 -        Type base = Navigator.REFLECTION.getBaseClass(t, Collection.class);
    34.8 +        Type base = Utils.REFLECTION_NAVIGATOR.getBaseClass(t, Collection.class);
    34.9          if(base==null)
   34.10              return this;    // not a collection
   34.11  
   34.12 -        return new TypeInfo(tagName,
   34.13 -            Navigator.REFLECTION.getTypeArgument(base,0));
   34.14 +        return new TypeInfo(tagName, Utils.REFLECTION_NAVIGATOR.getTypeArgument(base,0));
   34.15      }
   34.16  
   34.17      public Map<String, Object> properties() {
   34.18 @@ -188,9 +187,9 @@
   34.19          }
   34.20  //        if (type instanceof Class && java.util.Collection.class.isAssignableFrom((Class)type)) {
   34.21          Type t = (genericType != null)? genericType : type;
   34.22 -        Type base = Navigator.REFLECTION.getBaseClass(t, Collection.class);
   34.23 +        Type base = Utils.REFLECTION_NAVIGATOR.getBaseClass(t, Collection.class);
   34.24          if ( base != null)  {
   34.25 -            return new TypeInfo(tagName, Navigator.REFLECTION.getTypeArgument(base,0), annotations);
   34.26 +            return new TypeInfo(tagName, Utils.REFLECTION_NAVIGATOR.getTypeArgument(base,0), annotations);
   34.27          }
   34.28          return null;
   34.29      }
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java	Wed Jan 15 10:49:40 2014 -0800
    35.3 @@ -0,0 +1,85 @@
    35.4 +/*
    35.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    35.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.7 + *
    35.8 + * This code is free software; you can redistribute it and/or modify it
    35.9 + * under the terms of the GNU General Public License version 2 only, as
   35.10 + * published by the Free Software Foundation.  Oracle designates this
   35.11 + * particular file as subject to the "Classpath" exception as provided
   35.12 + * by Oracle in the LICENSE file that accompanied this code.
   35.13 + *
   35.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   35.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   35.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   35.17 + * version 2 for more details (a copy is included in the LICENSE file that
   35.18 + * accompanied this code).
   35.19 + *
   35.20 + * You should have received a copy of the GNU General Public License version
   35.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   35.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   35.23 + *
   35.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   35.25 + * or visit www.oracle.com if you need additional information or have any
   35.26 + * questions.
   35.27 + */
   35.28 +
   35.29 +package com.sun.xml.internal.ws.spi.db;
   35.30 +
   35.31 +import com.sun.xml.internal.bind.v2.model.nav.Navigator;
   35.32 +
   35.33 +import java.lang.reflect.Field;
   35.34 +import java.lang.reflect.InvocationTargetException;
   35.35 +import java.lang.reflect.Method;
   35.36 +import java.lang.reflect.Type;
   35.37 +import java.util.logging.Level;
   35.38 +import java.util.logging.Logger;
   35.39 +
   35.40 +/**
   35.41 + * Utils class.
   35.42 + *
   35.43 + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages.
   35.44 + *
   35.45 + * Has *package private* access to avoid inappropriate usage.
   35.46 + */
   35.47 +/* package */ final class Utils {
   35.48 +
   35.49 +    private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
   35.50 +
   35.51 +    /**
   35.52 +     * static ReflectionNavigator field to avoid usage of reflection every time we use it.
   35.53 +     */
   35.54 +    /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
   35.55 +
   35.56 +    static { // we statically initializing REFLECTION_NAVIGATOR property
   35.57 +        Class refNav = null;
   35.58 +        try {
   35.59 +            refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
   35.60 +            //noinspection unchecked
   35.61 +            Method getInstance = refNav.getDeclaredMethod("getInstance");
   35.62 +            getInstance.setAccessible(true);
   35.63 +            //noinspection unchecked
   35.64 +            REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
   35.65 +        } catch (ClassNotFoundException e) {
   35.66 +            e.printStackTrace();
   35.67 +            throw new IllegalStateException("Can't find ReflectionNavigator class");
   35.68 +        } catch (InvocationTargetException e) {
   35.69 +            e.printStackTrace();
   35.70 +            throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception");
   35.71 +        } catch (NoSuchMethodException e) {
   35.72 +            e.printStackTrace();
   35.73 +            throw new IllegalStateException("ReflectionNavigator.getInstance can't be found");
   35.74 +        } catch (IllegalAccessException e) {
   35.75 +            e.printStackTrace();
   35.76 +            throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible");
   35.77 +        } catch (SecurityException e) {
   35.78 +            LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
   35.79 +            throw e;
   35.80 +        }
   35.81 +    }
   35.82 +
   35.83 +    /**
   35.84 +     * private constructor to avoid util class instantiating
   35.85 +     */
   35.86 +    private Utils() {
   35.87 +    }
   35.88 +}
    36.1 --- a/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java	Mon Jan 13 22:31:58 2014 -0800
    36.2 +++ b/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java	Wed Jan 15 10:49:40 2014 -0800
    36.3 @@ -59,6 +59,7 @@
    36.4       */
    36.5      private volatile Throwable linkedException;
    36.6  
    36.7 +    static final long serialVersionUID = -3059799699420143848L;
    36.8  
    36.9      /**
   36.10       * Construct a TypeConstraintException with the specified detail message.  The

mercurial