src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java

Print this page
rev 472 : 8036030: Update JAX-WS RI integration to latest version

*** 1,7 **** /* ! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 42,71 **** /** * {@link Navigator} implementation for {@code java.lang.reflect}. * */ ! public final class ReflectionNavigator implements Navigator<Type, Class, Field, Method> { ! /** ! * Singleton. ! * ! * Use {@link Navigator#REFLECTION} ! */ ! ReflectionNavigator() { } public Class getSuperClass(Class clazz) { if (clazz == Object.class) { return null; } Class sc = clazz.getSuperclass(); if (sc == null) { sc = Object.class; // error recovery } return sc; } private static final TypeVisitor<Type, Class> baseClassFinder = new TypeVisitor<Type, Class>() { public Type onClass(Class c, Class sup) { // t is a raw type if (sup == c) { --- 42,75 ---- /** * {@link Navigator} implementation for {@code java.lang.reflect}. * */ ! /*package*/final class ReflectionNavigator implements Navigator<Type, Class, Field, Method> { ! // ---------- Singleton ----------------- ! private static final ReflectionNavigator INSTANCE = new ReflectionNavigator(); ! ! /*package*/static ReflectionNavigator getInstance() { ! return INSTANCE; } + private ReflectionNavigator() { + } + // --------------------------------------- + public Class getSuperClass(Class clazz) { if (clazz == Object.class) { return null; } Class sc = clazz.getSuperclass(); if (sc == null) { sc = Object.class; // error recovery } return sc; } + private static final TypeVisitor<Type, Class> baseClassFinder = new TypeVisitor<Type, Class>() { public Type onClass(Class c, Class sup) { // t is a raw type if (sup == c) {
*** 494,504 **** public boolean hasDefaultConstructor(Class c) { try { c.getDeclaredConstructor(); return true; } catch (NoSuchMethodException e) { ! return false; } } public boolean isStaticField(Field field) { return Modifier.isStatic(field.getModifiers()); --- 498,508 ---- public boolean hasDefaultConstructor(Class c) { try { c.getDeclaredConstructor(); return true; } catch (NoSuchMethodException e) { ! return false; // todo: do this WITHOUT exception throw } } public boolean isStaticField(Field field) { return Modifier.isStatic(field.getModifiers());
*** 542,558 **** } else { return name.substring(0, idx); } } ! public Class findClass(String className, Class referencePoint) { ! try { ClassLoader cl = SecureLoader.getClassClassLoader(referencePoint); ! if (cl == null) { cl = SecureLoader.getSystemClassLoader(); ! } ! return cl.loadClass(className); } catch (ClassNotFoundException e) { return null; } } --- 546,563 ---- } else { return name.substring(0, idx); } } ! @Override ! public Class loadObjectFactory(Class referencePoint, String pkg) { ClassLoader cl = SecureLoader.getClassClassLoader(referencePoint); ! if (cl == null) cl = SecureLoader.getSystemClassLoader(); ! ! try { ! return cl.loadClass(pkg + ".ObjectFactory"); } catch (ClassNotFoundException e) { return null; } }