Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public int hashCode() {
prf.getAlgorithm().toLowerCase(Locale.ENGLISH).hashCode();
}
@Override
@Pure
public boolean equals(Object obj) {
if (this == obj) return true;
if (this.getClass() != obj.getClass()) return false;
Expand Down
2 changes: 2 additions & 0 deletions src/java.base/share/classes/java/io/FileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.checkerframework.checker.index.qual.IndexOrHigh;
import org.checkerframework.checker.interning.qual.UsesObjectEquals;
import org.checkerframework.checker.signedness.qual.SignedPositive;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.framework.qual.AnnotatedFor;

import java.lang.annotation.Native;
Expand Down Expand Up @@ -242,6 +243,7 @@ public abstract boolean createFileExclusively(String pathname)
/**
* Compare two abstract pathnames lexicographically.
*/
@Pure
public abstract int compare(File f1, File f2);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public InvalidClassException(String cname, @Nullable String reason, @Nullable Th
/**
* Produce the message and include the classname, if present.
*/
@SideEffectFree
@Override
public String getMessage() {
if (classname == null)
Expand Down
6 changes: 6 additions & 0 deletions src/java.base/share/classes/java/io/ObjectStreamClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.signature.qual.BinaryName;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.dataflow.qual.SideEffectFree;
import org.checkerframework.framework.qual.AnnotatedFor;

Expand Down Expand Up @@ -1779,6 +1780,7 @@ private static long computeDefaultSUID(Class<?> cl) {
fieldSigs[i] = new MemberSignature(fields[i]);
}
Arrays.sort(fieldSigs, new Comparator<>() {
@Pure
public int compare(MemberSignature ms1, MemberSignature ms2) {
return ms1.name.compareTo(ms2.name);
}
Expand Down Expand Up @@ -1810,6 +1812,7 @@ public int compare(MemberSignature ms1, MemberSignature ms2) {
consSigs[i] = new MemberSignature(cons[i]);
}
Arrays.sort(consSigs, new Comparator<>() {
@Pure
public int compare(MemberSignature ms1, MemberSignature ms2) {
return ms1.signature.compareTo(ms2.signature);
}
Expand All @@ -1833,6 +1836,7 @@ public int compare(MemberSignature ms1, MemberSignature ms2) {
methSigs[i] = new MemberSignature(methods[i]);
}
Arrays.sort(methSigs, new Comparator<>() {
@Pure
public int compare(MemberSignature ms1, MemberSignature ms2) {
int comp = ms1.name.compareTo(ms2.name);
if (comp == 0) {
Expand Down Expand Up @@ -2166,6 +2170,7 @@ public int hashCode() {
return hash;
}

@Pure
public boolean equals(@Nullable Object obj) {
return obj == this ||
obj instanceof FieldReflectorKey other &&
Expand Down Expand Up @@ -2294,6 +2299,7 @@ public final int hashCode() {
}

@Override
@Pure
public final boolean equals(@Nullable Object obj) {
if (!(obj instanceof Key other)) return false;
int n = length();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package java.io;

import org.checkerframework.dataflow.qual.SideEffectFree;
import org.checkerframework.framework.qual.AnnotatedFor;

/**
Expand Down Expand Up @@ -55,6 +56,7 @@ public class OptionalDataException extends ObjectStreamException {
/*
* Create an {@code OptionalDataException} with a length.
*/
@SideEffectFree
OptionalDataException(int len) {
eof = false;
length = len;
Expand All @@ -64,6 +66,7 @@ public class OptionalDataException extends ObjectStreamException {
* Create an {@code OptionalDataException} signifying no
* more primitive data is available.
*/
@SideEffectFree
OptionalDataException(boolean end) {
length = 0;
eof = end;
Expand Down
2 changes: 2 additions & 0 deletions src/java.base/share/classes/java/io/UncheckedIOException.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package java.io;

import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.dataflow.qual.SideEffectFree;
import org.checkerframework.framework.qual.AnnotatedFor;

Expand Down Expand Up @@ -75,6 +76,7 @@ public UncheckedIOException(IOException cause) {
*
* @return the {@code IOException} which is the cause of this exception.
*/
@Pure
@Override
public IOException getCause() {
return (IOException) super.getCause();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
package java.io;

import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.dataflow.qual.SideEffectFree;
import org.checkerframework.framework.qual.AnnotatedFor;

Expand Down Expand Up @@ -74,6 +75,7 @@ public WriteAbortedException(@Nullable String s, @Nullable Exception ex) {
* Produce the message and include the message from the nested
* exception, if there is one.
*/
@SideEffectFree
public String getMessage() {
if (detail == null)
return super.getMessage();
Expand All @@ -88,6 +90,7 @@ public String getMessage() {
* which may be null.
* @since 1.4
*/
@Pure
@Override
public @Nullable Throwable getCause() {
return detail;
Expand Down
Loading
Loading