Bug 261909

Summary: ClassFileReader.getModifiers() answers funny bits
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: Olivier_Thomann, srikanth_sankaran
Version: 3.4.1   
Target Milestone: 3.6 M1   
Hardware: Other   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

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