(#) Code contains easter egg !!! WARNING: Code contains easter egg This is a warning. Id : `EasterEgg` Summary : Code contains easter egg Note : **This issue is disabled by default**; use `--enable EasterEgg` Severity : Warning Category : Security Platform : Any Vendor : Android Open Source Project Feedback : https://issuetracker.google.com/issues/new?component=192708 Affects : Gradle build files, Kotlin and Java files, manifest files, property files and resource files Editing : This check runs on the fly in the IDE editor Implementation : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/CommentDetector.java) Tests : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/CommentDetectorTest.java) Copyright Year : 2012 An "easter egg" is code deliberately hidden in the code, both from potential users and even from other developers. This lint check looks for code which looks like it may be hidden from sight. (##) Example Here is an example of lint warnings produced by this check: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text src/test/pkg/Hidden.java:5:Warning: Code might be hidden here; found unicode escape sequence which is interpreted as comment end, compiled code follows [EasterEgg] /* \u002a\u002f static { System.out.println("I'm executed on class load"); } \u002f\u002a */ ------------ src/test/pkg/Hidden.java:6:Warning: Code might be hidden here; found unicode escape sequence which is interpreted as comment end, compiled code follows [EasterEgg] /* \u002A\U002F static { System.out.println("I'm executed on class load"); } \u002f\u002a */ ------------ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is the source file referenced above: `src/test/pkg/Hidden.java`: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~java linenumbers package test.pkg; public class Hidden { // Innocent comment...? /* \u002a\u002f static { System.out.println("I'm executed on class load"); } \u002f\u002a */ /* \u002A\U002F static { System.out.println("I'm executed on class load"); } \u002f\u002a */ /* Normal \\u002A\U002F */ // OK static { String s = "\u002a\u002f"; // OK } // STOPSHIP /* We must STOPSHIP! */ String x = "STOPSHIP"; // OK } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can also visit the [source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/CommentDetectorTest.java) for the unit tests for this check to see additional scenarios. The above example was automatically extracted from the first unit test found for this lint check, `CommentDetector.testJava`. To report a problem with this extracted sample, visit https://issuetracker.google.com/issues/new?component=192708. (##) Suppressing You can suppress false positives using one of the following mechanisms: * Using a suppression annotation like this on the enclosing element: ```kt // Kotlin @Suppress("EasterEgg") fun method() { TODO(...) } ``` or ```java // Java @SuppressWarnings("EasterEgg") void method() { TODO(...); } ``` * Using a suppression comment like this on the line above: ```kt //noinspection EasterEgg problematicStatement() ``` * Adding the suppression attribute `tools:ignore="EasterEgg"` on the problematic XML element (or one of its enclosing elements). You may also need to add the following namespace declaration on the root element in the XML file if it's not already there: `xmlns:tools="http://schemas.android.com/tools"`. * Using a special `lint.xml` file in the source tree which turns off the check in that folder and any sub folder. A simple file might look like this: ```xml <?xml version="1.0" encoding="UTF-8"?> <lint> <issue id="EasterEgg" severity="ignore" /> </lint> ``` Instead of `ignore` you can also change the severity here, for example from `error` to `warning`. You can find additional documentation on how to filter issues by path, regular expression and so on [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html). * In Gradle projects, using the DSL syntax to configure lint. For example, you can use something like ```gradle lintOptions { disable 'EasterEgg' } ``` In Android projects this should be nested inside an `android { }` block. * For manual invocations of `lint`, using the `--ignore` flag: ``` $ lint --ignore EasterEgg ...` ``` * Last, but not least, using baselines, as discussed [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).