diff options
author | Ron Shapiro <ronshapiro@google.com> | 2016-02-06 20:44:02 -0500 |
---|---|---|
committer | Ron Shapiro <shapiro.rd@gmail.com> | 2016-02-06 20:49:50 -0500 |
commit | 2d21ad7ac0ec54afe0f0becf500a4ce7f17716dd (patch) | |
tree | 59e908d325dd38245857214408054d8f47ee7a1e /src/main/java/com/squareup/javapoet/TypeName.java | |
parent | e66ed4514245eedace3ffb90495429bde6779940 (diff) | |
download | javapoet-2d21ad7ac0ec54afe0f0becf500a4ce7f17716dd.tar.gz |
Allow TypeNames to be annotated twice
Diffstat (limited to 'src/main/java/com/squareup/javapoet/TypeName.java')
-rw-r--r-- | src/main/java/com/squareup/javapoet/TypeName.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/squareup/javapoet/TypeName.java b/src/main/java/com/squareup/javapoet/TypeName.java index 6895d85..9d5c706 100644 --- a/src/main/java/com/squareup/javapoet/TypeName.java +++ b/src/main/java/com/squareup/javapoet/TypeName.java @@ -110,7 +110,13 @@ public class TypeName { public TypeName annotated(List<AnnotationSpec> annotations) { Util.checkNotNull(annotations, "annotations == null"); - return new TypeName(keyword, annotations); + return new TypeName(keyword, prependAnnotations(annotations)); + } + + protected final List<AnnotationSpec> prependAnnotations(List<AnnotationSpec> annotations) { + List<AnnotationSpec> allAnnotations = new ArrayList<>(annotations); + allAnnotations.addAll(this.annotations); + return allAnnotations; } public boolean isAnnotated() { |