You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Stollhans (Jira)" <ji...@apache.org> on 2023/09/14 16:51:00 UTC

[jira] [Created] (JXR-179) Classes with curly braces in class-level annotations are misssing in all-classes and package html

Michael Stollhans created JXR-179:
-------------------------------------

             Summary: Classes with curly braces in class-level annotations are misssing in all-classes and package html
                 Key: JXR-179
                 URL: https://issues.apache.org/jira/browse/JXR-179
             Project: Maven JXR
          Issue Type: Bug
          Components: jxr, maven2 jxr plugin
    Affects Versions: 3.3.0
            Reporter: Michael Stollhans


Classes with curly braces in class-level annotations are misssing in allclasses-frame.html and package-frame.html. However, the html class for those classes are created.
h3. Steps to reproduce:

Create a maven project with to dependencies:
{code:java}
<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> {code}
Configure reporting with maven-jxr-plugin.

Create two java files:

 
{code:java}
import javax.persistence.Entity;
import lombok.Data;
@Entity
@Data
public class A {
   private String name;	
   private B b;	
}{code}
 
{code:java}
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;
} {code}
Run "mvn jxr:jxr".

 

Result:
 * All html files are created as expected
 * Only class A is listed in allclasses-frame.html and package-frame.html

h3. 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.

 
{code:java}
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 {
...
        }
    }
...
} {code}
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.

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)