Skip to content

Commit

Permalink
Fix a bug in TypeFactory.createReference(): declaring type OR package…
Browse files Browse the repository at this point in the history
… should be set for a reference, not both
  • Loading branch information
leventov committed Apr 22, 2016
1 parent 19fad0a commit c97a19a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/java/spoon/reflect/factory/TypeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,10 @@ public <T> CtTypeReference<T> createReference(Class<T> type) {
public <T> CtTypeReference<T> createReference(CtType<T> type) {
CtTypeReference<T> ref = factory.Core().createTypeReference();

if (type.getPackage() != null) {
ref.setPackage(factory.Package().createReference(type.getPackage()));
}

if (type.getDeclaringType() != null) {
ref.setDeclaringType(createReference(type.getDeclaringType()));
} else if (type.getPackage() != null) {
ref.setPackage(factory.Package().createReference(type.getPackage()));
}

ref.setSimpleName(type.getSimpleName());
Expand Down

0 comments on commit c97a19a

Please sign in to comment.