Skip to content

Commit

Permalink
Merge branch 'main' into taglet
Browse files Browse the repository at this point in the history
  • Loading branch information
cpovirk committed May 23, 2024
2 parents 8943fba + d660272 commit e040e49
Show file tree
Hide file tree
Showing 32 changed files with 6,472 additions and 1,100 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
experimental: [false]
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java_version }}
Expand All @@ -41,12 +41,12 @@ jobs:
- name: Check out the code
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
- name: Publish conformance tests snapshot
run: ./gradlew publishConformanceTestsPublicationToSonatypeRepository
env:
Expand All @@ -60,31 +60,31 @@ jobs:
reference_checker_repo: ${{ vars.reference_checker_repo || 'jspecify-reference-checker' }}
steps:
- name: Check out the code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: jspecify
- name: Check out the reference checker
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/${{ env.reference_checker_repo }}
path: ${{ env.reference_checker_repo }}
- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Run Conformance Tests
if: github.base_ref == 'main' # only PRs onto main
continue-on-error: true
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: conformanceTests
build-root-directory: ${{ env.reference_checker_repo }}
- name: Run Samples Tests
# only PRs onto samples-google-prototype
if: github.base_ref == 'samples-google-prototype'
continue-on-error: true
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: jspecifySamplesTest
build-root-directory: ${{ env.reference_checker_repo }}
12 changes: 6 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18

Expand All @@ -27,7 +27,7 @@ jobs:
run: npm run build
working-directory: docs

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: document
path: docs/build
Expand All @@ -39,14 +39,14 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: document
path: docs/build

- uses: JamesIves/github-pages-deploy-action@4.1.5
- uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
branch: gh-pages
folder: docs/build
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 The JSpecify Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id 'java-library'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' apply false
Expand Down
16 changes: 16 additions & 0 deletions conformance-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2023 The JSpecify Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.gradle.api.JavaVersion

