Uploaded image for project: 'Maven JXR'
  1. Maven JXR
  2. JXR-179

Classes with curly braces in class-level annotations are missing in allclasses and package html

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.3.0
    • None
    • jxr, maven-jxr-plugin
    • None

    Description

      Classes with curly braces in class-level annotations are misssing in allclasses-frame.html and package-frame.html of the xref report. However, the html files for those classes are created.

      Steps to reproduce:

      Create a maven project with to dependencies:

      <dependency>
          <groupId>org.projectlombok</groupId>
          <artifactId>lombok</artifactId>
          <version>1.18.28</version>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>javax.persistence</groupId>
          <artifactId>javax.persistence-api</artifactId>
          <version>2.2</version>
      </dependency> 

      Configure reporting with maven-jxr-plugin.

      Create two java files:

      import javax.persistence.Entity;
      import lombok.Data;
      @Entity
      @Data
      public class A {
         private String name;	
         private B b;	
      }
      import javax.persistence.Entity;
      import javax.persistence.Index;
      import javax.persistence.Table;
      import lombok.Data;
      @Entity
      @Table(name = "C_TABLE", indexes = { @Index(name = "NameIndex", columnList = "firstname,lastname") })
      @Data
      public class B {
      	private String firstname;
      	private String lastname;
      } 

      Run "mvn jxr:jxr".

      Result:

      • All html files of the xref report are created as expected
      • Only class A is listed in allclasses-frame.html and package-frame.html. Class B is missing.

      Assumed cause:

      I did some debugging with the maven-jxr library. Eventually I think the cause is the attribute indexes of the @Table annotation. The attribute has an array type.

      I suspect the error to happen in the class JavaFileImpl of the maven-jxr project.

      public class JavaFileImpl extends JavaFile {
      ...
          private void parseRecursive(String nestedPrefix, StreamTokenizer stok) throws IOException {
      
      ...
              while (stok.nextToken() != StreamTokenizer.TT_EOF) {
                  if (stok.sval == null) {
                      if (stok.ttype == '{') {
                          openBracesCount++;
                      } else if (stok.ttype == '}') {
                          if (--openBracesCount == 0) {
                              // break out of recursive
                              return;
                          }
                      }
                      continue;
                  } else {
      ...
              }
          }
      ...
      } 

      I think the cause is the return statement with the comment "break out of recursive". After parsing the annotation with the curly braces the tokenizer stops and the parser does not find the class declaration in the file. 

      Later in the method a ClassType object should be created but that never happens in this case.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mstollhans Michael Stollhans
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: