Bug 77249

Summary: Annotation on class cancels "public" modifier
Product: [Eclipse Project] JDT Reporter: Carl McConnell <carl_mcconnell>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

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