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

WIP: Improve reversibility #7469

Closed
wants to merge 694 commits into from
Closed

Conversation

antalk2
Copy link
Contributor

@antalk2 antalk2 commented Feb 26, 2021

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.

Updated to reflect changes in fix-7454
This is not finished.
Please comment if you feel some of the changes go in the wrong direction.

@calixtus
Copy link
Member

Hi @antalk2, thanks so far for your efforts you put in this PR.
However, I think you probably misunderstood me in the other PR. By "one feature issue per commit", I meant something like "Fixed reviewdog suggestions" to collect all the changes that were close connected by topic and time of change, not 4 times "reviewdog" after each other commit for every single change.
Note that you can modify the last committed change by amending it an recommitt.
Please also try to write "good commit messages"
https://www.freecodecamp.org/news/writing-good-commit-messages-a-practical-guide/ .

antalk2 added 27 commits March 2, 2021 23:07
Also: extract common part: insertNamedTextContent
Problem was:
- Turn Settings/Automatically sync.. off on OO/LO panel
- Select an article, Click Cite
- The reference mark created was empty.

It turned out, that in OOBibBase.insertReferenceMark
position.setString(citText); failed to set the text.

Solution was: create a new cursor and use that.
@antalk2
Copy link
Contributor Author

antalk2 commented Mar 8, 2021

At the commit
41507ce
I think I finished the first set of large-scale modifications.

The code should work and conform to the style checker.

There are some known bugs, at this point in TODO comments,
later moved to OOBibBase.org for easier review and categorization.

Currently I am trying to solve some of the bugs and separate
the code handling the data (reference marks, pageInfo) from
the parts that fill in the citation marks and bibliography.

