anchor.diff:              ImportList importList = new ImportList(null); 
               $compilationUnit.setImportList(importList); }
       : ( 
  -        ca1=compilerAnnotations
  +        ca=compilerAnnotations
           SEMICOLON
  -        { $compilationUnit.getCompilerAnnotations().addAll($ca1.annotations); }
  +        { $compilationUnit.getCompilerAnnotations().addAll($ca.annotations); }
         )?
         ( 
           importDeclaration 
           { importList.addImport($importDeclaration.importDeclaration); 
             $compilationUnit.connect(importList); }
         |
  -        (compilerAnnotations annotations MODULE)=>
  +        (annotatedModuleDescriptorStart) =>
           moduleDescriptor 
           { $compilationUnit.addModuleDescriptor($moduleDescriptor.moduleDescriptor); }
         |
  -        (compilerAnnotations annotations PACKAGE)=>
  +        (annotatedPackageDescriptorStart) =>
           packageDescriptor
           { $compilationUnit.addPackageDescriptor($packageDescriptor.packageDescriptor); }
         |
  -        ca2=compilerAnnotations declaration
  -        { if ($declaration.declaration instanceof 
  -                  com.redhat.ceylon.compiler.typechecker.tree.Tree.Declaration) {
  -              com.redhat.ceylon.compiler.typechecker.tree.Tree.Declaration dec = 
  -                  (com.redhat.ceylon.compiler.typechecker.tree.Tree.Declaration) 
  -                      $declaration.declaration;
  -              $compilationUnit.addDeclaration(dec); 
  -              $declaration.declaration.getCompilerAnnotations().addAll($ca2.annotations); } }
  +        toplevelDeclaration
  +        { if ($toplevelDeclaration.declaration!=null)
  +              $compilationUnit.addDeclaration($toplevelDeclaration.declaration); }
         | RBRACE
           { displayRecognitionError(getTokenNames(),
                 new MismatchedTokenException(EOF, input)); }
         )*
         EOF
  +    ;
  +
  +toplevelDeclaration returns [Declaration declaration]
  +    : ca=compilerAnnotations 
  +      d=declaration
  +      { $declaration = $d.declaration;
  +        if ($declaration!=null)
  +            $declaration.getCompilerAnnotations().addAll($ca.annotations); }
  +    ;
  +
  +annotatedModuleDescriptorStart
  +    : compilerAnnotations annotations MODULE
  +    ;
  +
  +annotatedPackageDescriptorStart
  +    : compilerAnnotations annotations PACKAGE
       ;
   
   moduleDescriptor returns [ModuleDescriptor moduleDescriptor]
  
positive.code:             $statement.getCompilerAnnotations().addAll($compilerAnnotations.annotations); }
      ;
  
  declaration returns [Statement declaration]
      @init { MissingDeclaration md = new MissingDeclaration(null); 
              $declaration = md; }
      : annotations
  
negative.code:       { $declaration=$aliasDeclaration.declaration; }
      | objectDeclaration
        { $declaration=$objectDeclaration.declaration; }
      | setterDeclaration
        { $declaration=$setterDeclaration.declaration; }
      | voidOrInferredMethodDeclaration
  