Bug 261909 - ClassFileReader.getModifiers() answers funny bits
Summary: ClassFileReader.getModifiers() answers funny bits
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.1   Edit
Hardware: Other All
: P3 minor (vote)
Target Milestone: 3.6 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-21 16:02 EST by Stephan Herrmann CLA
Modified: 2009-08-05 01:48 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (2.25 KB, patch)
2009-07-27 21:57 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2009-01-21 16:02:53 EST
Running org.eclipse.jdt.core.tests.model.TypeResolveTests#testResolveTypeInBinary1
in the debugger I see funny modifiers. Set a breakpoint in
SelectionEngine#selectType and look at typeDeclaration:

   public synchronized class Y ...

This is produced by the BinaryTypeConverter indirectly using 
ClassFileReader#getModifiers() which fails to filter AccSuper from the
bits set in the class file (Synchronized and Super share the same bit).

When this type is passed to buildTypeBindings the compiler detects:

"Pb(302) Illegal modifier for the class Y; only public, abstract & final are permitted"

Certainly this error never surfaces, but I see no good in converting to 
buggy code (BinaryTypeConverter).
Would we ever want to see the AccSuper bit through a ClassFileReader?
Or should it be filter right away when initializing the reader?

While I'm at it: mentioned method getModifiers() has a doc comment reading:

 * Set the AccDeprecated and AccSynthetic bits if necessary

however, the code only handles AccDeprecated.

So far nothing any user will notice but behind the scenes it looks wrong ...
Comment 1 Olivier Thomann CLA 2009-07-27 21:57:30 EDT
Created attachment 142724 [details]
Proposed fix
Comment 2 Olivier Thomann CLA 2009-07-27 22:05:35 EDT
Released for 3.6M1.
Source verification is required.
Comment 3 Srikanth Sankaran CLA 2009-08-05 01:48:11 EDT
Verified for 3.6M1 by code inspection