1 /* *******************************************************************
2 * Copyright (c) 2005 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 promoted member type from AjState
11 * ******************************************************************/
12 package org.aspectj.ajdt.internal.core.builder;
14 import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
15 import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
16 import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
17 import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryField;
18 import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
19 import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryNestedType;
20 import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType;
23 * Used to determine if a type has structurally changed during incremental compilation. At the end of compilation we create one of
24 * these objects using the bytes for the class about to be woven. On a subsequent incremental compile we compare the new form of the
25 * class with a previously stored CompactTypeStructureRepresentation instance. A structural change will indicate we need to do
26 * recompile other dependent types.
28 public class CompactTypeStructureRepresentation implements IBinaryType {
29 static char[][] NoInterface = CharOperation.NO_CHAR_CHAR;
30 static IBinaryNestedType[] NoNestedType = new IBinaryNestedType[0];
31 static IBinaryField[] NoField = new IBinaryField[0];
32 static IBinaryMethod[] NoMethod = new IBinaryMethod[0];
34 // this is the core state for comparison
37 char[] genericSignature;
38 char[] superclassName;
41 // this is the extra state that enables us to be an IBinaryType
42 char[] enclosingTypeName;
43 boolean isLocal, isAnonymous, isMember;
44 char[] sourceFileName;
49 IBinaryField[] binFields;
50 IBinaryMethod[] binMethods;
51 IBinaryNestedType[] memberTypes;
52 IBinaryAnnotation[] annotations;
54 public CompactTypeStructureRepresentation(ClassFileReader cfr) {
56 this.enclosingTypeName = cfr.getEnclosingTypeName();
57 this.isLocal = cfr.isLocal();
58 this.isAnonymous = cfr.isAnonymous();
59 this.isMember = cfr.isMember();
60 this.sourceFileName = cfr.sourceFileName();
61 this.fileName = cfr.getFileName();
62 this.tagBits = cfr.getTagBits();
63 this.isBinaryType = cfr.isBinaryType();
64 this.binFields = cfr.getFields();
65 if (binFields == null) {
68 this.binMethods = cfr.getMethods();
69 if (binMethods == null) {
70 binMethods = NoMethod;
72 this.memberTypes = cfr.getMemberTypes();
73 this.annotations = cfr.getAnnotations();
74 this.sourceName = cfr.getSourceName();
75 this.className = cfr.getName(); // slashes...
76 this.modifiers = cfr.getModifiers();
77 this.genericSignature = cfr.getGenericSignature();
78 // if (this.genericSignature.length == 0) {
79 // this.genericSignature = null;
81 this.superclassName = cfr.getSuperclassName(); // slashes...
82 interfaces = cfr.getInterfaceNames();
86 public char[] getEnclosingTypeName() {
87 return enclosingTypeName;
90 public int getModifiers() {
94 public char[] getGenericSignature() {
95 return genericSignature;
98 public char[][] getInterfaceNames() {
102 public boolean isAnonymous() {
106 public char[] sourceFileName() {
107 return sourceFileName;
110 public boolean isLocal() {
114 public boolean isMember() {
118 public char[] getSuperclassName() {
119 return superclassName;
122 public char[] getFileName() {
126 public char[] getName() {
130 public long getTagBits() {
134 public boolean isBinaryType() {
138 public IBinaryField[] getFields() {
142 public IBinaryMethod[] getMethods() {
146 public IBinaryNestedType[] getMemberTypes() {
150 public IBinaryAnnotation[] getAnnotations() {
154 public char[] getSourceName() {