From dade2046ad6fad90443bdf7f0c100642cce3c481 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Tue, 15 Feb 2022 16:43:48 +0100 Subject: [PATCH] Do not detect false positive license in Java Reference: https://github.com/nexB/scancode-toolkit/issues/2865 Reported-by: Patrick Kutter @PatteSI Reported-by: Sebastian Schuberth @sschuberth Signed-off-by: Philippe Ombredanne --- .../data/rules/false-positive_48.RULE | 1 + .../data/rules/false-positive_48.yml | 2 + .../datadriven/lic4/StandardValueGraph.java | 41 +++++++++++++++++++ .../lic4/StandardValueGraph.java.yml | 4 ++ 4 files changed, 48 insertions(+) create mode 100644 src/licensedcode/data/rules/false-positive_48.RULE create mode 100644 src/licensedcode/data/rules/false-positive_48.yml create mode 100644 tests/licensedcode/data/datadriven/lic4/StandardValueGraph.java create mode 100644 tests/licensedcode/data/datadriven/lic4/StandardValueGraph.java.yml diff --git a/src/licensedcode/data/rules/false-positive_48.RULE b/src/licensedcode/data/rules/false-positive_48.RULE new file mode 100644 index 00000000000..8312dc3219c --- /dev/null +++ b/src/licensedcode/data/rules/false-positive_48.RULE @@ -0,0 +1 @@ +mutable but may not be modified by the user \ No newline at end of file diff --git a/src/licensedcode/data/rules/false-positive_48.yml b/src/licensedcode/data/rules/false-positive_48.yml new file mode 100644 index 00000000000..1e0fd7070d2 --- /dev/null +++ b/src/licensedcode/data/rules/false-positive_48.yml @@ -0,0 +1,2 @@ +is_false_positive: yes +notes: See in https://raw.githubusercontent.com/google/guava/v31.0.1/guava/src/com/google/common/graph/StandardValueGraph.java diff --git a/tests/licensedcode/data/datadriven/lic4/StandardValueGraph.java b/tests/licensedcode/data/datadriven/lic4/StandardValueGraph.java new file mode 100644 index 00000000000..9f40d5e7574 --- /dev/null +++ b/tests/licensedcode/data/datadriven/lic4/StandardValueGraph.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2016 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.graph; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.graph.GraphConstants.DEFAULT_NODE_COUNT; +import static com.google.common.graph.Graphs.checkNonNegative; + +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import javax.annotation.CheckForNull; + +/** + * Standard implementation of {@link ValueGraph} that supports the options supplied by {@link + * AbstractGraphBuilder}. + * + *

This class maintains a map of nodes to {@link GraphConnections}. + * + *

Collection-returning accessors return unmodifiable views: the view returned will reflect + * changes to the graph (if the graph is mutable) but may not be modified by the user. + * + *

The time complexity of all collection-returning accessors is O(1), since views are returned. + * + */ + diff --git a/tests/licensedcode/data/datadriven/lic4/StandardValueGraph.java.yml b/tests/licensedcode/data/datadriven/lic4/StandardValueGraph.java.yml new file mode 100644 index 00000000000..66b61b5acda --- /dev/null +++ b/tests/licensedcode/data/datadriven/lic4/StandardValueGraph.java.yml @@ -0,0 +1,4 @@ +license_expressions: + - apache-2.0 +notes: there was some false positive detected before this +