"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main/java/groovy/lang/MetaClassImpl.java" between
apache-groovy-src-3.0.8.zip and apache-groovy-src-3.0.9.zip

About: Groovy is an agile dynamic (scripting) language for the Java Platform. It has features similar to those of Python, Ruby, Perl, and Smalltalk. Source release.

MetaClassImpl.java  (apache-groovy-src-3.0.8):MetaClassImpl.java  (apache-groovy-src-3.0.9)
skipping to change at line 2160 skipping to change at line 2160
if (getterName != null) { if (getterName != null) {
MetaMethod categoryMethod = getCategoryMethodGetter(senderForCMG , getterName, false); MetaMethod categoryMethod = getCategoryMethodGetter(senderForCMG , getterName, false);
if (categoryMethod != null) if (categoryMethod != null)
method = categoryMethod; method = categoryMethod;
} }
} }
return tuple(method, mp); return tuple(method, mp);
} }
private static MetaMethod getCategoryMethodMissing(Class sender) { private static CategoryMethod getCategoryMethodMissing(final Class<?> sender
List possibleGenericMethods = GroovyCategorySupport.getCategoryMethods(M ) {
ETHOD_MISSING); return findCategoryMethod(METHOD_MISSING, sender, params ->
if (possibleGenericMethods != null) { params.length == 2 && params[0].getTheClass() == String.class
for (Object possibleGenericMethod : possibleGenericMethods) { );
MetaMethod mmethod = (MetaMethod) possibleGenericMethod;
if (!mmethod.getDeclaringClass().getTheClass().isAssignableFrom(
sender))
continue;
CachedClass[] paramTypes = mmethod.getParameterTypes();
if (paramTypes.length == 2 && paramTypes[0].getTheClass() == Str
ing.class) {
return mmethod;
}
}
}
return null;
} }
private static MetaMethod getCategoryMethodGetter(Class sender, String name, private static CategoryMethod getCategoryMethodGetter(final Class<?> sender,
boolean useLongVersion) { final String name, final boolean useLongVersion) {
List possibleGenericMethods = GroovyCategorySupport.getCategoryMethods(n return findCategoryMethod(name, sender, params ->
ame); useLongVersion ? params.length == 1 && params[0].getTheClass() == St
if (possibleGenericMethods != null) { ring.class : params.length == 0
for (Object possibleGenericMethod : possibleGenericMethods) { );
MetaMethod mmethod = (MetaMethod) possibleGenericMethod;
if (!mmethod.getDeclaringClass().getTheClass().isAssignableFrom(
sender))
continue;
CachedClass[] paramTypes = mmethod.getParameterTypes();
if (useLongVersion) {
if (paramTypes.length == 1 && paramTypes[0].getTheClass() ==
String.class) {
return mmethod;
}
} else {
if (paramTypes.length == 0) return mmethod;
}
}
}
return null;
} }
private static MetaMethod getCategoryMethodSetter(Class sender, String name, private static CategoryMethod getCategoryMethodSetter(final Class<?> sender,
boolean useLongVersion) { final String name, final boolean useLongVersion) {
List possibleGenericMethods = GroovyCategorySupport.getCategoryMethods(n return findCategoryMethod(name, sender, params ->
ame); useLongVersion ? params.length == 2 && params[0].getTheClass() == St
if (possibleGenericMethods != null) { ring.class : params.length == 1
for (Object possibleGenericMethod : possibleGenericMethods) { );
MetaMethod mmethod = (MetaMethod) possibleGenericMethod; }
if (!mmethod.getDeclaringClass().getTheClass().isAssignableFrom(
sender)) private static CategoryMethod findCategoryMethod(final String name, final Cl
continue; ass<?> sender, final java.util.function.Predicate<CachedClass[]> paramFilter) {
List<CategoryMethod> categoryMethods = GroovyCategorySupport.getCategory
CachedClass[] paramTypes = mmethod.getParameterTypes(); Methods(name);
if (useLongVersion) { if (categoryMethods != null) {
if (paramTypes.length == 2 && paramTypes[0].getTheClass() == return categoryMethods.stream().filter(categoryMethod ->
String.class) { categoryMethod.getDeclaringClass().isAssignableFrom(sender) && p
return mmethod; aramFilter.test(categoryMethod.getParameterTypes())
} ).sorted().findFirst().orElse(null);
} else {
if (paramTypes.length == 1) return mmethod;
}
}
} }
return null; return null;
} }
/** /**
* Get all the properties defined for this type * Get all the properties defined for this type
* *
* @return a list of MetaProperty objects * @return a list of MetaProperty objects
*/ */
public List<MetaProperty> getProperties() { public List<MetaProperty> getProperties() {
 End of changes. 3 change blocks. 
62 lines changed or deleted 28 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)