-
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
Conversation
…ssor We don't care about new language constructs because we are only scanning for variable declaration of AndHow Properties. By using 'latestSupported', the version of whatever JDK is compiling will be accepted. * Added better class docs
Codecov Report
@@ Coverage Diff @@
## master #472 +/- ##
==========================================
+ Coverage 78.81% 78.82% +<.01%
==========================================
Files 122 122
Lines 3630 3631 +1
Branches 583 583
==========================================
+ Hits 2861 2862 +1
Misses 591 591
Partials 178 178
Continue to review full report at Codecov.
|
This was a small fix, but it stops two warnings from javac that were visible when the tests were run in the annotation processor. Those tests use spit out a lot of verbose stuff from javac that is not typically visible during compile, but anyone else doing something similar would see all those unneeded warnings. |
…piler-warnings # Conflicts: # andhow-annotation-processor/src/main/java/org/yarnandtail/andhow/compile/AndHowCompileProcessor.java # andhow-annotation-processor/src/test/java/org/yarnandtail/andhow/compile/AndHowCompileProcessorTest.java Updated per other merge.
@@ -39,6 +35,7 @@ | |||
public void setupTest() { | |||
compiler = ToolProvider.getSystemJavaCompiler(); | |||
manager = new MemoryFileManager(compiler); | |||
diagnostics = new DiagnosticCollector(); |
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.
@@ -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 comment
The 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 comment
The 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.
Fixed the compiler warnings and added a test for it.
Fixes #469