Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java')
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
index 0336bb2867..f4267e7df2 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -126,13 +126,13 @@ public class DefaultCodeFormatter extends CodeFormatter {
this.workingOptions = new DefaultCodeFormatterOptions(options);
this.oldCommentFormatOption = getOldCommentFormatOption(options);
String compilerSource = options.get(CompilerOptions.OPTION_Source);
- this.sourceLevel = compilerSource != null ? compilerSource : CompilerOptions.VERSION_11;
+ this.sourceLevel = compilerSource != null ? compilerSource : CompilerOptions.VERSION_12;
} else {
Map<String, String> settings = DefaultCodeFormatterConstants.getJavaConventionsSettings();
this.originalOptions = new DefaultCodeFormatterOptions(settings);
this.workingOptions = new DefaultCodeFormatterOptions(settings);
this.oldCommentFormatOption = DefaultCodeFormatterConstants.TRUE;
- this.sourceLevel = CompilerOptions.VERSION_11;
+ this.sourceLevel = CompilerOptions.VERSION_12;
}
if (defaultCodeFormatterOptions != null) {
this.originalOptions.set(defaultCodeFormatterOptions.getMap());
@@ -332,7 +332,7 @@ public class DefaultCodeFormatter extends CodeFormatter {
}
private ASTParser createParser(int kind) {
- ASTParser parser = ASTParser.newParser(AST.JLS11);
+ ASTParser parser = ASTParser.newParser(AST.JLS12);
if (kind == K_MODULE_INFO) {
parser.setSource(createDummyModuleInfoCompilationUnit());
@@ -344,6 +344,8 @@ public class DefaultCodeFormatter extends CodeFormatter {
Map<String, String> parserOptions = JavaCore.getOptions();
parserOptions.put(CompilerOptions.OPTION_Source, this.sourceLevel);
parserOptions.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
+ parserOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED); //TODO
+ parserOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
parser.setCompilerOptions(parserOptions);
return parser;
}

Back to the top