Skip to content

Conversation

@sormuras
Copy link
Contributor

Fixes #176 by setting the default javac source level to "9".

This PR superseds #177 as it includes the failing and ignored as well.

Copy link
Collaborator

@cushon cushon left a 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());
Copy link
Collaborator

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";
Copy link
Collaborator

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 {
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

@sormuras
Copy link
Contributor Author

Requested changes applied.

@sormuras
Copy link
Contributor Author

sormuras commented Aug 21, 2017

Travis CI is having had troubles starting the PR build.

@cushon cushon merged commit 1651bf6 into google:master Aug 21, 2017
@sormuras sormuras deleted the java-9-source-level-support branch August 22, 2017 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants