Skip to content

Commit

Permalink
Finish v0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
theshadowco committed Jan 1, 2025
2 parents dd266fc + 1a1b4b0 commit 5ac3df2
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java_version: ['17', '20']
java_version: ['17', '21']
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 10 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ plugins {
jacoco
signing
id("org.cadixdev.licenser") version "0.6.1"
id("me.qoomon.git-versioning") version "6.4.3"
id("me.qoomon.git-versioning") version "6.4.4"
id("com.gorylenko.gradle-git-properties") version "2.4.2"
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("io.freefair.maven-central.validate-poms") version "8.6"
id("io.freefair.lombok") version "8.11"
id("io.freefair.javadoc-links") version "8.11"
id("io.freefair.javadoc-utf-8") version "8.11"
id("io.freefair.maven-central.validate-poms") version "8.11"
id("com.github.ben-manes.versions") version "0.51.0"
id("ru.vyarus.pom") version "3.0.0"
id("io.codearte.nexus-staging") version "0.30.0"
Expand Down Expand Up @@ -40,13 +40,11 @@ repositories {
mavenCentral()
}

val junitVersion = "5.7.0"

dependencies {
compileOnly("com.github.spotbugs:spotbugs-annotations:4.8.5")
testImplementation("org.junit.jupiter", "junit-jupiter-api", junitVersion)
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", junitVersion)
testImplementation("org.assertj", "assertj-core", "3.18.1")
compileOnly("com.github.spotbugs", "spotbugs-annotations", "4.8.6")
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.11.4")
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", "5.11.4")
testImplementation("org.assertj", "assertj-core", "3.27.0")
}

java {
Expand Down Expand Up @@ -81,7 +79,7 @@ tasks.check {
tasks.jacocoTestReport {
reports {
xml.required.set(true)
xml.outputLocation.set(File("$buildDir/reports/jacoco/test/jacoco.xml"))
xml.outputLocation.set(layout.buildDirectory.file("reports/jacoco/test/jacoco.xml"))
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
44 changes: 43 additions & 1 deletion src/main/java/com/github/_1c_syntax/utils/Absolute.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of 1c-syntax utils.
*
* Copyright (c) 2018-2024
* Copyright (c) 2018-2025
* Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
Expand Down Expand Up @@ -40,6 +40,12 @@
@UtilityClass
public final class Absolute {

/**
* Получение URI из строки
*
* @param uri - строковое представление URI
* @return - полученное значение
*/
public static URI uri(@NonNull String uri) {
try {
var url = new URL(uri);
Expand All @@ -60,28 +66,64 @@ public static URI uri(@NonNull String uri) {
}
}

/**
* Получение абсолютного URI из URI с валидацией
*
* @param uri - исходный URI
* @return - полученное значение
*/
public static URI uri(@NonNull URI uri) {
var decodedUri = URI.create(uri.getScheme() + ":" + encodePath(uri.getSchemeSpecificPart()));

return checkFileAuthorityAndReturnURI(decodedUri);
}

/**
* Получение URI файла
*
* @param file - исходный файл
* @return - полученное значение
*/
public static URI uri(@NonNull File file) {
return uri(path(file).toUri());
}

/**
* Получение пути (path) из строки
*
* @param path - строковое представление пути
* @return - полученное значение
*/
public static Path path(@NonNull String path) {
return path(Path.of(path));
}

/**
* Получение пути (path) из URI
*
* @param uri - исходное значение URI
* @return - полученное значение
*/
public static Path path(@NonNull URI uri) {
return path(Path.of(uri(uri)));
}

/**
* Получение абсолютного пути (path) из Path
*
* @param path - исходное значение пути
* @return - полученное значение
*/
public static Path path(@NonNull Path path) {
return path(path.toFile());
}

/**
* Получение пути файла
*
* @param file - исходный файл
* @return - полученное значение
*/
@SneakyThrows
public static Path path(@NonNull File file) {
return file.getCanonicalFile().toPath().toAbsolutePath();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of 1c-syntax utils.
*
* Copyright (c) 2018-2024
* Copyright (c) 2018-2025
* Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/com/github/_1c_syntax/utils/GenericInterner.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of 1c-syntax utils.
*
* Copyright (c) 2018-2024
* Copyright (c) 2018-2025
* Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
Expand All @@ -25,17 +25,26 @@
import java.util.concurrent.ConcurrentHashMap;

/**
* Реализация интернера
* Реализация универсального интернера
*/
public class GenericInterner<T> {

private final Map<T, T> map = new ConcurrentHashMap<>();

/**
* Метод интернирования значения
*
* @param object Интернируемый объект
* @return значение из кеша
*/
public T intern(T object) {
var exist = map.putIfAbsent(object, object);
return (exist == null) ? object : exist;
}

/**
* Очистка кеша интернера
*/
public void clear() {
map.clear();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/github/_1c_syntax/utils/Lazy.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of 1c-syntax utils.
*
* Copyright (c) 2018-2024
* Copyright (c) 2018-2025
* Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of 1c-syntax utils.
*
* Copyright (c) 2018-2024
* Copyright (c) 2018-2025
* Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of 1c-syntax utils.
*
* Copyright (c) 2018-2024
* Copyright (c) 2018-2025
* Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of 1c-syntax utils.
*
* Copyright (c) 2018-2024
* Copyright (c) 2018-2025
* Alexey Sosnoviy <[email protected]>, Nikita Fedkin <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
Expand Down

0 comments on commit 5ac3df2

Please sign in to comment.