예제 #1
0
 @Override
 public void visit(Tree.MethodDeclaration that) {
   if (that.getDeclarationModel() == declaration) {
     if (that.getSpecifierExpression() != null) {
       specify();
       super.visit(that);
     } else {
       super.visit(that);
       if (declaration.isToplevel() && !isNativeHeader(declaration)) {
         that.addError(
             "toplevel function must be specified: '"
                 + declaration.getName()
                 + "' may not be forward declared");
       } else if (declaration.isClassMember()
           && !isNativeHeader(declaration)
           && isInNativeContainer(declaration)) {
         that.addError(
             "member in native container must be native: '" + declaration.getName() + "'", 1450);
       } else if (declaration.isClassMember()
           && !isNativeHeader(declaration)
           && !declaration.isFormal()
           && that.getDeclarationModel().getInitializerParameter() == null
           && declarationSection) {
         that.addError(
             "forward declaration may not occur in declaration section: '"
                 + declaration.getName()
                 + "'",
             1450);
       } else if (declaration.isInterfaceMember()
           && !isNativeHeader(declaration)
           && !declaration.isFormal()) {
         that.addError(
             "interface method must be formal or specified: '" + declaration.getName() + "'",
             1400);
       }
     }
   } else {
     super.visit(that);
   }
 }
예제 #2
0
 private boolean isForwardReferenceable() {
   return declarationSection || declaration.isToplevel() || declaration.isInterfaceMember();
 }