Bug 23050 - DOM - IVariableBinding.getModifiers() doesn't give final modifier for local variables
Summary: DOM - IVariableBinding.getModifiers() doesn't give final modifier for local v...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-30 16:06 EDT by mark_dixon CLA
Modified: 2002-09-19 11:06 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mark_dixon CLA 2002-08-30 16:06:57 EDT
Using I200208270833

This code
IWorkspace ws = testcasesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
IProject project = root.getProjects()[0];
IJavaProject jp = JavaCore.create(project);
		
CompilationUnit cu = AST.parseCompilationUnit(
   "public class Class {void theMethod() {final int i;}}".toCharArray(),
   "Class", jp);
cu.accept(new ASTVisitor() {
   public boolean visit(VariableDeclarationFragment node) {
      IVariableBinding binding = node.resolveBinding();
      if (!Modifier.isFinal(binding.getModifiers())) {
         System.out.println("No final modifier on binding");
      }
      return true;
   }
});

produces
No final modifier on binding

The code for VariableBinding.getModifiers() is
public int getModifiers() {
   if (isField()) {
      return ((FieldBinding) this.binding).getAccessFlags();
   }
   return 0;
}

I expected to get back the final modifier - is this a bug or is there some 
other way I should be getting this information?

Thanks
Mark
Comment 1 Olivier Thomann CLA 2002-09-04 11:54:00 EDT
Yes, this is a bug and it will be fixed shortly.
Comment 2 Olivier Thomann CLA 2002-09-04 12:02:45 EDT
Fixed and released in 2.1 stream.
Comment 3 David Audel CLA 2002-09-19 04:48:17 EDT
Verified.
Comment 4 Olivier Thomann CLA 2002-09-19 11:06:20 EDT
Regression test added (test0377)