src/jdk.internal.vm.compiler/share/classes/org.graalvm.options/src/org/graalvm/options/OptionDescriptor.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.options/src/org/graalvm/options/OptionDescriptor.java	Fri Jul  7 09:31:58 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.options/src/org/graalvm/options/OptionDescriptor.java	Fri Jul  7 09:31:58 2017

*** 22,31 **** --- 22,33 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package org.graalvm.options; + import java.util.Objects; + /** * Represents meta-data for a single option. * * @since 1.0 */
*** 90,113 **** --- 92,158 ---- public String getHelp() { return help; } /** + * {@inheritDoc} + * * @since 1.0 */ @Override public String toString() { return "OptionDescriptor [key=" + key + ", help=" + help + ", kind=" + kind + ", deprecated=" + deprecated + "]"; } /** + * {@inheritDoc} + * + * @since 1.0 + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (deprecated ? 1231 : 1237); + result = prime * result + ((help == null) ? 0 : help.hashCode()); + result = prime * result + ((key == null) ? 0 : key.hashCode()); + result = prime * result + ((kind == null) ? 0 : kind.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + /** + * {@inheritDoc} + * + * @since 1.0 + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (getClass() != obj.getClass()) { + return false; + } + OptionDescriptor other = (OptionDescriptor) obj; + return Objects.equals(name, other.name) && + Objects.equals(deprecated, other.deprecated) && + Objects.equals(help, other.help) && + Objects.equals(key, other.key) && + Objects.equals(kind, other.kind); + } + + /** * Creates a new option descriptor builder by key. The option group and name is inferred by the * key. * * @since 1.0 */ public static <T> Builder newBuilder(OptionKey<T> key, String name) { + Objects.requireNonNull(key); + Objects.requireNonNull(name); return new Builder(key, name); } /** * Represents an option descriptor builder.
*** 132,141 **** --- 177,187 ---- * {@link OptionCategory#DEBUG}. * * @since 1.0 */ public Builder category(@SuppressWarnings("hiding") OptionCategory category) { + Objects.requireNonNull(category); this.category = category; return this; } /**
*** 153,173 **** --- 199,220 ---- * Specifies a human-readable description on how to use the option. * * @since 1.0 */ public Builder help(@SuppressWarnings("hiding") String help) { + Objects.requireNonNull(help); this.help = help; return this; } /** * Builds and returns a new option descriptor. * * @since 1.0 */ public OptionDescriptor build() { ! return new OptionDescriptor(key, name, help == null ? "" : help, category == null ? OptionCategory.DEBUG : category, deprecated); } } }

src/jdk.internal.vm.compiler/share/classes/org.graalvm.options/src/org/graalvm/options/OptionDescriptor.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File