Avoid using dollar signs in variable names

Metadata

ID: java-code-style/avoid-dollar-signs

Language: Java

Severity: Notice

Category: Code Style

Description

Avoid using dollar signs in identifiers as auto-generated names containing dollar signs ($) may lead to unexpected issues that can be difficult to diagnose.

Non-Compliant Code Examples

public class $Foo {}
public class Fo$o {}
public class Foo$ {
    String bar$ = "bar";

    public String ba$ (){
        return "baz";
    }
}

Compliant Code Examples

public class Foo { }