You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2021/03/22 23:42:46 UTC

[lucene] branch jira/LUCENE-9856-static-analysis updated: LUCENE-9856: add module-specific overrides

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

rmuir pushed a commit to branch jira/LUCENE-9856-static-analysis
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/jira/LUCENE-9856-static-analysis by this push:
     new 66afbd6  LUCENE-9856: add module-specific overrides
66afbd6 is described below

commit 66afbd682492e5209047dbe37afb138d9dadd479
Author: Robert Muir <rm...@apache.org>
AuthorDate: Mon Mar 22 19:42:05 2021 -0400

    LUCENE-9856: add module-specific overrides
    
    I am sure it can be done more "groovy" and needs to be rewritten, but it works.
---
 gradle/validation/ecj-lint.gradle | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/gradle/validation/ecj-lint.gradle b/gradle/validation/ecj-lint.gradle
index 09c4ebe..7ed9b7c 100644
--- a/gradle/validation/ecj-lint.gradle
+++ b/gradle/validation/ecj-lint.gradle
@@ -47,6 +47,22 @@ allprojects {
         // The inputs are all source files from the sourceSet.
         inputs.files sourceSet.allSource.asFileTree
 
+        // ECJ preferences
+        Properties properties = new Properties()
+        properties.load(file("${resources}/ecj.javadocs.prefs").newDataInputStream())
+        inputs.properties(properties);
+
+        // module-specific overrides
+        // sorry Dawid :)
+        switch(project.name) {
+          case "queryparser":
+            // TODO: fix/exclude generated code?
+            properties.put("org.eclipse.jdt.core.compiler.problem.unusedLocal", "ignore");
+          case "expressions":
+            // TODO: fix/exclude generated code?
+            properties.put("org.eclipse.jdt.core.compiler.problem.unusedLocal", "ignore");
+        }
+
         // This task has no proper outputs.
         setupDummyOutputs(task)
 
@@ -65,6 +81,10 @@ allprojects {
 
         args += [ "-d", "none" ]
 
+        // write final ECJ properties file
+        def prefsFile = project.file("${getTemporaryDir()}/ecj.prefs")
+        properties.store(prefsFile.newDataOutputStream(), "ecj prefs")
+
         // Compilation environment.
         args += [ "-source", project.java.sourceCompatibility ]
         args += [ "-target", project.java.targetCompatibility ]
@@ -72,7 +92,7 @@ allprojects {
         args += [ "-proc:none" ]
         args += [ "-nowarn" ]
         args += [ "-enableJavadoc" ]
-        args += [ "-properties", file("${resources}/ecj.javadocs.prefs").absolutePath ]
+        args += [ "-properties", prefsFile.absolutePath ]
 
         // disable for now because individual file excludes cannot be applied to ecj.
         // enabled = false