Skip to content

Paying off technical debt: almost all utility classes have a private constructor now.#2649

Merged
stefan-kolb merged 7 commits into
JabRef:masterfrom
delftswa2017:payOffTechDebt
Mar 20, 2017
Merged

Paying off technical debt: almost all utility classes have a private constructor now.#2649
stefan-kolb merged 7 commits into
JabRef:masterfrom
delftswa2017:payOffTechDebt

Conversation

@TRvanRossum

Copy link
Copy Markdown
Contributor

I also removed an unused private method. According to SonarQube scans, this removes at least five days of technical debt.

  • Change in CHANGELOG.md described
  • Tests created for changes
  • Screenshots added (for bigger UI changes)
  • Manually tested changed features in running JabRef
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)
  • If you changed the localization: Did you run gradle localizationUpdate?

@stefan-kolb

Copy link
Copy Markdown
Member

Hm, not sure if I like the addition of those constructors just to prevent the instantiation of those classes?!
As it seems this is not done anywhere anyway.
I don't see much use right now, maybe you can clarify this a bit.
Lets see what @JabRef/developers think.


private static final Log LOGGER = LogFactory.getLog(ExportAction.class);

private ExportAction() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt that this is useful here. I am sure Export Action is somewhere called

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had a look at that. ExportAction is indeed instantiated in org.jabref.gui.preftabs.PreferencesDialog, but that class has its own ExportAction class in it. PreferencesDialog also has no import for org.jabref.gui.exporter.ExportAction, so the instantiation is most likely an instantiation of the inner class.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay, good to know, seems like they are different exportActions here.
Some time ago I was working with these action classes and therefore was just crurious.

@Siedlerchr

Copy link
Copy Markdown
Member

I would have not cared about this, as it is normally pretty obvious that you should not create an object of a class which only has static methods, but it is actually recommended http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4

But I think we agreed a while ago that we focus more on fixing/implementing issues (where you can resolve some code quality issues locally) than solely on internal code quality.

PS: You could also take a look at the modernizer test output log and maybe fix some of the mentioned issues as well (I would suggest ignoring group related stuff for the moment)

@lenhard

lenhard commented Mar 17, 2017

Copy link
Copy Markdown
Member

The technical debt metrics from Sonarqube (or rather SQALE) are a little fuzzy, I would not care too much about the absolute numbers they yield ;)

Anyway, in my opinion the merge conflicts should be resolved and the PR should be merged. At least nothing breaks from adding private constructors and on the plus side @TRvanRossum fixed at least one case where one of the classes was instantiated to call a static method. Some bracketing improvements are in there as well.

@TRvanRossum

Copy link
Copy Markdown
Contributor Author

The merge conflicts should be solved now.

@stefan-kolb stefan-kolb merged commit 4ff55d0 into JabRef:master Mar 20, 2017
stefan-kolb added a commit that referenced this pull request Mar 20, 2017
stefan-kolb added a commit that referenced this pull request Mar 20, 2017
stefan-kolb added a commit that referenced this pull request Mar 20, 2017
… have a private constructor now. (#2649)" (#2670)"

This reverts commit 73f7052.
stefan-kolb added a commit that referenced this pull request Mar 20, 2017
Siedlerchr added a commit that referenced this pull request Mar 25, 2017
* upstream/master:
  Localization: General: French: Translation of new entries
  Localization: Menu: French: Translation of an entry (#2685)
  Fix #2680 and fix #2667: Swing errors are catched properly and without freezing (#2681)
  Do not log AND throw
  Replace misleading error message for fetcher connection error
  Document CrossRef test
  Fix subtitle detection for CrossRef fetcher
  Revert "Invoke LogMessages.add in JavaFX thread"
  Use global user agent
  Update mockito from 2.7.17 to 2.7.18
  Move GuiAppender to GUI package
  Invoke LogMessages.add in JavaFX thread
  [WIP] Put the PDFAnnotationImporter under Test, enhance FileAnnotationTab (#2640)
  Fix for "Paying off technical debt: almost all utility classes have a private constructor now." (#2672)
  Revert "Paying off technical debt: almost all utility classes have a private constructor now. (#2649)" (#2670)
  Paying off technical debt: almost all utility classes have a private constructor now. (#2649)
  Changed codeformatting for better fxml annotation (#2668)
  Disalbe Google Scholar tests on all CI environments (#2654)
  Fix JSONException in Crossref fetcher as mentioned in #2442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants