aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjAttribute.java
blob: fd65867aedfff90e0c86796d7e956088e9896908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
/* *******************************************************************
 * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
 * All rights reserved. 
 * This program and the accompanying materials are made available 
 * under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution and is available at 
 * http://www.eclipse.org/legal/epl-v10.html 
 *  
 * Contributors: 
 *     PARC     initial implementation 
 * ******************************************************************/

package org.aspectj.weaver;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;

import org.aspectj.bridge.MessageUtil;
import org.aspectj.bridge.Version;
import org.aspectj.util.FileUtil;
import org.aspectj.weaver.patterns.Declare;
import org.aspectj.weaver.patterns.IScope;
import org.aspectj.weaver.patterns.PerClause;
import org.aspectj.weaver.patterns.Pointcut;

/**
 * These attributes are written to and read from .class files (see the JVM spec).
 * 
 * <p>
 * Each member or type can have a number of AjAttributes. Each such attribute is in 1-1 correspondence with an Unknown bcel
 * attribute. Creating one of these does NOTHING to the underlying thing, so if you really want to add an attribute to a particular
 * thing, well, you'd better actually do that.
 * 
 * @author Erik Hilsdale
 * @author Jim Hugunin
 */
public abstract class AjAttribute {

	public static final String AttributePrefix = "org.aspectj.weaver";

	protected abstract void write(CompressingDataOutputStream s) throws IOException;

	public abstract String getNameString();

	public char[] getNameChars() {
		return getNameString().toCharArray();
	}

	/**
	 * Just writes the contents
	 */
	public byte[] getBytes(ConstantPoolWriter compressor) {
		try {
			ByteArrayOutputStream b0 = new ByteArrayOutputStream();
			CompressingDataOutputStream s0 = new CompressingDataOutputStream(b0, compressor);
			write(s0);
			s0.close();
			return b0.toByteArray();
		} catch (IOException e) {
			// shouldn't happen with ByteArrayOutputStreams
			throw new RuntimeException("sanity check");
		}
	}

	/**
	 * Writes the full attribute, i.e. name_index, length, and contents
	 * 
	 * @param dataCompressor
	 */
	public byte[] getAllBytes(short nameIndex, ConstantPoolWriter dataCompressor) {
		try {
			byte[] bytes = getBytes(dataCompressor);

			ByteArrayOutputStream b0 = new ByteArrayOutputStream();
			DataOutputStream s0 = new DataOutputStream(b0);

			s0.writeShort(nameIndex);
			s0.writeInt(bytes.length);
			s0.write(bytes);
			s0.close();
			return b0.toByteArray();
		} catch (IOException e) {
			// shouldn't happen with ByteArrayOutputStreams
			throw new RuntimeException("sanity check");
		}
	}

	public static AjAttribute read(AjAttribute.WeaverVersionInfo v, String name, byte[] bytes, ISourceContext context, World w,
			ConstantPoolReader dataDecompressor) {
		try {
			if (bytes == null) {
				bytes = new byte[0];
			}

			VersionedDataInputStream s = new VersionedDataInputStream(new ByteArrayInputStream(bytes), dataDecompressor);
			s.setVersion(v);
			if (name.equals(Aspect.AttributeName)) {
				return new Aspect(PerClause.readPerClause(s, context));
			} else if (name.equals(MethodDeclarationLineNumberAttribute.AttributeName)) {
				return MethodDeclarationLineNumberAttribute.read(s);
			} else if (name.equals(WeaverState.AttributeName)) {
				return new WeaverState(WeaverStateInfo.read(s, context));
			} else if (name.equals(WeaverVersionInfo.AttributeName)) {
				return WeaverVersionInfo.read(s);
			} else if (name.equals(AdviceAttribute.AttributeName)) {
				AdviceAttribute aa = AdviceAttribute.read(s, context);
				aa.getPointcut().check(context, w);
				return aa;
			} else if (name.equals(PointcutDeclarationAttribute.AttributeName)) {
				PointcutDeclarationAttribute pda = new PointcutDeclarationAttribute(ResolvedPointcutDefinition.read(s, context));
				pda.pointcutDef.getPointcut().check(context, w);
				return pda;
			} else if (name.equals(TypeMunger.AttributeName)) {
				return new TypeMunger(ResolvedTypeMunger.read(s, context));
			} else if (name.equals(AjSynthetic.AttributeName)) {
				return new AjSynthetic();
			} else if (name.equals(DeclareAttribute.AttributeName)) {
				return new DeclareAttribute(Declare.read(s, context));
			} else if (name.equals(PrivilegedAttribute.AttributeName)) {
				return PrivilegedAttribute.read(s, context);
			} else if (name.equals(SourceContextAttribute.AttributeName)) {
				return SourceContextAttribute.read(s);
			} else if (name.equals(EffectiveSignatureAttribute.AttributeName)) {
				return EffectiveSignatureAttribute.read(s, context);
			} else {
				// We have to tell the user about this...
				if (w == null || w.getMessageHandler() == null) {
					throw new BCException("unknown attribute" + name);
				}
				w.getMessageHandler().handleMessage(MessageUtil.warn("unknown attribute encountered " + name));
				return null;
			}
		} catch (BCException e) {
			throw new BCException("malformed " + name + " attribute (length:" + bytes.length + ")" + e);
		} catch (IOException e) {
			throw new BCException("malformed " + name + " attribute (length:" + bytes.length + ")" + e);
		}
	}

