Skip to content

Commit cef9b74

Browse files
authored
chore: Add superficial code formatting fixes. (#2161)
This contains superficial changes to annotations. This tags specific fields labeled as deprecated in the javadoc with @deprecated annotation. Also, this adds @RunWith(JUnit4.class) to several test cases to make the test classes explicit.
1 parent 3bc7bba commit cef9b74

21 files changed

+56
-3
lines changed

core/src/main/java/com/google/cloud/sql/core/CoreSocketFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* @deprecated Use the official java API instead.
2424
* @see com.google.cloud.sql.ConnectorRegistry
2525
*/
26+
@SuppressWarnings("InlineMeSuggester")
2627
@Deprecated
2728
public final class CoreSocketFactory {
2829

@@ -80,6 +81,7 @@ public final class CoreSocketFactory {
8081
* @deprecated Use the official java API instead.
8182
* @see com.google.cloud.sql.ConnectorRegistry
8283
*/
84+
@Deprecated
8385
static void setApplicationName(String artifactId) {
8486
InternalConnectorRegistry.setApplicationName(artifactId);
8587
}

core/src/main/java/com/google/cloud/sql/core/InstanceCheckingTrustManger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private List<String> getSans(X509Certificate cert) throws CertificateException {
170170
return names;
171171
}
172172

173-
for (List item : sanAsn1Field) {
173+
for (List<?> item : sanAsn1Field) {
174174
Integer type = (Integer) item.get(0);
175175
// RFC 5280 section 4.2.1.6. "Subject Alternative Name"
176176
// describes the structure of subjectAlternativeName record.

core/src/main/java/com/google/cloud/sql/core/InternalConnectorRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public final class InternalConnectorRegistry {
7171
* @deprecated Use {@link #setApplicationName(String)} to set the application name
7272
* programmatically.
7373
*/
74-
static final String USER_TOKEN_PROPERTY_NAME = "_CLOUD_SQL_USER_TOKEN";
74+
@Deprecated static final String USER_TOKEN_PROPERTY_NAME = "_CLOUD_SQL_USER_TOKEN";
7575

7676
@VisibleForTesting
7777
InternalConnectorRegistry(

core/src/main/java/com/google/cloud/sql/core/JndiDnsResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public Collection<String> resolveTxt(String domainName)
6161
// See https://docs.oracle.com/javase/7/docs/technotes/guides/jndi/jndi-dns.html
6262

6363
// Explicitly reference the JNDI DNS classes. This is required for GraalVM.
64-
Hashtable contextProps = new Hashtable<>();
64+
Hashtable<String, String> contextProps = new Hashtable<>();
6565
contextProps.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
6666
contextProps.put(Context.OBJECT_FACTORIES, "com.sun.jndi.url.dns.dnsURLContextFactory");
6767
Attribute attr =

core/src/test/java/com/google/cloud/sql/ConnectorConfigTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
import java.util.List;
2929
import java.util.function.Supplier;
3030
import org.junit.Test;
31+
import org.junit.runner.RunWith;
32+
import org.junit.runners.JUnit4;
3133

34+
@RunWith(JUnit4.class)
3235
public class ConnectorConfigTest {
3336
@Test
3437
public void testConfigFromBuilder() {

core/src/test/java/com/google/cloud/sql/CredentialFactoryTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
import java.io.IOException;
3535
import java.util.Collections;
3636
import org.junit.Test;
37+
import org.junit.runner.RunWith;
38+
import org.junit.runners.JUnit4;
3739

40+
@RunWith(JUnit4.class)
3841
public class CredentialFactoryTest {
3942

4043
@Test

core/src/test/java/com/google/cloud/sql/core/ApiClientRetryingCallableTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
import java.util.concurrent.atomic.AtomicInteger;
2424
import org.junit.Assert;
2525
import org.junit.Test;
26+
import org.junit.runner.RunWith;
27+
import org.junit.runners.JUnit4;
2628

29+
@RunWith(JUnit4.class)
2730
public class ApiClientRetryingCallableTest {
2831
@Test
2932
public void testApiClientRetriesOn500ErrorAndSucceeds() throws Exception {

core/src/test/java/com/google/cloud/sql/core/ConnectionConfigTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
import java.util.Properties;
2828
import java.util.stream.Collectors;
2929
import org.junit.Test;
30+
import org.junit.runner.RunWith;
31+
import org.junit.runners.JUnit4;
3032

33+
@RunWith(JUnit4.class)
3134
public class ConnectionConfigTest {
3235

3336
@Test

core/src/test/java/com/google/cloud/sql/core/ConnectorTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@
4545
import org.junit.After;
4646
import org.junit.Before;
4747
import org.junit.Test;
48+
import org.junit.runner.RunWith;
49+
import org.junit.runners.JUnit4;
4850

51+
@RunWith(JUnit4.class)
4952
public class ConnectorTest extends CloudSqlCoreTestingBase {
5053
ListeningScheduledExecutorService defaultExecutor;
5154
private final long TEST_MAX_REFRESH_MS = 5000L;

core/src/test/java/com/google/cloud/sql/core/ConstantCredentialsFactoryTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020

2121
import com.google.auth.oauth2.GoogleCredentials;
2222
import org.junit.Test;
23+
import org.junit.runner.RunWith;
24+
import org.junit.runners.JUnit4;
2325

26+
@RunWith(JUnit4.class)
2427
public class ConstantCredentialsFactoryTest {
2528

2629
@Test

0 commit comments

Comments
 (0)