001: //
002: // This file is part of the prose package.
003: //
004: // The contents of this file are subject to the Mozilla Public License
005: // Version 1.1 (the "License"); you may not use this file except in
006: // compliance with the License. You may obtain a copy of the License at
007: // http://www.mozilla.org/MPL/
008: //
009: // Software distributed under the License is distributed on an "AS IS" basis,
010: // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
011: // for the specific language governing rights and limitations under the
012: // License.
013: //
014: // The Original Code is prose.
015: //
016: // The Initial Developer of the Original Code is Angela Nicoara. Portions
017: // created by Angela Nicoara are Copyright (C) 2002 Angela Nicoara.
018: // All Rights Reserved.
019: //
020: // Contributor(s):
021: // $Id$
022: // =====================================================================
023: //
024: // (history at end)
025: //
026:
027: package ch.ethz.prose.jvmai.jikesrvm.advice_weaver;
028:
029: import java.lang.reflect.Method;
030:
031: import ch.ethz.jvmai.*;
032:
033: import com.ibm.JikesRVM.classloader.VM_FieldReference;
034: import com.ibm.JikesRVM.classloader.VM_Method;
035:
036: /**
037: * Concrete implementation of a CodeJoinPoint for the Jikes RVM. The structure
038: * is similar to the JVMDI implementation.
039: *
040: * However, some methods aren't implemented yet since they are not used in the
041: * JUnit tests of PROSE. These methods will throw a RuntimeException.
042: *
043: * @version $Revision$
044: * @author Johann Gyger
045: * @author Angela Nicoara
046: */
047: public class CodeJoinPointImpl implements CodeJoinPoint, JoinPointKinds {
048:
049: /**
050: * Method identifier to which this join point belongs.
051: */
052: protected int methodId;
053:
054: /**
055: * Method to which this join point belongs.
056: */
057: protected Method method;
058:
059: /**
060: * AOP tag associated with this join point.
061: */
062: protected Object aopTag;
063:
064: /**
065: * Object on which this join point is executed (null for static methods).
066: */
067: protected Object this 0;
068:
069: /**
070: * Actual parameters of `method'.
071: */
072: protected Object args[];
073:
074: /**
075: * Initialize this join point.
076: *
077: * @param id method identifier to which this join point belongs
078: * @param tag AOP tag associated with this join point
079: * @param this0 Object on which this join point is executed (null for static
080: * methods)
081: * @param args actual parameters of `m'
082: */
083: public void init(int id, Object tag, Object this 0, Object[] args) {
084: methodId = id;
085: method = null;
086: aopTag = tag;
087: this .this 0 = this 0;
088: this .args = args;
089: }
090:
091: public Object getAopTag() {
092: return aopTag;
093: }
094:
095: public int getByteCodeIndex() {
096: throw new RuntimeException("Not implemented: "
097: + getClass().getName() + ".getByteCodeIndex()");
098: }
099:
100: public CodeJoinPoint getEnclosingJoinPoint() {
101: throw new RuntimeException("Not implemented: "
102: + getClass().getName() + ".getEnclosingJoinPoint()");
103: }
104:
105: public Method getMethod() {
106: if (method == null) {
107: VM_Method m = VM_FieldReference.getMemberRef(methodId)
108: .asMethodReference().resolve();
109: method = java.lang.reflect.JikesRVMSupport.createMethod(m);
110: }
111:
112: return method;
113: }
114:
115: public Object[] getArgs() {
116: return args;
117: }
118:
119: public String getKind() {
120: return KIND_CODE_JP;
121: }
122:
123: public int getMask() {
124: return MASK_CODE_JP;
125: }
126:
127: public Signature getSignature() {
128: throw new RuntimeException("Not implemented: "
129: + getClass().getName() + ".getSignature()");
130: }
131:
132: public JoinPointStaticPart getStaticPart() {
133: throw new RuntimeException("Not implemented: "
134: + getClass().getName() + ".getStaticPart()");
135: }
136:
137: public Object getTarget() {
138: return this 0;
139: }
140:
141: public Object getThis() {
142: return this 0;
143: }
144:
145: public String toLongString() {
146: return toString();
147: }
148:
149: public String toShortString() {
150: return toString();
151: }
152:
153: }
154:
155: //======================================================================
156: //
157: // $Log$
158: //
|