You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/03/10 15:42:55 UTC

[GitHub] [lucene-solr] aroopganguly opened a new pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

aroopganguly opened a new pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335
 
 
   
   
   # Description
   
   there was an unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
   
   # Solution
   fixed an unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
   # Tests
   
   no new test added, but all existing test suite succeed with warning now gone.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [x] I have created a Jira issue and added the issue ID to my pull request title.
   - [x] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [x] I have developed this patch against the `master` branch.
   - [x] I have run `ant precommit` and the appropriate test suite.
   - [x] I have run `gradlew precommit` and the appropriate test suite.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Ref Guide](https://github.com/apache/lucene-solr/tree/master/solr/solr-ref-guide) (for Solr changes only).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] aroopganguly commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
aroopganguly commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#issuecomment-597734765
 
 
   Thanks @anshumg I have added a changelog entry as advised.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] tflobbe commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
tflobbe commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#discussion_r391143892
 
 

 ##########
 File path: solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
 ##########
 @@ -287,6 +289,45 @@ public void testAllTypes() throws IOException {
     );
   }
 
+  @Test
+  public void testReadMapEntry() throws IOException {
+    Map.Entry<Object, Object> extryFromTextDoc1 = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+    Map.Entry<Object, Object> extryFromTextDoc1_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+
+    Map.Entry<Object, Object> extryFromTextDoc2 = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+    Map.Entry<Object, Object> extryFromTextDoc2_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+
+    // exactly same document read twice should have same content
+    assert (extryFromTextDoc1.equals(extryFromTextDoc1_clone));
 
 Review comment:
   While this would work because we force to enable assertions while running tests, we usually use JUnit's assertions, such as `assertEquals("", obj1, obj2);`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] noblepaul commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
noblepaul commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#issuecomment-597392672
 
 
   LGTM
   
   a test can help

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] aroopganguly commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
aroopganguly commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#issuecomment-597827316
 
 
   closing this PR in favor of https://github.com/apache/lucene-solr/pull/1344 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] anshumg commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
anshumg commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#issuecomment-597473846
 
 
   LGTM. Thanks for adding the test.
   
   Can you please also add a CHANGELOG entry?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] tflobbe commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
tflobbe commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#discussion_r391146435
 
 

 ##########
 File path: solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
 ##########
 @@ -287,6 +289,45 @@ public void testAllTypes() throws IOException {
     );
   }
 
+  @Test
+  public void testReadMapEntry() throws IOException {
+    Map.Entry<Object, Object> extryFromTextDoc1 = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+    Map.Entry<Object, Object> extryFromTextDoc1_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+
+    Map.Entry<Object, Object> extryFromTextDoc2 = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+    Map.Entry<Object, Object> extryFromTextDoc2_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+
+    // exactly same document read twice should have same content
+    assert (extryFromTextDoc1.equals(extryFromTextDoc1_clone));
+    // doc1 and doc2 are 2 text files with different content on line 1
+    assert (!extryFromTextDoc2.equals(extryFromTextDoc1));
+    // exactly same document read twice should have same content
+    assert (extryFromTextDoc2.equals(extryFromTextDoc2_clone));
+
+    // now lets look at binary files
 
 Review comment:
   suggestion, maybe take this to a different method?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] tflobbe commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
tflobbe commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#discussion_r391150799
 
 

 ##########
 File path: solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
 ##########
 @@ -287,6 +289,45 @@ public void testAllTypes() throws IOException {
     );
   }
 
+  @Test
+  public void testReadMapEntry() throws IOException {
+    Map.Entry<Object, Object> extryFromTextDoc1 = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+    Map.Entry<Object, Object> extryFromTextDoc1_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+
+    Map.Entry<Object, Object> extryFromTextDoc2 = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+    Map.Entry<Object, Object> extryFromTextDoc2_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+
+    // exactly same document read twice should have same content
+    assert (extryFromTextDoc1.equals(extryFromTextDoc1_clone));
+    // doc1 and doc2 are 2 text files with different content on line 1
+    assert (!extryFromTextDoc2.equals(extryFromTextDoc1));
+    // exactly same document read twice should have same content
+    assert (extryFromTextDoc2.equals(extryFromTextDoc2_clone));
+
+    // now lets look at binary files
+    Map.Entry<Object, Object> entryFromBinFileA = getMapFromJavaBinCodec(SOLRJ_JAVABIN_BACKCOMPAT_BIN);
+    Map.Entry<Object, Object> entryFromBinFileA_clone = getMapFromJavaBinCodec(SOLRJ_JAVABIN_BACKCOMPAT_BIN);
+
+    // as the equals assertion is based on the hashcode, even the same exact bin file
+    // will produce different Objects and hence different hashcodes
 
 Review comment:
   this is interesting. what's the type of the objects in the map for this case?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] aroopganguly commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
aroopganguly commented on issue #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#issuecomment-597466952
 
 
   @noblepaul tests added and some points to ponder upon as well in the Tests section in the main section of the PR above.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] aroopganguly closed pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
aroopganguly closed pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] aroopganguly commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
aroopganguly commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#discussion_r391184047
 
 

 ##########
 File path: solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
 ##########
 @@ -287,6 +289,45 @@ public void testAllTypes() throws IOException {
     );
   }
 
+  @Test
+  public void testReadMapEntry() throws IOException {
+    Map.Entry<Object, Object> extryFromTextDoc1 = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+    Map.Entry<Object, Object> extryFromTextDoc1_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+
+    Map.Entry<Object, Object> extryFromTextDoc2 = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+    Map.Entry<Object, Object> extryFromTextDoc2_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+
+    // exactly same document read twice should have same content
+    assert (extryFromTextDoc1.equals(extryFromTextDoc1_clone));
 
 Review comment:
   sure !

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] aroopganguly commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method

Posted by GitBox <gi...@apache.org>.
aroopganguly commented on a change in pull request #1335: SOLR-14316 Remove unchecked type conversion warning in JavaBinCodec's readMapEntry's equals() method
URL: https://github.com/apache/lucene-solr/pull/1335#discussion_r391184644
 
 

 ##########
 File path: solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
 ##########
 @@ -287,6 +289,45 @@ public void testAllTypes() throws IOException {
     );
   }
 
+  @Test
+  public void testReadMapEntry() throws IOException {
+    Map.Entry<Object, Object> extryFromTextDoc1 = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+    Map.Entry<Object, Object> extryFromTextDoc1_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_1);
+
+    Map.Entry<Object, Object> extryFromTextDoc2 = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+    Map.Entry<Object, Object> extryFromTextDoc2_clone = getMapFromJavaBinCodec(SOLRJ_DOCS_2);
+
+    // exactly same document read twice should have same content
+    assert (extryFromTextDoc1.equals(extryFromTextDoc1_clone));
+    // doc1 and doc2 are 2 text files with different content on line 1
+    assert (!extryFromTextDoc2.equals(extryFromTextDoc1));
+    // exactly same document read twice should have same content
+    assert (extryFromTextDoc2.equals(extryFromTextDoc2_clone));
+
+    // now lets look at binary files
 
 Review comment:
   sure 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org