aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/squareup/javapoet/WildcardTypeName.java
diff options
context:
space:
mode:
authorChristian Stein <sormuras@gmail.com>2016-01-09 01:27:38 +0100
committerChristian Stein <sormuras@gmail.com>2016-01-09 23:20:38 +0100
commitcaabf2c227a7e8a6a2496c2de9baf1528d21065b (patch)
treeea91c1eb073ee9c1d8eab19942fc3d0d6f0a2e02 /src/main/java/com/squareup/javapoet/WildcardTypeName.java
parent512e2169209eecea05862c9bbe5e2dc51474ddd4 (diff)
downloadjavapoet-caabf2c227a7e8a6a2496c2de9baf1528d21065b.tar.gz
Static import support added.
Diffstat (limited to 'src/main/java/com/squareup/javapoet/WildcardTypeName.java')
-rw-r--r--src/main/java/com/squareup/javapoet/WildcardTypeName.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/squareup/javapoet/WildcardTypeName.java b/src/main/java/com/squareup/javapoet/WildcardTypeName.java
index 7d1fe25..3994fbe 100644
--- a/src/main/java/com/squareup/javapoet/WildcardTypeName.java
+++ b/src/main/java/com/squareup/javapoet/WildcardTypeName.java
@@ -32,6 +32,7 @@ import static com.squareup.javapoet.Util.checkArgument;
public final class WildcardTypeName extends TypeName {
public final List<TypeName> upperBounds;
public final List<TypeName> lowerBounds;
+ private final int hashCode;
private WildcardTypeName(List<TypeName> upperBounds, List<TypeName> lowerBounds) {
this(upperBounds, lowerBounds, new ArrayList<AnnotationSpec>());
@@ -42,6 +43,7 @@ public final class WildcardTypeName extends TypeName {
super(annotations);
this.upperBounds = Util.immutableList(upperBounds);
this.lowerBounds = Util.immutableList(lowerBounds);
+ this.hashCode = upperBounds.hashCode() ^ lowerBounds.hashCode();
checkArgument(this.upperBounds.size() == 1, "unexpected extends bounds: %s", upperBounds);
for (TypeName upperBound : this.upperBounds) {
@@ -65,7 +67,7 @@ public final class WildcardTypeName extends TypeName {
}
@Override public int hashCode() {
- return upperBounds.hashCode() ^ lowerBounds.hashCode();
+ return hashCode;
}
@Override CodeWriter emit(CodeWriter out) throws IOException {