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

2.x: eliminate all anyonymous inner classes #5150

Closed
akarnokd opened this issue Mar 3, 2017 · 6 comments
Closed

2.x: eliminate all anyonymous inner classes #5150

akarnokd opened this issue Mar 3, 2017 · 6 comments

Comments

@akarnokd
Copy link
Member

akarnokd commented Mar 3, 2017

Currently, mostly the base reactive classes have been cleared of anonymous inner classes. Still, many stacktraces contain SomeClass$1$2 that makes it difficult to figure out what that exact component was without having an IDE open.

I don't know if IDEs allow searching for anonymous inner classes and/or highlight them like warnings, thus the a reasonable way would be to scan the build directory for files containing the $ pattern.

In addition, if there is an agreement, a new style-validation unit test could be added that does the same scanning at unit test time (ignoring SomeClassTests) and warning/failing the build if any of such files was found.

PR welcome.

@MyDogTom
Copy link

MyDogTom commented Mar 3, 2017

IntelliJ has "search structurally" function with predefined search for anonymous classes (search structurally -> copy existing template -> anonymous classes)
Also it's possible to create inspection from search. See Preferences -> Editor -> Inspections -> General -> Structural Search Inspection

@akarnokd
Copy link
Member Author

akarnokd commented Mar 4, 2017

Thanks. It shows about 115 places under src/main/java.

@SleimanJneidi
Copy link
Contributor

Hey guys, the issue is tagged with "PR welcome", so `i started working on it and removed all of them. Getting test errors due to naming violations. Early feedback is appreciated. https://github.com/SleimanJneidi/RxJava/tree/remove-anonymous-inner-classes

@akarnokd
Copy link
Member Author

akarnokd commented Mar 8, 2017

Hi and thanks for tackling this. See #5159 where I can comment on specific issues.

@akarnokd
Copy link
Member Author

akarnokd commented Mar 8, 2017

Looks like there are a bunch of copy-paste errors and the test hangs due to some unexpected code changes. I suggest you start over piece by piece and verifying after each java file the tests still pass.

@akarnokd
Copy link
Member Author

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants