rmuir commented on code in PR #14812:
URL: https://github.com/apache/lucene/pull/14812#discussion_r2156593895


##########
gradle/validation/ast-grep/rules/java-patterns.yml:
##########
@@ -0,0 +1,24 @@
+# Banned Lucene source patterns
+# Historically implemented as regexes which are more difficult
+---
+# yaml-language-server: 
$schema=https://raw.githubusercontent.com/ast-grep/ast-grep/refs/heads/main/schemas/java_rule.json
+id: java-lang-import
+language: java
+rule:
+  pattern: import java.lang.$REF
+  kind: import_declaration
+fix: ""
+severity: error
+message: unnecessary import of `$REF` from java.lang
+note: classes in java.lang are implicitly imported
+---
+# yaml-language-server: 
$schema=https://raw.githubusercontent.com/ast-grep/ast-grep/refs/heads/main/schemas/java_rule.json
+id: impossible-type-inference
+language: java
+# does the javac compiler allow this? did it ever?
+rule:
+  pattern: var $$$ = new $$$<>($$$)
+  kind: local_variable_declaration

Review Comment:
   @dweiss there's not a problem here: the first line is valid. the second line 
is invalid. same as with the source-pattern today.
   
   i'm not arguing for what the rule is trying to achieve, just trying to 
replace the regex.



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to