-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Use JDK7 and JDK8 Code Features #1564
Conversation
59471c8
to
a464ceb
Compare
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.
You found a whole lot of diamonds ;-)
Thanks for preparing this. I left two inline comments, that might make sense.
test/com/sun/jna/DirectTest.java
Outdated
@@ -202,8 +204,8 @@ public void testGetOptionsForDirectMappingWithMemberInitializer() { | |||
}; | |||
final TypeMapper mapper = new DefaultTypeMapper(); | |||
final int alignment = Structure.ALIGN_NONE; | |||
final String encoding = System.getProperty("file.encoding"); | |||
Map<String, Object> options = new HashMap<String, Object>(); | |||
final String encoding = Charset.defaultCharset().displayName(); |
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.
Not sure here, but the display name, that is even localized, seems wrong. The canonical name of the charset seems to be a better fit:
final String encoding = Charset.defaultCharset().displayName(); | |
final String encoding = Charset.defaultCharset().name(); |
Same would apply in line 228
test/com/sun/jna/NativeTest.java
Outdated
@@ -85,7 +85,7 @@ public void testLongStringGeneration() { | |||
} | |||
|
|||
public void testCustomStringEncoding() throws Exception { | |||
final String ENCODING = System.getProperty("file.encoding"); | |||
final String ENCODING = Charset.defaultCharset().displayName(); |
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.
See comment in DirectTest
(same on line 480)
To be fair, Eclipse found them, plus a few others that it shouldn't have. The "Clean Up" tool made this easy.
The suggestion was Eclipse's. Given Eclipse's failure with the diamonds on anonymous subclasses, I trust it less now, so looking into this.
So it looks like your suggestion is a good one, although in theory if someone had a "human readable" I'll update to your suggestion. It's in a test class anyway so not critical, worst case is a failed test someone has to debug. |
Signed-off-by: Daniel Widdis <[email protected]>
Will follow up with a similar PR for platform tonight. |
Used IDE cleanup tool with manual reverting of the anonymous inner class fixes to apply the following (each in a separate commit for ease of review or if you only want a portion of the changes):