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

Remove classes with no references #1453

Merged
merged 1 commit into from
May 12, 2016

Conversation

GabrielBrascher
Copy link
Member

I used UCDetector (http:https://www.ucdetector.org/) as a plugin for Eclipse. With this tool, I discovered a lot of code without any reference (variables, methods and classes).

Following the work that was done at [https://github.com//pull/1448]; this pull request had the goal of removing some of these classes. To check if I wasn't missing anything I searched for any file that could reference some of those classes. As I haven't found any way of these classes being used, they were removed. Note that some of them I found other references, but references such as commented lines or tests, nothing that could indicate their use (as XML files configuring beans or another class instantiating an object with "new").

Waiting for tests. Please tell me if I am missing something.

Removed Classes:

  • org.apache.cloudstack.framework.jobs.JobCancellationException (Note: removed
    variable JobCancellationException in com.cloud.utils.SerialVersionUID)
  • org.apache.cloudstack.ldap.NoSuchLdapUserException (Note: removed test file
    /cloud-plugin-user-authenticator-ldap/test/groovy/org/apache/cloudstack/ldap/NoSuchLdapUserExceptionSpec.groovy)
  • com.cloud.agent.api.storage.CreateVolumeOVAAnswer
  • com.cloud.exception.MissingParameterValueException
  • org.apache.cloudstack.api.response.StatusResponse
  • org.apache.cloudstack.api.response.VolumeDetailResponse
  • org.apache.cloudstack.api.response.UpgradeVmResponse
  • org.apache.cloudstack.api.response.AddIpToVmNicResponse
  • org.apache.cloudstack.api.response.TemplateZoneResponse (Note: at
    org.apache.cloudstack.api.response.TemplateResponse, there is this
    comment "To avoid breaking backwards compatibility, we still treat a
    template at different zones as different templates, so not embedding
    template_zone information in this TemplateZoneResponse set. private Set<TemplateZoneResponse> zones;" but right now it is not used)
  • org.apache.cloudstack.api.response.NicDetailResponse

@pdube
Copy link
Contributor

pdube commented Mar 30, 2016

I built, ran the unit tests and ran the server with the simulator. Thanks for cleaning up! LGTM

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache CloudStack Developer Tools - Checkstyle Configuration SUCCESS [ 1.481 s]
[INFO] Apache CloudStack ................................. SUCCESS [ 2.319 s]
[INFO] Apache CloudStack Maven Conventions Parent ........ SUCCESS [ 1.075 s]
[INFO] Apache CloudStack Framework - Managed Context ..... SUCCESS [ 5.519 s]
[INFO] Apache CloudStack Utils ........................... SUCCESS [ 20.629 s]
[INFO] Apache CloudStack Framework ....................... SUCCESS [ 0.035 s]
[INFO] Apache CloudStack Framework - Event Notification .. SUCCESS [ 6.274 s]
[INFO] Apache CloudStack Framework - Configuration ....... SUCCESS [ 3.581 s]
[INFO] Apache CloudStack API ............................. SUCCESS [ 17.061 s]
[INFO] Apache CloudStack Framework - REST ................ SUCCESS [ 2.250 s]
[INFO] Apache CloudStack Framework - IPC ................. SUCCESS [ 5.209 s]
[INFO] Apache CloudStack Cloud Engine .................... SUCCESS [ 0.043 s]
[INFO] Apache CloudStack Cloud Engine API ................ SUCCESS [ 4.154 s]
[INFO] Apache CloudStack Framework - Security ............ SUCCESS [ 1.968 s]
[INFO] Apache CloudStack Core ............................ SUCCESS [ 24.328 s]
[INFO] Apache CloudStack Agents .......................... SUCCESS [ 7.392 s]
[INFO] Apache CloudStack Framework - Clustering .......... SUCCESS [ 4.394 s]
[INFO] Apache CloudStack Framework - Event Notification .. SUCCESS [ 1.455 s]
[INFO] Apache CloudStack Cloud Engine Schema Component ... SUCCESS [ 14.251 s]
[INFO] Apache CloudStack Framework - Jobs ................ SUCCESS [ 4.137 s]
[INFO] Apache CloudStack Cloud Engine Internal Components API SUCCESS [ 2.500 s]
[INFO] Apache CloudStack Server .......................... SUCCESS [ 44.828 s]
[INFO] Apache CloudStack Framework - Quota ............... SUCCESS [ 5.957 s]
[INFO] Apache CloudStack Usage Server .................... SUCCESS [ 5.625 s]
[INFO] Apache CloudStack Cloud Engine Orchestration Component SUCCESS [ 8.316 s]
[INFO] Apache CloudStack Cloud Services .................. SUCCESS [ 0.029 s]
[INFO] Apache CloudStack Secondary Storage ............... SUCCESS [ 0.230 s]
[INFO] Apache CloudStack Secondary Storage Service ....... SUCCESS [ 4.525 s]
[INFO] Apache CloudStack Engine Storage Component ........ SUCCESS [ 5.890 s]
[INFO] Apache CloudStack Engine Storage Volume Component . SUCCESS [ 4.042 s]
[INFO] Apache CloudStack Engine Storage Image Component .. SUCCESS [ 2.578 s]
[INFO] Apache CloudStack Engine Storage Data Motion Component SUCCESS [ 2.076 s]
[INFO] Apache CloudStack Engine Storage Cache Component .. SUCCESS [ 1.821 s]
[INFO] Apache CloudStack Engine Storage Snapshot Component SUCCESS [ 7.113 s]
[INFO] Apache CloudStack Cloud Engine API ................ SUCCESS [ 1.391 s]
[INFO] Apache CloudStack Cloud Engine Service ............ SUCCESS [ 4.426 s]
[INFO] Apache CloudStack Plugin POM ...................... SUCCESS [ 0.300 s]
[INFO] Apache CloudStack Plugin - API Rate Limit ......... SUCCESS [ 5.367 s]
[INFO] Apache CloudStack Plugin - Storage Volume default provider SUCCESS [ 2.396 s]
[INFO] Apache CloudStack Plugin - Storage Volume SolidFire Provider SUCCESS [ 4.066 s]
[INFO] Apache CloudStack Plugin - API SolidFire .......... SUCCESS [ 1.818 s]
[INFO] Apache CloudStack Plugin - API Discovery .......... SUCCESS [ 3.680 s]
[INFO] Apache CloudStack Plugin - ACL Static Role Based .. SUCCESS [ 1.571 s]
[INFO] Apache CloudStack Plugin - Host Anti-Affinity Processor SUCCESS [ 1.612 s]
[INFO] Apache CloudStack Plugin - Explicit Dedication Processor SUCCESS [ 1.848 s]
[INFO] Apache CloudStack Plugin - User Concentrated Pod Deployment Planner SUCCESS [ 1.717 s]
[INFO] Apache CloudStack Plugin - User Dispersing Deployment Planner SUCCESS [ 1.660 s]
[INFO] Apache CloudStack Plugin - Implicit Dedication Planner SUCCESS [ 5.252 s]
[INFO] Apache CloudStack Plugin - Skip Heurestics Planner SUCCESS [ 1.438 s]
[INFO] Apache CloudStack Plugin - Host Allocator Random .. SUCCESS [ 1.754 s]
[INFO] Apache CloudStack Plugin - Dedicated Resources .... SUCCESS [ 4.998 s]
[INFO] Apache CloudStack Plugin - Hypervisor OracleVM .... SUCCESS [ 2.442 s]
[INFO] Apache CloudStack Plugin - Open vSwitch ........... SUCCESS [ 2.689 s]
[INFO] Apache CloudStack Plugin - Hypervisor XenServer ... SUCCESS [ 22.957 s]
[INFO] Apache CloudStack Plugin - Hypervisor KVM ......... SUCCESS [ 10.390 s]
[INFO] Apache CloudStack Plugin - RabbitMQ Event Bus ..... SUCCESS [ 1.770 s]
[INFO] Apache CloudStack Plugin - In Memory Event Bus .... SUCCESS [ 3.110 s]
[INFO] Apache CloudStack Plugin - Kafka Event Bus ........ SUCCESS [ 1.437 s]
[INFO] Apache CloudStack Plugin - Hypervisor Baremetal ... SUCCESS [ 3.183 s]
[INFO] Apache CloudStack Plugin - Hypervisor UCS ......... SUCCESS [ 2.155 s]
[INFO] Apache CloudStack Plugin - Hypervisor Hyper-V ..... SUCCESS [ 4.373 s]
[INFO] Apache CloudStack Plugin - Hypervisor OracleVM3 ... SUCCESS [ 17.905 s]
[INFO] Apache CloudStack Plugin - Network Elastic Load Balancer SUCCESS [ 4.764 s]
[INFO] Apache CloudStack Plugin - Network Internal Load Balancer SUCCESS [ 7.849 s]
[INFO] Apache CloudStack Framework - Spring Life Cycle ... SUCCESS [ 1.700 s]
[INFO] Apache CloudStack Plugin - Network Juniper Contrail SUCCESS [ 9.838 s]
[INFO] Apache CloudStack Plugin - Palo Alto .............. SUCCESS [ 5.376 s]
[INFO] Apache CloudStack Plugin - Network Netscaler ...... SUCCESS [ 3.538 s]
[INFO] Apache CloudStack Plugin - Network Nicira NVP ..... SUCCESS [ 11.095 s]
[INFO] Apache CloudStack Plugin - BigSwitch Virtual Network Segment SUCCESS [ 8.695 s]
[INFO] Apache CloudStack Plugin - Network Brocade VCS .... SUCCESS [ 7.456 s]
[INFO] Apache CloudStack Plugin - Midokura Midonet ....... SUCCESS [ 5.149 s]
[INFO] Apache CloudStack Plugin - Stratosphere SSP ....... SUCCESS [ 5.350 s]
[INFO] Apache CloudStack Plugin - Network Opendaylight ... SUCCESS [ 4.635 s]
[INFO] Apache CloudStack Plugin - Storage Allocator Random SUCCESS [ 1.480 s]
[INFO] Apache CloudStack Plugin - User Authenticator LDAP SUCCESS [ 2.706 s]
[INFO] Apache CloudStack Plugin - User Authenticator MD5 . SUCCESS [ 3.360 s]
[INFO] Apache CloudStack Plugin - User Authenticator PBKDF2-SHA-256 SUCCESS [ 4.444 s]
[INFO] Apache CloudStack Plugin - User Authenticator Plain Text SUCCESS [ 1.742 s]
[INFO] Apache CloudStack Plugin - User Authenticator SAML2 SUCCESS [ 33.553 s]
[INFO] Apache CloudStack Plugin - User Authenticator SHA256 Salted SUCCESS [ 3.433 s]
[INFO] Apache CloudStack Plugin - Dns Notifier Example ... SUCCESS [ 1.689 s]
[INFO] Apache CloudStack Plugin - Storage Image S3 provider SUCCESS [ 1.950 s]
[INFO] Apache CloudStack Plugin - Storage Image Swift provider SUCCESS [ 1.686 s]
[INFO] Apache CloudStack Plugin - Storage Image default provider SUCCESS [ 1.754 s]
[INFO] Apache CloudStack Plugin - Storage Image sample provider SUCCESS [ 1.603 s]
[INFO] Apache CloudStack Plugin - Storage Volume Nexenta Provider SUCCESS [ 3.603 s]
[INFO] Apache CloudStack Plugin - Storage Volume CloudByte Provider SUCCESS [ 2.691 s]
[INFO] Apache CloudStack Plugin - Storage Volume sample provider SUCCESS [ 1.640 s]
[INFO] Apache CloudStack Plugin - SNMP Alerts ............ SUCCESS [ 3.388 s]
[INFO] Apache CloudStack Plugin - Syslog Alerts .......... SUCCESS [ 4.680 s]
[INFO] Apache CloudStack Plugin - Network VXLAN .......... SUCCESS [ 3.897 s]
[INFO] Apache CloudStack Plugin - GloboDNS ............... SUCCESS [ 6.082 s]
[INFO] Apache CloudStack Plugin - Quota Service .......... SUCCESS [ 4.870 s]
[INFO] Apache CloudStack Plugin - Hypervisor Simulator ... SUCCESS [ 4.056 s]
[INFO] Apache CloudStack Framework - Spring Module ....... SUCCESS [ 5.767 s]
[INFO] Apache CloudStack Secondary Storage Controller .... SUCCESS [ 2.372 s]
[INFO] Apache CloudStack Client UI ....................... SUCCESS [ 10.796 s]
[INFO] Apache CloudStack Console Proxy - RDP Client ...... SUCCESS [ 9.548 s]
[INFO] Apache CloudStack Console Proxy ................... SUCCESS [ 0.331 s]
[INFO] Apache CloudStack Console Proxy - Server .......... SUCCESS [ 5.782 s]
[INFO] Apache CloudStack Framework - QuickCloud .......... SUCCESS [ 0.116 s]
[INFO] Apache CloudStack Test ............................ SUCCESS [ 0.405 s]
[INFO] Apache CloudStack Developer Mode .................. SUCCESS [ 0.673 s]
[INFO] Apache CloudStack Developer Tools ................. SUCCESS [ 0.223 s]
[INFO] Apache CloudStack apidocs ......................... SUCCESS [ 27.713 s]
[INFO] Apache CloudStack marvin .......................... SUCCESS [ 7.112 s]
[INFO] Apache CloudStack DevCloud ........................ SUCCESS [ 0.684 s]
[INFO] Apache CloudStack DevCloud4 ....................... SUCCESS [ 0.366 s]
[INFO] Apache CloudStack DevCloud-KVM .................... SUCCESS [ 0.364 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:44 min
[INFO] Finished at: 2016-03-30T10:39:18-05:00
[INFO] Final Memory: 121M/735M
[INFO] ------------------------------------------------------------------------

@GabrielBrascher
Copy link
Member Author

Thank you @pdube!

@DaanHoogland
Copy link
Contributor

@GabrielBrascher I'm getting a merge error on this PR to master. can you have a look and rebase if needed?

@rafaelweingartner
Copy link
Member

@DaanHoogland, @GabrielBrascher,
The merge errors are occurring because the PR has merge conflicts.
A rebase should solve that.

@DaanHoogland, are you going to merge this PR?
It only has 1 LGTM and no functional tests executed for it.
Even though I think that when removing unused code (code without any reference at all), we do not need functional tests (a complete build and unit + integration tests are enough), that is how it has been done so far. So, I am just asking to avoid any future complications. @swill, what do you think here?

@swill
Copy link
Contributor

swill commented Apr 7, 2016

@rafaelweingartner yes, I will be running CI on this when the merge conflicts have been resolved. nothing should be committed to master without CI run against it IMO...

@rafaelweingartner
Copy link
Member

@swill thanks
I did not know that you were also watching this PR.
Man, you are literally everywhere; that is very good.

@swill
Copy link
Contributor

swill commented Apr 7, 2016

haha, trying to be. it is turning into a full time job...

@rafaelweingartner rafaelweingartner force-pushed the brascher-removeUnusedClasses2 branch 2 times, most recently from 0666e0d to 9b9560c Compare April 7, 2016 20:30
- org.apache.cloudstack.framework.jobs.JobCancellationException (removed
variable JobCancellationException in com.cloud.utils.SerialVersionUID)
- org.apache.cloudstack.ldap.NoSuchLdapUserException (removed test file
/cloud-plugin-user-authenticator-ldap/test/groovy/org/apache/cloudstack/ldap/NoSuchLdapUserExceptionSpec.groovy)
- com.cloud.agent.api.storage.CreateVolumeOVAAnswer
- com.cloud.exception.MissingParameterValueException
- org.apache.cloudstack.api.response.StatusResponse
- org.apache.cloudstack.api.response.VolumeDetailResponse
- org.apache.cloudstack.api.response.UpgradeVmResponse
- org.apache.cloudstack.api.response.AddIpToVmNicResponse
- org.apache.cloudstack.api.response.TemplateZoneResponse (at
org.apache.cloudstack.api.response.TemplateResponse, there is this
comment "To avoid breaking backwards compatibility, we still treat a
template at different zones as different templates, so not embedding
template_zone information in this TemplateZoneResponse set. `private
Set<TemplateZoneResponse> zones;`" but right now it is not used)
- org.apache.cloudstack.api.response.NicDetailResponse
@rafaelweingartner
Copy link
Member

@swill , @DaanHoogland ,
Now everything is ok here.
@GabrielBrascher was a little busy, so I did the rebase for him.

@DaanHoogland
Copy link
Contributor

@rafaelweingartner the merge errors occured during testing as merging is part of the integration tests. I agree with @swill about the test being needed for this change. thought I think it makes no sense/adds no value for some other changes. The latter being UI and added tests. Every thing else should undergo the regression suite.

@rafaelweingartner
Copy link
Member

@DaanHoogland I understand your points on requiring functional tests and accept it.
Even after the rebase I did today you had problems while testing this PR?

@DaanHoogland
Copy link
Contributor

I am having other problems (after the merge) in my test environment, not related to the PR.

@swill
Copy link
Contributor

swill commented May 10, 2016

CI RESULTS

Tests Run: 85
  Skipped: 0
   Failed: 0
   Errors: 1
 Duration: 9h 04m 44s

Summary of the problem(s):

ERROR: Test VPC offering without port forwarding service
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/git/cs1/cloudstack/test/integration/component/test_vpc_offerings.py", line 799, in test_05_vpc_off_without_pf
    domainid=self.account.domainid
  File "/usr/lib/python2.7/site-packages/marvin/lib/base.py", line 4217, in create
    return VPC(apiclient.createVPC(cmd).__dict__)
  File "/usr/lib/python2.7/site-packages/marvin/cloudstackAPI/cloudstackAPIClient.py", line 2182, in createVPC
    response = self.connection.marvinRequest(command, response_type=response, method=method)
  File "/usr/lib/python2.7/site-packages/marvin/cloudstackConnection.py", line 379, in marvinRequest
    raise e
Exception: Job failed: {jobprocstatus : 0, created : u'2016-05-09T15:20:37+0200', jobresult : {errorcode : 530, errortext : u'Failed to create VPC'}, cmd : u'org.apache.cloudstack.api.command.admin.vpc.CreateVPCCmdByAdmin', userid : u'7762822f-15a0-11e6-91f9-5254001daa61', jobstatus : 2, jobid : u'b5b0ebc2-11b3-451f-ab08-5b45ce58d61e', jobresultcode : 530, jobresulttype : u'object', jobinstancetype : u'None', accountid : u'77626b72-15a0-11e6-91f9-5254001daa61'}
----------------------------------------------------------------------
Additional details in: /tmp/MarvinLogs/test_vpc_routers_I1C28S/results.txt

Associated Uploads

/tmp/MarvinLogs/DeployDataCenter__May_09_2016_06_45_25_CAQM5J:

/tmp/MarvinLogs/test_network_MTB4IB:

/tmp/MarvinLogs/test_vpc_routers_I1C28S:

Uploads will be available until 2016-07-10 02:00:00 +0200 CEST

Comment created by upr comment.

@swill
Copy link
Contributor

swill commented May 10, 2016

The one problem that is showing up in my CI does not appear to be related to this PR, but this is the first time I have ever seen this error. If someone else can confirm that this would not be related, I would appreciate it. :)

@swill
Copy link
Contributor

swill commented May 12, 2016

Can I get one more code review on this one??? Thx...

@DaanHoogland
Copy link
Contributor

LGTM @swill

@asfgit asfgit merged commit 4179606 into apache:master May 12, 2016
asfgit pushed a commit that referenced this pull request May 12, 2016
…asses2

Remove classes with no referencesI used UCDetector (http:https://www.ucdetector.org/) as a plugin for Eclipse.  With this tool, I discovered a lot of code without any reference (variables, methods and classes).

Following the work that was done at [#1448]; this pull request had the goal of removing some of these classes. To check if I wasn't missing anything I searched for any file that could reference some of those classes. As I haven't found any way of these classes being used, they were removed. Note that some of them I found other references, but references such as commented lines or tests, nothing that could indicate their use (as XML files configuring beans or another class instantiating an object with "new").

Waiting for tests. Please tell me if I am missing something.

Removed Classes:
- org.apache.cloudstack.framework.jobs.JobCancellationException (**Note:** removed
variable JobCancellationException in com.cloud.utils.SerialVersionUID)
- org.apache.cloudstack.ldap.NoSuchLdapUserException (**Note:** removed test file
/cloud-plugin-user-authenticator-ldap/test/groovy/org/apache/cloudstack/ldap/NoSuchLdapUserExceptionSpec.groovy)
- com.cloud.agent.api.storage.CreateVolumeOVAAnswer
- com.cloud.exception.MissingParameterValueException
- org.apache.cloudstack.api.response.StatusResponse
- org.apache.cloudstack.api.response.VolumeDetailResponse
- org.apache.cloudstack.api.response.UpgradeVmResponse
- org.apache.cloudstack.api.response.AddIpToVmNicResponse
- org.apache.cloudstack.api.response.TemplateZoneResponse (**Note:** at
org.apache.cloudstack.api.response.TemplateResponse, there is this
comment "To avoid breaking backwards compatibility, we still treat a
template at different zones as different templates, so not embedding
template_zone information in this TemplateZoneResponse set. `private
Set<TemplateZoneResponse> zones;`" but right now it is not used)
- org.apache.cloudstack.api.response.NicDetailResponse

* pr/1453:
  Removed classes with no reference

Signed-off-by: Will Stevens <[email protected]>
@GabrielBrascher GabrielBrascher deleted the brascher-removeUnusedClasses2 branch November 27, 2018 16:56
@GabrielBrascher GabrielBrascher restored the brascher-removeUnusedClasses2 branch November 27, 2018 16:57
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.

None yet

6 participants