diff options
author | Sam Berlin <sameb@google.com> | 2013-12-11 18:40:58 -0500 |
---|---|---|
committer | Sam Berlin <sameb@google.com> | 2013-12-11 18:45:14 -0500 |
commit | 0e896db46024dc7596302f8622276d1c7df02c6b (patch) | |
tree | ec8b8c7b74a64f507fb90320b2b95bcee2c87913 /core/src/com/google/inject | |
parent | 31d8fbf9934778160de52837ef311f0d26efbbf8 (diff) | |
download | guice-0e896db46024dc7596302f8622276d1c7df02c6b.tar.gz |
A Message should have only one source but as it is used in Errors, currently it can have multiple sources. The Message objects is returned from two public methods(Elements#getElements() and Errors#getMessages()) that make any changes in its method declarations difficult. As the first step, I am going to remove all calls to the Message constructor that receives multiple sources from []. So, the only calls will be from Errors that I will deal with separately.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=57979416
Diffstat (limited to 'core/src/com/google/inject')
-rw-r--r-- | core/src/com/google/inject/ProvisionException.java | 3 | ||||
-rw-r--r-- | core/src/com/google/inject/spi/Message.java | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/core/src/com/google/inject/ProvisionException.java b/core/src/com/google/inject/ProvisionException.java index 4d6afcdb..e2394461 100644 --- a/core/src/com/google/inject/ProvisionException.java +++ b/core/src/com/google/inject/ProvisionException.java @@ -18,7 +18,6 @@ package com.google.inject; import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.inject.internal.Errors; import com.google.inject.spi.Message; @@ -45,7 +44,7 @@ public final class ProvisionException extends RuntimeException { public ProvisionException(String message, Throwable cause) { super(cause); - this.messages = ImmutableSet.of(new Message(ImmutableList.of(), message, cause)); + this.messages = ImmutableSet.of(new Message(message, cause)); } public ProvisionException(String message) { diff --git a/core/src/com/google/inject/spi/Message.java b/core/src/com/google/inject/spi/Message.java index 14d3bcc8..59c40728 100644 --- a/core/src/com/google/inject/spi/Message.java +++ b/core/src/com/google/inject/spi/Message.java @@ -55,6 +55,13 @@ public final class Message implements Serializable, Element { this.cause = cause; } + /** + * @since 4.0 + */ + public Message(String message, Throwable cause) { + this(ImmutableList.of(), message, cause); + } + public Message(Object source, String message) { this(ImmutableList.of(source), message, null); } |