Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not a parameterized type! exception during indexing a class #55

Closed
tosix1988 opened this issue Apr 2, 2019 · 1 comment
Closed

Not a parameterized type! exception during indexing a class #55

tosix1988 opened this issue Apr 2, 2019 · 1 comment

Comments

@tosix1988
Copy link

I have found this error in the Wildfly server logs while deploying my application. Finally, I was able to create a simple test that reproduces this issue. Note that I use Lombok in my project, so it is likely that this is not an issue of Jandex per se, but it might be a problem of Lombok code generation, or some other problem.

To demonstrate, let's assume we have the following class:

@AllArgsConstructor(access = AccessLevel.PACKAGE)
public class SampleEntity {
	private Set<@TypeAnnotation String> userRoles;

	public Set<String> getUserRoles() {
		return userRoles;
	}
}

where the @TypeAnnotation is just an empty annotation. The test project is avaliable here: jandex-sample-project.zip. A simple test I have created just tries to index this class by Jandex.

When running mvn clean verify, the following exception occurs:

java.lang.IllegalArgumentException: Not a parameterized type!
        at org.jboss.jandex.Type.asParameterizedType(Type.java:228)
        at org.jboss.jandex.Indexer.resolveTypePath(Indexer.java:767)
        at org.jboss.jandex.Indexer.resolveTypeAnnotation(Indexer.java:727)
        at org.jboss.jandex.Indexer.resolveTypeAnnotations(Indexer.java:612)
        at org.jboss.jandex.Indexer.index(Indexer.java:1604)
        at sk.tosix.sample.IndexerTest.test(IndexerTest.java:17)

I have played a bit with this, and it seems that the following causes the error to disappear:

  • I have let Lombok to delombok the source of this Lombok-annotated class; Jandexing the generated class goes without issues.
  • Removing the @TypeAnnotation from the userRoles declaration makes the error disappear.
  • Removing the @AllArgsConstructor annotation and creating the constructor by hand (basically the same as delomboking the class) makes the error disappear.
  • opening this project in Eclipse and compiling it there (not by javac, but by ecj) makes the error disappear.

It is possible that it is Lombok to blame here, but as I am no expert in bytecode interpretation and as it is Jandex that throws the error, I am asking you guys for help :)

@chonton
Copy link

chonton commented Jul 25, 2019

I think this is a lombok issue. See projectlombok/lombok#2189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants