Skip to content

Commit

Permalink
Raise required Java version to 17
Browse files Browse the repository at this point in the history
  • Loading branch information
scordio committed Oct 9, 2024
1 parent 93f6300 commit f12bfe8
Show file tree
Hide file tree
Showing 94 changed files with 95 additions and 132 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '8'
java-version: '17'
cache: 'maven'
- name: Test
run: ./mvnw $MAVEN_ARGS verify
Expand All @@ -35,7 +35,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '8'
java-version: '17'
cache: 'maven'
- name: Test with Sonar
run: >
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
</scm>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Needed to properly bring in the Maven dependencies, see http://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html -->
<surefire.useSystemClassLoader>false</surefire.useSystemClassLoader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package ${package};
* }
* </pre>
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public class AutoCloseableSoftAssertions extends org.assertj.core.api.SoftAssertions implements AutoCloseable {
${all_assertions_entry_points}
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ${package};
/**
* Entry point for BDD assertions of different data types.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public class BddAssertions {
${all_assertions_entry_points}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ${package};
/**
* Entry point for BDD soft assertions of different data types.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public class BDDSoftAssertions extends org.assertj.core.api.BDDSoftAssertions {
${all_assertions_entry_points}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ${imports}
/**
* Abstract base class for {@link ${class_to_assert}} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class ${custom_assertion_class}<S extends ${custom_assertion_class}<S, A>, A extends ${class_to_assert}> extends ${super_assertion_class}<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ${imports}
/**
* {@link ${class_to_assert}} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public class ${custom_assertion_class} extends AbstractObjectAssert<${custom_assertion_class}, ${class_to_assert}> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ${imports}
* Although this class is not final to allow Soft assertions proxy, if you wish to extend it,
* extend {@link Abstract${custom_assertion_class}} instead.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public class ${custom_assertion_class} extends Abstract${custom_assertion_class}<${custom_assertion_class}, ${class_to_assert}> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package ${package};
* }
* }</code></pre>
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public class JUnitBDDSoftAssertions extends org.assertj.core.api.JUnitBDDSoftAssertions {
${all_assertions_entry_points}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package ${package};
* }
* }</code></pre>
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public class JUnitSoftAssertions extends org.assertj.core.api.JUnitSoftAssertions {
${all_assertions_entry_points}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ${package};
/**
* Entry point for soft assertions of different data types.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public class SoftAssertions extends org.assertj.core.api.SoftAssertions {
${all_assertions_entry_points}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package ${package};
* Entry point for assertions of different data types. Each method in this class is a static factory for the
* type-specific assertion objects.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public class Assertions {
${all_assertions_entry_points}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* this class was generated but kep in source control to see what was needed in term of import when dealing with nested classes
*/
@javax.annotation.Generated(value = "assertj-assertions-generator")
@javax.annotation.processing.Generated(value = "assertj-assertions-generator")
public class OuterClassStaticNestedPersonAssert
extends AbstractObjectAssert<OuterClassStaticNestedPersonAssert, OuterClass.StaticNestedPerson> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
package org.assertj.assertions.generator;

import com.google.common.base.Joiner;
import com.google.testing.compile.Compilation;
import com.google.testing.compile.CompilationSubject;
import com.google.testing.compile.Compiler;
Expand All @@ -23,12 +22,9 @@
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

public class GenerationHandler {

Expand All @@ -41,8 +37,7 @@ public class GenerationHandler {
GenerationHandler(Path root, Path resourcesDir) {
this.root = root;
this.resourcesDir = resourcesDir;
this.compiler = Compiler.javac()
.withOptions("-classpath", getClasspath(ClassLoader.getSystemClassLoader()));
this.compiler = Compiler.javac().withOptions("-classpath", System.getProperty("java.class.path"));
}

Path getResourcesDir() {
Expand Down Expand Up @@ -126,35 +121,4 @@ void compileGeneratedFilesFor(String generatedAssertionPackage, Class<?>... clas
compileGeneratedFiles(files);
}

/**
* Returns the current classpaths of the given classloader including its parents.
*
* @throws IllegalArgumentException if the given classloader had classpaths which we could not
* determine or use for compilation.
*/
private static String getClasspath(ClassLoader currentClassloader) {
ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();

// Add all URLClassloaders in the hierarchy till the system classloader.
List<URLClassLoader> classloaders = new ArrayList<>();
while (true) {
// We only know how to extract classpaths from URLClassloaders.
if (currentClassloader instanceof URLClassLoader) classloaders.add((URLClassLoader) currentClassloader);
else throw new IllegalArgumentException("Classpath for compilation could not be extracted as classloader is not a URLClassloader");

if (currentClassloader == systemClassLoader) break;
else currentClassloader = currentClassloader.getParent();
}

Set<String> classpaths = new LinkedHashSet<>();
for (URLClassLoader classLoader : classloaders) {
for (URL url : classLoader.getURLs()) {
if (url.getProtocol().equals("file")) classpaths.add(url.getPath());
else throw new IllegalArgumentException("Given classloader consists of classpaths which are unsupported for compilation.");
}
}

return Joiner.on(File.pathSeparatorChar).join(classpaths);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link AnnotatedClass} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractAnnotatedClassAssert<S extends AbstractAnnotatedClassAssert<S, A>, A extends AnnotatedClass> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractArtWorkAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link ArtWork} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractArtWorkAssert<S extends AbstractArtWorkAssert<S, A>, A extends ArtWork> extends AbstractObjectAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link AutoValueAnnotatedClass} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractAutoValueAnnotatedClassAssert<S extends AbstractAutoValueAnnotatedClassAssert<S, A>, A extends AutoValueAnnotatedClass> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractBlockBusterAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.assertj.assertions.generator.data;
/**
* Abstract base class for {@link BlockBuster} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractBlockBusterAssert<S extends AbstractBlockBusterAssert<S, A>, A extends BlockBuster> extends AbstractMovieAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link BooleanPredicates} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractBooleanPredicatesAssert<S extends AbstractBooleanPredicatesAssert<S, A>, A extends BooleanPredicates> extends AbstractObjectAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link ClassUsingDifferentClassesWithSameName} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractClassUsingDifferentClassesWithSameNameAssert<S extends AbstractClassUsingDifferentClassesWithSameNameAssert<S, A>, A extends ClassUsingDifferentClassesWithSameName> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractDollar$Assert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link Dollar$} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractDollar$Assert<S extends AbstractDollar$Assert<S, A>, A extends Dollar$> extends AbstractObjectAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link FieldPropertyClash} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractFieldPropertyClashAssert<S extends AbstractFieldPropertyClashAssert<S, A>, A extends FieldPropertyClash> extends AbstractObjectAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link InterferencePrimitives} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractInterferencePrimitivesAssert<S extends AbstractInterferencePrimitivesAssert<S, A>, A extends InterferencePrimitives> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractKeywordsAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.assertj.core.internal.Iterables;
/**
* Abstract base class for {@link Keywords} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractKeywordsAssert<S extends AbstractKeywordsAssert<S, A>, A extends Keywords> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractMovieAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.assertj.core.api.Assertions;
/**
* Abstract base class for {@link Movie} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractMovieAssert<S extends AbstractMovieAssert<S, A>, A extends Movie> extends AbstractArtWorkAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.assertj.core.internal.Iterables;
/**
* Abstract base class for {@link MultipleGenerics<T,U,V,W>} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractMultipleGenericsAssert<S extends AbstractMultipleGenericsAssert<S, A, T,U,V,W>, A extends MultipleGenerics<T,U,V,W>, T,U,V,W> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractNameAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractComparableAssert;
/**
* Abstract base class for {@link Name} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractNameAssert<S extends AbstractNameAssert<S, A>, A extends Name> extends AbstractComparableAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractOptionalAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link Optional} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractOptionalAssert<S extends AbstractOptionalAssert<S, A>, A extends Optional> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractPlayerAgentAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link PlayerAgent} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractPlayerAgentAssert<S extends AbstractPlayerAgentAssert<S, A>, A extends PlayerAgent> extends AbstractObjectAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link PlayerAgent} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractPlayerAgentAssert<S extends AbstractPlayerAgentAssert<S, A>, A extends PlayerAgent> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractPlayerAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.assertj.core.internal.Iterables;
/**
* Abstract base class for {@link Player} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractPlayerAssert<S extends AbstractPlayerAssert<S, A>, A extends Player> extends AbstractObjectAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.assertj.core.internal.Iterables;
/**
* Abstract base class for {@link Player} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractPlayerAssert<S extends AbstractPlayerAssert<S, A>, A extends Player> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractPrimitivesAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.assertj.core.api.Assertions;
/**
* Abstract base class for {@link Primitives} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractPrimitivesAssert<S extends AbstractPrimitivesAssert<S, A>, A extends Primitives> extends AbstractObjectAssert<S, A> {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/AbstractTeamAssert.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.assertj.core.internal.Iterables;
/**
* Abstract base class for {@link Team} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractTeamAssert<S extends AbstractTeamAssert<S, A>, A extends Team> extends AbstractObjectAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.util.Objects;
/**
* Abstract base class for {@link WithPrivateFields} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractWithPrivateFieldsAssert<S extends AbstractWithPrivateFieldsAssert<S, A>, A extends WithPrivateFields> extends AbstractWithPrivateFieldsParentAssert<S, A> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.assertj.core.api.AbstractObjectAssert;
/**
* Abstract base class for {@link WithPrivateFieldsParent} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
@javax.annotation.processing.Generated(value="assertj-assertions-generator")
public abstract class AbstractWithPrivateFieldsParentAssert<S extends AbstractWithPrivateFieldsParentAssert<S, A>, A extends WithPrivateFieldsParent> extends AbstractObjectAssert<S, A> {

/**
Expand Down
Loading

0 comments on commit f12bfe8

Please sign in to comment.