Bug 78740 - IDOMType.getFlags() fails to represent interface flags correctly.
Summary: IDOMType.getFlags() fails to represent interface flags correctly.
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 blocker (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-16 10:57 EST by Ed Merks CLA
Modified: 2004-12-14 10:00 EST (History)
1 user (show)

See Also:


Attachments
Full project with test case. (2.27 KB, application/zip)
2004-11-16 10:59 EST, Ed Merks CLA
no flags Details
Apply on HEAD (1.21 KB, patch)
2004-11-16 17:43 EST, 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 Ed Merks CLA 2004-11-16 10:57:30 EST
This code demonstrates that calling getComment on an IDOMType will change the
flags from correctly encoding the type as being interface to incorrectly
encoding it (because during becomeDetailed() that information is lost):

package org.example.jdom;

import org.eclipse.core.runtime.IPlatformRunnable;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.jdom.DOMFactory;
import org.eclipse.jdt.core.jdom.IDOMCompilationUnit;
import org.eclipse.jdt.core.jdom.IDOMType;

public class Test implements IPlatformRunnable
{
  public Object run(Object object)
  {
    DOMFactory factory = new DOMFactory();
    IDOMCompilationUnit jCompilationUnit =
factory.createCompilationUnit("package x; /** @model */ interface X  {}", "NAME");
    IDOMType jType = (IDOMType)jCompilationUnit.getFirstChild().getNextNode(); 
    System.err.println("" + ((jType.getFlags() & Flags.AccInterface) != 0));
    jType.getComment();
    System.err.println("" + ((jType.getFlags() & Flags.AccInterface) != 0));
    return new Integer(0);
  }
}

This bug completely breaks EMF's JavaEcoreBuilder, which is a blocking problem
for our clients and hence we see this as a blocking problem.
Comment 1 Ed Merks CLA 2004-11-16 10:59:42 EST
Created attachment 15897 [details]
Full project with test case.

The attachment is a zip of the complete project for reproducing the problem.
Comment 2 Olivier Thomann CLA 2004-11-16 14:58:08 EST
I will investigate.
Comment 3 Philipe Mulet CLA 2004-11-16 16:51:22 EST
Should we consider for 3.0 maintenance backporting or is it only a blocker in
3.1 stream ?
Comment 4 Olivier Thomann CLA 2004-11-16 17:09:00 EST
This seems to be a problem only in 3.1 where the call to
adjustInterfaceModifiers(); has been removed. The DocumentElementParser has not
been updated. Fixing this resolves this issue.
I will attach a patch soon.
Comment 5 Olivier Thomann CLA 2004-11-16 17:42:50 EST
The next nightly build will contain the fix.
Comment 6 Olivier Thomann CLA 2004-11-16 17:43:41 EST
Created attachment 15909 [details]
Apply on HEAD

This will be released as soon as all tests passed.
Comment 7 Olivier Thomann CLA 2004-11-16 17:59:22 EST
Fixed and released in HEAD.
Regression test added in ASTConverterTestAST3_2.test0576
Comment 8 Ed Merks CLA 2004-11-17 07:01:22 EST
Thanks for the speedy service!!!
Comment 9 Jerome Lanneluc CLA 2004-12-14 10:00:36 EST
Verified (in I200412140010) that the test ensures that getComment() has no side
effect on the flags.