From 1939b950303f6e5cf417be3cdde605812fd95343 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 15 Jun 2011 16:14:40 +0000 Subject: 349398 --- .../compiler/ast/AccessForInlineVisitor.java | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'org.aspectj.ajdt.core') diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java index eae372855..d46012bc9 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java @@ -14,6 +14,9 @@ package org.aspectj.ajdt.internal.compiler.ast; //import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory; import org.aspectj.ajdt.internal.compiler.lookup.InlineAccessFieldBinding; import org.aspectj.ajdt.internal.compiler.lookup.InterTypeFieldBinding; @@ -60,6 +63,7 @@ public class AccessForInlineVisitor extends ASTVisitor { PrivilegedHandler handler; AspectDeclaration inAspect; EclipseFactory world; // alias for inAspect.world + private Map> alreadyProcessedReceivers = new HashMap>(); // set to true for ClassLiteralAccess and AssertStatement // ??? A better answer would be to transform these into inlinable forms @@ -159,13 +163,22 @@ public class AccessForInlineVisitor extends ASTVisitor { binding.modifiers = AstUtil.makePackageVisible(binding.modifiers); } - ResolvedMember m = world.makeResolvedMember(binding, receiverType); - if (inAspect.accessForInline.containsKey(m)) + // Avoid repeatedly building ResolvedMembers by using info on any done previously in this visitor + Map alreadyResolvedMembers = alreadyProcessedReceivers.get(receiverType); + if (alreadyResolvedMembers == null) { + alreadyResolvedMembers = new HashMap(); + alreadyProcessedReceivers.put(receiverType, alreadyResolvedMembers); + } + ResolvedMember m = alreadyResolvedMembers.get(binding); + if (m == null) { + m = world.makeResolvedMember(binding, receiverType); + alreadyResolvedMembers.put(binding, m); + } + + if (inAspect.accessForInline.containsKey(m)) { return (FieldBinding) inAspect.accessForInline.get(m); + } FieldBinding ret = new InlineAccessFieldBinding(inAspect, binding, m); - - // System.err.println(" made accessor: " + ret); - inAspect.accessForInline.put(m, ret); return ret; } -- cgit v1.2.3