Skip to content

Commit

Permalink
Fix annotations of Attributes. (eisop#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpovirk authored Sep 6, 2023
1 parent 24179f8 commit cdf3431
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/java.base/share/classes/java/util/jar/Attributes.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public Attributes(Attributes attr) {
* @return the value of the specified attribute name, or null if
* not found.
*/
public Object get(@Nullable Object name) {
public @Nullable Object get(@Nullable Object name) {
return map.get(name);
}

Expand All @@ -121,7 +121,7 @@ public Object get(@Nullable Object name) {
* not found.
* @throws IllegalArgumentException if the attribute name is invalid
*/
public String getValue(String name) {
public @Nullable String getValue(String name) {
return (String)get(Name.of(name));
}

Expand All @@ -138,7 +138,7 @@ public String getValue(String name) {
* @return the String value of the specified Attribute.Name, or null if
* not found.
*/
public String getValue(Name name) {
public @Nullable String getValue(@Nullable Name name) {
return (String)get(name);
}

Expand All @@ -153,7 +153,7 @@ public String getValue(Name name) {
* @exception ClassCastException if the name is not a Attributes.Name
* or the value is not a String
*/
public Object put(Object name, Object value) {
public @Nullable Object put(Object name, Object value) {
return map.put((Attributes.Name)name, (String)value);
}

Expand All @@ -173,7 +173,7 @@ public Object put(Object name, Object value) {
* @return the previous value of the attribute, or null if none
* @exception IllegalArgumentException if the attribute name is invalid
*/
public String putValue(String name, String value) {
public @Nullable String putValue(String name, String value) {
return (String)put(Name.of(name), value);
}

Expand All @@ -184,7 +184,7 @@ public String putValue(String name, String value) {
* @param name attribute name
* @return the previous value of the attribute, or null if none
*/
public Object remove(@Nullable Object name) {
public @Nullable Object remove(@Nullable Object name) {
return map.remove(name);
}

Expand Down Expand Up @@ -219,7 +219,7 @@ public boolean containsKey(@Nullable Object name) {
* @param attr the Attributes to be stored in this map
* @exception ClassCastException if attr is not an Attributes
*/
public void putAll(Map<?,?> attr) {
public void putAll(Map<? extends Object,? extends Object> attr) {
// ## javac bug?
if (!Attributes.class.isInstance(attr))
throw new ClassCastException();
Expand Down Expand Up @@ -521,7 +521,7 @@ private final int hash(String name) {
* @return true if this attribute name is equal to the
* specified attribute object
*/
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
Expand Down

0 comments on commit cdf3431

Please sign in to comment.