20
20
import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType;
23
* Used to determine if a type has structurally changed during incremental
24
* compilation. At the end of compilation we create one of these objects
25
* using the bytes for the class about to be woven. On a subsequent
26
* incremental compile we compare the new form of the class with a previously
27
* stored CompactTypeStructureRepresentation instance. A structural change
28
* will indicate we need to do recompile other dependent types.
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.
30
28
public class CompactTypeStructureRepresentation implements IBinaryType {
31
static char[][] NoInterface = CharOperation.NO_CHAR_CHAR;
32
static IBinaryNestedType[] NoNestedType = new IBinaryNestedType[0];
33
static IBinaryField[] NoField = new IBinaryField[0];
34
static IBinaryMethod[] NoMethod = new IBinaryMethod[0];
36
// this is the core state for comparison
39
char[] genericSignature;
40
char[] superclassName;
43
// this is the extra state that enables us to be an IBinaryType
44
char[] enclosingTypeName;
45
boolean isLocal, isAnonymous, isMember;
46
char[] sourceFileName;
51
IBinaryField[] binFields;
52
IBinaryMethod[] binMethods;
53
IBinaryNestedType[] memberTypes;
54
IBinaryAnnotation[] annotations;
56
public CompactTypeStructureRepresentation(ClassFileReader cfr) {
58
this.enclosingTypeName = cfr.getEnclosingTypeName();
59
this.isLocal = cfr.isLocal();
60
this.isAnonymous = cfr.isAnonymous();
61
this.isMember = cfr.isMember();
62
this.sourceFileName = cfr.sourceFileName();
63
this.fileName = cfr.getFileName();
64
this.tagBits = cfr.getTagBits();
65
this.isBinaryType = cfr.isBinaryType();
66
this.binFields = cfr.getFields(); if (binFields==null) binFields = NoField;
67
this.binMethods = cfr.getMethods();if (binMethods==null) binMethods = NoMethod;
68
this.memberTypes = cfr.getMemberTypes();
69
this.annotations = cfr.getAnnotations();
70
this.sourceName = cfr.getSourceName();
71
this.className = cfr.getName(); // slashes...
72
this.modifiers = cfr.getModifiers();
73
this.genericSignature = cfr.getGenericSignature();
74
// if (this.genericSignature.length == 0) {
75
// this.genericSignature = null;
77
this.superclassName = cfr.getSuperclassName(); // slashes...
78
interfaces = cfr.getInterfaceNames();
82
public char[] getEnclosingTypeName() {
83
return enclosingTypeName;
86
public int getModifiers() {
90
public char[] getGenericSignature() {
91
return genericSignature;
94
public char[][] getInterfaceNames() {
98
public boolean isAnonymous() {
102
public char[] sourceFileName() {
103
return sourceFileName;
106
public boolean isLocal() {
110
public boolean isMember() {
114
public char[] getSuperclassName() {
115
return superclassName;
118
public char[] getFileName() {
122
public char[] getName() {
126
public long getTagBits() {
130
public boolean isBinaryType() {
134
public IBinaryField[] getFields() {
138
public IBinaryMethod[] getMethods() {
142
public IBinaryNestedType[] getMemberTypes() {
146
public IBinaryAnnotation[] getAnnotations() {
150
public char[] getSourceName() {
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(true);
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() {
b'\\ No newline at end of file'