Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from typetools/jdk #97

Merged
merged 33 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
31676ce
Don't use `--filter=blob:none` with `git-clone-related`
mernst Jan 27, 2024
8993cd4
Get `git-clone-related` from git-scripts repository, not plume-scripts
mernst Jan 28, 2024
e987898
`File.pathSeparator` is a regex (at least on Unix and Windows)
mernst Feb 20, 2024
b043424
Purity for boolean methods in `Files.java`
mernst Mar 11, 2024
9d75554
Add purity annotations on `max()`
mernst Mar 13, 2024
422cb09
Add purity annotations to `Pattern.java`
mernst Mar 28, 2024
0e0489d
Apply formatting to README.md
jyoo980 Apr 26, 2024
d125cc2
Annotate lambda parameter of `Iterable.forEach` with`@NonLeaked`
jyoo980 May 11, 2024
fcaecfe
Annotate `Record.java`
mernst May 11, 2024
3afbd0f
Annotate `Map.forEach` lambda parameter with `@NonLeaked`
jyoo980 May 13, 2024
6b98ceb
Make StringJoiner constructors `@SideEffectFree`
mernst May 14, 2024
196d23c
Locking annotations on `StringJoiner`
mernst May 24, 2024
535fc22
Annotate `Enum#name()` with `@Pure`
jyoo980 Jun 6, 2024
864c229
Enable debugging
mernst Jun 7, 2024
2491638
Break up cftests job into multiple steps
mernst Jun 20, 2024
43353a2
Remove trailing blank line
mernst Jun 20, 2024
3590dfb
Improve instructions
mernst Jun 20, 2024
c5d66ef
Fix reference to README.md file
mernst Jun 21, 2024
550b857
Non-Empty Checker
jyoo980 Jun 25, 2024
300156f
Augment README
mernst Jun 26, 2024
5ceaadd
Purity annotations
mernst Jul 5, 2024
2b17b85
Don't use `--filter=blob:none`
mernst Jul 5, 2024
27ccc4f
jul.Properties get should be nullable
agentgt Jul 6, 2024
7c94506
Diagnostics about cloning and updating jdk17u
mernst Jul 7, 2024
fd7576e
StackWalker can take a nullable producing function
agentgt Jul 7, 2024
de2924d
Add JDK annotations for the Side Effects Only Checker
jyoo980 Jul 9, 2024
8102a4d
More `@SideEffectsOnly` annotations
mernst Jul 14, 2024
f4d40f2
Add `@Pure` annotation to `peek()`
mernst Aug 15, 2024
f663c7d
Merge https://github.com/typetools/jdk into typetools
wmdietl Nov 11, 2024
77fb5c6
Use jtreg from docker image
wmdietl Nov 12, 2024
6a8473e
Consistent env var
wmdietl Nov 12, 2024
a129634
Disable debuggin, remove duplication
wmdietl Nov 13, 2024
103ec21
Run all tests at once
wmdietl Nov 13, 2024
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
1 change: 0 additions & 1 deletion README-rewritten-jdk-history
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ At each URL:
* Queue the project in hopes that will start automatic building for each commit.
* If the above doesn't work, change the instructions to the below:
* Delete and re-create the pipeline, because of apparent caching problems when checking out the projects.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ Replace the existing export lines present in
exports. If no new packages were added, then there are likely going to be no
changes to the `module-info.java` file.

Commit the changes. Do not include the top-level `checker-qual-source.jar` file.
Commit the changes. Do not include the top-level `checker-qual-source.jar` file,
but include any new `.java` files in a `qual/` directory.


## The typetools/jdk17u repository
Expand Down
92 changes: 41 additions & 51 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# variables:
# system.debug: true

jobs:

- job: build_jdk
Expand All @@ -12,12 +15,7 @@ jobs:
ls -al
env | sort
displayName: show environment
- bash: |
wget https://builds.shipilev.net/jtreg/jtreg-6.2%2B1.zip -O /tmp/$USER/jtreg.zip
unzip /tmp/$USER/jtreg.zip -d /tmp/$USER/
chmod +x /tmp/$USER/jtreg/bin/jtdiff /tmp/$USER/jtreg/bin/jtreg
displayName: download jtreg
- bash: pwd && ls && bash ./configure --with-jtreg=/tmp/$USER/jtreg --disable-warnings-as-errors
- bash: pwd && ls && bash ./configure --with-jtreg=/usr/share/jtreg --disable-warnings-as-errors
displayName: configure
- bash: make jdk
timeoutInMinutes: 90
Expand All @@ -43,40 +41,51 @@ jobs:
env | sort
displayName: show environment
- bash: |
wget https://builds.shipilev.net/jtreg/jtreg-6.2%2B1.zip -O /tmp/$USER/jtreg.zip
unzip /tmp/$USER/jtreg.zip -d /tmp/$USER/
chmod +x /tmp/$USER/jtreg/bin/jtdiff /tmp/$USER/jtreg/bin/jtreg
displayName: download jtreg
set -ex
if [ -d /tmp/$USER/git-scripts ]; \
then git -C /tmp/$USER/git-scripts pull -q > /dev/null 2>&1 ; \
else mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth=1 -q https://github.com/eisop-plume-lib/git-scripts.git ; \
fi
displayName: git-scripts
- bash: |
set -ex
if [ -d /tmp/$USER/plume-scripts ]; \
then git -C /tmp/$USER/plume-scripts pull -q > /dev/null 2>&1 ; \
else mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/plume-scripts.git ; \
else mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth=1 -q https://github.com/eisop-plume-lib/plume-scripts.git ; \
fi
displayName: plume-scripts
- bash: |
set -ex
if [ -d /tmp/$USER/git-scripts ]; \
then git -C /tmp/$USER/git-scripts pull -q > /dev/null 2>&1 ; \
else mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/git-scripts.git ; \
fi
displayName: git-scripts
# This creates ../jdk17u .
# If the depth is too small, the merge will fail.
# If the depth is too small, the merge will fail. However, we cannot use "--filter=blob:none"
# because that leads to "fatal: remote error: filter 'combine' not supported".
- bash: |
set -ex
/tmp/$USER/git-scripts/git-clone-related typetools jdk17u ../jdk17u -q --depth 1
pwd
ls -al .. || true
ls -al ../jdk17u || true
df .
/tmp/$USER/git-scripts/git-clone-related typetools jdk17u ../jdk17u --depth 999
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git config --global core.longpaths true
git config --global core.protectNTFS false
cd ../jdk17u && git status
git diff --exit-code
echo $?
displayName: clone-related-jdk17u
- bash: |
set -ex
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git config --global pull.ff true
git config --global pull.rebase false
git config --global core.longpaths true
git config --global core.protectNTFS false
eval `/tmp/$USER/plume-scripts/ci-info eisop`
cd ../jdk17u && git pull --no-edit https://github.com/${CI_ORGANIZATION}/jdk ${CI_BRANCH} || (git --version && git show && echo "Merge failed; see 'Pull request merge conflicts' at https://github.com/eisop/jdk/blob/master/README" && false)
cd ../jdk17u && git status
echo "About to run: git pull --no-edit https://github.com/${CI_ORGANIZATION}/jdk ${CI_BRANCH}"
cd ../jdk17u && git pull --no-edit https://github.com/${CI_ORGANIZATION}/jdk ${CI_BRANCH} || (git --version && git show && git status && echo "Merge failed; see 'Pull request merge conflicts' at https://github.com/eisop/jdk/blob/master/README.md" && false)
displayName: git merge
- bash: cd ../jdk17u && export JT_HOME=/tmp/$USER/jtreg && bash ./configure --with-jtreg=/tmp/$USER/jtreg --disable-warnings-as-errors
- bash: cd ../jdk17u && export JT_HOME=/usr/share/jtreg && bash ./configure --with-jtreg=/usr/share/jtreg --disable-warnings-as-errors
displayName: configure
- bash: cd ../jdk17u && make jdk
displayName: make jdk
Expand Down Expand Up @@ -110,30 +119,19 @@ jobs:
displayName: test-cftests-all.sh

- job: test_cftests_all_jdk11
timeoutInMinutes: 105
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-latest'
container: wmdietl/cf-ubuntu-jdk11:latest
steps:
- checkout: self
fetchDepth: 25
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/plume-scripts.git
displayName: clone plume-scripts
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/git-scripts.git
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth=1 -q https://github.com/eisop-plume-lib/git-scripts.git
displayName: clone git-scripts
- bash: /tmp/$USER/git-scripts/git-clone-related eisop checker-framework
displayName: clone checker-framework
# test-cftests-all.sh sometimes runs out of memory, but running its component parts in sequence does not.
# - bash: (cd ../checker-framework && checker/bin-devel/test-cftests-all.sh)
# displayName: test-cftests-all.sh
- bash: (cd ../checker-framework && checker/bin-devel/test-cftests-junit.sh)
displayName: test-cftests-junit.sh
- bash: (cd ../checker-framework && checker/bin-devel/test-cftests-nonjunit.sh)
displayName: test-cftests-nonjunit.sh
- bash: (cd ../checker-framework && checker/bin-devel/test-cftests-inference.sh)
displayName: test-cftests-inference.sh
- bash: (cd ../checker-framework && checker/bin-devel/test-typecheck.sh)
displayName: test-typecheck.sh
- bash: (cd ../checker-framework && checker/bin-devel/test-cftests-all.sh)
displayName: test-cftests-all.sh
## Here is how to create artifacts that can be downloaded.
# - bash: (cd ../checker-framework/checker/build/jtregJdk11/ && tar -czvf all.tgz all)
# condition: succeededOrFailed()
Expand All @@ -144,33 +142,29 @@ jobs:
# displayName: publish all.tgz

