Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jOOQ compilation with GraalVM #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>2.5.1.Final</quarkus.version>
<org.jooq.version>3.15.5</org.jooq.version>
<org.jooq.version>3.15.12</org.jooq.version>
</properties>

<scm>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.quarkiverse.jooq.runtime.graal;

import java.util.function.BooleanSupplier;

public class PostgreSQLNotPresent implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
try {
Class.forName("org.postgresql.util.PGInterval");
return false;
} catch (ClassNotFoundException e) {
return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package io.quarkiverse.jooq.runtime.graal;

import org.jooq.types.DayToSecond;
import org.jooq.types.YearToMonth;
import org.jooq.types.YearToSecond;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(className = "org.jooq.util.postgres.PostgresUtils", onlyWith = PostgreSQLNotPresent.class)
public final class PostgresUtilsSubstitutions {

@Substitute
public static DayToSecond toDayToSecond(Object pgInterval) {
throw new IllegalArgumentException(
"Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + pgInterval);
}

@Substitute
public static YearToMonth toYearToMonth(Object pgInterval) {
throw new IllegalArgumentException(
"Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + pgInterval);
}

@Substitute
public static Object toPGInterval(DayToSecond interval) {
throw new IllegalArgumentException(
"Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + interval);

}

@Substitute
public static Object toPGInterval(YearToSecond interval) {
throw new IllegalArgumentException(
"Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + interval);
}

@Substitute
public static Object toPGInterval(YearToMonth interval) {
throw new IllegalArgumentException(
"Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + interval);
}

@Substitute
private static final boolean pgIntervalAvailable() {
return false;
}
}