1 /* *******************************************************************
2 * Copyright (c) 2010 Contributors
4 * This program and the accompanying materials are made available
5 * under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Andy Clement - SpringSource
11 * ******************************************************************/
12 package org.aspectj.ajdt.internal.compiler.lookup;
14 import java.util.HashSet;
17 import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
18 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ITypeFinder;
19 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
20 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
23 * The member finder looks after intertype declared inner classes on a type, there is one member finder per type that was hit by an
24 * new inner type declaration.
26 * @author Andy Clement
29 public class IntertypeMemberTypeFinder implements ITypeFinder {
31 // Target that has these new types
32 public SourceTypeBinding targetTypeBinding;
34 // The new types declared onto the target
35 private Set<ReferenceBinding> intertypeMemberTypes = new HashSet<ReferenceBinding>();
37 public void addInterTypeMemberType(ReferenceBinding binding) {
38 intertypeMemberTypes.add(binding);
39 // ReferenceBinding[] rbs = targetTypeBinding.memberTypes();
40 // ReferenceBinding[] newRbs = new ReferenceBinding[rbs.length + 1];
41 // System.arraycopy(rbs, 0, newRbs, 1, rbs.length);
42 // newRbs[0] = binding;
43 // (targetTypeBinding).memberTypes = newRbs;
47 public ReferenceBinding getMemberType(char[] memberTypeName) {
48 for (ReferenceBinding intertypeMemberType : intertypeMemberTypes) {
49 if (CharOperation.equals(intertypeMemberType.sourceName, memberTypeName)) {
50 return intertypeMemberType;
56 public ReferenceBinding[] getMemberTypes() {
57 ReferenceBinding[] array = new ReferenceBinding[intertypeMemberTypes.size()];
58 return intertypeMemberTypes.toArray(array);