/** Add the @Generated annotation to the given target. * * @param target the target of the annotation. * @param context the generation context. * @param sarlCode the code that is the cause of the generation. */ protected void appendGeneratedAnnotation(JvmAnnotationTarget target, GenerationContext context, String sarlCode) { final GeneratorConfig config = context.getGeneratorConfig(); if (config.isGenerateGeneratedAnnotation()) { addAnnotationSafe(target, Generated.class, getClass().getName()); } if (target instanceof JvmFeature) { addAnnotationSafe(target, SyntheticMember.class); } if (!Strings.isNullOrEmpty(sarlCode)) { addAnnotationSafe(target, SarlSourceCode.class, sarlCode); } }
/** Replies if the compiler is using Java8 or higher. * * @return <code>true</code> if the compiler uses Java8 or higher. Otherwise <code>false</code>. */ public boolean isAtLeastJava8() { final JavaVersion javaVersion = JavaVersion.fromQualifier(SARLVersion.MINIMAL_JDK_VERSION); return javaVersion != null && getGeneratorConfig().getJavaSourceVersion().isAtLeast(javaVersion); }