From: aclement Date: Thu, 28 Aug 2008 16:26:41 +0000 (+0000) Subject: removed unused code and chewed on by formatter X-Git-Tag: V1_6_2~150 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=94de8ca9978d7f6176c6a86cb29896ca7c6479d9;p=aspectj.git removed unused code and chewed on by formatter --- diff --git a/asm/src/org/aspectj/asm/AsmManager.java b/asm/src/org/aspectj/asm/AsmManager.java index f32e9c1bb..5f47f958b 100644 --- a/asm/src/org/aspectj/asm/AsmManager.java +++ b/asm/src/org/aspectj/asm/AsmManager.java @@ -11,7 +11,6 @@ * Andy Clement incremental support and switch on/off state * ******************************************************************/ - package org.aspectj.asm; import java.io.BufferedWriter; @@ -43,61 +42,64 @@ import org.aspectj.asm.internal.RelationshipMap; import org.aspectj.bridge.ISourceLocation; /** - * The Abstract Structure Model (ASM) represents the containment hierarchy and crossccutting - * structure map for AspectJ programs. It is used by IDE views such as the document outline, - * and by other tools such as ajdoc to show both AspectJ declarations and crosscutting links, - * such as which advice affects which join point shadows. + * The Abstract Structure Model (ASM) represents the containment hierarchy and crossccutting structure map for AspectJ programs. It + * is used by IDE views such as the document outline, and by other tools such as ajdoc to show both AspectJ declarations and + * crosscutting links, such as which advice affects which join point shadows. * * @author Mik Kersten */ public class AsmManager { - + /** - * @deprecated use getDefault() method instead - */ + * @deprecated use getDefault() method instead + */ private static AsmManager INSTANCE = new AsmManager(); - - private IElementHandleProvider handleProvider; - private List structureListeners = new ArrayList(); -// private boolean shouldSaveModel = true; + private IElementHandleProvider handleProvider; + private List structureListeners = new ArrayList(); + + // private boolean shouldSaveModel = true; + + public void setRelationshipMap(IRelationshipMap irm) { + mapper = irm; + } + + public void setHierarchy(IHierarchy ih) { + hierarchy = ih; + } - - public void setRelationshipMap(IRelationshipMap irm) { mapper = irm;} - public void setHierarchy(IHierarchy ih) { hierarchy=ih;} - // The model is 'manipulated' by the AjBuildManager.setupModel() code which trashes all the // fields when setting up a new model for a batch build. // Due to the requirements of incremental compilation we need to tie some of the info // below to the AjState for a compilation and recover it if switching between projects. protected IHierarchy hierarchy; private IRelationshipMap mapper; - + private static boolean creatingModel = false; - public static boolean dumpModelPostBuild = false; // Dumping the model is expensive + public static boolean dumpModelPostBuild = false; // Dumping the model is expensive // SECRETAPI asc pull the secret options together into a system API you lazy fool - public static boolean attemptIncrementalModelRepairs = false; + public static boolean attemptIncrementalModelRepairs = false; - // For offline debugging, you can now ask for the AsmManager to - // dump the model - see the method setReporting() + // For offline debugging, you can now ask for the AsmManager to + // dump the model - see the method setReporting() private static boolean dumpModel = false; private static boolean dumpRelationships = false; private static boolean dumpDeltaProcessing = false; private static IModelFilter modelFilter = null; - private static String dumpFilename = ""; + private static String dumpFilename = ""; private static boolean reporting = false; private static boolean completingTypeBindings = false; - -// static { -// setReporting("c:/model.nfo",true,true,true,true); -// } - - protected AsmManager() { - handleProvider = new JDTLikeHandleProvider(); - createNewASM(); - } - + + // static { + // setReporting("c:/model.nfo",true,true,true,true); + // } + + protected AsmManager() { + handleProvider = new JDTLikeHandleProvider(); + createNewASM(); + } + public void createNewASM() { hierarchy = new AspectJElementHierarchy(); mapper = new RelationshipMap(hierarchy); @@ -106,281 +108,278 @@ public class AsmManager { handleProvider.initialize(); } - public IHierarchy getHierarchy() { - return hierarchy; + public IHierarchy getHierarchy() { + return hierarchy; } public static AsmManager getDefault() { return INSTANCE; } - + public IRelationshipMap getRelationshipMap() { return mapper; } public void fireModelUpdated() { - notifyListeners(); + notifyListeners(); if (dumpModelPostBuild && hierarchy.getConfigFile() != null) { writeStructureModel(hierarchy.getConfigFile()); } } - /** - * Constructs map each time it's called. - */ - public HashMap getInlineAnnotations( - String sourceFile, - boolean showSubMember, - boolean showMemberAndType) { - - if (!hierarchy.isValid()) return null; - - HashMap annotations = new HashMap(); - IProgramElement node = hierarchy.findElementForSourceFile(sourceFile); - if (node == IHierarchy.NO_STRUCTURE) { - return null; - } else { - IProgramElement fileNode = node; - ArrayList peNodes = new ArrayList(); - getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType); - for (Iterator it = peNodes.iterator(); it.hasNext(); ) { - IProgramElement peNode = (IProgramElement)it.next(); - List entries = new ArrayList(); - entries.add(peNode); - ISourceLocation sourceLoc = peNode.getSourceLocation(); - if (null != sourceLoc) { - Integer hash = new Integer(sourceLoc.getLine()); - List existingEntry = (List)annotations.get(hash); - if (existingEntry != null) { - entries.addAll(existingEntry); - } - annotations.put(hash, entries); - } - } - return annotations; - } - } - - private void getAllStructureChildren(IProgramElement node, List result, boolean showSubMember, boolean showMemberAndType) { - List children = node.getChildren(); - if (node.getChildren() == null) return; - for (Iterator it = children.iterator(); it.hasNext(); ) { - IProgramElement next = (IProgramElement)it.next(); - List rels = AsmManager.getDefault().getRelationshipMap().get(next); - if (next != null - && ((next.getKind() == IProgramElement.Kind.CODE && showSubMember) - || (next.getKind() != IProgramElement.Kind.CODE && showMemberAndType)) - && rels != null - && rels.size() > 0) { - result.add(next); - } - getAllStructureChildren(next, result, showSubMember, showMemberAndType); - } - } - - public void addListener(IHierarchyListener listener) { - structureListeners.add(listener); - } - - public void removeStructureListener(IHierarchyListener listener) { - structureListeners.remove(listener); - } + /** + * Constructs map each time it's called. + */ + public HashMap getInlineAnnotations(String sourceFile, boolean showSubMember, boolean showMemberAndType) { + + if (!hierarchy.isValid()) + return null; + + HashMap annotations = new HashMap(); + IProgramElement node = hierarchy.findElementForSourceFile(sourceFile); + if (node == IHierarchy.NO_STRUCTURE) { + return null; + } else { + IProgramElement fileNode = node; + ArrayList peNodes = new ArrayList(); + getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType); + for (Iterator it = peNodes.iterator(); it.hasNext();) { + IProgramElement peNode = (IProgramElement) it.next(); + List entries = new ArrayList(); + entries.add(peNode); + ISourceLocation sourceLoc = peNode.getSourceLocation(); + if (null != sourceLoc) { + Integer hash = new Integer(sourceLoc.getLine()); + List existingEntry = (List) annotations.get(hash); + if (existingEntry != null) { + entries.addAll(existingEntry); + } + annotations.put(hash, entries); + } + } + return annotations; + } + } + + private void getAllStructureChildren(IProgramElement node, List result, boolean showSubMember, boolean showMemberAndType) { + List children = node.getChildren(); + if (node.getChildren() == null) + return; + for (Iterator it = children.iterator(); it.hasNext();) { + IProgramElement next = (IProgramElement) it.next(); + List rels = AsmManager.getDefault().getRelationshipMap().get(next); + if (next != null + && ((next.getKind() == IProgramElement.Kind.CODE && showSubMember) || (next.getKind() != IProgramElement.Kind.CODE && showMemberAndType)) + && rels != null && rels.size() > 0) { + result.add(next); + } + getAllStructureChildren(next, result, showSubMember, showMemberAndType); + } + } + + public void addListener(IHierarchyListener listener) { + structureListeners.add(listener); + } + + public void removeStructureListener(IHierarchyListener listener) { + structureListeners.remove(listener); + } // this shouldn't be needed - but none of the people that add listeners // in the test suite ever remove them. AMC added this to be called in - // setup() so that the test cases would cease leaking listeners and go + // setup() so that the test cases would cease leaking listeners and go // back to executing at a reasonable speed. public void removeAllListeners() { structureListeners.clear(); } - private void notifyListeners() { - for (Iterator it = structureListeners.iterator(); it.hasNext(); ) { - ((IHierarchyListener)it.next()).elementsUpdated(hierarchy); - } - } - - public IElementHandleProvider getHandleProvider() { - return handleProvider; - } - - public void setHandleProvider(IElementHandleProvider handleProvider) { - this.handleProvider = handleProvider; - } - + private void notifyListeners() { + for (Iterator it = structureListeners.iterator(); it.hasNext();) { + ((IHierarchyListener) it.next()).elementsUpdated(hierarchy); + } + } + + public IElementHandleProvider getHandleProvider() { + return handleProvider; + } + + public void setHandleProvider(IElementHandleProvider handleProvider) { + this.handleProvider = handleProvider; + } + /** * Fails silently. */ - public void writeStructureModel(String configFilePath) { - try { - String filePath = genExternFilePath(configFilePath); - FileOutputStream fos = new FileOutputStream(filePath); - ObjectOutputStream s = new ObjectOutputStream(fos); - s.writeObject(hierarchy); // Store the program element tree - s.writeObject(mapper); // Store the relationships - s.flush(); - fos.flush(); - fos.close(); - s.close(); - } catch (Exception e) { - // System.err.println("AsmManager: Unable to write structure model: "+configFilePath+" because of:"); - // e.printStackTrace(); - } - } - - /** - * @todo add proper handling of bad paths/suffixes/etc - * @param configFilePath path to an ".lst" file - */ - public void readStructureModel(String configFilePath) { - boolean hierarchyReadOK = false; - try { - if (configFilePath == null) { - hierarchy.setRoot(IHierarchy.NO_STRUCTURE); - } else { - String filePath = genExternFilePath(configFilePath); - FileInputStream in = new FileInputStream(filePath); - ObjectInputStream s = new ObjectInputStream(in); - hierarchy = (AspectJElementHierarchy)s.readObject(); - hierarchyReadOK = true; - mapper = (RelationshipMap)s.readObject(); - ((RelationshipMap)mapper).setHierarchy(hierarchy); - } - } catch (FileNotFoundException fnfe) { - // That is OK + public void writeStructureModel(String configFilePath) { + try { + String filePath = genExternFilePath(configFilePath); + FileOutputStream fos = new FileOutputStream(filePath); + ObjectOutputStream s = new ObjectOutputStream(fos); + s.writeObject(hierarchy); // Store the program element tree + s.writeObject(mapper); // Store the relationships + s.flush(); + fos.flush(); + fos.close(); + s.close(); + } catch (Exception e) { + // System.err.println("AsmManager: Unable to write structure model: "+configFilePath+" because of:"); + // e.printStackTrace(); + } + } + + /** + * @todo add proper handling of bad paths/suffixes/etc + * @param configFilePath path to an ".lst" file + */ + public void readStructureModel(String configFilePath) { + boolean hierarchyReadOK = false; + try { + if (configFilePath == null) { + hierarchy.setRoot(IHierarchy.NO_STRUCTURE); + } else { + String filePath = genExternFilePath(configFilePath); + FileInputStream in = new FileInputStream(filePath); + ObjectInputStream s = new ObjectInputStream(in); + hierarchy = (AspectJElementHierarchy) s.readObject(); + hierarchyReadOK = true; + mapper = (RelationshipMap) s.readObject(); + ((RelationshipMap) mapper).setHierarchy(hierarchy); + } + } catch (FileNotFoundException fnfe) { + // That is OK hierarchy.setRoot(IHierarchy.NO_STRUCTURE); } catch (EOFException eofe) { // Might be an old format sym file that is missing its relationships if (!hierarchyReadOK) { - System.err.println("AsmManager: Unable to read structure model: "+configFilePath+" because of:"); + System.err.println("AsmManager: Unable to read structure model: " + configFilePath + " because of:"); eofe.printStackTrace(); hierarchy.setRoot(IHierarchy.NO_STRUCTURE); } - } catch (Exception e) { - // System.err.println("AsmManager: Unable to read structure model: "+configFilePath+" because of:"); - // e.printStackTrace(); - hierarchy.setRoot(IHierarchy.NO_STRUCTURE); - } finally { - notifyListeners(); - } - } - - private String genExternFilePath(String configFilePath) { - // sometimes don't have ".lst" - if (configFilePath.lastIndexOf(".lst") != -1) { - configFilePath = configFilePath.substring(0,configFilePath.lastIndexOf(".lst")); + } catch (Exception e) { + // System.err.println("AsmManager: Unable to read structure model: "+configFilePath+" because of:"); + // e.printStackTrace(); + hierarchy.setRoot(IHierarchy.NO_STRUCTURE); + } finally { + notifyListeners(); } - return configFilePath + ".ajsym"; - } - -// public void setShouldSaveModel(boolean shouldSaveModel) { -// this.shouldSaveModel = shouldSaveModel; -// } - + } + + private String genExternFilePath(String configFilePath) { + // sometimes don't have ".lst" + if (configFilePath.lastIndexOf(".lst") != -1) { + configFilePath = configFilePath.substring(0, configFilePath.lastIndexOf(".lst")); + } + return configFilePath + ".ajsym"; + } + + // public void setShouldSaveModel(boolean shouldSaveModel) { + // this.shouldSaveModel = shouldSaveModel; + // } + // ==== implementation of canonical file path map and accessors ============== - // a more sophisticated optimisation is left here commented out as the - // performance gains don't justify the disturbance this close to a release... + // a more sophisticated optimisation is left here commented out as the + // performance gains don't justify the disturbance this close to a release... // can't call prepareForWeave until preparedForCompilation has completed... -// public synchronized void prepareForCompilation(List files) { -// canonicalFilePathMap.prepopulate(files); -// } -// -// public synchronized void prepareForWeave() { -// canonicalFilePathMap.handover(); -// } - + // public synchronized void prepareForCompilation(List files) { + // canonicalFilePathMap.prepopulate(files); + // } + // + // public synchronized void prepareForWeave() { + // canonicalFilePathMap.handover(); + // } + public String getCanonicalFilePath(File f) { return canonicalFilePathMap.get(f); } - + private CanonicalFilePathMap canonicalFilePathMap = new CanonicalFilePathMap(); - + private static class CanonicalFilePathMap { private static final int MAX_SIZE = 4000; - + private Map pathMap = new HashMap(20); -// // guards to ensure correctness and liveness -// private boolean cacheInUse = false; -// private boolean stopRequested = false; -// -// private synchronized boolean isCacheInUse() { -// return cacheInUse; -// } -// -// private synchronized void setCacheInUse(boolean val) { -// cacheInUse = val; -// if (val) { -// notifyAll(); -// } -// } -// -// private synchronized boolean isStopRequested() { -// return stopRequested; -// } -// -// private synchronized void requestStop() { -// stopRequested = true; -// } -// -// /** -// * Begin prepopulating the map by adding an entry from -// * file.getPath -> file.getCanonicalPath for each file in -// * the list. Do this on a background thread. -// * @param files -// */ -// public void prepopulate(final List files) { -// stopRequested = false; -// setCacheInUse(false); -// if (pathMap.size() > MAX_SIZE) { -// pathMap.clear(); -// } -// new Thread() { -// public void run() { -// System.out.println("Starting cache population: " + System.currentTimeMillis()); -// Iterator it = files.iterator(); -// while (!isStopRequested() && it.hasNext()) { -// File f = (File)it.next(); -// if (pathMap.get(f.getPath()) == null) { -// // may reuse cache across compiles from ides... -// try { -// pathMap.put(f.getPath(),f.getCanonicalPath()); -// } catch (IOException ex) { -// pathMap.put(f.getPath(),f.getPath()); -// } -// } -// } -// System.out.println("Cached " + files.size()); -// setCacheInUse(true); -// System.out.println("Cache populated: " + System.currentTimeMillis()); -// } -// }.start(); -// } -// -// /** -// * Stop pre-populating the cache - our customers are ready to use it. -// * If there are any cache misses from this point on, we'll populate the -// * cache as we go. -// * The handover is done this way to ensure that only one thread is ever -// * accessing the cache, and that we minimize synchronization. -// */ -// public synchronized void handover() { -// if (!isCacheInUse()) { -// requestStop(); -// try { -// while (!isCacheInUse()) wait(); -// } catch (InterruptedException intEx) { } // just continue -// } -// } - + // // guards to ensure correctness and liveness + // private boolean cacheInUse = false; + // private boolean stopRequested = false; + // + // private synchronized boolean isCacheInUse() { + // return cacheInUse; + // } + // + // private synchronized void setCacheInUse(boolean val) { + // cacheInUse = val; + // if (val) { + // notifyAll(); + // } + // } + // + // private synchronized boolean isStopRequested() { + // return stopRequested; + // } + // + // private synchronized void requestStop() { + // stopRequested = true; + // } + // + // /** + // * Begin prepopulating the map by adding an entry from + // * file.getPath -> file.getCanonicalPath for each file in + // * the list. Do this on a background thread. + // * @param files + // */ + // public void prepopulate(final List files) { + // stopRequested = false; + // setCacheInUse(false); + // if (pathMap.size() > MAX_SIZE) { + // pathMap.clear(); + // } + // new Thread() { + // public void run() { + // System.out.println("Starting cache population: " + System.currentTimeMillis()); + // Iterator it = files.iterator(); + // while (!isStopRequested() && it.hasNext()) { + // File f = (File)it.next(); + // if (pathMap.get(f.getPath()) == null) { + // // may reuse cache across compiles from ides... + // try { + // pathMap.put(f.getPath(),f.getCanonicalPath()); + // } catch (IOException ex) { + // pathMap.put(f.getPath(),f.getPath()); + // } + // } + // } + // System.out.println("Cached " + files.size()); + // setCacheInUse(true); + // System.out.println("Cache populated: " + System.currentTimeMillis()); + // } + // }.start(); + // } + // + // /** + // * Stop pre-populating the cache - our customers are ready to use it. + // * If there are any cache misses from this point on, we'll populate the + // * cache as we go. + // * The handover is done this way to ensure that only one thread is ever + // * accessing the cache, and that we minimize synchronization. + // */ + // public synchronized void handover() { + // if (!isCacheInUse()) { + // requestStop(); + // try { + // while (!isCacheInUse()) wait(); + // } catch (InterruptedException intEx) { } // just continue + // } + // } + public String get(File f) { -// if (!cacheInUse) { // unsynchronized test - should never be parallel -// // threads at this point -// throw new IllegalStateException( -// "Must take ownership of cache before using by calling " + -// "handover()"); -// } + // if (!cacheInUse) { // unsynchronized test - should never be parallel + // // threads at this point + // throw new IllegalStateException( + // "Must take ownership of cache before using by calling " + + // "handover()"); + // } String ret = (String) pathMap.get(f.getPath()); if (ret == null) { try { @@ -388,60 +387,61 @@ public class AsmManager { } catch (IOException ioEx) { ret = f.getPath(); } - pathMap.put(f.getPath(),ret); - if (pathMap.size() > MAX_SIZE) pathMap.clear(); + pathMap.put(f.getPath(), ret); + if (pathMap.size() > MAX_SIZE) + pathMap.clear(); } return ret; } } // SECRETAPI - public static void setReporting(String filename,boolean dModel,boolean dRels,boolean dDeltaProcessing, - boolean deletefile) { - reporting = true; - dumpModel = dModel; + public static void setReporting(String filename, boolean dModel, boolean dRels, boolean dDeltaProcessing, boolean deletefile) { + reporting = true; + dumpModel = dModel; dumpRelationships = dRels; dumpDeltaProcessing = dDeltaProcessing; - if (deletefile) new File(filename).delete(); - dumpFilename = filename; + if (deletefile) + new File(filename).delete(); + dumpFilename = filename; } - - public static void setReporting(String filename,boolean dModel,boolean dRels,boolean dDeltaProcessing, - boolean deletefile,IModelFilter aFilter) { - setReporting(filename,dModel,dRels,dDeltaProcessing,deletefile); + + public static void setReporting(String filename, boolean dModel, boolean dRels, boolean dDeltaProcessing, boolean deletefile, + IModelFilter aFilter) { + setReporting(filename, dModel, dRels, dDeltaProcessing, deletefile); modelFilter = aFilter; } - + public static boolean isReporting() { return reporting; } - + public static void setDontReport() { reporting = false; - dumpDeltaProcessing=false; - dumpModel=false; - dumpRelationships=false; + dumpDeltaProcessing = false; + dumpModel = false; + dumpRelationships = false; } - // NB. If the format of this report changes then the model tests - // (@see org.aspectj.systemtest.model.ModelTestCase) will fail in - // their comparison. The tests are assuming that both the model + // (@see org.aspectj.systemtest.model.ModelTestCase) will fail in + // their comparison. The tests are assuming that both the model // and relationship map are reported and as a consequence single // testcases test that both the model and relationship map are correct. public void reportModelInfo(String reasonForReport) { - if (!dumpModel && !dumpRelationships) return; + if (!dumpModel && !dumpRelationships) + return; try { - FileWriter fw = new FileWriter(dumpFilename,true); + FileWriter fw = new FileWriter(dumpFilename, true); BufferedWriter bw = new BufferedWriter(fw); if (dumpModel) { - bw.write("=== MODEL STATUS REPORT ========= "+reasonForReport+"\n"); - dumptree(bw,AsmManager.getDefault().getHierarchy().getRoot(),0); - + bw.write("=== MODEL STATUS REPORT ========= " + reasonForReport + "\n"); + dumptree(bw, AsmManager.getDefault().getHierarchy().getRoot(), 0); + bw.write("=== END OF MODEL REPORT =========\n"); } if (dumpRelationships) { - bw.write("=== RELATIONSHIPS REPORT ========= "+reasonForReport+"\n"); + bw.write("=== RELATIONSHIPS REPORT ========= " + reasonForReport + "\n"); dumprels(bw); bw.write("=== END OF RELATIONSHIPS REPORT ==\n"); } @@ -449,8 +449,8 @@ public class AsmManager { Enumeration pkeyenum = p.keys(); bw.write("=== Properties of the model and relationships map =====\n"); while (pkeyenum.hasMoreElements()) { - String pkey = (String)pkeyenum.nextElement(); - bw.write(pkey+"="+p.getProperty(pkey)+"\n"); + String pkey = (String) pkeyenum.nextElement(); + bw.write(pkey + "=" + p.getProperty(pkey) + "\n"); } bw.flush(); fw.close(); @@ -459,321 +459,334 @@ public class AsmManager { e.printStackTrace(); } } - - public static void dumptree(Writer w,IProgramElement node,int indent) throws IOException { - for (int i =0 ;i>removeRelationshipsTargettingThisType "+typename); + boolean debug = false; + if (debug) + System.err.println(">>removeRelationshipsTargettingThisType " + typename); String pkg = null; - String type= typename; + String type = typename; int lastSep = typename.lastIndexOf('.'); if (lastSep != -1) { - pkg = typename.substring(0,lastSep); - type= typename.substring(lastSep+1); + pkg = typename.substring(0, lastSep); + type = typename.substring(lastSep + 1); } - boolean didsomething=false; - IProgramElement typeNode = hierarchy.findElementForType(pkg,type); - + boolean didsomething = false; + IProgramElement typeNode = hierarchy.findElementForType(pkg, type); + // Reasons for that being null: // 1. the file has fundamental errors and so doesn't exist in the model (-proceedOnError probably forced us to weave) - if (typeNode == null) return; + if (typeNode == null) + return; - Set sourcesToRemove = new HashSet(); + Set sourcesToRemove = new HashSet(); - // Iterate over the source handles in the relationships map, the aim here is to remove any 'affected by' - // relationships where the source of the relationship is the specified type (since it will be readded + // Iterate over the source handles in the relationships map, the aim here is to remove any 'affected by' + // relationships where the source of the relationship is the specified type (since it will be readded // when the type is woven) Set sourcehandlesSet = mapper.getEntries(); List relationshipsToRemove = new ArrayList(); for (Iterator keyiter = sourcehandlesSet.iterator(); keyiter.hasNext();) { - String hid = (String) keyiter.next(); - IProgramElement sourceElement = hierarchy.getElement(hid); - if (sourceElement == null || sameType(hid,sourceElement,typeNode)) { - // worth continuing as there may be a relationship to remove - relationshipsToRemove.clear(); - List relationships = mapper.get(hid); - for (Iterator reliter = relationships.iterator();reliter.hasNext();) { + String hid = (String) keyiter.next(); + IProgramElement sourceElement = hierarchy.getElement(hid); + if (sourceElement == null || sameType(hid, sourceElement, typeNode)) { + // worth continuing as there may be a relationship to remove + relationshipsToRemove.clear(); + List relationships = mapper.get(hid); + for (Iterator reliter = relationships.iterator(); reliter.hasNext();) { IRelationship rel = (IRelationship) reliter.next(); - if (rel.getKind()==IRelationship.Kind.USES_POINTCUT) continue; // these relationships are added at compile time, argh - if (rel.isAffects()) continue; // we want 'affected by' relationships - (e.g. advised by) + if (rel.getKind() == IRelationship.Kind.USES_POINTCUT) + continue; // these relationships are added at compile time, argh + if (rel.isAffects()) + continue; // we want 'affected by' relationships - (e.g. advised by) relationshipsToRemove.add(rel); // all the relationships can be removed, regardless of the target(s) } // Now, were any relationships emptied during that processing and so need removing for this source handle - if (relationshipsToRemove.size()>0) { - didsomething=true; - if (relationshipsToRemove.size() == relationships.size()) sourcesToRemove.add(hid); + if (relationshipsToRemove.size() > 0) { + didsomething = true; + if (relationshipsToRemove.size() == relationships.size()) + sourcesToRemove.add(hid); else { - for (int i = 0 ;i0) { + if (relationshipsToRemove.size() > 0) { // Are we removing *all* of the relationships for this source handle? - if (relationshipsToRemove.size() == relationships.size()) sourcesToRemove.add(hid); + if (relationshipsToRemove.size() == relationships.size()) + sourcesToRemove.add(hid); else { - for (int i = 0 ;i0) { - // Are we removing *all* of the relationships for this source handle? - if (relationshipsToRemove.size() == relationships.size()) { - // We know they are all going to go, so just delete the source handle. - sourcesToRemove.add(hid); - } else { - // MEMORY LEAK - we don't remove the relationships !! - for (int i = 0 ;i 0) { + // Are we removing *all* of the relationships for this source handle? + if (relationshipsToRemove.size() == relationships.size()) { + // We know they are all going to go, so just delete the source handle. + sourcesToRemove.add(hid); + } else { + // MEMORY LEAK - we don't remove the relationships !! + for (int i = 0; i < relationshipsToRemove.size(); i++) { + IRelationship irel = (IRelationship) relationshipsToRemove.get(i); + verifyAssumption(irm.remove(hid, irel), "Failed to remove relationship " + irel.getName() + + " for shid " + hid); + } + List rels = irm.get(hid); + if (rels == null || rels.size() == 0) + sourcesToRemove.add(hid); } - List rels = irm.get(hid); - if (rels==null || rels.size()==0) sourcesToRemove.add(hid); } } } } - } - // Remove sources that have no valid relationships any more - for (Iterator srciter = sourcesToRemove.iterator(); srciter.hasNext();) { - String hid = (String) srciter.next(); - irm.removeAll(hid); - IProgramElement ipe = model.getElement(hid); - if (ipe!=null) { - // If the relationship was hanging off a 'code' node, delete it. - if (ipe.getKind().equals(IProgramElement.Kind.CODE)) { - //System.err.println("Deleting code node"); - removeSingleNode(ipe); - } + // Remove sources that have no valid relationships any more + for (Iterator srciter = sourcesToRemove.iterator(); srciter.hasNext();) { + String hid = (String) srciter.next(); + irm.removeAll(hid); + IProgramElement ipe = model.getElement(hid); + if (ipe != null) { + // If the relationship was hanging off a 'code' node, delete it. + if (ipe.getKind().equals(IProgramElement.Kind.CODE)) { + // System.err.println("Deleting code node"); + removeSingleNode(ipe); + } + } } - } } catch (IOException ioe) { System.err.println("Failed to repair relationships:"); ioe.printStackTrace(); } } - + /** - * Removes a specified program element from the structure model. - * We go to the parent of the program element, ask for all its children - * and remove the node we want to delete from the list of children. + * Removes a specified program element from the structure model. We go to the parent of the program element, ask for all its + * children and remove the node we want to delete from the list of children. */ private void removeSingleNode(IProgramElement progElem) { - verifyAssumption(progElem!=null); + verifyAssumption(progElem != null); boolean deleteOK = false; IProgramElement parent = progElem.getParent(); List kids = parent.getChildren(); - for (int i =0 ;iFirst: We go to the parent of the program element, ask for all its children - * and remove the node we want to delete from the list of children. - *

Second:We check if that parent has any other children. If it has no other - * children and it is either a CODE node or a PACKAGE node, we delete it too. + * Removes a specified program element from the structure model. Two processing stages: + *

+ * First: We go to the parent of the program element, ask for all its children and remove the node we want to delete from the + * list of children. + *

+ * Second:We check if that parent has any other children. If it has no other children and it is either a CODE node or a PACKAGE + * node, we delete it too. */ private void removeNode(IProgramElement progElem) { - -// StringBuffer flightrecorder = new StringBuffer(); + + // StringBuffer flightrecorder = new StringBuffer(); try { -// flightrecorder.append("In removeNode, about to chuck away: "+progElem+"\n"); - - verifyAssumption(progElem!=null); -// boolean deleteOK = false; + // flightrecorder.append("In removeNode, about to chuck away: "+progElem+"\n"); + + verifyAssumption(progElem != null); + // boolean deleteOK = false; IProgramElement parent = progElem.getParent(); -// flightrecorder.append("Parent of it is "+parent+"\n"); + // flightrecorder.append("Parent of it is "+parent+"\n"); List kids = parent.getChildren(); -// flightrecorder.append("Which has "+kids.size()+" kids\n"); - for (int i =0 ;i0) formalComment = comment; + // if (comment!=null && comment.length()>0) formalComment = comment; this.modifiers = modifiers; } - - /** - * Use to create program element nodes that correspond to source locations. - */ - public ProgramElement( - String name, - Kind kind, - int modifiers, - //Accessibility accessibility, - String declaringType, - String packageName, - String comment, - ISourceLocation sourceLocation, - List relations, - List children, - boolean member) { - this(name, kind, children); - this.sourceLocation = sourceLocation; - this.kind = kind; - this.modifiers = modifiers; - setDeclaringType(declaringType);//this.declaringType = declaringType; - //this.packageName = packageName; - setFormalComment(comment); -// if (comment!=null && comment.length()>0) formalComment = comment; - if (relations!=null && relations.size()!=0) setRelations(relations); -// this.relations = relations; - } + // /** + // * Use to create program element nodes that correspond to source locations. + // */ + // public ProgramElement( + // String name, + // Kind kind, + // int modifiers, + // //Accessibility accessibility, + // String declaringType, + // String packageName, + // String comment, + // ISourceLocation sourceLocation, + // List relations, + // List children, + // boolean member) { + // + // this(name, kind, children); + // this.sourceLocation = sourceLocation; + // this.kind = kind; + // this.modifiers = modifiers; + // setDeclaringType(declaringType);//this.declaringType = declaringType; + // //this.packageName = packageName; + // setFormalComment(comment); + // // if (comment!=null && comment.length()>0) formalComment = comment; + // if (relations!=null && relations.size()!=0) setRelations(relations); + // // this.relations = relations; + // } public List getModifiers() { return genModifiers(this.modifiers); @@ -117,22 +116,25 @@ public class ProgramElement implements IProgramElement { public Accessibility getAccessibility() { return genAccessibility(this.modifiers); } - + public void setDeclaringType(String t) { - if (t!=null && t.length()>0) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("declaringType",t); + if (t != null && t.length() > 0) { + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("declaringType", t); } } public String getDeclaringType() { - String dt = (String)kvpairs.get("declaringType"); - if (dt==null) return ""; // assumption that not having one means "" is at HtmlDecorator line 111 + String dt = (String) kvpairs.get("declaringType"); + if (dt == null) + return ""; // assumption that not having one means "" is at HtmlDecorator line 111 return dt; } public String getPackageName() { - if (kind == Kind.PACKAGE) return getName(); + if (kind == Kind.PACKAGE) + return getName(); if (getParent() == null) { return ""; } @@ -154,18 +156,19 @@ public class ProgramElement implements IProgramElement { // not really sure why we have this setter ... how can we be in the situation where we didn't // know the location when we built the node but we learned it later on? public void setSourceLocation(ISourceLocation sourceLocation) { -// this.sourceLocation = sourceLocation; + // this.sourceLocation = sourceLocation; } public IMessage getMessage() { - return (IMessage)kvpairs.get("message"); -// return message; + return (IMessage) kvpairs.get("message"); + // return message; } public void setMessage(IMessage message) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("message",message); -// this.message = message; + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("message", message); + // this.message = message; } public IProgramElement getParent() { @@ -181,57 +184,67 @@ public class ProgramElement implements IProgramElement { } public void setRunnable(boolean value) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - if (value) kvpairs.put("isRunnable","true"); - else kvpairs.remove("isRunnable"); -// this.runnable = value; + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + if (value) + kvpairs.put("isRunnable", "true"); + else + kvpairs.remove("isRunnable"); + // this.runnable = value; } public boolean isRunnable() { - return kvpairs.get("isRunnable")!=null; -// return runnable; + return kvpairs.get("isRunnable") != null; + // return runnable; } public boolean isImplementor() { - return kvpairs.get("isImplementor")!=null; -// return implementor; + return kvpairs.get("isImplementor") != null; + // return implementor; } public void setImplementor(boolean value) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - if (value) kvpairs.put("isImplementor","true"); - else kvpairs.remove("isImplementor"); -// this.implementor = value; + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + if (value) + kvpairs.put("isImplementor", "true"); + else + kvpairs.remove("isImplementor"); + // this.implementor = value; } - + public boolean isOverrider() { - return kvpairs.get("isOverrider")!=null; -// return overrider; + return kvpairs.get("isOverrider") != null; + // return overrider; } public void setOverrider(boolean value) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - if (value) kvpairs.put("isOverrider","true"); - else kvpairs.remove("isOverrider"); -// this.overrider = value; + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + if (value) + kvpairs.put("isOverrider", "true"); + else + kvpairs.remove("isOverrider"); + // this.overrider = value; } public List getRelations() { - return (List)kvpairs.get("relations"); -// return relations; + return (List) kvpairs.get("relations"); + // return relations; } public void setRelations(List relations) { if (relations.size() > 0) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("relations",relations); -// this.relations = relations; + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("relations", relations); + // this.relations = relations; } } public String getFormalComment() { - return (String)kvpairs.get("formalComment"); -// return formalComment; + return (String) kvpairs.get("formalComment"); + // return formalComment; } public String toString() { @@ -240,77 +253,92 @@ public class ProgramElement implements IProgramElement { private static List genModifiers(int modifiers) { List modifiersList = new ArrayList(); - if ((modifiers & AccStatic) != 0) modifiersList.add(IProgramElement.Modifiers.STATIC); - if ((modifiers & AccFinal) != 0) modifiersList.add(IProgramElement.Modifiers.FINAL); - if ((modifiers & AccSynchronized) != 0) modifiersList.add(IProgramElement.Modifiers.SYNCHRONIZED); - if ((modifiers & AccVolatile) != 0) modifiersList.add(IProgramElement.Modifiers.VOLATILE); - if ((modifiers & AccTransient) != 0) modifiersList.add(IProgramElement.Modifiers.TRANSIENT); - if ((modifiers & AccNative) != 0) modifiersList.add(IProgramElement.Modifiers.NATIVE); - if ((modifiers & AccAbstract) != 0) modifiersList.add(IProgramElement.Modifiers.ABSTRACT); - return modifiersList; + if ((modifiers & AccStatic) != 0) + modifiersList.add(IProgramElement.Modifiers.STATIC); + if ((modifiers & AccFinal) != 0) + modifiersList.add(IProgramElement.Modifiers.FINAL); + if ((modifiers & AccSynchronized) != 0) + modifiersList.add(IProgramElement.Modifiers.SYNCHRONIZED); + if ((modifiers & AccVolatile) != 0) + modifiersList.add(IProgramElement.Modifiers.VOLATILE); + if ((modifiers & AccTransient) != 0) + modifiersList.add(IProgramElement.Modifiers.TRANSIENT); + if ((modifiers & AccNative) != 0) + modifiersList.add(IProgramElement.Modifiers.NATIVE); + if ((modifiers & AccAbstract) != 0) + modifiersList.add(IProgramElement.Modifiers.ABSTRACT); + return modifiersList; } public static IProgramElement.Accessibility genAccessibility(int modifiers) { - if ((modifiers & AccPublic) != 0) return IProgramElement.Accessibility.PUBLIC; - if ((modifiers & AccPrivate) != 0) return IProgramElement.Accessibility.PRIVATE; - if ((modifiers & AccProtected) != 0) return IProgramElement.Accessibility.PROTECTED; - if ((modifiers & AccPrivileged) != 0) return IProgramElement.Accessibility.PRIVILEGED; - else return IProgramElement.Accessibility.PACKAGE; + if ((modifiers & AccPublic) != 0) + return IProgramElement.Accessibility.PUBLIC; + if ((modifiers & AccPrivate) != 0) + return IProgramElement.Accessibility.PRIVATE; + if ((modifiers & AccProtected) != 0) + return IProgramElement.Accessibility.PROTECTED; + if ((modifiers & AccPrivileged) != 0) + return IProgramElement.Accessibility.PRIVILEGED; + else + return IProgramElement.Accessibility.PACKAGE; } - - - public String getBytecodeName() { - String s = (String)kvpairs.get("bytecodeName"); - if (s==null) return UNDEFINED; + String s = (String) kvpairs.get("bytecodeName"); + if (s == null) + return UNDEFINED; return s; } public String getBytecodeSignature() { - String s = (String)kvpairs.get("bytecodeSignature"); -// if (s==null) return UNDEFINED; + String s = (String) kvpairs.get("bytecodeSignature"); + // if (s==null) return UNDEFINED; return s; } public void setBytecodeName(String s) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("bytecodeName",s); + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("bytecodeName", s); } public void setBytecodeSignature(String s) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("bytecodeSignature",s); + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("bytecodeSignature", s); } - + public String getSourceSignature() { - return (String)kvpairs.get("sourceSignature"); + return (String) kvpairs.get("sourceSignature"); } public void setSourceSignature(String string) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); -// System.err.println(name+" SourceSig=>"+string); - kvpairs.put("sourceSignature",string); -// sourceSignature = string; + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + // System.err.println(name+" SourceSig=>"+string); + kvpairs.put("sourceSignature", string); + // sourceSignature = string; } - + public void setKind(Kind kind) { this.kind = kind; } public void setCorrespondingType(String s) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("returnType",s); -// this.returnType = s; + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("returnType", s); + // this.returnType = s; } public String getCorrespondingType() { return getCorrespondingType(false); } - + public String getCorrespondingType(boolean getFullyQualifiedType) { - String returnType = (String)kvpairs.get("returnType"); - if (returnType==null) returnType=""; + String returnType = (String) kvpairs.get("returnType"); + if (returnType == null) + returnType = ""; if (getFullyQualifiedType) { return returnType; } @@ -331,70 +359,73 @@ public class ProgramElement implements IProgramElement { public void setChildren(List children) { this.children = children; - if (children == null) return; - for (Iterator it = children.iterator(); it.hasNext(); ) { - ((IProgramElement)it.next()).setParent(this); + if (children == null) + return; + for (Iterator it = children.iterator(); it.hasNext();) { + ((IProgramElement) it.next()).setParent(this); } } public void addChild(IProgramElement child) { - if (children == null || children==Collections.EMPTY_LIST) children = new ArrayList(); + if (children == null || children == Collections.EMPTY_LIST) + children = new ArrayList(); children.add(child); child.setParent(this); } - + public void addChild(int position, IProgramElement child) { - if (children == null || children==Collections.EMPTY_LIST) children = new ArrayList(); + if (children == null || children == Collections.EMPTY_LIST) + children = new ArrayList(); children.add(position, child); child.setParent(this); } - + public boolean removeChild(IProgramElement child) { child.setParent(null); - return children.remove(child); + return children.remove(child); } - + public void setName(String string) { name = string; } public IProgramElement walk(HierarchyWalker walker) { - if (children!=null) { - for (Iterator it = children.iterator(); it.hasNext(); ) { - IProgramElement child = (IProgramElement)it.next(); - walker.process(child); - } + if (children != null) { + for (Iterator it = children.iterator(); it.hasNext();) { + IProgramElement child = (IProgramElement) it.next(); + walker.process(child); + } } return this; } - + public String toLongString() { final StringBuffer buffer = new StringBuffer(); HierarchyWalker walker = new HierarchyWalker() { private int depth = 0; - - public void preProcess(IProgramElement node) { - for (int i = 0; i < depth; i++) buffer.append(' '); + + public void preProcess(IProgramElement node) { + for (int i = 0; i < depth; i++) + buffer.append(' '); buffer.append(node.toString()); buffer.append('\n'); depth += 2; } - - public void postProcess(IProgramElement node) { + + public void postProcess(IProgramElement node) { depth -= 2; } }; walker.process(this); return buffer.toString(); } - + public void setModifiers(int i) { this.modifiers = i; } - + /** - * Convenience mechanism for setting new modifiers which do not require - * knowledge of the private internal representation + * Convenience mechanism for setting new modifiers which do not require knowledge of the private internal representation * * @param newModifier */ @@ -409,39 +440,36 @@ public class ProgramElement implements IProgramElement { public String toSignatureString(boolean getFullyQualifiedArgTypes) { StringBuffer sb = new StringBuffer(); sb.append(name); - + List ptypes = getParameterTypes(); - if (ptypes != null && (!ptypes.isEmpty() - || this.kind.equals(IProgramElement.Kind.METHOD)) - || this.kind.equals(IProgramElement.Kind.CONSTRUCTOR) - || this.kind.equals(IProgramElement.Kind.ADVICE) - || this.kind.equals(IProgramElement.Kind.POINTCUT) - || this.kind.equals(IProgramElement.Kind.INTER_TYPE_METHOD) + if (ptypes != null && (!ptypes.isEmpty() || this.kind.equals(IProgramElement.Kind.METHOD)) + || this.kind.equals(IProgramElement.Kind.CONSTRUCTOR) || this.kind.equals(IProgramElement.Kind.ADVICE) + || this.kind.equals(IProgramElement.Kind.POINTCUT) || this.kind.equals(IProgramElement.Kind.INTER_TYPE_METHOD) || this.kind.equals(IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR)) { - sb.append('('); - for (Iterator it = ptypes.iterator(); it.hasNext(); ) { - char[] arg = (char[])it.next(); + sb.append('('); + for (Iterator it = ptypes.iterator(); it.hasNext();) { + char[] arg = (char[]) it.next(); if (getFullyQualifiedArgTypes) { sb.append(arg); } else { - int index = CharOperation.lastIndexOf('.',arg); + int index = CharOperation.lastIndexOf('.', arg); if (index != -1) { - sb.append(CharOperation.subarray(arg,index+1,arg.length)); + sb.append(CharOperation.subarray(arg, index + 1, arg.length)); } else { sb.append(arg); } } - if (it.hasNext()) sb.append(","); + if (it.hasNext()) + sb.append(","); } sb.append(')'); } - - return sb.toString(); + + return sb.toString(); } - - + /** - * TODO: move the "parent != null"==>injar heuristic to more explicit + * TODO: move the "parent != null"==>injar heuristic to more explicit */ public String toLinkLabelString() { return toLinkLabelString(true); @@ -454,30 +482,30 @@ public class ProgramElement implements IProgramElement { } else if (kind.isInterTypeMember()) { if (shortITDNames) { // if (name.indexOf('.')!=-1) return toLabelString().substring(name.indexOf('.')+1); - label=""; + label = ""; } else { - int dotIndex = name.indexOf('.'); - if (dotIndex != -1) { - return parent.getName() + ": " + toLabelString().substring(dotIndex+1); - } else { - label = parent.getName() + '.'; - } + int dotIndex = name.indexOf('.'); + if (dotIndex != -1) { + return parent.getName() + ": " + toLabelString().substring(dotIndex + 1); + } else { + label = parent.getName() + '.'; + } } } else if (kind == Kind.CLASS || kind == Kind.ASPECT || kind == Kind.INTERFACE) { label = ""; } else if (kind.equals(Kind.DECLARE_PARENTS)) { label = ""; - } else { + } else { if (parent != null) { label = parent.getName() + '.'; - } else { - label = "injar aspect: "; + } else { + label = "injar aspect: "; } } label += toLabelString(getFullyQualifiedArgTypes); return label; } - + public String toLabelString() { return toLabelString(true); } @@ -487,35 +515,37 @@ public class ProgramElement implements IProgramElement { String details = getDetails(); if (details != null) { label += ": " + details; - } + } return label; } - + public String getHandleIdentifier() { return getHandleIdentifier(true); } - + public String getHandleIdentifier(boolean create) { if (null == handle && create) { - handle = AsmManager.getDefault().getHandleProvider().createHandleIdentifier(this); + handle = AsmManager.getDefault().getHandleProvider().createHandleIdentifier(this); } return handle; } - + public void setHandleIdentifier(String handle) { this.handle = handle; } - - public List getParameterNames() { - List parameterNames = (List)kvpairs.get("parameterNames"); - return parameterNames; + + public List getParameterNames() { + List parameterNames = (List) kvpairs.get("parameterNames"); + return parameterNames; } - - public void setParameterNames(List list) { - if (list==null || list.size()==0) return; - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("parameterNames",list); - //parameterNames = list; + + public void setParameterNames(List list) { + if (list == null || list.size() == 0) + return; + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("parameterNames", list); + // parameterNames = list; } public List getParameterTypes() { @@ -525,45 +555,52 @@ public class ProgramElement implements IProgramElement { } List params = new ArrayList(); for (Iterator iter = l.iterator(); iter.hasNext();) { - char[] param = (char[])iter.next(); + char[] param = (char[]) iter.next(); params.add(NameConvertor.convertFromSignature(param)); } return params; } - + public List getParameterSignatures() { - List parameters = (List)kvpairs.get("parameterSigs"); + List parameters = (List) kvpairs.get("parameterSigs"); return parameters; } public void setParameterSignatures(List list) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - if (list==null || list.size()==0) kvpairs.put("parameterSigs",Collections.EMPTY_LIST); - else kvpairs.put("parameterSigs",list); + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + if (list == null || list.size() == 0) + kvpairs.put("parameterSigs", Collections.EMPTY_LIST); + else + kvpairs.put("parameterSigs", list); } - + public String getDetails() { - String details = (String)kvpairs.get("details"); - return details; - } - public void setDetails(String string) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("details",string); - } - - public void setFormalComment(String txt) { - if (txt!=null && txt.length()>0) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("formalComment",txt); - } + String details = (String) kvpairs.get("details"); + return details; + } + + public void setDetails(String string) { + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("details", string); } - - public void setExtraInfo(ExtraInformation info) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - kvpairs.put("ExtraInformation",info); + + public void setFormalComment(String txt) { + if (txt != null && txt.length() > 0) { + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("formalComment", txt); } + } + + public void setExtraInfo(ExtraInformation info) { + if (kvpairs == Collections.EMPTY_MAP) + kvpairs = new HashMap(); + kvpairs.put("ExtraInformation", info); + } + public ExtraInformation getExtraInfo() { - return (ExtraInformation)kvpairs.get("ExtraInformation"); + return (ExtraInformation) kvpairs.get("ExtraInformation"); } } -