spinjar.com.sun.xml.bind.v2.ClassFactory Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.xml.bind.v2;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.ref.WeakReference;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.sun.xml.bind.Utils;
/**
* Creates new instances of classes.
*
*
* This code handles the case where the class is not public or the constructor is
* not public.
*
* @since 2.0
* @author Kohsuke Kawaguchi
*/
public final class ClassFactory {
private static final Class[] emptyClass = new Class[0];
private static final Object[] emptyObject = new Object[0];
private static final Logger logger = Utils.getClassLogger();
/**
* Cache from a class to its default constructor.
*
* To avoid synchronization among threads, we use {@link ThreadLocal}.
*/
private static final ThreadLocal