Skip to content

Commit b9548da

Browse files
--enable-preview is only available since Java 11
1 parent 0cbf377 commit b9548da

2 files changed

Lines changed: 2 additions & 20 deletions

File tree

src/main/java/pl/joegreen/lambdaFromString/LambdaFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import pl.joegreen.lambdaFromString.classFactory.ClassCompilationException;
44
import pl.joegreen.lambdaFromString.classFactory.ClassFactory;
5+
import pl.joegreen.lambdaFromString.classFactory.DefaultClassFactory;
56

67
import javax.tools.JavaCompiler;
78
import java.lang.reflect.Method;
@@ -88,7 +89,7 @@ public <T> T createLambda(String code, TypeReference<T> typeReference) throws La
8889
}
8990

9091
private List<String> createOptionsForCompilationClasspath(String compilationClassPath, boolean enablePreview) {
91-
if (enablePreview) {
92+
if (enablePreview && DefaultClassFactory.getJavaVersion() >= 11) {
9293
return Arrays.asList("-classpath", compilationClassPath, "--enable-preview");
9394
}
9495

src/test/java/pl/joegreen/lambdaFromString/DefaultCompilerSetter.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)