diff --git a/manifold-core-parent/manifold/src/main/java/manifold/api/util/JavacUtil.java b/manifold-core-parent/manifold/src/main/java/manifold/api/util/JavacUtil.java index c7c9d72d0..590ae682b 100644 --- a/manifold-core-parent/manifold/src/main/java/manifold/api/util/JavacUtil.java +++ b/manifold-core-parent/manifold/src/main/java/manifold/api/util/JavacUtil.java @@ -18,7 +18,9 @@ import com.sun.tools.javac.processing.JavacProcessingEnvironment; import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.Options; import manifold.internal.javac.JavacPlugin; +import manifold.util.JreUtil; import javax.lang.model.SourceVersion; @@ -35,4 +37,17 @@ public static int getSourceNumber() { return getSourceVersion().ordinal(); } + + public static int getReleaseNumber() + { + String release = Options.instance( JavacPlugin.instance().getContext() ).get( "--release" ); + try + { + return Integer.parseInt( release ); + } + catch( NumberFormatException e ) + { + return JreUtil.JAVA_VERSION; + } + } } diff --git a/manifold-core-parent/manifold/src/main/java/manifold/internal/javac/SrcClassUtil.java b/manifold-core-parent/manifold/src/main/java/manifold/internal/javac/SrcClassUtil.java index 42bdb917a..9f7ff5176 100644 --- a/manifold-core-parent/manifold/src/main/java/manifold/internal/javac/SrcClassUtil.java +++ b/manifold-core-parent/manifold/src/main/java/manifold/internal/javac/SrcClassUtil.java @@ -35,6 +35,7 @@ import manifold.api.gen.*; import manifold.api.host.IModule; +import manifold.api.util.JavacUtil; import manifold.rt.api.util.ManEscapeUtil; import manifold.util.JreUtil; import manifold.util.ReflectUtil; @@ -976,7 +977,7 @@ private boolean isExpired( Symbol symbol ) { for( Pair value: annotationMirror.values ) { - return JreUtil.JAVA_VERSION >= (int)value.snd.getValue(); + return JavacUtil.getReleaseNumber() >= (int)value.snd.getValue(); } } } diff --git a/manifold-deps-parent/manifold-ext/src/main/java/manifold/ext/ExtCodeGen.java b/manifold-deps-parent/manifold-ext/src/main/java/manifold/ext/ExtCodeGen.java index 87bfbc978..62cbf5931 100644 --- a/manifold-deps-parent/manifold-ext/src/main/java/manifold/ext/ExtCodeGen.java +++ b/manifold-deps-parent/manifold-ext/src/main/java/manifold/ext/ExtCodeGen.java @@ -28,6 +28,7 @@ import manifold.api.host.IModule; import manifold.api.type.ITypeManifold; import manifold.api.util.JavacDiagnostic; +import manifold.api.util.JavacUtil; import manifold.ext.rt.ExtensionMethod; import manifold.ext.rt.ForwardingExtensionMethod; import manifold.ext.rt.api.Expires; @@ -649,7 +650,7 @@ private boolean isExtensionMethod( AbstractSrcMethod method, SrcClass extendedTy SrcAnnotationExpression expires = method.getAnnotation( Expires.class ); if( expires != null && - JreUtil.JAVA_VERSION >= Integer.parseInt( expires.getArgument( "value" ).getValue().toString() ) ) + JavacUtil.getReleaseNumber() >= Integer.parseInt( expires.getArgument( "value" ).getValue().toString() ) ) { // on or past the method's expiration jdk return false;