Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.codehaus.groovy.reflection;
import groovy.lang.Closure;
import groovy.lang.ExpandoMetaClass;
import groovy.lang.ExpandoMetaClassCreationHandle;
import groovy.lang.GroovySystem;
import groovy.lang.MetaClass;
import groovy.lang.MetaClassRegistry;
import groovy.lang.MetaMethod;
import org.codehaus.groovy.reflection.GroovyClassValue.ComputeValue;
import org.codehaus.groovy.reflection.stdclasses.ArrayCachedClass;
import org.codehaus.groovy.reflection.stdclasses.BigDecimalCachedClass;
import org.codehaus.groovy.reflection.stdclasses.BigIntegerCachedClass;
import org.codehaus.groovy.reflection.stdclasses.BooleanCachedClass;
import org.codehaus.groovy.reflection.stdclasses.ByteCachedClass;
import org.codehaus.groovy.reflection.stdclasses.CachedClosureClass;
import org.codehaus.groovy.reflection.stdclasses.CachedSAMClass;
import org.codehaus.groovy.reflection.stdclasses.CharacterCachedClass;
import org.codehaus.groovy.reflection.stdclasses.DoubleCachedClass;
import org.codehaus.groovy.reflection.stdclasses.FloatCachedClass;
import org.codehaus.groovy.reflection.stdclasses.IntegerCachedClass;
import org.codehaus.groovy.reflection.stdclasses.LongCachedClass;
import org.codehaus.groovy.reflection.stdclasses.NumberCachedClass;
import org.codehaus.groovy.reflection.stdclasses.ObjectCachedClass;
import org.codehaus.groovy.reflection.stdclasses.ShortCachedClass;
import org.codehaus.groovy.reflection.stdclasses.StringCachedClass;
import org.codehaus.groovy.util.Finalizable;
import org.codehaus.groovy.util.LazyReference;
import org.codehaus.groovy.util.LockableObject;
import org.codehaus.groovy.util.ManagedConcurrentLinkedQueue;
import org.codehaus.groovy.util.ManagedConcurrentMap;
import org.codehaus.groovy.util.ManagedReference;
import org.codehaus.groovy.util.ReferenceBundle;
import org.codehaus.groovy.vmplugin.VMPluginFactory;
import java.lang.ref.WeakReference;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Handle for all information we want to keep about the class
*
* This class handles caching internally and its advisable to not store
* references directly to objects of this class. The static factory method
* {@link ClassInfo#getClassInfo(Class)} should be used to retrieve an instance
* from the cache. Internally the {@code Class} associated with a {@code ClassInfo}
* instance is kept as {@link WeakReference}, so it not safe to reference
* and instance without the Class being either strongly or softly reachable.
*/
public class ClassInfo implements Finalizable {
private final LazyCachedClassRef cachedClassRef;
private final LazyClassLoaderRef artifactClassLoader;
private final LockableObject lock = new LockableObject();
public final int hash = -1;
private final WeakReference> classRef;
// TODO: should be able to remove the klazz field once 2.5 becomes the mainline release
// Gradle has a cleanup mechanism in place to reflectively access this klazz field.
// The klazz field is being kept for compatibility so as to not break builds that depend
// on versions of Groovy after the field was changed to a WeakReference (classRef). It
// appears that Gradle only performs the cleanup when it detects a groovy version of 2.4.x,
// so the klazz field and placeholder Sentinel class can likely be safely removed once
// the release version bumps to 2.5 (or beyond).
// See:
// https://github.com/gradle/gradle/blob/711f64/subprojects/core/src/main/java/org/gradle/api/internal/classloading/LeakyOnJava7GroovySystemLoader.java#L74
private static final class Sentinel {}
private static final Class> klazz = Sentinel.class;
private final AtomicInteger version = new AtomicInteger();
private MetaClass strongMetaClass;
private ManagedReference weakMetaClass;
MetaMethod[] dgmMetaMethods = CachedClass.EMPTY;
MetaMethod[] newMetaMethods = CachedClass.EMPTY;
private ManagedConcurrentMap