From: aclement Date: Mon, 16 Jan 2006 16:46:54 +0000 (+0000) Subject: pr58524 (golden oldie...) - from Helen - removing use of deprecated API in ajdoc. X-Git-Tag: POST_MEMORY_CHANGES~184 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f4c8bf91bced2ba5bc1e0aa6b264549ced1efe70;p=aspectj.git pr58524 (golden oldie...) - from Helen - removing use of deprecated API in ajdoc. --- diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Declaration.java b/ajdoc/src/org/aspectj/tools/ajdoc/Declaration.java deleted file mode 100644 index 2480c6659..000000000 --- a/ajdoc/src/org/aspectj/tools/ajdoc/Declaration.java +++ /dev/null @@ -1,302 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Common Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation - * Mik Kersten port to AspectJ 1.1+ code base - * ******************************************************************/ - -package org.aspectj.tools.ajdoc; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import org.aspectj.asm.IProgramElement; - -/** - * @author Mik Kersten - * @deprecated org.aspectj.asm.IProgramElement should be used instead - */ -public class Declaration implements Serializable { - private int beginLine; - private int endLine; - private int beginColumn; - private int endColumn; - - private String modifiers; - private String fullSignature; - private String signature; - private String crosscutDesignator; - - private String packageName; - - private String kind; - private String declaringType; - - private String filename; - private String formalComment; - - private Declaration[] declarations; - - private Handle crosscutDeclarationHandle; - private Handle[] pointedToByHandles; - private Handle[] pointsToHandles; - - transient private Declaration crosscutDeclaration; - transient private Declaration[] pointedToBy = null; - transient private Declaration[] pointsTo = null; - - private Declaration parentDeclaration = null; - private IProgramElement node; - - public Declaration(int beginLine, int endLine, int beginColumn, int endColumn, - String modifiers, String signature, String fullSignature, - String crosscutDesignator, - String declaringType, String kind, - String filename, String formalComment, - String packageName, - IProgramElement node) - { - this.beginLine = beginLine; - this.endLine = endLine; - this.beginColumn = beginColumn; - this.endColumn = endColumn; - - this.modifiers = modifiers; - this.signature = signature; - this.fullSignature = fullSignature; - - this.crosscutDesignator = crosscutDesignator; - - this.declaringType = declaringType; - this.kind = kind; - - this.filename = filename; - this.formalComment = formalComment; - - this.packageName = packageName; - - this.pointedToByHandles = new Handle[0]; - this.pointsToHandles = new Handle[0]; - //??? - this.declarations = new Declaration[0]; - this.node = node; - } - - public int getBeginLine() { return beginLine; } - public int getEndLine() { return endLine; } - public int getBeginColumn() { return beginColumn; } - public int getEndColumn() { return endColumn; } - - public String getModifiers() { return modifiers; } - public String getFullSignature() { return fullSignature; } - public String getSignature() { return signature; } - - public String getPackageName() { return packageName; } - - public String getCrosscutDesignator() { return crosscutDesignator; } - - public Declaration getParentDeclaration() { return parentDeclaration; } - - public Declaration getCrosscutDeclaration() { - if (crosscutDeclaration == null && crosscutDeclarationHandle != null) { - crosscutDeclaration = crosscutDeclarationHandle.resolve(); - } - return crosscutDeclaration; - } - - public void setCrosscutDeclaration(Declaration _crosscutDeclaration) { - crosscutDeclaration = _crosscutDeclaration; - } - - public String getDeclaringType() { return declaringType; } - public String getKind() { - if (kind.startsWith("introduced-")) { - return kind.substring(11); - } else { - return kind; - } - } - - public String getFilename() { return filename; } - public String getFormalComment() { return formalComment; } - - public Declaration[] getDeclarations() { - return declarations; - } - public void setDeclarations(Declaration[] decs) { - declarations = decs; - if (decs != null) { - for (int i = 0; i < decs.length; i++) { - decs[i].parentDeclaration = this; - } - } - } - public void setPointedToBy(Declaration[] decs) { pointedToBy = decs; } - public void setPointsTo(Declaration[] decs) { pointsTo = decs; } - - - public Declaration[] getPointedToBy() { - if (pointedToBy == null) { - pointedToBy = resolveHandles(pointedToByHandles); - } - return pointedToBy; //.elements(); - } - - public Declaration[] getPointsTo() { - if (pointsTo == null) { - pointsTo = resolveHandles(pointsToHandles); - } - return pointsTo; //.elements(); - } - - private Declaration[] filterTypes(Declaration[] a_decs) { - List decs = new LinkedList(Arrays.asList(a_decs)); - for(Iterator i = decs.iterator(); i.hasNext(); ) { - Declaration dec = (Declaration)i.next(); - if (!dec.isType()) i.remove(); - } - return (Declaration[])decs.toArray(new Declaration[decs.size()]); - } - - - public Declaration[] getTargets() { - Declaration[] pointsTo = getPointsTo(); - - if (kind.equals("advice")) { - return pointsTo; - } else if (kind.equals("introduction")) { - return filterTypes(pointsTo); - } else { - return new Declaration[0]; - } - } - - // Handles are used to deal with dependencies between Declarations in different files - private Handle getHandle() { - return new Handle(filename, beginLine, beginColumn); - } - - private Declaration[] resolveHandles(Handle[] handles) { - Declaration[] declarations = new Declaration[handles.length]; - int missed = 0; - for(int i=0; i 0) { - Declaration[] decs = new Declaration[declarations.length - missed]; - for (int i=0, j=0; i < declarations.length; i++) { - if (declarations[i] != null) decs[j++] = declarations[i]; - } - declarations = decs; - } - return declarations; - } - - private Handle[] getHandles(Declaration[] declarations) { - Handle[] handles = new Handle[declarations.length]; - for(int i=0; i -1 && index2 > 0 && index1 < index2) { - currFileClass = base.substring(index1+1, index2); - } - - // XXX only one level of nexting - if (currFileClass.equals(decl.getDeclaringType())) { - nestedClass = true; - packageName = packageName.replace( '.','/' ); - String newBase = ""; - if ( base.lastIndexOf(Config.DIR_SEP_CHAR) > 0 ) { - newBase = base.substring(0, base.lastIndexOf(Config.DIR_SEP_CHAR)); - } - String signature = constructNestedTypeName(decl.getNode()); - - filename = newBase + Config.DIR_SEP_CHAR + packageName + - Config.DIR_SEP_CHAR + currFileClass + //"." + - signature + ".html"; - } else { - packageName = packageName.replace( '.','/' ); - filename = base + packageName + Config.DIR_SEP_CHAR + decl.getSignature() + ".html"; - } - } - else { - filename = base + decl.getSignature() + ".html"; - } - if (!exceededNestingLevel) { - - decorateHTMLFile(new File(filename)); - - decorateHTMLFromDecls(decl.getDeclarations(), - base + decl.getSignature() + ".", - docModifier, - nestedClass); - } - else { - System.out.println("Warning: can not generate documentation for nested " + - "inner class: " + decl.getSignature() ); - } - } - } - } + static void decorateHTMLFromIPE(IProgramElement decl, + String base, + String docModifier, + boolean exceededNestingLevel ) throws IOException { + boolean nestedClass = false; + if ( decl.getKind().isType() ) { + boolean decorateFile = true; + if (isAboveVisibility(decl)) { + visibleFileList.add(decl.toSignatureString()); + String packageName = decl.getPackageName(); + String filename = ""; + if ( packageName != null ) { + + int index1 = base.lastIndexOf(Config.DIR_SEP_CHAR); + int index2 = base.lastIndexOf("."); + String currFileClass = ""; + if (index1 > -1 && index2 > 0 && index1 < index2) { + currFileClass = base.substring(index1+1, index2); + } + + // XXX only one level of nexting + if (currFileClass.equals(decl.getDeclaringType())) { + nestedClass = true; + packageName = packageName.replace( '.','/' ); + String newBase = ""; + if ( base.lastIndexOf(Config.DIR_SEP_CHAR) > 0 ) { + newBase = base.substring(0, base.lastIndexOf(Config.DIR_SEP_CHAR)); + } + String signature = constructNestedTypeName(decl); + + filename = newBase + Config.DIR_SEP_CHAR + packageName + + Config.DIR_SEP_CHAR + currFileClass + //"." + + signature + ".html"; + } else { + packageName = packageName.replace( '.','/' ); + filename = base + packageName + Config.DIR_SEP_CHAR + decl.toSignatureString() + ".html"; + } + } + else { + filename = base + decl.toSignatureString() + ".html"; + } + if (!exceededNestingLevel) { + decorateHTMLFile(new File(filename)); + } + else { + System.out.println("Warning: can not generate documentation for nested " + + "inner class: " + decl.toSignatureString() ); + } + } + } + } private static String constructNestedTypeName(IProgramElement node) { if (node.getParent().getKind().isSourceFile()) { @@ -201,9 +193,6 @@ class HtmlDecorator { fileContents.delete(start, end + Config.DECL_ID_TERMINATOR.length()); if ( decl.getKind().isType() ) { isSecond = true; -// addIntroductionDocumentation(decl, fileContents, index); -// addAdviceDocumentation(decl, fileContents, index); -// addPointcutDocumentation(decl, fileContents, index); String fullname = ""; if (decl.getParent().getKind().equals(IProgramElement.Kind.ASPECT) || decl.getParent().getKind().equals(IProgramElement.Kind.CLASS)) { @@ -336,22 +325,6 @@ class HtmlDecorator { decorateDocWithRel(node,fileBuffer,index,advisedBy,HtmlRelationshipKind.ADVISED_BY); } } - -// static void addIntroductionDocumentation(IProgramElement decl, -// StringBuffer fileBuffer, -// int index ) { -// Declaration[] introductions = decl.getIntroductionDeclarations(); -// if ( introductions.length > 0 ) { -// insertDeclarationsSummary(fileBuffer, -// introductions, -// "Introduction Summary", -// index); -// insertDeclarationsDetails(fileBuffer, -// introductions, -// "Introduction Detail", -// index); -// } -// } static void insertDeclarationsSummary(StringBuffer fileBuffer, List decls, @@ -626,7 +599,6 @@ class HtmlDecorator { if (currDecl.getPackageName() != null ) { hrefName = currDecl.getPackageName().replace('.', '/'); -// hrefLink = "";//+ currDecl.getPackageName() + Config.DIR_SEP_CHAR; } // in the case of nested classes, in order for the links to work, @@ -869,24 +841,6 @@ class HtmlDecorator { static String generateIntroductionSignatures(IProgramElement decl, boolean isDetails) { return ""; - // Declaration[] decls = decl.getDeclarations(); -// String entry = ""; -// for ( int j = 0; j < decls.length; j++ ) { -// Declaration currDecl = decls[j]; -// if ( currDecl != null ) { -// entry += -// "" + -// currDecl.getSignature() + -// "
"; -// } -// if (isDetails) { -// entry += generateDetailsComment(currDecl) + "

"; -// } -// else { -// entry += generateSummaryComment(currDecl) + "

"; -// } -// } -// return entry; } static String generateSignatures(IProgramElement decl ) { @@ -913,7 +867,6 @@ class HtmlDecorator { } static String generateHREFName(IProgramElement decl) { - //String hrefLink = decl.toLabelString().replace("\"", "quot;"); // !!! StringBuffer hrefLinkBuffer = new StringBuffer(); char[] declChars = decl.toLabelString().toCharArray(); for (int i = 0; i < declChars.length; i++) { @@ -999,6 +952,34 @@ class HtmlDecorator { return formattedComment; } + static public IProgramElement[] getProgramElements(String filename) { + + IProgramElement file = (IProgramElement)AsmManager.getDefault().getHierarchy().findElementForSourceFile(filename); + final List nodes = new ArrayList(); + HierarchyWalker walker = new HierarchyWalker() { + public void preProcess(IProgramElement node) { + IProgramElement p = (IProgramElement)node; + if (accept(node)) nodes.add(p); + } + }; + + file.walk(walker); + return (IProgramElement[])nodes.toArray(new IProgramElement[nodes.size()]); + } + + /** + * Rejects anonymous kinds by checking if their name is an integer + */ + static private boolean accept(IProgramElement node) { + if (node.getKind().isType()) { + boolean isAnonymous = StructureUtil.isAnonymous(node); + return !node.getParent().getKind().equals(IProgramElement.Kind.METHOD) + && !isAnonymous; + } else { + return !node.getKind().equals(IProgramElement.Kind.IMPORT_REFERENCE); + } + } + /** * TypeSafeEnum for the entries which need to be put in the html doc */ diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java index e0000cb25..76603d059 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java @@ -32,8 +32,6 @@ import org.aspectj.util.FileUtil; public class Main implements Config { private static final String FAIL_MESSAGE = "> compile failed, exiting ajdoc"; - - static SymbolManager symbolManager = null; /** Command line options. */ static Vector options; @@ -72,7 +70,6 @@ public class Main implements Config { private static String outputWorkingDir = Config.WORKING_DIR; public static void clearState() { - symbolManager = null; options = new Vector(); ajcOptions = new Vector(); filenames = new Vector(); @@ -101,7 +98,6 @@ public class Main implements Config { sourcepath.addElement("."); // add the current directory to the classapth parseCommandLine(args); rootDir = getRootDir(); - symbolManager = SymbolManager.getDefault(); File[] inputFiles = new File[filenames.size()]; File[] signatureFiles = new File[filenames.size()]; try { @@ -158,7 +154,7 @@ public class Main implements Config { // PHASE 1: generate Signature files (Java with DeclIDs and no bodies). System.out.println( "> Building signature files..." ); try{ - StubFileGenerator.doFiles(declIDTable, symbolManager, inputFiles, signatureFiles); + StubFileGenerator.doFiles(declIDTable, inputFiles, signatureFiles); } catch (DocException d){ System.err.println(d.getMessage()); // d.printStackTrace(); @@ -219,7 +215,6 @@ public class Main implements Config { System.out.println( "> Decorating html files..." ); HtmlDecorator.decorateHTMLFromInputFiles(declIDTable, rootDir, - symbolManager, inputFiles, docModifier); @@ -586,7 +581,7 @@ public class Main implements Config { else { // check if this is a file or a package // System.err.println(">>>>>>>> " + ); - String entryName = arg.substring(arg.lastIndexOf(File.separator)+1); +// String entryName = arg.substring(arg.lastIndexOf(File.separator)+1); if (FileUtil.hasSourceSuffix(arg) || arg.endsWith(".lst") && arg != null ) { diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java b/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java index 954936a0f..2dcb098b8 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java @@ -30,17 +30,16 @@ class StubFileGenerator{ static Hashtable declIDTable = null; static void doFiles (Hashtable table, - SymbolManager symbolManager, File[] inputFiles, File[] signatureFiles) throws DocException { declIDTable = table; for (int i = 0; i < inputFiles.length; i++) { - processFile(symbolManager, inputFiles[i], signatureFiles[i]); + processFile(inputFiles[i], signatureFiles[i]); } } - static void processFile(SymbolManager symbolManager, File inputFile, File signatureFile) throws DocException { + static void processFile(File inputFile, File signatureFile) throws DocException { try { String path = StructureUtil.translateAjPathName(signatureFile.getCanonicalPath()); PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(path))); @@ -193,11 +192,11 @@ class StubFileGenerator{ * replaced. */ static String addToFormal(String formalComment, String string) { - boolean appendPeriod = true; + //boolean appendPeriod = true; if ( (formalComment == null) || formalComment.equals("")) { //formalComment = "/**\n * . \n */\n"; formalComment = "/**\n * \n */\n"; - appendPeriod = false; + //appendPeriod = false; } formalComment = formalComment.trim(); diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java b/ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java deleted file mode 100644 index 59edbb2fd..000000000 --- a/ajdoc/src/org/aspectj/tools/ajdoc/SymbolManager.java +++ /dev/null @@ -1,359 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Common Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation - * Mik Kersten port to AspectJ 1.1+ code base - * ******************************************************************/ - -package org.aspectj.tools.ajdoc; - - -import java.util.*; - -import org.aspectj.asm.*; - -/** - * @author Mik Kersten - */ -public class SymbolManager { - - private static SymbolManager INSTANCE = new SymbolManager(); - - public static SymbolManager getDefault() { - return INSTANCE; - } - - - /** - * TODO: only works for one class - */ - public Declaration[] getDeclarations(String filename) { - - IProgramElement file = (IProgramElement)AsmManager.getDefault().getHierarchy().findElementForSourceFile(filename); - IProgramElement node = (IProgramElement)file.getChildren().get(0); - -// Declaration[] decls = new Declaration[node.getChildren().size()+1]; - final List nodes = new ArrayList(); - HierarchyWalker walker = new HierarchyWalker() { - public void preProcess(IProgramElement node) { - IProgramElement p = (IProgramElement)node; - if (accept(node)) nodes.add(buildDecl(p)); - } - }; - - file.walk(walker); - - return (Declaration[])nodes.toArray(new Declaration[nodes.size()]); - } - - /** - * Rejects anonymous kinds by checking if their name is an integer - */ - private boolean accept(IProgramElement node) { - if (node.getKind().isType()) { - boolean isAnonymous = StructureUtil.isAnonymous(node); - return !node.getParent().getKind().equals(IProgramElement.Kind.METHOD) - && !isAnonymous; - } else { - return !node.getKind().equals(IProgramElement.Kind.IMPORT_REFERENCE); - } -// && !(node.getKind().isType() && -// node.getParent().getKind().equals(IProgramElement.Kind.METHOD)); - } - - private Declaration buildDecl(IProgramElement node) { - - String signature = ""; - String accessibility = node.getAccessibility().toString(); - if (!accessibility.equals("package")) signature = accessibility.toString() + " "; - - String modifiers = ""; - if (!node.getAccessibility().equals(IProgramElement.Accessibility.PACKAGE)) modifiers += node.getAccessibility() + " "; - for (Iterator modIt = node.getModifiers().iterator(); modIt.hasNext(); ) { - modifiers += modIt.next() + " "; - } - - if (node.getKind().equals(IProgramElement.Kind.METHOD) || - node.getKind().equals(IProgramElement.Kind.FIELD)) { - signature += node.getCorrespondingType() + " "; - } - - if (node.getKind().equals(IProgramElement.Kind.CLASS) || - node.getKind().equals(IProgramElement.Kind.METHOD)) { - signature += "class "; - } else if (node.getKind().equals(IProgramElement.Kind.INTERFACE) || - node.getKind().equals(IProgramElement.Kind.METHOD)) { - signature += "interface "; - } - - signature += node.toSignatureString(); - - String name = node.getName(); - if (node.getKind().isType()) { - name = genPartiallyQualifiedName(node, node.getName()); - } - - String declaringType = node.getParent().getName(); -// if (!node.getKind().isType()) { -// declaringType = node.getParent().getName(); -// } - - Declaration dec = new Declaration( - node.getSourceLocation().getLine(), - node.getSourceLocation().getEndLine(), - node.getSourceLocation().getColumn(), - -1, - modifiers, - name, - signature, - "", // crosscut designator - node.getDeclaringType(), - node.getKind().toString(), - node.getSourceLocation().getSourceFile().getAbsolutePath(), - node.getFormalComment(), - node.getPackageName(), - node - ); - return dec; - } - - -// // In the unusual case that there are multiple declarations on a single line -// // This will return a random one -// public Declaration getDeclarationAtLine(String filename, int line) { -// return getDeclarationAtPoint(filename, line, -1); -// } - - private String genPartiallyQualifiedName(IProgramElement node, String name) { -// if (node.getParent() != null) System.err.println("%%% " + node.getParent()); - if (node.getParent() != null && node.getParent().getKind().isType()) { - name = node.getParent().getName() + '.' + name; - genPartiallyQualifiedName(node.getParent(), name); - } - return name; - } - - public Declaration getDeclarationAtPoint(String filename, int line, int column) { - - Declaration[] declarations = lookupDeclarations(filename); - //System.out.println("getting "+filename+", "+line+":"+column); - //System.out.println("decs: "+declarations); - return getDeclarationAtPoint(declarations, line, column); - } - - public Declaration getDeclarationAtPoint(Declaration[] declarations, int line, int column) { - //!!! when we care about the performance of this method - //!!! these should be guaranteed to be sorted and a binary search used here - //!!! for now we use the simple (and reliable) linear search - if (declarations == null) return null; - - for(int i=0; i= line) { - if (column == -1) return dec; - if (dec.getBeginColumn() == column) { // && dec.getEndColumn() >= column) { - return dec; - } - } - Declaration[] enclosedDecs = dec.getDeclarations(); - if (enclosedDecs.length == 0) continue; - - Declaration dec1 = getDeclarationAtPoint(enclosedDecs, line, column); - if (dec1 != null) return dec1; - } - - //??? what should be returned for no declaration found - return null; - } - -// private Hashtable symbolFileEntryCache = new Hashtable(); - - private Declaration[] lookupDeclarations(String filename) { - System.err.println("> looking up: " + filename); - return null; -// CorrFileEntry entry = lookup(filename, mapFilenameToSymbolFile(filename), -// symbolFileEntryCache); -// return (Declaration[])entry.data; - } - -// private Hashtable sourceToOutputCache = new Hashtable(); -// private Hashtable outputToSourceCache = new Hashtable(); - -// private Map lookupSourceToOutput(String filename) { -// CorrFileEntry entry = lookup(filename, -// getSourceToOutputFile(new File(filename).getParent()), -// sourceToOutputCache); -// return (Map)entry.data; -// } - -// private Map lookupOutputToSource(String filename) { -// CorrFileEntry entry = lookup(filename, -// getOutputToSourceFile(new File(filename).getParent()), -// outputToSourceCache); -// return (Map)entry.data; -// } - - /* generic code for dealing with correlation files, serialization, and caching */ -// private static class CorrFileEntry { -// public long lastModified; -// public Object data; -// -// public CorrFileEntry(long lastModified, Object data) { -// this.lastModified = lastModified; -// this.data = data; -// } -// } - -// private CorrFileEntry lookup(String filename, File file, Hashtable cache) { -// CorrFileEntry entry = (CorrFileEntry)cache.get(filename); -// if (entry != null && entry.lastModified == file.lastModified()) { -// return entry; -// } -// -// entry = createCorrFileEntry(file); -// cache.put(filename, entry); -// return entry; -// } - -// private CorrFileEntry createCorrFileEntry(File file) { -// if (!file.exists()) { -// return new CorrFileEntry(0l, null); -// } -// -// try { -// long lastModified = file.lastModified(); -// ObjectInputStream stream = -// new ObjectInputStream(new BufferedInputStream(new FileInputStream(file))); -// Object data = stream.readObject(); -// stream.close(); -// return new CorrFileEntry(lastModified, data); -// } catch (IOException ioe) { -// //System.err.println("ERROR!!!"); -// //ioe.printStackTrace(); -// return new CorrFileEntry(0l, null); -// } catch (ClassNotFoundException cce) { -// //System.err.println("ERROR!!!"); -// //cce.printStackTrace(); -// return new CorrFileEntry(0l, null); -// } -// } - - - /** - * @param methodName method name without type or parameter list - * @return method name with ajc-specific name mangling removed, - * unchanged if there's not ajc name mangling present - */ - public static String translateMethodName(String methodName) { - int firstDollar = methodName.indexOf('$'); - - if (firstDollar == -1) return methodName; - - String baseName = methodName.substring(firstDollar); - - if (methodName.indexOf("ajc") != -1) { - return "<" + baseName + " advice>"; - } else { - return baseName; - } - } - - - /************************************************************************ - The rest of the code in this file is just for testing purposes - ************************************************************************/ - -// private static final void printIndentation(int indent, String prefix) { -// for(int i=0; i< indent; i++) System.out.print(" "); -// System.out.print(prefix); -// } -// -// -// private static final void printDeclaration(Declaration dec, int indent, String prefix) { -// printIndentation(indent, prefix); -// if (dec == null) { -// System.out.println("null"); -// return; -// } -// -// System.out.println(dec.getKind()+": "+dec.getDeclaringType()+": "+ -// dec.getModifiers()+": "+dec.getSignature()+": " + -// //dec.getFullSignature()+": "+ -// dec.getCrosscutDesignator()+ -// ": "+dec.isIntroduced()+": "+dec.getPackageName()+": "+dec.getBeginLine()+":"+dec.getBeginColumn() -// ); -// -// //printIndentation(indent, "\"\"\""); -// //System.out.println(dec.getFormalComment()); -// /* -// if (dec.getParentDeclaration() != null) { -// printDeclaration(dec.getParentDeclaration(), indent+INDENT, "PARENT "); -// } -// if (dec.getCrosscutDeclaration() != null) { -// printDeclaration(dec.getCrosscutDeclaration(), indent+INDENT, "XC "); -// } -// */ -// if (prefix.equals("")) { -// printDeclarations(dec.getTargets(), indent+INDENT, "T> "); -// printDeclarations(dec.getPointsTo(), indent+INDENT, ">> "); -// printDeclarations(dec.getPointedToBy(), indent+INDENT, "<< "); -// printDeclarations(dec.getDeclarations(), indent+INDENT, ""); -// } -// } - -// private static final void printDeclarations(Declaration[] decs, int indent, String prefix) { -// for(int i=0; i