-
Notifications
You must be signed in to change notification settings - Fork 903
Set supported Java source level to "9" #178
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
Conversation
cushon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); | ||
| context.put(DiagnosticListener.class, diagnostics); | ||
| Options.instance(context).put("allowStringFolding", "false"); | ||
| Options.instance(context).put("-source", options.javaSourceLevel()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a TODO so I remember to remove this once the default language level is 9. Also you can use the Option enum instead of the string "-source":
// TODO(cushon): this should default to the latest supported source level, remove this after backing out
// https://github.com/google/error-prone-javac/commit/c97f34ddd2308302587ce2de6d0c984836ea5b9f
Options.instance(context).put(Option.SOURCE, "9");| public class JavaFormatterOptions { | ||
|
|
||
| static final int DEFAULT_MAX_LINE_LENGTH = 100; | ||
| static final String DEFAULT_JAVA_SOURCE_LEVEL = "9"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need configuration. It would normally default to the latest supported language level, which is want we want. Explicitly setting -source 9 is a temporary work-around (see the TODO in my other comment).
|
|
||
| /** Tests for Java 9 source level related issues. */ | ||
| @RunWith(JUnit4.class) | ||
| public class Java9SourceLevelSupportTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's hold off on these tests until these features are implemented. I'd rather use the regular side car files for the test inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. I'll remove the file from the PR.
Btw, is somebody already coding the visitModule(ModuleTree node... method and friends? If not, I could give it shot.
|
Requested changes applied. |
|
Travis CI |
Fixes #176 by setting the default javac source level to "9".
This PR superseds #177 as it includes the failing and ignored as well.