	// ----

	/**
	 * Synthetic members should have NO advice put on them or on their contents. This attribute is currently unused as we consider
	 * all members starting with NameMangler.PREFIX to automatically be synthetic. As we use this we might find that we want
	 * multiple kinds of synthetic. In particular, if we want to treat the call to a synthetic getter (say, of an introduced field)
	 * as a field reference itself, then a method might want a particular kind of AjSynthetic attribute that also includes a
	 * signature of what it stands for.
	 */
	public static class AjSynthetic extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.AjSynthetic";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		// private ResolvedTypeMunger munger;
		public AjSynthetic() {
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
		}
	}

	public static class TypeMunger extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.TypeMunger";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		private final ResolvedTypeMunger munger;

		public TypeMunger(ResolvedTypeMunger munger) {
			this.munger = munger;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			munger.write(s);
		}

		public ConcreteTypeMunger reify(World world, ResolvedType aspectType) {
			return world.getWeavingSupport().concreteTypeMunger(munger, aspectType);
		}
	}

	public static class WeaverState extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.WeaverState";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		private final WeaverStateInfo kind;

		public WeaverState(WeaverStateInfo kind) {
			this.kind = kind;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			kind.write(s);
		}

		public WeaverStateInfo reify() {
			return kind;
		}
	}

	public static class WeaverVersionInfo extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.WeaverVersion";

		// If you change the format of an AspectJ class file, you have two
		// options:
		// - changing the minor version means you have not added anything that
		// prevents
		// previous versions of the weaver from operating (e.g.
		// MethodDeclarationLineNumber attribute)
		// - changing the major version means you have added something that
		// prevents previous
		// versions of the weaver from operating correctly.
		//
		// The user will get a warning for any org.aspectj.weaver attributes the
		// weaver does
		// not recognize.

		// When we don't know ... (i.e. pre 1.2.1)
		public final static short WEAVER_VERSION_MAJOR_UNKNOWN = 0;
		public final static short WEAVER_VERSION_MINOR_UNKNOWN = 0;

		// These are the weaver major/minor numbers for AspectJ 1.2.1
		public final static short WEAVER_VERSION_MAJOR_AJ121 = 1;
		public final static short WEAVER_VERSION_MINOR_AJ121 = 0;

		// These are the weaver major/minor numbers for AspectJ 1.5.0
		public final static short WEAVER_VERSION_MAJOR_AJ150M4 = 3;
		public final static short WEAVER_VERSION_MAJOR_AJ150 = 2;
		public final static short WEAVER_VERSION_MINOR_AJ150 = 0;

		// These are the weaver major/minor numbers for AspectJ 1.6.0
		public final static short WEAVER_VERSION_MAJOR_AJ160M2 = 5;
		public final static short WEAVER_VERSION_MAJOR_AJ160 = 4;
		public final static short WEAVER_VERSION_MINOR_AJ160 = 0;

		// These are the weaver major/minor numbers for AspectJ 1.6.1
		// added annotation value binding
		public final static short WEAVER_VERSION_MAJOR_AJ161 = 6;
		public final static short WEAVER_VERSION_MINOR_AJ161 = 0;

		// 1.6.9 adds new style ITDs. This is used to see what version of AJ was used to
		// build the ITDs so we know id the generated get/set dispatchers are using old
		// or new style (new style will be get/setters for private ITD fields)
		public final static short WEAVER_VERSION_AJ169 = 7;

		// These are the weaver major/minor versions for *this* weaver
		private final static short CURRENT_VERSION_MAJOR = WEAVER_VERSION_AJ169;
		private final static short CURRENT_VERSION_MINOR = 0;

		public final static WeaverVersionInfo UNKNOWN = new WeaverVersionInfo(WEAVER_VERSION_MAJOR_UNKNOWN,
				WEAVER_VERSION_MINOR_UNKNOWN);
		public final static WeaverVersionInfo CURRENT = new WeaverVersionInfo(CURRENT_VERSION_MAJOR, CURRENT_VERSION_MINOR);

		// These are the versions read in from a particular class file.
		private final short major_version;
		private final short minor_version;

		private long buildstamp = Version.NOTIME;

		@Override
		public String getNameString() {
			return AttributeName;
		}

		// Default ctor uses the current version numbers
		public WeaverVersionInfo() {
			major_version = CURRENT_VERSION_MAJOR;
			minor_version = CURRENT_VERSION_MINOR;
		}

		public WeaverVersionInfo(short major, short minor) {
			major_version = major;
			minor_version = minor;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			s.writeShort(CURRENT_VERSION_MAJOR);
			s.writeShort(CURRENT_VERSION_MINOR);
			s.writeLong(Version.getTime()); // build used to construct the
			// class...
		}

		public static WeaverVersionInfo read(VersionedDataInputStream s) throws IOException {
			short major = s.readShort();
			short minor = s.readShort();
			WeaverVersionInfo wvi = new WeaverVersionInfo(major, minor);
			if (s.getMajorVersion() >= WEAVER_VERSION_MAJOR_AJ150M4) {
				long stamp = 0;
				try {
					stamp = s.readLong();
					wvi.setBuildstamp(stamp);
				} catch (EOFException eof) {
					// didnt find that build stamp - its not the end of the
					// world
				}
			}
			return wvi;
		}

		public short getMajorVersion() {
			return major_version;
		}

		public short getMinorVersion() {
			return minor_version;
		}

		public static short getCurrentWeaverMajorVersion() {
			return CURRENT_VERSION_MAJOR;
		}

		public static short getCurrentWeaverMinorVersion() {
			return CURRENT_VERSION_MINOR;
		}

		public void setBuildstamp(long stamp) {
			buildstamp = stamp;
		}

		public long getBuildstamp() {
			return buildstamp;
		}

		@Override
		public String toString() {
			return major_version + "." + minor_version;
		}

		public static String toCurrentVersionString() {
			return CURRENT_VERSION_MAJOR + "." + CURRENT_VERSION_MINOR;
		}

	}

	public static class SourceContextAttribute extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.SourceContext";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		private final String sourceFileName;
		private final int[] lineBreaks;

		public SourceContextAttribute(String sourceFileName, int[] lineBreaks) {
			this.sourceFileName = sourceFileName;
			this.lineBreaks = lineBreaks;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			if (s.canCompress()) {
				s.writeCompressedPath(sourceFileName);
			} else {
				s.writeUTF(sourceFileName);
			}
			s.writeInt(lineBreaks.length);
			int previous = 0;
			for (int lineBreak : lineBreaks) {
				s.writeShort(lineBreak - previous);
				previous = lineBreak;
			}
		}

		public static SourceContextAttribute read(VersionedDataInputStream s) throws IOException {
			String sourceFileName = s.isAtLeast169() ? s.readPath() : s.readUTF();
			int lineBreaks = s.readInt();
			int[] lines = new int[lineBreaks];
			int previous = 0;
			for (int i = 0; i < lineBreaks; i++) {
				if (s.isAtLeast169()) {
					lines[i] = s.readShort() + previous;
					previous = lines[i];
				} else {
					lines[i] = s.readInt();
				}
			}
			return new SourceContextAttribute(sourceFileName, lines);
		}

		public int[] getLineBreaks() {
			return lineBreaks;
		}

		public String getSourceFileName() {
			return sourceFileName;
		}
	}

	public static class MethodDeclarationLineNumberAttribute extends AjAttribute {

		public static final String AttributeName = "org.aspectj.weaver.MethodDeclarationLineNumber";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		private final int lineNumber;

		// AV: added in 1.5 M3 thus handling cases where we don't have that
		// information
		private final int offset;

		public MethodDeclarationLineNumberAttribute(int line, int offset) {
			lineNumber = line;
			this.offset = offset;
		}

		public int getLineNumber() {
			return lineNumber;
		}

		public int getOffset() {
			return offset;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			s.writeInt(lineNumber);
			s.writeInt(offset);
		}

		public static MethodDeclarationLineNumberAttribute read(VersionedDataInputStream s) throws IOException {
			int line = s.readInt();
			int offset = 0;
			if (s.available() > 0) {
				offset = s.readInt();
			}
			return new MethodDeclarationLineNumberAttribute(line, offset);
		}

		@Override
		public String toString() {
			return AttributeName + ": " + lineNumber + ":" + offset;
		}
	}

	public static class PointcutDeclarationAttribute extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.PointcutDeclaration";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		private final ResolvedPointcutDefinition pointcutDef;

		public PointcutDeclarationAttribute(ResolvedPointcutDefinition pointcutDef) {
			this.pointcutDef = pointcutDef;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			pointcutDef.write(s);
		}

		public ResolvedPointcutDefinition reify() {
			return pointcutDef;
		}
	}

	public static class DeclareAttribute extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.Declare";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		private final Declare declare;

		public DeclareAttribute(Declare declare) {
			this.declare = declare;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			declare.write(s);
		}

		public Declare getDeclare() {
			return declare;
		}
	}

	public static class AdviceAttribute extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.Advice";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		private final AdviceKind kind;
		private final Pointcut pointcut;
		private final int extraParameterFlags;
		private final int start;
		private final int end;
		private final ISourceContext sourceContext;

		// these are only used by around advice
		private boolean proceedInInners;
		private ResolvedMember[] proceedCallSignatures; // size == # of proceed
		// calls in body
		private boolean[] formalsUnchangedToProceed; // size == formals.size
		private UnresolvedType[] declaredExceptions;

		/**
		 * @param start must be greater than the start of any advice declared before this one in an aspect,
		 *        otherwise, it can be any value.
		 */
		public AdviceAttribute(AdviceKind kind, Pointcut pointcut, int extraArgumentFlags, int start, int end,
				ISourceContext sourceContext) {
			this.kind = kind;
			this.pointcut = pointcut;
			extraParameterFlags = extraArgumentFlags;
			this.start = start;
			this.end = end;
			this.sourceContext = sourceContext;

			// XXX put this back when testing works better (or fails better)
			// if (kind == AdviceKind.Around) throw new
			// IllegalArgumentException("not for around");
		}

		public AdviceAttribute(AdviceKind kind, Pointcut pointcut, int extraArgumentFlags, int start, int end,
				ISourceContext sourceContext, boolean proceedInInners, ResolvedMember[] proceedCallSignatures,
				boolean[] formalsUnchangedToProceed, UnresolvedType[] declaredExceptions) {
			this.kind = kind;
			this.pointcut = pointcut;
			extraParameterFlags = extraArgumentFlags;
			this.start = start;
			this.end = end;
			this.sourceContext = sourceContext;

			if (kind != AdviceKind.Around) {
				throw new IllegalArgumentException("only for around");
			}

			this.proceedInInners = proceedInInners;
			this.proceedCallSignatures = proceedCallSignatures;
			this.formalsUnchangedToProceed = formalsUnchangedToProceed;
			this.declaredExceptions = declaredExceptions;
		}

		public static AdviceAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
			AdviceKind kind = AdviceKind.read(s);
			if (kind == AdviceKind.Around) {
				return new AdviceAttribute(kind, Pointcut.read(s, context), s.readByte(), s.readInt(), s.readInt(), context,
						s.readBoolean(), ResolvedMemberImpl.readResolvedMemberArray(s, context), FileUtil.readBooleanArray(s),
						UnresolvedType.readArray(s));
			} else {
				return new AdviceAttribute(kind, Pointcut.read(s, context), s.readByte(), s.readInt(), s.readInt(), context);
			}
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			kind.write(s);
			pointcut.write(s);
			s.writeByte(extraParameterFlags);
			s.writeInt(start);
			s.writeInt(end);

			if (kind == AdviceKind.Around) {
				s.writeBoolean(proceedInInners);
				ResolvedMemberImpl.writeArray(proceedCallSignatures, s);
				FileUtil.writeBooleanArray(formalsUnchangedToProceed, s);
				UnresolvedType.writeArray(declaredExceptions, s);
			}
		}

		public Advice reify(Member signature, World world, ResolvedType concreteAspect) {
			return world.getWeavingSupport().createAdviceMunger(this, pointcut, signature, concreteAspect);
		}

		@Override
		public String toString() {
			return "AdviceAttribute(" + kind + ", " + pointcut + ", " + extraParameterFlags + ", " + start + ")";
		}

		public int getExtraParameterFlags() {
			return extraParameterFlags;
		}

		public AdviceKind getKind() {
			return kind;
		}

		public Pointcut getPointcut() {
			return pointcut;
		}

		public UnresolvedType[] getDeclaredExceptions() {
			return declaredExceptions;
		}

		public boolean[] getFormalsUnchangedToProceed() {
			return formalsUnchangedToProceed;
		}

		public ResolvedMember[] getProceedCallSignatures() {
			return proceedCallSignatures;
		}

		public boolean isProceedInInners() {
			return proceedInInners;
		}

		public int getEnd() {
			return end;
		}

		public ISourceContext getSourceContext() {
			return sourceContext;
		}

		public int getStart() {
			return start;
		}

	}

	public static class Aspect extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.Aspect";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		private final PerClause perClause;
		private IScope resolutionScope;

		public Aspect(PerClause perClause) {
			this.perClause = perClause;
		}

		public PerClause reify(ResolvedType inAspect) {
			// XXXperClause.concretize(inAspect);
			return perClause;
		}

		public PerClause reifyFromAtAspectJ(ResolvedType inAspect) {
			perClause.resolve(resolutionScope);
			return perClause;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			perClause.write(s);
		}

		public void setResolutionScope(IScope binding) {
			resolutionScope = binding;
		}
	}

	public static class PrivilegedAttribute extends AjAttribute {

		public static final String AttributeName = "org.aspectj.weaver.Privileged";

		private final ResolvedMember[] accessedMembers;

		public PrivilegedAttribute(ResolvedMember[] accessedMembers) {
			this.accessedMembers = accessedMembers;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			ResolvedMemberImpl.writeArray(accessedMembers, s);
		}

		public ResolvedMember[] getAccessedMembers() {
			return accessedMembers;
		}

		public static PrivilegedAttribute read(VersionedDataInputStream stream, ISourceContext context) throws IOException {
			PrivilegedAttribute pa = new PrivilegedAttribute(ResolvedMemberImpl.readResolvedMemberArray(stream, context));
			return pa;
		}

		@Override
		public String getNameString() {
			return AttributeName;
		}
	}

	public static class EffectiveSignatureAttribute extends AjAttribute {
		public static final String AttributeName = "org.aspectj.weaver.EffectiveSignature";

		@Override
		public String getNameString() {
			return AttributeName;
		}

		private final ResolvedMember effectiveSignature;
		private final Shadow.Kind shadowKind;
		private final boolean weaveBody;

		public EffectiveSignatureAttribute(ResolvedMember effectiveSignature, Shadow.Kind shadowKind, boolean weaveBody) {
			this.effectiveSignature = effectiveSignature;
			this.shadowKind = shadowKind;
			this.weaveBody = weaveBody;
		}

		@Override
		public void write(CompressingDataOutputStream s) throws IOException {
			effectiveSignature.write(s);
			shadowKind.write(s);
			s.writeBoolean(weaveBody);
		}

		public static EffectiveSignatureAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
			ResolvedMember member = ResolvedMemberImpl.readResolvedMember(s, context);
			return new EffectiveSignatureAttribute(member, Shadow.Kind.read(s), s.readBoolean());
		}

		public ResolvedMember getEffectiveSignature() {
			return effectiveSignature;
		}

		@Override
		public String toString() {
			return "EffectiveSignatureAttribute(" + effectiveSignature + ", " + shadowKind + ")";
		}

		public Shadow.Kind getShadowKind() {
			return shadowKind;
		}

		public boolean isWeaveBody() {
			return weaveBody;
		}

	}

}