Projects
Mega:24.03:SP1:Everything
guava20
_service:tar_scm:CVE-2023-2976-pre.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:CVE-2023-2976-pre.patch of Package guava20
From 364aed58e083e305f3f9ffc5bcacf9536f2472ab Mon Sep 17 00:00:00 2001 From: cpovirk <cpovirk@google.com> Date: Tue, 25 Apr 2023 10:00:41 -0700 Subject: [PATCH] Split the tests for `Files.createTempDir` into a separate file. This makes it easier to run them a second time under a newer Android emulator in our internal tests. RELNOTES=n/a PiperOrigin-RevId: 526998248 Origin: https://github.com/google/guava/commit/364aed58e083e305f3f9ffc5bcacf9536f2472ab --- .../common/io/FilesCreateTempDirTest.java | 37 +++++++++++++++++ .../test/com/google/common/io/FilesTest.java | 10 +---- .../common/annotations/J2ktIncompatible.java | 31 ++++++++++++++ .../io/ElementTypesAreNonnullByDefault.java | 41 +++++++++++++++++++ 4 files changed, 111 insertions(+), 8 deletions(-) create mode 100644 guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java create mode 100644 guava/src/com/google/common/annotations/J2ktIncompatible.java create mode 100644 guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java diff --git a/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java b/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java new file mode 100644 index 0000000..557689e --- /dev/null +++ b/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2007 The Guava 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 com.google.common.io; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.File; + +/** + * Unit test for {@link Files#createTempDir}. + * + * @author Chris Nokleberg + */ + +public class FilesCreateTempDirTest extends IoTestCase { + public void testCreateTempDir() { + File temp = Files.createTempDir(); + assertTrue(temp.exists()); + assertTrue(temp.isDirectory()); + assertThat(temp.listFiles()).isEmpty(); + assertTrue(temp.delete()); + } +} diff --git a/guava-tests/test/com/google/common/io/FilesTest.java b/guava-tests/test/com/google/common/io/FilesTest.java index 863321b..8a3bfc1 100644 --- a/guava-tests/test/com/google/common/io/FilesTest.java +++ b/guava-tests/test/com/google/common/io/FilesTest.java @@ -45,6 +45,8 @@ import junit.framework.TestSuite; /** * Unit test for {@link Files}. * + * <p>Note: {@link Files#createTempDir()} is tested in {@link FilesCreateTempDirTest}. + * * @author Chris Nokleberg */ @@ -417,14 +419,6 @@ public class FilesTest extends IoTestCase { } } - public void testCreateTempDir() { - File temp = Files.createTempDir(); - assertTrue(temp.exists()); - assertTrue(temp.isDirectory()); - assertThat(temp.listFiles()).isEmpty(); - assertTrue(temp.delete()); - } - public void testMove() throws IOException { File i18nFile = getTestFile("i18n.txt"); File temp1 = createTempFile(); diff --git a/guava/src/com/google/common/annotations/J2ktIncompatible.java b/guava/src/com/google/common/annotations/J2ktIncompatible.java new file mode 100644 index 0000000..6e28d02 --- /dev/null +++ b/guava/src/com/google/common/annotations/J2ktIncompatible.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2009 The Guava 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 com.google.common.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * The presence of this annotation on an API indicates that the method may <em>not</em> be used with + * J2kt. + * + * @since NEXT + */ +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) +@GwtCompatible +public @interface J2ktIncompatible {} diff --git a/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java new file mode 100644 index 0000000..48bc10f --- /dev/null +++ b/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 The Guava 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 com.google.common.io; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import com.google.common.annotations.GwtCompatible; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import javax.annotation.Nonnull; +import javax.annotation.meta.TypeQualifierDefault; + +/** + * Marks all "top-level" types as non-null in a way that is recognized by Kotlin. Note that this + * unfortunately includes type-variable usages, so we also provide {@link ParametricNullness} to + * "undo" it as best we can. + */ +@GwtCompatible +@Retention(RUNTIME) +@Target(TYPE) +@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) +@Nonnull +@interface ElementTypesAreNonnullByDefault {} -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2