Questions about the Bibliography

  • The handling of bibliography is inconsistent in whether
    the start of the bibliography is marked by a bookmark, or by
    the start of a section.

  • Personally, I would prefer not to create a section, because

    • (1) those who know how to handle it can create it easily,
      those who do not know are forced into more obscure parts of LO
      if want to remove it.

    • (2) While a distinct section is useful if one wishes to change for
      example the number of columns, it also interferes with a style
      where the body of a two-column article is directly followed
      with the references.

      | a | c    |
      | b | refs |
      
  • On the technical side:

    • The name of the bibliography section does not survive an
      (odt->docx->odt) conversion.

    • From the code I have the impression, that we probably moved from
      bookmarks to reference marks, and at Zotero I also found a comment
      that bookmarks are considered fragile ("may cause errors if
      accidentally modified"). I may be missing something here.

The questions are:

  1. What to use to mark the start or the range of the bibliography?
  • bookmark
  • reference mark
  • comment (not implemented)
  • section

I would choose bookmark now, (with maybe giving an option
for autocreating the section for backward compatibility)

  1. When creating and when refreshing the bibliography, its title
    is created and recreated. The only way to change the title
    permanently is to copy-edit-select a new style.

    I think creating it initially, but not overwriting on refresh
    would be a more friendly solution.

    On the other hand this goes against the philosophy of "select a
    journal, and we will adjust the bibliography to it"

    The question is: who owns the title? The style, or the user?
    Should we give a choice in Settings?

Citations: Reference marks or bookmarks (or something else)

A weak point of reference marks marking citations is that in LO
Copy-Paste loses the reference mark on the copy.

On the other hand bookmarks survive (the copy gets a new name with a
number appended), potentially allowing us to reestablish the connection.

Comments and invisible markup also survive, but probably take more time
to recover from the text.

Was: Merge losing connection to pageInfo

  • Proposed change was: Unmerge LO citations #7455

    • A solution could be to encode the number making the originals
      unique in the merged name: in stead of
      "JR_cite_1_XX2000a,YY2010" it would be e.g.
      "JR_cite_1_XX2000a,1_YY2010".

    • Apart from

      • construction and
      • parsing,
      • probably marking (or calculating) the originals as "in use" for
        getUniqueReferenceMarkName() would be needed.

This seems doable, even with some level backward compatibility
(recognizing old style marks and upgrading them)

What I am worried about is: if we repeatedly change the representation,
the compatibility with multiple old variants may become hard to manage.

When should I start a new branch?

At the commit mentioned above: we have the code reorganized, mostly
moved around, in and out of functions without a change of the logic
behind. What comes next is: resolving some more bugs and an attempt at
centralizing the management of how we store data in the document (in
hope of allowing for easier change or reresentation later).

Shall I start a new branch somewhere about there?

Other: OOBibBase.org is probably not where you would want it to be in
the main repository (if anywhere), only included
in case you want to look at the details

@calixtus
Copy link
Member

Can you please stop? This PR is totally loosing focus on the issue. It seems that you refactor files that are not directly linked to the original issue. It will not be possible to review this PR anymore.

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

This is a hard one. Some first, minimal comments.

We have some "minimum coding guidelines".

Could you please re-iterate on https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace?

It seems that the IDE used was not configured. Thus, checkstyle will fail.

* pageInfo for this citation, provided by the user.
* May be null, for none.
*/
String getPageInfoOrNull();
Copy link
Member

Choose a reason for hiding this comment

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

Do not return null. Use Optional.

Copy link
Member

Choose a reason for hiding this comment

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

Applies to the complete class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@@ -16,14 +16,17 @@

public class StyleLoader {

public static final String DEFAULT_AUTHORYEAR_STYLE_PATH = "/resource/openoffice/default_authoryear.jstyle";
public static final String DEFAULT_NUMERICAL_STYLE_PATH = "/resource/openoffice/default_numerical.jstyle";
public static final String DEFAULT_AUTHORYEAR_STYLE_PATH =
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice if you reformated changed code only.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree.

The question of long lines comes back repeatedly.
I have 106 characters of horizontal space (about half width of the screen), and tend to break lines that are longer.
Idea would provide at most 183 (full screen, side bars closed), unless I find a smaller font.
The style rules seem to prefer long lines, and indeed, there are many above 100,
some even above 300. I was wondering how people manage to read those.

Are "fit-to-width" PRs something like the project would consider?
If yes, what would be a targeted limit on line length?
This may also raise: where to break.

Choose a reason for hiding this comment

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

I was wondering how people manage to read those.

I scroll 😛
Are you asking about 'soft-wrap'? Screen-shot is from Intellij
Skärmavbild 2021-04-23 kl  15 45 55

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is possible. Breaking at white space instead of at the character at the edge of the window
helps somewhat, but still destroys the "visible indentation suggests code structure" effect.
My guess was they do no split their windows vertically, as Idea and probably other
IDEs put compilation results at the bottom under a horizontal split.

Copy link
Member

@k3KAW8Pnf7mkmdSMPHz27 k3KAW8Pnf7mkmdSMPHz27 Apr 23, 2021

Choose a reason for hiding this comment

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

"visible indentation suggests code structure" effect.

I am not sure what you are referring to, first of all

  1. are you using Intellij?
  2. does the below settings help?

Skärmavbild 2021-04-23 kl  16 56 50

they do no split their windows vertically, as Idea

"Idea" = IntelliJ IDEA? I split mine both horizontally and vertically o.O

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. are you using Intellij?

No. Not to edit code.

  1. does the below settings help?
    I am not sure what you are referring to, first of all

It seems you guessed correctly.
These settings improve the results by not destroying the outline.
This makes it more understandable why Intellij IDEA users seem to care less
about keeping a limit on their line lengths.

What it seems to miss when compared to hand-edited
breaks is a preference to break at higher points in the parse tree.
For example breaking between arguments of the outer call, not within.

Choose a reason for hiding this comment

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

For example breaking between arguments of the outer call, not within.

Indeed. I don't know of any options for this within Intellij.

encoding);

OOBibStyleParser.ParseLog parseLog = newStyle.getParseLog();
if ( parseLog == null ) {
Copy link
Member

Choose a reason for hiding this comment

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

It seems that the IDE used was not configured according to https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace. Thus, checkstyle will fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does each commit have to pass checkstyle?
I hoped it is enough to check from time to time, and before PRs.

Choose a reason for hiding this comment

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

Each commit doesn't have to pass Checkstyle, but it becomes easier to review if they pass or are close to passing Checkstyle. Is there anything except the line-wrapping issue that discourages you from using the default settings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there anything except the line-wrapping issue that discourages
you from using the default settings?

I assume "default settings" above refers to "checkstyle with JabRef
settings". I am using those now, through a call to checkstyle with JabRef
settings in my Makefile before "gradlew build". Earlier I was relying
on visits to Intellij IDEA to check from time to time, and by regularly
postponing this I collected many non-confirming spaces.

the line-wrapping issue

This appeared in two situations.

One is when I formatted code in order to read it.
Now I removed many (all?) of those.

I understand it is not a good idea to mix formatting with actual changes,
and often separated these into "format" and "fit-to-width" commits.
But these were still interspersed with actual changes.

This is why I asked about "fit-to-width" PRs: these would separate
code formatting and code changes. So far my impression is that
these are considered unnecessary among the people here,
probably because -- as you have shown above -- it is less of a problem
for Intellij IDEA users. Unfortunately I am not ready to switch to it.

The other situation is with new or changed code:

class X {
    public static  //x
    ALongDescriptiveNameOfATemplate<ALongParameter, AndOfcourseAnAnotherOne> //x
    descriptiveMethodName( //x
        LongParameterType firstParameter,
        Another secondParameter) {
   }
}

my impression is that none of the line breaks marked with //x are
considered OK (even if checkstyle accepts some of them). Taken together,
they can result in long lines, like this:

class X {
    public static ALongDescriptiveNameOfATemplate<ALongParameter, AndOfcourseAnAnotherOne> descriptiveMethodName(LongParameterType firstParameter,
                                                                                                                 Another secondParameter) {
   }
}

On the question of independent PRs: although I could point to some
changes that could be considered for thematic splitting, these are small when
compared to a large body of restructuring. (I removed changes to the *.jstyle parser
as well as changes outside openoffice directories (except JabRef_en.properties)).

GUI changes: there are no changes to the OO Panel or other parts of
the normally visible GUI.

Changes to gui-related code consist so far basically of

  • (g1) replacing series of calls to OOBibBase by a single call (moving
    detailed knowledge of OOBibBase working from GUI stuff to an
    OOBibBase method dedicated to the given GUI function)

  • (g2) catching more exceptions (with associated display of warning
    dialogs)

  • (g3) checking more preconditions (with associated display of warning
    dialogs).

OO interface changes: What is changed as seen by the user in Libreoffice?

  • (o1) unresolved citations are not thrown away, they get an
    "Unresolved(citationKey)" representation in the text (unless using
    numbered citations) and they also get a bibliography entry with a
    similar content

  • (o2) these bibliography entries now contain clickable
    cross-references pointing to the corresponding citation groups in
    the text.

  • (o3) GUI actions now wrapped into OO Undo groups, so their effects
    can be undone with a single click (except those affecting pageInfo in
    custom properties)

  • (o4) parts of GUI actions are wrapped into "disable screen
    refresh" which reduces flashing. The exception is the part
    deciding "visual order", which relies on asking the position of the
    text view cursor.

  • (o5) more careful sorting of footnote markers now allows Merge to
    more reliably discover consecutive citation groups in footnotes.

  • (o6) citation groups with no intervening space can now be merged

  • (o7) Even with Settings/Automatically sync.. off, leave recognizable marks

    Problem was:

    • Turn Settings/Automatically sync.. off on OO/LO panel
    • Select an article, Click Cite
    • The reference mark created was empty.

    It turned out, that in OOBibBase.insertReferenceMark
    position.setString(citText); failed to set the text.

    Solution was: create a new cursor and use that.

OOBibStyle changes:

  • (j1) (Removed parser changes. Note: the parser does need changes:
    silently ignoring user input the parser does not understand, providing
    no warning on mistyped keys, like for example
    BibtexKeyCitations (as appears in the official exemples:
    jabref/src/main/resources/resource/openoffice/default_authoryear.jstyle,
    jstyles.jabref.org-master/turabian-english.jstyle,
    jstyles.jabref.org-master/turabian-deutsch.jstyle
    and jstyles.jabref.org-master/remoteSensingOfEnvironment.jstyle)
    instead of the expected BibTeXKeyCitations,
    inheriting settings from a previous parse, ignoring changes if
    they only affect the LAYOUT section make it a nightmare
    figuring out why some changes to the style have no effect)

  • (j2) xxxMarkupBefore xxxMarkupAfter

    *.jstyle now allows insertion of markup before and after a citation group
    as well as some of its parts

    implemented
    CitationGroupMarkupBefore and CitationGroupMarkupAfter
    AuthorsPartMarkupBefore and AuthorsPartMarkupAfter
    AuthorNamesListMarkupBefore and AuthorNamesListMarkupAfter
    AuthorNameMarkupBefore and AuthorNameMarkupAfter

    This was an opportunistic extension, allowed by "Most text we emit
    into the document handled as OOFormattedText". The latter was needed
    for proper handling of italicization of "et al.", that is doing it
    (using markup) when creating the citation marker, not heuristically
    by search-and-edit EtAlString when inserting.

Of these

  • (g1) and (g2) are part of the restructuring.
  • (g3) and (o3) were implemented to help during testing-by-hand
  • (o4) was not necessary for testing. It just follows a similar pattern as
    the Undo part and I happened to find the corresponding API in the OO docs.
  • (o5) In principle could have been left out. The hypothesis about
    what could be the problem (why citation groups in footnotes are not
    merged) of course came from the effort to understand what does the
    code do. I could have left it as a hypothesis with some notes on
    what do I think, and why, and which parts of the code should be
    changed to attempt a solution. And after the extra effort to create
    these notes, then let's say a month later, I could scratch my head what was I
    thinking and where are those parts now. As time goes, I do forget things,
    so it is time to locate and reread the corresponding code ... Doing things
    the administratively appropriate way, while it has its virtues,
    may result in losing the opportunity to do them at al.

Choose a reason for hiding this comment

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

I assume "default settings" above refers to "checkstyle with JabRef settings".

Yup, sorry about the confusion.

So far my impression is that these are considered unnecessary among the people here,

You are right.

Taken together, they can result in long lines, like this:

Unfortunately, I'd suggest going with the long lines even if they aren't always enforced by Checkstyle.

This is why I asked about "fit-to-width" PRs: these would separate code formatting and code changes.

In practice, when reviewing a PR I'd be using the Files changed tab in the PR and it easily becomes "cluttered" if I happen to look at a commit that is "fit-to-width".

On the question of independent PRs: although I could point to some changes that could be considered for thematic splitting, these are small when compared to a large body of restructuring.

Can they be split without the larger body of restructuring? Even (g1), (g2), (g3), and (o3) seem like a large PR in itself but it would allow us to better understand what you are changing and why in a more incremental way. Frankly, even (g2) by itself could be considered a good contribution.

Copy link
Member

@Siedlerchr Siedlerchr May 1, 2021

Choose a reason for hiding this comment

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

The reason why CitationEntry is in logic is, is just simply the fact that nobody moved it to a specific model package.
There is simply no org.jabref.model.openoffice.
The name itself is fine.
Regarding UNO:
https://api.libreoffice.org/ (see examples and IDL apidoc)

I had spent some time with the JabRef OO stuff and also the UNO stuff in general (some LO macros)

And https://wiki.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide
Although it's from OO the general concepts still apply to LO and the usage in JabRef. You can skip the part of the connection to LO because that's a topic on its own which is not relevant.

Copy link
Member

@k3KAW8Pnf7mkmdSMPHz27 k3KAW8Pnf7mkmdSMPHz27 May 1, 2021

Choose a reason for hiding this comment

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

Options? Email?

An up to date PR but expect the first comments to be about adhering to the codestyle, e.g., try not to abbreviate names. It is to make it easier to understand and review.

Choose a reason for hiding this comment

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

like separating oostyle

I don't feel that I understand your goal well enough. Perhaps it will become clearer what class belongs where soon (it is not necessarily always clear-cut).

How they relate to "Catch and wrap all API exceptions". Where should we do that?
...
Is threading up everything
in distinct exception types a good thing?

It depends. Many of those exceptions seem to indicate that there is an exception that will prevent what the user is trying to do from happening and therefore should show an error (i.e., it isn't enough with logging it and doing something else).
I'll try to keep an eye out for good examples.

Or should we collect them to some more generic types derived from JabRefException?

Mostly not, but there are some examples of where it's done, ShortDOIServiceException, FetcherException, etc.

In one reading all is well, OOPanel catches (tries to catch) everything, thus JabRef proper
is not exposed to these. In another reading it is all wrong.

I'd guess that is good enough for most of the exceptions, at least for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

on CitationEntry

Context

You are not missing anything. It is not intended to be private to
openoffice. You are expressing the class' concern/responsibility
(logic) and use (openoffice) already. Other parts of JabRef can depend
on logic/openoffice if it is needed in the future.

https://devdocs.jabref.org/getting-into-the-code/high-level-documentation

The model represents the most important data structures
(BibDatases, BibEntries, Events, and related aspects)
and has only a little bit of logic attached.
The logic is responsible for reading/writing/importing/exporting and manipulating the model,
and it is structured often as an API the gui can call and use

Looking at it I am not sure why CitationEntry is in logic/openoffice instead of model/openoffice.

For example, CitationEntry, with its fairly generic name was in
logic/openoffice (now in logic/oostyle (? this looks wrong, I'll move it back)).
Its sole purpose is to pass some data from

What else would you call it?
It is imported as

import org.jabref.logic.openoffice.CitationEntry;

which, in my opinion, makes it quite specific even if the class name is generic.

The reason why CitationEntry is in logic is, is just simply the fact that nobody moved it to a specific model package.
There is simply no org.jabref.model.openoffice.
The name itself is fine.

Notes

It is not intended to be private to openoffice.

Other parts of JabRef can depend on logic/openoffice if it is needed in the future.

The model represents the most important data structures

What else would you call it?

Let's review what is it, and what is it used for?

What is it

public class CitationEntry implements Comparable<CitationEntry> {

    private final String refMarkName;
    private final Optional<String> pageInfo;
    private final String context;
    [...] // getters, setters, Comparable<CitationEntry> implementation based on refMarkName
}
  • refMarkName : on return from the gui allows to find the citation group the pageInfo belongs to.
    In the near future it needs to be extended to refer to citations, since pageInfo will be associated
    to citations, not citation groups. A bit further in the future (not part of the current changes)
    reference marks may be replaced with bookmarks, or possibly Comments which can also be listed
    in the LibreOffice Navigator panel, but (I think) do not have names, or, to promote
    interoperability and easy editing they may be replaced
    with a textual representtaion similar to what JabRefConverter does (also nameless).

    To minimize changes I kept refMarkName here, but it basically stands for CitationGroupID.
    To refer to citations CitationPath is used elsewhere.

    As long as we need to handle old-style (pageInfo for citationGroups) documents
    in ManageCitationsDialog we need to support both variations.

  • pageInfo : the only thing that ManageCitationsDialog allows to change

  • context : a piece of text from the the document: the text of the citation marker
    with up to 30 characters on each side. Changing to pageInfo-for-citations will need
    a change here: "text-before [1-7] text-after" does not tell the user to which of the 7 sources
    does this pageInfo belong to. This also applies to Author-year citations.

Based on this, I would argue that

  • CitationEntry is not in any sense among the "the most important data structures"
  • I do not see a future where any part of JabRef outside openoffice, or indeed, any part
    inside openoffice apart from those implementing
    ManageCitationsDialog would want to use this class.
    It represents a collection of data for a very particular purpose.

On naming: the only thing that ManageCitationsDialogView allows is:
edit pageInfo records. It could possibly be extended with a
"link-to-location-in-the-document", and sorting (by cited source / by
document order). To do more (what actually?) would probably require
further dialogs, or at least a major revision of the current GUI.

I am not even sure that ManageCitationsDialog (or, to reflect what
it does, "PageInfoEditor") is the right direction. Both Jabref and
LibreOffice GUIs are built with a "the whole screen is mine" mindset,
(even the 2nd demo gif here
struggles showing them together).
It is probably best if we try to minimize the number of required
switches between them. Although ManageCitationsDialog is a dialog with its
own window, so it might fit on the same screen as LibreOffice,
its "parallel" use with LibreOffice is limited,
because it shows a snapshot of the document: if the user edits the text (he
cannot do much, but may remove some citation groups), the state in
ManageCitationsDialogView becomes outdated (it is unavoidable, unless
we can hook into LibreOffice to "let me know when this reference mark
is deleted", or start polling). If textual representation (similar to
JabRefConverter's, but extended to include pageInfo) comes around, the
PageInfoEditor functionality may probably better served by that: it
would make moving or copying citations between locations as well as
editing the pageInfo parts a more natural experience for
users of LibreOffice, as opposed to opening extra dialogs from an external
program (JabRef) for these purposes.

Clickable links to the list of citation groups (reference marks) are already provided
by the LibreOffice Navigator (we could add bookmarks for the discovered textual parts, too).
We could add links from the bibliography entries
to the citation groups containing citations of a given source (an exploratory version
of this is in the code, only shown for Unresolved sources to stay close to the earlier
output in the normal case).

Summary

  • CitationEntry is unlikely to be of interest outside its current use
    (passing around a collection of data collected for ManageCitationsDialog)

  • Depending on the future of ManageCitationsDialog
    it may need modifications to serve the extended purpose or may become
    unused if in-LibreOffice solutions make ManageCitationsDialog unnecessary.

  • Naming CitationEntry: something like ManageCitationsDialogEntryData.
    (there is also "CitationEntryViewModel.java" in gui/openoffice).

separating oostyle

like separating oostyle

I don't feel that I understand your goal well enough.
Perhaps it will become clearer what class belongs where soon (it is not necessarily always clear-cut).

The direct goal is separation of concerns.

oostyle: given a .jstyle, a list of citation groups (in order of
appearance) and a list of citations (citation keys) in each group,
and access to some BibDatases, produce citation
markers for these groups and a bibliography according to the style. It needs to communicate
formatting instructions, uses OOFormattedText for this purpose.

In principle this functionality does not depend on if we use LibreOffice,
OpenOffice, MS Word, or generate a HTML page, as long as we can feed it the necessary data,
and interpret the markup it produces into the target.

It might also produce cross-references between citations and bibliography entries
by including links in the markup.

I expect CSL does something like this (style+citations and cites to markup) as well.

logic/openoffice contains a mixture of:

  • (1: backend) how do we store/retrieve locations of
    the citation groups (reference marks) and list of citations
    belonging to them (reference mark names) and associated data
    (citep,citet,nocite) in reference mark names, pageInfo in
    user-defined document properties), as well as how do we find the
    taxt range containing the bibliography for refresh.
  • (2: OOFormattedText interpreter) the markup received from oostyle needs to be interpreted
    into the locations the backend points to.
  • (3) methods to be called from GUI. Those that change the document need to communicate to the backend.

So oostyle is a part that might be of interest in other contexts.
Correspondingly its main data structures could probably move to "model/oostyle".

From logic/openoffice it is harder to pick.

DocumentConnection is not really a data structure. It is basically an
XTextDocument with some of its relations and interfaces cached in its
other fields. Just as we do it in the constructor, we could always
get them starting from the XTextDocument. The rest is mainly a
collection of methods, some of them already static, others use the
XTextDocument and/or the cached values, but could be made static by
adding an XTextDocument argument. And it has a LOGGER.

OOUtil is mostly concerned with interpreting OOFormattedText into
an OpenOffice or LibreOffice writer document (insertOOFormattedTextAtCurrentLocation2)

It has a small counterpart within oostyle/OOFormat.java : setLocale, setCharStyle, and paragraph
wrap an OOFormattedText into the corresponding tags. Most of the markup comes
from the layout and other options from the jstyle.

The rest of logic/openoffice seems more or less specific to either the backend or the gui,
with OOFrontend in between. I expect to move more support-the-gui code
from OOBibBase here. RangeSortVisual provides the "order of appearance" of
citation groups needed by oostyle. RangeKeyedMapList might possibly be replaced
by or reimplemented using a MultiMap from elsewhere.

abbreviations in names

e.g., try not to abbreviate names.

It says: "try not to abbreviate names of variables, classes or methods"

  • The general principle, as I saw before was closer to: try not to abbreviate global names.
  • The hard part is: what is the expected balance between avoiding unnecessary verbosity
    that just clutters the code and cryptic (or well-known?) abbreviations
    (like awt, fxml, slf4j, cli, gui, i (in StringInt),
    CSLType, RisMonth, AuthorLF_FF, JabRef :). Unfortunately "cryptic"
    depends on who is seeing it, with what background and which state of mind
    (as in looking at ones' own code a year later).
  • Below try not to abbreviate names
    I find catch (IOException ioe) in an official example. This suggests
    that local variables are probably exempt.
    IOException itself contains an abbreviation, and is a globally used name.

My filenames (and corresponding classnames) are usually
not abbreviations (except the "OO" prefix already in use before,
Compat (would it be more expressive as Compatibility?)
How does it relate to contractions in
"the most important data structures (BibDatabases, BibEntries, ...)",
getPrefsNodeForCustomizedEntryTypes, ParamLayoutFormatter?

  • Seeing for (LayoutFormatter anOption : option) { reveals that the name option
    refers to a collection of things with type LayoutFormatter.
    These are named anOption which contributes nothing to my understanding. Nor would it
    help if we called it aLayoutFormatter or theCurrentLayoutFormatter

  • My local variables and argument names often are abbreviated: for example CitationGroup cg.
    Replacing cg with citationGroup is about as useful as
    changing IOException ioe to IOException ioException:
    adds nothing to what we already know from the verbose typename.

I will probably need more explicit examples of which abbreviations
should I expand. I, of course understand them (for now), but it is hard to guess
which ones could appear confusing or cryptic to others, or even myself at another time.

Choose a reason for hiding this comment

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

I will probably need more explicit examples of which abbreviations
should I expand. I, of course understand them (for now), but it is hard to guess
which ones could appear confusing or cryptic to others, or even myself at another time.

Not all JabRef code is up to date, there are unfortunately still parts of the code where the standard is lower than we'd like it to be. When it comes to AuthorLF_FF and some other artifacts of Authors.java/BracketedExpression, they are a mix of code that should be refactored, but no one has had the time to do so, and names/commands that the user is expected to manually enter within JabRef or in an external text editor, without autocompletion, type safety, etc. They probably would have been named differently if they were created today.

Imho https://github.com/antalk2/jabref/blob/improve-reversibility-rebased-03/src/main/java/org/jabref/logic/openoffice/Backend52.java#L236-L240

CitationGroup cg = new CitationGroup(cgid,
                                                 sr,
                                                 itcType,
                                                 citations,
                                                 pageInfo);

and similar would be helpful (to me) if they were expanded.

Generally speaking, I'd make a separation between what I'd consider ok in a draft-PR and what I'd consider ready to merge, and I'd still try to err on the side of expanding names, as opposed to abbreviating them. I can't say that I have never written IOException e but I probably should at least have done IOException exception 😬

@koppor
Copy link
Member

koppor commented Apr 12, 2021

May I ask about the time frame of working on this? How much time do you have to work on this and until which date you want to be finished completely?

Some software engineering comments:

  • documentation should go to docs/.
  • JabRef team works asynchronously without dailies or weeklies.
  • We like code refactorings
  • We also like to have a chance to review things 😇

  • Proposal:
    • Start a new branch based on main whenever you can
    • If you cannot, please create branches A, B, C; where A is based on main, B is based on A, C is based on B.
    • A, B, C cover "small" topics, but are dependent on each other.
    • Create a PR on A (to main) first
    • Let us review A
      • reviewing includes putting comments on that
      • we ask for addressing the comments
    • Work on suggestions on A
    • If A is merged, rebase B on A
    • Submit a PR on B (to main)

Please get back to us if the text was not understandable.

@antalk2
Copy link
Contributor Author

antalk2 commented Apr 13, 2021

May I ask about the time frame of working on this?
How much time do you have to work on this and until which date you want to be finished completely?

I was wondering about that, too.

What is done, and what is missing

The issue is: loss of pageInfo upon (Merge,Separate)

To solve this, started to distinguish CitationGroup and Citation
(These are close to what CSL terminology calls "citation" and "cite")

Using these terms, the problem is, that JabRef5.2 associates pageInfo to CitationGroups
which are dissolved on a Merge. Consequently "Separate" cannot reliably recreate them.

This is partly hidden by the fact, that Merge does not clean up, it leaves the pageInfo values
associated to the dissolved groups (which could have one or more Citations) around, so
a Merge/Separate cycle starting from individual citations is recovered.

The proposed solution is: move pageInfo from CitationGroup to Citation.

This raises questions about backward compatiblity

  • We probably want the new version to be capable of opening files saved by the old one.
  • Details of a representation upgrade

To minimize duplication, now both CitationGroup and Citation have pageInfo fields,
the backend deciding which of these are to be used.

We have Backend52, collecting code that behaves differently between versions.

  • Missing: Backend53

To establish context for Backend53, the rest has to be able to handle the corresponding
changes:

  • On the presentation side, OOBibStyle getNumCitationMarker and getCitationMarker
    has to handle the pageInfo for each citation: they do now.

    • Missing: ManageCitationsDialog expects citation groups, now has to
      handle citations.
      • CitationEntry is only used for communication between ManageCitationsDialog
        and OOBibBase (both in 'gui'), I propose to move it from 'logic' to 'gui'.
  • Rewriting OOBibStyleParser should go into another branch
    (calixtus probably referred to that and related changes).

Summary

I think ManageCitationsDialog and Backend53 are the main missing
parts. Then conversion between new and old, and a place in the GUI to
actually request (or acknowledge if upgrade is not optional) the change.

Some software engineering comments:

* documentation should go to [`docs/`](https://github.com/JabRef/jabref/tree/main/docs).

Are you referring to the comments in example_style_file.jstyle or
those in *.java?

* JabRef team works asynchronously without dailies or weeklies.
  • Do you mean I should not push until I think it is ready?
    • I do not see the Maintainer interface, and did not expect
      maintainer alert before sending a new PR.
* We like code refactorings
* We also like to have a chance to review things
* Proposal:

  * Start a new branch based on `main` whenever you can
  * If you cannot, please create branches A, B, C; where A is based on main, B is based on A, C is based on B.
  * A, B, C cover "small" topics, but are dependent on each other.
  * Create a PR on A (to main) first
  * Let us review A
    * reviewing includes putting comments on that
    * we ask for addressing the comments
  * Work on suggestions on A
  * If A is merged, rebase B on A

The "rebase B on A" confuses me. Does it mean "rebase B on (main after
A merged)" or (rebase B on last state of A)?

  * Submit a PR on B (to main)
  • Probably the A,B,C variant applies.
  • The cover "small" part. In the actual situation, I guess it means to go back to
    an earlier state "A". Do you mean to go back to the last WIP PR, or
    just before rewriting OOBibStyleParser, or some place between?
    • Technically, how to apply this in the current situation?
      • Have: "improve-reversibility" branch
        • Choose point "A", create branch A from there
        • rebase branch A on main (then cleanup, PR)
        • Is this correct?

Please get back to us if the text was not understandable.

  • on Optional: a plugin in idea suggested not to put Optional into
    class fields. Should I change those fields to nullable,
    or keep them as Optional?

@tobiasdiez
Copy link
Member

Another idea for the review process would be that you finish the code (on the current branch). Then extract changes that logically belong to each other (say gui changes, OO interface changes, migration,... ) to new PRs that can be reviewed and merged independently. But maybe we have to accept that these are major changes and review everything as one PR

@k3KAW8Pnf7mkmdSMPHz27
Copy link
Member

The cover "small" part. In the actual situation, I guess it means to go back to
an earlier state "A". Do you mean to go back to the last WIP PR, or
just before rewriting OOBibStyleParser, or some place between?

  • Technically, how to apply this in the current situation?

    • Have: "improve-reversibility" branch

      • Choose point "A", create branch A from there
      • rebase branch A on main (then cleanup, PR)
      • Is this correct?

Basically, yes, that would help. Though in this example, wouldn't A already be based on main and not need to be rebased?
You can also split a PR based on specific files or (cherry-picked) commits, e.g., strategy 1 or 2 at droidsonroids.
It is easier to review it if the PR is independent in some way, i.e., thematically or logically.

The "rebase B on A" confuses me. Does it mean "rebase B on (main after
A merged)" or (rebase B on last state of A)?

rebase B on last state of A. Same as the headline "Sync using the git rebase:".

Do you mean I should not push until I think it is ready?

  • I do not see the Maintainer interface, and did not expect
    maintainer alert before sending a new PR.

Everyone work on JabRef when they have spare time to do so. If there are 15 000+ line changes that must be reviewed the same person must review all the changes (and have enough spare time to do so). If there are several smaller PRs it doesn't have to be the same person doing the full review -> timelier reviews. Additionally, you are likelier to get early feedback, even when the PR is marked as a draft 😃
That is, perhaps contrary to how you perceive it right now, we want to be involved earlier in the process.

@k3KAW8Pnf7mkmdSMPHz27
Copy link
Member

@antalk2 could you make a PR to https://github.com/koppor/jabref/tree/main with the latest version of the changes? In that case, we can put comments directly in the code instead.

@antalk2
Copy link
Contributor Author

antalk2 commented May 6, 2021

could you make a PR to https://github.com/koppor/jabref/tree/main with the latest version of the changes? In that case, we can put comments directly in the code instead.

How do I do that? pushed to antalk/jabref improve-reversibility-rebased-03
Clicked (on github) Pull request,
Selected base repository koppor/jabref base: main
Is this the right target?

@k3KAW8Pnf7mkmdSMPHz27
Copy link
Member

Looks right to me. I think we can change it afterward as well if it is wrong, or in the worst-case scenario we close/re-open X)

@koppor
Copy link
Member

koppor commented Jun 5, 2021

May I ask about the time frame of working on this?
How much time do you have to work on this and until which date you want to be finished completely?
I was wondering about that, too.

I was asking, because I am helping persons moving, renovating my house, ... and thus, I have to schedule my freetime accordingly. - I can try to review and give feedback twice a week. Each two weeks, we have a developer's call. If you want, you can join and we can go into details. Besides that, these calls ensure that we have at least a quick look on your PRs each two weeks.

I think, the whole thing will take at least 6 weeks to complete.

We have Backend52, collecting code that behaves differently between versions.

May I ask why 52/53 in the name? Is it JabRef 5.2/5.3? Maybe, we should go for 60 for the new backend --> JabRef 6.0

Some software engineering comments:

* documentation should go to [`docs/`](https://github.com/JabRef/jabref/tree/main/docs).

Are you referring to the comments in example_style_file.jstyle or
those in *.java?

I totally forgot which part I meant. - Everything developer-facing should go there. This includes code design decisions, explanation of how classes belong together, ... - I think, it was because of a very long text in a JavaDoc, which did not belong to one class, but to a set of classes. For sure, the documentation should be linked form the JavaDoc.

For user-facing documentation chagnes --> e.g., other usage, ... Please submit a WIP-PR to https://github.com/JabRef/user-documentation.

* JabRef team works asynchronously without dailies or weeklies.
* Do you mean I should not push until I think it is ready?

We typically like a single commit when we should start to review a PR. Because we go through the code from top to bottom in the GitHub PR view - and do not review commits separately.

* Proposal:

  * Start a new branch based on `main` whenever you can
  * If you cannot, please create branches A, B, C; where A is based on main, B is based on A, C is based on B.
  * A, B, C cover "small" topics, but are dependent on each other.
  * Create a PR on A (to main) first
  * Let us review A
    * reviewing includes putting comments on that
    * we ask for addressing the comments
  * Work on suggestions on A
  * If A is merged, rebase B on A

The "rebase B on A" confuses me. Does it mean "rebase B on (main after
A merged)" or (rebase B on last state of A)?

Yeah, just merging upstream/main should be enough.

While addressing comments on A, you can merge A into B to ensure that no merge conflicts will arise.

* The cover "small" part. In the actual situation, I guess it means to go back to
  an earlier state "A". Do you mean to go back to the last WIP PR, or
  just before rewriting  OOBibStyleParser, or some place between?

I have no clue, since I am not into the code. Seems you found a way and we need to first focus on getting #7787 merged.

It seems that each of the new PR is "somehow" self-contained. Thus, I ask to explain the self-containtness explicitley at #7787 (comment). This really helps others to give proper feedback.

Maybe, I forgotten to state: The feedback we give is increase maintability of the code by other persons than the original author. The nature of the JabRef project is that contriubtors come and go, but the code stays. Thus, we try to establish a proper level code "qualtiy". For sure, everyone has its own style. However, we try to establish a general style in JabRef (mostly following Java by Comparison).

* on Optional: a plugin in idea suggested not to put Optional into
  class fields. Should I change those fields to nullable,
  or keep them as Optional?

null is a difficult thing in Java. Interesting presentation. https://drive.google.com/file/d/15wZ-cVPkfsNYzSez9WrAF4gEjWNzlDAD/view (found via https://jspecify.dev/). - Not sure why one cannot "fix" this issue timely in the Java world...

I think, Optional is good as class variables to really state that these can be null.

@antalk2
Copy link
Contributor Author

antalk2 commented Jun 5, 2021

May I ask about the time frame of working on this?
How much time do you have to work on this and until which date you want to be finished completely?
I was wondering about that, too.

I was asking, because I am helping persons moving, renovating my
house, ... and thus, I have to schedule my freetime accordingly.

  • I can try to review and give feedback twice a week.

Each two weeks, we have a developer's call. If you want,
you can join and we can go into details.

This link points to a list of subjects, but I see no "contact
address". I do not know what does it mean "join"? What is needed? When?

We typically like a single commit when we should start to review a PR.
Because we go through the code from top to bottom in the GitHub PR view

  • and do not review commits separately.

The oobranch series is organized so that after each layer the code can be compiled.
Meaning: later layers build on earlier ones, but not in the other way. The code
is not integrated to the rest of jabref until the "integrate" step, so a
question like:

Link issues that are fixed, e.g. "Fixes #333".
are not directly meaningful. Nothing changed in how the program runs.

Describe the changes you have made here: what, why, ...

Apart from the general description: UNO utilities, general utilities,
what exactly do you expect? We are basically rebuilding OOBibBase
in a more structured form.

Because we go through the code from top to bottom in the GitHub PR view

You are probably doing it wrong. You try to read the files in alhapbetic order.
Maybe you would be better off getting the last branch and starting from OOBibBase2
check what is going on. From that view you would have context (GUI action)
to start with.

Besides that, these calls ensure that we have at least a quick look
on your PRs each two weeks.

I think, the whole thing will take at least 6 weeks to complete.

I think it is time to make up your minds, will you read it, scan and decide
on that or just ignore it. Creating this oobranch series took a considerable
effort: I tried to minimize the effort needed on your part to read it.
My impression is that it is not happening:

I quickly jumped to a random file and commented on that.
Please, never ever use Optional as method parameter.
Your whole formatting looks a bit odd, do you have a maxline length configured?
please no single character variables

We have Backend52, collecting code that behaves differently between versions.

May I ask why 52/53 in the name? Is it JabRef 5.2/5.3? Maybe, we should go for 60 for the new backend --> JabRef 6.0

Yes, 53 for "some future version". ok.

  • Everything developer-facing should go there. This includes code
    design decisions, explanation of how classes belong together, ...
  • I think, it was because of a very long text in a JavaDoc, which
    did not belong to one class, but to a set of classes. For sure,
    the documentation should be linked form the JavaDoc.

Is JavaDoc (in the sense using /** and <p> and &lt; instead of <)
is actively use here? Using &lt; instead of < makes it hard to read in the source.

./gradlew javadoc yields 100 warnings.

For user-facing documentation chagnes --> e.g., other usage,
... Please submit a WIP-PR to
https://github.com/JabRef/user-documentation.

  • When should this happen? Before the change is accepted?

  • How is it kept in sync with the source?

  • What should it document? In particular: I do not remember seeing
    documentation on how unresolved references are handled. Now (some
    time in the future if my changes get integrated) they are handled
    differently (they are shown in the citation markers and the
    bibliography either as "Unresolved(citationKey)" or
    "[??citationkey]" (for numbered citation styles). They do not
    stop processing, only evoke a warning when finished.

    Or going back in time: "Merge citations" is not mentioned at
    https://docs.jabref.org/cite/openofficeintegration Should "Separate
    citations" be documented? On one hand one could argue that
    they may be worth mentioning. On the other, the page is already overwhelming
    with two tables, a long example style file that requires horizontal scrolling
    but is still shown with lines broken in places where it is not actually allowed
    by the parser. This suggests that things the user will discover anyway
    might be better kept out.

    Another set: 9388b2a
    a new set of settings is understood now: in jstyle: "CitationGroupMarkupBefore" .. "AuthorNameMarkupAfter".
    These allow some markup (and text) fragments to be injected before and after
    some parts of the citation marker. For example AuthorNameMarkupBefore = "<smallcaps>"
    and AuthorNameMarkupAfter = "</smallcaps>" will set author names in citations to small capitals
    (Some people expect smallCaps author names).

    There are some questions though:

    • Which parts need this capability?
    • Preview does not understand "", it does understand
      a HTML equivalent, expressed with style. OOTextIntoOO.write understands both
      (the HTML equvalent is limited to this special case).
      Should we tell the user to use: <span style="font-variant: small-caps">
      or translate <smallcaps> for the sake of Preview?
      • Should we tell users, that <span oo:CharStyleName="Standard"> (or other OO-known character style name)
        can be used, or keep as internal implementation detail?
      • How to handle OO styles, that the user can already evoke (ReferenceParagraphFormat,
        ReferenceHeaderParagraphFormat, CitationCharacterFormat), but the Preview knows nothing about?
      • Should we keep the current way of describing formatting details of citations (with keyword=value pairs)
        or could/should we try to reuse the layout machinery for these? The latter
        might make the style more regular, but the LAYOUT part is a mystery (to me).
        And it is a mix of HTML-like and LaTeX-like markup.

Maybe, I forgotten to state: The feedback we give is increase
maintability of the code by other persons than the original
author. The nature of the JabRef project is that contriubtors come
and go, but the code stays. Thus, we try to establish a proper level
code "qualtiy". For sure, everyone has its own style. However, we
try to establish a general style in JabRef (mostly following Java
by Comparison
).

That book is paywalled. On the available samples:

http://media.pragprog.com/titles/javacomp/boolean.pdf

  • Goes from a 5-line ifelse to 3 lines of code.

  • Basically says: do not overcomplicate and give names to the parts.

  • In boolean isValidName = name != null && !name.trim().isEmpty();

    • I would suggest parentheses around name != null for easier parsing by eye.

    • Relative precedences of != and && are well-known, other pairs
      may be more obscure.

    • If your checkstyle settings allow, a + b/c is better than a + b / c

    • The De Morgan laws are in logic: logical equivalence does not
      imply same level of readability. A field may potentially fail on
      any of a set of tests. Example:
      failed = failedOnFirst || failedOnSecond || failedOnThird; return !failed;
      and
      return !failedOnFirst && !failedOnSecond && !failedOnThird;,
      although logically equivalent, the first is probably easier to read.
      Similarly: name == null and missions < 0 more directly tells
      what is the problem then their negations: name != null and missions >= 0

    • Also: if you ever want to log why is it not valid, it is natural
      to break a group of || relations and insert the corresponding messages.
      With name != null && !name.trim().isEmpty() ... I would probably unDeMorgan.

  • http://media.pragprog.com/titles/javacomp/examples.pdf

Goes from (v1)

classSupply {
    /**
	* The code universally identifies a supply.
	*
	* It follows a strict format, beginning with an S (for supply), followed
	* by a five digit inventory number. Next comes a backslash that
	* separates the country code from the preceding inventory number. This
	* country code must be exactly two capital letters standing for one of
	* the participating nations (US,EU, RU, CN). After that follows a dot
	* and the actual nameof the supply in lowercase letters.
	*/
	static final Pattern CODE =
	       Pattern.compile("^S\\d{5}\\\\(US|EU|RU|CN)\\.[a-z]+$");
}

to (v2)

class Supply {
	/**
	  * The expression universally identifies a supplycode.
	  *
	  * Format: "S<inventory-number>\<COUNTRY-CODE>.<name>"
	  *
	  * Valid examples: "S12345\US.pasta","S08342\CN.wrench",
	  * "S88888\EU.laptop", "S12233\RU.brush"
	  *
	  * Invalid examples:
	  * "R12345\RU.fuel"      (Resource, not supply)
	  * "S1234\US.light"      (Need five digits)
	  * "S01234\AI.coconut"   (Wrong country code. Use US, EU, RU, or CN)
	  * " S88888\EU.laptop "  (Trailing whitespaces)
	  */
	  static final Pattern SUPPLY_CODE =
	         Pattern.compile("^S\\d{5}\\\\(US|EU|RU|CN)\\.[a-z]+$");
}
  • Note how automatic line breaks were used in v1 to make it worse than its content requires.
    (I get a similar effect when looking at long lines in my editor.)

  • Note in v2, under "Invalid examples" how the parenthesized notes are lined up.
    Yes, the author probably used multiple spaces.

  • The "fuel is resource, not supply" exceeds my understanding of english.

  • I may misunderstand "light". Apparently, unlike fuel, it is a supply, not a
    resource. Or the example is invalid in two respects, but the comment
    only highlights one of them. Confusing.

  • "Need five digits" Is it really appropriate to hide
    this information in a comment in the second block of examples?

  • Interestingly v1 did mention the backslash, v2 fails to. In the pdf,
    in the line Format: "S<inventory-number>\<COUNTRY-CODE>.<name>" it looked like possibly
    | to me. Well, informal specifications have their limitations. Using <> for the fill-in
    seems unusual to me: {} is even used in java.

  • "Wrong country code" and "universally identifies"

    • Valid country codes (again, deep in examples): US, EU, RU, or CN.
      These regions of the world certainly cover a lot, but less than "universally" would suggest.
      EU is not a country.
  • In a class Supply, that contains a single thing: CODE, renaming the latter to SUPPLY_CODE (as "more meaningful")
    seems dumb. Unless using static import, we get Supply.SUPPLY_CODE instead of Supply.CODE.

  • " S88888\EU.laptop " (Trailing whitespaces) Why trailing? The regular expression will already fail on the
    space at the beginning.

  • http://media.pragprog.com/titles/javacomp/split.pdf

logbook.log("Aliens sighted!",true);
logbook.log("Toilet broken.",false);

Suggests:

logbook.writeToCaptainLog("Aliens sighted!");
logbook.writeToCrewLog("Toilet broken. Again...");

But why not: enum { CLASSIFIED, PUBLIC } instead of a boolean?

  • It is the boolean that makes the code ambiguous.
  • In case you neeed to build otherwise identical code around it,
    the split version makes you either create duplicate code or reinvent
    the parameter.

Summary

  • I am sure the book covers a lot of useful ideas and tricks. I would
    suggest not to take it too literally. Or the examples as gold standard.

    As http://media.pragprog.com/titles/javacomp/split.pdf actually mentions:

    "Good design is less clear-cut, and it requires you to have an
    intuition and a “feeling” for it."

    I know, I am a bit harsh on the book. Well, it was repeatedly
    referred to me as "what we follow", with details behind a paywall.
    Then I find all three authors on the top
    of the contributor list. Are you trying to sell the book?

null is a difficult thing in Java.

Probably in any statically typechecked language: it breaks the promise
"if you have a variable of this type, you can access its fields and
methods...".

Interesting presentation. https://drive.google.com/file/d/15wZ-cVPkfsNYzSez9WrAF4gEjWNzlDAD/view (found via https://jspecify.dev/).

  • Not sure why one cannot "fix" this issue timely in the Java world...

The presentation says: "[in java] every reference type must include null".
I am not sure why would it be so: in principle they could introduce non-nullable variants.

  • But with a lot of code relying on this, including "Map.get()", "We
    changed our minds, no more nulls" is not a practical option.

    To make the change painless, touching old code must be optional,
    otherwise the vendors lose users. So there is, presumably for a long
    time, a mix of two worlds. Handling this mix with a reasonably low
    pain and an appreciable gain in reliability is hard and takes a long
    time.

    A generation or more (there is still some code from the seventies
    around, maybe even older). With several competing vendors, and the
    possibility that those refusing/delaying a transition may gain,
    there is a risk for those going forward.

    Finally, some introspection may be enlightening: why is it so slow to merge my
    wonderful (according to me) changes to main?

@antalk2
Copy link
Contributor Author

antalk2 commented Oct 26, 2021

I believe this pull request is obsolete, replaced by oobranch-[a-j]
Closing

@antalk2 antalk2 closed this Oct 26, 2021
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.

6 participants