+
+ # Resolve the types in methods and attributes of this class
+ fun resolve_types
+ do
+ for id, java_class in classes do
+ java_class.resolve_types_of java_class
+
+ # Ask nester classes for resolve too
+ var matches = id.search_all("$")
+ for match in matches do
+ var nester_name = id.substring(0, match.from)
+ if classes.keys.has(nester_name) then
+ var nester = classes[nester_name]
+ nester.resolve_types_of java_class
+ end
+ end
+ end
+ end
+
+ # Specialization hierarchy of `classes`
+ var class_hierarchy = new POSet[JavaClass] is noserialize
+
+ # Fill `class_hierarchy`
+ fun build_class_hierarchy
+ do
+ var object_type = new JavaType
+ object_type.identifier = ["java","lang","Object"]
+
+ # Fill POSet
+ for name, java_class in all_classes do
+ # Skip anonymous classes
+ if java_class.class_type.is_anonymous then continue
+
+ java_class.in_hierarchy = class_hierarchy.add_node(java_class)
+
+ # Collect explicit super classes
+ var super_classes = new Array[JavaType]
+ super_classes.add_all java_class.implements
+ super_classes.add_all java_class.extends
+
+ # Remove unavailable super classes
+ for super_type in super_classes.reverse_iterator do
+ # Is the super class available?
+ if not all_classes.keys.has(super_type.java_full_name) then super_classes.remove(super_type)
+ end
+
+ # If the is no explicit supers, add `java.lang.Object` (if it is known)
+ if super_classes.is_empty and java_class.class_type != object_type and
+ knows_the_object_class then
+ super_classes.add object_type
+ end
+
+ for super_type in super_classes do
+ # Is the super class available?
+ if not all_classes.keys.has(super_type.java_full_name) then continue
+
+ var super_class = all_classes[super_type.java_full_name]
+ class_hierarchy.add_edge(java_class, super_class)
+ end
+ end
+
+ # Flatten classes from the top one (Object like)
+ var linearized = class_hierarchy.linearize(class_hierarchy)
+
+ # Methods intro
+ for java_class in linearized do
+ var greaters = java_class.in_hierarchy.greaters
+
+ for mid, signatures in java_class.methods do
+ for signature in signatures do
+ if signature.is_static then continue
+
+ # Check if this signature exists in a parent
+ for parent in greaters do
+ if parent == java_class then continue
+
+ if not parent.methods.keys.has(mid) then continue
+
+ if parent.methods[mid].has(signature) then continue label
+ end
+
+ # This is an introduction! register it
+ java_class.local_intro_methods[mid].add signature
+
+ end label
+ end
+ end
+ end
+end
+
+# A property to a Java class
+abstract class JavaProperty
+
+ # Is this property marked static?
+ var is_static: Bool