[JAVA-3205] Address compiler warnings when targeting Java 8 Created: 14/Feb/19  Updated: 28/Oct/23  Resolved: 05/Apr/19

Status: Closed
Project: Java Driver
Component/s: Build
Affects Version/s: None
Fix Version/s: 4.0.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Now that we are targeting Java 8 source and target compatibility in the 4.x branch, some new generics-related compiler warnings are appearing during compilation. Examples include

/Users/jeff/mongo-java-driver/driver-core/src/main/com/mongodb/operation/CommandOperationHelper.java:112: warning: [overloads] <T#1>executeWrappedCommandProtocol(ReadBinding,String,BsonDocument,CommandTransformer<BsonDocument,T#1>) in CommandOperationHelper is potentially ambiguous with <T#2>executeWrappedCommandProtocol(ReadBinding,String,BsonDocument,Decoder<T#2>) in CommandOperationHelper
    static <T> T executeWrappedCommandProtocol(final ReadBinding binding, final String database, final BsonDocument command,
 
/Users/jeff/mongo-java-driver/driver-core/src/main/com/mongodb/client/model/Filters.java:163: warning: [unchecked] Possible heap pollution from parameterized vararg type TItem
    public static <TItem> Bson in(final String fieldName, final TItem... values)
 

The purpose of this ticket is to address or suppress these warnings so they don't distract us from new problems.



 Comments   
Comment by Githook User [ 15/Jan/20 ]

Author:

{'name': 'Jeff Yemin', 'username': 'jyemin', 'email': 'jeff.yemin@10gen.com'}

Message: Suppress extraneous compiler warnings

  • suppress warnings for "overloads" and "varargs" where appropriate
  • Add SafeVarArgs annotation where appropriate

JAVA-3205
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/da0774fde0b208286f888f40827aafae113d3026

Generated at Thu Feb 08 08:59:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.