Skip to content

Commit b55d6a2

Browse files
committed
Upgrade to Java 11 and parent version 2.0
1 parent d5adcc9 commit b55d6a2

File tree

8 files changed

+35
-445
lines changed

8 files changed

+35
-445
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
strategy:
2828
matrix:
29-
java: [8, 11, 17, 21]
29+
java: [11, 17, 21]
3030
fail-fast: false
3131
steps:
3232
- uses: actions/checkout@v5
@@ -39,7 +39,7 @@ jobs:
3939
- name: Build with Maven
4040
run: mvn package --file pom.xml -B --no-transfer-progress
4141

42-
native-module:
42+
site:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- uses: actions/checkout@v5
@@ -50,17 +50,4 @@ jobs:
5050
distribution: 'temurin'
5151
cache: 'maven'
5252
- name: Build with Maven
53-
run: mvn package --file pom.xml -B --no-transfer-progress -Pnative-module
54-
55-
site:
56-
runs-on: ubuntu-latest
57-
steps:
58-
- uses: actions/checkout@v5
59-
- name: Set up JDK 8
60-
uses: actions/setup-java@v5
61-
with:
62-
java-version: '8'
63-
distribution: 'temurin'
64-
cache: 'maven'
65-
- name: Build with Maven
66-
run: mvn site --file pom.xml -B --no-transfer-progress
53+
run: mvn package site --file pom.xml -B --no-transfer-progress -DskipTests

.github/workflows/release-site.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- uses: actions/checkout@v5
29-
- name: Set up JDK 8
29+
- name: Set up JDK 11
3030
uses: actions/setup-java@v5
3131
with:
32-
java-version: '8'
32+
java-version: '11'
3333
distribution: 'temurin'
3434
cache: 'maven'
3535
- name: Build site
3636
run: |
37-
mvn site --file pom.xml -B --no-transfer-progress
37+
mvn package site --file pom.xml -B --no-transfer-progress -DskipTests
3838
for i in `grep '<module>.*</module>' pom.xml`; do
3939
module=`echo $i | sed 's~<module>\(.*\)</module>~\1~g'`
4040
echo "Moving site for module $module to target/site"

pom.xml

Lines changed: 22 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
<parent>
2323
<groupId>com.github.robtimus</groupId>
2424
<artifactId>robtimus-parent</artifactId>
25-
<version>1.18</version>
25+
<version>2.0</version>
2626
<relativePath />
2727
</parent>
2828

2929
<artifactId>obfuscation-core</artifactId>
30-
<version>1.6-SNAPSHOT</version>
30+
<version>2.0-SNAPSHOT</version>
3131
<packaging>jar</packaging>
3232

3333
<name>obfuscation-core</name>
@@ -61,6 +61,10 @@
6161
<url>https://github.com/robtimus/obfuscation-core/issues</url>
6262
</issueManagement>
6363

64+
<properties>
65+
<version.java>11</version.java>
66+
</properties>
67+
6468
<dependencies>
6569
<dependency>
6670
<groupId>org.junit.jupiter</groupId>
@@ -91,6 +95,13 @@
9195
<plugin>
9296
<groupId>org.apache.maven.plugins</groupId>
9397
<artifactId>maven-dependency-plugin</artifactId>
98+
<executions>
99+
<execution>
100+
<goals>
101+
<goal>properties</goal>
102+
</goals>
103+
</execution>
104+
</executions>
94105
</plugin>
95106

96107
<plugin>
@@ -155,11 +166,6 @@
155166
</executions>
156167
</plugin>
157168

158-
<plugin>
159-
<groupId>org.moditect</groupId>
160-
<artifactId>moditect-maven-plugin</artifactId>
161-
</plugin>
162-
163169
<plugin>
164170
<groupId>com.github.robtimus</groupId>
165171
<artifactId>build-helper-maven-plugin</artifactId>
@@ -184,6 +190,15 @@
184190
<plugin>
185191
<groupId>org.apache.maven.plugins</groupId>
186192
<artifactId>maven-surefire-plugin</artifactId>
193+
<configuration>
194+
<argLine>
195+
@{argLine}
196+
-javaagent:${org.mockito:mockito-core:jar}
197+
<!-- Allow JUnit to fully access the test classes -->
198+
--add-opens com.github.robtimus.obfuscation/com.github.robtimus.obfuscation=ALL-UNNAMED
199+
--add-opens com.github.robtimus.obfuscation/com.github.robtimus.obfuscation.support=ALL-UNNAMED
200+
</argLine>
201+
</configuration>
187202
</plugin>
188203

