You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CodeDocImpl.java 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. *
  3. * This file is part of the debugger and core tools for the AspectJ(tm)
  4. * programming language; see http://aspectj.org
  5. *
  6. * The contents of this file are subject to the Mozilla Public License
  7. * Version 1.1 (the "License"); you may not use this file except in
  8. * compliance with the License. You may obtain a copy of the License at
  9. * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
  10. *
  11. * Software distributed under the License is distributed on an "AS IS" basis,
  12. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. * for the specific language governing rights and limitations under the
  14. * License.
  15. *
  16. * The Original Code is AspectJ.
  17. *
  18. * The Initial Developer of the Original Code is Xerox Corporation. Portions
  19. * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
  20. * All Rights Reserved.
  21. */
  22. package org.aspectj.tools.ajdoc;
  23. import org.aspectj.compiler.base.ast.ASTObject;
  24. import org.aspectj.compiler.base.ast.CodeDec;
  25. import org.aspectj.compiler.base.ast.Dec;
  26. import org.aspectj.compiler.base.ast.DummySourceLocation;
  27. import org.aspectj.compiler.base.ast.Formals;
  28. import org.aspectj.compiler.base.ast.NameType;
  29. import org.aspectj.compiler.base.ast.SourceLocation;
  30. import org.aspectj.compiler.base.ast.TypeDec;
  31. import org.aspectj.compiler.base.ast.TypeDs;
  32. import org.aspectj.compiler.crosscuts.ast.AdviceDec;
  33. import java.util.ArrayList;
  34. import java.util.Collection;
  35. import java.util.Collections;
  36. import java.util.Iterator;
  37. import java.util.List;
  38. import java.util.Set;
  39. public abstract class CodeDocImpl extends ExecutableMemberDocImpl {
  40. /** The CodeDec to which we delegate. */
  41. private final CodeDec codeDec;
  42. public CodeDocImpl(com.sun.javadoc.ClassDoc containingClass, CodeDec codeDec) {
  43. super(containingClass);
  44. this.codeDec = codeDec;
  45. }
  46. protected Collection createAdvice() {
  47. Set affectedBy = ajc().getCorrespondences().getAffectedBy(codeDec());
  48. if (affectedBy.size() < 1) return Collections.EMPTY_LIST;
  49. List list = new ArrayList();
  50. for (Iterator i = affectedBy.iterator(); i.hasNext();) {
  51. AdviceDec adec = (AdviceDec)i.next();
  52. TypeDec owner = ((NameType)adec.getDeclaringType()).getTypeDec();
  53. AspectDocImpl ad = (AspectDocImpl)ClassDocImpl.getInstance(owner);
  54. AdviceDocImpl adoc = ad.docForDec(adec);
  55. list.add(adoc);
  56. }
  57. return list;
  58. }
  59. protected Dec dec() {
  60. return codeDec();
  61. }
  62. protected Formals getFormals() {
  63. return codeDec().getFormals();
  64. }
  65. protected TypeDs getThrows() {
  66. return codeDec().getThrows();
  67. }
  68. protected CodeDec codeDec() {
  69. return codeDec;
  70. }
  71. }