Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConstantsAndStaticNonFinalFieldsNamesRule: Synthetic/Anonymous class violate the rule #90

Open
1 of 3 tasks
fhaefemeier opened this issue Apr 21, 2024 · 0 comments
Open
1 of 3 tasks

Comments

@fhaefemeier
Copy link

fhaefemeier commented Apr 21, 2024

Summary

Have a method with the following code snippet:

package de.dummy;
public class CheckDummy {
  public void check(DummyEnum dummy) {
     var check = switch (dummy) {
         default -> true;
     };
  }
}

de.dummy.DummyEnum is a enumeration.
Running ArchUnit with ConstantsAndStaticNonFinalFieldsNamesRule enabled, it prints the error

[ERROR] Constants have to be written in uppercase. It's possible to add underscore but not at the beginning or the end of the name. - class: de.dummy.CheckDummy$1 - field name: $SwitchMap$de$dummy$DummyEnum

It seems related to TNG/ArchUnit#1019

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

Current Behavior

Running ArchUnit with ConstantsAndStaticNonFinalFieldsNamesRule enabled, it prints the error

[ERROR] Constants have to be written in uppercase. It's possible to add underscore but not at the beginning or the end of the name. - class: de.dummy.CheckDummy$1 - field name: $SwitchMap$de$dummy$DummyEnum

Expected Behavior

Expected behaviour should accept this special case as a valid exception.

Steps to Reproduce (for bugs)

Your Environment

  • Version used: arch-unit-maven-plugin:3.0.2
  • OS and version: JDK17
  • Version of libs used:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant