Determine if the given {@link Class} type does not require {@link ClassLoader} proxying.
778594
public static boolean isPassthroughType(Class<?> type)
   {
      Assert.notNull(type, "Type to inspect must not be null.");

      boolean result = type.isArray()
               || JAVA_LANG_PACKAGE_REGEXP.matcher(type.getName()).matches()
               || JAVA_IO_PACKAGE_REGEXP.matcher(type.getName()).matches()
               || JAVA_NET_PACKAGE_REGEXP.matcher(type.getName()).matches()
               || JAVA_UTIL_LOGGING_PACKAGE_REGEXP.matcher(type.getName()).matches()
               || type.isPrimitive();

      result = result && !(Iterable.class.getName().equals(type.getName()));

      return result;
   }
1342062
protected static <P extends AbstractDecoderProxy<T>, T> Object newInstance(
        final Class<P> proxyType, final Class<T> decoderType, final T decoder) {

        if (proxyType == null) {
            throw new NullPointerException("proxyType");
        }

        if (!StringDecoderProxy.class.isAssignableFrom(proxyType)) {
            throw new IllegalArgumentException(
                "proxyType(" + proxyType + ") is not assignable to "
                + StringDecoderProxy.class);
        }

        return newInstance(DECODER.getClassLoader(), new Class<?>[]{DECODER},
                           proxyType, decoderType, decoder);
    }
996264
public static ProxyClassLoader convertClassloader(ClassLoader loader) {
        if (loader == null) {
            return ProxyClient.DEFAULT_LOADER;
        } else if (loader instanceof ProxyClassLoader) {
            return (ProxyClassLoader) loader;
        } else {
            return new ProxyClassLoader(loader);
        }
    }
963810
public JsTopicControls getJsTopicControlsFromProxyClass(Class<?> proxy) {
		Class<?> realClass = unProxyClassServices.getRealClass(proxy);
		return realClass.getAnnotation(JsTopicControls.class);
	}
812597
public void setProxyClass(Class newProxyClass)
    {
        proxyClass = newProxyClass;
        if (proxyClass == null)
        {
            setProxyClassName(null);
        }
        else
        {
            proxyClassName = proxyClass.getName();
        }
    }
193922
public static boolean isCacheSafe(Class<?> clazz, ClassLoader classLoader) {
		Assert.notNull(clazz, "Class must not be null");
		try {
			ClassLoader target = clazz.getClassLoader();
			if (target == null) {
				return true;
			}
			ClassLoader cur = classLoader;
			if (cur == target) {
				return true;
			}
			while (cur != null) {
				cur = cur.getParent();
				if (cur == target) {
					return true;
				}
			}
			return false;
		}
		catch (SecurityException ex) {
			// Probably from the system ClassLoader - let's consider it safe.
			return true;
		}
	}
112656
public static boolean isProvider(ClassInfo classInfo) {
        AnnotationInfo annotationInfo = classInfo.getAnnotation(JaxWsConstants.WEB_SERVICE_ANNOTATION_NAME);
        if (annotationInfo == null) {
            annotationInfo = classInfo.getAnnotation(JaxWsConstants.WEB_SERVICE_PROVIDER_ANNOTATION_NAME);
            if (annotationInfo != null) {
                return true;
            }
        }
        return false;
    }
911507
@SuppressWarnings({ "unchecked", "rawtypes" })
    public <T> T createProxy(ClassLoader classLoader) {

        LettuceAssert.notNull(classLoader, "ClassLoader must not be null");

        Class<?>[] interfaces = this.interfaces.toArray(new Class[0]);

        return (T) Proxy.newProxyInstance(classLoader, interfaces, new InterceptorChainInvocationHandler(interceptors));
    }
120293
private static boolean isRunnerClass(Class<?> type) {
        return Stream.of(type.getDeclaredFields()).anyMatch(field -> TestRunner.class.isAssignableFrom(field.getType()));
    }
690236
private void addConstructorsForBeanWithPrivateConstructors(ClassFile proxyClassType) {
        ClassMethod ctor = proxyClassType.addMethod(AccessFlag.PUBLIC, INIT_METHOD_NAME, BytecodeUtils.VOID_CLASS_DESCRIPTOR, LJAVA_LANG_BYTE);
        CodeAttribute b = ctor.getCodeAttribute();
        b.aload(0);
        b.aconstNull();
        b.aconstNull();
        b.invokespecial(proxyClassType.getName(), INIT_METHOD_NAME, "(" + LJAVA_LANG_BYTE + LJAVA_LANG_BYTE + ")" + BytecodeUtils.VOID_CLASS_DESCRIPTOR);
        b.returnInstruction();

        ctor = proxyClassType.addMethod(AccessFlag.PUBLIC, INIT_METHOD_NAME, BytecodeUtils.VOID_CLASS_DESCRIPTOR, LJAVA_LANG_BYTE, LJAVA_LANG_BYTE);
        b = ctor.getCodeAttribute();
        b.aload(0);
        b.aconstNull();
        b.invokespecial(proxyClassType.getName(), INIT_METHOD_NAME, "(" + LJAVA_LANG_BYTE + ")" + BytecodeUtils.VOID_CLASS_DESCRIPTOR);
        b.returnInstruction();
    }
