Skip to main content
summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2017-10-04Bug 313553 - Unentangle ProvidedCapability members and attributesTodor Boev2-14/+12
The members are the generic way for p2 queries to describe getters on objects. The capability attributes then participate in queries as the "attributes" member of a ProvidedCapability object. Fixed the IProvidedCapability to follow the OSGi convention that the attributes contain the name of the capability under a key equal to the capability namespace. This is cleaner than to introduce a new "name" attribute for the p2 name that can conflict with an incoming OSGi "name" attribute. Fixed the version of IProvidedCapability to follow the OSGi convention that capabilities with a version have a "version" attribute with a value of type an OSGi version object. Change-Id: Ic9b77c2d103216141035dc3fb5861ca99a3ddccd Signed-off-by: Todor Boev <rinsvind@gmail.com>
2017-09-29Bug 313553 - Capability: add handling to BundlesActionI20171002-2000Todor Boev1-2/+5
Update BundlesAction to publish the bundle generic capabilities. Fix BundlesActionTest to handle the newly published capabilities. Change-Id: I4b3d11b64706b4fc77b9084f27f8e1583f15580e Signed-off-by: Todor Boev <rinsvind@gmail.com>
2017-09-28Bug 313553 - Requirement: add handling to BundlesActionI20171001-2000I20170930-1500I20170929-2000I20170928-2000Todor Boev2-68/+97
Added publication of generic requirements. Fixed the requirement advice processing to ignore generic requirements. Fixed the BundlesActionTest to verify the newly published generic requirements Change-Id: I5351e12dbc92090717348e0c495c4993906d07fc Signed-off-by: Todor Boev <rinsvind@gmail.com>
2017-09-27Remove empty methods and useless overrides in p2.tests andI20170927-2000Alexander Kurtakov8-27/+2
suppresswarnings. Change-Id: Ia0b139c029a84b054ee741bf97606fbeea7b2576 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-25Use varargs Collections.addAll.I20170927-0420I20170926-2000I20170925-2000Alexander Kurtakov3-11/+11
Change-Id: I37ae7c578281c9da2f6faf465bbaacb8c0732b1e Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-23Bug 514333 - Preferences store access can lead to unattended workspaceI20170924-2000I20170923-1500Alexander Kurtakov2-2/+2
location initialization Pass -Dosgi.dataAreaRequiresExplicitInit=false to p2 tests. Change-Id: I514a7130e80725081c61ec100afb2a0051f64ae2 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-22Bug 514333 - Preferences store access can lead to unattended workspaceI20170922-2000Alexander Kurtakov1-1/+1
location initialization Pass -Dosgi.dataAreaRequiresExplicitInit=false to p2 tests. Change-Id: Ica802b795f38455b95a74bb9573300def0f40da1 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-20Bug 522466 - Fix generification warnings in p2.testsAlexander Kurtakov1-1/+1
Fix compiler warning introduced with previous commits. Change-Id: I8c95949c7719fe216f8503bece716ae74c7b6cfc Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-20Fix deprecated Properties.save to store.Alexander Kurtakov1-1/+1
Change-Id: I9a774701d8fbe065f20128a27b2c01259935e3c2 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-19Bug 522466 - Fix generification warnings in p2.testsI20170920-0100I20170919-2000Alexander Kurtakov36-156/+159
Yet another round. Change-Id: Idfcc6a717588ea423249b45ca37c18fc832aaad1 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-19Bug 522466 - Fix generification warnings in p2.tests Alexander Kurtakov70-271/+276
Round 3 Change-Id: Iecb11d4317c6859b60b6470a629a112735767da5 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-19Bug 522466 - Fix generification warnings in p2.tests Alexander Kurtakov54-356/+330
Second round. Change-Id: I624199cb119e374788521bf20189852e4c15d3cc Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-19Bug 522466 - Fix generification warnings in p2.tests Alexander Kurtakov61-375/+350
First round of generifying everything faced. Change-Id: I78bb9ce2655caf41da22235b0ac85ad6ad922365 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-19Bug 522466 - Fix generification warnings in p2.tests Alexander Kurtakov65-601/+589
Generification of most IQuery* related warnings possible and surrounding other generic warnings. Change-Id: I8516236c712722d7c40ea15c7334d7ba87b7e6b4 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-06Bug 313553 - [publisher] publish metadata for Provide-Capability andAlexander Kurtakov1-1/+2
Require-Capability Remove redundant type declarations introduced with previous patches. Change-Id: Ia3a8826ee3dc93a66eb0ed445c374091b68c354a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-09-06Bug 313553 - Retrofit the JRE IU with generic osgi.ee capabilitiesTodor Boev1-8/+14
The osgi.ee capabilities can now match both old-style and generic requirements. Change-Id: Id39103123ff2f1ce9d33a353b92e918f706dfa34 Signed-off-by: Todor Boev <rinsvind@gmail.com>
2017-08-23Bug 313553 - [publisher] publish metadata for Provide-Capability and ↵I20170831-2000I20170830-2000I20170830-0605I20170829-2345I20170829-2000I20170829-0940I20170829-0705I20170828-2000I20170828-1220I20170828-0730I20170827-2000I20170826-1500I20170825-2000I20170824-2000I20170823-2000Todor Boev1-8/+12
Require-Capability Generalize to include attributes. Change-Id: I1135b89842185ed0e3197bfbcf4625a0f4f73510 Signed-off-by: Todor Boev <rinsvind@gmail.com>
2017-08-23Bug 521301 - Stop using deprecated p2 methods in p2 tests Alexander Kurtakov28-125/+143
Change-Id: I08b47ba0d4219f15b061b759c01f874747a496df Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-07-24Bug 514885 - Added test case for match type greaterOrEqualI20170725-2000Karsten Thoms1-0/+32
Change-Id: I53d9fc1e6ae314d21b76558700d913d344d12eb6 Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
2017-07-03Bug 512312: Droplets should correctly detect feature group IUs.I20170703-2000Roland Grunberg5-0/+59
This issue has been mostly addressed by 7c95455. The logic for detection of feature groups was wrongly comparing a string and a boolean for equality as well as being computed more times than necessary. Change-Id: Icd714e39b798fba748d88c3aea2845649aa9fee1 Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
2017-06-22Bug 518587 - Modernize o.e.equinox.p2.testsI20170623-0110I20170622-2000Alexander Kurtakov40-754/+398
Use try-with-resources. Change-Id: I6c1d3efb7f0fd4f5dd0f014d8801ec8e375355f9 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-06-22Bug 517929 - Update POMs in the master for 4.8 releaseI20170622-0950Alexander Kurtakov1-1/+1
Point to 4.8 parent pom. Change-Id: Ic754058b23731334425f98aaca527bcf90991a7d Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-06-22Bug 518587 - Modernize o.e.equinox.p2.testsAlexander Kurtakov1-0/+4
Add back DictionaryServiceReference.getProperties despite it showing as error in the workspace. It's new method addition in master. Change-Id: I9d40f5101fa7a95624a05edfa490e70a2535052e Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-06-21Bug 518587 - Modernize o.e.equinox.p2.testsI20170621-2000Alexander Kurtakov314-1642/+2196
Move to Java 8, enable more warnings and save actions and go through the codebase to minimize the warnings. Change-Id: I6283bfeef18e250f5283e80f7bfad38e6ef65415 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-06-21Bug 518574 - Use StandardCharsetsAlexander Kurtakov2-14/+10
Bump BREE to 1.8 for bundles that were too low to have StandardCharsets. Change-Id: Iac9e9615c5179b970df893182f5f1c6e3dd4d574 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-06-16Bug 518375 - Update test implementations of ServiceReference to accountY20170617-1235I20170620-2000I20170619-2000I20170618-2355I20170618-2000I20170617-2000I20170616-2000Thomas Watson1-1/+5
for new R7 method Change-Id: I42b1f4ba599faf273c967b3a35a4640aa773b73f Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
2017-05-26Bug 508905 - On Windows disable test ↵Y20170622-1000Y20170620-0625Y20170619-2325Y20170618-0415Y20170615-1000Y20170608-1000Y20170601-1000S4_7_0_RC4aS4_7_0_RC4S4_7_0_RC3R4_7I20170616-0530I20170615-2000I20170614-2000I20170613-2000I20170612-0950I20170610-0940I20170608-0530I20170607-2000I20170607-1100I20170607-0800I20170607-0215I20170606-2000I20170606-0800I20170605-2000I20170605-0800I20170604-2000I20170604-0800I20170603-1500I20170603-0800I20170603-0100I20170602-2000I20170531-2000I20170531-0800I20170530-2000I20170530-0800I20170529-2000I20170529-0800I20170528-2000I20170528-0800I20170527-1500I20170527-0800I20170526-2000Thomas Watson1-1/+4
SharedInstallTestsProfileSpoofEnabledConfigured Change-Id: I307cd2f51d5e4f1782eac3f995a4f2067b50a010 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
2017-05-11Bug 516457 - Many of plug-ins need a version increaseI20170514-2000I20170514-1120Alexander Kurtakov2-3/+3
Take care of the following: o.e.equinox.p2.publisher - service bump o.e.equinox.p2.publisher.eclipse - service bump o.e.equinox.p2.repository - service bump o.e.equinox.p2.repository.tools - service bump org.eclipse.equinox.p2.touchpoint.natives - service bump org.eclipse.equinox.p2.ui.admin - service bump org.eclipse.equinox.p2.ui.admin.rcp - service bump org.eclipse.equinox.p2.ui.importexport - service bump org.eclipse.equinox.p2.ui.sdk - service bump org.eclipse.equinox.p2.tests - service bump Change-Id: I21578f13200b5c9de6fed6818b16992764f33216 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-05-05Bug 438584 - p2 unit tests not cleaning up after themselvesI20170510-0800I20170509-2000I20170509-1300I20170509-1100I20170509-0945I20170509-0800I20170508-2000I20170508-0800I20170507-2000I20170506-2000I20170505-2000Alexander Kurtakov4-1/+18
Change-Id: I651c22e089d17929f00ee086e3de6910ef901266 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-04-24Some mirroring tests use wrong MessagesI20170425-0910I20170425-0700I20170425-0240I20170425-0215I20170424-2000Mykola Nikishov3-4/+6
MD5-related test methods in ArtifactMirrorApplicationTest, NewMirrorApplicationArtifactTest and MirrorTaskTest should assert log message using the same Messages class as MD5ArtifactComparator's compare method uses when generating the log message in question. Change-Id: I6986d1d5748d55bed9589d71e9c4f62dfde91665 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2017-02-08Replace assertTrue with assertThatMykola Nikishov1-1/+3
java.lang.AssertionError: Expected: an instance of org.eclipse.equinox.internal.p2.updatesite.metadata.UpdateSiteMetadataRepository but: <org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository@180f33b2> is a org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:956) at org.junit.Assert.assertThat(Assert.java:923) at org.eclipse.equinox.p2.tests.metadata.repository.SiteIndexFileTest.testSingleRepository1(SiteIndexFileTest.java:258) Change-Id: Ifbfd6d8ced0c6a50a53a39faeb5311ba32097482 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2017-02-08Assert that two object arrays are equal with JUnit's ↵Mykola Nikishov1-23/+16
assertArrayEquals(Object[], Object[]) This provides a more clear error message for both cases when array lengths are different or they contain different elements: java.lang.AssertionError: array lengths differed, expected.length=0 actual.length=1 at org.junit.Assert.fail(Assert.java:88) at org.junit.internal.ComparisonCriteria.assertArraysAreSameLength(ComparisonCriteria.java:76) at org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:37) at org.junit.Assert.internalArrayEquals(Assert.java:532) at org.junit.Assert.assertArrayEquals(Assert.java:283) at org.junit.Assert.assertArrayEquals(Assert.java:298) arrays first differed at element [1]; expected:<[1]> but was:<[2]> at org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:55) at org.junit.Assert.internalArrayEquals(Assert.java:532) at org.junit.Assert.assertArrayEquals(Assert.java:283) at org.junit.Assert.assertArrayEquals(Assert.java:298) Change-Id: I468b376d696445c1aaae920b9b2b71c0813b09ca Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2017-02-07Bug 511830 - Remove .cvsignore from p2 projectLars Vogel5-5/+0
Change-Id: I2041f6ccbc3dc8863e202b56d33a74266905d397 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
2017-01-31Revert "Make Tycho's compiler use configuration from ↵Markus Keller21-20/+36
.settings/org.eclipse.jdt.core.prefs" This reverts commit 678bfa1aad9cf5fbe6a488d168763288acabb501. Change-Id: Ia1ec726e051392b3fefa753b6def2d937f68523e
2017-01-27Make Tycho's compiler use configuration from ↵I20170130-2000Mykola Nikishov21-36/+20
.settings/org.eclipse.jdt.core.prefs Change-Id: I60cd95811a1c12a8e961d05a1e4da077fc9a3c30 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2017-01-10Reason for failed assert that the log file doesn't contain messageMykola Nikishov1-2/+2
Provide details on what lines are missing from what log file. Change-Id: I15f0a0ee37feef6470ffbea631e27ee987a9c0e3 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2017-01-09Bug 508905: Change File.canWrite to Files.isWritable for p2 Droplets.Roland Grunberg6-23/+40
For compatibility with Windows, use java.nio.Files.isWritable(Path) instead of java.io.File.canWrite(). This is due to the fact that canWrite always returns true for directories on Windows. - Enable all tests disabled on Windows by 416b782 - Introduce reallyReadOnly/removeReallyReadonly functions that operate recursively on a directory (like chmod -R on linux) since certain test cases require this Change-Id: I615dfdef60e4abd23c34602bd324c307325e00d4 Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
2016-12-16Fix 'always true' assertionY20161229-1000Y20161223-1030Y20161222-1000I20170105-0320I20170105-0230I20170104-2000I20170104-0800I20170103-2000I20170102-2000I20170101-2000I20161231-2000I20161230-2000I20161229-2000I20161228-2000I20161227-2000I20161226-2000I20161225-2000I20161224-2000I20161223-2000I20161223-0615I20161222-2000I20161221-2000I20161221-0400I20161220-2000I20161220-0530Mykola Nikishov4-7/+14
Use org.junit.Assert's assertNotEquals(String, Object, Object) to check if two MD5 are different. junit.framework.TestCase's assertNotSame(String, Object, Object) compares arguments by reference and for String arguments, in most cases, returns true even if both arguments are equal by value. As we need a negative assertion (two MD5 are not equal), junit.framework.TestCase doesn't fit the bill - it does provide assertEquals() but not assertNotEquals(). Change-Id: I1ce6123d9102de963c92da88bea5e713ecdf44e6 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2016-11-23Bug 498116 - Replace fixed check for updates scheduler with a fuzzy oneY20161215-1200Y20161208-1000Y20161201-1000Y20161124-1000S4_7_0_M4I20161215-2000I20161215-0915I20161215-0830I20161215-0730I20161215-0130I20161214-2000I20161214-1005I20161213-2000I20161213-0600I20161213-0300I20161212-2000I20161211-2000I20161210-2000I20161208-0830I20161208-0730I20161207-2000I20161207-1340I20161207-0800I20161207-0515I20161206-2000I20161206-0800I20161205-2000I20161205-0800I20161204-2000I20161203-2000I20161202-2000I20161201-2000I20161201-0800I20161130-2000I20161129-2330I20161129-2000I20161128-2000I20161128-0600I20161128-0330I20161127-2000I20161127-1300I20161126-2000I20161126-0815I20161125-2000I20161124-2000Mikael Barbero2-2/+4
Checking the servers for update at a fixed time on fixed day of the week can kneel the servers. However, activating automatic check for updates on EPP packages is only possible by specifying a fix day and hour (see bug 421779 for the decision). This patch replace the fixed time of the day/week of the day way check for updates are scheduled. Users can choose to check "once a day", "once a week" or "once a month". The initial time used for next checks is the time when the user activates the option. However, it never checks for update exactly after a day, a week or a month. It introduces some randomness: - If the delay for checking for update is passed, it schedules a check sometime in the next 8 hours. - If the delay is well overpassed (see definition of "well overpassed" below), it schedules a check in the next hour. The delay is considered "well overpassed" depending on the recurrence of the check: - If the recurrence is "once a day", the delay is considered overpassed after a day and 6 hours. - If the recurrence is "once a week", the delay is considered overpassed after a week and 2 days. - If the recurrence is "once a month", the delay is considered overpassed after a week and 6 days. It also migrates automatically the fixed weekday/time preferences to the new fuzzy scheduler. Change-Id: I74a8bfba6b711e98eb795c1f924840e68789f102 Signed-off-by: Mikael Barbero <mikael@eclipse.org> Signed-off-by: Pascal Rapicault <pascal@rapicorp.com>
2016-11-08Bug 493193 - MirrorApplication should explicitly use MD5 artifact comparatorMykola Nikishov1-6/+15
The only place that documents the usage of MD5 comparator in MirrorApplication is Equinox p2 Repository Mirroring wiki page [1]: Adding the argument -comparator <comparator ID> specifies the mirroring application should use an Artifact Comparator with an ID of "comparator ID" to compare artifact descriptors. The mirroring application uses the "MD5 Comparator" to compare the MD5 hash property of the artifact descriptors if no comparator is defined. If no comparator is defined, ArtifactComparatorFactory's getArtifactComparator(String) will be finally called with null as a comparator ID. It's an ArtifactComparatorFactory's implementation detail that it will return the first configured one. MD5 comparator is the only one available now, but this may change and break MirrorApplication's expectation. To avoid such breakage, MirrorApplication declares an explicit dependency on MD5 comparator. So, when '-compare' CLI parameter is true but '-comparator' CLI parameter is missing, it will request MD5 artifact comparator to be used. Also improve testBaselineCompareUsingMD5Comparator() and testCompareUsingMD5Comparator(). These two tests should: - not only set 'compare' to true but also set a desired comparator's id explicitly - run twice, for an empty comparator id and MD5. To not copy-n-paste them, use @Theory [2]. To make theories work, run with Theories test runner. [1] https://wiki.eclipse.org/Equinox_p2_Repository_Mirroring [2] https://github.com/junit-team/junit4/wiki/Theories Change-Id: I5adda382c2824b6488af3716fc645cb6eff14b94 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2016-11-08Bug 493193 - MirrorApplication should explicitly use MD5 artifact comparatorMykola Nikishov2-5/+48
As test for the fix will use JUnit4 features, don't mix concerns and convert NewMirrorApplicationArtifactTest into a JUnit4 annotation-based test now, in a separate step. Change-Id: Ia0659146bc5c4e951cad9428479c8a593daef51a Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2016-11-07Add tests for IPublisherInfo.A_NO_MD5 contractI20161108-0800Mykola Nikishov1-0/+17
When creating an artifact descriptor with PublisherHelper, createArtifactDescriptor(IPublisherInfo, IArtifactRepository, IArtifactKey, File) will generate MD5 hash if (info == null || (info.getArtifactOptions() & IPublisherInfo.A_NO_MD5) == 0) is true. As current tests cover only 1 out of 4 this condition's branches, add tests for missing branches that assert IPublisherInfo.A_NO_MD5 contract. Change-Id: I9912f01294cee8288a61520086d590f62524fff9 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2016-09-19Bug 499623: Do not run testLoadConfigurationExtended on Windows.Y20160929-1000Y20160922-1000I20160927-0800I20160920-0800Roland Grunberg1-0/+6
Currently, test utility methods do not guarantee a folder can be made read-only and asserted using java.io.File.canWrite(). As a result extended configuration tests will not work correctly on Windows. Change-Id: I2e4f320587aea45c22a4b95b57f6817c3e8a09ff Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
2016-08-12Bug 499623 - Support extended configurations in SimpleConfigManipulator.Roland Grunberg1-0/+49
SimpleConfiguratorManipulatorImpl#loadConfiguration(BundleContext, String) only returns the list of BundleInfo elements from the platform itself. Extend this mechanism to also return extended BundleInfo elements (when p2.fragments property is set). Change-Id: I2230aff75bb20f8e38dd8a7a22c4cba6aefd6df8 Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
2016-06-28Bug 496465 - Prep for 4.7 (Oxygen) and 4.6.1 (Neon.1) maintenance buildsThomas Watson1-1/+1
Change-Id: I90a85375f7864204f482d76130da772798f0a28b Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
2016-05-04Bug 493004 - Need to update versions for Neon of various bundlesY20160519-1000Y20160513-1000Y20160505-1000I20160523-2000I20160522-2000I20160521-1500I20160520-2000I20160519-1730I20160519-1100I20160518-2000I20160517-2000I20160516-2000I20160515-2000I20160514-1500I20160513-2000I20160512-1000I20160511-2000I20160511-0400I20160510-2000I20160509-2000I20160508-2000I20160507-1500I20160506-2000I20160506-1030I20160506-0830I20160505-2000I20160504-2000Thomas Watson2-2/+2
Change-Id: Idb4576fc90fc7180d3c7e1960696615bb4c37594 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
2016-04-21Bug 336246 - Remove the metadata generatorY20160421-1000I20160424-2000Mykola Nikishov1-15/+0
With 439356b40487f691fc68c0c90eedce5d73d65c0f, references to MetadataGeneratorHelper's method had been replaced with a call to PublisherHelper. Now testGeneration*2 methods are just duplicates of existing ones (check testGenerationFolder vs testGenerationFile2). Remove tests that used to call MetadataGeneratorHelper's methods and are the same as the tests for PublisherHelper. Change-Id: I74670f196a5a2b3b24c8a6e36120e9885d9ea7d6 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2016-04-19Bug 489706 - Replace new Integer() with Integer.valueOf()I20160419-0800Alex Blewitt5-19/+19
There are a lot of new Integer() calls in the P2 codebase, which results in many duplicate values of Integer being stored, particularly when performing updates or checks. Integer.valueOf() performs this caching already, which means that it's unnecessary to call new Integer() and instead can call Integer.valueOf(). In the places where the int value is being used directly, the call can be further optimised to Integer.parseInt() instead. Replace calls to new Integer() with Integer.valueOf() or .parseInt() as appropriate. Change-Id: Ic760e66084c856fc90cb7c8a358007c975213638 Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
2015-10-19Prevent NPE in DebugHelper's formatParameters methodI20151110-0800Mykola Nikishov2-0/+30
Change-Id: I816a68305ec086da8bfd9b7ec179ece6af35b52e Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2015-09-07Bug 476724 - Remove new Boolean and Boolean.valueOf().booleanValue()I20150929-0800I20150922-0800I20150916-2000I20150916-0800I20150915-2000I20150915-0800I20150914-2000I20150914-1545I20150914-1130I20150914-0800I20150913-2000I20150908-0800Alex Blewitt8-31/+31
The new Boolean constructor creates a new instance of a Boolean object, but it can easily be replaced with Boolean.valueOf which returns the reference to the global Boolean.TRUE or Boolean.FALSE. Replace calls to new Boolean() with Boolean.valueOf() for identical semantics except without object collection. Additionally Boolean.valueOf().booleanValue() is identical to Boolean.parseBoolean() and will result in no garbage. In addition, methods will be (slightly) smaller and parseBoolean will often be in-lined by the JIT, which can often prove that the value is non-null for faster checking. Replace Boolean.valueOf().booleanValue() chains with Boolean.parseBoolean(). Some other tests can use Wrapper.valueOf() to take advantage of the built-in caches that these objects maintain (for values in the range -128..127). Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com> Change-Id: I5da4216a26ffbb6b8fd3365515ee800dd82b36ae

Back to the top