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

Allow writing a single test case which will scan the current classpath for all @Immutable classes #44

Open
Grundlefleck opened this Issue Aug 27, 2013 · 5 comments

Comments

Projects
None yet
4 participants
@Grundlefleck
Contributor

Grundlefleck commented Aug 27, 2013

Currently, if you want to start using Mutability Detector on your project, and you already have a lot of classes marked as @Immutable, you can either:

  • use the FindBugs plugin to automatically detect them, in which case, you can't configure the assertion to suppress false positives
  • add a unit test for every class, in which case, you have to spend a lot of tedious time writing new test methods.

I would like to find a solution which offers the best of both worlds: to be able to quickly check all your immutable classes, but which still allows flexible configuration for suppressing false positives.

Currently I think we could do something where:

  • a user configures one assertion in a unit test
  • the test scans the classpath for @Immutable classes and analyses them, reporting errors from all classes
  • ... excluding classes which are being tested in another method, with custom suppressions.

This could possibly use a library like http://scannotation.sourceforge.net/ or something similar, to do the scanning. I don't know yet how this method could exclude classes which are being tested elsewhere. Perhaps we would need to get creative.

@Grundlefleck

This comment has been minimized.

Contributor

Grundlefleck commented Sep 19, 2013

@sandeater

This comment has been minimized.

sandeater commented Jul 7, 2014

Well its been a while as I've been settling into my new job and teaching basic TDD. I now have a need for this and will start looking into a solution

@neomatrix369

This comment has been minimized.

Member

neomatrix369 commented Jul 7, 2014

Sounds like a good plan! Looking forward to your participation.

On Mon, Jul 7, 2014 at 9:01 PM, sandeater notifications@github.com wrote:

Well its been a while as I've been settling into my new job and teaching
basic TDD. I now have a need for this and will start looking into a solution

@lasombra

This comment has been minimized.

Contributor

lasombra commented Dec 1, 2015

That is a very interesting issue. I know nothing about class scanning but I'm interested in giving this a try. Is that OK?

@Grundlefleck

This comment has been minimized.

Contributor

Grundlefleck commented Dec 1, 2015

@lasombra absolutely!

I know nothing about classpath scanning either, so hopefully we can learn together 😄

This entire issue may be a bit big as it's currently described. So I think a good contribution to get started would be a change to Mutability Detector where a method was available, which, when invoked, scanned the classpath and lists all the classes it finds annotated with @Immutable. Once we have that we can then start to talk about actually asserting on them, customising the assertions, etc. If you want to start even smaller, and just find something really tiny, like fixing a typo in the documentation, just to get into the swing of forking the project and issuing pull requests, that's cool too.

I see you're on the LJC's Slack. Feel free to ping me there for any questions you have in getting the project checked out, built. I don't know your level of familiarity with Java/Maven/Git etc, but no question is too basic!

lasombra added a commit to lasombra/MutabilityDetector that referenced this issue Dec 1, 2015

lasombra added a commit to lasombra/MutabilityDetector that referenced this issue Dec 2, 2015

lasombra added a commit to lasombra/MutabilityDetector that referenced this issue Dec 2, 2015

Merge remote-tracking branch 'origin/master'
* origin/master:
  Initial work on MutabilityDetector#44.

# Conflicts:
#	src/main/java/org/mutabilitydetector/classpath/ClassPathScanner.java

Grundlefleck added a commit that referenced this issue Dec 4, 2015

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