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

Replace explicit types with <> (The diamond operator). #420

Merged
merged 1 commit into from
Aug 31, 2017

Conversation

JamieMagee
Copy link
Member

This removes duplicated information when instantiating variables, and increases the readability. For example:

EnumMap<CallableHandles, HandleAssociation> handleMap =
      new EnumMap<CallableHandles, HandleAssociation>(CallableHandles.class);

becomes

EnumMap<CallableHandles, HandleAssociation> handleMap =
            new EnumMap<>(CallableHandles.class);

and

private static final EnumMap<SSType.Category, EnumSet<JDBCType.Category>> conversionMap =
            new EnumMap<SSType.Category, EnumSet<JDBCType.Category>>(SSType.Category.class);

becomes

private static final EnumMap<SSType.Category, EnumSet<JDBCType.Category>> conversionMap =
                new EnumMap<>(SSType.Category.class);

This removes duplicated information when instantiating variables, and increases the readability. For example:

```Java
EnumMap<CallableHandles, HandleAssociation> handleMap =
      new EnumMap<CallableHandles, HandleAssociation>(CallableHandles.class);
```

becomes

```Java
EnumMap<CallableHandles, HandleAssociation> handleMap =
            new EnumMap<>(CallableHandles.class);
```

and

```Java
private static final EnumMap<SSType.Category, EnumSet<JDBCType.Category>> conversionMap =
            new EnumMap<SSType.Category, EnumSet<JDBCType.Category>>(SSType.Category.class);
```

becomes

```Java
private static final EnumMap<SSType.Category, EnumSet<JDBCType.Category>> conversionMap =
                new EnumMap<>(SSType.Category.class);
```
@codecov-io
Copy link

codecov-io commented Jul 31, 2017

Codecov Report

Merging #420 into dev will increase coverage by 0.09%.
The diff coverage is 76.36%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #420      +/-   ##
============================================
+ Coverage     45.92%   46.01%   +0.09%     
- Complexity     2198     2202       +4     
============================================
  Files           108      108              
  Lines         25210    25210              
  Branches       4164     4164              
============================================
+ Hits          11577    11601      +24     
+ Misses        11711    11681      -30     
- Partials       1922     1928       +6
Flag Coverage Δ Complexity Δ
#JDBC41 45.77% <76.36%> (+0.08%) 2188 <10> (+3) ⬆️
#JDBC42 45.83% <76.36%> (+0.02%) 2196 <10> (+4) ⬆️
Impacted Files Coverage Δ Complexity Δ
...com/microsoft/sqlserver/jdbc/dns/DNSUtilities.java 0% <0%> (ø) 0 <0> (ø) ⬇️
.../microsoft/sqlserver/jdbc/SQLServerXAResource.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...om/microsoft/sqlserver/jdbc/JaasConfiguration.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...om/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java 52.61% <100%> (-0.39%) 241 <6> (-2)
...m/microsoft/sqlserver/jdbc/SQLServerDataTable.java 57.25% <100%> (ø) 23 <0> (ø) ⬇️
...oft/sqlserver/jdbc/SQLServerCallableStatement.java 22.81% <100%> (ø) 74 <0> (ø) ⬇️
...m/microsoft/sqlserver/jdbc/SQLServerStatement.java 59.57% <100%> (ø) 138 <0> (ø) ⬇️
...oft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java 42.12% <100%> (ø) 28 <0> (ø) ⬇️
src/main/java/com/microsoft/sqlserver/jdbc/AE.java 70.83% <100%> (ø) 0 <0> (ø) ⬇️
...soft/sqlserver/jdbc/SQLServerDatabaseMetaData.java 29.47% <100%> (ø) 48 <1> (ø) ⬇️
... and 27 more

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 7741ee9...1b0224c. Read the comment docs.

Copy link
Member

@cheenamalhotra cheenamalhotra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any issues with these changes. Thank you @JamieMagee for improving code readability and removing explicit types.

@cheenamalhotra cheenamalhotra added this to the 6.3.2 milestone Aug 24, 2017
@JamieMagee
Copy link
Member Author

@cheenamalhotra Thanks for the review. Is it possible to merge this?

@peterbae
Copy link
Contributor

Testing was good. Merging in.

@peterbae peterbae merged commit 1b0224c into microsoft:dev Aug 31, 2017
@JamieMagee JamieMagee deleted the explicit-type-diamond branch September 1, 2017 09:27
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.

5 participants