Skip to content
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 4 commits into from
Dec 5, 2018
Merged

Issue469 compiler warnings #472

merged 4 commits into from
Dec 5, 2018

Conversation

eeverman
Copy link
Owner

Fixed the compiler warnings and added a test for it.
Fixes #469

…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
Copy link

codecov bot commented Nov 20, 2018

Codecov Report

Merging #472 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
...andtail/andhow/compile/AndHowCompileProcessor.java 92.55% <100%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2db61d...ed7fa24. Read the comment docs.

@eeverman
Copy link
Owner Author

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();
Copy link
Owner Author

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);
Copy link
Owner Author

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());
Copy link
Owner Author

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.

@eeverman eeverman merged commit fa35b8a into master Dec 5, 2018
@eeverman eeverman deleted the Issue469_compiler-warnings branch July 20, 2021 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants