From d1b063fab9b8d5141bc240ec10f6b9ebcafb9d6b Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Fri, 15 Mar 2024 12:14:33 -0400 Subject: [PATCH 1/4] Annotate `Thread.enumerate` to accept arrays of nullable elements. (#86) --- src/java.base/share/classes/java/lang/Thread.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index e2ae3e83b72b2..75aede10f828b 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -31,6 +31,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.nullness.qual.PolyNull; import org.checkerframework.dataflow.qual.Pure; import org.checkerframework.dataflow.qual.SideEffectFree; import org.checkerframework.framework.qual.AnnotatedFor; @@ -1261,7 +1262,7 @@ public static int activeCount() { * if {@link java.lang.ThreadGroup#checkAccess} determines that * the current thread cannot access its thread group */ - public static int enumerate(Thread tarray[]) { + public static int enumerate(@PolyNull Thread[] tarray) { return currentThread().getThreadGroup().enumerate(tarray); } From 96290b88982d3c06f43658e5346dc7351703e740 Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Tue, 14 May 2024 16:41:04 -0400 Subject: [PATCH 2/4] Annotate `NetworkInterface` for nullness. (#87) --- .../share/classes/java/net/NetworkInterface.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/java.base/share/classes/java/net/NetworkInterface.java b/src/java.base/share/classes/java/net/NetworkInterface.java index be1b2a63f2eab..d1cb1e746d642 100644 --- a/src/java.base/share/classes/java/net/NetworkInterface.java +++ b/src/java.base/share/classes/java/net/NetworkInterface.java @@ -30,6 +30,7 @@ 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; import java.util.Arrays; import java.util.Enumeration; @@ -49,6 +50,7 @@ * * @since 1.4 */ +@AnnotatedFor("nullness") public final class NetworkInterface { private String name; private String displayName; @@ -225,7 +227,7 @@ public Stream subInterfaces() { * @return The {@code NetworkInterface} this interface is attached to. * @since 1.6 */ - public NetworkInterface getParent() { + public @Nullable NetworkInterface getParent() { return parent; } @@ -252,7 +254,7 @@ public int getIndex() { * @return a non-empty string representing the display name of this network * interface, or null if no display name is available. */ - public String getDisplayName() { + public @Nullable String getDisplayName() { /* strict TCK conformance */ return "".equals(displayName) ? null : displayName; } @@ -273,7 +275,7 @@ public String getDisplayName() { * @throws NullPointerException * If the specified name is {@code null}. */ - public static NetworkInterface getByName(String name) throws SocketException { + public static @Nullable NetworkInterface getByName(String name) throws SocketException { if (name == null) throw new NullPointerException(); return getByName0(name); @@ -290,7 +292,7 @@ public static NetworkInterface getByName(String name) throws SocketException { * @see #getIndex() * @since 1.7 */ - public static NetworkInterface getByIndex(int index) throws SocketException { + public static @Nullable NetworkInterface getByIndex(int index) throws SocketException { if (index < 0) throw new IllegalArgumentException("Interface index can't be negative"); return getByIndex0(index); @@ -318,7 +320,7 @@ public static NetworkInterface getByIndex(int index) throws SocketException { * @throws NullPointerException * If the specified address is {@code null}. */ - public static NetworkInterface getByInetAddress(InetAddress addr) throws SocketException { + public static @Nullable NetworkInterface getByInetAddress(InetAddress addr) throws SocketException { if (addr == null) { throw new NullPointerException(); } @@ -519,7 +521,7 @@ public boolean supportsMulticast() throws SocketException { * @throws SocketException if an I/O error occurs. * @since 1.6 */ - public byte[] getHardwareAddress() throws SocketException { + public byte @Nullable [] getHardwareAddress() throws SocketException { @SuppressWarnings("removal") SecurityManager sec = System.getSecurityManager(); if (sec != null) { From 6bdbb4f7b800c9a88381755da9d4d4992a6c9eb2 Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Fri, 12 Jul 2024 21:41:23 -0400 Subject: [PATCH 3/4] Annotate `TrustAnchor` for nullness. (#88) --- .../java/security/cert/TrustAnchor.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/java.base/share/classes/java/security/cert/TrustAnchor.java b/src/java.base/share/classes/java/security/cert/TrustAnchor.java index fd5bf6a2da10a..0dc7b7014de20 100644 --- a/src/java.base/share/classes/java/security/cert/TrustAnchor.java +++ b/src/java.base/share/classes/java/security/cert/TrustAnchor.java @@ -26,6 +26,7 @@ package java.security.cert; import org.checkerframework.checker.interning.qual.UsesObjectEquals; +import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.framework.qual.AnnotatedFor; import java.io.IOException; @@ -64,7 +65,7 @@ * @since 1.4 * @author Sean Mullan */ -@AnnotatedFor({"interning"}) +@AnnotatedFor({"interning", "nullness"}) public @UsesObjectEquals class TrustAnchor { private final PublicKey pubKey; @@ -131,7 +132,7 @@ * @throws NullPointerException if the specified * {@code X509Certificate} is {@code null} */ - public TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints) + public TrustAnchor(X509Certificate trustedCert, byte @Nullable [] nameConstraints) { if (trustedCert == null) throw new NullPointerException("the trustedCert parameter must " + @@ -171,7 +172,7 @@ public TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints) * @since 1.5 */ public TrustAnchor(X500Principal caPrincipal, PublicKey pubKey, - byte[] nameConstraints) { + byte @Nullable [] nameConstraints) { if ((caPrincipal == null) || (pubKey == null)) { throw new NullPointerException(); } @@ -213,7 +214,7 @@ public TrustAnchor(X500Principal caPrincipal, PublicKey pubKey, * @throws NullPointerException if the specified {@code caName} or * {@code pubKey} parameter is {@code null} */ - public TrustAnchor(String caName, PublicKey pubKey, byte[] nameConstraints) + public TrustAnchor(String caName, PublicKey pubKey, byte @Nullable [] nameConstraints) { if (pubKey == null) throw new NullPointerException("the pubKey parameter must be " + @@ -238,7 +239,7 @@ public TrustAnchor(String caName, PublicKey pubKey, byte[] nameConstraints) * @return a trusted {@code X509Certificate} or {@code null} * if the trust anchor was not specified as a trusted certificate */ - public final X509Certificate getTrustedCert() { + public final @Nullable X509Certificate getTrustedCert() { return this.trustedCert; } @@ -250,7 +251,7 @@ public final X509Certificate getTrustedCert() { * public key and name or X500Principal pair * @since 1.5 */ - public final X500Principal getCA() { + public final @Nullable X500Principal getCA() { return this.caPrincipal; } @@ -262,7 +263,7 @@ public final X500Principal getCA() { * {@code null} if the trust anchor was not specified as a trusted * public key and name or X500Principal pair */ - public final String getCAName() { + public final @Nullable String getCAName() { return this.caName; } @@ -273,7 +274,7 @@ public final String getCAName() { * if the trust anchor was not specified as a trusted public key and name * or X500Principal pair */ - public final PublicKey getCAPublicKey() { + public final @Nullable PublicKey getCAPublicKey() { return this.pubKey; } @@ -318,7 +319,7 @@ private void setNameConstraints(byte[] bytes) { * a NameConstraints extension used for checking name constraints, * or {@code null} if not set. */ - public final byte [] getNameConstraints() { + public final byte @Nullable [] getNameConstraints() { return ncBytes == null ? null : ncBytes.clone(); } From 6fe3e7815516f0e935b03f45af60f3f74ec50175 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Sat, 13 Jul 2024 09:49:07 -0400 Subject: [PATCH 4/4] Use git-scripts (#89) --- azure-pipelines.yml | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6dc2d60ebb107..2fc9b8bd4b6d0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -51,14 +51,21 @@ jobs: 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 --filter=blob:none -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. - bash: | set -ex - /tmp/$USER/plume-scripts/git-clone-related typetools jdk17u ../jdk17u -q --filter=blob:none + /tmp/$USER/git-scripts/git-clone-related typetools jdk17u ../jdk17u -q --depth 1 displayName: clone-related-jdk17u - bash: | set -ex @@ -95,7 +102,9 @@ jobs: 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: /tmp/$USER/plume-scripts/git-clone-related eisop checker-framework + - 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 @@ -108,9 +117,11 @@ jobs: steps: - checkout: self fetchDepth: 25 - - bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --filter=blob:none -q https://github.com/eisop-plume-lib/plume-scripts.git + - 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: /tmp/$USER/plume-scripts/git-clone-related eisop checker-framework + - 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) @@ -140,9 +151,11 @@ jobs: steps: - checkout: self fetchDepth: 25 - - bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --filter=blob:none -q https://github.com/eisop-plume-lib/plume-scripts.git + - 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: /tmp/$USER/plume-scripts/git-clone-related eisop checker-framework + - 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 @@ -155,9 +168,11 @@ jobs: steps: - checkout: self fetchDepth: 25 - - bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --filter=blob:none -q https://github.com/eisop-plume-lib/plume-scripts.git + - 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: /tmp/$USER/plume-scripts/git-clone-related eisop checker-framework + - 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 @@ -170,9 +185,11 @@ jobs: steps: - checkout: self fetchDepth: 25 - - bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --filter=blob:none -q https://github.com/eisop-plume-lib/plume-scripts.git + - 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: /tmp/$USER/plume-scripts/git-clone-related eisop checker-framework + - 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-daikon.sh) displayName: test-daikon.sh @@ -184,9 +201,11 @@ jobs: steps: - checkout: self fetchDepth: 25 - - bash: mkdir -p /tmp/$USER && git -C /tmp/$USER clone --filter=blob:none -q https://github.com/eisop-plume-lib/plume-scripts.git + - 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: /tmp/$USER/plume-scripts/git-clone-related eisop checker-framework + - 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-plume-lib.sh) displayName: test-plume-lib.sh