You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by gi...@apache.org on 2019/01/27 20:42:50 UTC

[incubator-druid] branch master updated: * Use `@SuppressWarnings("GuardedBy")` instead of `noinspection FieldAccessNotGuarded` comment (#6903)

This is an automated email from the ASF dual-hosted git repository.

gian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 2b73644  * Use `@SuppressWarnings("GuardedBy")` instead of `noinspection FieldAccessNotGuarded` comment (#6903)
2b73644 is described below

commit 2b7364434054ea4cc07944288f83ef9a371ee107
Author: Benedict Jin <as...@apache.org>
AuthorDate: Mon Jan 28 04:42:45 2019 +0800

    * Use `@SuppressWarnings("GuardedBy")` instead of `noinspection FieldAccessNotGuarded` comment (#6903)
    
    * Remove `@GuardedBy("connectionLock")` from `connectionLock` itself
    
    * Add FieldAccessNotGuarded into inspection profile and set the level to ERROR
---
 .idea/inspectionProfiles/Druid.xml                                  | 1 +
 sql/src/main/java/org/apache/druid/sql/avatica/DruidConnection.java | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.idea/inspectionProfiles/Druid.xml b/.idea/inspectionProfiles/Druid.xml
index b3c94b3..a79a44c 100644
--- a/.idea/inspectionProfiles/Druid.xml
+++ b/.idea/inspectionProfiles/Druid.xml
@@ -324,5 +324,6 @@
       <option name="ADD_SERVLET_TO_ENTRIES" value="true" />
       <option name="ADD_NONJAVA_TO_ENTRIES" value="true" />
     </inspection_tool>
+    <inspection_tool class="FieldAccessNotGuarded" enabled="true" level="ERROR" enabled_by_default="true" />
   </profile>
 </component>
\ No newline at end of file
diff --git a/sql/src/main/java/org/apache/druid/sql/avatica/DruidConnection.java b/sql/src/main/java/org/apache/druid/sql/avatica/DruidConnection.java
index 6c84ccb..b0ba8fb 100644
--- a/sql/src/main/java/org/apache/druid/sql/avatica/DruidConnection.java
+++ b/sql/src/main/java/org/apache/druid/sql/avatica/DruidConnection.java
@@ -56,9 +56,8 @@ public class DruidConnection
 
   // Typically synchronized by connectionLock, except in one case: the onClose function passed
   // into DruidStatements contained by the map.
-  private final ConcurrentMap<Integer, DruidStatement> statements;
-
   @GuardedBy("connectionLock")
+  private final ConcurrentMap<Integer, DruidStatement> statements;
   private final Object connectionLock = new Object();
 
   @GuardedBy("connectionLock")
@@ -94,6 +93,7 @@ public class DruidConnection
           e -> !SENSITIVE_CONTEXT_FIELDS.contains(e.getKey())
       );
 
+      @SuppressWarnings("GuardedBy")
       final DruidStatement statement = new DruidStatement(
           connectionId,
           statementId,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org