]> source.dussan.org Git - aspectj.git/commitdiff
proper handling of inter-type fields with array types
authorjhugunin <jhugunin>
Tue, 7 Jan 2003 23:20:59 +0000 (23:20 +0000)
committerjhugunin <jhugunin>
Tue, 7 Jan 2003 23:20:59 +0000 (23:20 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java

index 86d5c9c8b6809932dfe0335feea006fec164db54..6051c9a7bb2ab9dfd5a8fa7823762f0bbeca4f48 100644 (file)
@@ -60,13 +60,30 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
                EclipseWorld world = EclipseWorld.fromScopeLookupEnvironment(upperScope);
                ResolvedMember sig = munger.getSignature();
                TypeX aspectType = EclipseWorld.fromBinding(upperScope.referenceContext.binding);
+//
+//             System.err.println("sig: " + sig);
+//             System.err.println("field: " + world.makeFieldBinding(
+//                             AjcMemberMaker.interFieldClassField(sig, aspectType)));
+               
+
+               if (initialization != null && initialization instanceof ArrayInitializer) {
+                       //System.err.println("got initializer: " + initialization);
+                       ArrayAllocationExpression aae = new ArrayAllocationExpression();
+                       aae.initializer = (ArrayInitializer)initialization;
+                       ArrayBinding arrayType = (ArrayBinding)world.makeTypeBinding(sig.getReturnType());
+                       aae.type = AstUtil.makeTypeReference(arrayType.leafComponentType());
+                       aae.sourceStart = initialization.sourceStart;
+                       aae.sourceEnd = initialization.sourceEnd;
+                       aae.dimensions = new Expression[arrayType.dimensions];
+                       initialization = aae;
+               }
+
                
                if (initialization == null) {
                        this.statements = new Statement[] {
                                new ReturnStatement(null, 0, 0),
                        };
                } else if (!onTypeBinding.isInterface()) {
-                       
                        FieldBinding interField = world.makeFieldBinding(
                                AjcMemberMaker.interFieldClassField(sig, aspectType));
                        Reference ref = new KnownFieldReference(interField, 0);
@@ -117,6 +134,8 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
                        };
                }
                
+               //System.err.println("type: " + binding.returnType + ", " + returnType);
+               
                ResolvedMember sig =
                        new ResolvedMember(Member.FIELD, EclipseWorld.fromBinding(onTypeBinding),
                                        declaredModifiers, EclipseWorld.fromBinding(binding.returnType),
index c5ebf3dee31f7d3a0cf27597aef51709c04e046f..4b3c564993858dd41d488b719edf264a0344daf4 100644 (file)
@@ -186,7 +186,7 @@ public class EclipseWorld extends World {
                                dim++;
                                typeX = typeX.getComponentType();
                        }
-                       return new ArrayBinding(makeTypeBinding(typeX), dim);
+                       return lookupEnvironment.createArrayType(makeTypeBinding(typeX), dim);
                } else {
                        ResolvedTypeX rt = typeX.resolve(this);
                        //System.out.println("typex: " + typeX + ", " + rt);
index 40d65731eaa5d79adc03bfb88afea215120a90e8..ede3ca9f33ed18761a0cd8f4bdf54a15dab8e0d6 100644 (file)
@@ -766,13 +766,9 @@ public class AjParser extends Parser {
                //      field.sourceEnd = end;
 
                TypeReference onType = getTypeReference(0);
-               TypeReference returnType = getTypeReference(0);
-               //      field.type = returnType;
-
+               TypeReference returnType = getTypeReference(intStack[intPtr--]);
                this.display();
 
-               int dontKnowWhatThisIs = intStack[intPtr--];
-
                int decSourceStart = intStack[intPtr--];
                int modifiers = intStack[intPtr--];