189204
<plugin>
@@ -222,55 +237,4 @@
222237
</plugin>
223238
</plugins>
224239
</build>
225-
226-
<profiles>
227-
<profile>
228-
<id>native-module</id>
229-
<properties>
230-
<version.java>11</version.java>
231-
</properties>
232-
<build>
233-
<plugins>
234-
<plugin>
235-
<groupId>org.apache.maven.plugins</groupId>
236-
<artifactId>maven-surefire-plugin</artifactId>
237-
<configuration>
238-
<!-- Allow JUnit to fully access the test classes -->
239-
<argLine>
240-
@{argLine}
241-
--add-opens com.github.robtimus.obfuscation/com.github.robtimus.obfuscation=ALL-UNNAMED
242-
--add-opens com.github.robtimus.obfuscation/com.github.robtimus.obfuscation.support=ALL-UNNAMED
243-
</argLine>
244-
</configuration>
245-
</plugin>
246-
247-
<plugin>
248-
<groupId>org.moditect</groupId>
249-
<artifactId>moditect-maven-plugin</artifactId>
250-
<configuration>
251-
<skip>true</skip>
252-
</configuration>
253-
</plugin>
254-
255-
<plugin>
256-
<groupId>org.codehaus.mojo</groupId>
257-
<artifactId>build-helper-maven-plugin</artifactId>
258-
<executions>
259-
<execution>
260-
<phase>generate-sources</phase>
261-
<goals>
262-
<goal>add-source</goal>
263-
</goals>
264-
<configuration>
265-
<sources>
266-
<source>${project.basedir}/src/moditect</source>
267-
</sources>
268-
</configuration>
269-
</execution>
270-
</executions>
271-
</plugin>
272-
</plugins>
273-
</build>
274-
</profile>
275-
</profiles>
276240
</project>

src/main/java/com/github/robtimus/obfuscation/ObfuscatingProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public synchronized void load(InputStream inStream) throws IOException {
288288
}
289289

290290
@Override
291-
@Deprecated
291+
@Deprecated(since = "1.0", forRemoval = false)
292292
public synchronized void save(OutputStream out, String comments) {
293293
properties.save(out, comments);
294294
}

