Bug 77249 - Annotation on class cancels "public" modifier
Summary: Annotation on class cancels "public" modifier
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-28 17:57 EDT by Carl McConnell CLA
Modified: 2004-11-04 04:28 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carl McConnell CLA 2004-10-28 17:57:26 EDT
(This is in 3.1 M2.) The org.eclipse.jdt.core.dom.CompilationUnit instance 
corresponding to the class Foo below has no "public" modifier, although it 
should. Note that if the declaration is simplified to just "@Jpf.Controller 
public class Foo {...}", then the instance does have a "public" modifier.

@Jpf.Controller(
    catches={
       @Jpf.Catch(type=java.lang.Exception.class, method="handleException"),
       @Jpf.Catch(type=PageFlowException.class, 
method="handlePageFlowException")
    }
)
public class Foo {
...
}
Comment 1 Carl McConnell CLA 2004-10-28 18:01:40 EDT
Below is the code I used to determine if the class in the description is 
public. The code returns false when it should return true for that class. 
(Apologies for any errors in the code: I had to collapse together some 
scattered methods, and may have made a mistake.)

  ICompilationUnit cu = JavaCore.createCompilationUnitFrom(file);
  ASTParser parser = ASTParser.newParser(AST.JLS3);
  parser.setSource(cu);
  CompilationUnit cuNode = (CompilationUnit) parser.createAST(null);
  TypeDeclaration type = (TypeDeclaration) cuNode.types().get(0);
  return Modifier.isPublic(type.getModifiers());
Comment 2 Olivier Thomann CLA 2004-10-28 22:06:20 EDT
Fixed and released in HEAD.
Regression test added.
Comment 3 David Audel CLA 2004-11-04 04:28:05 EST
Verified for 3.1M3 with build I20041102