You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/06/15 20:12:34 UTC

[GitHub] [druid] gianm commented on a change in pull request #11363: upgrade error-prone to 2.7.1 and support checks with Java 11+

gianm commented on a change in pull request #11363:
URL: https://github.com/apache/druid/pull/11363#discussion_r652113239



##########
File path: core/src/main/java/org/apache/druid/math/expr/BinaryLogicalOperatorExpr.java
##########
@@ -27,7 +27,7 @@
 import java.util.Objects;
 
 // logical operators live here
-
+@SuppressWarnings("ClassName")

Review comment:
       I guess the issue is there's no public class BinaryLogicalOperatorExpr?
   
   I suppose that's strange, but fine.

##########
File path: core/src/main/java/org/apache/druid/crypto/CryptoService.java
##########
@@ -113,6 +113,7 @@ public CryptoService(
 
       SecretKey tmp = getKeyFromPassword(passPhrase, salt);
       SecretKey secret = new SecretKeySpec(tmp.getEncoded(), cipherAlgName);
+      @SuppressWarnings("InsecureCryptoUsage")

Review comment:
       What's insecure about it? It is bad?
   
   If it's not bad, it'd be good to have a comment here about why it's not bad.

##########
File path: pom.xml
##########
@@ -1777,75 +1778,101 @@
                     </plugin>
                 </plugins>
             </build>
-        </profile>
-        <profile>
+          </profile>
+          <profile>
             <id>strict</id>
+            <activation>
+              <property>
+                <name>strictCompile</name>
+              </property>
+            </activation>
             <build>
                 <plugins>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-compiler-plugin</artifactId>
                         <configuration>
-                            <compilerId>javac-with-errorprone</compilerId>
-                            <forceJavacCompilerUse>true</forceJavacCompilerUse>
                             <fork>true</fork>
                             <meminitial>1024m</meminitial>
                             <maxmem>3000m</maxmem>
                             <source>${maven.compiler.source}</source>
                             <target>${maven.compiler.target}</target>
                             <showWarnings>false</showWarnings>
                             <compilerArgs>
-                                <arg>-XepDisableWarningsInGeneratedCode</arg>
-
-                                <arg>-Xep:ClassCanBeStatic:ERROR</arg>
-                                <arg>-Xep:PreconditionsInvalidPlaceholder:ERROR</arg>
-                                <arg>-Xep:MissingOverride:ERROR</arg>
-                                <arg>-Xep:DefaultCharset:ERROR</arg>
-                                <arg>-Xep:QualifierOrScopeOnInjectMethod:ERROR</arg>
-
-                                <arg>-Xep:AssistedInjectAndInjectOnSameConstructor</arg>
-                                <arg>-Xep:AutoFactoryAtInject</arg>
-                                <arg>-Xep:ClassName</arg>
-                                <arg>-Xep:ComparisonContractViolated</arg>
-                                <arg>-Xep:DepAnn</arg>
-                                <arg>-Xep:DivZero</arg>
-                                <arg>-Xep:EmptyIf</arg>
-                                <arg>-Xep:InjectInvalidTargetingOnScopingAnnotation</arg>
-                                <arg>-Xep:InjectMoreThanOneQualifier</arg>
-                                <arg>-Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass</arg>
-                                <arg>-Xep:InjectScopeOrQualifierAnnotationRetention</arg>
-                                <arg>-Xep:InjectedConstructorAnnotations</arg>
-                                <arg>-Xep:InsecureCryptoUsage</arg>
-                                <arg>-Xep:JMockTestWithoutRunWithOrRuleAnnotation</arg>
-                                <arg>-Xep:JavaxInjectOnFinalField</arg>
-                                <arg>-Xep:LockMethodChecker</arg>
-                                <arg>-Xep:LongLiteralLowerCaseSuffix</arg>
-                                <arg>-Xep:NoAllocation</arg>
-                                <arg>-Xep:NonRuntimeAnnotation</arg>
-                                <arg>-Xep:NumericEquality</arg>
-                                <arg>-Xep:ParameterPackage</arg>
-                                <arg>-Xep:ProtoStringFieldReferenceEquality</arg>
-                                <arg>-Xep:UnlockMethod</arg>
-                            </compilerArgs>
+                                <arg>-XDcompilePolicy=simple</arg>
+                                <!-- disable LongFloatConversion until https://github.com/google/error-prone/issues/2396 is fixed -->
+                                <arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/target/generated-(test-)?sources/.* -XepDisableWarningsInGeneratedCode -Xep:ClassCanBeStatic:ERROR -Xep:PreconditionsInvalidPlaceholder:ERROR -Xep:MissingOverride:ERROR -Xep:DefaultCharset:ERROR -Xep:QualifierOrScopeOnInjectMethod:ERROR -Xep:AssistedInjectAndInjectOnSameConstructor -Xep:AutoFactoryAtInject -Xep:ClassName -Xep:ComparisonContractViolated -Xep:DepAnn -Xep:DivZero -Xep:EmptyIf -Xep:InjectInvalidTargetingOnScopingAnnotation  -Xep:InjectMoreThanOneQualifier -Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass -Xep:InjectScopeOrQualifierAnnotationRetention -Xep:InjectedConstructorAnnotations -Xep:InsecureCryptoUsage -Xep:JMockTestWithoutRunWithOrRuleAnnotation -Xep:JavaxInjectOnFinalField -Xep:LockMethodChecker -Xep:LongLiteralLowerCaseSuffix -Xep:NoAllocation -Xep:NonRuntimeAnnotation -Xep:NumericEquality -Xep:ProtoStringFieldReferenceEquality -Xep:UnlockMethod -Xep:LongFloatConversion:OFF</arg>

Review comment:
       If this still works when broken onto multiple lines, I think it'd be nice to do that, for readability's sake. The line is super long.

##########
File path: processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java
##########
@@ -526,6 +526,7 @@ public int nextInt()
     };
   }
 
+  @SuppressWarnings("ReturnValueIgnored")

Review comment:
       Will this suppression work if it's moved down to the single line `values.contains(null)`?
   
   If not, consider adding a comment here about what line needs the ReturnValueIgnored suppression. It might not be obvious to people.

##########
File path: server/src/main/java/org/apache/druid/segment/realtime/appenderator/SinkQuerySegmentWalker.java
##########
@@ -152,9 +152,9 @@ public SinkQuerySegmentWalker(
     final DataSourceAnalysis analysis = DataSourceAnalysis.forDataSource(query.getDataSource());
 
     // Sanity check: make sure the query is based on the table we're meant to handle.
-    analysis.getBaseTableDataSource()
-            .filter(ds -> dataSource.equals(ds.getName()))
-            .orElseThrow(() -> new ISE("Cannot handle datasource: %s", analysis.getDataSource()));
+    if (!analysis.getBaseTableDataSource().filter(ds -> dataSource.equals(ds.getName())).isPresent()) {

Review comment:
       Fine 🙂




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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