Skip to content

Commit 11217bf

Browse files
committed
optimization and jitpack
1 parent fa5152d commit 11217bf

File tree

9 files changed

+23
-16
lines changed

9 files changed

+23
-16
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ repositories {
1010
}
1111

1212
dependencies {
13-
implementation("org.jetbrains:annotations:24.0.0")
14-
annotationProcessor("org.jetbrains:annotations:24.0.0")
15-
13+
implementation('org.jetbrains:annotations:24.0.0')
14+
annotationProcessor('org.jetbrains:annotations:24.0.0')
1615
implementation('com.google.errorprone:error_prone_annotations:2.36.0')
16+
annotationProcessor('com.google.errorprone:error_prone_annotations:2.36.0')
1717
}

jitpack.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
jdk:
2+
- openjdk21
3+
before-install:
4+
- sdk install java 21.0.5-graal
5+
- sdk use java 21.0.5-graal
6+
- sdk install gradle 8.9
7+
- sdk use gradle 8.9

src/main/java/dev/manere/inscript/value/impl/ByteValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class ByteValue implements InlineValue<Byte> {
99
public boolean matches(final @NotNull String text) {
1010
if (!text.endsWith("B")) return false;
1111

12-
final String other = text.replaceAll("B", "");
12+
final String other = text.substring(0, text.length() - 1);
1313
try {
1414
Byte.valueOf(other);
1515
return true;
@@ -20,7 +20,7 @@ public boolean matches(final @NotNull String text) {
2020

2121
@Override
2222
public @Nullable Byte deserialize(final @NotNull String text) {
23-
return Byte.valueOf(text.replaceAll("B", ""));
23+
return Byte.valueOf(text.substring(0, text.length() - 1));
2424
}
2525

2626
@Override

src/main/java/dev/manere/inscript/value/impl/CharacterValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public boolean matches(final @NotNull String text) {
1212

1313
@Override
1414
public @Nullable Character deserialize(final @NotNull String text) {
15-
return text.substring(1).replaceAll("'C", "").charAt(0);
15+
return text.substring(1, text.length() - 2).charAt(0);
1616
}
1717

1818
@Override

src/main/java/dev/manere/inscript/value/impl/DoubleValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class DoubleValue implements InlineValue<Double> {
99
public boolean matches(final @NotNull String text) {
1010
if (!text.endsWith("D")) return false;
1111

12-
final String other = text.replaceAll("D", "");
12+
final String other = text.substring(0, text.length() - 1);
1313
try {
1414
Double.valueOf(other);
1515
return true;
@@ -21,7 +21,7 @@ public boolean matches(final @NotNull String text) {
2121
@Override
2222
public @Nullable Double deserialize(final @NotNull String text) {
2323
try {
24-
return Double.valueOf(text.replaceAll("D", ""));
24+
return Double.valueOf(text.substring(0, text.length() - 1));
2525
} catch (NumberFormatException e) {
2626
return -1.0;
2727
}

src/main/java/dev/manere/inscript/value/impl/FloatValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class FloatValue implements InlineValue<Float> {
99
public boolean matches(final @NotNull String text) {
1010
if (!text.endsWith("F")) return false;
1111

12-
final String other = text.replaceAll("F", "");
12+
final String other = text.substring(0, text.length() - 1);
1313
try {
1414
Float.valueOf(other);
1515
return true;
@@ -21,7 +21,7 @@ public boolean matches(final @NotNull String text) {
2121
@Override
2222
public @Nullable Float deserialize(final @NotNull String text) {
2323
try {
24-
return Float.valueOf(text.replaceAll("F", ""));
24+
return Float.valueOf(text.substring(0, text.length() - 1));
2525
} catch (NumberFormatException e) {
2626
return -1.0F;
2727
}

src/main/java/dev/manere/inscript/value/impl/LongValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class LongValue implements InlineValue<Long> {
99
public boolean matches(final @NotNull String text) {
1010
if (!text.endsWith("L")) return false;
1111

12-
final String other = text.replaceAll("L", "");
12+
final String other = text.substring(0, text.length() - 1);
1313
try {
1414
Long.valueOf(other);
1515
return true;
@@ -21,7 +21,7 @@ public boolean matches(final @NotNull String text) {
2121
@Override
2222
public @Nullable Long deserialize(final @NotNull String text) {
2323
try {
24-
return Long.valueOf(text.replaceAll("L", ""));
24+
return Long.valueOf(text.substring(0, text.length() - 1));
2525
} catch (NumberFormatException e) {
2626
return -1L;
2727
}

src/main/java/dev/manere/inscript/value/impl/ShortValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class ShortValue implements InlineValue<Short> {
99
public boolean matches(final @NotNull String text) {
1010
if (!text.endsWith("S")) return false;
1111

12-
final String other = text.replaceAll("S", "");
12+
final String other = text.substring(0, text.length() - 1);
1313
try {
1414
Short.valueOf(other);
1515
return true;
@@ -20,7 +20,7 @@ public boolean matches(final @NotNull String text) {
2020

2121
@Override
2222
public @Nullable Short deserialize(final @NotNull String text) {
23-
return Short.valueOf(text.replaceAll("S", ""));
23+
return Short.valueOf(text.substring(0, text.length() - 1));
2424
}
2525

2626
@Override

src/main/java/dev/manere/inscript/value/impl/UUIDValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public boolean matches(final @NotNull String text) {
1414
}
1515

1616
try {
17-
UUID.fromString(text.replaceAll("uuid\\(", "").replaceAll("\\)", ""));
17+
UUID.fromString(text.substring(5, text.length() - 1));
1818
return true;
1919
} catch (final Exception e) {
2020
return false;
@@ -24,7 +24,7 @@ public boolean matches(final @NotNull String text) {
2424
@Override
2525
public @Nullable UUID deserialize(final @NotNull String text) {
2626
try {
27-
return UUID.fromString(text.replaceAll("uuid\\(", "").replaceAll("\\)", ""));
27+
return UUID.fromString(text.substring(5, text.length() - 1));
2828
} catch (final Exception e) {
2929
return null;
3030
}

0 commit comments

Comments
 (0)