diff options
author | Philipe Mulet | 2004-04-08 10:47:52 +0000 |
---|---|---|
committer | Philipe Mulet | 2004-04-08 10:47:52 +0000 |
commit | ff29823019aba32f7bf310695c265bf97203000e (patch) | |
tree | 60fc32611f59f9b131a0b33af0662246f93f75dd | |
parent | 8a335ded1ddcb97e71e631176860db28a5869134 (diff) | |
download | eclipse.jdt.core-ff29823019aba32f7bf310695c265bf97203000e.tar.gz eclipse.jdt.core-ff29823019aba32f7bf310695c265bf97203000e.tar.xz eclipse.jdt.core-ff29823019aba32f7bf310695c265bf97203000e.zip |
57858
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java | 66 |
1 files changed, 39 insertions, 27 deletions
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 9104ee9389..4c3489fee1 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 @@ -16,7 +16,6 @@ import org.eclipse.jdt.internal.compiler.ast.Clinit; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeReference; -import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; @@ -310,33 +309,46 @@ public class ClassScope extends Scope { } else if (sourceType.isLocalType()) { if (sourceType.isAnonymousType()) modifiers |= AccFinal; - MethodScope methodScope = methodScope(); - ReferenceContext refContext = methodScope.referenceContext; - if (refContext instanceof TypeDeclaration) { - - SourceTypeBinding type = ((TypeDeclaration) refContext).binding; - - // inside field declaration ? check field modifier to see if deprecated - if (methodScope.initializedField != null) { - // currently inside this field initialization - if (methodScope.initializedField.isViewedAsDeprecated() && !sourceType.isDeprecated()){ - modifiers |= AccDeprecatedImplicitly; - } - } else { - if (type.isStrictfp()) - modifiers |= AccStrictfp; - if (type.isViewedAsDeprecated() && !sourceType.isDeprecated()) - modifiers |= AccDeprecatedImplicitly; - } - } else { - MethodBinding method = ((AbstractMethodDeclaration) refContext).binding; - if (method != null){ - if (method.isStrictfp()) - modifiers |= AccStrictfp; - if (method.isViewedAsDeprecated() && !sourceType.isDeprecated()) - modifiers |= AccDeprecatedImplicitly; + Scope scope = this; + do { + switch (scope.kind) { + case METHOD_SCOPE : + MethodScope methodScope = (MethodScope) scope; + if (methodScope.isInsideInitializer()) { + SourceTypeBinding type = ((TypeDeclaration) methodScope.referenceContext).binding; + + // inside field declaration ? check field modifier to see if deprecated + if (methodScope.initializedField != null) { + // currently inside this field initialization + if (methodScope.initializedField.isViewedAsDeprecated() && !sourceType.isDeprecated()){ + modifiers |= AccDeprecatedImplicitly; + } + } else { + if (type.isStrictfp()) + modifiers |= AccStrictfp; + if (type.isViewedAsDeprecated() && !sourceType.isDeprecated()) + modifiers |= AccDeprecatedImplicitly; + } + } else { + MethodBinding method = ((AbstractMethodDeclaration) methodScope.referenceContext).binding; + if (method != null){ + if (method.isStrictfp()) + modifiers |= AccStrictfp; + if (method.isViewedAsDeprecated() && !sourceType.isDeprecated()) + modifiers |= AccDeprecatedImplicitly; + } + } + break; + case CLASS_SCOPE : + // local member + if (enclosingType.isStrictfp()) + modifiers |= AccStrictfp; + if (enclosingType.isViewedAsDeprecated() && !sourceType.isDeprecated()) + modifiers |= AccDeprecatedImplicitly; + break; } - } + scope = scope.parent; + } while (scope != null); } // after this point, tests on the 16 bits reserved. int realModifiers = modifiers & AccJustFlag; |