plugins {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright 2024 The JSpecify Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jspecify.conformance.tests.irrelevantannotations.notnullmarked;

import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

/**
* {@link Nullable @Nullable} and {@link NonNull @NonNull} annotations are unrecognized when applied
* to type parameters themselves (as opposed to their bounds).
*
* @see <a
* href="https://jspecify.dev/docs/spec#recognized-locations-for-type-use-annotations">Recognized
* locations for type-use annotations</a> in the JSpecify specification.
*/
public interface AnnotatedTypeParameters {

// test:name:Nullable on simple type parameter on method
// test:irrelevant-annotation:Nullable
<@Nullable T> void nParameter();

// test:name:NonNull on simple type parameter on method
// test:irrelevant-annotation:NonNull
<@NonNull T> void rParameter();

// test:name:Nullable on bounded type parameter on method
// test:irrelevant-annotation:Nullable
<@Nullable T extends Object> void nParameterWithBound();

// test:name:NonNull on bounded type parameter on method
// test:irrelevant-annotation:NonNull
<@NonNull T extends Object> void rParameterWithBound();

// test:name:NonNull on annotated-bounded type parameter on method
// test:irrelevant-annotation:NonNull
<@NonNull T extends @Nullable Object> void rParameterWithNBound();

// test:name:Nullable on annotated-bounded type parameter on method
// test:irrelevant-annotation:Nullable
<@Nullable T extends @NonNull Object> void nParameterWithRBound();

// test:name:Nullable on simple type parameter on class
// test:irrelevant-annotation:Nullable
interface NParameter<@Nullable T> {}

// test:name:NonNull on simple type parameter on class
// test:irrelevant-annotation:NonNull
interface RParameter<@NonNull T> {}

// test:name:Nullable on bounded type parameter on class
// test:irrelevant-annotation:Nullable
interface NParameterWithBound<@Nullable T extends Object> {}

// test:name:NonNull on bounded type parameter on class
// test:irrelevant-annotation:NonNull
interface RParameterWithBound<@NonNull T extends Object> {}

// test:name:NonNull on annotated-bounded type parameter on class
// test:irrelevant-annotation:NonNull
interface RParameterWithNBound<@NonNull T extends @Nullable Object> {}

// test:name:Nullable on annotated-bounded type parameter on class
// test:irrelevant-annotation:Nullable
interface NParameterWithRBound<@Nullable T extends @NonNull Object> {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2024 The JSpecify Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jspecify.conformance.tests.irrelevantannotations.notnullmarked;

import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.jspecify.conformance.deps.nullmarked.NHolder;

/**
* {@link Nullable @Nullable} and {@link NonNull @NonNull} annotations are unrecognized when applied
* to wildcards themselves (as opposed to their bounds).
*
* @see <a
* href="https://jspecify.dev/docs/spec#recognized-locations-for-type-use-annotations">Recognized
* locations for type-use annotations</a> in the JSpecify specification.
*/
public interface AnnotatedWildcards {

// test:name:Nullable on unbounded wildcard
// test:irrelevant-annotation:Nullable
NHolder<@Nullable ?> nWildcard();

// test:name:NonNull on unbounded wildcard
// test:irrelevant-annotation:NonNull
NHolder<@NonNull ?> rWildcard();

// test:name:Nullable on bounded wildcard
// test:irrelevant-annotation:Nullable
NHolder<@Nullable ? extends Object> nWildcardWithBound();

// test:name:NonNull on bounded wildcard
// test:irrelevant-annotation:NonNull
NHolder<@NonNull ? extends Object> rWildcardWithBound();

// test:name:NonNull on annotated-bounded wildcard
// test:irrelevant-annotation:NonNull
NHolder<@NonNull ? extends @Nullable Object> rWildcardWithNBound();

// test:name:Nullable on annotated-bounded wildcard
// test:irrelevant-annotation:Nullable
NHolder<@Nullable ? extends @NonNull Object> nWildcardWithRBound();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* Copyright 2024 The JSpecify Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jspecify.conformance.tests.irrelevantannotations.notnullmarked;

import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

public class Other {

/**
* {@link Nullable @Nullable} and {@link NonNull @NonNull} annotations are unrecognized when
* applied to root types of local variables.
*
* @see <a
* href="https://jspecify.dev/docs/spec#recognized-locations-for-type-use-annotations">Recognized
* locations for type-use annotations</a> in the JSpecify specification.
*/
void localVariables() {
// test:name:Nullable local variable object
// test:irrelevant-annotation:Nullable
@Nullable Object n;

// test:name:NonNull local variable object
// test:irrelevant-annotation:NonNull
@NonNull Object r;

// test:name:Nullable local variable array
// test:irrelevant-annotation:Nullable
Object @Nullable [] nArray;

// test:name:NonNull local variable array
// test:irrelevant-annotation:NonNull
Object @NonNull [] rArray;
}

/**
* {@link Nullable @Nullable} and {@link NonNull @NonNull} annotations are unrecognized when
* applied to catch parameter types.
*
* @see <a
* href="https://jspecify.dev/docs/spec#recognized-locations-for-type-use-annotations">Recognized
* locations for type-use annotations</a> in the JSpecify specification.
*/
void catchParameters() {
try {
// test:name:Nullable exception parameter
// test:irrelevant-annotation:Nullable
} catch (@Nullable RuntimeException e) {
}
try {
// test:name:NonNull exception parameter
// test:irrelevant-annotation:NonNull
} catch (@NonNull RuntimeException e) {
}
}

/**
* {@link Nullable @Nullable} and {@link NonNull @NonNull} annotations are unrecognized when
* applied to try-with-resources parameter types.
*
* @see <a
* href="https://jspecify.dev/docs/spec#recognized-locations-for-type-use-annotations">Recognized
* locations for type-use annotations</a> in the JSpecify specification.
*/
void tryWithResourcesParameters() throws Exception {
// test:name:Nullable try-with-resources
// test:irrelevant-annotation:Nullable
try (@Nullable AutoCloseable a = () -> {}) {}
// test:name:NonNull try-with-resources
// test:irrelevant-annotation:NonNull
try (@Nullable AutoCloseable a = () -> {}) {}
}

/**
* {@link Nullable @Nullable} and {@link NonNull @NonNull} annotations are unrecognized when
* applied to thrown types.
*
* @see <a
* href="https://jspecify.dev/docs/spec#recognized-locations-for-type-use-annotations">Recognized
* locations for type-use annotations</a> in the JSpecify specification.
*/
interface ExceptionTypes {
// test:name:Nullable exception type
// test:irrelevant-annotation:Nullable
void throwsN() throws @Nullable Exception;

// test:name:NonNull exception type
// test:irrelevant-annotation:NonNulll
void throwsR() throws @NonNull Exception;
}
}

0 comments on commit e040e49

Please sign in to comment.