Skip to content

Commit d7c6aea

Browse files
authored
Merge pull request #4903 from volodya-lombrozo/4884-qulice-upgrade
refactor(#4884): upgrade qulice to version 0.25.1 in `eo-runtime`
2 parents 39b2b4d + 890f7bb commit d7c6aea

64 files changed

Lines changed: 761 additions & 614 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eo-runtime/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@
385385
<plugin>
386386
<groupId>com.qulice</groupId>
387387
<artifactId>qulice-maven-plugin</artifactId>
388+
<version>0.25.1</version>
388389
<configuration>
389390
<excludes>
390391
<exclude>dependencies:org.eolang:eo-maven-plugin</exclude>

eo-runtime/src/main/java/EOorg/EOeolang/EObytes$EOslice.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public final class EObytes$EOslice extends PhDefault implements Atom {
3838
}
3939

4040
@Override
41+
@SuppressWarnings("PMD.UnnecessaryLocalRule")
4142
public Phi lambda() {
4243
final int start = Expect.at(this, "start")
4344
.that(phi -> new Dataized(phi).asNumber())

eo-runtime/src/main/java/EOorg/EOeolang/EOerror.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,10 @@ public Collection<String> messages() {
140140
* @param message New one
141141
* @return New list of them
142142
*/
143-
private static Collection<String> concat(final Collection<String> before,
144-
final String message) {
143+
private static Collection<String> concat(
144+
final Collection<String> before,
145+
final String message
146+
) {
145147
final Collection<String> list = new ArrayList<>(before.size() + 1);
146148
list.addAll(before);
147149
list.add(message);
@@ -161,11 +163,10 @@ private static String safeMessage(final Phi enclosure) {
161163
result = "null Phi";
162164
} else {
163165
try {
164-
final byte[] raw = new Dataized(enclosure).take();
165166
result = String.format(
166167
"%s(Δ = %s)",
167168
enclosure,
168-
new VerboseBytesAsString(raw).get()
169+
new VerboseBytesAsString(new Dataized(enclosure).take()).get()
169170
);
170171
} catch (final Exception first) {
171172
try {

eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOdir$EOwalk.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,19 @@ public final class EOdir$EOwalk extends PhDefault implements Atom {
4242
}
4343

4444
@Override
45+
@SuppressWarnings("PMD.UnnecessaryLocalRule")
4546
public Phi lambda() {
4647
final Path path = Paths.get(
4748
new Dataized(
4849
this.take(Phi.RHO).take("file").take("path")
4950
).asString()
5051
).toAbsolutePath();
51-
final String glob = new Dataized(
52-
this.take("glob")
53-
).asString();
5452
final PathMatcher matcher = FileSystems.getDefault().getPathMatcher(
55-
String.format("glob:%s", glob)
53+
String.format(
54+
"glob:%s", new Dataized(
55+
this.take("glob")
56+
).asString()
57+
)
5658
);
5759
try (Stream<Path> paths = Files.walk(path)) {
5860
return new Data.ToPhi(

eo-runtime/src/main/java/EOorg/EOeolang/EOfs/Files.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@
2323
/**
2424
* File streams.
2525
* @since 0.40
26+
* @todo #4884:30min Use ReentrantLock instead of 'synchronized' in Files.
27+
* We should use ReentrantLock instead of 'synchronized' to avoid potential
28+
* deadlocks when multiple AtOnce attributes are used together.
29+
* Moreover, 'synchronized' keyword is forbidden by qulice.
2630
*/
31+
@SuppressWarnings("PMD.AvoidSynchronizedStatement")
2732
final class Files {
2833
/**
2934
* Files instance.
@@ -33,6 +38,7 @@ final class Files {
3338
/**
3439
* File input streams for reading.
3540
*/
41+
@SuppressWarnings("PMD.LooseCoupling")
3642
private final ConcurrentHashMap<String, Object[]> streams;
3743

3844
/**
@@ -52,7 +58,7 @@ void open(final String name) throws IOException {
5258
final Path path = Paths.get(name);
5359
this.streams.putIfAbsent(
5460
name,
55-
new Object[] {
61+
new Object[]{
5662
java.nio.file.Files.newInputStream(path),
5763
java.nio.file.Files.newOutputStream(path, StandardOpenOption.APPEND),
5864
}

eo-runtime/src/main/java/EOorg/EOeolang/EOmalloc$EOof$EOallocated$EOresized.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public final class EOmalloc$EOof$EOallocated$EOresized extends PhDefault impleme
3434
}
3535

3636
@Override
37+
@SuppressWarnings("PMD.UnnecessaryLocalRule")
3738
public Phi lambda() {
3839
final Phi rho = this.take(Phi.RHO);
3940
final int id = Expect.at(rho, "id")

eo-runtime/src/main/java/EOorg/EOeolang/EOms/EOpow.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
* @checkstyle TypeNameCheck (100 lines)
2424
*/
2525
@XmirObject(oname = "pow")
26-
@SuppressWarnings("PMD.AvoidDollarSigns")
2726
public final class EOpow extends PhDefault implements Atom {
2827
/**
2928
* Ctor.

eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOdiv.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public final class EOnumber$EOdiv extends PhDefault implements Atom {
3535
}
3636

3737
@Override
38+
@SuppressWarnings("PMD.UnnecessaryLocalRule")
3839
public Phi lambda() {
3940
final Double left = new Expect.Number(Expect.at(this, Phi.RHO)).it();
4041
final Double right = new Expect.Number(Expect.at(this, "x")).it();

eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOgt.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public final class EOnumber$EOgt extends PhDefault implements Atom {
3535
}
3636

3737
@Override
38+
@SuppressWarnings("PMD.UnnecessaryLocalRule")
3839
public Phi lambda() {
3940
final Double left = new Expect.Number(Expect.at(this, Phi.RHO)).it();
4041
final Double right = new Expect.Number(Expect.at(this, "x")).it();

eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOplus.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ public final class EOnumber$EOplus extends PhDefault implements Atom {
3636

3737
@Override
3838
public Phi lambda() {
39-
final Double left = new Expect.Number(Expect.at(this, Phi.RHO)).it();
40-
final Double right = new Expect.Number(Expect.at(this, "x")).it();
41-
return new Data.ToPhi(Double.sum(left, right));
39+
return new Data.ToPhi(
40+
Double.sum(
41+
new Expect.Number(Expect.at(this, Phi.RHO)).it(),
42+
new Expect.Number(Expect.at(this, "x")).it()
43+
)
44+
);
4245
}
4346
}

0 commit comments

Comments
 (0)