From dougo@ccs.neu.edu Sat Dec 16 01:44:59 2000 X-UIDL: bb7bc5e49a1da7c1ed1b46efa8b6a54c Return-Path: Received: from vega.ccs.neu.edu (dougo@vega.ccs.neu.edu [129.10.116.206]) by amber.ccs.neu.edu (8.10.0.Beta10/8.10.0.Beta10) with ESMTP id eBG6ivX14926; Sat, 16 Dec 2000 01:44:57 -0500 (EST) Received: (from dougo@localhost) by vega.ccs.neu.edu (8.10.0.Beta10/8.10.0.Beta10) id eBG6iuE16185; Sat, 16 Dec 2000 01:44:56 -0500 (EST) From: Doug Orleans Message-ID: <14907.3944.130188.238931@vega.ccs.neu.edu> Date: Sat, 16 Dec 2000 01:44:56 -0500 (EST) To: Karl Lieberherr Cc: avi@ccs.neu.edu, dougo@ccs.neu.edu Subject: Re: DJ and collection classes In-Reply-To: <200012151631.eBFGV6301751@gomeisa.ccs.neu.edu> References: <200012151631.eBFGV6301751@gomeisa.ccs.neu.edu> X-Mailer: VM 6.72 under 21.1 (patch 3) "Acadia" XEmacs Lucid X-Face: (4D-osoq?}7M3\EgvbWKo Hi Doug: > > /proj/adaptive3/lieber/grading/com3360/avi > > Avi and I don't understand why DJ does not traverse > in to the list of emplyees, if > we change Vector to the List interface in Main.java and University.java. > > Is this a bug in DJ? > We checked class graph and traversal graph and they looked fine. It's sort of a bug in DJ. The problem is that if the concrete class of the object that's a List, e.g. ArrayList, is not in the TraversalGraph, then the traverse algorithm will stop when it sees the class that it doesn't know about. The reason it's not in the TraversalGraph is that it's not in the ClassGraph! And the reason it's not in the ClassGraph is that the ClassGraph is constructed from the field types, and ArrayList is only referred to in the body of the method, i.e. List employees = new ArrayList(); The field type (of University) is List, so DJ has no way of knowing that it might run across an ArrayList until it actually does so. I could probably fix this by having it check to see, when it runs into a class that's not in the TraversalGraph, if it's also not in the ClassGraph but all its superclasses are okay, then proceed. (Sorry if that doesn't make any sense-- it's just a note to myself.) I'll try this when I get back to working on DJ next quarter. Meanwhile, the workaround is simply to add the class to the ClassGraph manually: cg.addClass(ArrayList.class, false, false); --Doug