Skip to content

Commit 021faab

Browse files
committed
Fix spotbugs issues
1 parent f879a77 commit 021faab

14 files changed

Lines changed: 17 additions & 40 deletions

File tree

aiservices/huggingface/src/main/java/com/microsoft/semantickernel/aiservices/huggingface/services/HuggingFacePromptExecutionSettings.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@ public HuggingFacePromptExecutionSettings(
103103
@Nullable Boolean logProbs,
104104
@Nullable Integer topLogProbs,
105105
@Nullable Long seed,
106-
@Nullable Boolean maxCompletionTokens) {
106+
@Nullable Boolean maxCompletionTokensEnable) {
107107
super(
108108
serviceId, modelId, temperature, topP, presencePenalty, frequencyPenalty, maxTokens,
109-
resultsPerPrompt, bestOf, user, stopSequences, tokenSelectionBiases, responseFormat, Boolean.toString(maxCompletionTokens));
109+
resultsPerPrompt, bestOf, user, stopSequences, tokenSelectionBiases, responseFormat,
110+
Boolean.toString(Boolean.TRUE.equals(maxCompletionTokensEnable)));
110111

111112
this.topK = topK;
112113
this.repetitionPenalty = repetitionPenalty;

data/semantickernel-data-hsqldb/src/main/java/com/microsoft/semantickernel/data/jdbc/hsqldb/HSQLDBVectorStoreQueryProvider.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.microsoft.semantickernel.data.vectorstorage.options.UpsertRecordOptions;
1313
import com.microsoft.semantickernel.exceptions.SKException;
1414
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
15-
1615
import java.sql.Connection;
1716
import java.sql.PreparedStatement;
1817
import java.sql.SQLException;
@@ -32,7 +31,6 @@ public class HSQLDBVectorStoreQueryProvider extends JDBCVectorStoreQueryProvider
3231

3332
private final ObjectMapper objectMapper;
3433

