Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2012-01-28 18:53:55 +0000
committerStephan Herrmann2012-01-28 19:43:44 +0000
commit7ab5e31c24d0eb1a3e3c1c6f079a57204550e8f1 (patch)
treee4be8e8ceb501c59126a9fd22d648023421f72b3
parent2c38ab4d76d7def0495e781b84c159ff2b585512 (diff)
downloadorg.eclipse.objectteams-7ab5e31c24d0eb1a3e3c1c6f079a57204550e8f1.tar.gz
org.eclipse.objectteams-7ab5e31c24d0eb1a3e3c1c6f079a57204550e8f1.tar.xz
org.eclipse.objectteams-7ab5e31c24d0eb1a3e3c1c6f079a57204550e8f1.zip
Fixed the inclusion of OT-specific fields (fake & generated) into the
new strategy for assigning field ids.
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java19
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/BaseCallTrackingVariable.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/TypeValueParameter.java9
4 files changed, 18 insertions, 14 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
index 8b5742483..237f5220a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
@@ -1793,6 +1793,11 @@ public void resolve() {
}
ReferenceBinding[] superInterfacesBinding = sourceType.superInterfaces;
fieldAnalysisOffset += findFieldCountFromSuperInterfaces(superInterfacesBinding);
+//{ObjectTeams: also count type value parameters into maxFieldCount
+ if (this.typeParameters != null)
+ fieldAnalysisOffset += TypeValueParameter.count(this);
+// SH}
+
sourceType.cumulativeFieldCount += fieldAnalysisOffset;
sourceType.fieldAnalysisOffset = fieldAnalysisOffset;
this.maxFieldCount = sourceType.cumulativeFieldCount;
@@ -1808,9 +1813,9 @@ public void resolve() {
}
}
//{ObjectTeams: should we work at all?
- Config config = Config.getConfig();
- boolean fieldsAndMethods = config.verifyMethods;
- if (fieldsAndMethods) {
+ Config config = Config.getConfig();
+ boolean fieldsAndMethods = config.verifyMethods;
+ if (fieldsAndMethods)
// SH}
if (this.fields != null) {
for (int i = 0, count = this.fields.length; i < count; i++) {
@@ -1848,11 +1853,6 @@ public void resolve() {
field.resolve(field.isStatic() ? this.staticInitializerScope : this.initializerScope);
}
}
-//{ObjectTeams: also count type value parameters into maxFieldCount
- if (this.typeParameters != null)
- sourceType.cumulativeFieldCount += TypeValueParameter.updateMaxFieldCount(this);
- }
-// SH}
if (needSerialVersion) {
//check that the current type doesn't extend javax.rmi.CORBA.Stub
TypeBinding javaxRmiCorbaStub = this.scope.getType(TypeConstants.JAVAX_RMI_CORBA_STUB, 4);
@@ -2307,6 +2307,9 @@ public void traverse(ASTVisitor visitor, ClassScope classScope) {
* which include fields of outer and super types.
* During resolve, the maximum of these counts is collected inside out.
*/
+//{ObjectTeams: make accessible for ClassScope.addGeneratedField():
+public
+// SH}
void updateMaxFieldCount() {
if (this.binding == null)
return; // error scenario
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
index d9fcc0a4c..5a693105b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
@@ -842,6 +842,8 @@ public class ClassScope extends Scope {
fieldDeclaration, null, fieldDeclaration.modifiers|ExtraCompilerModifiers.AccUnresolved, sourceType);
sourceType.addField(fieldBinding);
+ sourceType.cumulativeFieldCount++;
+ this.referenceContext.updateMaxFieldCount();
checkAndSetModifiersForField(fieldBinding, fieldDeclaration);
// FIXME(SH): does this improve robustness?
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/BaseCallTrackingVariable.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/BaseCallTrackingVariable.java
index e0270c850..93cc9dfcb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/BaseCallTrackingVariable.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/BaseCallTrackingVariable.java
@@ -76,6 +76,6 @@ public class BaseCallTrackingVariable extends LocalDeclaration {
false);
this.binding.setConstant(Constant.NotAConstant);
// use a free slot without assigning it:
- this.binding.id = scope.outerMostMethodScope().analysisIndex+1;
+ this.binding.id = scope.outerMostMethodScope().analysisIndex++;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/TypeValueParameter.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/TypeValueParameter.java
index 3e0b9a236..8950b3f8c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/TypeValueParameter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/TypeValueParameter.java
@@ -145,15 +145,14 @@ public class TypeValueParameter extends TypeParameter {
}
/** Count all TypeValuaParameters of declaration into the number of its fields. */
- public static int updateMaxFieldCount(TypeDeclaration declaration) {
+ public static int count(TypeDeclaration declaration) {
TypeParameter[] typeParameters = declaration.typeParameters;
- int incr = 0;
+ int count = 0;
for (int i = 0; i < typeParameters.length; i++) {
if (typeParameters[i] instanceof TypeValueParameter) {
- incr++;
+ count++;
}
}
- declaration.maxFieldCount += incr;
- return incr;
+ return count;
}
}

Back to the top