You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/07/17 17:19:30 UTC

[GitHub] [pulsar] vcottagiri opened a new pull request #7582: #683 - Replace internal proprietary sun.reflect.ReflectionFactory API with Objenesis API

vcottagiri opened a new pull request #7582:
URL: https://github.com/apache/pulsar/pull/7582


   Fixes #683
   "[Objenesis](http://objenesis.org/index.html) is a small Java library that serves one purpose: To instantiate a new object of a particular class."
   
   Used by Spring, EasyMock, Mockito, Kryo etc
   [List of supported JVMs](https://github.com/easymock/objenesis/blob/master/SupportedJVMs.md#list-of-currently-supported-jvms)
   
   ### Motivation
   
   - We need to instantiate a Zookeeper client instance without invoking the constructor in the MockZookeeper.
   - sun.reflect.ReflectionFactory is internal API and might not exists on all JVM variants.
   - Compiler warnings are produced during maven builds
   
   ### Modifications
   
   - Added Objenesis in root pom dependencyManagement section
   - Replaced ReflectionFactory API for Objenesis API in org.apache.zookeeper.MockZooKeeper
   - Removed @SuppressWarnings annotation on org.apache.zookeeper.MockZooKeeper
   - Replaced deprecated org.apache.zookeeper.KeeperException.Code constants with recommended enums
   
   ### Verifying this change
   
   - [X] Make sure that the change passes the CI checks.
   - [X] This change is already covered by existing tests, such as 
         - org.apache.pulsar.zookeeper.ZookeeperCacheTest
         - org.apache.pulsar.discovery.service.BaseDiscoveryTestSetup
         - org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest
         - org.apache.pulsar.discovery.service.BaseDiscoveryTestSetup
         - org.apache.pulsar.discovery.service.web.BaseZKStarterTest
         - org.apache.bookkeeper.mledger.offload.filesystem.impl.FileSystemManagedLedgerOffloaderTest
         - org.apache.bookkeeper.mledger.offload.jcloud.impl.BlobStoreManagedLedgerOffloaderTest
   
   


----------------------------------------------------------------
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



[GitHub] [pulsar] merlimat commented on a change in pull request #7582: #683 - Replace internal proprietary sun.reflect.ReflectionFactory API with Objenesis API

Posted by GitBox <gi...@apache.org>.
merlimat commented on a change in pull request #7582:
URL: https://github.com/apache/pulsar/pull/7582#discussion_r456572484



##########
File path: testmocks/src/main/java/org/apache/zookeeper/MockZooKeeper.java
##########
@@ -67,6 +66,10 @@
     private int readOpDelayMs;
 
     private ReentrantLock mutex;
+    
+    //see details of Objenesis caching - http://objenesis.org/details.html
+    //see supported jvms - https://github.com/easymock/objenesis/blob/master/SupportedJVMs.md
+    private static Objenesis objenesis = new ObjenesisStd();

Review comment:
       ```suggestion
       private static final Objenesis objenesis = new ObjenesisStd();
   ```




----------------------------------------------------------------
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



[GitHub] [pulsar] merlimat merged pull request #7582: #683 - Replace internal proprietary sun.reflect.ReflectionFactory API with Objenesis API

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #7582:
URL: https://github.com/apache/pulsar/pull/7582


   


----------------------------------------------------------------
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



[GitHub] [pulsar] vcottagiri commented on a change in pull request #7582: #683 - Replace internal proprietary sun.reflect.ReflectionFactory API with Objenesis API

Posted by GitBox <gi...@apache.org>.
vcottagiri commented on a change in pull request #7582:
URL: https://github.com/apache/pulsar/pull/7582#discussion_r456573877



##########
File path: testmocks/src/main/java/org/apache/zookeeper/MockZooKeeper.java
##########
@@ -67,6 +66,10 @@
     private int readOpDelayMs;
 
     private ReentrantLock mutex;
+    
+    //see details of Objenesis caching - http://objenesis.org/details.html
+    //see supported jvms - https://github.com/easymock/objenesis/blob/master/SupportedJVMs.md
+    private static Objenesis objenesis = new ObjenesisStd();

Review comment:
       done, thx




----------------------------------------------------------------
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