"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main/java/org/codehaus/groovy/runtime/GroovyCategorySupport.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.

GroovyCategorySupport.java  (apache-groovy-src-3.0.8):GroovyCategorySupport.java  (apache-groovy-src-3.0.9)
skipping to change at line 230 skipping to change at line 230
public CategoryMethod(CachedMethod metaMethod, Class metaClass) { public CategoryMethod(CachedMethod metaMethod, Class metaClass) {
super(metaMethod); super(metaMethod);
this.metaClass = metaClass; this.metaClass = metaClass;
} }
public boolean isCacheable() { return false; } public boolean isCacheable() { return false; }
/** /**
* Sort by most specific to least specific. * Sort by most specific to least specific.
* *
* @param o the object to compare against * @param that the object to compare against
*/ */
public int compareTo(Object o) { @Override
CategoryMethod thatMethod = (CategoryMethod) o; public int compareTo(final Object that) {
Class thisClass = metaClass; Class thisClass = metaClass;
Class thatClass = thatMethod.metaClass; Class thatClass = ((CategoryMethod) that).metaClass;
if (thisClass == thatClass) return 0; if (thisClass == thatClass) return 0;
if (isChildOfParent(thisClass, thatClass)) return -1; if (thisClass.isAssignableFrom(thatClass)) return 1;
if (isChildOfParent(thatClass, thisClass)) return 1; if (thatClass.isAssignableFrom(thisClass)) return -1;
return 0;
}
private boolean isChildOfParent(Class candidateChild, Class candidatePar return 0;
ent) {
Class loop = candidateChild;
while(loop != null && loop != Object.class) {
loop = loop.getSuperclass();
if (loop == candidateParent) {
return true;
}
}
return false;
} }
} }
public static AtomicInteger getCategoryNameUsage (String name) { public static AtomicInteger getCategoryNameUsage (String name) {
return THREAD_INFO.getUsage (name); return THREAD_INFO.getUsage (name);
} }
/** /**
* Create a scope based on given categoryClass and invoke closure within tha t scope. * Create a scope based on given categoryClass and invoke closure within tha t scope.
* *
 End of changes. 5 change blocks. 
18 lines changed or deleted 8 lines changed or added

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