Hi guys, we have some kind of bad usage of generics in Mavibot, and I'm trying to get it fixed. The pb lies in the way we handle the data we store in a BTree. A BTree has pages (Nodes and Leaves), and those pages hold elements which can be other pages, or values. Values can themselves be simple or multiple (and we could consider that a simple value is just a specific cas of a multiple value). We also store the pages and values either in memory or on disk, so we may have references to physical storage in the second case. This is not quite simple to mimic using generics. Let's sumup all those things : A Node stores Pages (either Nodes or Leaves), which may be dereferenced if they are not in memory. A Leaf stores Values which may be simpe or multiple, and themselves could be dereferenced if they are not in memory. Multiple values are stored in a BTree, where V is the value's type (in fact we *never* store the value, we just store the key. At this point, we can define the generic we want to use and the classes to implement those constraints ValueHolder : ------------- Defines a value stored in memory. MultipleValueHolder : --------------------- o Defines a value where V is a multiple value stored in a BTree : MultipleValueHolder extends ValueHolder> o Stored in memory ReferenceValueHolder : ---------------------- This is a simple value stored on disk. We may have to read it from the disk, but t may be present in memory too. ReferenceValueHolder extends ValueHolder ReferenceMultipleValueHolder : ------------------------------ o Defines a value where V is a multiple value stored in a BTree : ReferenceMultipleValueHolder extends ReferenceValueHolder> o Stored in disk, so may be dereferenced if it's not present in memory Page : ------ A Page can be either a Node or a Leaf. Page Node : ------ Stores references to other pages (Node or Leaf) Node extends Page Leaf : ------ Stores references to values (either simple of multiple, either in memory or dereferenced) Leaf extends Page ReferencePage : --------------- When a page is not present in memory, it can be loaded from disk. ReferencePage extends Page ReferenceNode : --------------- A Node which is stored on disk ReferenceNode extends Node ReferenceLeaf : --------------- A Leaf which is stored on disk ReferenceLeaf extends Leaf Now, we never know in advance if we will store references or memory values into a leaf or a node, at least when we create a BTree. The BTree will use references whan it's managed. At this point, I'm a bit stuck and I'm facing some issue when dealing with multipleValues, and get a Classcast expression when trying to add a new value. I'm working on it though... -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com