Skip to content

Commit

Permalink
Merge branch 'master' into add-not-check-dead-code-option
Browse files Browse the repository at this point in the history
  • Loading branch information
Ao-senXiong authored Jan 5, 2025
2 parents aff7485 + 6717656 commit 1508ca6
Show file tree
Hide file tree
Showing 12 changed files with 138 additions and 129 deletions.
117 changes: 97 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.10.0
if: matrix.script == 'cftests-nonjunit'
if: ${{ matrix.script == 'cftests-nonjunit' }}
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
Expand All @@ -64,12 +64,24 @@ jobs:
fail-fast: true
matrix:
# No need to run 'cftests-junit-jdk21' on JDK 21.
script: ['typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib', 'daikon-part1', 'daikon-part2', 'jspecify-conformance', 'jspecify-reference-checker']
script: ['typecheck-part1', 'typecheck-part2',
'guava', 'plume-lib',
'daikon-part1', 'daikon-part2',
'jspecify-conformance', 'jspecify-reference-checker',
'misc']
java_version: [21]
env:
JAVA_VERSION: ${{ matrix.java_version }}
steps:
- uses: actions/checkout@v4
if: ${{ matrix.script != 'misc' }}
with:
fetch-depth: 1
- uses: actions/checkout@v4
if: ${{ matrix.script == 'misc' }}
with:
# CI diff needs more history - 0 fetches all history.
fetch-depth: 0
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
Expand All @@ -80,7 +92,17 @@ jobs:
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4.2.2

# Setup for misc tests
- name: Install misc dependencies
if: ${{ matrix.script == 'misc' }}
run: |
sudo apt install -y shellcheck devscripts python3-pip \
texlive-latex-base texlive-latex-extra latexmk librsvg2-bin \
autoconf dia hevea latexmk libasound2-dev rsync pdf2svg \
libcups2-dev libfontconfig1-dev libx11-dev libxext-dev \
libxrender-dev libxrandr-dev libxtst-dev libxt-dev \
texlive-font-utils texlive-fonts-recommended texlive-latex-recommended
pip install black flake8 html5validator
- name: Run test script checker/bin-devel/test-${{ matrix.script }}
run: ./checker/bin-devel/test-${{ matrix.script }}.sh

Expand All @@ -93,26 +115,81 @@ jobs:
strategy:
fail-fast: true
matrix:
# jspecify-conformance and jspecify-reference-checker only tested on JDK 21.
script: ['cftests-junit', 'cftests-nonjunit', 'cftests-junit-jdk21', 'typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib', 'daikon-part1', 'daikon-part2']
# JDK 21 used by sanity before
# `jspecify-conformance` and `jspecify-reference-checker` only tested on JDK 21.
script: ['cftests-junit', 'cftests-nonjunit', 'cftests-junit-jdk21',
'typecheck-part1', 'typecheck-part2',
'guava', 'plume-lib',
'daikon-part1', 'daikon-part2',
'misc']
# JDK 21 used by `sanity` and `remainder` before.
# `experimental` versions use the $version compiler, but run on JDK 21.
java: [{version: '8', experimental: false},
{version: '11', experimental: false},
{version: '17', experimental: false},
{version: '23', experimental: false},
{version: '24-ea', experimental: true}]
exclude:
# JDK 8 does not allow toolchains, so testing 'cftests-junit-jdk21' is unnecessary.
- script: 'cftests-junit-jdk21'
java: {version: '8'}
# Only run `typecheck*`, `guava`, and `misc` scripts on core versions,
# so exclude 11 and 17.
- script: 'typecheck-part1'
java: {version: '11'}
- script: 'typecheck-part1'
java: {version: '17'}
- script: 'typecheck-part2'
java: {version: '11'}
- script: 'typecheck-part2'
java: {version: '17'}
- script: 'guava'
java: {version: '11'}
- script: 'guava'
java: {version: '17'}
- script: 'misc'
java: {version: '11'}
- script: 'misc'
java: {version: '17'}
# At least one plume-lib project no longer works on Java 8,
# so exclude 8, 11, and 17.
- script: 'plume-lib'
java: {version: '8'}
- script: 'plume-lib'
java: {version: '11'}
- script: 'plume-lib'
java: {version: '17'}
# Daikon produces 'this-escape' compiler warnings in JDK 22+.
# Exclude all versions here and just explicitly include with JDK 17.
- script: 'daikon-part1'
- script: 'daikon-part2'
include:
- script: 'daikon-part1'
java: {version: '17', experimental: false}
- script: 'daikon-part2'
java: {version: '17', experimental: false}