src/main/java/com/github/robtimus/obfuscation/Obfuscator.java

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,8 +1408,7 @@ public static PortionBuilder portion() {
14081408
* A builder for obfuscators that obfuscate a specific portion of their input.
14091409
* An obfuscator created with {@link #keepAtStart(int) keepAtStart(x)} and {@link #keepAtEnd(int) keepAtEnd(y)} will, for input {@code s},
14101410
* obfuscate all characters in the range {@code x} (inclusive) to {@link CharSequence#length() s.length()}{@code - y} (exclusive).
1411-
* If this range is empty, such an obfuscator will not obfuscate anything, unless if {@link #withFixedTotalLength(int)} or
1412-
* {@link #withFixedLength(int)} is specified.
1411+
* If this range is empty, such an obfuscator will not obfuscate anything, unless if {@link #withFixedTotalLength(int)} is specified.
14131412
*
14141413
* @author Rob Spoor
14151414
*/
@@ -1420,7 +1419,6 @@ public static final class PortionBuilder {
14201419
private int atLeastFromStart;
14211420
private int atLeastFromEnd;
14221421
private int fixedTotalLength;
1423-
private int fixedObfuscatedLength;
14241422
private char maskChar;
14251423

14261424
private PortionBuilder() {
@@ -1507,23 +1505,6 @@ public PortionBuilder withFixedTotalLength(int fixedTotalLength) {
15071505
return this;
15081506
}
15091507

1510-
/**
1511-
* Sets or removes the fixed number of {@link #withMaskChar(char) mask characters} to use for obfuscating.
1512-
* <p>
1513-
* This setting will be ignored if the {@link #withFixedTotalLength(int) fixed total length} is set.
1514-
*
1515-
* @param fixedObfuscatedLength The fixed number of mask characters, or a negative value to use the actual length of the input.
1516-
* The default is {@code -1}.
1517-
* @return This builder.
1518-
* @deprecated The total length of obfuscated contents can vary when using this setting, making it possible in certain cases to find the
1519-
* original value that was obfuscated. Use {@link #withFixedTotalLength(int)} instead.
1520-
*/
1521-
@Deprecated
1522-
public PortionBuilder withFixedLength(int fixedObfuscatedLength) {
1523-
this.fixedObfuscatedLength = Math.max(-1, fixedObfuscatedLength);
1524-
return this;
1525-
}
1526-
15271508
/**
15281509
* Sets the char that created obfuscators use for obfuscating.
15291510
*
@@ -1544,7 +1525,6 @@ public PortionBuilder withMaskChar(char maskChar) {
15441525
* <li>{@link #atLeastFromStart(int) atLeastFromStart(0)}</li>
15451526
* <li>{@link #atLeastFromEnd(int) atLeastFromEnd(0)}</li>
15461527
* <li>{@link #withFixedTotalLength(int) withFixedTotalLength(-1)}</li>
1547-
* <li>{@link #withFixedLength(int) withFixedLength(-1)}</li>
15481528
* <li>{@link #withMaskChar(char) withMaskChar('*')}</li>
15491529
* </ul>
15501530
*
@@ -1556,7 +1536,6 @@ public PortionBuilder withDefaults() {
15561536
atLeastFromStart(0);
15571537
atLeastFromEnd(0);
15581538
withFixedTotalLength(-1);
1559-
withFixedLength(-1);
15601539
withMaskChar(DEFAULT_MASK_CHAR);
15611540
return this;
15621541
}
@@ -1593,7 +1572,6 @@ private static final class PortionObfuscator extends Obfuscator {
15931572
private final int atLeastFromStart;
15941573
private final int atLeastFromEnd;
15951574
private final int fixedTotalLength;
1596-
private final int fixedObfuscatedLength;
15971575
private final char maskChar;
15981576

15991577
private PortionObfuscator(PortionBuilder builder) {
@@ -1602,7 +1580,6 @@ private PortionObfuscator(PortionBuilder builder) {
16021580
this.atLeastFromStart = builder.atLeastFromStart;
16031581
this.atLeastFromEnd = builder.atLeastFromEnd;
16041582
this.fixedTotalLength = builder.fixedTotalLength;
1605-
this.fixedObfuscatedLength = builder.fixedObfuscatedLength;
16061583
this.maskChar = builder.maskChar;
16071584

16081585
if (fixedTotalLength >= 0 && fixedTotalLength < keepAtStart + keepAtEnd) {
@@ -1650,9 +1627,6 @@ public CharSequence obfuscateText(CharSequence s, int start, int end) {
16501627

16511628
if (fixedTotalLength >= 0) {
16521629
length = fixedTotalLength;
1653-
} else if (fixedObfuscatedLength >= 0) {
1654-
// length - fromStart - fromEnd needs to be fixedObfuscatedLength, so length needs to be fixedObfuscatedLength + fromStart + fromEnd
1655-
length = fixedObfuscatedLength + fromStart + fromEnd;
16561630
}
16571631

16581632
char[] array = new char[length];
@@ -1680,9 +1654,6 @@ public void obfuscateText(CharSequence s, int start, int end, Appendable destina
16801654

16811655
if (fixedTotalLength >= 0) {
16821656
length = fixedTotalLength;
1683-
} else if (fixedObfuscatedLength >= 0) {
1684-
// length - fromStart - fromEnd needs to be fixedObfuscatedLength, so length needs to be fixedObfuscatedLength + fromStart + fromEnd
1685-
length = fixedObfuscatedLength + fromStart + fromEnd;
16861657
}
16871658

16881659
// first build the content as expected: 0 to fromStart non-obfuscated, then obfuscated, then end - fromEnd non-obfuscated
@@ -1723,14 +1694,13 @@ public boolean equals(Object o) {
17231694
PortionObfuscator other = (PortionObfuscator) o;
17241695
return keepAtStart == other.keepAtStart && keepAtEnd == other.keepAtEnd
17251696
&& atLeastFromStart == other.atLeastFromStart && atLeastFromEnd == other.atLeastFromEnd
1726-
&& fixedObfuscatedLength == other.fixedObfuscatedLength
17271697
&& fixedTotalLength == other.fixedTotalLength
17281698
&& maskChar == other.maskChar;
17291699
}
17301700

17311701
@Override
17321702
public int hashCode() {
1733-
return keepAtStart ^ keepAtEnd ^ atLeastFromStart ^ atLeastFromEnd ^ fixedObfuscatedLength ^ fixedTotalLength ^ maskChar;
1703+
return keepAtStart ^ keepAtEnd ^ atLeastFromStart ^ atLeastFromEnd ^ fixedTotalLength ^ maskChar;
17341704
}
17351705

17361706
@Override
@@ -1751,9 +1721,6 @@ public String toString() {
17511721
if (atLeastFromEnd > 0) {
17521722
sb.append("atLeastFromEnd=").append(atLeastFromEnd).append(',');
17531723
}
1754-
if (fixedObfuscatedLength >= 0) {
1755-
sb.append("fixedLength=").append(fixedObfuscatedLength).append(',');
1756-
}
17571724
if (fixedTotalLength >= 0) {
17581725
sb.append("fixedTotalLength=").append(fixedTotalLength).append(',');
17591726
}

src/main/java/com/github/robtimus/obfuscation/support/MapBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ private boolean contains(Entry<?, ?> entry) {
301301

302302
@Override
303303
public Iterator<Entry<String, V>> iterator() {
304-
return new Iterator<Entry<String, V>>() {
304+
return new Iterator<>() {
305305
private final Iterator<Entry<String, V>> caseSensitiveIterator = caseSensitiveMap.entrySet().iterator();
306306
private final Iterator<Entry<String, V>> caseInsensitiveIterator = caseInsensitiveMap.entrySet().iterator();
307307

src/moditect/module-info.java renamed to src/main/java/module-info.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18+
/**
19+
* Provides functionality for obfuscating text.
20+
*/
1821
module com.github.robtimus.obfuscation {
1922
exports com.github.robtimus.obfuscation;
2023
exports com.github.robtimus.obfuscation.support;

0 commit comments

Comments
 (0)