Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GROOVY-11158: deprecate callsite code #1934

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/groovy/lang/ExpandoMetaClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,7 @@ public boolean isSetter(String name, CachedClass[] args) {
}

@Override
@Deprecated
public CallSite createPojoCallSite(CallSite site, Object receiver, Object[] args) {
if (invokeMethodMethod != null)
return new PojoMetaClassSite(site, this);
Expand All @@ -1324,6 +1325,7 @@ public CallSite createPojoCallSite(CallSite site, Object receiver, Object[] args
}

@Override
@Deprecated
public CallSite createStaticSite(CallSite site, Object[] args) {
if (invokeStaticMethodMethod != null)
return new StaticMetaClassSite(site, this);
Expand All @@ -1335,12 +1337,14 @@ public CallSite createStaticSite(CallSite site, Object[] args) {
public boolean hasCustomStaticInvokeMethod() {return invokeStaticMethodMethod!=null; }

@Override
@Deprecated
public CallSite createPogoCallSite(CallSite site, Object[] args) {
if (invokeMethodMethod != null)
return new PogoMetaClassSite(site, this);
return super.createPogoCallSite(site, args);
}

@Deprecated
public CallSite createPogoCallCurrentSite(CallSite site, Class sender, String name, Object[] args) {
if (invokeMethodMethod != null)
return new PogoMetaClassSite(site, this);
Expand All @@ -1356,6 +1360,7 @@ public MetaMethod retrieveConstructor(Object[] args) {
}

@Override
@Deprecated
public CallSite createConstructorSite(CallSite site, Object[] args) {
Class[] params = MetaClassHelper.convertToTypeArray(args);
MetaMethod method = pickMethod(GROOVY_CONSTRUCTOR, params);
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/groovy/lang/MetaClassImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3414,6 +3414,7 @@ protected void dropMethodCache(String name) {
/**
* Create a CallSite
*/
@Deprecated
public CallSite createPojoCallSite(CallSite site, Object receiver, Object[] args) {
if (!(this instanceof AdaptingMetaClass)) {
Class[] params = MetaClassHelper.convertToTypeArray(args);
Expand All @@ -3427,6 +3428,7 @@ public CallSite createPojoCallSite(CallSite site, Object receiver, Object[] args
/**
* Create a CallSite
*/
@Deprecated
public CallSite createStaticSite(CallSite site, Object[] args) {
if (!(this instanceof AdaptingMetaClass)) {
Class[] params = MetaClassHelper.convertToTypeArray(args);
Expand All @@ -3440,6 +3442,7 @@ public CallSite createStaticSite(CallSite site, Object[] args) {
/**
* Create a CallSite
*/
@Deprecated
public CallSite createPogoCallSite(CallSite site, Object[] args) {
if (!GroovyCategorySupport.hasCategoryInCurrentThread() && !(this instanceof AdaptingMetaClass)) {
Class[] params = MetaClassHelper.convertToTypeArray(args);
Expand All @@ -3462,6 +3465,7 @@ public CallSite createPogoCallSite(CallSite site, Object[] args) {
/**
* Create a CallSite
*/
@Deprecated
public CallSite createPogoCallCurrentSite(CallSite site, Class sender, Object[] args) {
if (!GroovyCategorySupport.hasCategoryInCurrentThread() && !(this instanceof AdaptingMetaClass)) {
Class[] params = MetaClassHelper.convertToTypeArray(args);
Expand All @@ -3475,6 +3479,7 @@ public CallSite createPogoCallCurrentSite(CallSite site, Class sender, Object[]
/**
* Create a CallSite
*/
@Deprecated
public CallSite createConstructorSite(CallSite site, Object[] args) {
if (!(this instanceof AdaptingMetaClass)) {
Class[] argTypes = MetaClassHelper.convertToTypeArray(args);
Expand Down Expand Up @@ -3967,10 +3972,12 @@ private enum InvokeMethodResult {
NONE
}

@Deprecated
public boolean isPermissivePropertyAccess() {
return permissivePropertyAccess;
}

@Deprecated
public void setPermissivePropertyAccess(boolean permissivePropertyAccess) {
this.permissivePropertyAccess = permissivePropertyAccess;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/codehaus/groovy/reflection/CachedClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public CachedMethod[] initValue() {
}
};

@Deprecated
private final LazyReference<CallSiteClassLoader> callSiteClassLoader = new LazyReference<CallSiteClassLoader>(softBundle) {
private static final long serialVersionUID = 4410385968428074090L;

Expand Down Expand Up @@ -276,6 +277,7 @@ public CachedConstructor[] getConstructors() {
return constructors.get();
}

@Deprecated
public CachedMethod searchMethods(String name, CachedClass[] parameterTypes) {
CachedMethod[] methods = getMethods();

Expand Down Expand Up @@ -484,6 +486,7 @@ public boolean isDirectlyAssignable(Object argument) {
return ReflectionCache.isAssignableFrom(getTheClass(), argument.getClass());
}

@Deprecated
public CallSiteClassLoader getCallSiteLoader() {
return callSiteClassLoader.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public void setTransformedMethod(final CachedMethod transformedMethod) {

//--------------------------------------------------------------------------

@Deprecated
public CallSite createPogoMetaMethodSite(final CallSite site, final MetaClassImpl metaClass, final Class[] params) {
if (!skipCompiled) {
Constructor<CallSite> ctor = deref(pogoCallSiteConstructor);
Expand Down Expand Up @@ -262,6 +263,7 @@ public CallSite createPogoMetaMethodSite(final CallSite site, final MetaClassImp
return new PogoMetaMethodSite.PogoCachedMethodSiteNoUnwrapNoCoerce(site, metaClass, this, params);
}

@Deprecated
public CallSite createPojoMetaMethodSite(final CallSite site, final MetaClassImpl metaClass, final Class[] params) {
if (!skipCompiled) {
Constructor<CallSite> ctor = deref(pojoCallSiteConstructor);
Expand Down Expand Up @@ -290,6 +292,7 @@ public CallSite createPojoMetaMethodSite(final CallSite site, final MetaClassImp
return new PojoMetaMethodSite.PojoCachedMethodSiteNoUnwrapNoCoerce(site, metaClass, this, params);
}

@Deprecated
public CallSite createStaticMetaMethodSite(final CallSite site, final MetaClassImpl metaClass, final Class[] params) {
if (!skipCompiled) {
Constructor<CallSite> ctor = deref(staticCallSiteConstructor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
/**
* Base class for all call sites.
*/
@Deprecated
public class AbstractCallSite implements CallSite {

protected final int index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* This creates a Predicate by calling a {@link Closure} and converting the result to a boolean.
* {@link BooleanReturningMethodInvoker} is used for caching.
*/
@Deprecated
public class BooleanClosureForMapPredicate<K, V> implements Predicate<Map.Entry<K, V>> {
private final BooleanReturningMethodInvoker bmi;
private final Closure wrapped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* This creates a Predicate by calling a {@link Closure} and converting the result to a boolean.
* {@link BooleanReturningMethodInvoker} is used for caching.
*/
@Deprecated
public class BooleanClosurePredicate<T> implements Predicate<T> {
private final BooleanReturningMethodInvoker bmi;
private final Closure wrapped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@
import java.util.Map.Entry;

/**
* Helper class for internal use only. This allows to call a {@link Closure} and
* Helper class for internal use only. This allows to call a {@link Closure} and
* convert the result to a boolean. It will do this by caching the possible "doCall"
* as well as the "asBoolean" in CallSiteArray fashion. "asBoolean" will not be
* as well as the "asBoolean" in CallSiteArray fashion. "asBoolean" will not be
* called if the result is null or a Boolean. In case of null we return false and
* in case of a Boolean we simply unbox. This logic is designed after the one present
* in case of a Boolean we simply unbox. This logic is designed after the one present
* in {@link org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation#castToBoolean(Object)}. The purpose of
* this class is to avoid the slow "asBoolean" call in that method.
* {@link BooleanReturningMethodInvoker} is used for caching.
*
*/
@Deprecated
public class BooleanClosureWrapper {
private final BooleanReturningMethodInvoker bmi;
private final Closure wrapped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
/**
* Helper class for internal use only. This allows to call a given method and
* convert the result to a boolean. It will do this by caching the method call
* as well as the "asBoolean" in {@link CallSiteArray} fashion. "asBoolean" will not be
* as well as the "asBoolean" in {@link CallSiteArray} fashion. "asBoolean" will not be
* called if the result is null or a Boolean. In case of null we return false and
* in case of a Boolean we simply unbox. This logic is designed after the one present
* in case of a Boolean we simply unbox. This logic is designed after the one present
* in {@link org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation#castToBoolean(Object)}. The purpose of
* this class is to avoid the slow "asBoolean" call in that method.
*
* this class is to avoid the slow "asBoolean" call in that method.
*
* The nature of this class allows a per instance caching instead of a per class
* caching like the normal {@link CallSiteArray} logic.
*/
@Deprecated
public class BooleanReturningMethodInvoker {
private final CallSiteArray csa;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import groovy.lang.GroovyObject;


@Deprecated
public interface CallSite {
CallSiteArray getArray();
int getIndex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.security.PrivilegedAction;
import java.util.stream.IntStream;

@Deprecated
public final class CallSiteArray {
public static final Object[] NOPARAM = new Object[0];
public final CallSite[] array;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import groovy.lang.MetaClassImpl;
import groovy.lang.MetaMethod;

@Deprecated
public abstract class CallSiteAwareMetaMethod extends MetaMethod{

public abstract CallSite createPojoCallSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Object receiver, Object[] args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.HashSet;
import java.util.Set;

@Deprecated
public class CallSiteClassLoader extends ClassLoaderForClassArtifacts {

private static final Set<String> KNOWN_CLASSES = new HashSet<String>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;

@Deprecated
public class CallSiteGenerator {

private CallSiteGenerator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import groovy.lang.MetaClass;
import org.codehaus.groovy.reflection.ClassInfo;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;

@Deprecated
class ClassMetaClassGetPropertySite extends AbstractCallSite {
final MetaClass metaClass;
private final Class aClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import groovy.lang.MetaClass;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;

@Deprecated
public class ConstructorMetaClassSite extends MetaClassSite {
public ConstructorMetaClassSite(CallSite site, MetaClass metaClass) {
super(site, metaClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* metaclass - cached
* method - not cached
*/
@Deprecated
public class ConstructorMetaMethodSite extends MetaMethodSite {

private final int version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import java.util.Map;

@Deprecated
public class ConstructorSite extends MetaClassSite {
final CachedConstructor constructor;
final Class[] params;
Expand Down Expand Up @@ -57,6 +58,7 @@ protected final boolean checkCall(Object receiver, Object[] args) {
&& MetaClassHelper.sameClasses(params, args);
}

@Deprecated
public static ConstructorSite createConstructorSite(CallSite site, MetaClassImpl metaClass, CachedConstructor constructor, Class[] params, Object[] args) {
if (constructor.correctArguments(args) == args) {
if (noWrappers(args)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.codehaus.groovy.runtime.callsite;

@Deprecated
public class DummyCallSite extends AbstractCallSite {
public DummyCallSite(CallSiteArray array, int index, String name) {
super(array, index,name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.codehaus.groovy.reflection.CachedField;
import org.codehaus.groovy.runtime.GroovyCategorySupport;

@Deprecated
public class GetEffectivePogoFieldSite extends AbstractCallSite {
private final MetaClass metaClass;
private final CachedField effective;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* Date: May 21, 2008
* Time: 10:37:37 AM
*/
@Deprecated
class GetEffectivePogoPropertySite extends AbstractCallSite {
private final MetaClass metaClass;
private final MetaProperty effective;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.codehaus.groovy.reflection.CachedField;
import org.codehaus.groovy.runtime.GroovyCategorySupport;

@Deprecated
class GetEffectivePojoFieldSite extends AbstractCallSite {
private final MetaClassImpl metaClass;
private final CachedField effective;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.codehaus.groovy.runtime.GroovyCategorySupport;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;

@Deprecated
public class GetEffectivePojoPropertySite extends AbstractCallSite {
private final MetaClassImpl metaClass;
private final MetaProperty effective;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* metaclass - cached
* method - not cached
*/
@Deprecated
public class MetaClassConstructorSite extends MetaClassSite {

private final ClassInfo classInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
/**
* Call site which holds reference to metaclass.
*/
@Deprecated
public abstract class MetaClassSite extends AbstractCallSite {

protected final MetaClass metaClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/**
* Call site which caches meta method
*/
@Deprecated
public abstract class MetaMethodSite extends MetaClassSite {
final MetaMethod metaMethod;
protected final Class[] params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.codehaus.groovy.runtime.NullObject;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;

@Deprecated
public final class NullCallSite extends AbstractCallSite {
public NullCallSite(CallSite callSite) {
super(callSite);
Expand Down Expand Up @@ -53,4 +54,4 @@ public Object getProperty(Object receiver) throws Throwable {
return acceptGetProperty(receiver).getProperty(receiver);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.codehaus.groovy.runtime.InvokerHelper;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;

@Deprecated
public class PerInstancePojoMetaClassSite extends AbstractCallSite{
private final ClassInfo info;

Expand All @@ -43,4 +44,4 @@ public Object call(Object receiver, Object[] args) throws Throwable {
return CallSiteArray.defaultCall(this, receiver, args);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* method - cached
*
*/
@Deprecated
public abstract class PlainObjectMetaMethodSite extends MetaMethodSite {
public PlainObjectMetaMethodSite(CallSite site, MetaClass metaClass, MetaMethod metaMethod, Class[] params) {
super(site, metaClass, metaMethod, params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import groovy.lang.GroovyRuntimeException;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;

@Deprecated
public class PogoGetPropertySite extends AbstractCallSite {
private final Class aClass;

Expand Down
Loading