env:
JAVA_VERSION: ${{ matrix.java.version }}
continue-on-error: ${{ matrix.java.experimental }}
steps:
- uses: actions/checkout@v4
- name: Check out sources
uses: actions/checkout@v4
if: ${{ matrix.script != 'misc' }}
with:
fetch-depth: 1
- name: Check out sources with all history
uses: actions/checkout@v4
if: ${{ matrix.script == 'misc' }}
with:
# CI diff needs more history - 0 fetches all history.
fetch-depth: 0
- name: Set up JDK ${{ matrix.java.version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java.version }}
distribution: 'temurin'
- name: Set up JDK 21 on an experimental platform
if: matrix.java.experimental
if: ${{ matrix.java.experimental }}
uses: actions/setup-java@v4
with:
# Install JDK 21 second, to make it the default on which gradle runs.
Expand All @@ -124,10 +201,19 @@ jobs:
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4.2.2

- name: Install misc dependencies
if: ${{ matrix.script == 'misc' }}
run: |
sudo apt install -y shellcheck devscripts python3-pip \
texlive-latex-base texlive-latex-extra latexmk librsvg2-bin \
autoconf dia hevea latexmk libasound2-dev rsync pdf2svg \
libcups2-dev libfontconfig1-dev libx11-dev libxext-dev \
libxrender-dev libxrandr-dev libxtst-dev libxt-dev \
texlive-font-utils texlive-fonts-recommended texlive-latex-recommended
pip install black flake8 html5validator
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.10.0
if: matrix.script == 'cftests-nonjunit'
if: ${{ matrix.script == 'cftests-nonjunit' }}
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
Expand All @@ -138,15 +224,6 @@ jobs:

- name: Run test script checker/bin-devel/test-${{ matrix.script }}
run: ./checker/bin-devel/test-${{ matrix.script }}.sh
# TODO: it would be nicer to not run the job at all, but GH Actions does
# not allow accessing the matrix on the job-if clause. There is also no way
# for an earlier step to stop execution successfully.
#
# At least one plume-lib project no longer works on Java 8.
# Java 8 does not allow toolchains, so testing 'cftests-junit-jdk21' is unnecessary.
# Daikon produces 'this-escape' compiler warnings in JDK 22+.
if: (matrix.java.version != 8 || (matrix.script != 'plume-lib' && matrix.script != 'cftests-junit-jdk21')) &&
(matrix.java.version <= 21 || (matrix.script != 'daikon-part1' && matrix.script != 'daikon-part2'))
# Set the compiler version to use, allowing us to e.g. run Java 23 while gradle does not work
# on Java 23 yet. This only tests the compiler, it does not use that version to run the tests.
env:
Expand Down Expand Up @@ -180,7 +257,7 @@ jobs:
uses: gradle/actions/setup-gradle@v4.2.2

- name: Install coreutils on MacOS
if: matrix.os == 'macos-latest'
if: ${{ matrix.os == 'macos-latest' }}
run: brew install coreutils

- name: Run test script checker/bin-devel/test-${{ matrix.script }}
Expand Down
75 changes: 0 additions & 75 deletions azure-pipelines.yml

This file was deleted.

2 changes: 1 addition & 1 deletion checker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ dependencies {
testImplementation 'com.amazonaws:aws-java-sdk-ec2'
testImplementation 'com.amazonaws:aws-java-sdk-kms'
// The AWS SDK is used for testing the Called Methods Checker.
testImplementation platform('com.amazonaws:aws-java-sdk-bom:1.12.770')
testImplementation platform('com.amazonaws:aws-java-sdk-bom:1.12.780')
// For the Resource Leak Checker's support for JavaEE.
testImplementation 'javax.servlet:javax.servlet-api:4.0.1'
// For the Resource Leak Checker's support for IOUtils.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ protected boolean commonAssignmentCheck(
}
}

