{"action":"created","issue":{"url":"https://api.github.com/repos/diffplug/spotless/issues/30","repository_url":"https://api.github.com/repos/diffplug/spotless","labels_url":"https://api.github.com/repos/diffplug/spotless/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/diffplug/spotless/issues/30/comments","events_url":"https://api.github.com/repos/diffplug/spotless/issues/30/events","html_url":"https://github.com/diffplug/spotless/issues/30","id":173269607,"number":30,"title":"Support license header for Java classes in default package","user":{"login":"sbrannen","id":104798,"avatar_url":"https://avatars.githubusercontent.com/u/104798?v=3","gravatar_id":"","url":"https://api.github.com/users/sbrannen","html_url":"https://github.com/sbrannen","followers_url":"https://api.github.com/users/sbrannen/followers","following_url":"https://api.github.com/users/sbrannen/following{/other_user}","gists_url":"https://api.github.com/users/sbrannen/gists{/gist_id}","starred_url":"https://api.github.com/users/sbrannen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbrannen/subscriptions","organizations_url":"https://api.github.com/users/sbrannen/orgs","repos_url":"https://api.github.com/users/sbrannen/repos","events_url":"https://api.github.com/users/sbrannen/events{/privacy}","received_events_url":"https://api.github.com/users/sbrannen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/diffplug/spotless/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-08-25T17:56:46Z","updated_at":"2016-08-26T17:25:47Z","closed_at":null,"body":"## Overview\r\n\r\nDisclaimer: I don't condone the use of the _default_ package in Java at all.\r\n\r\nHowever... having said that, we need to support test classes declared in the default package in JUnit 5. So I added a `DefaultPackageTestCase` to our test suite to verify our support for such use cases.\r\n\r\nConsequently, when Spotless is applied during the JUnit 5 builds, we now see the following:\r\n\r\n```\r\nUnable to apply step LicenseHeader to src/test/java/DefaultPackageTestCase.java: Unable to find delimiter regex ^package\r\n```\r\n\r\nSince a Java class in the default package does not have a `package` declaration, it makes sense that your regular expression would fail to find `^package`; however, just because a class exists in the default package shouldn't mean that it does not have the license header rule applied.\r\n\r\n## Proposal\r\n\r\nIf a class is in the _default_ package, consider doing one of the following:\r\n\r\n1. use a different means for determining the location of the license header file -- for example, prior to `^import `, `^/** `, or similar.\r\n1. just make sure the license header exists at the top of the document."},"comment":{"url":"https://api.github.com/repos/diffplug/spotless/issues/comments/242797769","html_url":"https://github.com/diffplug/spotless/issues/30#issuecomment-242797769","issue_url":"https://api.github.com/repos/diffplug/spotless/issues/30","id":242797769,"user":{"login":"sbrannen","id":104798,"avatar_url":"https://avatars.githubusercontent.com/u/104798?v=3","gravatar_id":"","url":"https://api.github.com/users/sbrannen","html_url":"https://github.com/sbrannen","followers_url":"https://api.github.com/users/sbrannen/followers","following_url":"https://api.github.com/users/sbrannen/following{/other_user}","gists_url":"https://api.github.com/users/sbrannen/gists{/gist_id}","starred_url":"https://api.github.com/users/sbrannen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbrannen/subscriptions","organizations_url":"https://api.github.com/users/sbrannen/orgs","repos_url":"https://api.github.com/users/sbrannen/repos","events_url":"https://api.github.com/users/sbrannen/events{/privacy}","received_events_url":"https://api.github.com/users/sbrannen/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T17:25:47Z","updated_at":"2016-08-26T17:25:47Z","body":"> there's a lot that could go wrong...\r\n\r\nAgreed.\r\n\r\nSo feel free to close this as \"won't fix\" if you like.\r\n\r\nThanks for all of your assistance!"}}
{"actor":{"display_login":"sbrannen"}}