aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java
blob: eb4b4444e39b618ea559e94ec6b39a5c3079db76 (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
/* *******************************************************************
 * 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.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
import org.aspectj.weaver.patterns.Declare;
import org.aspectj.weaver.patterns.DeclareAnnotation;
import org.aspectj.weaver.patterns.DeclareErrorOrWarning;
import org.aspectj.weaver.patterns.DeclareParents;
import org.aspectj.weaver.patterns.DeclarePrecedence;
import org.aspectj.weaver.patterns.DeclareSoft;
import org.aspectj.weaver.patterns.DeclareTypeErrorOrWarning;
import org.aspectj.weaver.patterns.PerClause;
import org.aspectj.weaver.patterns.Pointcut;
import org.aspectj.weaver.patterns.PointcutRewriter;

/**
 * This holds on to all members that have an invasive effect outside of there own compilation unit. These members need to be all
 * gathered up and in a world before any weaving can take place.
 * 
 * They are also important in the compilation process and need to be gathered up before the inter-type declaration weaving stage
 * (unsurprisingly).
 * 
 * All members are concrete.
 * 
 * @author Jim Hugunin
 */
public class CrosscuttingMembers {
	private final ResolvedType inAspect;
	private final World world;

	private PerClause perClause;

	private List<ShadowMunger> shadowMungers = new ArrayList<ShadowMunger>(4);
	private List<ConcreteTypeMunger> typeMungers = new ArrayList<ConcreteTypeMunger>(4);
	private List<ConcreteTypeMunger> lateTypeMungers = new ArrayList<ConcreteTypeMunger>(0);

	private Set<DeclareParents> declareParents = new HashSet<DeclareParents>();
	private Set<DeclareSoft> declareSofts = new HashSet<DeclareSoft>();
	private List<Declare> declareDominates = new ArrayList<Declare>(4);

	// These are like declare parents type mungers
	private Set<DeclareAnnotation> declareAnnotationsOnType = new HashSet<DeclareAnnotation>();
	private Set<DeclareAnnotation> declareAnnotationsOnField = new HashSet<DeclareAnnotation>();
	private Set<DeclareAnnotation> declareAnnotationsOnMethods = new HashSet<DeclareAnnotation>();
	// declareAnnotationsOnMethods includes constructors too

	private Set<DeclareTypeErrorOrWarning> declareTypeEow = new HashSet<DeclareTypeErrorOrWarning>();

	private boolean shouldConcretizeIfNeeded = true;

	public CrosscuttingMembers(ResolvedType inAspect, boolean shouldConcretizeIfNeeded) {
		this.inAspect = inAspect;
		world = inAspect.getWorld();
		this.shouldConcretizeIfNeeded = shouldConcretizeIfNeeded;
	}

	private final Hashtable<String, Object> cflowFields = new Hashtable<String, Object>();
	private final Hashtable<String, Object> cflowBelowFields = new Hashtable<String, Object>();

	// public void addConcreteShadowMungers(Collection c) {
	// shadowMungers.addAll(c);
	// }

	public void addConcreteShadowMunger(ShadowMunger m) {
		// assert m is concrete
		shadowMungers.add(m);
	}

	public void addShadowMungers(Collection<ShadowMunger> c) {
		for (ShadowMunger munger : c) {
			addShadowMunger(munger);
		}
	}

	private void addShadowMunger(ShadowMunger m) {
		if (inAspect.isAbstract()) {
			return; // mungers for abstract aspects are not added
		}
		addConcreteShadowMunger(m.concretize(inAspect, world, perClause));
	}

	public void addTypeMungers(Collection<ConcreteTypeMunger> c) {
		typeMungers.addAll(c);
	}

	public void addTypeMunger(ConcreteTypeMunger m) {
		if (m == null) {
			throw new Error("FIXME AV - should not happen or what ?");// return;
		}
		typeMungers.add(m);
	}

	public void addLateTypeMungers(Collection<ConcreteTypeMunger> c) {
		lateTypeMungers.addAll(c);
	}

	public void addLateTypeMunger(ConcreteTypeMunger m) {
		lateTypeMungers.add(m);
	}

	public void addDeclares(Collection<Declare> declares) {
		for (Declare declare : declares) {
			addDeclare(declare);
		}
	}

	public void addDeclare(Declare declare) {
		// this is not extensible, oh well
		if (declare instanceof DeclareErrorOrWarning) {
			ShadowMunger m = new Checker((DeclareErrorOrWarning) declare);
			m.setDeclaringType(declare.getDeclaringType());
			addShadowMunger(m);
		} else if (declare instanceof DeclarePrecedence) {
			declareDominates.add(declare);
		} else if (declare instanceof DeclareParents) {
			DeclareParents dp = (DeclareParents) declare;
			exposeTypes(dp.getParents().getExactTypes());
			declareParents.add(dp);
		} else if (declare instanceof DeclareSoft) {
			DeclareSoft d = (DeclareSoft) declare;
			// Ordered so that during concretization we can check the related
			// munger
			ShadowMunger m = Advice.makeSoftener(world, d.getPointcut(), d.getException(), inAspect, d);
			m.setDeclaringType(d.getDeclaringType());
			Pointcut concretePointcut = d.getPointcut().concretize(inAspect, d.getDeclaringType(), 0, m);
			m.pointcut = concretePointcut;
			declareSofts.add(new DeclareSoft(d.getException(), concretePointcut));
			addConcreteShadowMunger(m);
		} else if (declare instanceof DeclareAnnotation) {
			// FIXME asc perf Possible Improvement. Investigate why this is
			// called twice in a weave ?
			DeclareAnnotation da = (DeclareAnnotation) declare;
			if (da.getAspect() == null) {
				da.setAspect(inAspect);
			}
			if (da.isDeclareAtType()) {
				declareAnnotationsOnType.add(da);
			} else if (da.isDeclareAtField()) {
				declareAnnotationsOnField.add(da);
			} else if (da.isDeclareAtMethod() || da.isDeclareAtConstuctor()) {
				declareAnnotationsOnMethods.add(da);
			}
		} else if (declare instanceof DeclareTypeErrorOrWarning) {
			declareTypeEow.add((DeclareTypeErrorOrWarning) declare);
		} else {
			throw new RuntimeException("unimplemented");
		}
	}

	public void exposeTypes(List<UnresolvedType> typesToExpose) {
		for (UnresolvedType typeToExpose : typesToExpose) {
			exposeType(typeToExpose);
		}
	}

	public void exposeType(UnresolvedType typeToExpose) {
		if (ResolvedType.isMissing(typeToExpose)) {
			return;
		}
		if (typeToExpose.isParameterizedType() || typeToExpose.isRawType()) {
			if (typeToExpose instanceof ResolvedType) {
				typeToExpose = ((ResolvedType) typeToExpose).getGenericType();
			} else {
				typeToExpose = UnresolvedType.forSignature(typeToExpose.getErasureSignature());
			}
		}
		// Check we haven't already got a munger for this:
		String signatureToLookFor = typeToExpose.getSignature();
		for (Iterator<ConcreteTypeMunger> iterator = typeMungers.iterator(); iterator.hasNext();) {
			ConcreteTypeMunger cTM = iterator.next();
			ResolvedTypeMunger rTM = cTM.getMunger();
			if (rTM != null && rTM instanceof ExposeTypeMunger) {
				String exposedType = ((ExposeTypeMunger) rTM).getExposedTypeSignature();
				if (exposedType.equals(signatureToLookFor)) {
					return; // dont need to bother
				}
			}
		}
		addTypeMunger(world.getWeavingSupport().concreteTypeMunger(new ExposeTypeMunger(typeToExpose), inAspect));
		// ResolvedMember member = new ResolvedMemberImpl(
		// Member.STATIC_INITIALIZATION, typeToExpose, 0, ResolvedType.VOID,
		// "<clinit>", UnresolvedType.NONE);
		// addTypeMunger(world.concreteTypeMunger(
		// new PrivilegedAccessMunger(member), inAspect));
	}

	public void addPrivilegedAccesses(Collection<ResolvedMember> accessedMembers) {
		int version = inAspect.getCompilerVersion();
		for (ResolvedMember member : accessedMembers) {
			// Looking it up ensures we get the annotations - the accessedMembers are just retrieved from the attribute and
			// don't have that information
			ResolvedMember resolvedMember = world.resolve(member);

			// pr333469
			// If the member is for an ITD (e.g. serialVersionUID) then during resolution we may resolve it on
			// a supertype because it doesn't yet exist on the target.
			// For example: MyList extends ArrayList<String> and the ITD is on MyList - after resolution it may be:
			// ArrayList<String>.serialVersionUID, we need to avoid that happening

			if (resolvedMember == null) {
				// can happen for ITDs - are there many privileged access ITDs??
				resolvedMember = member;
				if (resolvedMember.hasBackingGenericMember()) {
					resolvedMember = resolvedMember.getBackingGenericMember();
				}
			} else {
				UnresolvedType unresolvedDeclaringType = member.getDeclaringType().getRawType();
				UnresolvedType resolvedDeclaringType = resolvedMember.getDeclaringType().getRawType();
				if (!unresolvedDeclaringType.equals(resolvedDeclaringType)) {
					resolvedMember = member;
				}
			}
			PrivilegedAccessMunger privilegedAccessMunger = new PrivilegedAccessMunger(resolvedMember,
					version >= WeaverVersionInfo.WEAVER_VERSION_AJ169);
			ConcreteTypeMunger concreteTypeMunger = world.getWeavingSupport().concreteTypeMunger(privilegedAccessMunger, inAspect);
			addTypeMunger(concreteTypeMunger);
		}
	}

	public Collection<ShadowMunger> getCflowEntries() {
		List<ShadowMunger> ret = new ArrayList<ShadowMunger>();
		for (ShadowMunger m : shadowMungers) {
			if (m instanceof Advice) {
				Advice a = (Advice) m;
				if (a.getKind().isCflow()) {
					ret.add(a);
				}
			}
		}
		return ret;
	}

	/**
	 * Updates the records if something has changed. This is called at most twice, firstly whilst collecting ITDs and declares. At
	 * this point the CrosscuttingMembers we're comparing ourselves with doesn't know about shadowmungers. Therefore a straight
	 * comparison with the existing list of shadowmungers would return that something has changed even though it might not have, so
	 * in this first round we ignore the shadowMungers. The second time this is called is whilst we're preparing to weave. At this
	 * point we know everything in the system and so we're able to compare the shadowMunger list. (see bug 129163)
	 * 
	 * @param other
	 * @param careAboutShadowMungers
	 * @return true if something has changed since the last time this method was called, false otherwise
	 */
	public boolean replaceWith(CrosscuttingMembers other, boolean careAboutShadowMungers) {
		boolean changed = false;

		if (careAboutShadowMungers) {
			if (perClause == null || !perClause.equals(other.perClause)) {
				changed = true;
				perClause = other.perClause;
			}
		}

		// XXX all of the below should be set equality rather than list equality
		// System.err.println("old: " + shadowMungers + " new: " +
		// other.shadowMungers);

		if (careAboutShadowMungers) {
			// bug 129163: use set equality rather than list equality
			Set<ShadowMunger> theseShadowMungers = new HashSet<ShadowMunger>();
			Set<ShadowMunger> theseInlinedAroundMungers = new HashSet<ShadowMunger>();
			for (ShadowMunger munger : shadowMungers) {
				if (munger instanceof Advice) {
					Advice adviceMunger = (Advice) munger;
					// bug 154054: if we're around advice that has been inlined
					// then we need to do more checking than existing equals
					// methods allow
					if (!world.isXnoInline() && adviceMunger.getKind().equals(AdviceKind.Around)) {
						theseInlinedAroundMungers.add(adviceMunger);
					} else {
						theseShadowMungers.add(adviceMunger);
					}
				} else {
					theseShadowMungers.add(munger);
				}
			}
			Set<ShadowMunger> tempSet = new HashSet<ShadowMunger>();
			tempSet.addAll(other.shadowMungers);
			Set<ShadowMunger> otherShadowMungers = new HashSet<ShadowMunger>();
			Set<ShadowMunger> otherInlinedAroundMungers = new HashSet<ShadowMunger>();
			for (ShadowMunger munger : tempSet) {
				if (munger instanceof Advice) {
					Advice adviceMunger = (Advice) munger;
					// bug 154054: if we're around advice that has been inlined
					// then we need to do more checking than existing equals
					// methods allow
					if (!world.isXnoInline() && adviceMunger.getKind().equals(AdviceKind.Around)) {
						otherInlinedAroundMungers.add(rewritePointcutInMunger(adviceMunger));
					} else {
						otherShadowMungers.add(rewritePointcutInMunger(adviceMunger));
					}
				} else {
					otherShadowMungers.add(rewritePointcutInMunger(munger));
				}
			}
			if (!theseShadowMungers.equals(otherShadowMungers)) {
				changed = true;
			}
			if (!equivalent(theseInlinedAroundMungers, otherInlinedAroundMungers)) {
				changed = true;
			}

			// bug 158573 - if there are no changes then preserve whether
			// or not a particular shadowMunger has matched something.
			if (!changed) {
				for (ShadowMunger munger : shadowMungers) {
					int i = other.shadowMungers.indexOf(munger);
					ShadowMunger otherMunger = other.shadowMungers.get(i);
					if (munger instanceof Advice) {
						((Advice) otherMunger).setHasMatchedSomething(((Advice) munger).hasMatchedSomething());
					}
				}
			}
			// replace the existing list of shadowmungers with the
			// new ones in case anything like the sourcelocation has
			// changed, however, don't want this flagged as a change
			// which will force a full build - bug 134541
			shadowMungers = other.shadowMungers;
		}

		// bug 129163: use set equality rather than list equality and
		// if we dont care about shadow mungers then ignore those
		// typeMungers which are created to help with the implementation
		// of shadowMungers
		Set<Object> theseTypeMungers = new HashSet<Object>();
		Set<Object> otherTypeMungers = new HashSet<Object>();
		if (!careAboutShadowMungers) {
			for (Iterator<ConcreteTypeMunger> iter = typeMungers.iterator(); iter.hasNext();) {
				Object o = iter.next();
				if (o instanceof ConcreteTypeMunger) {
					ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) o;
					if (!typeMunger.existsToSupportShadowMunging()) {
						theseTypeMungers.add(typeMunger);
					}
				} else {
					theseTypeMungers.add(o);
				}
			}

			for (Iterator<ConcreteTypeMunger> iter = other.typeMungers.iterator(); iter.hasNext();) {
				Object o = iter.next();
				if (o instanceof ConcreteTypeMunger) {
					ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) o;
					if (!typeMunger.existsToSupportShadowMunging()) {
						otherTypeMungers.add(typeMunger);
					}
				} else {
					otherTypeMungers.add(o);
				}
			}
		} else {
			theseTypeMungers.addAll(typeMungers);
			otherTypeMungers.addAll(other.typeMungers);
		}

		// initial go at equivalence logic rather than set compare (see
		// pr133532)
		if (theseTypeMungers.size() != otherTypeMungers.size()) {
			changed = true;
			typeMungers = other.typeMungers;
		} else {
			boolean shouldOverwriteThis = false;
			boolean foundInequality = false;
			for (Iterator<Object> iter = theseTypeMungers.iterator(); iter.hasNext() && !foundInequality;) {
				Object thisOne = iter.next();
				boolean foundInOtherSet = false;
				for (Object otherOne : otherTypeMungers) {
					if (thisOne instanceof ConcreteTypeMunger) {
						if (((ConcreteTypeMunger) thisOne).shouldOverwrite()) {
							shouldOverwriteThis = true;
						}
					}
					if (thisOne instanceof ConcreteTypeMunger && otherOne instanceof ConcreteTypeMunger) {
						if (((ConcreteTypeMunger) thisOne).equivalentTo(otherOne)) {
							foundInOtherSet = true;
						} else if (thisOne.equals(otherOne)) {
							foundInOtherSet = true;
						}
					} else {
						if (thisOne.equals(otherOne)) {
							foundInOtherSet = true;
						}
					}
				}
				if (!foundInOtherSet) {
					foundInequality = true;
				}
			}
			if (foundInequality) {
				// System.out.println("type munger change");
				changed = true;
			}
			if (shouldOverwriteThis) {
				typeMungers = other.typeMungers;
			}
		}
		// if (!theseTypeMungers.equals(otherTypeMungers)) {
		// changed = true;
		// typeMungers = other.typeMungers;
		// }

		if (!lateTypeMungers.equals(other.lateTypeMungers)) {
			changed = true;
			lateTypeMungers = other.lateTypeMungers;
		}

		if (!declareDominates.equals(other.declareDominates)) {
			changed = true;
			declareDominates = other.declareDominates;
		}

		if (!declareParents.equals(other.declareParents)) {
			// Are the differences just because of a mixin? These are not created until weave time so should be gotten rid of for
			// the up front comparison
			if (!careAboutShadowMungers) {
				// this means we are in front end compilation and if the differences are purely mixin parents, we can continue OK
				Set<DeclareParents> trimmedThis = new HashSet<DeclareParents>();
				for (Iterator<DeclareParents> iterator = declareParents.iterator(); iterator.hasNext();) {
					DeclareParents decp = iterator.next();
					if (!decp.isMixin()) {
						trimmedThis.add(decp);
					}
				}
				Set<DeclareParents> trimmedOther = new HashSet<DeclareParents>();
				for (Iterator<DeclareParents> iterator = other.declareParents.iterator(); iterator.hasNext();) {
					DeclareParents decp = iterator.next();
					if (!decp.isMixin()) {
						trimmedOther.add(decp);
					}
				}
				if (!trimmedThis.equals(trimmedOther)) {
					changed = true;
					declareParents = other.declareParents;
				}
			} else {
				changed = true;
				declareParents = other.declareParents;
			}
		}

		if (!declareSofts.equals(other.declareSofts)) {
			changed = true;
			declareSofts = other.declareSofts;
		}

		// DECAT for when attempting to replace an aspect
		if (!declareAnnotationsOnType.equals(other.declareAnnotationsOnType)) {
			changed = true;
			declareAnnotationsOnType = other.declareAnnotationsOnType;
		}

		if (!declareAnnotationsOnField.equals(other.declareAnnotationsOnField)) {
			changed = true;
			declareAnnotationsOnField = other.declareAnnotationsOnField;
		}

		if (!declareAnnotationsOnMethods.equals(other.declareAnnotationsOnMethods)) {
			changed = true;
			declareAnnotationsOnMethods = other.declareAnnotationsOnMethods;
		}
		if (!declareTypeEow.equals(other.declareTypeEow)) {
			changed = true;
			declareTypeEow = other.declareTypeEow;
		}

		return changed;
	}

	private boolean equivalent(Set<ShadowMunger> theseInlinedAroundMungers, Set<ShadowMunger> otherInlinedAroundMungers) {
		if (theseInlinedAroundMungers.size() != otherInlinedAroundMungers.size()) {
			return false;
		}
		for (Iterator<ShadowMunger> iter = theseInlinedAroundMungers.iterator(); iter.hasNext();) {
			Advice thisAdvice = (Advice) iter.next();
			boolean foundIt = false;
			for (Iterator<ShadowMunger> iterator = otherInlinedAroundMungers.iterator(); iterator.hasNext();) {
				Advice otherAdvice = (Advice) iterator.next();
				if (thisAdvice.equals(otherAdvice)) {
					if (thisAdvice.getSignature() instanceof ResolvedMemberImpl) {
						if (((ResolvedMemberImpl) thisAdvice.getSignature()).isEquivalentTo(otherAdvice.getSignature())) {
							foundIt = true;
							continue;
						}
					}
					return false;
				}
			}
			if (!foundIt) {
				return false;
			}
		}
		return true;
	}

	private ShadowMunger rewritePointcutInMunger(ShadowMunger munger) {
		PointcutRewriter pr = new PointcutRewriter();
		Pointcut p = munger.getPointcut();
		Pointcut newP = pr.rewrite(p);
		if (p.m_ignoreUnboundBindingForNames.length != 0) {
			// *sigh* dirty fix for dirty hacky implementation pr149305
			newP.m_ignoreUnboundBindingForNames = p.m_ignoreUnboundBindingForNames;
		}
		munger.setPointcut(newP);
		return munger;
	}

	public void setPerClause(PerClause perClause) {
		if (shouldConcretizeIfNeeded) {
			this.perClause = perClause.concretize(inAspect);
		} else {
			this.perClause = perClause;
		}
	}

	public List<Declare> getDeclareDominates() {
		return declareDominates;
	}

	public Collection<DeclareParents> getDeclareParents() {
		return declareParents;
	}

	public Collection<DeclareSoft> getDeclareSofts() {
		return declareSofts;
	}

	public List<ShadowMunger> getShadowMungers() {
		return shadowMungers;
	}

	public List<ConcreteTypeMunger> getTypeMungers() {
		return typeMungers;
	}

	public List<ConcreteTypeMunger> getLateTypeMungers() {
		return lateTypeMungers;
	}

	public Collection<DeclareAnnotation> getDeclareAnnotationOnTypes() {
		return declareAnnotationsOnType;
	}

	public Collection<DeclareAnnotation> getDeclareAnnotationOnFields() {
		return declareAnnotationsOnField;
	}

	/**
	 * includes declare @method and @constructor
	 */
	public Collection<DeclareAnnotation> getDeclareAnnotationOnMethods() {
		return declareAnnotationsOnMethods;
	}

	public Collection<DeclareTypeErrorOrWarning> getDeclareTypeErrorOrWarning() {
		return declareTypeEow;
	}

	public Map<String, Object> getCflowBelowFields() {
		return cflowBelowFields;
	}

	public Map<String, Object> getCflowFields() {
		return cflowFields;
	}

	public void clearCaches() {
		cflowFields.clear();
		cflowBelowFields.clear();
	}

}