Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into addAddContentToImage
Browse files Browse the repository at this point in the history
* upstream/main:
  Replacement localization (#10358)
  Add workaround for IDEA-317606
  Fix CHANGELOG.md linting issues (#10351)
  fix afterburner
  checkstyle
  add changelog
  Fix NPE when adding new aux group
  Add "--verbose" to MV generator (#10347)
  Fix dependencies (#10326)
  Add new openrewrite rules (#10342)
  New Crowdin updates (#10344)
  Rework duplicate checker tests (#10341)
  • Loading branch information
Siedlerchr committed Sep 9, 2023
2 parents 299032a + 8d4e8d8 commit 0337872
Show file tree
Hide file tree
Showing 20 changed files with 484 additions and 212 deletions.
35 changes: 18 additions & 17 deletions CHANGELOG.md

Large diffs are not rendered by default.

35 changes: 11 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {

id 'org.javamodularity.moduleplugin' version '1.8.12'

id 'org.openjfx.javafxplugin' version '0.0.14'
id 'org.openjfx.javafxplugin' version '0.1.0'

id 'org.beryx.jlink' version '2.26.0'

Expand All @@ -27,7 +27,7 @@ plugins {

id 'idea'

id 'org.openrewrite.rewrite' version '6.3.2'
id 'org.openrewrite.rewrite' version '6.3.3'
}

// Enable following for debugging
Expand Down Expand Up @@ -83,7 +83,6 @@ sourceSets {
}

repositories {
mavenLocal()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/groups/public' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
Expand Down Expand Up @@ -169,13 +168,12 @@ dependencies {
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
implementation 'jakarta.inject:jakarta.inject-api:2.0.1'


implementation 'org.jabref:afterburner.fx:1.1.0-SNAPSHOT'
implementation('org.jabref:afterburner.fx:2.0.0-SNAPSHOT')
implementation 'org.kordamp.ikonli:ikonli-javafx:12.3.1'
implementation 'org.kordamp.ikonli:ikonli-materialdesign2-pack:12.3.1'
implementation 'com.github.sialcasa.mvvmFX:mvvmfx-validation:f195849ca9' //jitpack
implementation 'de.saxsys:mvvmfx:1.8.0'
implementation 'com.tobiasdiez:easybind:2.2.1-SNAPSHOT'
implementation('com.tobiasdiez:easybind:2.2.1-SNAPSHOT')
implementation 'org.fxmisc.flowless:flowless:0.7.1'
implementation 'org.fxmisc.richtext:richtextfx:0.11.1'
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.77.0') {
Expand All @@ -196,7 +194,9 @@ dependencies {
// route all requests to java.util.logging to SLF4J (which in turn routes to tinylog)
implementation 'org.slf4j:jul-to-slf4j:2.0.7'

implementation 'de.undercouch:citeproc-java:3.0.0-beta.2'
implementation('de.undercouch:citeproc-java:3.0.0-beta.2') {
exclude group: 'org.antlr'
}

// jakarta.activation is already dependency of glassfish
implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '3.0.1'
Expand Down Expand Up @@ -253,8 +253,10 @@ dependencies {
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.2.1"))
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")
rewrite("org.openrewrite.recipe:rewrite-migrate-java")
}

clean {
Expand Down Expand Up @@ -712,24 +714,9 @@ if (OperatingSystem.current().isMacOsX()) {
}
}
}

jmh {
warmupIterations = 5
iterations = 10
fork = 2
}

// Source: https://stackoverflow.com/a/44168582/873282
task downloadDependencies {
description "Pre-downloads *most* dependencies"
doLast {
configurations.getAsMap().each { name, config ->
println "Retrieving dependencies for $name"
try {
config.files
} catch (e) {
// some cannot be resolved, just log them
project.logger.info e.message
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ In the following, we will use `c:\git-repositories` as base folder:
cd \
mkdir git-repositories
cd git-repositories
git clone --depth=10 https://github.com/JabRef/jabref.git
git clone --depth=10 https://github.com/JabRef/jabref.git JabRef
cd jabref
git remote rename origin upstream
git remote add origin https://github.com/YOUR_USERNAME/jabref.git
Expand All @@ -36,6 +36,8 @@ git branch --set-upstream-to=origin/main main
> Note that putting the repo JabRef directly on `C:\` or any other drive letter on Windows causes compile errors (**negative example**: `C:\jabref`).
>
> Further, if you are building on Windows, make sure that the absolute path to the location of the clone does not contain folders starting with '`u`' (**negative example**: `C:\university\jabref`) as this may currently also cause [compile errors](https://github.com/JabRef/jabref/issues/9783).
>
> Please really ensure that you pass `JabRef` as parameter. Otherwise, you will get `java.lang.IllegalStateException: Module entity with name: jabref should be available`. See [IDEA-317606](https://youtrack.jetbrains.com/issue/IDEA-317606/Changing-only-the-case-of-the-Gradle-root-project-name-causes-exception-while-importing-project-java.lang.IllegalStateException) for details.
{: .note-title }
> Background
Expand Down
15 changes: 15 additions & 0 deletions rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,18 @@ recipeList:
# We voted against it
# - org.openrewrite.staticanalysis.ExplicitInitialization

- org.openrewrite.java.migrate.io.ReplaceFileInOrOutputStreamFinalizeWithClose

- org.openrewrite.java.recipes.UseJavaParserBuilderInJavaTemplate

- org.openrewrite.java.ShortenFullyQualifiedTypeReferences

- org.openrewrite.java.testing.junit5.AssertTrueInstanceofToAssertInstanceOf
- org.openrewrite.java.testing.junit5.RemoveTryCatchFailBlocks

# needs another openrewrite dependency
# - org.openrewrite.okhttp.ReorderRequestBodyCreateArguments

- org.openrewrite.staticanalysis.AtomicPrimitiveEqualsUsesGet
- org.openrewrite.staticanalysis.BigDecimalRoundingConstantsToEnums
- org.openrewrite.staticanalysis.BooleanChecksNotInverted
Expand All @@ -116,6 +126,7 @@ recipeList:
# - org.openrewrite.staticanalysis.DefaultComesLast
- org.openrewrite.staticanalysis.EmptyBlock
- org.openrewrite.staticanalysis.EqualsAvoidsNull
- org.openrewrite.staticanalysis.EqualsToContentEquals
# Needs manual intervention
# - org.openrewrite.staticanalysis.ExplicitCharsetOnStringGetBytes
- org.openrewrite.staticanalysis.ExternalizableHasNoArgsConstructor
Expand Down Expand Up @@ -150,7 +161,9 @@ recipeList:
- org.openrewrite.staticanalysis.RemoveEmptyJavaDocParameters
- org.openrewrite.staticanalysis.RemoveExtraSemicolons
- org.openrewrite.staticanalysis.RemoveJavaDocAuthorTag
- org.openrewrite.staticanalysis.RemoveHashCodeCallsFromArrayInstances
- org.openrewrite.staticanalysis.RemoveRedundantTypeCast
- org.openrewrite.staticanalysis.RemoveToStringCallsFromArrayInstances
- org.openrewrite.staticanalysis.RemoveUnneededAssertion
- org.openrewrite.staticanalysis.RemoveUnneededBlock
# - org.openrewrite.staticanalysis.RemoveUnusedLocalVariables
Expand All @@ -159,12 +172,14 @@ recipeList:
- org.openrewrite.staticanalysis.RenameMethodsNamedHashcodeEqualOrTostring
- org.openrewrite.staticanalysis.ReplaceRedundantFormatWithPrintf
- org.openrewrite.staticanalysis.ReplaceStringBuilderWithString
- org.openrewrite.staticanalysis.ReplaceWeekYearWithYear
# - org.openrewrite.staticanalysis.ShortenFullyQualifiedTypeReferences
# - org.openrewrite.staticanalysis.SimplifyConsecutiveAssignments
# - org.openrewrite.staticanalysis.SimplifyCompoundStatement
- org.openrewrite.staticanalysis.SimplifyBooleanExpression
- org.openrewrite.staticanalysis.SimplifyBooleanReturn
- org.openrewrite.staticanalysis.SimplifyDurationCreationUnits
- org.openrewrite.staticanalysis.SortedSetStreamToLinkedHashSet
- org.openrewrite.staticanalysis.StaticMethodNotFinal
- org.openrewrite.staticanalysis.StringLiteralEquality
- org.openrewrite.staticanalysis.TypecastParenPad
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/jabref/cli/JournalListMvGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
public class JournalListMvGenerator {

public static void main(String[] args) throws IOException {
boolean verbose = (args.length == 1) && ("--verbose".equals(args[0]));

Path abbreviationsDirectory = Path.of("buildres", "abbrv.jabref.org", "journals");
if (!Files.exists(abbreviationsDirectory)) {
System.out.println("Path " + abbreviationsDirectory.toAbsolutePath() + " does not exist");
Expand Down Expand Up @@ -66,7 +68,9 @@ public static void main(String[] args) throws IOException {
Abbreviation::getName,
abbreviation -> abbreviation,
(abbreviation1, abbreviation2) -> {
System.out.println("Double entry " + abbreviation1.getName());
if (verbose) {
System.out.println("Double entry " + abbreviation1.getName());
}
return abbreviation2;
}));
fullToAbbreviation.putAll(abbreviationMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ protected Void call() throws Exception {
skipped++;
} else {
for (Path file : files) {
updateMessage(Localization.lang("Writing metadata to {}", file.getFileName()));
updateMessage(Localization.lang("Writing metadata to %0", file.getFileName()));

if (Files.exists(file)) {
try {
Expand Down
22 changes: 14 additions & 8 deletions src/main/java/org/jabref/gui/groups/GroupDialogView.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,23 @@ public class GroupDialogView extends BaseDialog<AbstractGroup> {

@FXML private TextField texGroupFilePath;

@Inject private FileUpdateMonitor fileUpdateMonitor;

private final EnumMap<GroupHierarchyType, String> hierarchyText = new EnumMap<>(GroupHierarchyType.class);
private final EnumMap<GroupHierarchyType, String> hierarchyToolTip = new EnumMap<>(GroupHierarchyType.class);

private final ControlsFxVisualizer validationVisualizer = new ControlsFxVisualizer();
private final GroupDialogViewModel viewModel;

public GroupDialogView(DialogService dialogService,
BibDatabaseContext currentDatabase,
PreferencesService preferencesService,
private final BibDatabaseContext currentDatabase;
private final AbstractGroup editedGroup;
private GroupDialogViewModel viewModel;
@Inject private FileUpdateMonitor fileUpdateMonitor;
@Inject private DialogService dialogService;
@Inject private PreferencesService preferencesService;

public GroupDialogView(BibDatabaseContext currentDatabase,
AbstractGroup editedGroup,
GroupDialogHeader groupDialogHeader) {
viewModel = new GroupDialogViewModel(dialogService, currentDatabase, preferencesService, editedGroup, fileUpdateMonitor);
this.currentDatabase = currentDatabase;
this.editedGroup = editedGroup;

ViewLoader.view(this)
.load()
Expand All @@ -117,7 +120,6 @@ public GroupDialogView(DialogService dialogService,
this.setTitle(Localization.lang("Edit group") + " " + editedGroup.getName());
}

setResultConverter(viewModel::resultConverter);
getDialogPane().getButtonTypes().setAll(ButtonType.OK, ButtonType.CANCEL);

final Button confirmDialogButton = (Button) getDialogPane().lookupButton(ButtonType.OK);
Expand All @@ -128,6 +130,10 @@ public GroupDialogView(DialogService dialogService,

@FXML
public void initialize() {
viewModel = new GroupDialogViewModel(dialogService, currentDatabase, preferencesService, editedGroup, fileUpdateMonitor);

setResultConverter(viewModel::resultConverter);

hierarchyText.put(GroupHierarchyType.INCLUDING, Localization.lang("Union"));
hierarchyToolTip.put(GroupHierarchyType.INCLUDING, Localization.lang("Include subgroups: When selected, view entries contained in this group or its subgroups"));
hierarchyText.put(GroupHierarchyType.REFINING, Localization.lang("Intersection"));
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class GroupTreeViewModel extends AbstractViewModel {
private final Comparator<GroupTreeNode> compAlphabetIgnoreCase = (GroupTreeNode v1, GroupTreeNode v2) -> v1
.getName()
.compareToIgnoreCase(v2.getName());
private Optional<BibDatabaseContext> currentDatabase;
private Optional<BibDatabaseContext> currentDatabase = Optional.empty();

public GroupTreeViewModel(StateManager stateManager, DialogService dialogService, PreferencesService preferencesService, TaskExecutor taskExecutor, CustomLocalDragboard localDragboard) {
this.stateManager = Objects.requireNonNull(stateManager);
Expand Down Expand Up @@ -159,9 +159,7 @@ private void onActiveDatabaseChanged(Optional<BibDatabaseContext> newDatabase) {
public void addNewSubgroup(GroupNodeViewModel parent, GroupDialogHeader groupDialogHeader) {
currentDatabase.ifPresent(database -> {
Optional<AbstractGroup> newGroup = dialogService.showCustomDialogAndWait(new GroupDialogView(
dialogService,
database,
preferences,
null,
groupDialogHeader));

Expand Down Expand Up @@ -245,9 +243,7 @@ boolean onlyMinorChanges(AbstractGroup oldGroup, AbstractGroup newGroup) {
public void editGroup(GroupNodeViewModel oldGroup) {
currentDatabase.ifPresent(database -> {
Optional<AbstractGroup> newGroup = dialogService.showCustomDialogAndWait(new GroupDialogView(
dialogService,
database,
preferences,
oldGroup.getGroupNode().getGroup(),
GroupDialogHeader.SUBGROUP));
newGroup.ifPresent(group -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public String format(String value) {
}
// If we are in a command body, see if it has ended:
if (inCommand && (c == '}')) {
if ("begin".equals(commandName.toString())) {
if ("begin".contentEquals(commandName)) {
nestedEnvironments++;
}
if ((nestedEnvironments > 0) && "end".equals(commandName.toString())) {
if ((nestedEnvironments > 0) && "end".contentEquals(commandName)) {
nestedEnvironments--;
}

Expand All @@ -72,7 +72,7 @@ public String format(String value) {

// We add a backslash before any ampersand characters, with one exception: if
// we are inside an \\url{...} command, we should write it as it is. Maybe.
if ((c == '&') && !escape && !(inCommand && "url".equals(commandName.toString()))
if ((c == '&') && !escape && !(inCommand && "url".contentEquals(commandName))
&& (nestedEnvironments == 0)) {
result.append("\\&");
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2579,4 +2579,4 @@ Failed\ to\ download\ from\ URL=Failed to download from URL
Finished=Finished
Finished\ writing\ metadata\ for\ library\ %0\ (%1\ succeeded,\ %2\ skipped,\ %3\ errors).=Finished writing metadata for library %0 (%1 succeeded, %2 skipped, %3 errors).
Processing...=Processing...
Writing\ metadata\ to\ {}=Writing metadata to {}
Writing\ metadata\ to\ %0=Writing metadata to %0
Loading

0 comments on commit 0337872

Please sign in to comment.