// undefinedclass.beh // // This file contains the behavior necessary to implement the check for // undefined classes. // Visitor class which implements the undefined class check. The current // implementation does not allow for a class to be imported from a Java // package. Therefore, it currently give a warning instead of an error. UndefClassVisitor { {{ // Create new TraversalGraph which targets Term objects. public void before(Adjacency a) { TraversalGraph tg = new TraversalGraph( "from Adjacency bypassing ParentList through Any_vertex_List to Term", Main.cg ); // Iterate through each Term object. List clist = tg.gather(a); ListIterator i = clist.listIterator(); while (i.hasNext()) { // Get the Ident representation of the Term object. Ident otype = ((Term) i.next()).fetchIdent(); // Search the Cd_graph for this class. Adjacency result = Main.cdg.search(otype); // If it doesn't exist then report error. if (result == null) { System.out.println( "*** Warning: Class " + a.fetchIdent() + " references an object of type " + otype + ". Class " + otype + " is not defined in the class dictionary." + " Disregard this warning if class " + otype + " is defined in an imported package." + '\n' ); Main.wcount++; } } } }} }