/// TODO: What does "take precedence over" mean? Both are issued, but the
/// "i18nformat.excess.arguments" appears first in the output. Is this meant to not call
/// super.commonAssignmentCheck() if `result` is already false?
// TODO: What does "take precedence over" mean? Both are issued, but the
// "i18nformat.excess.arguments" appears first in the output. Is this meant to not call
// super.commonAssignmentCheck() if `result` is already false?
// By calling super.commonAssignmentCheck() last, any "i18nformat.excess.arguments"
// message issued for a given line of code will take precedence over the
// "assignment.type.incompatible"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,16 @@ public TransferResult<CFValue, CFStore> visitAssignment(
* {@code node} is known to be {@code typeOfNode}. If the node is a plus or a minus then the
* types of the left and right operands can be refined to include offsets. If the node is a
* multiplication, its operands can also be refined. See {@link
* #propagateToAdditionOperand(LessThanLengthOf, Node, Node, TransferInput, CFStore)}, {@link
* #propagateToSubtractionOperands(LessThanLengthOf, NumericalSubtractionNode, TransferInput,
* CFStore)}, and {@link #propagateToMultiplicationOperand(LessThanLengthOf, Node, Node,
* TransferInput, CFStore)} for details.
* #propagateToAdditionOperand(UBQualifier.LessThanLengthOf, Node, Node, TransferInput,
* CFStore)}, {@link #propagateToSubtractionOperands(UBQualifier.LessThanLengthOf,
* NumericalSubtractionNode, TransferInput, CFStore)}, and {@link
* #propagateToMultiplicationOperand(UBQualifier.LessThanLengthOf, Node, Node, TransferInput,
* CFStore)} for details.
*
* @param typeOfNode type of node
* @param node the node
* @param in the TransferInput before propagate to this operand
* @param store location to store the refined type
*/
private void propagateToOperands(
LessThanLengthOf typeOfNode,
Expand Down Expand Up @@ -234,10 +240,10 @@ private void propagateToMultiplicationOperand(
*
* <p>This means that the left node is less than or equal to the length of the array when the
* right node is subtracted from the left node. Note that unlike {@link
* #propagateToAdditionOperand(LessThanLengthOf, Node, Node, TransferInput, CFStore)} and {@link
* #propagateToMultiplicationOperand(LessThanLengthOf, Node, Node, TransferInput, CFStore)},
* this method takes the NumericalSubtractionNode instead of the two operand nodes. This
* implements case 4.
* #propagateToAdditionOperand(UBQualifier.LessThanLengthOf, Node, Node, TransferInput,
* CFStore)} and {@link #propagateToMultiplicationOperand(UBQualifier.LessThanLengthOf, Node,
* Node, TransferInput, CFStore)}, this method takes the NumericalSubtractionNode instead of the
* two operand nodes. This implements case 4.
*
* @param typeOfSubtraction type of node
* @param node subtraction node that has typeOfSubtraction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public FlowRule getFlowRule() {
* Produce a string representation.
*
* @return a string representation
* @see org.checkerframework.dataflow.cfg.builder.CFGBuilder.PhaseOneResult#nodeToString
* @see org.checkerframework.dataflow.cfg.builder.PhaseOneResult#nodeToString
*/
@Override
public String toString() {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/errorprone/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'java'
id 'net.ltgt.errorprone' version '4.1.0'
// Checker Framework pluggable type-checking
id 'org.checkerframework' version '0.6.47'
id 'org.checkerframework' version '0.6.48'
}

ext {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/lombok/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'java'
id 'io.freefair.lombok' version '8.11'
// Checker Framework pluggable type-checking
id 'org.checkerframework' version '0.6.47'
id 'org.checkerframework' version '0.6.48'
}

lombok {
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/creating-a-checker.tex
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
repository \url{https://github.com/eisop/checker-framework}.
Another choice is to write it in a stand-alone repository. Here is a
template for a stand-alone repository:
\url{https://github.com/typetools/templatefora-checker}; at that URL,
\url{https://github.com/eisop/templatefora-checker}; at that URL,
click the ``Use this template'' button.

% You may also wish to consult Section~\ref{creating-testing-framework} for
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/map-key-checker.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
\chapterAndLabel{Map Key Checker}{map-key-checker}

The Map Key Checker tracks which values are keys for which maps. If variable
\code{v} has type \code{@KeyFor("m")...}, then the value of \code{v} is a key
in Map \code{m}. That is, the expression \code{m.containsKey(v)} evaluates to
\code{k} has type \code{@KeyFor("m")...}, then the value of \code{k} is a key
in Map \code{m}. That is, the expression \code{m.containsKey(k)} evaluates to
\code{true}.

Section~\ref{map-key-qualifiers} describes how \code{@KeyFor} annotations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3819,7 +3819,7 @@ protected void reportMethodInvocabilityError(
* constructor result type. This is equivalent to down-casting.
*
* <p>For type checking of the enclosing expression of inner type instantiations, see {@link
* #checkEnclosingExpr(NewClassTree, AnnotatedExecutableType)}
* #checkEnclosingExpr(NewClassTree, AnnotatedTypeMirror.AnnotatedExecutableType)}
*
* @param invocation the AnnotatedDeclaredType of the constructor invocation
* @param constructor the AnnotatedExecutableType of the constructor declaration
Expand Down
Loading

0 comments on commit 1508ca6

Please sign in to comment.