- job: test_cftests_all_jdk17
timeoutInMinutes: 105
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-latest'
container: wmdietl/cf-ubuntu-jdk17:latest
steps:
- checkout: self
fetchDepth: 25
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/plume-scripts.git
displayName: clone plume-scripts
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/git-scripts.git
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth=1 -q https://github.com/eisop-plume-lib/git-scripts.git
displayName: clone git-scripts
- bash: /tmp/$USER/git-scripts/git-clone-related eisop checker-framework
displayName: clone checker-framework
- bash: (cd ../checker-framework && checker/bin-devel/test-cftests-all.sh)
displayName: test-cftests-all.sh

- job: test_cftests_all_jdk_latest
timeoutInMinutes: 105
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-latest'
container: wmdietl/cf-ubuntu-jdk-latest:latest
steps:
- checkout: self
fetchDepth: 25
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/plume-scripts.git
displayName: clone plume-scripts
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/git-scripts.git
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth=1 -q https://github.com/eisop-plume-lib/git-scripts.git
displayName: clone git-scripts
- bash: /tmp/$USER/git-scripts/git-clone-related eisop checker-framework
displayName: clone checker-framework
Expand All @@ -185,9 +179,7 @@ jobs:
steps:
- checkout: self
fetchDepth: 25
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/plume-scripts.git
displayName: clone plume-scripts
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/git-scripts.git
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth=1 -q https://github.com/eisop-plume-lib/git-scripts.git
displayName: clone git-scripts
- bash: /tmp/$USER/git-scripts/git-clone-related eisop checker-framework
displayName: clone checker-framework
Expand All @@ -201,9 +193,7 @@ jobs:
steps:
- checkout: self
fetchDepth: 25
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/plume-scripts.git
displayName: clone plume-scripts
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth 1 -q https://github.com/eisop-plume-lib/git-scripts.git
- bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --depth=1 -q https://github.com/eisop-plume-lib/git-scripts.git
displayName: clone git-scripts
- bash: /tmp/$USER/git-scripts/git-clone-related eisop checker-framework
displayName: clone checker-framework
Expand Down
8 changes: 7 additions & 1 deletion src/java.base/share/classes/java/io/BufferedReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@
import org.checkerframework.checker.index.qual.Positive;
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.mustcall.qual.MustCallAlias;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmptyIf;
import org.checkerframework.checker.nonempty.qual.NonEmpty;
import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.dataflow.qual.SideEffectsOnly;
import org.checkerframework.framework.qual.AnnotatedFor;

import java.util.Iterator;
Expand Down Expand Up @@ -578,6 +581,8 @@ public Stream<String> lines(@GuardSatisfied BufferedReader this) {
String nextLine = null;

@Override
@Pure
@EnsuresNonEmptyIf(result = true, expression = "this")
public boolean hasNext() {
if (nextLine != null) {
return true;
Expand All @@ -592,7 +597,8 @@ public boolean hasNext() {
}

@Override
public String next() {
@SideEffectsOnly("this")
public String next(/*@NonEmpty Iterator<String> this*/) {
if (nextLine != null || hasNext()) {
String line = nextLine;
nextLine = null;
Expand Down
3 changes: 2 additions & 1 deletion src/java.base/share/classes/java/io/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.lock.qual.ReleasesNoLocks;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.regex.qual.Regex;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.dataflow.qual.SideEffectFree;
import org.checkerframework.framework.qual.AnnotatedFor;
Expand Down Expand Up @@ -257,7 +258,7 @@ int getPrefixLength() {
* for convenience. This string contains a single character, namely
* {@link #pathSeparatorChar}.
*/
public static final @Interned String pathSeparator = "" + pathSeparatorChar;
public static final @Interned @Regex String pathSeparator = "" + pathSeparatorChar;


/* -- Constructors -- */
Expand Down
4 changes: 4 additions & 0 deletions src/java.base/share/classes/java/io/ObjectInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.checkerframework.checker.mustcall.qual.MustCallAlias;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.signedness.qual.SignedPositive;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.framework.qual.AnnotatedFor;

import java.io.ObjectInputFilter.Config;
Expand Down Expand Up @@ -2857,6 +2858,7 @@ private static class PeekInputStream extends InputStream {
* Peeks at next byte value in stream. Similar to read(), except
* that it does not consume the read value.
*/
@Pure
int peek() throws IOException {
if (peekb >= 0) {
return peekb;
Expand Down Expand Up @@ -3181,6 +3183,7 @@ int currentBlockRemaining() {
* the stream, or -1 if the end of the stream/block data (if in block
* data mode) has been reached.
*/
@Pure
int peek() throws IOException {
if (blkmode) {
if (pos == end) {
Expand All @@ -3197,6 +3200,7 @@ int peek() throws IOException {
* the stream, or throws EOFException if end of stream/block data has
* been reached.
*/
@Pure
byte peekByte() throws IOException {
int val = peek();
if (val < 0) {
Expand Down
14 changes: 12 additions & 2 deletions src/java.base/share/classes/java/lang/CharSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
import org.checkerframework.checker.index.qual.LengthOf;
import org.checkerframework.checker.index.qual.SameLen;
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmptyIf;
import org.checkerframework.checker.nonempty.qual.NonEmpty;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.dataflow.qual.SideEffectFree;
import org.checkerframework.dataflow.qual.SideEffectsOnly;
import org.checkerframework.framework.qual.AnnotatedFor;

import java.util.NoSuchElementException;
Expand Down Expand Up @@ -110,6 +113,7 @@ public interface CharSequence {
* @since 15
*/
@Pure
@EnsuresNonEmptyIf(result = false, expression = "this")
default boolean isEmpty() {
return this.length() == 0;
}
Expand Down Expand Up @@ -164,11 +168,14 @@ public default IntStream chars() {
class CharIterator implements PrimitiveIterator.OfInt {
int cur = 0;

@Pure
@EnsuresNonEmptyIf(result = true, expression = "this")
public boolean hasNext() {
return cur < length();
}

public int nextInt() {
@SideEffectsOnly("this")
public int nextInt(@NonEmpty CharIterator this) {
if (hasNext()) {
return charAt(cur++);
} else {
Expand Down Expand Up @@ -238,11 +245,14 @@ public void forEachRemaining(IntConsumer block) {
}
}

@Pure
@EnsuresNonEmptyIf(result = true, expression = "this")
public boolean hasNext() {
return cur < length();
}

public int nextInt() {
@SideEffectsOnly("this")
public int nextInt(@NonEmpty CodePointIterator this) {
final int length = length();

if (cur >= length) {
Expand Down
5 changes: 4 additions & 1 deletion src/java.base/share/classes/java/lang/ClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
package java.lang;

import org.checkerframework.checker.interning.qual.UsesObjectEquals;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmptyIf;
import org.checkerframework.checker.nonempty.qual.NonEmpty;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
Expand Down Expand Up @@ -2754,11 +2756,12 @@ private boolean next() {
return false;
}

@EnsuresNonEmptyIf(result = true, expression = "this")
public boolean hasMoreElements() {
return next();
}

public E nextElement() {
public E nextElement(@NonEmpty CompoundEnumeration<E> this) {
if (!next()) {
throw new NoSuchElementException();
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Enum.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public abstract class Enum<E extends Enum<E>>
*
* @return the name of this enum constant
*/
@Pure
public final @PolyValue String name(@GuardedByUnknown @UnknownInitialization(java.lang.Enum.class) @PolyValue Enum<E> this) {
return name;
}
Expand Down
8 changes: 5 additions & 3 deletions src/java.base/share/classes/java/lang/Iterable.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/
package java.lang;

import org.checkerframework.checker.nonempty.qual.PolyNonEmpty;
import org.checkerframework.common.aliasing.qual.NonLeaked;
import org.checkerframework.framework.qual.AnnotatedFor;

import java.util.Iterator;
Expand All @@ -41,14 +43,14 @@
* @since 1.5
* @jls 14.14.2 The enhanced {@code for} statement
*/
@AnnotatedFor({"lock", "nullness"})
@AnnotatedFor({"aliasing", "lock", "nullness"})
public interface Iterable<T> {
/**
* Returns an iterator over elements of type {@code T}.
*
* @return an Iterator.
*/
Iterator<T> iterator();
@PolyNonEmpty Iterator<T> iterator(@PolyNonEmpty Iterable<T> this);

/**
* Performs the given action for each element of the {@code Iterable}
Expand All @@ -72,7 +74,7 @@ public interface Iterable<T> {
* @throws NullPointerException if the specified action is null
* @since 1.8
*/
default void forEach(Consumer<? super T> action) {
default void forEach(@NonLeaked Consumer<? super T> action) {
Objects.requireNonNull(action);
for (T t : this) {
action.accept(t);
Expand Down
Loading
Loading