1021207
public static boolean isProxy(GSIConstants.CertificateType certType) {
        return isGsi2Proxy(certType) || isGsi3Proxy(certType) || isGsi4Proxy(certType);
    }
313939
@Override
    public <TYPE extends Assignable> TYPE as(final Class<TYPE> clazz) {
        Validate.notNull(clazz, "Class must be specified");

        return this.configuration.getExtensionLoader().load(clazz, this);
    }
1008055
static Type forTypeProvider(final TypeProvider provider) {
        LettuceAssert.notNull(provider, "Provider must not be null");
        if (provider.getType() instanceof Serializable || provider.getType() == null) {
            return provider.getType();
        }

        for (Class<?> type : SUPPORTED_SERIALIZABLE_TYPES) {
            if (type.isAssignableFrom(provider.getType().getClass())) {
                ClassLoader classLoader = provider.getClass().getClassLoader();
                Class<?>[] interfaces = new Class<?>[] { type, SerializableTypeProxy.class, Serializable.class };
                InvocationHandler handler = new TypeProxyInvocationHandler(provider);
                return (Type) Proxy.newProxyInstance(classLoader, interfaces, handler);
            }
        }
        throw new IllegalArgumentException("Unsupported Type class: " + provider.getType().getClass().getName());
    }
599871
private static boolean isAccessible(final Class<?> type) {
        Class<?> cls = type;
        while (cls != null) {
            if (!Modifier.isPublic(cls.getModifiers())) {
                return false;
            }
            cls = cls.getEnclosingClass();
        }
        return true;
    }
788237
public static Object createProxy(final Class<?> type, final ProxyTargetLocator locator) {
        if (type.isPrimitive() || BUILTINS.contains(type) || Enum.class.isAssignableFrom(type)) {
            // We special-case primitives as sometimes people use these as
            // SpringBeans (WICKET-603, WICKET-906). Go figure.
            Object proxy = locator.locateProxyTarget();
            Object realTarget = getRealTarget(proxy);
            if (proxy instanceof ReleasableProxyTarget) {
                // This is not so nice... but with a primitive this should'nt matter at all...
                ((ReleasableProxyTarget) proxy).releaseTarget();
            }
            return realTarget;
        } else if (type.isInterface()) {
            JdkHandler handler = new JdkHandler(type, locator);

            try {
                return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
                        new Class[]{ type, Serializable.class, ILazyInitProxy.class,
                                IWriteReplace.class }, handler);
            } catch (IllegalArgumentException e) {
                // While in the original Wicket Environment this is a failure of the context-classloader in PAX-WICKET
                // this is always an error of missing imports into the classloader. Right now we can do nothing here but
                // inform the user about the problem and throw an IllegalStateException instead wrapping up and
                // presenting the real problem.
                throw new IllegalStateException("The real problem is that the used wrapper classes are not imported " +
                        "by the bundle using injection", e);
            }

        } else {
            CGLibInterceptor handler = new CGLibInterceptor(type, locator);

            Enhancer e = new Enhancer();
            e.setInterfaces(new Class[]{ Serializable.class, ILazyInitProxy.class,
                    IWriteReplace.class });
            e.setSuperclass(type);
            e.setCallback(handler);
            //e.setClassLoader(LazyInitProxyFactory.class.getClassLoader());
            e.setNamingPolicy(new DefaultNamingPolicy() {
                @Override
                public String getClassName(final String prefix, final String source,
                                           final Object key, final Predicate names) {
                    return super.getClassName("WICKET_" + prefix, source, key, names);
                }
            });

            return e.create();
        }
    }
693878
public static boolean canHandle(final ClassLoader classLoader) {
        return "weblogic.utils.classloaders.ChangeAwareClassLoader".equals(classLoader.getClass().getName())
                || "weblogic.utils.classloaders.GenericClassLoader".equals(classLoader.getClass().getName())
                || "weblogic.utils.classloaders.FilteringClassLoader".equals(classLoader.getClass().getName())
                // TODO: The following two known classloader names have not been tested, and the fields/methods
                // may not match those of the above classloaders.
                || "weblogic.servlet.jsp.JspClassLoader".equals(classLoader.getClass().getName())
                || "weblogic.servlet.jsp.TagFileClassLoader".equals(classLoader.getClass().getName());
    }
793361
public static boolean isInstantiable(Class<?> type)
   {
      if (type != null)
      {
         try
         {
            if (type.isInterface())
               return true;
            type.getConstructor();
            return true;
         }
         catch (SecurityException e)
         {
            return false;
         }
         catch (NoSuchMethodException e)
         {
            return false;
         }
      }
      return false;
   }