Created
April 27, 2012 06:04
-
-
Save espeed/2506332 to your computer and use it in GitHub Desktop.
Jython Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set<String> allModified = Generic.set(); | |
PyJavaType[] conflicted = inConflict.toArray(new PyJavaType[inConflict.size()]); | |
for (PyJavaType type : conflicted) { | |
if (type.modified == null) { | |
continue; | |
} | |
for (String method : type.modified) { | |
if (!allModified.add(method)) { // Another type in conflict has this method, fail | |
PyList types = new PyList(); | |
for (PyJavaType othertype : conflicted) { | |
if (othertype.modified != null && othertype.modified.contains(method)) { | |
types.add(othertype); | |
} | |
} | |
throw Py.TypeError(String.format("Supertypes that share a modified attribute " | |
+ " have an MRO conflict[attribute=%s, types=%s]", method, types)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment