-
Notifications
You must be signed in to change notification settings - Fork 34
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
Issue469 compiler warnings #472
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ba50244
Overrode the getSupportedSourceVersion method to the Annotation proce…
ee-usgs aabd3ce
Added a test to ensure we are not getting compiler warnings
ee-usgs 8e86148
Formatted for consistent tabs
ee-usgs ed7fa24
Merge branch 'master' of github.com:eeverman/andhow into Issue469_com…
ee-usgs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import java.nio.charset.Charset; | ||
import java.util.*; | ||
import javax.tools.*; | ||
import javax.tools.Diagnostic.Kind; | ||
import org.junit.Test; | ||
import org.yarnandtail.andhow.util.IOUtil; | ||
|
||
|
@@ -40,13 +41,15 @@ public void testServiceRegistrationOfOneProdAndOneTestInit() throws Exception { | |
sources.add(buildTestSource(pkg, AndHowTestInitAbstract_NAME)); | ||
sources.add(buildTestSource(pkg, AndHowTestInitA_NAME)); | ||
|
||
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, null, options, null, sources); | ||
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, diagnostics, options, null, sources); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the diagnostic collector to the compiler task. |
||
task.setProcessors(Collections.singleton(new AndHowCompileProcessor())); | ||
task.call(); | ||
|
||
String prodInitSvs = IOUtil.toString(loader.getResourceAsStream(INIT_SVS_PATH), Charset.forName("UTF-8")); | ||
String testInitSvs = IOUtil.toString(loader.getResourceAsStream(TEST_INIT_SVS_PATH), Charset.forName("UTF-8")); | ||
|
||
assertEquals("Should be no warn/errors", 0, diagnostics.getDiagnostics().stream().filter( | ||
d -> d.getKind().equals(Kind.ERROR) || d.getKind().equals(Kind.WARNING)).count()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...and check it here. There should be no ERROR or WARNING type messages. |
||
|
||
// | ||
//Test the initiation files | ||
|
@@ -66,12 +69,15 @@ public void testServiceRegistrationOfOneProdInit() throws Exception { | |
sources.add(buildTestSource(pkg, AndHowInitAbstract_NAME)); | ||
sources.add(buildTestSource(pkg, AndHowInitA_NAME)); | ||
|
||
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, null, options, null, sources); | ||
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, diagnostics, options, null, sources); | ||
task.setProcessors(Collections.singleton(new AndHowCompileProcessor())); | ||
task.call(); | ||
|
||
String prodInitSvs = IOUtil.toString(loader.getResourceAsStream(INIT_SVS_PATH), Charset.forName("UTF-8")); | ||
|
||
assertEquals("Should be no warn/errors", 0, diagnostics.getDiagnostics().stream().filter( | ||
d -> d.getKind().equals(Kind.ERROR) || d.getKind().equals(Kind.WARNING)).count()); | ||
|
||
// | ||
//Test the initiation files | ||
assertNotNull(prodInitSvs); | ||
|
@@ -87,12 +93,15 @@ public void testServiceRegistrationOfOneTestInit() throws Exception { | |
sources.add(buildTestSource(pkg, AndHowTestInitAbstract_NAME)); | ||
sources.add(buildTestSource(pkg, AndHowTestInitA_NAME)); | ||
|
||
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, null, options, null, sources); | ||
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, diagnostics, options, null, sources); | ||
task.setProcessors(Collections.singleton(new AndHowCompileProcessor())); | ||
task.call(); | ||
|
||
String testInitSvs = IOUtil.toString(loader.getResourceAsStream(TEST_INIT_SVS_PATH), Charset.forName("UTF-8")); | ||
|
||
assertEquals("Should be no warn/errors", 0, diagnostics.getDiagnostics().stream().filter( | ||
d -> d.getKind().equals(Kind.ERROR) || d.getKind().equals(Kind.WARNING)).count()); | ||
|
||
|
||
// | ||
//Test the initiation files | ||
|
@@ -116,6 +125,8 @@ public void testServiceRegistrationOfAndHowInitWithTooManyProdInstances() throws | |
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, null, options, null, sources); | ||
task.setProcessors(Collections.singleton(new AndHowCompileProcessor())); | ||
task.call(); | ||
|
||
fail("Should have thrown an exception"); | ||
|
||
} catch (RuntimeException e) { | ||
|
||
|
@@ -155,6 +166,8 @@ public void testServiceRegistrationOfAndHowInitWithTooManyTestInstances() throws | |
task.setProcessors(Collections.singleton(new AndHowCompileProcessor())); | ||
task.call(); | ||
|
||
fail("Should have thrown an exception"); | ||
|
||
} catch (RuntimeException e) { | ||
|
||
assertNotNull(e.getCause()); | ||
|
@@ -195,6 +208,8 @@ public void testServiceRegistrationOfAndHowInitWithTooManyInstAndBadProperties() | |
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, null, options, null, sources); | ||
task.setProcessors(Collections.singleton(new AndHowCompileProcessor())); | ||
task.call(); | ||
|
||
fail("Should have thrown an exception"); | ||
|
||
} catch (RuntimeException e) { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Added a way to get the diagnostic messages (the javac version of logging) during the testing. This has the side benefit of preventing them from being printed out during the test.