Is there a way to prohibit usage of var keyword #1051
Answered
by
hankem
ChristianGmw
asked this question in
Q&A
-
Hello, thanks for this amazing library! In our project we have the rule that types should be explicit, so no usage of the Java 10 "var" keyword. Is there a way to enforce this with ArchUnit? |
Beta Was this translation helpful? Give feedback.
Answered by
hankem
Jan 25, 2023
Replies: 1 comment 1 reply
-
As ArchUnit (currently) only analyzes byte code, it cannot distinguish between |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ChristianGmw
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As ArchUnit (currently) only analyzes byte code, it cannot distinguish between
var
and an explicit type declaration, as the compiler creates the same class file regardless of whether the type was expclitly declared or inferred.