Token annotations are generated when annotation generation is turned off

Create issue
Issue #312 resolved
Jesper Öqvist created an issue

The option generateAnnotations=false does not turn off all annotations generation. Tokens still are annotated leading to compile errors because the ASTNodeAnnotation type is missing.

Comments (2)

  1. Jesper Öqvist reporter

    Test case:

    // Test that annotations are not generated for tokens when annotation generation is turned off.
    // See https://bitbucket.org/jastadd/jastadd2/issues/312/token-annotations-are-generated-when
    // .grammar: { A ::= <ID> <I:int> <A:A>; }
    // .options: generateAnnotations=false
    import static runtime.Test.*;
    import java.lang.reflect.Method;
    import java.lang.annotation.Annotation;
    
    public class Test {
      public static void main(String[] args) throws Throwable {
        for (Method m: A.class.getDeclaredMethods()) {
          if (m.getName().equals("getID")) {
            for (Annotation annot : m.getAnnotations()) {
              testThat(annot.annotationType().getName()).notEqual("ASTNodeAnnotation$Token");
            }
          }
        }
      }
    }
    
  2. Jesper Öqvist reporter

    Fix error in generateAnnotations option

    Disable token annotations from being generated when the generateAnnotations option is set to false.

    fixes #312

    → <<cset 3d900dde5fad>>

  3. Log in to comment