Skip to content

Commit

Permalink
Finish 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
theshadowco committed Jul 11, 2024
2 parents 5782c49 + 63c1a85 commit 5348252
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 41 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: Java CI

on: [push, pull_request]
on: [ push, pull_request ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java_version: ['17', '20']
os: [ubuntu-latest, windows-latest, macOS-latest]
java_version: [ '17', '20', '21' ]
os: [ ubuntu-latest, windows-latest, macOS-latest ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'adopt'
- name: Build with Gradle
run: ./gradlew check --stacktrace
- name: Archive test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: junit_report_${{ matrix.os }}_${{ matrix.java_version }}
path: build/reports/tests/test
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'adopt'
- name: Build with Gradle
run: ./gradlew check --stacktrace
- name: Archive test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: junit_report_${{ matrix.os }}_${{ matrix.java_version }}
path: build/reports/tests/test
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
id("io.freefair.lombok") version "8.6"
id("io.freefair.javadoc-links") version "8.6"
id("io.freefair.javadoc-utf-8") version "8.6"
id("org.sonarqube") version "5.0.0.4638"
id("org.sonarqube") version "5.1.0.4882"
id("io.freefair.maven-central.validate-poms") version "8.6"
id("com.github.ben-manes.versions") version "0.51.0"
id("ru.vyarus.pom") version "3.0.0"
Expand Down
69 changes: 46 additions & 23 deletions src/main/java/com/github/_1c_syntax/bsl/types/MdoReference.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* This file is a part of BSL Common library.
*
* Copyright (c) 2021 - 2024
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* BSL Common library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* BSL Common library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with BSL Common library.
*/
package com.github._1c_syntax.bsl.types;
/*
* This file is a part of BSL Common library.
*
* Copyright (c) 2021 - 2024
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* BSL Common library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* BSL Common library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with BSL Common library.
*/
package com.github._1c_syntax.bsl.types;

import com.github._1c_syntax.utils.StringInterner;
import lombok.EqualsAndHashCode;
Expand All @@ -39,7 +39,7 @@
@Value
@EqualsAndHashCode(of = {"mdoRef"})
@ToString(of = {"mdoRef"})
public class MdoReference {
public class MdoReference implements Comparable<MdoReference> {
/**
* Ссылка на пустую ссылку
*/
Expand Down Expand Up @@ -182,6 +182,29 @@ public static Optional<MdoReference> find(@NonNull String mdoRef) {
return result;
}

@Override
public int compareTo(@Nullable MdoReference mdoReference) {
if (mdoReference == null) {
return 1;
}

if (this.equals(mdoReference)) {
return 0;
}

int typeComparison = this.type.compareTo(mdoReference.getType());
if (typeComparison != 0) {
return typeComparison;
}

int mdoRefComparison = this.mdoRef.compareTo(mdoReference.getMdoRef());
if (mdoRefComparison != 0) {
return mdoRefComparison;
}

return this.mdoRefRu.compareTo(mdoReference.getMdoRefRu());
}

private static MdoReference getOrCompute(@NonNull MDOType mdoType, @NonNull String mdoRef, @NonNull String mdoRefRu) {
if (REFERENCES.containsKey(mdoRef)) {
return REFERENCES.get(mdoRef);
Expand Down

0 comments on commit 5348252

Please sign in to comment.