Skip to content

Commit

Permalink
GROOVY-11520: Remove deprecated collections
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellansun committed Nov 12, 2024
1 parent d2e6834 commit e6c95b7
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 1,752 deletions.
78 changes: 0 additions & 78 deletions src/main/java/groovy/lang/MetaClassImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@
import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation;
import org.codehaus.groovy.runtime.typehandling.NumberMathModificationInfo;
import org.codehaus.groovy.runtime.wrappers.Wrapper;
import org.codehaus.groovy.util.ComplexKeyHashMap;
import org.codehaus.groovy.util.FastArray;
import org.codehaus.groovy.util.SingleKeyHashMap;
import org.codehaus.groovy.vmplugin.VMPlugin;
import org.codehaus.groovy.vmplugin.VMPluginFactory;
import org.objectweb.asm.Opcodes;
Expand Down Expand Up @@ -3895,82 +3893,6 @@ protected void clearInvocationCaches() {
metaMethodIndex.clearCaches();
}

@Deprecated
private static final SingleKeyHashMap.Copier NAME_INDEX_COPIER = value -> {
if (value instanceof FastArray) {
return ((FastArray) value).copy();
} else {
return value;
}
};

@Deprecated
private static final SingleKeyHashMap.Copier METHOD_INDEX_COPIER = value -> SingleKeyHashMap.copy(new SingleKeyHashMap(false), (SingleKeyHashMap) value, NAME_INDEX_COPIER);

/**
* @deprecated use {@link LinkedHashMap} instead
*/
@Deprecated
static class MethodIndex extends Index {
MethodIndex(boolean b) {
super(false);
}

MethodIndex(int size) {
super(size);
}

MethodIndex() {
super();
}

MethodIndex copy() {
return (MethodIndex) SingleKeyHashMap.copy(new MethodIndex(false), this, METHOD_INDEX_COPIER);
}

@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
}

/**
* @deprecated use {@link LinkedHashMap} instead
*/
@Deprecated
public static class Index extends SingleKeyHashMap {

public Index(int size) {
}

public Index() {
}

public Index(boolean size) {
super(false);
}

public SingleKeyHashMap getNotNull(CachedClass key) {
Entry res = getOrPut(key);
if (res.value == null) {
res.value = new SingleKeyHashMap();
}
return (SingleKeyHashMap) res.value;
}

public void put(CachedClass key, SingleKeyHashMap value) {
getOrPut(key).value = value;
}

public SingleKeyHashMap getNullable(CachedClass clazz) {
return (SingleKeyHashMap) get(clazz);
}

public boolean checkEquals(ComplexKeyHashMap.Entry e, Object key) {
return ((Entry) e).key.equals(key);
}
}

private static class DummyMetaMethod extends MetaMethod {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,11 @@
*/
package org.codehaus.groovy.reflection;

import org.apache.groovy.util.SystemUtil;
import org.codehaus.groovy.reflection.GroovyClassValue.ComputeValue;
import org.codehaus.groovy.reflection.v7.GroovyClassValueJava7;

class GroovyClassValueFactory {
/**
* This flag is introduced as a (hopefully) temporary workaround for a JVM bug, that is to say that using
* ClassValue prevents the classes and classloaders from being unloaded.
* See https://bugs.openjdk.java.net/browse/JDK-8136353
* This issue does not exist on IBM Java (J9) so use ClassValue by default on that JVM.
*/
private static final boolean USE_CLASSVALUE = Boolean.parseBoolean(SystemUtil.getSystemPropertySafe("groovy.use.classvalue", "true"));

public static <T> GroovyClassValue<T> createGroovyClassValue(ComputeValue<T> computeValue) {
return (USE_CLASSVALUE)
? new GroovyClassValueJava7<>(computeValue)
: new GroovyClassValuePreJava7<>(computeValue);
return new GroovyClassValueJava7<>(computeValue);
}
}

This file was deleted.

Loading

0 comments on commit e6c95b7

Please sign in to comment.