diff --git a/app/.classpath b/app/.classpath index bdcadc9a0..7ffc408e6 100644 --- a/app/.classpath +++ b/app/.classpath @@ -28,7 +28,6 @@ - diff --git a/app/lib/guava-18.0.LICENSE.ASL-2.0.txt b/app/lib/guava-18.0.LICENSE.ASL-2.0.txt deleted file mode 100644 index 6b0b1270f..000000000 --- a/app/lib/guava-18.0.LICENSE.ASL-2.0.txt +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/app/lib/guava-18.0.jar b/app/lib/guava-18.0.jar deleted file mode 100644 index 8f89e4901..000000000 Binary files a/app/lib/guava-18.0.jar and /dev/null differ diff --git a/app/src/cc/arduino/contributions/BuiltInCoreIsNewerCheck.java b/app/src/cc/arduino/contributions/BuiltInCoreIsNewerCheck.java index 11e84cf3b..683c00125 100644 --- a/app/src/cc/arduino/contributions/BuiltInCoreIsNewerCheck.java +++ b/app/src/cc/arduino/contributions/BuiltInCoreIsNewerCheck.java @@ -34,9 +34,6 @@ import cc.arduino.contributions.filters.InstalledPredicate; import cc.arduino.contributions.packages.ContributedPackage; import cc.arduino.contributions.packages.ContributedPlatform; import cc.arduino.view.Event; -import com.google.common.collect.Collections2; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import processing.app.Base; import processing.app.BaseNoGui; import processing.app.I18n; @@ -44,7 +41,7 @@ import processing.app.PreferencesData; import javax.swing.*; import java.awt.event.ActionEvent; -import java.util.LinkedList; +import java.util.Collection; import java.util.List; import java.util.stream.Collectors; @@ -72,7 +69,7 @@ public class BuiltInCoreIsNewerCheck implements Runnable { return; } - LinkedList contributedPlatforms = Lists.newLinkedList(Iterables.concat(Collections2.transform(BaseNoGui.indexer.getPackages(), ContributedPackage::getPlatforms))); + List contributedPlatforms = BaseNoGui.indexer.getPackages().stream().map(ContributedPackage::getPlatforms).flatMap(Collection::stream).collect(Collectors.toList()); List installedBuiltInPlatforms = contributedPlatforms.stream().filter(new InstalledPredicate()).filter(new BuiltInPredicate()).collect(Collectors.toList()); if (installedBuiltInPlatforms.size() != 1) { diff --git a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java index b185afc85..901bfa3a3 100644 --- a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java +++ b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java @@ -38,7 +38,6 @@ import cc.arduino.contributions.libraries.filters.OnlyUpstreamReleasePredicate; import cc.arduino.contributions.ui.InstallerTableCell; import cc.arduino.contributions.ui.listeners.DelegatingKeyListener; import cc.arduino.utils.ReverseComparator; -import com.google.common.collect.Lists; import processing.app.Base; import javax.swing.*; @@ -51,11 +50,12 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Collections; +import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; -import static processing.app.I18n.tr; import static processing.app.I18n.format; +import static processing.app.I18n.tr; @SuppressWarnings("serial") public class ContributedLibraryTableCell extends InstallerTableCell { @@ -158,8 +158,8 @@ public class ContributedLibraryTableCell extends InstallerTableCell { HTMLDocument html = (HTMLDocument) doc; StyleSheet stylesheet = html.getStyleSheet(); stylesheet.addRule("body { margin: 0; padding: 0;" - + "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;" - + "font-size: 100%;" + "font-size: 0.95em; }"); + + "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;" + + "font-size: 100%;" + "font-size: 0.95em; }"); } description.setOpaque(false); description.setBorder(new EmptyBorder(4, 7, 7, 7)); @@ -236,19 +236,17 @@ public class ContributedLibraryTableCell extends InstallerTableCell { downgradeChooser.removeAllItems(); downgradeChooser.addItem(tr("Select version")); - final List uninstalledPreviousReleases = Lists.newLinkedList(); - final List uninstalledNewerReleases = Lists.newLinkedList(); + final List uninstalledPreviousReleases = new LinkedList<>(); + final List uninstalledNewerReleases = new LinkedList<>(); final VersionComparator versionComparator = new VersionComparator(); - Lists.newLinkedList(Lists.transform(uninstalledReleases, input -> { + uninstalledReleases.stream().forEach(input -> { if (installed == null || versionComparator.greaterThan(installed.getParsedVersion(), input.getParsedVersion())) { uninstalledPreviousReleases.add(input); } else { uninstalledNewerReleases.add(input); } - - return input; - })); + }); uninstalledNewerReleases.forEach(downgradeChooser::addItem); uninstalledPreviousReleases.forEach(downgradeChooser::addItem); diff --git a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java index 2fbd60901..04dc4d8f2 100644 --- a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java +++ b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java @@ -39,7 +39,6 @@ import cc.arduino.contributions.packages.ContributedPlatform; import cc.arduino.contributions.ui.InstallerTableCell; import cc.arduino.contributions.ui.listeners.DelegatingKeyListener; import cc.arduino.utils.ReverseComparator; -import com.google.common.collect.Lists; import processing.app.Base; import javax.swing.*; @@ -55,8 +54,8 @@ import java.util.Collections; import java.util.LinkedList; import java.util.stream.Collectors; -import static processing.app.I18n.tr; import static processing.app.I18n.format; +import static processing.app.I18n.tr; @SuppressWarnings("serial") public class ContributedPlatformTableCell extends InstallerTableCell { @@ -170,8 +169,8 @@ public class ContributedPlatformTableCell extends InstallerTableCell { HTMLDocument html = (HTMLDocument) doc; StyleSheet stylesheet = html.getStyleSheet(); stylesheet.addRule("body { margin: 0; padding: 0;" - + "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;" - + "font-size: 100%;" + "font-size: 0.95em; }"); + + "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;" + + "font-size: 100%;" + "font-size: 0.95em; }"); } description.setOpaque(false); description.setBorder(new EmptyBorder(4, 7, 7, 7)); @@ -248,19 +247,17 @@ public class ContributedPlatformTableCell extends InstallerTableCell { downgradeChooser.removeAllItems(); downgradeChooser.addItem(tr("Select version")); - final java.util.List uninstalledPreviousReleases = Lists.newLinkedList(); - final java.util.List uninstalledNewerReleases = Lists.newLinkedList(); + final java.util.List uninstalledPreviousReleases = new LinkedList<>(); + final java.util.List uninstalledNewerReleases = new LinkedList<>(); final VersionComparator versionComparator = new VersionComparator(); - Lists.newLinkedList(Lists.transform(uninstalledReleases, input -> { + uninstalledReleases.stream().forEach(input -> { if (installed == null || versionComparator.greaterThan(installed.getParsedVersion(), input.getParsedVersion())) { uninstalledPreviousReleases.add(input); } else { uninstalledNewerReleases.add(input); } - - return input; - })); + }); uninstalledNewerReleases.forEach(downgradeChooser::addItem); uninstalledPreviousReleases.forEach(downgradeChooser::addItem); diff --git a/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java b/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java index 0c86cf546..d5bc9cc0e 100644 --- a/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java +++ b/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java @@ -29,8 +29,6 @@ package cc.arduino.view.preferences; -import com.google.common.base.Joiner; -import com.google.common.collect.FluentIterable; import processing.app.Base; import java.awt.*; @@ -39,6 +37,7 @@ import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.util.Arrays; import java.util.Collection; +import java.util.stream.Collectors; import static processing.app.I18n.tr; @@ -174,17 +173,17 @@ public class AdditionalBoardsManagerURLTextArea extends javax.swing.JDialog { public void setText(String text) { Collection urls = splitAndTrim(text, ","); - additionalBoardsManagerURLs.setText(Joiner.on("\n").skipNulls().join(urls)); + additionalBoardsManagerURLs.setText(urls.stream().filter(s -> s != null).collect(Collectors.joining("\n"))); } private Collection splitAndTrim(String text, String separator) { Collection urls = Arrays.asList(text.split(separator)); - return FluentIterable.from(urls).transform(String::trim).filter(url -> !url.isEmpty()).toList(); + return urls.stream().map(String::trim).filter(url -> !url.isEmpty()).collect(Collectors.toList()); } public String getText() { Collection urls = splitAndTrim(additionalBoardsManagerURLs.getText(), "\n"); - return Joiner.on(",").skipNulls().join(urls); + return urls.stream().filter(s -> s != null).collect(Collectors.joining(",")); } // Variables declaration - do not modify//GEN-BEGIN:variables diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 403b88f40..1befb5d1d 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -38,9 +38,6 @@ import cc.arduino.utils.Progress; import cc.arduino.view.Event; import cc.arduino.view.JMenuUtils; import cc.arduino.view.SplashScreenHelper; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.Collections2; import org.apache.commons.compress.utils.IOUtils; import org.apache.commons.lang3.StringUtils; import processing.app.debug.TargetBoard; @@ -65,9 +62,11 @@ import java.awt.event.*; import java.io.*; import java.util.*; import java.util.List; +import java.util.function.Predicate; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.stream.Collectors; import static processing.app.I18n.tr; @@ -82,7 +81,7 @@ public class Base { public static final Predicate CONTRIBUTED = new Predicate() { @Override - public boolean apply(UserLibrary library) { + public boolean test(UserLibrary library) { return library.getTypes() == null || library.getTypes().isEmpty() || library.getTypes().contains("Contributed"); } }; @@ -1143,13 +1142,13 @@ public class Base { public LibraryList getIDELibs() { LibraryList installedLibraries = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries()); - List libs = new LinkedList(Collections2.filter(new LinkedList(installedLibraries), Predicates.not(CONTRIBUTED))); + List libs = installedLibraries.stream().filter(CONTRIBUTED.negate()).collect(Collectors.toList()); return new LibraryList(libs); } public LibraryList getUserLibs() { LibraryList installedLibraries = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries()); - List libs = new LinkedList(Collections2.filter(new LinkedList(installedLibraries), CONTRIBUTED)); + List libs = installedLibraries.stream().filter(CONTRIBUTED).collect(Collectors.toList()); return new LibraryList(libs); } diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 575efda4f..23d8e1793 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -28,7 +28,6 @@ import cc.arduino.packages.Uploader; import cc.arduino.packages.uploaders.SerialUploader; import cc.arduino.view.StubMenuListener; import cc.arduino.view.findreplace.FindReplace; -import com.google.common.base.Predicate; import com.jcraft.jsch.JSchException; import jssc.SerialPortException; import org.fife.ui.rsyntaxtextarea.RSyntaxDocument; @@ -72,6 +71,7 @@ import java.net.URL; import java.net.URLClassLoader; import java.util.*; import java.util.List; +import java.util.function.Predicate; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -92,7 +92,7 @@ public class Editor extends JFrame implements RunnerListener { private static class ShouldSaveIfModified implements Predicate { @Override - public boolean apply(Sketch sketch) { + public boolean test(Sketch sketch) { return PreferencesData.getBoolean("editor.save_on_verify") && sketch.isModified() && !sketch.isReadOnly(); } } @@ -100,7 +100,7 @@ public class Editor extends JFrame implements RunnerListener { private static class ShouldSaveReadOnly implements Predicate { @Override - public boolean apply(Sketch sketch) { + public boolean test(Sketch sketch) { return sketch.isReadOnly(); } } @@ -1947,7 +1947,7 @@ public class Editor extends JFrame implements RunnerListener { private void handleRun(final boolean verbose, Predicate shouldSavePredicate, Runnable verboseHandler, Runnable nonVerboseHandler) { internalCloseRunner(); - if (shouldSavePredicate.apply(sketch)) { + if (shouldSavePredicate.test(sketch)) { handleSave(true); } toolbar.activateRun(); diff --git a/arduino-core/.classpath b/arduino-core/.classpath index 692937b66..183bd20e5 100644 --- a/arduino-core/.classpath +++ b/arduino-core/.classpath @@ -23,7 +23,6 @@ - diff --git a/arduino-core/lib/guava-18.0.LICENSE.ASL-2.0.txt b/arduino-core/lib/guava-18.0.LICENSE.ASL-2.0.txt deleted file mode 100644 index 6b0b1270f..000000000 --- a/arduino-core/lib/guava-18.0.LICENSE.ASL-2.0.txt +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/arduino-core/lib/guava-18.0.jar b/arduino-core/lib/guava-18.0.jar deleted file mode 100644 index 8f89e4901..000000000 Binary files a/arduino-core/lib/guava-18.0.jar and /dev/null differ diff --git a/arduino-core/src/cc/arduino/contributions/filters/DownloadableContributionWithVersionPredicate.java b/arduino-core/src/cc/arduino/contributions/filters/DownloadableContributionWithVersionPredicate.java index 576103bfa..6e95111f6 100644 --- a/arduino-core/src/cc/arduino/contributions/filters/DownloadableContributionWithVersionPredicate.java +++ b/arduino-core/src/cc/arduino/contributions/filters/DownloadableContributionWithVersionPredicate.java @@ -30,7 +30,8 @@ package cc.arduino.contributions.filters; import cc.arduino.contributions.DownloadableContribution; -import com.google.common.base.Predicate; + +import java.util.function.Predicate; public class DownloadableContributionWithVersionPredicate implements Predicate { private final String version; @@ -40,7 +41,7 @@ public class DownloadableContributionWithVersionPredicate implements Predicate getLibraries(); public List find(final String name) { - return new LinkedList(Collections2.filter(getLibraries(), new LibraryWithNamePredicate(name))); + return getLibraries().stream().filter(new LibraryWithNamePredicate(name)).collect(Collectors.toList()); } public ContributedLibrary find(String name, String version) { diff --git a/arduino-core/src/cc/arduino/contributions/libraries/filters/LibraryWithNamePredicate.java b/arduino-core/src/cc/arduino/contributions/libraries/filters/LibraryWithNamePredicate.java index a1cc5090f..74aeb866d 100644 --- a/arduino-core/src/cc/arduino/contributions/libraries/filters/LibraryWithNamePredicate.java +++ b/arduino-core/src/cc/arduino/contributions/libraries/filters/LibraryWithNamePredicate.java @@ -30,7 +30,8 @@ package cc.arduino.contributions.libraries.filters; import cc.arduino.contributions.libraries.ContributedLibrary; -import com.google.common.base.Predicate; + +import java.util.function.Predicate; public class LibraryWithNamePredicate implements Predicate { @@ -41,7 +42,7 @@ public class LibraryWithNamePredicate implements Predicate { } @Override - public boolean apply(ContributedLibrary contributedLibrary) { + public boolean test(ContributedLibrary contributedLibrary) { return name.equals(contributedLibrary.getName()); } diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java index 104d27c36..52cdf1c64 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java @@ -37,7 +37,6 @@ import cc.arduino.filters.FileExecutablePredicate; import cc.arduino.utils.ArchiveExtractor; import cc.arduino.utils.MultiStepProgress; import cc.arduino.utils.Progress; -import com.google.common.collect.Collections2; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.Executor; @@ -54,9 +53,10 @@ import java.io.IOException; import java.net.URL; import java.nio.file.Files; import java.util.*; +import java.util.stream.Collectors; -import static processing.app.I18n.tr; import static processing.app.I18n.format; +import static processing.app.I18n.tr; public class ContributionInstaller { @@ -174,7 +174,7 @@ public class ContributionInstaller { } private void findAndExecutePostInstallScriptIfAny(File folder, boolean trusted, boolean trustAll) throws IOException { - Collection scripts = Collections2.filter(platform.postInstallScripts(folder), new FileExecutablePredicate()); + Collection scripts = platform.postInstallScripts(folder).stream().filter(new FileExecutablePredicate()).collect(Collectors.toList()); if (scripts.isEmpty()) { String[] subfolders = folder.list(new OnlyDirs()); @@ -190,7 +190,7 @@ public class ContributionInstaller { } private void findAndExecutePreUninstallScriptIfAny(File folder, boolean trusted, boolean trustAll) throws IOException { - Collection scripts = Collections2.filter(platform.preUninstallScripts(folder), new FileExecutablePredicate()); + Collection scripts = platform.preUninstallScripts(folder).stream().filter(new FileExecutablePredicate()).collect(Collectors.toList()); if (scripts.isEmpty()) { String[] subfolders = folder.list(new OnlyDirs()); diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java index 674a4916d..6f9295f74 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java @@ -33,9 +33,6 @@ import cc.arduino.contributions.DownloadableContributionBuiltInAtTheBottomCompar import cc.arduino.contributions.filters.DownloadableContributionWithVersionPredicate; import cc.arduino.contributions.filters.InstalledPredicate; import cc.arduino.contributions.packages.filters.PlatformArchitecturePredicate; -import com.google.common.collect.Collections2; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.Collection; @@ -64,8 +61,7 @@ public abstract class ContributionsIndex { if (aPackage == null) { return null; } - Collection platforms = Collections2.filter(aPackage.getPlatforms(), new PlatformArchitecturePredicate(platformArch)); - return Lists.newLinkedList(platforms); + return aPackage.getPlatforms().stream().filter(new PlatformArchitecturePredicate(platformArch)).collect(Collectors.toList()); } public ContributedPlatform findPlatform(String packageName, final String platformArch, final String platformVersion) { @@ -79,7 +75,7 @@ public abstract class ContributionsIndex { return null; } - Collection platforms = Collections2.filter(platformsByName, new DownloadableContributionWithVersionPredicate(platformVersion)); + Collection platforms = platformsByName.stream().filter(new DownloadableContributionWithVersionPredicate(platformVersion)).collect(Collectors.toList()); if (platforms.isEmpty()) { return null; } @@ -107,7 +103,7 @@ public abstract class ContributionsIndex { } private List getPlatforms() { - return Lists.newLinkedList(Iterables.concat(Collections2.transform(getPackages(), ContributedPackage::getPlatforms))); + return getPackages().stream().map(ContributedPackage::getPlatforms).flatMap(Collection::stream).collect(Collectors.toList()); } private final List categories = new ArrayList<>(); diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java index 9e30653c7..1e7f9d965 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java @@ -39,10 +39,6 @@ import cc.arduino.contributions.filters.InstalledPredicate; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.module.mrbean.MrBeanModule; -import com.google.common.collect.Collections2; -import com.google.common.collect.ImmutableListMultimap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Multimaps; import org.apache.commons.compress.utils.IOUtils; import processing.app.I18n; import processing.app.Platform; @@ -96,7 +92,7 @@ public class ContributionsIndexer { } List packages = index.getPackages(); - Collection packagesWithTools = Collections2.filter(packages, input -> input.getTools() != null); + Collection packagesWithTools = packages.stream().filter(input -> input.getTools() != null).collect(Collectors.toList()); for (ContributedPackage pack : packages) { for (ContributedPlatform platform : pack.getPlatforms()) { @@ -352,17 +348,16 @@ public class ContributionsIndexer { } for (ContributedPackage pack : index.getPackages()) { Collection platforms = pack.getPlatforms().stream().filter(new InstalledPredicate()).collect(Collectors.toList()); - ImmutableListMultimap platformsByName = Multimaps.index(platforms, ContributedPlatform::getName); + Map> platformsByName = platforms.stream().collect(Collectors.groupingBy(ContributedPlatform::getName)); - for (Map.Entry> entry : platformsByName.asMap().entrySet()) { - Collection platformsWithName = entry.getValue(); + platformsByName.forEach((platformName, platformsWithName) -> { if (platformsWithName.size() > 1) { platformsWithName = platformsWithName.stream().filter(new BuiltInPredicate().negate()).collect(Collectors.toList()); } for (ContributedPlatform platform : platformsWithName) { tools.addAll(platform.getResolvedTools()); } - } + }); } return tools; } @@ -416,11 +411,11 @@ public class ContributionsIndexer { } public ContributedPlatform getPlatformByFolder(final File folder) { - com.google.common.base.Optional platformOptional = Iterables.tryFind(getInstalledPlatforms(), contributedPlatform -> { + Optional platformOptional = getInstalledPlatforms().stream().filter(contributedPlatform -> { assert contributedPlatform.getInstalledFolder() != null; return FileUtils.isSubDirectory(contributedPlatform.getInstalledFolder(), folder); - }); + }).findFirst(); - return platformOptional.orNull(); + return platformOptional.orElse(null); } } diff --git a/arduino-core/src/cc/arduino/contributions/packages/filters/PlatformArchitecturePredicate.java b/arduino-core/src/cc/arduino/contributions/packages/filters/PlatformArchitecturePredicate.java index 2f7957dfd..69d6e9cc5 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/filters/PlatformArchitecturePredicate.java +++ b/arduino-core/src/cc/arduino/contributions/packages/filters/PlatformArchitecturePredicate.java @@ -30,7 +30,8 @@ package cc.arduino.contributions.packages.filters; import cc.arduino.contributions.packages.ContributedPlatform; -import com.google.common.base.Predicate; + +import java.util.function.Predicate; public class PlatformArchitecturePredicate implements Predicate { @@ -41,7 +42,7 @@ public class PlatformArchitecturePredicate implements Predicate { @Override - public boolean apply(File file) { + public boolean test(File file) { return file.isFile() && file.exists() && file.canRead() && file.canExecute(); } diff --git a/arduino-core/src/processing/app/PreferencesData.java b/arduino-core/src/processing/app/PreferencesData.java index 8d5a0eb3b..4305f0c36 100644 --- a/arduino-core/src/processing/app/PreferencesData.java +++ b/arduino-core/src/processing/app/PreferencesData.java @@ -1,6 +1,5 @@ package processing.app; -import com.google.common.base.Joiner; import org.apache.commons.compress.utils.IOUtils; import processing.app.helpers.PreferencesHelper; import processing.app.helpers.PreferencesMap; @@ -15,6 +14,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.MissingResourceException; +import java.util.stream.Collectors; import static processing.app.I18n.tr; @@ -248,7 +248,7 @@ public class PreferencesData { } public static void setCollection(String key, Collection values) { - String value = Joiner.on(',').join(values); + String value = values.stream().collect(Collectors.joining(",")); set(key, value); } } diff --git a/arduino-core/src/processing/app/SketchData.java b/arduino-core/src/processing/app/SketchData.java index 09a52fe22..e0161727d 100644 --- a/arduino-core/src/processing/app/SketchData.java +++ b/arduino-core/src/processing/app/SketchData.java @@ -1,29 +1,37 @@ package processing.app; -import com.google.common.collect.FluentIterable; - -import static processing.app.I18n.tr; - import java.io.File; import java.io.IOException; import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static processing.app.I18n.tr; public class SketchData { public static final List SKETCH_EXTENSIONS = Arrays.asList("ino", "pde"); public static final List OTHER_ALLOWED_EXTENSIONS = Arrays.asList("c", "cpp", "h", "hh", "hpp", "s"); - public static final List EXTENSIONS = new LinkedList(FluentIterable.from(SKETCH_EXTENSIONS).append(OTHER_ALLOWED_EXTENSIONS).toList()); + public static final List EXTENSIONS = Stream.concat(SKETCH_EXTENSIONS.stream(), OTHER_ALLOWED_EXTENSIONS.stream()).collect(Collectors.toList()); - /** main pde file for this sketch. */ + /** + * main pde file for this sketch. + */ private File primaryFile; - /** folder that contains this sketch */ + /** + * folder that contains this sketch + */ private File folder; - /** data folder location for this sketch (may not exist yet) */ + /** + * data folder location for this sketch (may not exist yet) + */ private File dataFolder; - /** code folder location for this sketch (may not exist yet) */ + /** + * code folder location for this sketch (may not exist yet) + */ private File codeFolder; /** @@ -79,15 +87,15 @@ public class SketchData { /** * Build the list of files. - *

+ *

* Generally this is only done once, rather than * each time a change is made, because otherwise it gets to be * a nightmare to keep track of what files went where, because * not all the data will be saved to disk. - *

+ *

* This also gets called when the main sketch file is renamed, * because the sketch has to be reloaded from a different folder. - *

+ *

* Another exception is when an external editor is in use, * in which case the load happens each time "run" is hit. */ @@ -106,7 +114,7 @@ public class SketchData { // codeDocs = new SketchCodeDoc[list.length]; clearCodeDocs(); // data.setCodeDocs(codeDocs); - + for (String filename : list) { // Ignoring the dot prefix files is especially important to avoid files // with the ._ prefix on Mac OS X. (You'll see this with Mac files on diff --git a/arduino-core/src/processing/app/windows/RegQueryParser.java b/arduino-core/src/processing/app/windows/RegQueryParser.java index 4d75b747e..e20a27faf 100644 --- a/arduino-core/src/processing/app/windows/RegQueryParser.java +++ b/arduino-core/src/processing/app/windows/RegQueryParser.java @@ -1,8 +1,5 @@ package processing.app.windows; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - import java.util.Arrays; import java.util.List; @@ -17,12 +14,7 @@ public class RegQueryParser { private void parse(String regQueryOutput) { List rows = Arrays.asList(regQueryOutput.replace(" ", "\t").replace("\r", "\n").replace("\n\n", "\n").split("\n")); - String row = Iterables.find(rows, new Predicate() { - @Override - public boolean apply(String input) { - return input.startsWith("\t"); - } - }); + String row = rows.stream().filter(input -> input.startsWith("\t")).findFirst().get(); String[] cols = row.split("\t"); assert cols.length == 4; diff --git a/build/windows/launcher/config.xml b/build/windows/launcher/config.xml index 5f78c2c53..4c6ddaf7e 100644 --- a/build/windows/launcher/config.xml +++ b/build/windows/launcher/config.xml @@ -19,7 +19,6 @@ %EXEDIR%/lib/commons-lang3-3.3.2.jar %EXEDIR%/lib/commons-logging-1.0.4.jar %EXEDIR%/lib/ecj.jar - %EXEDIR%/lib/guava-18.0.jar %EXEDIR%/lib/jackson-annotations-2.2.3.jar %EXEDIR%/lib/jackson-core-2.2.3.jar %EXEDIR%/lib/jackson-databind-2.2.3.jar diff --git a/build/windows/launcher/config_debug.xml b/build/windows/launcher/config_debug.xml index 4bcd2b34e..bd465e24a 100644 --- a/build/windows/launcher/config_debug.xml +++ b/build/windows/launcher/config_debug.xml @@ -19,7 +19,6 @@ %EXEDIR%/lib/commons-lang3-3.3.2.jar %EXEDIR%/lib/commons-logging-1.0.4.jar %EXEDIR%/lib/ecj.jar - %EXEDIR%/lib/guava-18.0.jar %EXEDIR%/lib/jackson-annotations-2.2.3.jar %EXEDIR%/lib/jackson-core-2.2.3.jar %EXEDIR%/lib/jackson-databind-2.2.3.jar