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

Fix warnings #124

Merged
merged 4 commits into from Oct 28, 2013
Merged

Fix warnings #124

merged 4 commits into from Oct 28, 2013

Conversation

@sharwell
Copy link
Contributor

@sharwell sharwell commented Sep 23, 2013

  • Fix improper/sub-optimal generics usage
  • Call static method directly, not through instance
  • Improved specification of compiler arguments in pom.xml

After this change, the project builds without warnings even with -Xlint -Xlint:-serial.

@ndw
Copy link
Owner

@ndw ndw commented Sep 24, 2013

Interesting. A useful refresher on some aspects of generics I've not used a lot. A couple of questions.

  1. In places like BaseURI.java, what motivates the use of <?>. It doesn't seem to have any consequences elsewhere, though perhaps it avoids a compiler warning that I haven't noticed.
  2. In Template.java, and a few other places, what motivated changing Iterator<String> prefixes to Iterator<?> prefixes and adding a (String) cast?
@sharwell
Copy link
Contributor Author

@sharwell sharwell commented Sep 24, 2013

I rebased this change on commit 9976a12, and added an additional commit to address warnings that were introduced by 2733096 (a commit which was added after my original work on this branch).

@sharwell
Copy link
Contributor Author

@sharwell sharwell commented Sep 24, 2013

To answer your questions:

  1. SequenceIterator is a generic type. In these cases, we don't care what the generic type argument is so using <?> fixes the lint warnings without requiring changing a bunch of the code.
  2. This is the most "interesting" change of the branch IMO, because it seems to be removing generics. It turns out that iteratePrefixes() in the Saxon library returns Iterator (no generic argument specified), which can be implicitly assigned to Iterator<String>, but that introduces an unchecked warning. You can also assign it to Iterator, but that introduces a rawtypes warning. Assigning it to Iterator<?> is safe and does not result in any warnings, but like using a raw Iterator the next() method will require a cast to the target type.
@ndw ndw merged commit 9976a12 into ndw:saxon94 Oct 28, 2013
ndw added a commit that referenced this pull request Oct 28, 2013
@sharwell sharwell deleted the sharwell:fix-warnings branch Oct 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.