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

A primitive type as parameter for generic type and JavassistTypeSolver #1857

Closed
izebit opened this issue Sep 17, 2018 · 0 comments
Closed

A primitive type as parameter for generic type and JavassistTypeSolver #1857

izebit opened this issue Sep 17, 2018 · 0 comments

Comments

@izebit
Copy link
Contributor

izebit commented Sep 17, 2018

When we try to get fields for classes from jar archive we will have UnsolvedSymbolException. It happens if a field is parametrized and its generic type is primitive.
For example:

We have the class:

public class ClassWithFields {
    private List<byte[]> genericPrimitiveArrayField = new ArrayList<>();
   ...
}

and we want to get fields from this class:

((JavassistClassDeclaration) anotherTypeSolver.solveType("com.github.javaparser.test.ClassWithFields")).getAllFields().forEach(e->e.getType());

After execute the code, which is above, we will see the next stacktrace:

Unsolved symbol : byte[]
UnsolvedSymbolException{context='null', name='byte[]', cause='null'}
at com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver.solveType(CombinedTypeSolver.java:76)
at com.github.javaparser.symbolsolver.javassistmodel.JavassistUtils.lambda$objectTypeArgumentToType$3(JavassistUtils.java:182)

izebit added a commit to izebit/javaparser that referenced this issue Sep 17, 2018
@izebit izebit mentioned this issue Sep 17, 2018
@izebit izebit changed the title A primitive type as parameter for generic type and JavassisTypeSolver A primitive type as parameter for generic type and JavassistTypeSolver Sep 17, 2018
izebit added a commit to izebit/javaparser that referenced this issue Sep 18, 2018
ftomassetti added a commit that referenced this issue Sep 19, 2018
@matozoid matozoid modified the milestones: major release, next release Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants