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

[eclipse/xtext-core#1835] better treatment of unsupported Java versions in Xtext #198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,18 @@ class XtextGradleBuilder implements IncrementalXtextBuilder {
attachToEmfObject(resourceSet)
language2GeneratorConfig.putAll(
gradleRequest.generatorConfigsByLanguage.mapValues [ gradleConfig |
val javaVersion = JavaVersion.fromQualifier(gradleConfig.javaSourceLevel.toString)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

am not sure how we should react here.
Java 11 as default is not available as we compile against old version.
maybe we should stop here and report error instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should make this an error.

if (javaVersion === null) {
val msg = "Xtext does not support Java " + gradleConfig.javaSourceLevel.toString + "."
gradleRequest.logger.error(msg)
throw new GradleException(msg)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it ok to throw here or should we continue with default and just log error

}
new GeneratorConfig => [
generateSyntheticSuppressWarnings = gradleConfig.isGenerateSyntheticSuppressWarnings
generateGeneratedAnnotation = gradleConfig.isGenerateGeneratedAnnotation
includeDateInGeneratedAnnotation = gradleConfig.isIncludeDateInGeneratedAnnotation
includeDateInGeneratedAnnotation = gradleConfig.isIncludeDateInGeneratedAnnotation
generatedAnnotationComment = gradleConfig.generatedAnnotationComment
javaSourceVersion = JavaVersion.fromQualifier(gradleConfig.javaSourceLevel.toString)
javaSourceVersion = javaVersion ?: JavaVersion.JAVA8
]
]
)
Expand Down