35-
@SuppressFBWarnings("EI_EXPOSE_REP2")
3634
private HSQLDBVectorStoreQueryProvider(
3735
DataSource dataSource,
3836
String collectionsTable,

data/semantickernel-data-jdbc/src/main/java/com/microsoft/semantickernel/data/jdbc/JDBCVectorStoreQueryProvider.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import java.util.HashMap;
3030
import java.util.List;
3131
import java.util.Map;
32-
import java.util.concurrent.locks.Lock;
33-
import java.util.concurrent.locks.ReentrantLock;
3432
import java.util.stream.Collectors;
3533
import java.util.stream.Stream;
3634
import javax.annotation.Nonnull;
@@ -59,7 +57,6 @@ public class JDBCVectorStoreQueryProvider
5957

6058
private final Object dbCreationLock = new Object();
6159

62-
@SuppressFBWarnings("EI_EXPOSE_REP2") // DataSource is not exposed
6360
protected JDBCVectorStoreQueryProvider(
6461
@Nonnull DataSource dataSource,
6562
@Nonnull String collectionsTable,
@@ -102,8 +99,9 @@ protected JDBCVectorStoreQueryProvider(
10299
* @param supportedDataTypes the supported data types
103100
* @param supportedVectorTypes the supported vector types
104101
*/
102+
@SuppressFBWarnings("EI_EXPOSE_REP2")
105103
public JDBCVectorStoreQueryProvider(
106-
@SuppressFBWarnings("EI_EXPOSE_REP2") @Nonnull DataSource dataSource,
104+
@Nonnull DataSource dataSource,
107105
@Nonnull String collectionsTable,
108106
@Nonnull String prefixForCollectionTables,
109107
@Nonnull Map<Class<?>, String> supportedKeyTypes,

data/semantickernel-data-jdbc/src/main/java/com/microsoft/semantickernel/data/jdbc/JDBCVectorStoreRecordCollection.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public class JDBCVectorStoreRecordCollection<Record>
4646
* @param collectionName the name of the collection
4747
* @param options the options
4848
*/
49-
@SuppressFBWarnings("EI_EXPOSE_REP2") // DataSource is not exposed
5049
public JDBCVectorStoreRecordCollection(
5150
@Nonnull DataSource dataSource,
5251
@Nonnull String collectionName,

data/semantickernel-data-mysql/src/main/java/com/microsoft/semantickernel/data/jdbc/mysql/MySQLVectorStoreQueryProvider.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
import com.microsoft.semantickernel.data.vectorstorage.options.UpsertRecordOptions;
1414
import com.microsoft.semantickernel.exceptions.SKException;
1515
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
16-
17-
import javax.annotation.Nonnull;
18-
import javax.sql.DataSource;
1916
import java.sql.Connection;
2017
import java.sql.PreparedStatement;
2118
import java.sql.SQLException;
2219
import java.util.List;
2320
import java.util.stream.Collectors;
21+
import javax.annotation.Nonnull;
22+
import javax.sql.DataSource;
2423

2524
/**
2625
* The MySQL vector store query provider.
@@ -32,7 +31,6 @@ public class MySQLVectorStoreQueryProvider extends
3231

3332
private final ObjectMapper objectMapper;
3433

35-
@SuppressFBWarnings("EI_EXPOSE_REP2")
3634
private MySQLVectorStoreQueryProvider(
3735
@Nonnull DataSource dataSource,
3836
@Nonnull String collectionsTable,

data/semantickernel-data-postgres/src/main/java/com/microsoft/semantickernel/data/jdbc/postgres/PostgreSQLVectorStoreQueryProvider.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import com.fasterxml.jackson.core.JsonProcessingException;
55
import com.fasterxml.jackson.databind.JsonNode;
66
import com.fasterxml.jackson.databind.ObjectMapper;
7-
import com.microsoft.semantickernel.data.jdbc.JDBCVectorStoreQueryProvider;
8-
import com.microsoft.semantickernel.data.jdbc.SQLVectorStoreQueryProvider;
97
import com.microsoft.semantickernel.data.filter.AnyTagEqualToFilterClause;
108
import com.microsoft.semantickernel.data.filter.EqualToFilterClause;
9+
import com.microsoft.semantickernel.data.jdbc.JDBCVectorStoreQueryProvider;
10+
import com.microsoft.semantickernel.data.jdbc.SQLVectorStoreQueryProvider;
1111
import com.microsoft.semantickernel.data.vectorsearch.VectorSearchFilter;
1212
import com.microsoft.semantickernel.data.vectorsearch.VectorSearchResult;
1313
import com.microsoft.semantickernel.data.vectorsearch.VectorSearchResults;
@@ -22,9 +22,6 @@
2222
import com.microsoft.semantickernel.data.vectorstorage.options.VectorSearchOptions;
2323
import com.microsoft.semantickernel.exceptions.SKException;
2424
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
25-
26-
import javax.annotation.Nonnull;
27-
import javax.sql.DataSource;
2825
import java.sql.Connection;
2926
import java.sql.PreparedStatement;
3027
import java.sql.ResultSet;
@@ -38,6 +35,8 @@
3835
import java.util.List;
3936
import java.util.Map;
4037
import java.util.stream.Collectors;
38+
import javax.annotation.Nonnull;
39+
import javax.sql.DataSource;
4140

4241
/**
4342
* The MySQL vector store query provider.
@@ -50,7 +49,6 @@ public class PostgreSQLVectorStoreQueryProvider extends
5049
private final String prefixForCollectionTables;
5150
private final ObjectMapper objectMapper;
5251

53-
@SuppressFBWarnings("EI_EXPOSE_REP2")
5452
private PostgreSQLVectorStoreQueryProvider(
5553
@Nonnull DataSource dataSource,
5654
@Nonnull String collectionsTable,

data/semantickernel-data-sqlite/src/main/java/com/microsoft/semantickernel/data/jdbc/sqlite/SQLiteVectorStoreQueryProvider.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
import com.microsoft.semantickernel.data.vectorstorage.options.UpsertRecordOptions;
1414
import com.microsoft.semantickernel.exceptions.SKException;
1515
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
16-
17-
import javax.annotation.Nonnull;
18-
import javax.sql.DataSource;
1916
import java.sql.Connection;
2017
import java.sql.PreparedStatement;
2118
import java.sql.SQLException;
2219
import java.util.List;
20+
import javax.annotation.Nonnull;
21+
import javax.sql.DataSource;
2322

2423
/**
2524
* A query provider for a vector store in SQLite.
@@ -30,7 +29,6 @@ public class SQLiteVectorStoreQueryProvider extends
3029
private final DataSource dataSource;
3130
private final ObjectMapper objectMapper;
3231

33-
@SuppressFBWarnings("EI_EXPOSE_REP2")
3432
private SQLiteVectorStoreQueryProvider(
3533
@Nonnull DataSource dataSource,
3634
@Nonnull String collectionsTable,

semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/ContextVariableTypeConverter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import com.microsoft.semantickernel.exceptions.SKException;
55
import com.microsoft.semantickernel.localization.SemanticKernelResources;
6-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
76
import java.util.ArrayList;
87
import java.util.Collections;
98
import java.util.List;
@@ -341,7 +340,6 @@ public static class Builder<T> {
341340
*
342341
* @param clazz the class of the type
343342
*/
344-
@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
345343
public Builder(Class<T> clazz) {
346344
this.clazz = clazz;
347345
fromObject = x -> ContextVariableTypes.convert(x, clazz);

semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/converters/CollectionVariableContextVariableTypeConverter.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.microsoft.semantickernel.contextvariables.ContextVariableType;
88
import com.microsoft.semantickernel.contextvariables.ContextVariableTypeConverter;
99
import com.microsoft.semantickernel.contextvariables.ContextVariableTypes;
10-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
1110
import java.util.Collection;
1211
import java.util.stream.Collectors;
1312

@@ -24,7 +23,6 @@ public class CollectionVariableContextVariableTypeConverter extends
2423
* Creates a new instance of the {@link CollectionVariableContextVariableTypeConverter} class.
2524
* @param delimiter The delimiter to use joining elements of the collection.
2625
*/
27-
@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
2826
public CollectionVariableContextVariableTypeConverter(String delimiter) {
2927
super(
3028
Collection.class,
@@ -38,7 +36,6 @@ public CollectionVariableContextVariableTypeConverter(String delimiter) {
3836
/**
3937
* Creates a new instance of the {@link CollectionVariableContextVariableTypeConverter} class.
4038
*/
41-
@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
4239
public CollectionVariableContextVariableTypeConverter() {
4340
this(",");
4441
}

semantickernel-api/src/main/java/com/microsoft/semantickernel/hooks/FunctionInvokedEvent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
package com.microsoft.semantickernel.hooks;
33

44
import com.microsoft.semantickernel.orchestration.FunctionResult;
5-
import com.microsoft.semantickernel.semanticfunctions.KernelFunction;
65
import com.microsoft.semantickernel.semanticfunctions.KernelArguments;
6+
import com.microsoft.semantickernel.semanticfunctions.KernelFunction;
77
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
88
import javax.annotation.Nullable;
99

@@ -60,7 +60,6 @@ public KernelArguments getArguments() {
6060
*
6161
* @return the result
6262
*/
63-
@SuppressFBWarnings("EI_EXPOSE_REP")
6463
public FunctionResult<T> getResult() {
6564
return result;
6665
}

0 commit comments

Comments
 (0)