1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/c.s.tools.ide.analysis.modernize/build.xml Sun Jun 25 18:25:05 2017 +0200
1.3 @@ -0,0 +1,8 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
1.6 +<!-- for some information on what you could do (e.g. targets to override). -->
1.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
1.8 +<project name="contrib/c.s.tools.ide.analysis.modernize" default="netbeans" basedir=".">
1.9 + <description>Builds, tests, and runs the project com.sun.tools.ide.analysis.modernize.</description>
1.10 + <import file="../../nbbuild/templates/projectized.xml"/>
1.11 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/c.s.tools.ide.analysis.modernize/l10n.list Sun Jun 25 18:25:05 2017 +0200
2.3 @@ -0,0 +1,2 @@
2.4 +src/**/Bundle.properties
2.5 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/c.s.tools.ide.analysis.modernize/license.txt Sun Jun 25 18:25:05 2017 +0200
3.3 @@ -0,0 +1,565 @@
3.4 +NetBeans IDE Dual License Header and License Notice
3.5 +
3.6 +Oracle elects to use only the GNU Lesser General Public License version 2.1
3.7 +(LGPL) for any software where a choice of LGPL/GPL license versions are made
3.8 +available with the language indicating that LGPLv2.1/GPLv2 or any later version
3.9 +may be used, or where a choice of which version of the LGPL/GPL is applied is
3.10 +unspecified.
3.11 +For more information on the license please see: the NetBeans License FAQs.
3.12 +
3.13 +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
3.14 +
3.15 +1. Definitions.
3.16 +1.1. "Contributor" means each individual or entity that creates or contributes
3.17 +to the creation of Modifications.
3.18 +1.2. "Contributor Version" means the combination of the Original Software,
3.19 +prior Modifications used by a Contributor (if any), and the Modifications made
3.20 +by that particular Contributor.
3.21 +1.3. "Covered Software" means (a) the Original Software, or (b) Modifications,
3.22 +or (c) the combination of files containing Original Software with files
3.23 +containing Modifications, in each case including portions thereof.
3.24 +1.4. "Executable" means the Covered Software in any form other than Source Code.
3.25 +1.5. "Initial Developer" means the individual or entity that first makes
3.26 +Original Software available under this License.
3.27 +1.6. "Larger Work" means a work which combines Covered Software or portions
3.28 +thereof with code not governed by the terms of this License.
3.29 +1.7. "License" means this document.
3.30 +1.8. "Licensable" means having the right to grant, to the maximum extent
3.31 +possible, whether at the time of the initial grant or subsequently acquired,
3.32 +any and all of the rights conveyed herein.
3.33 +1.9 "Modifications" means the Source Code and Executable form of any of the
3.34 +following:
3.35 +A. Any file that results from an addition to, deletion from or modification of
3.36 +the contents of a file containing Original Software or previous Modifications;
3.37 +B. Any new file that contains any part of the Original Software or previous
3.38 +Modification; or
3.39 +C. Any new file that is contributed or otherwise made available under the terms
3.40 +of this License.
3.41 +1.10. "Original Software" means the Source Code and Executable form of computer
3.42 +software code that is originally released under this License.
3.43 +1.11. "Patent Claims" means any patent claim(s), now owned or hereafter
3.44 +acquired, including without limitation, method, process, and apparatus claims,
3.45 +in any patent Licensable by grantor.
3.46 +1.12. "Source Code" means (a) the common form of computer software code in
3.47 +which modifications are made and (b) associated documentation included in or
3.48 +with such code.
3.49 +1.13. "You" (or "Your") means an individual or a legal entity exercising rights
3.50 +under, and complying with all of the terms of, this License. For legal
3.51 +entities, "You" includes any entity which controls, is controlled by, or is
3.52 +under common control with You. For purposes of this definition, "control" means
3.53 +(a) the power, direct or indirect, to cause the direction or management of such
3.54 +entity, whether by contract or otherwise, or (b) ownership of more than fifty
3.55 +percent (50%) of the outstanding shares or beneficial ownership of such entity.
3.56 +2. License Grants.
3.57 +2.1. The Initial Developer Grant.
3.58 +Conditioned upon Your compliance with Section 3.1 below and subject to third
3.59 +party intellectual property claims, the Initial Developer hereby grants You a
3.60 +world-wide, royalty-free, non-exclusive license:
3.61 +(a) under intellectual property rights (other than patent or trademark)
3.62 +Licensable by Initial Developer, to use, reproduce, modify, display, perform,
3.63 +sublicense and distribute the Original Software (or portions thereof), with or
3.64 +without Modifications, and/or as part of a Larger Work; and
3.65 +(b) under Patent Claims infringed by the making, using or selling of Original
3.66 +Software, to make, have made, use, practice, sell, and offer for sale, and/or
3.67 +otherwise dispose of the Original Software (or portions thereof).
3.68 +(c) The licenses granted in Sections 2.1(a) and (b) are effective on the date
3.69 +Initial Developer first distributes or otherwise makes the Original Software
3.70 +available to a third party under the terms of this License.
3.71 +(d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for
3.72 +code that You delete from the Original Software, or (2) for infringements
3.73 +caused by: (i) the modification of the Original Software, or (ii) the
3.74 +combination of the Original Software with other software or devices.
3.75 +2.2. Contributor Grant.
3.76 +Conditioned upon Your compliance with Section 3.1 below and subject to third
3.77 +party intellectual property claims, each Contributor hereby grants You a
3.78 +world-wide, royalty-free, non-exclusive license:
3.79 +(a) under intellectual property rights (other than patent or trademark)
3.80 +Licensable by Contributor to use, reproduce, modify, display, perform,
3.81 +sublicense and distribute the Modifications created by such Contributor (or
3.82 +portions thereof), either on an unmodified basis, with other Modifications, as
3.83 +Covered Software and/or as part of a Larger Work; and
3.84 +(b) under Patent Claims infringed by the making, using, or selling of
3.85 +Modifications made by that Contributor either alone and/or in combination with
3.86 +its Contributor Version (or portions of such combination), to make, use, sell,
3.87 +offer for sale, have made, and/or otherwise dispose of: (1) Modifications made
3.88 +by that Contributor (or portions thereof); and (2) the combination of
3.89 +Modifications made by that Contributor with its Contributor Version (or
3.90 +portions of such combination).
3.91 +(c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the
3.92 +date Contributor first distributes or otherwise makes the Modifications
3.93 +available to a third party.
3.94 +(d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for
3.95 +any code that Contributor has deleted from the Contributor Version; (2) for
3.96 +infringements caused by: (i) third party modifications of Contributor Version,
3.97 +or (ii) the combination of Modifications made by that Contributor with other
3.98 +software (except as part of the Contributor Version) or other devices; or (3)
3.99 +under Patent Claims infringed by Covered Software in the absence of
3.100 +Modifications made by that Contributor.
3.101 +3. Distribution Obligations.
3.102 +3.1. Availability of Source Code.
3.103 +Any Covered Software that You distribute or otherwise make available in
3.104 +Executable form must also be made available in Source Code form and that Source
3.105 +Code form must be distributed only under the terms of this License. You must
3.106 +include a copy of this License with every copy of the Source Code form of the
3.107 +Covered Software You distribute or otherwise make available. You must inform
3.108 +recipients of any such Covered Software in Executable form as to how they can
3.109 +obtain such Covered Software in Source Code form in a reasonable manner on or
3.110 +through a medium customarily used for software exchange.
3.111 +3.2. Modifications.
3.112 +The Modifications that You create or to which You contribute are governed by
3.113 +the terms of this License. You represent that You believe Your Modifications
3.114 +are Your original creation(s) and/or You have sufficient rights to grant the
3.115 +rights conveyed by this License.
3.116 +3.3. Required Notices.
3.117 +You must include a notice in each of Your Modifications that identifies You as
3.118 +the Contributor of the Modification. You may not remove or alter any copyright,
3.119 +patent or trademark notices contained within the Covered Software, or any
3.120 +notices of licensing or any descriptive text giving attribution to any
3.121 +Contributor or the Initial Developer.
3.122 +3.4. Application of Additional Terms.
3.123 +You may not offer or impose any terms on any Covered Software in Source Code
3.124 +form that alters or restricts the applicable version of this License or the
3.125 +recipients� rights hereunder. You may choose to offer, and to charge a fee
3.126 +for, warranty, support, indemnity or liability obligations to one or more
3.127 +recipients of Covered Software. However, you may do so only on Your own behalf,
3.128 +and not on behalf of the Initial Developer or any Contributor. You must make it
3.129 +absolutely clear that any such warranty, support, indemnity or liability
3.130 +obligation is offered by You alone, and You hereby agree to indemnify the
3.131 +Initial Developer and every Contributor for any liability incurred by the
3.132 +Initial Developer or such Contributor as a result of warranty, support,
3.133 +indemnity or liability terms You offer.
3.134 +3.5. Distribution of Executable Versions.
3.135 +You may distribute the Executable form of the Covered Software under the terms
3.136 +of this License or under the terms of a license of Your choice, which may
3.137 +contain terms different from this License, provided that You are in compliance
3.138 +with the terms of this License and that the license for the Executable form
3.139 +does not attempt to limit or alter the recipient�s rights in the Source Code
3.140 +form from the rights set forth in this License. If You distribute the Covered
3.141 +Software in Executable form under a different license, You must make it
3.142 +absolutely clear that any terms which differ from this License are offered by
3.143 +You alone, not by the Initial Developer or Contributor. You hereby agree to
3.144 +indemnify the Initial Developer and every Contributor for any liability
3.145 +incurred by the Initial Developer or such Contributor as a result of any such
3.146 +terms You offer.
3.147 +3.6. Larger Works.
3.148 +You may create a Larger Work by combining Covered Software with other code not
3.149 +governed by the terms of this License and distribute the Larger Work as a
3.150 +single product. In such a case, You must make sure the requirements of this
3.151 +License are fulfilled for the Covered Software.
3.152 +4. Versions of the License.
3.153 +4.1. New Versions.
3.154 +Oracle Corp. is the initial license steward and may publish revised and/or new
3.155 +versions of this License from time to time. Each version will be given a
3.156 +distinguishing version number. Except as provided in Section 4.3, no one other
3.157 +than the license steward has the right to modify this License.
3.158 +4.2. Effect of New Versions.
3.159 +You may always continue to use, distribute or otherwise make the Covered
3.160 +Software available under the terms of the version of the License under which
3.161 +You originally received the Covered Software. If the Initial Developer includes
3.162 +a notice in the Original Software prohibiting it from being distributed or
3.163 +otherwise made available under any subsequent version of the License, You must
3.164 +distribute and make the Covered Software available under the terms of the
3.165 +version of the License under which You originally received the Covered
3.166 +Software. Otherwise, You may also choose to use, distribute or otherwise make
3.167 +the Covered Software available under the terms of any subsequent version of the
3.168 +License published by the license steward.
3.169 +4.3. Modified Versions.
3.170 +When You are an Initial Developer and You want to create a new license for Your
3.171 +Original Software, You may create and use a modified version of this License if
3.172 +You: (a) rename the license and remove any references to the name of the
3.173 +license steward (except to note that the license differs from this License);
3.174 +and (b) otherwise make it clear that the license contains terms which differ
3.175 +from this License.
3.176 +5. DISCLAIMER OF WARRANTY.
3.177 +COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT
3.178 +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
3.179 +LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS,
3.180 +MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK
3.181 +AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD
3.182 +ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL
3.183 +DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,
3.184 +REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART
3.185 +OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT
3.186 +UNDER THIS DISCLAIMER.
3.187 +6. TERMINATION.
3.188 +6.1. This License and the rights granted hereunder will terminate automatically
3.189 +if You fail to comply with terms herein and fail to cure such breach within 30
3.190 +days of becoming aware of the breach. Provisions which, by their nature, must
3.191 +remain in effect beyond the termination of this License shall survive.
3.192 +6.2. If You assert a patent infringement claim (excluding declaratory judgment
3.193 +actions) against Initial Developer or a Contributor (the Initial Developer or
3.194 +Contributor against whom You assert such claim is referred to as "Participant")
3.195 +alleging that the Participant Software (meaning the Contributor Version where
3.196 +the Participant is a Contributor or the Original Software where the Participant
3.197 +is the Initial Developer) directly or indirectly infringes any patent, then any
3.198 +and all rights granted directly or indirectly to You by such Participant, the
3.199 +Initial Developer (if the Initial Developer is not the Participant) and all
3.200 +Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days
3.201 +notice from Participant terminate prospectively and automatically at the
3.202 +expiration of such 60 day notice period, unless if within such 60 day period
3.203 +You withdraw Your claim with respect to the Participant Software against such
3.204 +Participant either unilaterally or pursuant to a written agreement with
3.205 +Participant.
3.206 +6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user
3.207 +licenses that have been validly granted by You or any distributor hereunder
3.208 +prior to termination (excluding licenses granted to You by any distributor)
3.209 +shall survive termination.
3.210 +7. LIMITATION OF LIABILITY.
3.211 +UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
3.212 +NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY
3.213 +OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF
3.214 +ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL,
3.215 +INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
3.216 +LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
3.217 +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN
3.218 +IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS
3.219 +LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
3.220 +INJURY RESULTING FROM SUCH PARTY�S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
3.221 +PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
3.222 +LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND
3.223 +LIMITATION MAY NOT APPLY TO YOU.
3.224 +8. U.S. GOVERNMENT END USERS.
3.225 +The Covered Software is a "commercial item," as that term is defined in 48
3.226 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" (as that
3.227 +term is defined at 48 C.F.R. �252.227-7014(a)(1)) and "commercial computer
3.228 +software documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
3.229 +1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through
3.230 +227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software
3.231 +with only those rights set forth herein. This U.S. Government Rights clause is
3.232 +in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision
3.233 +that addresses Government rights in computer software under this License.
3.234 +9. MISCELLANEOUS.
3.235 +This License represents the complete agreement concerning subject matter
3.236 +hereof. If any provision of this License is held to be unenforceable, such
3.237 +provision shall be reformed only to the extent necessary to make it
3.238 +enforceable. This License shall be governed by the law of the jurisdiction
3.239 +specified in a notice contained within the Original Software (except to the
3.240 +extent applicable law, if any, provides otherwise), excluding such
3.241 +jurisdiction�s conflict-of-law provisions. Any litigation relating to this
3.242 +License shall be subject to the jurisdiction of the courts located in the
3.243 +jurisdiction and venue specified in a notice contained within the Original
3.244 +Software, with the losing party responsible for costs, including, without
3.245 +limitation, court costs and reasonable attorneys� fees and expenses. The
3.246 +application of the United Nations Convention on Contracts for the International
3.247 +Sale of Goods is expressly excluded. Any law or regulation which provides that
3.248 +the language of a contract shall be construed against the drafter shall not
3.249 +apply to this License. You agree that You alone are responsible for compliance
3.250 +with the United States export administration regulations (and the export
3.251 +control laws and regulation of any other countries) when You use, distribute or
3.252 +otherwise make available any Covered Software.
3.253 +10. RESPONSIBILITY FOR CLAIMS.
3.254 +As between Initial Developer and the Contributors, each party is responsible
3.255 +for claims and damages arising, directly or indirectly, out of its utilization
3.256 +of rights under this License and You agree to work with Initial Developer and
3.257 +Contributors to distribute such responsibility on an equitable basis. Nothing
3.258 +herein is intended or shall be deemed to constitute any admission of liability.
3.259 +NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
3.260 +(CDDL)
3.261 +The code released under the CDDL shall be governed by the laws of the State of
3.262 +California (excluding conflict-of-law provisions). Any litigation relating to
3.263 +this License shall be subject to the jurisdiction of the Federal Courts of the
3.264 +Northern District of California and the state courts of the State of
3.265 +California, with venue lying in Santa Clara County, California.
3.266 +The GNU General Public License (GPL) Version 2, June 1991
3.267 +
3.268 +Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite
3.269 +330, Boston, MA 02111-1307 USA
3.270 +Everyone is permitted to copy and distribute verbatim copies of this license
3.271 +document, but changing it is not allowed.
3.272 +Preamble
3.273 +The licenses for most software are designed to take away your freedom to share
3.274 +and change it. By contrast, the GNU General Public License is intended to
3.275 +guarantee your freedom to share and change free software--to make sure the
3.276 +software is free for all its users. This General Public License applies to most
3.277 +of the Free Software Foundation's software and to any other program whose
3.278 +authors commit to using it. (Some other Free Software Foundation software is
3.279 +covered by the GNU Library General Public License instead.) You can apply it to
3.280 +your programs, too.
3.281 +When we speak of free software, we are referring to freedom, not price. Our
3.282 +General Public Licenses are designed to make sure that you have the freedom to
3.283 +distribute copies of free software (and charge for this service if you wish),
3.284 +that you receive source code or can get it if you want it, that you can change
3.285 +the software or use pieces of it in new free programs; and that you know you
3.286 +can do these things.
3.287 +To protect your rights, we need to make restrictions that forbid anyone to deny
3.288 +you these rights or to ask you to surrender the rights. These restrictions
3.289 +translate to certain responsibilities for you if you distribute copies of the
3.290 +software, or if you modify it.
3.291 +For example, if you distribute copies of such a program, whether gratis or for
3.292 +a fee, you must give the recipients all the rights that you have. You must make
3.293 +sure that they, too, receive or can get the source code. And you must show them
3.294 +these terms so they know their rights.
3.295 +We protect your rights with two steps: (1) copyright the software, and (2)
3.296 +offer you this license which gives you legal permission to copy, distribute
3.297 +and/or modify the software.
3.298 +Also, for each author's protection and ours, we want to make certain that
3.299 +everyone understands that there is no warranty for this free software. If the
3.300 +software is modified by someone else and passed on, we want its recipients to
3.301 +know that what they have is not the original, so that any problems introduced
3.302 +by others will not reflect on the original authors' reputations.
3.303 +Finally, any free program is threatened constantly by software patents. We wish
3.304 +to avoid the danger that redistributors of a free program will individually
3.305 +obtain patent licenses, in effect making the program proprietary. To prevent
3.306 +this, we have made it clear that any patent must be licensed for everyone's
3.307 +free use or not licensed at all.
3.308 +The precise terms and conditions for copying, distribution and modification
3.309 +follow.
3.310 +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
3.311 +0. This License applies to any program or other work which contains a notice
3.312 +placed by the copyright holder saying it may be distributed under the terms of
3.313 +this General Public License. The "Program", below, refers to any such program
3.314 +or work, and a "work based on the Program" means either the Program or any
3.315 +derivative work under copyright law: that is to say, a work containing the
3.316 +Program or a portion of it, either verbatim or with modifications and/or
3.317 +translated into another language. (Hereinafter, translation is included without
3.318 +limitation in the term "modification".) Each licensee is addressed as "you".
3.319 +Activities other than copying, distribution and modification are not covered by
3.320 +this License; they are outside its scope. The act of running the Program is not
3.321 +restricted, and the output from the Program is covered only if its contents
3.322 +constitute a work based on the Program (independent of having been made by
3.323 +running the Program). Whether that is true depends on what the Program does.
3.324 +1. You may copy and distribute verbatim copies of the Program's source code as
3.325 +you receive it, in any medium, provided that you conspicuously and
3.326 +appropriately publish on each copy an appropriate copyright notice and
3.327 +disclaimer of warranty; keep intact all the notices that refer to this License
3.328 +and to the absence of any warranty; and give any other recipients of the
3.329 +Program a copy of this License along with the Program.
3.330 +You may charge a fee for the physical act of transferring a copy, and you may
3.331 +at your option offer warranty protection in exchange for a fee.
3.332 +2. You may modify your copy or copies of the Program or any portion of it, thus
3.333 +forming a work based on the Program, and copy and distribute such modifications
3.334 +or work under the terms of Section 1 above, provided that you also meet all of
3.335 +these conditions:
3.336 +a) You must cause the modified files to carry prominent notices stating that
3.337 +you changed the files and the date of any change.
3.338 +b) You must cause any work that you distribute or publish, that in whole or in
3.339 +part contains or is derived from the Program or any part thereof, to be
3.340 +licensed as a whole at no charge to all third parties under the terms of this
3.341 +License.
3.342 +c) If the modified program normally reads commands interactively when run, you
3.343 +must cause it, when started running for such interactive use in the most
3.344 +ordinary way, to print or display an announcement including an appropriate
3.345 +copyright notice and a notice that there is no warranty (or else, saying that
3.346 +you provide a warranty) and that users may redistribute the program under these
3.347 +conditions, and telling the user how to view a copy of this License.
3.348 +(Exception: if the Program itself is interactive but does not normally print
3.349 +such an announcement, your work based on the Program is not required to print
3.350 +an announcement.)
3.351 +These requirements apply to the modified work as a whole. If identifiable
3.352 +sections of that work are not derived from the Program, and can be reasonably
3.353 +considered independent and separate works in themselves, then this License, and
3.354 +its terms, do not apply to those sections when you distribute them as separate
3.355 +works. But when you distribute the same sections as part of a whole which is a
3.356 +work based on the Program, the distribution of the whole must be on the terms
3.357 +of this License, whose permissions for other licensees extend to the entire
3.358 +whole, and thus to each and every part regardless of who wrote it.
3.359 +Thus, it is not the intent of this section to claim rights or contest your
3.360 +rights to work written entirely by you; rather, the intent is to exercise the
3.361 +right to control the distribution of derivative or collective works based on
3.362 +the Program.
3.363 +In addition, mere aggregation of another work not based on the Program with the
3.364 +Program (or with a work based on the Program) on a volume of a storage or
3.365 +distribution medium does not bring the other work under the scope of this
3.366 +License.
3.367 +3. You may copy and distribute the Program (or a work based on it, under
3.368 +Section 2) in object code or executable form under the terms of Sections 1 and
3.369 +2 above provided that you also do one of the following:
3.370 +a) Accompany it with the complete corresponding machine-readable source code,
3.371 +which must be distributed under the terms of Sections 1 and 2 above on a medium
3.372 +customarily used for software interchange; or,
3.373 +b) Accompany it with a written offer, valid for at least three years, to give
3.374 +any third party, for a charge no more than your cost of physically performing
3.375 +source distribution, a complete machine-readable copy of the corresponding
3.376 +source code, to be distributed under the terms of Sections 1 and 2 above on a
3.377 +medium customarily used for software interchange; or,
3.378 +c) Accompany it with the information you received as to the offer to distribute
3.379 +corresponding source code. (This alternative is allowed only for noncommercial
3.380 +distribution and only if you received the program in object code or executable
3.381 +form with such an offer, in accord with Subsection b above.)
3.382 +The source code for a work means the preferred form of the work for making
3.383 +modifications to it. For an executable work, complete source code means all the
3.384 +source code for all modules it contains, plus any associated interface
3.385 +definition files, plus the scripts used to control compilation and installation
3.386 +of the executable. However, as a special exception, the source code distributed
3.387 +need not include anything that is normally distributed (in either source or
3.388 +binary form) with the major components (compiler, kernel, and so on) of the
3.389 +operating system on which the executable runs, unless that component itself
3.390 +accompanies the executable.
3.391 +If distribution of executable or object code is made by offering access to copy
3.392 +from a designated place, then offering equivalent access to copy the source
3.393 +code from the same place counts as distribution of the source code, even though
3.394 +third parties are not compelled to copy the source along with the object code.
3.395 +4. You may not copy, modify, sublicense, or distribute the Program except as
3.396 +expressly provided under this License. Any attempt otherwise to copy, modify,
3.397 +sublicense or distribute the Program is void, and will automatically terminate
3.398 +your rights under this License. However, parties who have received copies, or
3.399 +rights, from you under this License will not have their licenses terminated so
3.400 +long as such parties remain in full compliance.
3.401 +5. You are not required to accept this License, since you have not signed it.
3.402 +However, nothing else grants you permission to modify or distribute the Program
3.403 +or its derivative works. These actions are prohibited by law if you do not
3.404 +accept this License. Therefore, by modifying or distributing the Program (or
3.405 +any work based on the Program), you indicate your acceptance of this License to
3.406 +do so, and all its terms and conditions for copying, distributing or modifying
3.407 +the Program or works based on it.
3.408 +6. Each time you redistribute the Program (or any work based on the Program),
3.409 +the recipient automatically receives a license from the original licensor to
3.410 +copy, distribute or modify the Program subject to these terms and conditions.
3.411 +You may not impose any further restrictions on the recipients' exercise of the
3.412 +rights granted herein. You are not responsible for enforcing compliance by
3.413 +third parties to this License.
3.414 +7. If, as a consequence of a court judgment or allegation of patent
3.415 +infringement or for any other reason (not limited to patent issues), conditions
3.416 +are imposed on you (whether by court order, agreement or otherwise) that
3.417 +contradict the conditions of this License, they do not excuse you from the
3.418 +conditions of this License. If you cannot distribute so as to satisfy
3.419 +simultaneously your obligations under this License and any other pertinent
3.420 +obligations, then as a consequence you may not distribute the Program at all.
3.421 +For example, if a patent license would not permit royalty-free redistribution
3.422 +of the Program by all those who receive copies directly or indirectly through
3.423 +you, then the only way you could satisfy both it and this License would be to
3.424 +refrain entirely from distribution of the Program.
3.425 +If any portion of this section is held invalid or unenforceable under any
3.426 +particular circumstance, the balance of the section is intended to apply and
3.427 +the section as a whole is intended to apply in other circumstances.
3.428 +It is not the purpose of this section to induce you to infringe any patents or
3.429 +other property right claims or to contest validity of any such claims; this
3.430 +section has the sole purpose of protecting the integrity of the free software
3.431 +distribution system, which is implemented by public license practices. Many
3.432 +people have made generous contributions to the wide range of software
3.433 +distributed through that system in reliance on consistent application of that
3.434 +system; it is up to the author/donor to decide if he or she is willing to
3.435 +distribute software through any other system and a licensee cannot impose that
3.436 +choice.
3.437 +This section is intended to make thoroughly clear what is believed to be a
3.438 +consequence of the rest of this License.
3.439 +8. If the distribution and/or use of the Program is restricted in certain
3.440 +countries either by patents or by copyrighted interfaces, the original
3.441 +copyright holder who places the Program under this License may add an explicit
3.442 +geographical distribution limitation excluding those countries, so that
3.443 +distribution is permitted only in or among countries not thus excluded. In such
3.444 +case, this License incorporates the limitation as if written in the body of
3.445 +this License.
3.446 +9. The Free Software Foundation may publish revised and/or new versions of the
3.447 +General Public License from time to time. Such new versions will be similar in
3.448 +spirit to the present version, but may differ in detail to address new problems
3.449 +or concerns.
3.450 +Each version is given a distinguishing version number. If the Program specifies
3.451 +a version number of this License which applies to it and "any later version",
3.452 +you have the option of following the terms and conditions either of that
3.453 +version or of any later version published by the Free Software Foundation. If
3.454 +the Program does not specify a version number of this License, you may choose
3.455 +any version ever published by the Free Software Foundation.
3.456 +10. If you wish to incorporate parts of the Program into other free programs
3.457 +whose distribution conditions are different, write to the author to ask for
3.458 +permission. For software which is copyrighted by the Free Software Foundation,
3.459 +write to the Free Software Foundation; we sometimes make exceptions for this.
3.460 +Our decision will be guided by the two goals of preserving the free status of
3.461 +all derivatives of our free software and of promoting the sharing and reuse of
3.462 +software generally.
3.463 +NO WARRANTY
3.464 +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
3.465 +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
3.466 +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
3.467 +PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
3.468 +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3.469 +FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
3.470 +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU
3.471 +ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
3.472 +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
3.473 +ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
3.474 +PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
3.475 +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
3.476 +INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
3.477 +BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
3.478 +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
3.479 +OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
3.480 +END OF TERMS AND CONDITIONS
3.481 +How to Apply These Terms to Your New Programs
3.482 +If you develop a new program, and you want it to be of the greatest possible
3.483 +use to the public, the best way to achieve this is to make it free software
3.484 +which everyone can redistribute and change under these terms.
3.485 +To do so, attach the following notices to the program. It is safest to attach
3.486 +them to the start of each source file to most effectively convey the exclusion
3.487 +of warranty; and each file should have at least the "copyright" line and a
3.488 +pointer to where the full notice is found.
3.489 +One line to give the program's name and a brief idea of what it does.
3.490 +Copyright (C)
3.491 +This program is free software; you can redistribute it and/or modify it under
3.492 +the terms of the GNU General Public License as published by the Free Software
3.493 +Foundation; either version 2 of the License, or (at your option) any later
3.494 +version.
3.495 +This program is distributed in the hope that it will be useful, but WITHOUT ANY
3.496 +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
3.497 +PARTICULAR PURPOSE. See the GNU General Public License for more details.
3.498 +You should have received a copy of the GNU General Public License along with
3.499 +this program; if not, write to the Free Software Foundation, Inc., 59 Temple
3.500 +Place, Suite 330, Boston, MA 02111-1307 USA
3.501 +Also add information on how to contact you by electronic and paper mail.
3.502 +If the program is interactive, make it output a short notice like this when it
3.503 +starts in an interactive mode:
3.504 +Gnomovision version 69, Copyright (C) year name of author
3.505 +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This
3.506 +is free software, and you are welcome to redistribute it under certain
3.507 +conditions; type `show c' for details.
3.508 +The hypothetical commands `show w' and `show c' should show the appropriate
3.509 +parts of the General Public License. Of course, the commands you use may be
3.510 +called something other than `show w' and `show c'; they could even be
3.511 +mouse-clicks or menu items--whatever suits your program.
3.512 +You should also get your employer (if you work as a programmer) or your school,
3.513 +if any, to sign a "copyright disclaimer" for the program, if necessary. Here is
3.514 +a sample; alter the names:
3.515 +Yoyodyne, Inc., hereby disclaims all copyright interest in the program
3.516 +`Gnomovision' (which makes passes at compilers) written by James Hacker.
3.517 +signature of Ty Coon, 1 April 1989
3.518 +Ty Coon, President of Vice
3.519 +This General Public License does not permit incorporating your program into
3.520 +proprietary programs. If your program is a subroutine library, you may consider
3.521 +it more useful to permit linking proprietary applications with the library. If
3.522 +this is what you want to do, use the GNU Library General Public License instead
3.523 +of this License.
3.524 +"CLASSPATH" EXCEPTION TO THE GPL VERSION 2
3.525 +Certain source files distributed by Oracle America, Inc. and/or its affiliates
3.526 +are subject to the following clarification and special exception to the GPLv2,
3.527 +based on the GNU Project exception for its Classpath libraries, known as the
3.528 +GNU Classpath Exception, but only where Oracle has expressly included in the
3.529 +particular source file's header the words "Oracle designates this particular
3.530 +file as subject to the "Classpath" exception as provided by Oracle in the
3.531 +LICENSE file that accompanied this code."
3.532 +You should also note that Oracle includes multiple, independent programs in
3.533 +this software package. Some of those programs are provided under licenses
3.534 +deemed incompatible with the GPLv2 by the Free Software Foundation and others.
3.535 +For example, the package includes programs licensed under the Apache License,
3.536 +Version 2.0. Such programs are licensed to you under their original licenses.
3.537 +Oracle facilitates your further distribution of this package by adding the
3.538 +Classpath Exception to the necessary parts of its GPLv2 code, which permits you
3.539 +to use that code in combination with other independent modules not licensed
3.540 +under the GPLv2. However, note that this would not permit you to commingle code
3.541 +under an incompatible license with Oracle's GPLv2 licensed code by, for
3.542 +example, cutting and pasting such code into a file also containing Oracle's
3.543 +GPLv2 licensed code and then distributing the result.
3.544 +Additionally, if you were to remove the Classpath Exception from any of the
3.545 +files to which it applies and distribute the result, you would likely be
3.546 +required to license some or all of the other code in that distribution under
3.547 +the GPLv2 as well, and since the GPLv2 is incompatible with the license terms
3.548 +of some items included in the distribution by Oracle, removing the Classpath
3.549 +Exception could therefore effectively compromise your ability to further
3.550 +distribute the package.
3.551 +Proceed with caution and we recommend that you obtain the advice of a lawyer
3.552 +skilled in open source matters before removing the Classpath Exception or
3.553 +making modifications to this package which may subsequently be redistributed
3.554 +and/or involve the use of third party software.
3.555 +CLASSPATH EXCEPTION
3.556 +Linking this library statically or dynamically with other modules is making a
3.557 +combined work based on this library. Thus, the terms and conditions of the GNU
3.558 +General Public License version 2 cover the whole combination.
3.559 +As a special exception, the copyright holders of this library give you
3.560 +permission to link this library with independent modules to produce an
3.561 +executable, regardless of the license terms of these independent modules, and
3.562 +to copy and distribute the resulting executable under terms of your choice,
3.563 +provided that you also meet, for each linked independent module, the terms and
3.564 +conditions of the license of that module. An independent module is a module
3.565 +which is not derived from or based on this library. If you modify this library,
3.566 +you may extend this exception to your version of the library, but you are not
3.567 +obligated to do so. If you do not wish to do so, delete this exception
3.568 +statement from your version.
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/c.s.tools.ide.analysis.modernize/manifest.mf Sun Jun 25 18:25:05 2017 +0200
4.3 @@ -0,0 +1,6 @@
4.4 +Manifest-Version: 1.0
4.5 +AutoUpdate-Show-In-Client: true
4.6 +OpenIDE-Module: com.sun.tools.ide.analysis.modernize
4.7 +OpenIDE-Module-Layer: com/sun/tools/ide/analysis/modernize/layer.xml
4.8 +OpenIDE-Module-Localizing-Bundle: com/sun/tools/ide/analysis/modernize/Bundle.properties
4.9 +OpenIDE-Module-Specification-Version: 1.1.2
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/c.s.tools.ide.analysis.modernize/nbproject/project.properties Sun Jun 25 18:25:05 2017 +0200
5.3 @@ -0,0 +1,15 @@
5.4 +javac.source=1.8
5.5 +javac.compilerargs=-Xlint -Xlint:-serial
5.6 +
5.7 +license.file=license.txt
5.8 +nbm.module.author=Ilia Gromov
5.9 +nbm.needs.restart=true
5.10 +test.unit.cp.extra=../../cnd.modelimpl/build/test/unit/classes:\
5.11 +../../cnd/build/test/unit/classes:\
5.12 +../../dlight.nativeexecution/build/test/unit/classes:\
5.13 +../../editor.mimelookup/build/test/unit/classes:\
5.14 +../../cnd.classview/build/test/unit/classes
5.15 +keystore=nbproject/private/keystore
5.16 +nbm_alias=myself
5.17 +
5.18 +test.unit.run.cp.extra=../../editor.mimelookup/build/test/unit/classes
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/c.s.tools.ide.analysis.modernize/nbproject/project.xml Sun Jun 25 18:25:05 2017 +0200
6.3 @@ -0,0 +1,334 @@
6.4 +<?xml version="1.0" encoding="UTF-8"?>
6.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
6.6 + <type>org.netbeans.modules.apisupport.project</type>
6.7 + <configuration>
6.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
6.9 + <code-name-base>com.sun.tools.ide.analysis.modernize</code-name-base>
6.10 + <module-dependencies>
6.11 + <dependency>
6.12 + <code-name-base>org.netbeans.api.progress</code-name-base>
6.13 + <build-prerequisite/>
6.14 + <compile-dependency/>
6.15 + <run-dependency>
6.16 + <release-version>1</release-version>
6.17 + <specification-version>1.46.1</specification-version>
6.18 + </run-dependency>
6.19 + </dependency>
6.20 + <dependency>
6.21 + <code-name-base>org.netbeans.api.progress.nb</code-name-base>
6.22 + <build-prerequisite/>
6.23 + <compile-dependency/>
6.24 + <run-dependency>
6.25 + <specification-version>1.46.1</specification-version>
6.26 + </run-dependency>
6.27 + </dependency>
6.28 + <dependency>
6.29 + <code-name-base>org.netbeans.modules.cnd.analysis.api</code-name-base>
6.30 + <build-prerequisite/>
6.31 + <compile-dependency/>
6.32 + <run-dependency>
6.33 + <specification-version>1.3.1</specification-version>
6.34 + </run-dependency>
6.35 + </dependency>
6.36 + <dependency>
6.37 + <code-name-base>org.netbeans.modules.cnd.api.model</code-name-base>
6.38 + <build-prerequisite/>
6.39 + <compile-dependency/>
6.40 + <run-dependency>
6.41 + <release-version>1</release-version>
6.42 + <specification-version>1.13.1.1</specification-version>
6.43 + </run-dependency>
6.44 + </dependency>
6.45 + <dependency>
6.46 + <code-name-base>org.netbeans.modules.cnd.api.project</code-name-base>
6.47 + <build-prerequisite/>
6.48 + <compile-dependency/>
6.49 + <run-dependency>
6.50 + <release-version>1</release-version>
6.51 + <specification-version>1.31.4</specification-version>
6.52 + </run-dependency>
6.53 + </dependency>
6.54 + <dependency>
6.55 + <code-name-base>org.netbeans.modules.cnd.api.remote</code-name-base>
6.56 + <build-prerequisite/>
6.57 + <compile-dependency/>
6.58 + <run-dependency>
6.59 + <release-version>1</release-version>
6.60 + <specification-version>1.22.2</specification-version>
6.61 + </run-dependency>
6.62 + </dependency>
6.63 + <dependency>
6.64 + <code-name-base>org.netbeans.modules.cnd.kit</code-name-base>
6.65 + <run-dependency>
6.66 + <specification-version>1.30.5.1</specification-version>
6.67 + </run-dependency>
6.68 + </dependency>
6.69 + <dependency>
6.70 + <code-name-base>org.netbeans.modules.cnd.makeproject</code-name-base>
6.71 + <build-prerequisite/>
6.72 + <compile-dependency/>
6.73 + <run-dependency>
6.74 + <release-version>2</release-version>
6.75 + <specification-version>1.15.0.1</specification-version>
6.76 + </run-dependency>
6.77 + </dependency>
6.78 + <dependency>
6.79 + <code-name-base>org.netbeans.modules.cnd.model.services</code-name-base>
6.80 + <build-prerequisite/>
6.81 + <compile-dependency/>
6.82 + <run-dependency>
6.83 + <release-version>1</release-version>
6.84 + <specification-version>1.42.16</specification-version>
6.85 + </run-dependency>
6.86 + </dependency>
6.87 + <dependency>
6.88 + <code-name-base>org.netbeans.modules.cnd.modelutil</code-name-base>
6.89 + <build-prerequisite/>
6.90 + <compile-dependency/>
6.91 + <run-dependency>
6.92 + <release-version>1</release-version>
6.93 + <specification-version>1.14.0.1</specification-version>
6.94 + </run-dependency>
6.95 + </dependency>
6.96 + <dependency>
6.97 + <code-name-base>org.netbeans.modules.cnd.toolchain</code-name-base>
6.98 + <build-prerequisite/>
6.99 + <compile-dependency/>
6.100 + <run-dependency>
6.101 + <specification-version>1.5.0.1</specification-version>
6.102 + </run-dependency>
6.103 + </dependency>
6.104 + <dependency>
6.105 + <code-name-base>org.netbeans.modules.cnd.utils</code-name-base>
6.106 + <build-prerequisite/>
6.107 + <compile-dependency/>
6.108 + <run-dependency>
6.109 + <specification-version>1.17.1</specification-version>
6.110 + </run-dependency>
6.111 + </dependency>
6.112 + <dependency>
6.113 + <code-name-base>org.netbeans.modules.cnd.utils.ui</code-name-base>
6.114 + <build-prerequisite/>
6.115 + <compile-dependency/>
6.116 + <run-dependency>
6.117 + <specification-version>1.0</specification-version>
6.118 + </run-dependency>
6.119 + </dependency>
6.120 + <dependency>
6.121 + <code-name-base>org.netbeans.modules.code.analysis</code-name-base>
6.122 + <build-prerequisite/>
6.123 + <compile-dependency/>
6.124 + <run-dependency>
6.125 + <release-version>0</release-version>
6.126 + <specification-version>1.8</specification-version>
6.127 + </run-dependency>
6.128 + </dependency>
6.129 + <dependency>
6.130 + <code-name-base>org.netbeans.modules.dlight.nativeexecution</code-name-base>
6.131 + <build-prerequisite/>
6.132 + <compile-dependency/>
6.133 + <run-dependency>
6.134 + <specification-version>1.10.3</specification-version>
6.135 + </run-dependency>
6.136 + </dependency>
6.137 + <dependency>
6.138 + <code-name-base>org.netbeans.modules.dlight.remote</code-name-base>
6.139 + <build-prerequisite/>
6.140 + <compile-dependency/>
6.141 + <run-dependency>
6.142 + <specification-version>1.28.7.1</specification-version>
6.143 + </run-dependency>
6.144 + </dependency>
6.145 + <dependency>
6.146 + <code-name-base>org.netbeans.modules.dlight.remote.ui</code-name-base>
6.147 + <build-prerequisite/>
6.148 + <compile-dependency/>
6.149 + <run-dependency>
6.150 + <specification-version>1.1.0</specification-version>
6.151 + </run-dependency>
6.152 + </dependency>
6.153 + <dependency>
6.154 + <code-name-base>org.netbeans.modules.editor.document</code-name-base>
6.155 + <build-prerequisite/>
6.156 + <compile-dependency/>
6.157 + <run-dependency>
6.158 + <specification-version>1.6.0.1</specification-version>
6.159 + </run-dependency>
6.160 + </dependency>
6.161 + <dependency>
6.162 + <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
6.163 + <build-prerequisite/>
6.164 + <compile-dependency/>
6.165 + <run-dependency>
6.166 + <release-version>3</release-version>
6.167 + <specification-version>4.3.1.22.1.44</specification-version>
6.168 + </run-dependency>
6.169 + </dependency>
6.170 + <dependency>
6.171 + <code-name-base>org.netbeans.modules.options.api</code-name-base>
6.172 + <build-prerequisite/>
6.173 + <compile-dependency/>
6.174 + <run-dependency>
6.175 + <release-version>1</release-version>
6.176 + <specification-version>1.22</specification-version>
6.177 + </run-dependency>
6.178 + </dependency>
6.179 + <dependency>
6.180 + <code-name-base>org.netbeans.modules.projectapi</code-name-base>
6.181 + <build-prerequisite/>
6.182 + <compile-dependency/>
6.183 + <run-dependency>
6.184 + <release-version>1</release-version>
6.185 + <specification-version>1.36</specification-version>
6.186 + </run-dependency>
6.187 + </dependency>
6.188 + <dependency>
6.189 + <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
6.190 + <build-prerequisite/>
6.191 + <compile-dependency/>
6.192 + <run-dependency>
6.193 + <specification-version>1.47.1.1</specification-version>
6.194 + </run-dependency>
6.195 + </dependency>
6.196 + <dependency>
6.197 + <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
6.198 + <build-prerequisite/>
6.199 + <compile-dependency/>
6.200 + <run-dependency>
6.201 + <release-version>0-1</release-version>
6.202 + <specification-version>1.18.0.7.9</specification-version>
6.203 + </run-dependency>
6.204 + </dependency>
6.205 + <dependency>
6.206 + <code-name-base>org.openide.awt</code-name-base>
6.207 + <build-prerequisite/>
6.208 + <compile-dependency/>
6.209 + <run-dependency>
6.210 + <specification-version>7.31</specification-version>
6.211 + </run-dependency>
6.212 + </dependency>
6.213 + <dependency>
6.214 + <code-name-base>org.openide.filesystems</code-name-base>
6.215 + <build-prerequisite/>
6.216 + <compile-dependency/>
6.217 + <run-dependency>
6.218 + <specification-version>9.8.1</specification-version>
6.219 + </run-dependency>
6.220 + </dependency>
6.221 + <dependency>
6.222 + <code-name-base>org.openide.filesystems.nb</code-name-base>
6.223 + <build-prerequisite/>
6.224 + <compile-dependency/>
6.225 + <run-dependency>
6.226 + <specification-version>9.7.1</specification-version>
6.227 + </run-dependency>
6.228 + </dependency>
6.229 + <dependency>
6.230 + <code-name-base>org.openide.loaders</code-name-base>
6.231 + <build-prerequisite/>
6.232 + <compile-dependency/>
6.233 + <run-dependency>
6.234 + <specification-version>7.61</specification-version>
6.235 + </run-dependency>
6.236 + </dependency>
6.237 + <dependency>
6.238 + <code-name-base>org.openide.modules</code-name-base>
6.239 + <build-prerequisite/>
6.240 + <compile-dependency/>
6.241 + <run-dependency>
6.242 + <specification-version>7.47.1</specification-version>
6.243 + </run-dependency>
6.244 + </dependency>
6.245 + <dependency>
6.246 + <code-name-base>org.openide.text</code-name-base>
6.247 + <build-prerequisite/>
6.248 + <compile-dependency/>
6.249 + <run-dependency>
6.250 + <specification-version>6.66.1</specification-version>
6.251 + </run-dependency>
6.252 + </dependency>
6.253 + <dependency>
6.254 + <code-name-base>org.openide.util</code-name-base>
6.255 + <build-prerequisite/>
6.256 + <compile-dependency/>
6.257 + <run-dependency>
6.258 + <specification-version>9.3</specification-version>
6.259 + </run-dependency>
6.260 + </dependency>
6.261 + <dependency>
6.262 + <code-name-base>org.openide.util.lookup</code-name-base>
6.263 + <build-prerequisite/>
6.264 + <compile-dependency/>
6.265 + <run-dependency>
6.266 + <specification-version>8.23</specification-version>
6.267 + </run-dependency>
6.268 + </dependency>
6.269 + <dependency>
6.270 + <code-name-base>org.openide.util.ui</code-name-base>
6.271 + <build-prerequisite/>
6.272 + <compile-dependency/>
6.273 + <run-dependency>
6.274 + <specification-version>9.3</specification-version>
6.275 + </run-dependency>
6.276 + </dependency>
6.277 + <dependency>
6.278 + <code-name-base>org.openide.windows</code-name-base>
6.279 + <build-prerequisite/>
6.280 + <compile-dependency/>
6.281 + <run-dependency>
6.282 + <specification-version>6.74.1</specification-version>
6.283 + </run-dependency>
6.284 + </dependency>
6.285 + </module-dependencies>
6.286 + <test-dependencies>
6.287 + <test-type>
6.288 + <name>unit</name>
6.289 + <test-dependency>
6.290 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
6.291 + <compile-dependency/>
6.292 + </test-dependency>
6.293 + <test-dependency>
6.294 + <code-name-base>org.netbeans.modules.cnd.classview</code-name-base>
6.295 + <compile-dependency/>
6.296 + </test-dependency>
6.297 + <test-dependency>
6.298 + <code-name-base>org.netbeans.modules.cnd.kit</code-name-base>
6.299 + <recursive/>
6.300 + <compile-dependency/>
6.301 + <test/>
6.302 + </test-dependency>
6.303 + <test-dependency>
6.304 + <code-name-base>org.netbeans.modules.cnd.makeproject</code-name-base>
6.305 + <recursive/>
6.306 + <compile-dependency/>
6.307 + <test/>
6.308 + </test-dependency>
6.309 + <test-dependency>
6.310 + <code-name-base>org.netbeans.modules.cnd.modelimpl</code-name-base>
6.311 + <recursive/>
6.312 + <compile-dependency/>
6.313 + <test/>
6.314 + </test-dependency>
6.315 + <test-dependency>
6.316 + <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
6.317 + <recursive/>
6.318 + <compile-dependency/>
6.319 + <test/>
6.320 + </test-dependency>
6.321 + <test-dependency>
6.322 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
6.323 + <recursive/>
6.324 + <compile-dependency/>
6.325 + </test-dependency>
6.326 + <test-dependency>
6.327 + <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
6.328 + <recursive/>
6.329 + <compile-dependency/>
6.330 + <test/>
6.331 + </test-dependency>
6.332 + </test-type>
6.333 + </test-dependencies>
6.334 + <public-packages/>
6.335 + </data>
6.336 + </configuration>
6.337 +</project>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/Bundle.properties Sun Jun 25 18:25:05 2017 +0200
7.3 @@ -0,0 +1,8 @@
7.4 +OpenIDE-Module-Display-Category=Analysis tools
7.5 +OpenIDE-Module-Long-Description=\
7.6 + This plugin enables clang-tidy analysis on C/C++ projects and files via Source->Inspect or right in the Editor.\n\
7.7 + Works only with "Clang-tidy wrapper for <OS> <bitness>" plugin.\n\n\
7.8 + Please note that in order to have clang-tidy hints in the Editor you should run Source->Inspect on your whole project.\n\
7.9 + You can view list of checks and enable/disable them in Options->Editor->Hints.
7.10 +OpenIDE-Module-Name=Clang-tidy integration
7.11 +OpenIDE-Module-Short-Description=Clang-tidy analyzer integration
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/AnalyzedFiles.java Sun Jun 25 18:25:05 2017 +0200
8.3 @@ -0,0 +1,114 @@
8.4 +/*
8.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8.6 + *
8.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
8.8 + *
8.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8.10 + * Other names may be trademarks of their respective owners.
8.11 + *
8.12 + * The contents of this file are subject to the terms of either the GNU
8.13 + * General Public License Version 2 only ("GPL") or the Common
8.14 + * Development and Distribution License("CDDL") (collectively, the
8.15 + * "License"). You may not use this file except in compliance with the
8.16 + * License. You can obtain a copy of the License at
8.17 + * http://www.netbeans.org/cddl-gplv2.html
8.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
8.19 + * specific language governing permissions and limitations under the
8.20 + * License. When distributing the software, include this License Header
8.21 + * Notice in each file and include the License file at
8.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
8.23 + * particular file as subject to the "Classpath" exception as provided
8.24 + * by Oracle in the GPL Version 2 section of the License file that
8.25 + * accompanied this code. If applicable, add the following below the
8.26 + * License Header, with the fields enclosed by brackets [] replaced by
8.27 + * your own identifying information:
8.28 + * "Portions Copyrighted [year] [name of copyright owner]"
8.29 + *
8.30 + * If you wish your version of this file to be governed by only the CDDL
8.31 + * or only the GPL Version 2, indicate your decision by adding
8.32 + * "[Contributor] elects to include this software in this distribution
8.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
8.34 + * single choice of license, a recipient has the option to distribute
8.35 + * your version of this file under either the CDDL, the GPL Version 2 or
8.36 + * to extend the choice of license to its licensees as provided above.
8.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
8.38 + * Version 2 license, then the option applies only if the new code is
8.39 + * made subject to such option by the copyright holder.
8.40 + *
8.41 + * Contributor(s): Ilia Gromov
8.42 + */
8.43 +package com.sun.tools.ide.analysis.modernize.impl;
8.44 +
8.45 +import java.util.Collection;
8.46 +import java.util.HashMap;
8.47 +import java.util.HashSet;
8.48 +import java.util.Map;
8.49 +import java.util.Set;
8.50 +import org.netbeans.modules.cnd.api.model.CsmFile;
8.51 +
8.52 +/**
8.53 + * This cache is designed to help Editor showing correct checks for included
8.54 + * files.
8.55 + *
8.56 + * @param <T>
8.57 + */
8.58 +public class AnalyzedFiles {
8.59 +
8.60 + private final Map<CsmFile, Set<CsmFile>> hierarchyCache = new HashMap<CsmFile, Set<CsmFile>>();
8.61 +// private final Map<FileObject, Set<CsmErrorInfo>> diagnosticsCache = new HashMap<FileObject, Set<CsmErrorInfo>>();
8.62 +
8.63 +// public void cacheDiagnostics(FileObject fo, CsmErrorInfo info) {
8.64 +// Set<CsmErrorInfo> alreadyMapped = diagnosticsCache.get(fo);
8.65 +//
8.66 +// if (alreadyMapped == null) {
8.67 +// alreadyMapped = new HashSet<CsmErrorInfo>();
8.68 +// diagnosticsCache.put(fo, alreadyMapped);
8.69 +// }
8.70 +//
8.71 +// alreadyMapped.add(info);
8.72 +// }
8.73 + public void cacheHierarchy(CsmFile startFile, Collection<CsmFile> includedFiles) {
8.74 + Set<CsmFile> alreadyMapped = hierarchyCache.get(startFile);
8.75 +
8.76 + if (alreadyMapped == null) {
8.77 + alreadyMapped = new HashSet<CsmFile>();
8.78 + hierarchyCache.put(startFile, alreadyMapped);
8.79 + }
8.80 +
8.81 + alreadyMapped.addAll(includedFiles);
8.82 + }
8.83 +
8.84 +// public Set<CsmErrorInfo> getDiagnostics(FileObject fo) {
8.85 +// return diagnosticsCache.get(fo);
8.86 +// }
8.87 +
8.88 + public Collection<? extends CsmFile> getStartFiles(CsmFile includedFile) {
8.89 + Set<CsmFile> result = new HashSet<CsmFile>();
8.90 + for (Map.Entry<CsmFile, Set<CsmFile>> entry : hierarchyCache.entrySet()) {
8.91 + CsmFile key = entry.getKey();
8.92 + Set<CsmFile> value = entry.getValue();
8.93 +
8.94 + if (value.contains(includedFile)) {
8.95 + result.add(key);
8.96 + }
8.97 + }
8.98 + return result;
8.99 + }
8.100 +
8.101 + public boolean isStartFile(CsmFile file) {
8.102 + return hierarchyCache.containsKey(file);
8.103 + }
8.104 +
8.105 + public void clear() {
8.106 + hierarchyCache.clear();
8.107 + }
8.108 +
8.109 + public static AnalyzedFiles getDefault() {
8.110 + return HOLDER.INSTANCE;
8.111 + }
8.112 +
8.113 + private static class HOLDER {
8.114 +
8.115 + public static final AnalyzedFiles INSTANCE = new AnalyzedFiles();
8.116 + }
8.117 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/AnalyzerResponseMerger.java Sun Jun 25 18:25:05 2017 +0200
9.3 @@ -0,0 +1,105 @@
9.4 +/*
9.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.6 + *
9.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
9.8 + *
9.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
9.10 + * Other names may be trademarks of their respective owners.
9.11 + *
9.12 + * The contents of this file are subject to the terms of either the GNU
9.13 + * General Public License Version 2 only ("GPL") or the Common
9.14 + * Development and Distribution License("CDDL") (collectively, the
9.15 + * "License"). You may not use this file except in compliance with the
9.16 + * License. You can obtain a copy of the License at
9.17 + * http://www.netbeans.org/cddl-gplv2.html
9.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.19 + * specific language governing permissions and limitations under the
9.20 + * License. When distributing the software, include this License Header
9.21 + * Notice in each file and include the License file at
9.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
9.23 + * particular file as subject to the "Classpath" exception as provided
9.24 + * by Oracle in the GPL Version 2 section of the License file that
9.25 + * accompanied this code. If applicable, add the following below the
9.26 + * License Header, with the fields enclosed by brackets [] replaced by
9.27 + * your own identifying information:
9.28 + * "Portions Copyrighted [year] [name of copyright owner]"
9.29 + *
9.30 + * If you wish your version of this file to be governed by only the CDDL
9.31 + * or only the GPL Version 2, indicate your decision by adding
9.32 + * "[Contributor] elects to include this software in this distribution
9.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
9.34 + * single choice of license, a recipient has the option to distribute
9.35 + * your version of this file under either the CDDL, the GPL Version 2 or
9.36 + * to extend the choice of license to its licensees as provided above.
9.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
9.38 + * Version 2 license, then the option applies only if the new code is
9.39 + * made subject to such option by the copyright holder.
9.40 + *
9.41 + * Contributor(s):
9.42 + */
9.43 +package com.sun.tools.ide.analysis.modernize.impl;
9.44 +
9.45 +import com.sun.tools.ide.analysis.modernize.impl.ModernizeAnalyzerImpl.ModernizeResponse;
9.46 +import java.util.ArrayList;
9.47 +import java.util.HashMap;
9.48 +import java.util.List;
9.49 +import java.util.Map;
9.50 +import java.util.Optional;
9.51 +import java.util.stream.Collectors;
9.52 +import org.netbeans.modules.cnd.analysis.api.AnalyzerResponse;
9.53 +import org.netbeans.spi.editor.hints.ErrorDescription;
9.54 +import org.openide.filesystems.FileObject;
9.55 +
9.56 +/**
9.57 + *
9.58 + * @author Ilia Gromov
9.59 + */
9.60 +public class AnalyzerResponseMerger {
9.61 +
9.62 + private static class ErrorDesc {
9.63 +
9.64 + final ModernizeErrorInfo info;
9.65 + final FileObject fo;
9.66 +
9.67 + public ErrorDesc(ModernizeErrorInfo info, FileObject fo) {
9.68 + this.info = info;
9.69 + this.fo = fo;
9.70 + }
9.71 +
9.72 + public boolean isSame(ErrorDesc o2) {
9.73 + return isSame(this.info, o2.info) && this.fo.equals(o2.fo);
9.74 + }
9.75 +
9.76 + public boolean isSame(ModernizeErrorInfo o1, ModernizeErrorInfo o2) {
9.77 + return o1.getStartOffset() == o2.getStartOffset()
9.78 + && o1.getEndOffset() == o2.getEndOffset()
9.79 + && o1.getDiagnostics().getCheckName().equals(o2.getDiagnostics().getCheckName());
9.80 + }
9.81 + }
9.82 +
9.83 + private final List<ErrorDesc> errors = new ArrayList<>();
9.84 + private final ModernizeResponse delegate;
9.85 +
9.86 + public AnalyzerResponseMerger(ModernizeResponse delegate) {
9.87 + this.delegate = delegate;
9.88 + }
9.89 +
9.90 + public void addError(ModernizeErrorInfo info, FileObject fo) {
9.91 + ErrorDesc errorDesc = new ErrorDesc(info, fo);
9.92 + Optional<ErrorDesc> found = errors.stream()
9.93 + .filter(o1 -> o1.isSame(errorDesc))
9.94 + .findAny();
9.95 +
9.96 + if (found.isPresent()) {
9.97 + found.get().info.addMessageInfixes(errorDesc.info.getMessageInfixes());
9.98 + } else {
9.99 + errors.add(errorDesc);
9.100 + }
9.101 + }
9.102 +
9.103 + public List<ErrorDescription> done() {
9.104 + return errors.stream()
9.105 + .map(error -> delegate.addErrorImpl(error.info, error.fo))
9.106 + .collect(Collectors.toList());
9.107 + }
9.108 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/Bundle.properties Sun Jun 25 18:25:05 2017 +0200
10.3 @@ -0,0 +1,59 @@
10.4 +#
10.5 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10.6 +#
10.7 +# Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
10.8 +#
10.9 +# The contents of this file are subject to the terms of either the GNU
10.10 +# General Public License Version 2 only ("GPL") or the Common
10.11 +# Development and Distribution License("CDDL") (collectively, the
10.12 +# "License"). You may not use this file except in compliance with the
10.13 +# License. You can obtain a copy of the License at
10.14 +# http://www.netbeans.org/cddl-gplv2.html
10.15 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
10.16 +# specific language governing permissions and limitations under the
10.17 +# License. When distributing the software, include this License Header
10.18 +# Notice in each file and include the License file at
10.19 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
10.20 +# particular file as subject to the "Classpath" exception as provided
10.21 +# by Sun in the GPL Version 2 section of the License file that
10.22 +# accompanied this code. If applicable, add the following below the
10.23 +# License Header, with the fields enclosed by brackets [] replaced by
10.24 +# your own identifying information:
10.25 +# "Portions Copyrighted [year] [name of copyright owner]"
10.26 +#
10.27 +# Contributor(s):
10.28 +#
10.29 +# The Original Software is NetBeans. The Initial Developer of the Original
10.30 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
10.31 +# Microsystems, Inc. All Rights Reserved.
10.32 +#
10.33 +# If you wish your version of this file to be governed by only the CDDL
10.34 +# or only the GPL Version 2, indicate your decision by adding
10.35 +# "[Contributor] elects to include this software in this distribution
10.36 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
10.37 +# single choice of license, a recipient has the option to distribute
10.38 +# your version of this file under either the CDDL, the GPL Version 2 or
10.39 +# to extend the choice of license to its licensees as provided above.
10.40 +# However, if you add GPL Version 2 code and therefore, elected the GPL
10.41 +# Version 2 license, then the option applies only if the new code is
10.42 +# made subject to such option by the copyright holder.
10.43 +#
10.44 +
10.45 +LBL_ProviderName=C/C++ Errors
10.46 +LBL_ProviderDescription=C/C++ errors and warnings
10.47 +
10.48 +#Previse errors
10.49 +Modernize_NAME=Clang-Tidy analyzer
10.50 +Modernize_DESCRIPTION=Show warnings identified by clang-tidy.\
10.51 + <br>clang-tidy is a clang-based C++ \u201clinter\u201d tool. Its purpose is to provide an extensible framework for diagnosing and fixing typical programming errors, like style violations, interface misuse, or bugs that can be deduced via static analysis. \
10.52 + <br>Expand the node to specify which static checks you want to be displayed.
10.53 +DisableHint=Configure clang-tidy analyzer - {0}
10.54 +
10.55 +#internal error
10.56 +tool.error=Oracle Developer Studio compilers not found
10.57 +remote.mode.error=Unsupported remote mode
10.58 +remote.mode.error.info=Mode {0}
10.59 +temporary.file.error=Cannot create temporary file
10.60 +compile.file.error=Clang-tidy was unable to analyze file
10.61 +fatal.analyze.error=Clang-tidy was unable to analyze file
10.62 +compile.file.error.info=Exit code: {0}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/ConfigureHintsFix.java Sun Jun 25 18:25:05 2017 +0200
11.3 @@ -0,0 +1,80 @@
11.4 +/*
11.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
11.6 + *
11.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
11.8 + *
11.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
11.10 + * Other names may be trademarks of their respective owners.
11.11 + *
11.12 + * The contents of this file are subject to the terms of either the GNU
11.13 + * General Public License Version 2 only ("GPL") or the Common
11.14 + * Development and Distribution License("CDDL") (collectively, the
11.15 + * "License"). You may not use this file except in compliance with the
11.16 + * License. You can obtain a copy of the License at
11.17 + * http://www.netbeans.org/cddl-gplv2.html
11.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
11.19 + * specific language governing permissions and limitations under the
11.20 + * License. When distributing the software, include this License Header
11.21 + * Notice in each file and include the License file at
11.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
11.23 + * particular file as subject to the "Classpath" exception as provided
11.24 + * by Oracle in the GPL Version 2 section of the License file that
11.25 + * accompanied this code. If applicable, add the following below the
11.26 + * License Header, with the fields enclosed by brackets [] replaced by
11.27 + * your own identifying information:
11.28 + * "Portions Copyrighted [year] [name of copyright owner]"
11.29 + *
11.30 + * If you wish your version of this file to be governed by only the CDDL
11.31 + * or only the GPL Version 2, indicate your decision by adding
11.32 + * "[Contributor] elects to include this software in this distribution
11.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
11.34 + * single choice of license, a recipient has the option to distribute
11.35 + * your version of this file under either the CDDL, the GPL Version 2 or
11.36 + * to extend the choice of license to its licensees as provided above.
11.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
11.38 + * Version 2 license, then the option applies only if the new code is
11.39 + * made subject to such option by the copyright holder.
11.40 + *
11.41 + * Contributor(s): Ilia Gromov
11.42 + */
11.43 +package com.sun.tools.ide.analysis.modernize.impl;
11.44 +
11.45 +import org.netbeans.api.options.OptionsDisplayer;
11.46 +import org.netbeans.spi.editor.hints.ChangeInfo;
11.47 +import org.netbeans.spi.editor.hints.EnhancedFix;
11.48 +import org.openide.util.NbBundle;
11.49 +
11.50 +class ConfigureHintsFix implements EnhancedFix {
11.51 +
11.52 + private final ModernizeErrorInfo error;
11.53 + private final String text;
11.54 +
11.55 + ConfigureHintsFix(ModernizeErrorInfo error) {
11.56 + this.error = error;
11.57 + String id = error.getId();
11.58 + this.text = (id.startsWith("-")) ? id.substring(1) : id; //NOI18N
11.59 + }
11.60 +
11.61 + @Override
11.62 + public String getText() {
11.63 + return NbBundle.getMessage(ModernizeErrorProvider.class, "DisableHint", text); // NOI18N
11.64 + }
11.65 +
11.66 + @Override
11.67 + public ChangeInfo implement() throws Exception {
11.68 + String provider = ModernizeErrorProvider.NAME;
11.69 + String name = error.getId();
11.70 + OptionsDisplayer.getDefault().open("Editor/Hints/text/x-cnd+sourcefile/" + provider + "/" + name); // NOI18N
11.71 + return null;
11.72 + }
11.73 +
11.74 + @Override
11.75 + public CharSequence getSortText() {
11.76 + //Hint opening options dialog should always be the lastest in offered list
11.77 + return Integer.toString(Integer.MAX_VALUE);
11.78 + }
11.79 +
11.80 + public ModernizeErrorInfo getError() {
11.81 + return error;
11.82 + }
11.83 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/CsmResponseMerger.java Sun Jun 25 18:25:05 2017 +0200
12.3 @@ -0,0 +1,87 @@
12.4 +/*
12.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
12.6 + *
12.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
12.8 + *
12.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
12.10 + * Other names may be trademarks of their respective owners.
12.11 + *
12.12 + * The contents of this file are subject to the terms of either the GNU
12.13 + * General Public License Version 2 only ("GPL") or the Common
12.14 + * Development and Distribution License("CDDL") (collectively, the
12.15 + * "License"). You may not use this file except in compliance with the
12.16 + * License. You can obtain a copy of the License at
12.17 + * http://www.netbeans.org/cddl-gplv2.html
12.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12.19 + * specific language governing permissions and limitations under the
12.20 + * License. When distributing the software, include this License Header
12.21 + * Notice in each file and include the License file at
12.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
12.23 + * particular file as subject to the "Classpath" exception as provided
12.24 + * by Oracle in the GPL Version 2 section of the License file that
12.25 + * accompanied this code. If applicable, add the following below the
12.26 + * License Header, with the fields enclosed by brackets [] replaced by
12.27 + * your own identifying information:
12.28 + * "Portions Copyrighted [year] [name of copyright owner]"
12.29 + *
12.30 + * If you wish your version of this file to be governed by only the CDDL
12.31 + * or only the GPL Version 2, indicate your decision by adding
12.32 + * "[Contributor] elects to include this software in this distribution
12.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
12.34 + * single choice of license, a recipient has the option to distribute
12.35 + * your version of this file under either the CDDL, the GPL Version 2 or
12.36 + * to extend the choice of license to its licensees as provided above.
12.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
12.38 + * Version 2 license, then the option applies only if the new code is
12.39 + * made subject to such option by the copyright holder.
12.40 + *
12.41 + * Contributor(s): Ilia Gromov
12.42 + */
12.43 +package com.sun.tools.ide.analysis.modernize.impl;
12.44 +
12.45 +import java.util.ArrayList;
12.46 +import java.util.List;
12.47 +import java.util.Optional;
12.48 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
12.49 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
12.50 +
12.51 +/**
12.52 + *
12.53 + * @author Ilia Gromov
12.54 + */
12.55 +public class CsmResponseMerger implements CsmErrorProvider.Response {
12.56 +
12.57 + private final List<ModernizeErrorInfo> bag = new ArrayList<>();
12.58 + private final CsmErrorProvider.Response delegate;
12.59 +
12.60 + public CsmResponseMerger(CsmErrorProvider.Response delegate) {
12.61 + this.delegate = delegate;
12.62 + }
12.63 +
12.64 + @Override
12.65 + public void addError(CsmErrorInfo errorInfo) {
12.66 + ModernizeErrorInfo o2 = (ModernizeErrorInfo) errorInfo;
12.67 + Optional<ModernizeErrorInfo> found = bag.stream()
12.68 + .filter(o1 -> isSame(o1, o2))
12.69 + .findAny();
12.70 +
12.71 + if (found.isPresent()) {
12.72 + found.get().addMessageInfixes(o2.getMessageInfixes());
12.73 + } else {
12.74 + bag.add(o2);
12.75 + }
12.76 + }
12.77 +
12.78 + @Override
12.79 + public void done() {
12.80 + bag.forEach(delegate::addError);
12.81 + delegate.done();
12.82 + bag.clear();
12.83 + }
12.84 +
12.85 + public boolean isSame(ModernizeErrorInfo o1, ModernizeErrorInfo o2) {
12.86 + return o1.getStartOffset() == o2.getStartOffset()
12.87 + && o1.getEndOffset() == o2.getEndOffset()
12.88 + && o1.getDiagnostics().getCheckName().equals(o2.getDiagnostics().getCheckName());
12.89 + }
12.90 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/DiagnosticsTool.java Sun Jun 25 18:25:05 2017 +0200
13.3 @@ -0,0 +1,307 @@
13.4 +/*
13.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
13.6 + *
13.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
13.8 + *
13.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
13.10 + * Other names may be trademarks of their respective owners.
13.11 + *
13.12 + * The contents of this file are subject to the terms of either the GNU
13.13 + * General Public License Version 2 only ("GPL") or the Common
13.14 + * Development and Distribution License("CDDL") (collectively, the
13.15 + * "License"). You may not use this file except in compliance with the
13.16 + * License. You can obtain a copy of the License at
13.17 + * http://www.netbeans.org/cddl-gplv2.html
13.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13.19 + * specific language governing permissions and limitations under the
13.20 + * License. When distributing the software, include this License Header
13.21 + * Notice in each file and include the License file at
13.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
13.23 + * particular file as subject to the "Classpath" exception as provided
13.24 + * by Oracle in the GPL Version 2 section of the License file that
13.25 + * accompanied this code. If applicable, add the following below the
13.26 + * License Header, with the fields enclosed by brackets [] replaced by
13.27 + * your own identifying information:
13.28 + * "Portions Copyrighted [year] [name of copyright owner]"
13.29 + *
13.30 + * If you wish your version of this file to be governed by only the CDDL
13.31 + * or only the GPL Version 2, indicate your decision by adding
13.32 + * "[Contributor] elects to include this software in this distribution
13.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
13.34 + * single choice of license, a recipient has the option to distribute
13.35 + * your version of this file under either the CDDL, the GPL Version 2 or
13.36 + * to extend the choice of license to its licensees as provided above.
13.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
13.38 + * Version 2 license, then the option applies only if the new code is
13.39 + * made subject to such option by the copyright holder.
13.40 + *
13.41 + * Contributor(s): Ilia Gromov
13.42 + */
13.43 +package com.sun.tools.ide.analysis.modernize.impl;
13.44 +
13.45 +import com.sun.tools.ide.analysis.modernize.utils.AnalyticsTools;
13.46 +import java.io.BufferedReader;
13.47 +import java.io.File;
13.48 +import java.io.FileReader;
13.49 +import java.io.IOException;
13.50 +import java.nio.file.Files;
13.51 +import java.nio.file.Path;
13.52 +import java.util.ArrayList;
13.53 +import java.util.Collection;
13.54 +import java.util.Collections;
13.55 +import java.util.List;
13.56 +import java.util.logging.Level;
13.57 +import java.util.logging.Logger;
13.58 +import org.netbeans.modules.cnd.api.model.CsmFile;
13.59 +import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
13.60 +import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAudit;
13.61 +import org.netbeans.modules.cnd.api.toolchain.AbstractCompiler;
13.62 +import static org.netbeans.modules.cnd.api.toolchain.PredefinedToolKind.CCCompiler;
13.63 +import static org.netbeans.modules.cnd.api.toolchain.PredefinedToolKind.CCompiler;
13.64 +import org.netbeans.modules.cnd.api.toolchain.Tool;
13.65 +import org.netbeans.modules.cnd.makeproject.api.MakeProject;
13.66 +import org.netbeans.modules.cnd.makeproject.api.configurations.CCCCompilerConfiguration;
13.67 +import org.netbeans.modules.cnd.makeproject.api.configurations.CCCompilerConfiguration;
13.68 +import org.netbeans.modules.cnd.makeproject.api.configurations.CCompilerConfiguration;
13.69 +import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
13.70 +import org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration;
13.71 +import org.netbeans.modules.cnd.makeproject.api.support.MakeProjectOptionsFormat;
13.72 +import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
13.73 +import org.netbeans.modules.nativeexecution.api.HostInfo;
13.74 +import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
13.75 +import org.netbeans.modules.nativeexecution.api.util.HostInfoUtils;
13.76 +import org.netbeans.modules.nativeexecution.api.util.ProcessUtils;
13.77 +import org.openide.filesystems.FileObject;
13.78 +import org.openide.filesystems.FileUtil;
13.79 +
13.80 +/**
13.81 + *
13.82 + * @author Ilia Gromov
13.83 + */
13.84 +public class DiagnosticsTool {
13.85 +
13.86 + public static final Logger LOG = Logger.getLogger("ide.analysis.tidy"); //NOI18N
13.87 + public static final String CACHE_ID = "TIDY-CACHE"; //NOI18N
13.88 +
13.89 + public static final int STATUS_OK = 0;
13.90 + public static final int STATUS_IO_ERROR = -1;
13.91 +
13.92 + public static List<CodeAudit> getAudits(String path, ExecutionEnvironment env, AuditPreferences preferences) {
13.93 + List<CodeAudit> res = new ArrayList<>();
13.94 +
13.95 + ProcessUtils.ExitStatus status = ProcessUtils.execute(env, path, new String[]{"-checks=*", "-list-checks", "dummy", "--"}); // NOI18N
13.96 +
13.97 + if (status.exitCode == 0) {
13.98 + String out = status.getOutputString();
13.99 + out = out.substring(status.getOutputString().indexOf('\n') + 1);
13.100 + String[] checks = out.split("\n"); // NOI18N
13.101 +
13.102 + FileObject disabledChecksFolder = FileUtil.getConfigFile("Analysis/Clang-Tidy/Disabled_Default"); // NOI18N
13.103 +
13.104 + List<String> disabledChecks = new ArrayList<>();
13.105 + for (FileObject fileObject : disabledChecksFolder.getChildren()) {
13.106 + disabledChecks.add(fileObject.getName());
13.107 + }
13.108 +
13.109 + for (String check : checks) {
13.110 + check = check.trim();
13.111 + ModernizeCodeAudit myCodeAudit = new ModernizeCodeAudit(
13.112 + check,
13.113 + check,
13.114 + check,
13.115 + "warning", //NOI18N
13.116 + !disabledChecks.contains(check),
13.117 + preferences);
13.118 + res.add(myCodeAudit);
13.119 + }
13.120 + }
13.121 +
13.122 + return res;
13.123 + }
13.124 +
13.125 + private final ExecutionEnvironment execEnv;
13.126 + private final Item item;
13.127 + private final MakeProject project;
13.128 + private final String binaryPath;
13.129 +
13.130 + private StringBuilder buf;
13.131 +
13.132 + public DiagnosticsTool(ExecutionEnvironment execEnv, Item item, MakeProject project, String binaryPath) {
13.133 + this.execEnv = execEnv;
13.134 + this.item = item;
13.135 + this.project = project;
13.136 + this.binaryPath = binaryPath;
13.137 + }
13.138 +
13.139 + /**
13.140 + * @return clang-tidy's exit code or negative code if some other problem has
13.141 + * occurred.
13.142 + */
13.143 + public int process(Collection<String> checks, CsmFile csmFile, boolean isStartFile) throws ConnectionManager.CancellationException, IOException {
13.144 + // TODO: can we split analyzer (Source -> Inspect) ant editor error providing?
13.145 +
13.146 + final String directoryMacro = "xDIRx"; //NOI18N
13.147 +
13.148 + File tmpDir = null;
13.149 + try {
13.150 + List<String> args = new ArrayList<String>();
13.151 +
13.152 + HostInfo hostInfo = HostInfoUtils.getHostInfo(execEnv);
13.153 +
13.154 + try {
13.155 + if (execEnv.isRemote()) {
13.156 + tmpDir = Files.createTempDirectory(hostInfo.getTempDirFile().toPath(), "tidy").toFile(); //NOI18N
13.157 + } else {
13.158 + tmpDir = Files.createTempDirectory("tidy").toFile(); //NOI18N
13.159 + }
13.160 + } catch (IOException ex) {
13.161 + return -1;
13.162 + }
13.163 +
13.164 + Path tmpFile = Files.createTempFile(tmpDir.toPath(), null, null);
13.165 +
13.166 + args.add("-header-filter=.*"); //NOI18N
13.167 + StringBuilder sb = new StringBuilder("-checks=");// NOI18N
13.168 + for (String check : checks) {
13.169 + sb.append(check);
13.170 + sb.append(","); // NOI18N
13.171 + }
13.172 + args.add(sb.toString().substring(0, sb.length() - 1));
13.173 +
13.174 + args.add("-export-fixes=" + tmpFile); // NOI18N
13.175 + int directoryIdx = args.size() - 1;
13.176 +
13.177 + Collection<? extends CsmFile> startFiles = Collections.EMPTY_LIST;
13.178 + args.add(csmFile.getFileObject().getPath());
13.179 +
13.180 + args.add("--"); //NOI18N
13.181 + args.addAll(getAdditionalFlags(csmFile));
13.182 +
13.183 + List<String> copy = new ArrayList<String>(args);
13.184 +
13.185 + copy.set(directoryIdx, copy.get(directoryIdx).replace(directoryMacro, tmpDir.getAbsolutePath()));
13.186 +
13.187 + // TODO: execute in the ${WORKING_DIR} ? Because we can have relative path includes (-Isrc/libs/abcd)
13.188 + ProcessUtils.ExitStatus executeStatus = ProcessUtils.executeInDir(tmpDir.getAbsolutePath(),
13.189 + execEnv,
13.190 + binaryPath,
13.191 + copy.toArray(new String[copy.size()]));
13.192 +
13.193 + if (executeStatus.exitCode != STATUS_OK) {
13.194 + LOG.log(Level.INFO, "clang-tidy exit code {0}: {1}", new Object[]{executeStatus.exitCode, arrayAsString(binaryPath, copy)});
13.195 + LOG.fine(executeStatus.getOutputString());
13.196 + LOG.fine(executeStatus.getErrorString());
13.197 + return executeStatus.exitCode;
13.198 + } else {
13.199 + LOG.log(Level.FINEST, "{0}", arrayAsString(binaryPath, copy));
13.200 + LOG.finest(executeStatus.getOutputString());
13.201 + LOG.finest(executeStatus.getErrorString());
13.202 + }
13.203 +
13.204 + File[] listFiles = tmpDir.listFiles();
13.205 +
13.206 + if (listFiles.length != 1) {
13.207 + return STATUS_IO_ERROR;
13.208 + }
13.209 +
13.210 + File yamlFile = listFiles[0];
13.211 +
13.212 + BufferedReader in = new BufferedReader(new FileReader(yamlFile));
13.213 + buf = new StringBuilder();
13.214 + while (true) {
13.215 + String s = in.readLine();
13.216 + if (s == null) {
13.217 + break;
13.218 + }
13.219 + buf.append(s).append('\n'); //NOI18N
13.220 + }
13.221 +
13.222 + } finally {
13.223 + try {
13.224 + tmpDir.delete();
13.225 + } catch (Exception x) {
13.226 +
13.227 + }
13.228 + }
13.229 +
13.230 + return STATUS_OK;
13.231 + }
13.232 +
13.233 + private List<String> getAdditionalFlags(CsmFile csmFile) {
13.234 + List<String> all = new ArrayList<String>();
13.235 +
13.236 + Tool tool = AnalyticsTools.compiler(item, project);
13.237 +
13.238 + if (tool instanceof AbstractCompiler) {
13.239 + AbstractCompiler compiler = (AbstractCompiler) tool;
13.240 +
13.241 + for (String systemIncludeDirectory : compiler.getSystemIncludeDirectories()) {
13.242 + all.add("-I" + systemIncludeDirectory); //NOI18N
13.243 + }
13.244 +
13.245 + MakeConfiguration activeConfiguration = AnalyticsTools.getConfigurationDescriptor(csmFile, project).getActiveConfiguration();
13.246 +
13.247 + String options = "";
13.248 +// // compileSingleUnmanage as reference
13.249 +// // don't use getAllOptions - we need not -w flag
13.250 + if (tool.getKind() == CCCompiler) {
13.251 + CCCompilerConfiguration ccc = activeConfiguration.getCCCompilerConfiguration();
13.252 + options += ccc.getPreprocessorOptions(compiler.getCompilerSet());
13.253 + options += ccc.getIncludeDirectoriesOptions(compiler.getCompilerSet());
13.254 +// options += getLibrariesFlags();
13.255 + options += compiler.getCppStandardOptions(ccc.getInheritedCppStandard());
13.256 + if (!options.contains("-std=")) { //NOI18N
13.257 + switch (item.getLanguageFlavor()) {
13.258 + case CPP98:
13.259 + options += " -std=c++98"; //NOI18N
13.260 + break;
13.261 + case CPP11:
13.262 + options += " -std=c++11"; //NOI18N
13.263 + break;
13.264 + case CPP14:
13.265 + options += " -std=c++14"; //NOI18N
13.266 + break;
13.267 + }
13.268 + }
13.269 + } else if (tool.getKind() == CCompiler) {
13.270 + CCompilerConfiguration cc = activeConfiguration.getCCompilerConfiguration();
13.271 + options += cc.getPreprocessorOptions(compiler.getCompilerSet());
13.272 + options += cc.getIncludeDirectoriesOptions(compiler.getCompilerSet());
13.273 + options += compiler.getCStandardOptions(cc.getInheritedCStandard());
13.274 + if (!options.contains("-std=")) { //NOI18N
13.275 + switch (item.getLanguageFlavor()) {
13.276 + case C11:
13.277 + options += " -std=c11"; //NOI18N
13.278 + break;
13.279 + case C89:
13.280 + options += " -std=c89"; //NOI18N
13.281 + break;
13.282 + case C99:
13.283 + options += " -std=c99"; //NOI18N
13.284 + break;
13.285 + }
13.286 + }
13.287 + }
13.288 +
13.289 + List<String> optionsList = AnalyticsTools.scanCommandLine(MakeProjectOptionsFormat.reformatWhitespaces(options));
13.290 + all.addAll(optionsList);
13.291 + }
13.292 +
13.293 + return all;
13.294 + }
13.295 +
13.296 + public String getYamlAsString() {
13.297 + if (buf == null) {
13.298 + throw new IllegalStateException();
13.299 + }
13.300 + return buf.toString();
13.301 + }
13.302 +
13.303 + private static String arrayAsString(String binary, List<String> list) {
13.304 + StringBuilder sb = new StringBuilder(binary).append(" "); //NOI18N
13.305 + for (String string : list) {
13.306 + sb.append(string).append(" "); //NOI18N
13.307 + }
13.308 + return sb.toString();
13.309 + }
13.310 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/ModernizeAnalyzerImpl.java Sun Jun 25 18:25:05 2017 +0200
14.3 @@ -0,0 +1,227 @@
14.4 +/*
14.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
14.6 + *
14.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
14.8 + *
14.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
14.10 + * Other names may be trademarks of their respective owners.
14.11 + *
14.12 + * The contents of this file are subject to the terms of either the GNU
14.13 + * General Public License Version 2 only ("GPL") or the Common
14.14 + * Development and Distribution License("CDDL") (collectively, the
14.15 + * "License"). You may not use this file except in compliance with the
14.16 + * License. You can obtain a copy of the License at
14.17 + * http://www.netbeans.org/cddl-gplv2.html
14.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14.19 + * specific language governing permissions and limitations under the
14.20 + * License. When distributing the software, include this License Header
14.21 + * Notice in each file and include the License file at
14.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
14.23 + * particular file as subject to the "Classpath" exception as provided
14.24 + * by Oracle in the GPL Version 2 section of the License file that
14.25 + * accompanied this code. If applicable, add the following below the
14.26 + * License Header, with the fields enclosed by brackets [] replaced by
14.27 + * your own identifying information:
14.28 + * "Portions Copyrighted [year] [name of copyright owner]"
14.29 + *
14.30 + * If you wish your version of this file to be governed by only the CDDL
14.31 + * or only the GPL Version 2, indicate your decision by adding
14.32 + * "[Contributor] elects to include this software in this distribution
14.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
14.34 + * single choice of license, a recipient has the option to distribute
14.35 + * your version of this file under either the CDDL, the GPL Version 2 or
14.36 + * to extend the choice of license to its licensees as provided above.
14.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
14.38 + * Version 2 license, then the option applies only if the new code is
14.39 + * made subject to such option by the copyright holder.
14.40 + *
14.41 + * Contributor(s): Ilia Gromov
14.42 + */
14.43 +package com.sun.tools.ide.analysis.modernize.impl;
14.44 +
14.45 +import com.sun.tools.ide.analysis.modernize.options.ClangAnalyzerOptions;
14.46 +import com.sun.tools.ide.analysis.modernize.resources.BundleUtilities;
14.47 +import java.io.CharConversionException;
14.48 +import java.io.File;
14.49 +import java.util.ArrayList;
14.50 +import java.util.Arrays;
14.51 +import java.util.Collection;
14.52 +import java.util.Collections;
14.53 +import java.util.List;
14.54 +import java.util.concurrent.atomic.AtomicBoolean;
14.55 +import java.util.prefs.Preferences;
14.56 +import org.netbeans.modules.analysis.spi.Analyzer;
14.57 +import org.netbeans.modules.cnd.analysis.api.AbstractAnalyzer;
14.58 +import org.netbeans.modules.cnd.analysis.api.AbstractHintsPanel;
14.59 +import org.netbeans.modules.cnd.api.model.CsmFile;
14.60 +import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAudit;
14.61 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
14.62 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
14.63 +import org.netbeans.modules.cnd.modelutil.CsmUtilities;
14.64 +import org.netbeans.modules.cnd.utils.CndPathUtilities;
14.65 +import org.netbeans.spi.editor.hints.ErrorDescription;
14.66 +import org.netbeans.spi.editor.hints.ErrorDescriptionFactory;
14.67 +import org.netbeans.spi.editor.hints.LazyFixList;
14.68 +import org.netbeans.spi.editor.hints.Severity;
14.69 +import org.openide.filesystems.FileObject;
14.70 +import org.openide.util.ImageUtilities;
14.71 +import org.openide.util.NbBundle;
14.72 +import org.openide.util.lookup.ServiceProvider;
14.73 +import org.openide.xml.XMLUtil;
14.74 +
14.75 +public class ModernizeAnalyzerImpl extends AbstractAnalyzer {
14.76 +
14.77 + private static final String PREFIX = "tidy-"; //NOI18N
14.78 +
14.79 + private ModernizeErrorProvider currentErrorProvider;
14.80 +
14.81 + private ModernizeAnalyzerImpl(Context ctx) {
14.82 + super(ctx);
14.83 + }
14.84 +
14.85 + @Override
14.86 + public ModernizeErrorProvider getErrorProvider(Preferences preferences) {
14.87 + return ModernizeErrorProvider.getInstance();
14.88 + }
14.89 +
14.90 + @Override
14.91 + protected boolean isCompileUnitBased() {
14.92 + return true;
14.93 + }
14.94 +
14.95 + @Override
14.96 + protected Collection<ErrorDescription> done() {
14.97 + if (currentErrorProvider != null) {
14.98 + Collection<ErrorDescription> results = currentErrorProvider.done();
14.99 + currentErrorProvider = null;
14.100 + return results;
14.101 + }
14.102 + return Collections.<ErrorDescription>emptyList();
14.103 + }
14.104 +
14.105 + @Override
14.106 + protected Collection<? extends ErrorDescription> doRunImpl(final FileObject sr, final Context ctx, final CsmErrorProvider provider, final AtomicBoolean cancel) {
14.107 + final CsmFile csmFile = CsmUtilities.getCsmFile(sr, false, false);
14.108 + if (csmFile == null) {
14.109 + return Collections.<ErrorDescription>emptyList();
14.110 + }
14.111 + CsmErrorProvider.Request request = new RequestImpl(csmFile, ctx, cancel);
14.112 + final ArrayList<ErrorDescription> res = new ArrayList<>();
14.113 + CsmErrorProvider.Response response = new ModernizeResponse(sr, res, cancel);
14.114 + this.currentErrorProvider = (ModernizeErrorProvider) provider;
14.115 + provider.getErrors(request, response);
14.116 + return res;
14.117 + }
14.118 +
14.119 + protected static class ModernizeResponse extends AbstractResponse {
14.120 +
14.121 + public ModernizeResponse(FileObject sr, ArrayList<ErrorDescription> res, AtomicBoolean cancel) {
14.122 + super(sr, res, cancel);
14.123 + }
14.124 +
14.125 + @Override
14.126 + public ErrorDescription addErrorImpl(CsmErrorInfo errorInfo, FileObject fo) {
14.127 + String messages[] = errorInfo.getMessage().split("\n"); //NOI18N
14.128 + if (messages.length > 0) {
14.129 + StringBuilder sb = new StringBuilder();
14.130 + if (errorInfo instanceof ModernizeErrorInfo) {
14.131 + ModernizeErrorInfo mei = (ModernizeErrorInfo) errorInfo;
14.132 + sb.append("<pre>"); //NOI18N
14.133 + sb.append("["); //NOI18N
14.134 + sb.append(mei.getId());
14.135 + sb.append("]"); //NOI18N
14.136 + sb.append("\n"); //NOI18N
14.137 + List<YamlParser.Replacement> replacements = mei.getDiagnostics().getReplacements();
14.138 + if (replacements.isEmpty()) {
14.139 + sb.append(CndPathUtilities.getRelativePath(mei.getProject().getProjectRoot(), mei.getDiagnostics().getMessageFilePath())).append(" "); //NOI18N
14.140 + sb.append(mei.getDiagnostics().getMessageFileOffset()).append("\n");
14.141 + } else {
14.142 + for (YamlParser.Replacement replacement : replacements) {
14.143 + sb.append("\n"); //NOI18N
14.144 + sb.append("Replacement: "); //NOI18N
14.145 + sb.append(CndPathUtilities.getRelativePath(mei.getProject().getProjectRoot(), replacement.filePath)).append(" "); //NOI18N
14.146 + sb.append(replacement.offset).append("-").append(replacement.offset + replacement.length).append("\n"); //NOI18N
14.147 + String attributeValue = replacement.replacementText;
14.148 + try {
14.149 + attributeValue = XMLUtil.toAttributeValue(replacement.replacementText);
14.150 + } catch (CharConversionException ex) {
14.151 + }
14.152 + sb.append(attributeValue).append("\n"); //NOI18N
14.153 + }
14.154 + }
14.155 + sb.append(mei.getMessage());
14.156 + sb.append("</pre>"); //NOI18N
14.157 +
14.158 + LazyFixList list = new LazyFixListImpl();
14.159 +
14.160 + return ErrorDescriptionFactory.createErrorDescription(PREFIX + mei.getId(), Severity.valueOf(mei.getSeverity().toString().toUpperCase()),
14.161 + messages[0], sb.toString(), list, fo, errorInfo.getStartOffset(), errorInfo.getStartOffset());
14.162 + }
14.163 + }
14.164 + return null;
14.165 + }
14.166 + }
14.167 +
14.168 + @ServiceProvider(service = AnalyzerFactory.class)
14.169 + public static final class AnalyzerFactoryImpl extends AnalyzerFactory {
14.170 +
14.171 + public AnalyzerFactoryImpl() {
14.172 + super(ModernizeErrorProvider.NAME,
14.173 + NbBundle.getMessage(ModernizeErrorProvider.class, "Modernize_NAME"), //NOI18N
14.174 + ImageUtilities.loadImage("com/sun/tools/ide/analysis/modernize/impl/bugs.png")); //NOI18N
14.175 + }
14.176 +
14.177 + @Override
14.178 + public Iterable<? extends WarningDescription> getWarnings() {
14.179 + List<WarningDescription> result = new ArrayList<>();
14.180 + final ModernizeErrorProvider provider = ModernizeErrorProvider.getInstance();
14.181 + for (CodeAudit audit : provider.getAudits()) {
14.182 + result.add(WarningDescription.create(PREFIX + audit.getID(), audit.getName(), ModernizeErrorProvider.NAME, provider.getDisplayName()));
14.183 + }
14.184 + String[] fatals = BundleUtilities.getFatalErrors();
14.185 + for (String id : fatals) { //NOI18N
14.186 + if (!id.isEmpty()) {
14.187 + result.add(WarningDescription.create(PREFIX + id, BundleUtilities.getDescription(id), ModernizeErrorProvider.NAME, provider.getDisplayName()));
14.188 + }
14.189 + }
14.190 + return result;
14.191 + }
14.192 +
14.193 + @Override
14.194 + public CustomizerProvider<Void, AbstractHintsPanel> getCustomizerProvider() {
14.195 + return new CustomizerProvider<Void, AbstractHintsPanel>() {
14.196 +
14.197 + @Override
14.198 + public Void initialize() {
14.199 + return null;
14.200 + }
14.201 +
14.202 + @Override
14.203 + public AbstractHintsPanel createComponent(CustomizerContext<Void, AbstractHintsPanel> context) {
14.204 + return AbstractAnalyzer.createComponent(ModernizeErrorProvider.getInstance());
14.205 + }
14.206 + };
14.207 + }
14.208 +
14.209 + @Override
14.210 + public Collection<? extends MissingPlugin> requiredPlugins(Context context) {
14.211 +// ExecutionEnvironment env = detectEnvironment(context);
14.212 +// if (env == null) {
14.213 +// env = ExecutionEnvironmentFactory.getLocal();
14.214 +// }
14.215 + String installedTool = ClangAnalyzerOptions.getClangAnalyzerPath();
14.216 + if (installedTool == null || !new File(installedTool).exists()) {
14.217 + String codeBase = ClangAnalyzerOptions.getMissingModuleName();
14.218 + if (codeBase != null) {
14.219 + return Arrays.asList(new MissingPlugin(codeBase, NbBundle.getMessage(ModernizeAnalyzerImpl.class, "Modernize_NAME"))); //NOI18N
14.220 + }
14.221 + }
14.222 + return Collections.emptyList();
14.223 + }
14.224 +
14.225 + @Override
14.226 + public Analyzer createAnalyzer(Context context) {
14.227 + return new ModernizeAnalyzerImpl(context);
14.228 + }
14.229 + }
14.230 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/ModernizeCodeAudit.java Sun Jun 25 18:25:05 2017 +0200
15.3 @@ -0,0 +1,120 @@
15.4 +/*
15.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
15.6 + *
15.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
15.8 + *
15.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
15.10 + * Other names may be trademarks of their respective owners.
15.11 + *
15.12 + * The contents of this file are subject to the terms of either the GNU
15.13 + * General Public License Version 2 only ("GPL") or the Common
15.14 + * Development and Distribution License("CDDL") (collectively, the
15.15 + * "License"). You may not use this file except in compliance with the
15.16 + * License. You can obtain a copy of the License at
15.17 + * http://www.netbeans.org/cddl-gplv2.html
15.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15.19 + * specific language governing permissions and limitations under the
15.20 + * License. When distributing the software, include this License Header
15.21 + * Notice in each file and include the License file at
15.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
15.23 + * particular file as subject to the "Classpath" exception as provided
15.24 + * by Oracle in the GPL Version 2 section of the License file that
15.25 + * accompanied this code. If applicable, add the following below the
15.26 + * License Header, with the fields enclosed by brackets [] replaced by
15.27 + * your own identifying information:
15.28 + * "Portions Copyrighted [year] [name of copyright owner]"
15.29 + *
15.30 + * If you wish your version of this file to be governed by only the CDDL
15.31 + * or only the GPL Version 2, indicate your decision by adding
15.32 + * "[Contributor] elects to include this software in this distribution
15.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
15.34 + * single choice of license, a recipient has the option to distribute
15.35 + * your version of this file under either the CDDL, the GPL Version 2 or
15.36 + * to extend the choice of license to its licensees as provided above.
15.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
15.38 + * Version 2 license, then the option applies only if the new code is
15.39 + * made subject to such option by the copyright holder.
15.40 + *
15.41 + * Contributor(s): Ilia Gromov
15.42 + */
15.43 +package com.sun.tools.ide.analysis.modernize.impl;
15.44 +
15.45 +import org.netbeans.modules.cnd.api.model.syntaxerr.AbstractCodeAudit;
15.46 +import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
15.47 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
15.48 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
15.49 +
15.50 +final class ModernizeCodeAudit extends AbstractCodeAudit {
15.51 +
15.52 + private final String id;
15.53 + private final String name;
15.54 + private final String description;
15.55 + private final String defaultSeverity;
15.56 + private final boolean defaultEnabled;
15.57 + private final AuditPreferences myPreferences;
15.58 +
15.59 + public ModernizeCodeAudit(String id, String name, String description, String defaultSeverity, boolean defaultEnabled, AuditPreferences myPreferences) {
15.60 + super(id, name, description, defaultSeverity, defaultEnabled, myPreferences);
15.61 + this.id = id;
15.62 + this.name = name;
15.63 + this.description = description;
15.64 + this.defaultSeverity = defaultSeverity;
15.65 + this.defaultEnabled = defaultEnabled;
15.66 + this.myPreferences = myPreferences;
15.67 + }
15.68 +
15.69 + @Override
15.70 + public String getID() {
15.71 + return id;
15.72 + }
15.73 +
15.74 + @Override
15.75 + public String getName() {
15.76 + return name;
15.77 + }
15.78 +
15.79 + @Override
15.80 + public String getDescription() {
15.81 + return description;
15.82 + }
15.83 +
15.84 + public static CsmErrorInfo.Severity toSeverity(String severity) {
15.85 + if ("error".equals(severity)) { // NOI18N
15.86 + return CsmErrorInfo.Severity.ERROR;
15.87 + } else if ("warning".equals(severity)) { // NOI18N
15.88 + return CsmErrorInfo.Severity.WARNING;
15.89 + } else {
15.90 + return CsmErrorInfo.Severity.HINT;
15.91 + }
15.92 + }
15.93 +
15.94 + @Override
15.95 + public String getKind() {
15.96 + return "inspection"; //NOI18N
15.97 + }
15.98 +
15.99 + @Override
15.100 + public AuditPreferences getPreferences() {
15.101 + return myPreferences;
15.102 + }
15.103 +
15.104 + @Override
15.105 + public boolean getDefaultEnabled() {
15.106 + return defaultEnabled;
15.107 + }
15.108 +
15.109 + @Override
15.110 + public String getDefaultSeverity() {
15.111 + return defaultSeverity;
15.112 + }
15.113 +
15.114 + @Override
15.115 + public boolean isSupportedEvent(CsmErrorProvider.EditorEvent kind) {
15.116 + return true;
15.117 + }
15.118 +
15.119 + @Override
15.120 + public void doGetErrors(CsmErrorProvider.Request request, CsmErrorProvider.Response response) {
15.121 + throw new UnsupportedOperationException("Not supported yet."); //NOI18N
15.122 + }
15.123 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/ModernizeErrorInfo.java Sun Jun 25 18:25:05 2017 +0200
16.3 @@ -0,0 +1,147 @@
16.4 +/*
16.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
16.6 + *
16.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
16.8 + *
16.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
16.10 + * Other names may be trademarks of their respective owners.
16.11 + *
16.12 + * The contents of this file are subject to the terms of either the GNU
16.13 + * General Public License Version 2 only ("GPL") or the Common
16.14 + * Development and Distribution License("CDDL") (collectively, the
16.15 + * "License"). You may not use this file except in compliance with the
16.16 + * License. You can obtain a copy of the License at
16.17 + * http://www.netbeans.org/cddl-gplv2.html
16.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16.19 + * specific language governing permissions and limitations under the
16.20 + * License. When distributing the software, include this License Header
16.21 + * Notice in each file and include the License file at
16.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
16.23 + * particular file as subject to the "Classpath" exception as provided
16.24 + * by Oracle in the GPL Version 2 section of the License file that
16.25 + * accompanied this code. If applicable, add the following below the
16.26 + * License Header, with the fields enclosed by brackets [] replaced by
16.27 + * your own identifying information:
16.28 + * "Portions Copyrighted [year] [name of copyright owner]"
16.29 + *
16.30 + * If you wish your version of this file to be governed by only the CDDL
16.31 + * or only the GPL Version 2, indicate your decision by adding
16.32 + * "[Contributor] elects to include this software in this distribution
16.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
16.34 + * single choice of license, a recipient has the option to distribute
16.35 + * your version of this file under either the CDDL, the GPL Version 2 or
16.36 + * to extend the choice of license to its licensees as provided above.
16.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
16.38 + * Version 2 license, then the option applies only if the new code is
16.39 + * made subject to such option by the copyright holder.
16.40 + *
16.41 + * Contributor(s): Ilia Gromov
16.42 + */
16.43 +package com.sun.tools.ide.analysis.modernize.impl;
16.44 +
16.45 +import java.util.ArrayList;
16.46 +import java.util.Arrays;
16.47 +import java.util.Collections;
16.48 +import java.util.List;
16.49 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
16.50 +import org.netbeans.modules.cnd.api.project.NativeProject;
16.51 +import org.openide.util.Lookup;
16.52 +
16.53 +public class ModernizeErrorInfo implements CsmErrorInfo, ModernizeErrorProvider.ErrorInfoWithId {
16.54 +
16.55 + private final YamlParser.Diagnostics diag;
16.56 + private final String messagePrefix;
16.57 + private final List<String> messageInfixes;
16.58 + private final String messageBody;
16.59 + private final NativeProject project;
16.60 +
16.61 + private final int startOffset;
16.62 + private final int endOffset;
16.63 +
16.64 + public ModernizeErrorInfo(YamlParser.Diagnostics diag, String messagePrefix, List<String> messageInfixes, String messageBody, Lookup.Provider project) {
16.65 + this.diag = diag;
16.66 + this.messagePrefix = messagePrefix;
16.67 + this.messageInfixes = messageInfixes;
16.68 + this.messageBody = messageBody;
16.69 + this.project = project.getLookup().lookup(NativeProject.class);
16.70 +
16.71 + if (diag.getReplacements().isEmpty()) {
16.72 + startOffset = diag.getMessageFileOffset();
16.73 + endOffset = diag.getMessageFileOffset();
16.74 + } else {
16.75 + YamlParser.Replacement first = diag.getReplacements().get(0);
16.76 + startOffset = first.offset;
16.77 + endOffset = first.offset + first.length;
16.78 + }
16.79 + }
16.80 +
16.81 + public static ModernizeErrorInfo withFixedMessage(YamlParser.Diagnostics diag, String messageBody, Lookup.Provider project) {
16.82 + return new ModernizeErrorInfo(diag, "", new ArrayList<>(), messageBody, project);
16.83 + }
16.84 +
16.85 + public static ModernizeErrorInfo withMutableMessage(YamlParser.Diagnostics diag, String messagePrefix, String messageInfix, String messageBody, Lookup.Provider project) {
16.86 + List<String> list = new ArrayList<>();
16.87 + list.add(messageInfix);
16.88 + return new ModernizeErrorInfo(diag, messagePrefix, list, messageBody, project);
16.89 + }
16.90 +
16.91 + public static ModernizeErrorInfo withMutableMessage(YamlParser.Diagnostics diag, String messagePrefix, List<String> messageInfixes, String messageBody, Lookup.Provider project) {
16.92 + return new ModernizeErrorInfo(diag, messagePrefix, messageInfixes, messageBody, project);
16.93 + }
16.94 +
16.95 + public void addMessageInfixes(List<String> infix) {
16.96 + messageInfixes.addAll(infix);
16.97 + }
16.98 +
16.99 + public List<String> getMessageInfixes() {
16.100 + return Collections.unmodifiableList(messageInfixes);
16.101 + }
16.102 +
16.103 + public NativeProject getProject() {
16.104 + return project;
16.105 + }
16.106 +
16.107 + @Override
16.108 + public String getMessage() {
16.109 + StringBuilder sb = new StringBuilder();
16.110 + sb.append(messagePrefix).append(' ');
16.111 + if (messageInfixes.size() < 4) {
16.112 + sb.append(messageInfixes.toString());
16.113 + } else {
16.114 + ArrayList<String> list = new ArrayList<>(messageInfixes.subList(0, 2));
16.115 + list.add(String.format("... (%s more)", messageInfixes.size() - 2));
16.116 + sb.append(list.toString());
16.117 + }
16.118 + sb.append(": "); //NOI18N
16.119 + sb.append(messageBody);
16.120 + return sb.toString();
16.121 + }
16.122 +
16.123 + @Override
16.124 + public Severity getSeverity() {
16.125 + return Severity.valueOf(diag.getLevel().toString().toUpperCase());
16.126 + }
16.127 +
16.128 + @Override
16.129 + public int getStartOffset() {
16.130 + return startOffset;
16.131 + }
16.132 +
16.133 + @Override
16.134 + public int getEndOffset() {
16.135 + return endOffset;
16.136 + }
16.137 +
16.138 + public YamlParser.Diagnostics getDiagnostics() {
16.139 + return diag;
16.140 + }
16.141 +
16.142 + @Override
16.143 + public String getId() {
16.144 + return diag.getCheckName();
16.145 + }
16.146 +
16.147 + public boolean isNeedConfigureHint() {
16.148 + return true;
16.149 + }
16.150 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/ModernizeErrorProvider.java Sun Jun 25 18:25:05 2017 +0200
17.3 @@ -0,0 +1,425 @@
17.4 +/*
17.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
17.6 + *
17.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
17.8 + *
17.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
17.10 + * Other names may be trademarks of their respective owners.
17.11 + *
17.12 + * The contents of this file are subject to the terms of either the GNU
17.13 + * General Public License Version 2 only ("GPL") or the Common
17.14 + * Development and Distribution License("CDDL") (collectively, the
17.15 + * "License"). You may not use this file except in compliance with the
17.16 + * License. You can obtain a copy of the License at
17.17 + * http://www.netbeans.org/cddl-gplv2.html
17.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17.19 + * specific language governing permissions and limitations under the
17.20 + * License. When distributing the software, include this License Header
17.21 + * Notice in each file and include the License file at
17.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
17.23 + * particular file as subject to the "Classpath" exception as provided
17.24 + * by Oracle in the GPL Version 2 section of the License file that
17.25 + * accompanied this code. If applicable, add the following below the
17.26 + * License Header, with the fields enclosed by brackets [] replaced by
17.27 + * your own identifying information:
17.28 + * "Portions Copyrighted [year] [name of copyright owner]"
17.29 + *
17.30 + * If you wish your version of this file to be governed by only the CDDL
17.31 + * or only the GPL Version 2, indicate your decision by adding
17.32 + * "[Contributor] elects to include this software in this distribution
17.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
17.34 + * single choice of license, a recipient has the option to distribute
17.35 + * your version of this file under either the CDDL, the GPL Version 2 or
17.36 + * to extend the choice of license to its licensees as provided above.
17.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
17.38 + * Version 2 license, then the option applies only if the new code is
17.39 + * made subject to such option by the copyright holder.
17.40 + *
17.41 + * Contributor(s): Ilia Gromov
17.42 + */
17.43 +package com.sun.tools.ide.analysis.modernize.impl;
17.44 +
17.45 +import com.sun.tools.ide.analysis.modernize.impl.YamlParser.Replacement;
17.46 +import com.sun.tools.ide.analysis.modernize.options.AnalyzerPreferences;
17.47 +import com.sun.tools.ide.analysis.modernize.options.ClangAnalyzerOptions;
17.48 +import static com.sun.tools.ide.analysis.modernize.utils.AnalyticsTools.fatalError;
17.49 +import static com.sun.tools.ide.analysis.modernize.utils.AnalyticsTools.findItem;
17.50 +import java.io.File;
17.51 +import java.io.IOException;
17.52 +import java.util.ArrayList;
17.53 +import java.util.Collection;
17.54 +import java.util.Collections;
17.55 +import java.util.List;
17.56 +import java.util.logging.Level;
17.57 +import java.util.logging.Logger;
17.58 +import java.util.prefs.Preferences;
17.59 +import javax.swing.JComponent;
17.60 +import javax.swing.JLabel;
17.61 +import org.netbeans.modules.cnd.analysis.api.AbstractCustomizerProvider;
17.62 +import org.netbeans.modules.cnd.analysis.api.AnalyzerResponse;
17.63 +import org.netbeans.modules.cnd.api.model.CsmFile;
17.64 +import org.netbeans.modules.cnd.api.model.syntaxerr.AbstractCodeAudit;
17.65 +import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
17.66 +import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAudit;
17.67 +import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAuditFactory;
17.68 +import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAuditProvider;
17.69 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
17.70 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo.Severity;
17.71 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfoHintProvider;
17.72 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
17.73 +import org.netbeans.modules.cnd.api.project.NativeFileItem.Language;
17.74 +import org.netbeans.modules.cnd.api.project.NativeProject;
17.75 +import org.netbeans.modules.cnd.api.remote.RemoteProject;
17.76 +import org.netbeans.modules.cnd.makeproject.api.MakeProject;
17.77 +import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
17.78 +import org.netbeans.modules.cnd.modelutil.CsmUtilities;
17.79 +import org.netbeans.modules.cnd.utils.MIMENames;
17.80 +import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
17.81 +import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
17.82 +import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
17.83 +import org.netbeans.spi.editor.hints.ErrorDescription;
17.84 +import org.netbeans.spi.editor.hints.Fix;
17.85 +import org.openide.filesystems.FileObject;
17.86 +import org.openide.filesystems.FileUtil;
17.87 +import org.openide.util.Exceptions;
17.88 +import org.openide.util.Lookup;
17.89 +import org.openide.util.NbBundle;
17.90 +import org.openide.util.lookup.ServiceProvider;
17.91 +import org.openide.util.lookup.ServiceProviders;
17.92 +
17.93 +@ServiceProviders({
17.94 + @ServiceProvider(service = CsmErrorProvider.class, position = 2100)
17.95 + ,
17.96 + @ServiceProvider(service = CodeAuditProvider.class, position = 2100)
17.97 +})
17.98 +public final class ModernizeErrorProvider extends CsmErrorProvider implements CodeAuditProvider, AbstractCustomizerProvider {
17.99 +
17.100 + public static final Logger LOG = Logger.getLogger("ide.analysis.tidy"); //NOI18N
17.101 + public static final String NAME = "Modernize"; //NOI18N
17.102 +
17.103 + private Collection<CodeAudit> audits;
17.104 + private AnalyzerResponseMerger analyzerResponseMerger;
17.105 +
17.106 + public static ModernizeErrorProvider getInstance() {
17.107 + for (CsmErrorProvider provider : Lookup.getDefault().lookupAll(CsmErrorProvider.class)) {
17.108 + if (NAME.equals(provider.getName()) && provider instanceof ModernizeErrorProvider) {
17.109 + return (ModernizeErrorProvider) provider;
17.110 + }
17.111 + }
17.112 + return null;
17.113 + }
17.114 +
17.115 + @Override
17.116 + protected boolean validate(Request request) {
17.117 + CsmFile file = request.getFile();
17.118 + return file != null;
17.119 + }
17.120 +
17.121 + @Override
17.122 + public boolean hasHintControlPanel() {
17.123 + return true;
17.124 + }
17.125 +
17.126 + @Override
17.127 + public String getName() {
17.128 + return NAME;
17.129 + }
17.130 +
17.131 + @Override
17.132 + public String getDisplayName() {
17.133 + return NbBundle.getMessage(ModernizeErrorProvider.class, "Modernize_NAME"); //NOI18N
17.134 + }
17.135 +
17.136 + @Override
17.137 + public String getDescription() {
17.138 + return NbBundle.getMessage(ModernizeErrorProvider.class, "Modernize_DESCRIPTION"); //NOI18N
17.139 + }
17.140 +
17.141 + @Override
17.142 + public String getMimeType() {
17.143 + return MIMENames.SOURCES_MIME_TYPE;
17.144 + }
17.145 +
17.146 + @Override
17.147 + public boolean isSupportedEvent(EditorEvent kind) {
17.148 + return kind == EditorEvent.FileBased;
17.149 + }
17.150 +
17.151 + @Override
17.152 + protected void doGetErrors(CsmErrorProvider.Request request, CsmErrorProvider.Response response) {
17.153 + CsmFile file = request.getFile();
17.154 + if (file != null) {
17.155 + if (request.isCancelled()) {
17.156 + return;
17.157 + }
17.158 + Object platformProject = file.getProject().getPlatformProject();
17.159 + if (platformProject instanceof NativeProject) {
17.160 + Lookup.Provider project = ((NativeProject) platformProject).getProject();
17.161 + if (project != null) {
17.162 + if (request.isCancelled()) {
17.163 + return;
17.164 + }
17.165 + Thread currentThread = Thread.currentThread();
17.166 + currentThread.setName("Provider " + getName() + " prosess " + file.getAbsolutePath()); // NOI18N
17.167 + RemoteProject info = project.getLookup().lookup(RemoteProject.class);
17.168 + if (info != null) {
17.169 + ExecutionEnvironment execEnv = info.getDevelopmentHost();
17.170 + if (execEnv != null) {
17.171 + if (request.isCancelled()) {
17.172 + return;
17.173 + }
17.174 + if (ConnectionManager.getInstance().isConnectedTo(execEnv)) {
17.175 + Item item = findItem(file, project);
17.176 + if (item != null) {
17.177 + if (request.isCancelled()) {
17.178 + return;
17.179 + }
17.180 + // Temporarily analyzing even excluded items
17.181 + if (/* !item.isExcluded() && */(item.getLanguage() == Language.C || item.getLanguage() == Language.CPP || item.getLanguage() == Language.C_HEADER)) {
17.182 + analyze(execEnv, item, project, request, response);
17.183 + }
17.184 + }
17.185 + }
17.186 + }
17.187 + }
17.188 + }
17.189 + }
17.190 + }
17.191 + }
17.192 +
17.193 + public void analyze(ExecutionEnvironment execEnv, Item item, Lookup.Provider project, CsmErrorProvider.Request request, CsmErrorProvider.Response response) {
17.194 + String binaryPath = ClangAnalyzerOptions.getClangAnalyzerPath();
17.195 + boolean isAnalyzer = response instanceof ModernizeAnalyzerImpl.ModernizeResponse;
17.196 + if (binaryPath == null) {
17.197 + Level level = isAnalyzer ? Level.INFO : Level.FINE;
17.198 + LOG.log(level, "clang-tidy needs to be installed as a plugin"); //NOI18N
17.199 + return;
17.200 + }
17.201 +
17.202 + if (isAnalyzer && isNewRun()) {
17.203 + AnalyzedFiles.getDefault().clear();
17.204 + analyzerResponseMerger = new AnalyzerResponseMerger((ModernizeAnalyzerImpl.ModernizeResponse) response);
17.205 + }
17.206 +
17.207 + DiagnosticsTool diagnosticsTool = new DiagnosticsTool(execEnv, item, (MakeProject) project, binaryPath);
17.208 + try {
17.209 + CsmFile csmFile = request.getFile();
17.210 + Collection<String> checks = /*isAnalyzer ? Collections.singleton("*") : */ getEnabledChecks(); //NOI18N
17.211 +
17.212 + Collection<CsmFile> tu = new ArrayList<CsmFile>();
17.213 + if (isAnalyzer) {
17.214 + tu.add(csmFile);
17.215 + } else {
17.216 + if (AnalyzedFiles.getDefault().isStartFile(csmFile)) {
17.217 + tu.add(csmFile);
17.218 + } else {
17.219 + tu.addAll(AnalyzedFiles.getDefault().getStartFiles(csmFile));
17.220 + }
17.221 + }
17.222 +
17.223 + if (!isAnalyzer) {
17.224 + response = new CsmResponseMerger(response);
17.225 + }
17.226 +
17.227 + for (CsmFile startFile : tu) {
17.228 + int exitCode = diagnosticsTool.process(checks, startFile, true);
17.229 + if (exitCode != DiagnosticsTool.STATUS_OK) {
17.230 + String error = NbBundle.getMessage(ModernizeErrorProvider.class, "compile.file.error"); //NOI18N
17.231 + String info = NbBundle.getMessage(ModernizeErrorProvider.class, "compile.file.error.info", "" + exitCode); //NOI18N
17.232 + fatalError(AnalyzerResponse.AnalyzerSeverity.FileError, "fatal.analyze.error", error + "\n" + info, csmFile, response); //NOI18N
17.233 + return;
17.234 + }
17.235 + List<YamlParser.Diagnostics> results = YamlParser.getDefault().parseYaml(diagnosticsTool.getYamlAsString());
17.236 + postProcess(isAnalyzer, startFile, project, results, request, response);
17.237 + }
17.238 +
17.239 + if (!isAnalyzer) {
17.240 + response.done();
17.241 + }
17.242 +
17.243 + } catch (ConnectionManager.CancellationException | IOException ex) {
17.244 + Exceptions.printStackTrace(ex);
17.245 + }
17.246 + }
17.247 +
17.248 + private static CsmErrorProvider last;
17.249 +
17.250 + private boolean isNewRun() {
17.251 + if (last == null || this != last) {
17.252 + last = this;
17.253 + return true;
17.254 + }
17.255 + return false;
17.256 + }
17.257 +
17.258 + public Collection<ErrorDescription> done() {
17.259 + return analyzerResponseMerger.done();
17.260 + }
17.261 +
17.262 + public void postProcess(boolean isAnalyzer, CsmFile startFile, Lookup.Provider project, List<YamlParser.Diagnostics> results, CsmErrorProvider.Request request, CsmErrorProvider.Response response) {
17.263 + CsmFile file = request.getFile();
17.264 + List<CsmFile> otherCsmFiles = new ArrayList<>();
17.265 +
17.266 + for (YamlParser.Diagnostics diag : results) {
17.267 + // TODO: don't add "Configure Hint" fix multiple times for one line
17.268 + FileObject fo = FileUtil.toFileObject(new File(diag.getMessageFilePath()));
17.269 + CsmFile csmFile = CsmUtilities.getCsmFile(fo, false, false);
17.270 +
17.271 + // Composing a preview message. Showing a start file for compilation unit
17.272 + // in case we analysing a header file
17.273 + ModernizeErrorInfo info;
17.274 + if (startFile.equals(file) && csmFile.equals(file)) {
17.275 + String message = String.format("[%s]: %s", diag.getCheckName(), diag.getMessage()); //NOI18N
17.276 + info = ModernizeErrorInfo.withFixedMessage(diag, message, project);
17.277 + } else {
17.278 + info = ModernizeErrorInfo.withMutableMessage(diag, diag.getCheckName(), startFile.getName().toString(), diag.getMessage(), project);
17.279 + }
17.280 +
17.281 + if (isAnalyzer) {
17.282 + // Add found errors for all files (can be other files from compileUnit)
17.283 + analyzerResponseMerger.addError(info, fo);
17.284 +
17.285 + if (!csmFile.equals(file)) {
17.286 + // May be not header (e.g BBB.cc: AAA.cc -> (includes) BBB.cc -> ... )
17.287 + otherCsmFiles.add(csmFile);
17.288 + }
17.289 + } else if (fo.equals(file.getFileObject())) {
17.290 + // Add found errors only for file displayed in Editor
17.291 + response.addError(info);
17.292 + }
17.293 + }
17.294 +
17.295 + if (isAnalyzer /* and not empty? */) {
17.296 + AnalyzedFiles.getDefault().cacheHierarchy(file, otherCsmFiles);
17.297 + }
17.298 + }
17.299 +
17.300 + @ServiceProvider(path = CodeAuditFactory.REGISTRATION_PATH + ModernizeErrorProvider.NAME, service = CodeAuditFactory.class, position = 4000)
17.301 + public static final class Factory implements CodeAuditFactory {
17.302 +
17.303 + @Override
17.304 + public AbstractCodeAudit create(AuditPreferences preferences) {
17.305 + String id = NbBundle.getMessage(ModernizeCodeAudit.class, "LBL_ProviderName"); // NOI18N
17.306 + String description = NbBundle.getMessage(ModernizeCodeAudit.class, "LBL_ProviderDescription"); // NOI18N
17.307 + return new ModernizeCodeAudit(id, id, description, "error", false, preferences); // NOI18N
17.308 + }
17.309 + }
17.310 +
17.311 + private String oldPath;
17.312 +
17.313 + @Override
17.314 + public synchronized Collection<CodeAudit> getAudits() {
17.315 + String path = ClangAnalyzerOptions.getClangAnalyzerPath();
17.316 +
17.317 + if (path == null) {
17.318 + return Collections.emptyList();
17.319 + }
17.320 +
17.321 + if (oldPath == null) {
17.322 + oldPath = path;
17.323 + }
17.324 +
17.325 + if (audits == null || !oldPath.equals(path)) {
17.326 + List<CodeAudit> res = DiagnosticsTool.getAudits(path, ExecutionEnvironmentFactory.getLocal(), AnalyzerPreferences.getAuditPreferences());
17.327 +
17.328 + audits = res;
17.329 + oldPath = path;
17.330 + }
17.331 + return audits;
17.332 + }
17.333 +
17.334 + public Collection<String> getEnabledChecks() {
17.335 + Collection<CodeAudit> auditList = getAudits();
17.336 + List<String> enabled = new ArrayList<String>();
17.337 + for (CodeAudit codeAudit : auditList) {
17.338 + if (codeAudit.isEnabled()) {
17.339 + enabled.add(codeAudit.getID());
17.340 + }
17.341 + }
17.342 + return enabled.size() == auditList.size() ? Collections.singleton("*") : enabled; //NOI18N
17.343 + }
17.344 +
17.345 + @Override
17.346 + public AuditPreferences getPreferences() {
17.347 + return AnalyzerPreferences.getAuditPreferences();
17.348 + }
17.349 +
17.350 + @Override
17.351 + public JComponent createComponent(Preferences context) {
17.352 + return new JLabel();
17.353 + }
17.354 +
17.355 + public static interface ErrorInfoWithId {
17.356 +
17.357 + String getId();
17.358 + }
17.359 +
17.360 + public static final class FatalErrorInfo implements CsmErrorInfo, ErrorInfoWithId {
17.361 +
17.362 + private final String id;
17.363 + private final String message;
17.364 +
17.365 + public FatalErrorInfo(String id, String message) {
17.366 + this.id = id;
17.367 + this.message = message;
17.368 + }
17.369 +
17.370 + @Override
17.371 + public String getMessage() {
17.372 + return message;
17.373 + }
17.374 +
17.375 + @Override
17.376 + public Severity getSeverity() {
17.377 + return Severity.WARNING;
17.378 + }
17.379 +
17.380 + @Override
17.381 + public int getStartOffset() {
17.382 + return 0;
17.383 + }
17.384 +
17.385 + @Override
17.386 + public int getEndOffset() {
17.387 + return 1;
17.388 + }
17.389 +
17.390 + @Override
17.391 + public String getId() {
17.392 + return id;
17.393 + }
17.394 + }
17.395 +
17.396 + @ServiceProvider(service = CsmErrorInfoHintProvider.class, position = 9100)
17.397 + public final static class ModerinzeHintProvider extends CsmErrorInfoHintProvider {
17.398 +
17.399 + @Override
17.400 + protected List<Fix> doGetFixes(CsmErrorInfo info, List<Fix> alreadyFound) {
17.401 + if (info instanceof ModernizeErrorInfo) {
17.402 + alreadyFound.add(new ConfigureHintsFix((ModernizeErrorInfo) info));
17.403 + }
17.404 + return alreadyFound;
17.405 + }
17.406 + }
17.407 +
17.408 + @ServiceProvider(service = CsmErrorInfoHintProvider.class, position = 1600)
17.409 + public static final class ModernizeFixProvider extends CsmErrorInfoHintProvider {
17.410 +
17.411 + @Override
17.412 + protected List<Fix> doGetFixes(CsmErrorInfo info, List<Fix> alreadyFound) {
17.413 + alreadyFound.addAll(createFixes(info));
17.414 + return alreadyFound;
17.415 + }
17.416 + }
17.417 +
17.418 + private static List<? extends Fix> createFixes(CsmErrorInfo info) {
17.419 + if (info instanceof ModernizeErrorInfo) {
17.420 + ModernizeErrorInfo mei = (ModernizeErrorInfo) info;
17.421 + List<Replacement> replacements = mei.getDiagnostics().getReplacements();
17.422 + if (!replacements.isEmpty()) {
17.423 + return Collections.singletonList(new ModernizeFix(replacements, mei.getId()));
17.424 + }
17.425 + }
17.426 + return Collections.EMPTY_LIST;
17.427 + }
17.428 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/ModernizeFix.java Sun Jun 25 18:25:05 2017 +0200
18.3 @@ -0,0 +1,133 @@
18.4 +/*
18.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
18.6 + *
18.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
18.8 + *
18.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
18.10 + * Other names may be trademarks of their respective owners.
18.11 + *
18.12 + * The contents of this file are subject to the terms of either the GNU
18.13 + * General Public License Version 2 only ("GPL") or the Common
18.14 + * Development and Distribution License("CDDL") (collectively, the
18.15 + * "License"). You may not use this file except in compliance with the
18.16 + * License. You can obtain a copy of the License at
18.17 + * http://www.netbeans.org/cddl-gplv2.html
18.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18.19 + * specific language governing permissions and limitations under the
18.20 + * License. When distributing the software, include this License Header
18.21 + * Notice in each file and include the License file at
18.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18.23 + * particular file as subject to the "Classpath" exception as provided
18.24 + * by Oracle in the GPL Version 2 section of the License file that
18.25 + * accompanied this code. If applicable, add the following below the
18.26 + * License Header, with the fields enclosed by brackets [] replaced by
18.27 + * your own identifying information:
18.28 + * "Portions Copyrighted [year] [name of copyright owner]"
18.29 + *
18.30 + * If you wish your version of this file to be governed by only the CDDL
18.31 + * or only the GPL Version 2, indicate your decision by adding
18.32 + * "[Contributor] elects to include this software in this distribution
18.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
18.34 + * single choice of license, a recipient has the option to distribute
18.35 + * your version of this file under either the CDDL, the GPL Version 2 or
18.36 + * to extend the choice of license to its licensees as provided above.
18.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
18.38 + * Version 2 license, then the option applies only if the new code is
18.39 + * made subject to such option by the copyright holder.
18.40 + *
18.41 + * Contributor(s): Ilia Gromov
18.42 + */
18.43 +package com.sun.tools.ide.analysis.modernize.impl;
18.44 +
18.45 +import java.io.File;
18.46 +import java.util.List;
18.47 +import javax.swing.text.Document;
18.48 +import javax.swing.text.Position;
18.49 +import org.netbeans.editor.BaseDocument;
18.50 +import org.netbeans.modules.cnd.api.model.CsmFile;
18.51 +import org.netbeans.modules.cnd.modelutil.CsmUtilities;
18.52 +import org.netbeans.spi.editor.hints.ChangeInfo;
18.53 +import org.netbeans.spi.editor.hints.EnhancedFix;
18.54 +import org.openide.filesystems.FileObject;
18.55 +import org.openide.filesystems.FileUtil;
18.56 +import org.openide.text.CloneableEditorSupport;
18.57 +import org.openide.text.PositionRef;
18.58 +
18.59 +/**
18.60 + *
18.61 + * @author Ilia Gromov
18.62 + */
18.63 +public class ModernizeFix implements EnhancedFix {
18.64 +
18.65 + private final YamlParser.Replacement[] replacements;
18.66 + private final String text;
18.67 + private CloneableEditorSupport ces;
18.68 + private final PositionRef[] beg;
18.69 + private final PositionRef[] end;
18.70 +
18.71 + public ModernizeFix(List<YamlParser.Replacement> replacementList, String id) {
18.72 + this.beg = new PositionRef[replacementList.size()];
18.73 + this.end = new PositionRef[replacementList.size()];
18.74 + this.replacements = replacementList.toArray(new YamlParser.Replacement[replacementList.size()]);
18.75 + this.text = (id.startsWith("-")) ? id.substring(1) : id; //NOI18N
18.76 + for (int i = 0; i < replacements.length; i++) {
18.77 + YamlParser.Replacement replacement = replacements[i];
18.78 + FileObject fo = FileUtil.toFileObject(new File(replacement.filePath));
18.79 + CsmFile csmFile = CsmUtilities.getCsmFile(fo, false, false);
18.80 + if (csmFile != null) {
18.81 + ces = CsmUtilities.findCloneableEditorSupport(csmFile);
18.82 + if (ces != null) {
18.83 + beg[i] = ces.createPositionRef(replacement.offset, Position.Bias.Forward);
18.84 + end[i] = ces.createPositionRef(replacement.offset + replacement.length, Position.Bias.Backward);
18.85 + } else {
18.86 + }
18.87 + }
18.88 + }
18.89 + } //NOI18N
18.90 +
18.91 + @Override
18.92 + public String getText() {
18.93 + return "Apply replacement - " + text; //NOI18N
18.94 + }
18.95 +
18.96 + @Override
18.97 + public ChangeInfo implement() throws Exception {
18.98 + Document doc = CsmUtilities.openDocument(ces);
18.99 + if (doc instanceof BaseDocument) {
18.100 + Position min = beg[0];
18.101 + Position max = end[0];
18.102 + for (int i = 0; i < replacements.length; i++) {
18.103 + YamlParser.Replacement replacement = replacements[i];
18.104 + PositionRef b = beg[i];
18.105 + PositionRef e = end[i];
18.106 + if (b != null && e != null) {
18.107 + int newBeg = b.getOffset();
18.108 + int newLength = e.getOffset() - b.getOffset();
18.109 + if (b.getOffset() < min.getOffset()) {
18.110 + min = b;
18.111 + }
18.112 + if (e.getOffset() > max.getOffset()) {
18.113 + max = e;
18.114 + }
18.115 + if (newLength < 1) {
18.116 + // TODO: temp fix
18.117 + newLength = 0;
18.118 + }
18.119 + ((BaseDocument) doc).replace(newBeg, newLength, replacement.replacementText, null);
18.120 + }
18.121 + }
18.122 + return new ChangeInfo(min, max);
18.123 + }
18.124 + return null;
18.125 + }
18.126 +
18.127 + @Override
18.128 + public CharSequence getSortText() {
18.129 + return Integer.toString(Integer.MIN_VALUE);
18.130 + }
18.131 +
18.132 + public YamlParser.Replacement[] getReplacements() {
18.133 + return replacements;
18.134 + }
18.135 +
18.136 +}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/YamlParser.java Sun Jun 25 18:25:05 2017 +0200
19.3 @@ -0,0 +1,357 @@
19.4 +/*
19.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
19.6 + *
19.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
19.8 + *
19.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
19.10 + * Other names may be trademarks of their respective owners.
19.11 + *
19.12 + * The contents of this file are subject to the terms of either the GNU
19.13 + * General Public License Version 2 only ("GPL") or the Common
19.14 + * Development and Distribution License("CDDL") (collectively, the
19.15 + * "License"). You may not use this file except in compliance with the
19.16 + * License. You can obtain a copy of the License at
19.17 + * http://www.netbeans.org/cddl-gplv2.html
19.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
19.19 + * specific language governing permissions and limitations under the
19.20 + * License. When distributing the software, include this License Header
19.21 + * Notice in each file and include the License file at
19.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
19.23 + * particular file as subject to the "Classpath" exception as provided
19.24 + * by Oracle in the GPL Version 2 section of the License file that
19.25 + * accompanied this code. If applicable, add the following below the
19.26 + * License Header, with the fields enclosed by brackets [] replaced by
19.27 + * your own identifying information:
19.28 + * "Portions Copyrighted [year] [name of copyright owner]"
19.29 + *
19.30 + * If you wish your version of this file to be governed by only the CDDL
19.31 + * or only the GPL Version 2, indicate your decision by adding
19.32 + * "[Contributor] elects to include this software in this distribution
19.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
19.34 + * single choice of license, a recipient has the option to distribute
19.35 + * your version of this file under either the CDDL, the GPL Version 2 or
19.36 + * to extend the choice of license to its licensees as provided above.
19.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
19.38 + * Version 2 license, then the option applies only if the new code is
19.39 + * made subject to such option by the copyright holder.
19.40 + *
19.41 + * Contributor(s): Ilia Gromov
19.42 + */
19.43 +package com.sun.tools.ide.analysis.modernize.impl;
19.44 +
19.45 +import static com.sun.tools.ide.analysis.modernize.impl.YamlParser.Diagnostics.UNDEFINED;
19.46 +import java.util.ArrayList;
19.47 +import java.util.Collections;
19.48 +import java.util.List;
19.49 +import java.util.StringTokenizer;
19.50 +import java.util.logging.Level;
19.51 +
19.52 +/**
19.53 + *
19.54 + * @author Ilia Gromov
19.55 + */
19.56 +public class YamlParser {
19.57 + // TODO check for no-replacements case
19.58 +
19.59 + private static final YamlParser INSTANCE = new YamlParser();
19.60 +
19.61 + public static YamlParser getDefault() {
19.62 + return INSTANCE;
19.63 + }
19.64 +
19.65 + private static final String OPEN_TAG = "---"; //NOI18N
19.66 + private static final String CLOSE_TAG = "..."; //NOI18N
19.67 +
19.68 + private static final String MAIN_SOURCE_FILE = "MainSourceFile"; //NOI18N
19.69 + private static final String CHECK_NAME = "CheckName"; //NOI18N
19.70 + private static final String LEVEL = "Level"; //NOI18N
19.71 + private static final String MESSAGE_FILE_PATH = "MessageFilePath"; //NOI18N
19.72 + private static final String MESSAGE_FILE_OFFSET = "MessageFileOffset"; //NOI18N
19.73 + private static final String MESSAGE = "Message"; //NOI18N
19.74 + private static final String REPLACEMENTS = "Replacements"; //NOI18N
19.75 + private static final String DIAGNOSTICS = "Diagnostics"; //NOI18N
19.76 +
19.77 + private static final String FILE_PATH = "FilePath"; //NOI18N
19.78 + private static final String OFFSET = "Offset"; //NOI18N
19.79 + private static final String LENGTH = "Length"; //NOI18N
19.80 + private static final String REPLACEMENT_TEXT = "ReplacementText"; //NOI18N
19.81 +
19.82 + // clang-modernize:
19.83 +// ---
19.84 +// MainSourceFile: /home/ilia/NetBeansProjects/CppApplication_46/main.cpp
19.85 +// Replacements:
19.86 +// - FilePath: /home/ilia/NetBeansProjects/CppApplication_46/newfile.h
19.87 +// Offset: 101
19.88 +// Length: 1
19.89 +// ReplacementText: nullptr
19.90 +// - FilePath: /home/ilia/NetBeansProjects/CppApplication_46/newfile1.h
19.91 +// Offset: 380
19.92 +// Length: 1
19.93 +// ReplacementText: nullptr
19.94 +// - FilePath: /home/ilia/NetBeansProjects/CppApplication_46/main.cpp
19.95 +// Offset: 152
19.96 +// Length: 1
19.97 +// ReplacementText: nullptr
19.98 +// ...
19.99 + // clang-tidy:
19.100 +// ---
19.101 +// MainSourceFile: ''
19.102 +// Diagnostics:
19.103 +// CheckName: misc-macro-parentheses
19.104 +// Replacements:
19.105 +// - FilePath: /media/SSD_/code/zdoom/main_1.cpp
19.106 +// Offset: 1352
19.107 +// Length: 0
19.108 +// ReplacementText: '('
19.109 +// - FilePath: /media/SSD_/code/zdoom/main_1.cpp
19.110 +// Offset: 1353
19.111 +// Length: 0
19.112 +// ReplacementText: ')'
19.113 +// Diagnostics:
19.114 +// CheckName: misc-macro-parentheses
19.115 +// Replacements:
19.116 +// - FilePath: /media/SSD_/code/zdoom/main_1.cpp
19.117 +// Offset: 1446
19.118 +// Length: 0
19.119 +// ReplacementText: '('
19.120 +// - FilePath: /media/SSD_/code/zdoom/main_1.cpp
19.121 +// Offset: 1447
19.122 +// Length: 0
19.123 +// ReplacementText: ')'
19.124 +// ...
19.125 + public List<Diagnostics> parseYaml(String output) {
19.126 + try {
19.127 + if (output.isEmpty()) {
19.128 + // No warnings in header = no 'Main Source File' element
19.129 + return Collections.EMPTY_LIST;
19.130 + }
19.131 + StringTokenizer st = new StringTokenizer(output, "\n"); //NOI18N
19.132 + String line;
19.133 +
19.134 + // ---
19.135 + line = st.nextToken();
19.136 +
19.137 + line = st.nextToken();
19.138 + String mainSourceFile = getValue(MAIN_SOURCE_FILE, line);
19.139 +
19.140 + // Replacements:
19.141 + line = st.nextToken();
19.142 + ClangTidyVersion version = line.contains(REPLACEMENTS)
19.143 + ? ClangTidyVersion.OLD_FORMAT
19.144 + : ClangTidyVersion.NEW_FORMAT;
19.145 +
19.146 + List<Diagnostics> list = version.parser.parse(st);
19.147 +
19.148 + return list;
19.149 + } catch (Exception ex) {
19.150 + ModernizeErrorProvider.LOG.log(Level.INFO, "Can't parse output line");
19.151 + return Collections.EMPTY_LIST;
19.152 + }
19.153 + }
19.154 +
19.155 + private static List<Replacement> parseReplacements(StringTokenizer st) {
19.156 + List<Replacement> replacements = new ArrayList<Replacement>();
19.157 + String line;
19.158 +
19.159 + // eat Replacements:
19.160 + line = st.nextToken();
19.161 +
19.162 + if (!line.contains(REPLACEMENTS)) {
19.163 + return replacements;
19.164 + }
19.165 +
19.166 + while (st.hasMoreTokens()) {
19.167 + line = st.nextToken();
19.168 +
19.169 + if (line.equals(CLOSE_TAG) || !line.contains(FILE_PATH)) {
19.170 + break;
19.171 + }
19.172 +
19.173 + String filePath = getValue(FILE_PATH, line);
19.174 +
19.175 + line = st.nextToken();
19.176 + int offset = Integer.parseInt(getValue(OFFSET, line));
19.177 +
19.178 + line = st.nextToken();
19.179 + int length = Integer.parseInt(getValue(LENGTH, line));
19.180 +
19.181 + line = st.nextToken();
19.182 + String replacementText = getValue(REPLACEMENT_TEXT, line);
19.183 + while (replacementText == null && st.hasMoreElements()) {
19.184 + line = line + "\n" + st.nextElement(); //NOI18N
19.185 + replacementText = getValue(REPLACEMENT_TEXT, line);
19.186 + }
19.187 +
19.188 + Replacement replacement = new Replacement(filePath, offset, length, replacementText);
19.189 + replacements.add(replacement);
19.190 +
19.191 + }
19.192 + return replacements;
19.193 + }
19.194 +
19.195 + private static String getValue(String key, String line) {
19.196 + int keyStart = line.indexOf(key);
19.197 + assert keyStart != -1;
19.198 + int keyEnd = keyStart + key.length() + 1;
19.199 + String trimmed = line.substring(keyEnd).trim();
19.200 + boolean isTextValue = trimmed.charAt(0) == '\'';
19.201 + if (isTextValue) {
19.202 + if (trimmed.length() == 1) {
19.203 + // '
19.204 + // abcd'
19.205 + return null;
19.206 + } else if (trimmed.charAt(trimmed.length() - 1) == '\'') {
19.207 + trimmed = trimmed.substring(1, trimmed.length() - 1);
19.208 + } else {
19.209 + return null;
19.210 + }
19.211 + }
19.212 + return trimmed;
19.213 + }
19.214 +
19.215 + public static class TranslationUnitDiagnostics {
19.216 +
19.217 + private final String mainSourceFilePath;
19.218 + private final String context;
19.219 + private final List<Diagnostics> diags;
19.220 +
19.221 + public TranslationUnitDiagnostics(String mainSourceFilePath, String context, List<Diagnostics> diags) {
19.222 + this.mainSourceFilePath = mainSourceFilePath;
19.223 + this.context = context;
19.224 + this.diags = diags;
19.225 + }
19.226 +
19.227 + public String getMainSourceFilePath() {
19.228 + return mainSourceFilePath;
19.229 + }
19.230 +
19.231 + public String getContext() {
19.232 + return context;
19.233 + }
19.234 +
19.235 + public List<Diagnostics> getDiags() {
19.236 + return diags;
19.237 + }
19.238 + }
19.239 +
19.240 + public static class Diagnostics {
19.241 +
19.242 + public static final String UNDEFINED = "undefined"; // NOI18N
19.243 +
19.244 + public enum Level {
19.245 + warning, error
19.246 + }
19.247 +
19.248 + private final String checkName;
19.249 + private final Diagnostics.Level level;
19.250 + private final String messageFilePath;
19.251 + private final int messageFileOffset;
19.252 + private final String message;
19.253 + private final List<Replacement> replacements;
19.254 +
19.255 + public Diagnostics(String checkName, Diagnostics.Level level, String messageFilePath, int messageFileOffset, String message, List<Replacement> replacements) {
19.256 + this.checkName = checkName;
19.257 + this.level = level;
19.258 + this.messageFilePath = messageFilePath;
19.259 + this.messageFileOffset = messageFileOffset;
19.260 + this.message = message;
19.261 + this.replacements = replacements;
19.262 + }
19.263 +
19.264 + public String getCheckName() {
19.265 + return checkName;
19.266 + }
19.267 +
19.268 + public Level getLevel() {
19.269 + return level;
19.270 + }
19.271 +
19.272 + public String getMessageFilePath() {
19.273 + return messageFilePath;
19.274 + }
19.275 +
19.276 + public int getMessageFileOffset() {
19.277 + return messageFileOffset;
19.278 + }
19.279 +
19.280 + public String getMessage() {
19.281 + return message;
19.282 + }
19.283 +
19.284 + public List<Replacement> getReplacements() {
19.285 + return replacements;
19.286 + }
19.287 + }
19.288 +
19.289 + public static class Replacement {
19.290 +
19.291 + public final String filePath;
19.292 + public final int offset;
19.293 + public final int length;
19.294 + public final String replacementText;
19.295 +
19.296 + public Replacement(String FilePath, int offset, int length, String replacementText) {
19.297 + this.filePath = FilePath;
19.298 + this.offset = offset;
19.299 + this.length = length;
19.300 + this.replacementText = replacementText;
19.301 + }
19.302 + }
19.303 +
19.304 + private static enum ClangTidyVersion {
19.305 + NEW_FORMAT(new NewFormatParser()),
19.306 + OLD_FORMAT(new OldFormatParser());
19.307 +
19.308 + public final TidyParser parser;
19.309 +
19.310 + private ClangTidyVersion(TidyParser parser) {
19.311 + this.parser = parser;
19.312 + }
19.313 + }
19.314 +
19.315 + private static abstract class TidyParser {
19.316 +
19.317 + abstract List<Diagnostics> parse(StringTokenizer st);
19.318 + }
19.319 +
19.320 + private static class NewFormatParser extends TidyParser {
19.321 +
19.322 + @Override
19.323 + public List<Diagnostics> parse(StringTokenizer st) {
19.324 + List<Diagnostics> list = new ArrayList<Diagnostics>();
19.325 +
19.326 + String line;
19.327 + while (st.hasMoreElements()) {
19.328 + line = st.nextToken();
19.329 + String checkName = getValue(CHECK_NAME, line);
19.330 +
19.331 + line = st.nextToken();
19.332 + Diagnostics.Level level = Diagnostics.Level.valueOf(getValue(LEVEL, line).toLowerCase());
19.333 +
19.334 + line = st.nextToken();
19.335 + String messageFilePath = getValue(MESSAGE_FILE_PATH, line);
19.336 +
19.337 + line = st.nextToken();
19.338 + int messageFileOffset = Integer.parseInt(getValue(MESSAGE_FILE_OFFSET, line));
19.339 +
19.340 + line = st.nextToken();
19.341 + String message = getValue(MESSAGE, line);
19.342 +
19.343 + List<Replacement> replacements = parseReplacements(st);
19.344 +
19.345 + list.add(new Diagnostics(checkName, level, messageFilePath, messageFileOffset, message, replacements));
19.346 + }
19.347 + return list;
19.348 + }
19.349 +
19.350 + }
19.351 +
19.352 + private static class OldFormatParser extends TidyParser {
19.353 +
19.354 + @Override
19.355 + public List<Diagnostics> parse(StringTokenizer st) {
19.356 + List<Replacement> parseReplacements = parseReplacements(st);
19.357 + return Collections.singletonList(new Diagnostics(UNDEFINED, Diagnostics.Level.warning, "", -1, "", parseReplacements)); //NOI18N
19.358 + }
19.359 + }
19.360 +}
20.1 Binary file c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/impl/bugs.png has changed
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/layer.xml Sun Jun 25 18:25:05 2017 +0200
21.3 @@ -0,0 +1,75 @@
21.4 +<?xml version="1.0" encoding="UTF-8"?>
21.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
21.6 +<filesystem>
21.7 + <folder name="Analysis">
21.8 + <folder name="Clang-Tidy">
21.9 + <folder name="Disabled_Default">
21.10 + <file name="misc-unused-parameters">
21.11 + <![CDATA[False positive activation]]>
21.12 + </file>
21.13 + <file name="misc-unused-parameters">
21.14 + <![CDATA[False positive activation]]>
21.15 + </file>
21.16 + <file name="google-runtime-int">
21.17 + <![CDATA[Too much warnings]]>
21.18 + </file>
21.19 + <file name="modernize-use-nullptr">
21.20 + <![CDATA[Too much warnings]]>
21.21 + </file>
21.22 + <file name="modernize-use-default">
21.23 + <![CDATA[Too much warnings]]>
21.24 + </file>
21.25 + <file name="google-runtime-references">
21.26 + <![CDATA[Too much warnings]]>
21.27 + </file>
21.28 + <file name="modernize-redundant-void-arg">
21.29 + <![CDATA[Too much warnings]]>
21.30 + </file>
21.31 + <file name="readability-implicit-bool-cast">
21.32 + <![CDATA[Too much warnings]]>
21.33 + </file>
21.34 + <file name="cppcoreguidelines-pro-bounds-pointer-arithmetic">
21.35 + <![CDATA[Too much warnings]]>
21.36 + </file>
21.37 + <file name="google-readability-casting">
21.38 + <![CDATA[Too much warnings]]>
21.39 + </file>
21.40 + <file name="misc-macro-parentheses">
21.41 + <![CDATA[Too much warnings]]>
21.42 + </file>
21.43 +
21.44 + <file name="google-readability-braces-around-statements">
21.45 + <![CDATA[Project-specific readability check]]>
21.46 + </file>
21.47 + <file name="readability-named-parameter">
21.48 + <![CDATA[Project-specific readability check]]>
21.49 + </file>
21.50 + <file name="llvm-header-guard">
21.51 + <![CDATA[Project-specific readability check]]>
21.52 + </file>
21.53 + <file name="google-readability-casting">
21.54 + <![CDATA[Project-specific readability check]]>
21.55 + </file>
21.56 + <file name="google-readability-namespace-comments">
21.57 + <![CDATA[Project-specific readability check]]>
21.58 + </file>
21.59 + <file name="readability-braces-around-statements">
21.60 + <![CDATA[Project-specific readability check]]>
21.61 + </file>
21.62 + <file name="llvm-include-order">
21.63 + <![CDATA[Project-specific readability check]]>
21.64 + </file>
21.65 + <file name="readability-else-after-return">
21.66 + <![CDATA[Project-specific readability check]]>
21.67 + </file>
21.68 + <file name="cppcoreguidelines-pro-type-union-access">
21.69 + <![CDATA[Requires specific library]]>
21.70 + </file>
21.71 + </folder>
21.72 + <folder name="Strict_Checks">
21.73 + <file name="readability-inconsistent-declaration-parameter-name"></file>
21.74 + <file name="misc-unused-using-decls"></file>
21.75 + </folder>
21.76 + </folder>
21.77 + </folder>
21.78 +</filesystem>
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/options/AnalyzerPreferences.java Sun Jun 25 18:25:05 2017 +0200
22.3 @@ -0,0 +1,66 @@
22.4 +/*
22.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
22.6 + *
22.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
22.8 + *
22.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
22.10 + * Other names may be trademarks of their respective owners.
22.11 + *
22.12 + * The contents of this file are subject to the terms of either the GNU
22.13 + * General Public License Version 2 only ("GPL") or the Common
22.14 + * Development and Distribution License("CDDL") (collectively, the
22.15 + * "License"). You may not use this file except in compliance with the
22.16 + * License. You can obtain a copy of the License at
22.17 + * http://www.netbeans.org/cddl-gplv2.html
22.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
22.19 + * specific language governing permissions and limitations under the
22.20 + * License. When distributing the software, include this License Header
22.21 + * Notice in each file and include the License file at
22.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
22.23 + * particular file as subject to the "Classpath" exception as provided
22.24 + * by Oracle in the GPL Version 2 section of the License file that
22.25 + * accompanied this code. If applicable, add the following below the
22.26 + * License Header, with the fields enclosed by brackets [] replaced by
22.27 + * your own identifying information:
22.28 + * "Portions Copyrighted [year] [name of copyright owner]"
22.29 + *
22.30 + * If you wish your version of this file to be governed by only the CDDL
22.31 + * or only the GPL Version 2, indicate your decision by adding
22.32 + * "[Contributor] elects to include this software in this distribution
22.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
22.34 + * single choice of license, a recipient has the option to distribute
22.35 + * your version of this file under either the CDDL, the GPL Version 2 or
22.36 + * to extend the choice of license to its licensees as provided above.
22.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
22.38 + * Version 2 license, then the option applies only if the new code is
22.39 + * made subject to such option by the copyright holder.
22.40 + *
22.41 + * Contributor(s): Ilia Gromov
22.42 + */
22.43 +
22.44 +package com.sun.tools.ide.analysis.modernize.options;
22.45 +
22.46 +import java.util.prefs.Preferences;
22.47 +import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
22.48 +
22.49 +/**
22.50 + *
22.51 + * @author Ilia Gromov
22.52 + */
22.53 +public class AnalyzerPreferences {
22.54 +
22.55 + private static final String NODE_NAME = "clang-tidy"; //NOI18N
22.56 +
22.57 + public static AuditPreferences getAuditPreferences() {
22.58 + return Holder.PREFS;
22.59 + }
22.60 +
22.61 + public static Preferences getPreferences() {
22.62 + return Holder.PREFS.getPreferences();
22.63 + }
22.64 +
22.65 + private static final class Holder {
22.66 +
22.67 + static final AuditPreferences PREFS = new AuditPreferences(AuditPreferences.AUDIT_PREFERENCES_ROOT.node(NODE_NAME));
22.68 + }
22.69 +}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/options/Bundle.properties Sun Jun 25 18:25:05 2017 +0200
23.3 @@ -0,0 +1,15 @@
23.4 +PreviseOptions.confidenceLabel.text=&Confidence:
23.5 +
23.6 +SURE_CONFIDENCE=Sure
23.7 +HIGH_CONFIDENCE=High
23.8 +MEDIUM_CONFIDENCE=Medium
23.9 +LOW_CONFIDENCE=Low
23.10 +Parfait.tool.collection=
23.11 +ParfaitOptions.pathToParfait.notfound=Not Found
23.12 +ParfaitOptions.browse.text=...
23.13 +SELECT_TOOL_TITLE=Select Clang Binary Folder
23.14 +ParfaitOptions.connect.text=Connect to host {0}
23.15 +Parfait.tool.collection_1=clang-tidy
23.16 +ModernizeOptions.browseButton.text=...
23.17 +ModernizeOptions.jLabel2.text=build host
23.18 +ModernizeOptions.pathToAnalyzer.text=
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/options/ClangAnalyzerOptions.java Sun Jun 25 18:25:05 2017 +0200
24.3 @@ -0,0 +1,169 @@
24.4 +/*
24.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
24.6 + *
24.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
24.8 + *
24.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
24.10 + * Other names may be trademarks of their respective owners.
24.11 + *
24.12 + * The contents of this file are subject to the terms of either the GNU
24.13 + * General Public License Version 2 only ("GPL") or the Common
24.14 + * Development and Distribution License("CDDL") (collectively, the
24.15 + * "License"). You may not use this file except in compliance with the
24.16 + * License. You can obtain a copy of the License at
24.17 + * http://www.netbeans.org/cddl-gplv2.html
24.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
24.19 + * specific language governing permissions and limitations under the
24.20 + * License. When distributing the software, include this License Header
24.21 + * Notice in each file and include the License file at
24.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
24.23 + * particular file as subject to the "Classpath" exception as provided
24.24 + * by Oracle in the GPL Version 2 section of the License file that
24.25 + * accompanied this code. If applicable, add the following below the
24.26 + * License Header, with the fields enclosed by brackets [] replaced by
24.27 + * your own identifying information:
24.28 + * "Portions Copyrighted [year] [name of copyright owner]"
24.29 + *
24.30 + * If you wish your version of this file to be governed by only the CDDL
24.31 + * or only the GPL Version 2, indicate your decision by adding
24.32 + * "[Contributor] elects to include this software in this distribution
24.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
24.34 + * single choice of license, a recipient has the option to distribute
24.35 + * your version of this file under either the CDDL, the GPL Version 2 or
24.36 + * to extend the choice of license to its licensees as provided above.
24.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
24.38 + * Version 2 license, then the option applies only if the new code is
24.39 + * made subject to such option by the copyright holder.
24.40 + *
24.41 + * Contributor(s): Ilia Gromov
24.42 + */
24.43 +
24.44 +package com.sun.tools.ide.analysis.modernize.options;
24.45 +
24.46 +import java.io.File;
24.47 +import java.io.IOException;
24.48 +import java.util.Collections;
24.49 +import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
24.50 +import org.netbeans.modules.nativeexecution.api.HostInfo;
24.51 +import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
24.52 +import org.netbeans.modules.nativeexecution.api.util.HostInfoUtils;
24.53 +import org.openide.modules.InstalledFileLocator;
24.54 +
24.55 +/**
24.56 + *
24.57 + * @author Ilia Gromov
24.58 + */
24.59 +public class ClangAnalyzerOptions {
24.60 +
24.61 + public static final String CLANG_BINARY_NAME = "clang-tidy"; //NOI18N
24.62 + public static final String CLANG_BINARY_PATH = "clang-tidy-path"; //NOI18N
24.63 +
24.64 + private static String findInPaths() {
24.65 + String binaryName = CLANG_BINARY_NAME + "-" + getCodeBase(); //NOI18N
24.66 + String result = HostInfoUtils.searchFile(ExecutionEnvironmentFactory.getLocal(), Collections.<String>emptyList(), binaryName, true); // NOI18N
24.67 + return result;
24.68 + }
24.69 +
24.70 + public static String getClangAnalyzerPath() {
24.71 + String result = AnalyzerPreferences.getPreferences().get(CLANG_BINARY_PATH, ""); //NOI18N
24.72 + String oldValue = result;
24.73 + if (result.isEmpty()) {
24.74 + String toolPath = System.getProperty("devstudio.clangtidy.path"); //NOI18N
24.75 + if (toolPath != null) {
24.76 + result = toolPath;
24.77 + }
24.78 + }
24.79 + if (result.isEmpty()) {
24.80 + final String codeBase = getCodeBase();
24.81 + String relativePath = String.format("%s/%s-%s", CLANG_BINARY_NAME, CLANG_BINARY_NAME, codeBase); //NOI18N
24.82 + File toolFile = InstalledFileLocator.getDefault().locate(relativePath, codeBase, false);
24.83 + if (toolFile != null && toolFile.exists()) {
24.84 + toolFile.setExecutable(true);
24.85 + System.out.println(toolFile.canExecute());
24.86 + result = toolFile.getAbsolutePath();
24.87 + }
24.88 + }
24.89 + if (result.isEmpty()) {
24.90 + String toolPath = findInPaths();
24.91 + if (toolPath != null) {
24.92 + result = toolPath;
24.93 + }
24.94 + }
24.95 + if (result.isEmpty()) {
24.96 + return null;
24.97 + } else {
24.98 + if (!oldValue.equals(result)) {
24.99 + AnalyzerPreferences.getPreferences().put(CLANG_BINARY_PATH, result);
24.100 + }
24.101 + }
24.102 + return result;
24.103 + }
24.104 +
24.105 + public static String getMissingModuleName() {
24.106 + return "org.netbeans.modules.analysis.clangtidy." + getCodeBase(); //NOI18N
24.107 + }
24.108 +
24.109 + public static String getCodeBase() {
24.110 + HostInfo hostInfo = null;
24.111 + try {
24.112 + hostInfo = HostInfoUtils.getHostInfo(ExecutionEnvironmentFactory.getLocal());
24.113 + } catch (IOException ex) {
24.114 + ex.printStackTrace(System.err);
24.115 + } catch (ConnectionManager.CancellationException ex) {
24.116 + ex.printStackTrace(System.err);
24.117 + }
24.118 + String module = null;
24.119 + if (hostInfo != null) {
24.120 + switch (hostInfo.getOS().getFamily()) {
24.121 + case SUNOS:
24.122 + switch (hostInfo.getCpuFamily()) {
24.123 + case X86:
24.124 + switch (hostInfo.getOS().getBitness()) {
24.125 + case _32:
24.126 + module = "SunOS_x86"; // NOI18N
24.127 + break;
24.128 + case _64:
24.129 + module = "SunOS_x86_64"; // NOI18N
24.130 + break;
24.131 + }
24.132 + break;
24.133 + case SPARC:
24.134 + module = "SunOS_sparc"; // NOI18N
24.135 + break;
24.136 + }
24.137 + break;
24.138 + case LINUX:
24.139 + switch (hostInfo.getOS().getBitness()) {
24.140 + case _32:
24.141 + module = "Linux_x86"; // NOI18N
24.142 + break;
24.143 + case _64:
24.144 + module = "Linux_x86_64"; // NOI18N
24.145 + break;
24.146 + }
24.147 + break;
24.148 + case WINDOWS:
24.149 + switch (hostInfo.getOS().getBitness()) {
24.150 + case _32:
24.151 + module = "Windows_x86"; // NOI18N
24.152 + break;
24.153 + case _64:
24.154 + module = "Windows_x86_64"; // NOI18N
24.155 + break;
24.156 + }
24.157 + break;
24.158 + case MACOSX:
24.159 + switch (hostInfo.getOS().getBitness()) {
24.160 + case _32:
24.161 + module = "MacOSX_x86"; // NOI18N
24.162 + break;
24.163 + case _64:
24.164 + module = "MacOSX_x86_64"; // NOI18N
24.165 + break;
24.166 + }
24.167 + break;
24.168 + }
24.169 + }
24.170 + return module;
24.171 + }
24.172 +}
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/resources/Bundle.properties Sun Jun 25 18:25:05 2017 +0200
25.3 @@ -0,0 +1,6 @@
25.4 +fatals=fatal.unsupported.remote;fatal.tmp;fatal.analyze.error;fatal.language.flavor
25.5 +
25.6 +fatal.unsupported.remote= fatal: Unsupported remote mode
25.7 +fatal.tmp= fatal: Cannot create temporary file
25.8 +fatal.analyze.error= fatal: Unable to analyze file
25.9 +fatal.language.flavor= fatal: Clang-tidy can be used with C++11 or later standard only
25.10 \ No newline at end of file
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/resources/BundleUtilities.java Sun Jun 25 18:25:05 2017 +0200
26.3 @@ -0,0 +1,61 @@
26.4 +/*
26.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
26.6 + *
26.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
26.8 + *
26.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
26.10 + * Other names may be trademarks of their respective owners.
26.11 + *
26.12 + * The contents of this file are subject to the terms of either the GNU
26.13 + * General Public License Version 2 only ("GPL") or the Common
26.14 + * Development and Distribution License("CDDL") (collectively, the
26.15 + * "License"). You may not use this file except in compliance with the
26.16 + * License. You can obtain a copy of the License at
26.17 + * http://www.netbeans.org/cddl-gplv2.html
26.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
26.19 + * specific language governing permissions and limitations under the
26.20 + * License. When distributing the software, include this License Header
26.21 + * Notice in each file and include the License file at
26.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
26.23 + * particular file as subject to the "Classpath" exception as provided
26.24 + * by Oracle in the GPL Version 2 section of the License file that
26.25 + * accompanied this code. If applicable, add the following below the
26.26 + * License Header, with the fields enclosed by brackets [] replaced by
26.27 + * your own identifying information:
26.28 + * "Portions Copyrighted [year] [name of copyright owner]"
26.29 + *
26.30 + * If you wish your version of this file to be governed by only the CDDL
26.31 + * or only the GPL Version 2, indicate your decision by adding
26.32 + * "[Contributor] elects to include this software in this distribution
26.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
26.34 + * single choice of license, a recipient has the option to distribute
26.35 + * your version of this file under either the CDDL, the GPL Version 2 or
26.36 + * to extend the choice of license to its licensees as provided above.
26.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
26.38 + * Version 2 license, then the option applies only if the new code is
26.39 + * made subject to such option by the copyright holder.
26.40 + *
26.41 + * Contributor(s): Ilia Gromov
26.42 + */
26.43 +package com.sun.tools.ide.analysis.modernize.resources;
26.44 +
26.45 +import org.openide.util.NbBundle;
26.46 +
26.47 +/**
26.48 + *
26.49 + * @author Ilia Gromov
26.50 + */
26.51 +public class BundleUtilities {
26.52 +
26.53 + public static String[] getFlags() {
26.54 + return NbBundle.getMessage(BundleUtilities.class, "flags").split(";");
26.55 + }
26.56 +
26.57 + public static String getDescription(String key) {
26.58 + return NbBundle.getMessage(BundleUtilities.class, key);
26.59 + }
26.60 +
26.61 + public static String[] getFatalErrors() {
26.62 + return NbBundle.getMessage(BundleUtilities.class, "fatals").split(";");
26.63 + }
26.64 +}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/tools-clang-tools-extra.patch Sun Jun 25 18:25:05 2017 +0200
27.3 @@ -0,0 +1,139 @@
27.4 +Index: clang-tidy/ClangTidy.cpp
27.5 +===================================================================
27.6 +--- clang-tidy/ClangTidy.cpp (revision 278390)
27.7 ++++ clang-tidy/ClangTidy.cpp (working copy)
27.8 +@@ -35,6 +35,7 @@
27.9 + #include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
27.10 + #include "clang/Tooling/Refactoring.h"
27.11 + #include "clang/Tooling/ReplacementsYaml.h"
27.12 ++#include "clang/Tooling/DiagnosticsYaml.h"
27.13 + #include "clang/Tooling/Tooling.h"
27.14 + #include "llvm/Support/Process.h"
27.15 + #include "llvm/Support/Signals.h"
27.16 +@@ -509,13 +510,10 @@
27.17 +
27.18 + void exportReplacements(const std::vector<ClangTidyError> &Errors,
27.19 + raw_ostream &OS) {
27.20 +- tooling::TranslationUnitReplacements TUR;
27.21 +- for (const ClangTidyError &Error : Errors)
27.22 +- TUR.Replacements.insert(TUR.Replacements.end(), Error.Fix.begin(),
27.23 +- Error.Fix.end());
27.24 +-
27.25 + yaml::Output YAML(OS);
27.26 +- YAML << TUR;
27.27 ++ TranslationUnitDiagnostics TUD;
27.28 ++ TUD.Diags.insert(TUD.Diags.end(), Errors.begin(), Errors.end());
27.29 ++ YAML << TUD;
27.30 + }
27.31 +
27.32 + } // namespace tidy
27.33 +Index: clang-tidy/ClangTidyDiagnosticConsumer.cpp
27.34 +===================================================================
27.35 +--- clang-tidy/ClangTidyDiagnosticConsumer.cpp (revision 278390)
27.36 ++++ clang-tidy/ClangTidyDiagnosticConsumer.cpp (working copy)
27.37 +@@ -102,25 +102,6 @@
27.38 + };
27.39 + } // end anonymous namespace
27.40 +
27.41 +-ClangTidyMessage::ClangTidyMessage(StringRef Message)
27.42 +- : Message(Message), FileOffset(0) {}
27.43 +-
27.44 +-ClangTidyMessage::ClangTidyMessage(StringRef Message,
27.45 +- const SourceManager &Sources,
27.46 +- SourceLocation Loc)
27.47 +- : Message(Message) {
27.48 +- assert(Loc.isValid() && Loc.isFileID());
27.49 +- FilePath = Sources.getFilename(Loc);
27.50 +- FileOffset = Sources.getFileOffset(Loc);
27.51 +-}
27.52 +-
27.53 +-ClangTidyError::ClangTidyError(StringRef CheckName,
27.54 +- ClangTidyError::Level DiagLevel,
27.55 +- bool IsWarningAsError,
27.56 +- StringRef BuildDirectory)
27.57 +- : CheckName(CheckName), BuildDirectory(BuildDirectory), DiagLevel(DiagLevel),
27.58 +- IsWarningAsError(IsWarningAsError) {}
27.59 +-
27.60 + // Returns true if GlobList starts with the negative indicator ('-'), removes it
27.61 + // from the GlobList.
27.62 + static bool ConsumeNegativeIndicator(StringRef &GlobList) {
27.63 +Index: clang-tidy/ClangTidyDiagnosticConsumer.h
27.64 +===================================================================
27.65 +--- clang-tidy/ClangTidyDiagnosticConsumer.h (revision 278390)
27.66 ++++ clang-tidy/ClangTidyDiagnosticConsumer.h (working copy)
27.67 +@@ -14,6 +14,7 @@
27.68 + #include "clang/Basic/Diagnostic.h"
27.69 + #include "clang/Basic/SourceManager.h"
27.70 + #include "clang/Tooling/Refactoring.h"
27.71 ++#include "clang/Tooling/Core/Diagnostics.h"
27.72 + #include "llvm/ADT/DenseMap.h"
27.73 + #include "llvm/ADT/StringMap.h"
27.74 + #include "llvm/Support/Regex.h"
27.75 +@@ -32,52 +33,9 @@
27.76 +
27.77 + namespace tidy {
27.78 +
27.79 +-/// \brief A message from a clang-tidy check.
27.80 +-///
27.81 +-/// Note that this is independent of a \c SourceManager.
27.82 +-struct ClangTidyMessage {
27.83 +- ClangTidyMessage(StringRef Message = "");
27.84 +- ClangTidyMessage(StringRef Message, const SourceManager &Sources,
27.85 +- SourceLocation Loc);
27.86 +- std::string Message;
27.87 +- std::string FilePath;
27.88 +- unsigned FileOffset;
27.89 +-};
27.90 ++typedef clang::tooling::DiagnosticsMessage ClangTidyMessage;
27.91 ++typedef clang::tooling::Diagnostics ClangTidyError;
27.92 +
27.93 +-/// \brief A detected error complete with information to display diagnostic and
27.94 +-/// automatic fix.
27.95 +-///
27.96 +-/// This is used as an intermediate format to transport Diagnostics without a
27.97 +-/// dependency on a SourceManager.
27.98 +-///
27.99 +-/// FIXME: Make Diagnostics flexible enough to support this directly.
27.100 +-struct ClangTidyError {
27.101 +- enum Level {
27.102 +- Warning = DiagnosticsEngine::Warning,
27.103 +- Error = DiagnosticsEngine::Error
27.104 +- };
27.105 +-
27.106 +- ClangTidyError(StringRef CheckName, Level DiagLevel, bool IsWarningAsError,
27.107 +- StringRef BuildDirectory);
27.108 +-
27.109 +- std::string CheckName;
27.110 +- ClangTidyMessage Message;
27.111 +- tooling::Replacements Fix;
27.112 +- SmallVector<ClangTidyMessage, 1> Notes;
27.113 +-
27.114 +- // A build directory of the diagnostic source file.
27.115 +- //
27.116 +- // It's an absolute path which is `directory` field of the source file in
27.117 +- // compilation database. If users don't specify the compilation database
27.118 +- // directory, it is the current directory where clang-tidy runs.
27.119 +- //
27.120 +- // Note: it is empty in unittest.
27.121 +- std::string BuildDirectory;
27.122 +-
27.123 +- Level DiagLevel;
27.124 +- bool IsWarningAsError;
27.125 +-};
27.126 +-
27.127 + /// \brief Read-only set of strings represented as a list of positive and
27.128 + /// negative globs. Positive globs add all matched strings to the set, negative
27.129 + /// globs remove them in the order of appearance in the list.
27.130 +Index: clang-tidy/tool/ClangTidyMain.cpp
27.131 +===================================================================
27.132 +--- clang-tidy/tool/ClangTidyMain.cpp (revision 278390)
27.133 ++++ clang-tidy/tool/ClangTidyMain.cpp (working copy)
27.134 +@@ -389,7 +389,7 @@
27.135 +
27.136 + // -fix-errors implies -fix.
27.137 + handleErrors(Errors, (FixErrors || Fix) && !DisableFixes, WErrorCount);
27.138 +-
27.139 ++
27.140 + if (!ExportFixes.empty() && !Errors.empty()) {
27.141 + std::error_code EC;
27.142 + llvm::raw_fd_ostream OS(ExportFixes, EC, llvm::sys::fs::F_None);
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/tools-clang.patch Sun Jun 25 18:25:05 2017 +0200
28.3 @@ -0,0 +1,461 @@
28.4 +Index: include/clang/Tooling/Core/Diagnostics.h
28.5 +===================================================================
28.6 +--- include/clang/Tooling/Core/Diagnostics.h (revision 278390)
28.7 ++++ include/clang/Tooling/Core/Diagnostics.h (working copy)
28.8 +@@ -1,254 +1,54 @@
28.9 +-//===--- Replacement.h - Framework for clang refactoring tools --*- C++ -*-===//
28.10 +-//
28.11 +-// The LLVM Compiler Infrastructure
28.12 +-//
28.13 +-// This file is distributed under the University of Illinois Open Source
28.14 +-// License. See LICENSE.TXT for details.
28.15 +-//
28.16 +-//===----------------------------------------------------------------------===//
28.17 +-//
28.18 +-// Classes supporting refactorings that span multiple translation units.
28.19 +-// While single translation unit refactorings are supported via the Rewriter,
28.20 +-// when refactoring multiple translation units changes must be stored in a
28.21 +-// SourceManager independent form, duplicate changes need to be removed, and
28.22 +-// all changes must be applied at once at the end of the refactoring so that
28.23 +-// the code is always parseable.
28.24 +-//
28.25 +-//===----------------------------------------------------------------------===//
28.26 +-
28.27 +-#ifndef LLVM_CLANG_TOOLING_CORE_REPLACEMENT_H
28.28 +-#define LLVM_CLANG_TOOLING_CORE_REPLACEMENT_H
28.29 +-
28.30 +-#include "clang/Basic/LangOptions.h"
28.31 +-#include "clang/Basic/SourceLocation.h"
28.32 +-#include "llvm/ADT/StringRef.h"
28.33 +-#include "llvm/Support/Error.h"
28.34 +-#include <map>
28.35 +-#include <set>
28.36 ++#ifndef LLVM_CLANG_TOOLING_CORE_DIAGNOSTICS_H
28.37 ++#define LLVM_CLANG_TOOLING_CORE_DIAGNOSTICS_H
28.38 ++#include "clang/Basic/Diagnostic.h"
28.39 ++#include "llvm/ADT/SmallVector.h"
28.40 ++#include "Replacement.h"
28.41 + #include <string>
28.42 +-#include <vector>
28.43 +-
28.44 + namespace clang {
28.45 ++ namespace tooling {
28.46 +
28.47 +-class Rewriter;
28.48 ++ struct DiagnosticsMessage {
28.49 ++ DiagnosticsMessage(StringRef Message = "");
28.50 ++ DiagnosticsMessage(StringRef Message, const SourceManager &Sources,
28.51 ++ SourceLocation Loc);
28.52 ++ std::string Message;
28.53 ++ std::string FilePath;
28.54 ++ unsigned FileOffset;
28.55 ++ };
28.56 +
28.57 +-namespace tooling {
28.58 ++ struct Diagnostics {
28.59 +
28.60 +-/// \brief A source range independent of the \c SourceManager.
28.61 +-class Range {
28.62 +-public:
28.63 +- Range() : Offset(0), Length(0) {}
28.64 +- Range(unsigned Offset, unsigned Length) : Offset(Offset), Length(Length) {}
28.65 ++ enum Level {
28.66 ++ Warning = DiagnosticsEngine::Warning,
28.67 ++ Error = DiagnosticsEngine::Error
28.68 ++ };
28.69 +
28.70 +- /// \brief Accessors.
28.71 +- /// @{
28.72 +- unsigned getOffset() const { return Offset; }
28.73 +- unsigned getLength() const { return Length; }
28.74 +- /// @}
28.75 ++ Diagnostics();
28.76 ++ Diagnostics(StringRef CheckName, Level DiagLevel, bool IsWarningAsError,
28.77 ++ StringRef BuildDirectory);
28.78 ++ std::string CheckName;
28.79 ++ DiagnosticsMessage Message;
28.80 ++ tooling::Replacements Fix;
28.81 ++ SmallVector<DiagnosticsMessage, 1> Notes;
28.82 +
28.83 +- /// \name Range Predicates
28.84 +- /// @{
28.85 +- /// \brief Whether this range overlaps with \p RHS or not.
28.86 +- bool overlapsWith(Range RHS) const {
28.87 +- return Offset + Length > RHS.Offset && Offset < RHS.Offset + RHS.Length;
28.88 +- }
28.89 ++ // A build directory of the diagnostic source file.
28.90 ++ //
28.91 ++ // It's an absolute path which is `directory` field of the source file in
28.92 ++ // compilation database. If users don't specify the compilation database
28.93 ++ // directory, it is the current directory where clang-tidy runs.
28.94 ++ //
28.95 ++ // Note: it is empty in unittest.
28.96 ++ std::string BuildDirectory;
28.97 +
28.98 +- /// \brief Whether this range contains \p RHS or not.
28.99 +- bool contains(Range RHS) const {
28.100 +- return RHS.Offset >= Offset &&
28.101 +- (RHS.Offset + RHS.Length) <= (Offset + Length);
28.102 +- }
28.103 ++ Level DiagLevel;
28.104 ++ bool IsWarningAsError;
28.105 ++ };
28.106 +
28.107 +- /// \brief Whether this range equals to \p RHS or not.
28.108 +- bool operator==(const Range &RHS) const {
28.109 +- return Offset == RHS.getOffset() && Length == RHS.getLength();
28.110 +- }
28.111 +- /// @}
28.112 +-
28.113 +-private:
28.114 +- unsigned Offset;
28.115 +- unsigned Length;
28.116 +-};
28.117 +-
28.118 +-/// \brief A text replacement.
28.119 +-///
28.120 +-/// Represents a SourceManager independent replacement of a range of text in a
28.121 +-/// specific file.
28.122 +-class Replacement {
28.123 +-public:
28.124 +- /// \brief Creates an invalid (not applicable) replacement.
28.125 +- Replacement();
28.126 +-
28.127 +- /// \brief Creates a replacement of the range [Offset, Offset+Length) in
28.128 +- /// FilePath with ReplacementText.
28.129 +- ///
28.130 +- /// \param FilePath A source file accessible via a SourceManager.
28.131 +- /// \param Offset The byte offset of the start of the range in the file.
28.132 +- /// \param Length The length of the range in bytes.
28.133 +- Replacement(StringRef FilePath, unsigned Offset, unsigned Length,
28.134 +- StringRef ReplacementText);
28.135 +-
28.136 +- /// \brief Creates a Replacement of the range [Start, Start+Length) with
28.137 +- /// ReplacementText.
28.138 +- Replacement(const SourceManager &Sources, SourceLocation Start,
28.139 +- unsigned Length, StringRef ReplacementText);
28.140 +-
28.141 +- /// \brief Creates a Replacement of the given range with ReplacementText.
28.142 +- Replacement(const SourceManager &Sources, const CharSourceRange &Range,
28.143 +- StringRef ReplacementText,
28.144 +- const LangOptions &LangOpts = LangOptions());
28.145 +-
28.146 +- /// \brief Creates a Replacement of the node with ReplacementText.
28.147 +- template <typename Node>
28.148 +- Replacement(const SourceManager &Sources, const Node &NodeToReplace,
28.149 +- StringRef ReplacementText,
28.150 +- const LangOptions &LangOpts = LangOptions());
28.151 +-
28.152 +- /// \brief Returns whether this replacement can be applied to a file.
28.153 +- ///
28.154 +- /// Only replacements that are in a valid file can be applied.
28.155 +- bool isApplicable() const;
28.156 +-
28.157 +- /// \brief Accessors.
28.158 +- /// @{
28.159 +- StringRef getFilePath() const { return FilePath; }
28.160 +- unsigned getOffset() const { return ReplacementRange.getOffset(); }
28.161 +- unsigned getLength() const { return ReplacementRange.getLength(); }
28.162 +- StringRef getReplacementText() const { return ReplacementText; }
28.163 +- /// @}
28.164 +-
28.165 +- /// \brief Applies the replacement on the Rewriter.
28.166 +- bool apply(Rewriter &Rewrite) const;
28.167 +-
28.168 +- /// \brief Returns a human readable string representation.
28.169 +- std::string toString() const;
28.170 +-
28.171 +- private:
28.172 +- void setFromSourceLocation(const SourceManager &Sources,
28.173 +- SourceLocation Start, unsigned Length,
28.174 +- StringRef ReplacementText);
28.175 +- void setFromSourceRange(const SourceManager &Sources,
28.176 +- const CharSourceRange &Range,
28.177 +- StringRef ReplacementText,
28.178 +- const LangOptions &LangOpts);
28.179 +-
28.180 +- std::string FilePath;
28.181 +- Range ReplacementRange;
28.182 +- std::string ReplacementText;
28.183 +-};
28.184 +-
28.185 +-/// \brief Less-than operator between two Replacements.
28.186 +-bool operator<(const Replacement &LHS, const Replacement &RHS);
28.187 +-
28.188 +-/// \brief Equal-to operator between two Replacements.
28.189 +-bool operator==(const Replacement &LHS, const Replacement &RHS);
28.190 +-
28.191 +-/// \brief A set of Replacements.
28.192 +-/// FIXME: Change to a vector and deduplicate in the RefactoringTool.
28.193 +-typedef std::set<Replacement> Replacements;
28.194 +-
28.195 +-/// \brief Apply all replacements in \p Replaces to the Rewriter \p Rewrite.
28.196 +-///
28.197 +-/// Replacement applications happen independently of the success of
28.198 +-/// other applications.
28.199 +-///
28.200 +-/// \returns true if all replacements apply. false otherwise.
28.201 +-bool applyAllReplacements(const Replacements &Replaces, Rewriter &Rewrite);
28.202 +-
28.203 +-/// \brief Apply all replacements in \p Replaces to the Rewriter \p Rewrite.
28.204 +-///
28.205 +-/// Replacement applications happen independently of the success of
28.206 +-/// other applications.
28.207 +-///
28.208 +-/// \returns true if all replacements apply. false otherwise.
28.209 +-bool applyAllReplacements(const std::vector<Replacement> &Replaces,
28.210 +- Rewriter &Rewrite);
28.211 +-
28.212 +-/// \brief Applies all replacements in \p Replaces to \p Code.
28.213 +-///
28.214 +-/// This completely ignores the path stored in each replacement. If all
28.215 +-/// replacements are applied successfully, this returns the code with
28.216 +-/// replacements applied; otherwise, an llvm::Error carrying llvm::StringError
28.217 +-/// is returned (the Error message can be converted to string using
28.218 +-/// `llvm::toString()` and 'std::error_code` in the `Error` should be ignored).
28.219 +-llvm::Expected<std::string> applyAllReplacements(StringRef Code,
28.220 +- const Replacements &Replaces);
28.221 +-
28.222 +-/// \brief Calculates how a code \p Position is shifted when \p Replaces are
28.223 +-/// applied.
28.224 +-unsigned shiftedCodePosition(const Replacements& Replaces, unsigned Position);
28.225 +-
28.226 +-/// \brief Calculates how a code \p Position is shifted when \p Replaces are
28.227 +-/// applied.
28.228 +-///
28.229 +-/// \pre Replaces[i].getOffset() <= Replaces[i+1].getOffset().
28.230 +-unsigned shiftedCodePosition(const std::vector<Replacement> &Replaces,
28.231 +- unsigned Position);
28.232 +-
28.233 +-/// \brief Removes duplicate Replacements and reports if Replacements conflict
28.234 +-/// with one another. All Replacements are assumed to be in the same file.
28.235 +-///
28.236 +-/// \post Replaces[i].getOffset() <= Replaces[i+1].getOffset().
28.237 +-///
28.238 +-/// This function sorts \p Replaces so that conflicts can be reported simply by
28.239 +-/// offset into \p Replaces and number of elements in the conflict.
28.240 +-void deduplicate(std::vector<Replacement> &Replaces,
28.241 +- std::vector<Range> &Conflicts);
28.242 +-
28.243 +-/// \brief Collection of Replacements generated from a single translation unit.
28.244 +-struct TranslationUnitReplacements {
28.245 +- /// Name of the main source for the translation unit.
28.246 +- std::string MainSourceFile;
28.247 +-
28.248 +- /// A freeform chunk of text to describe the context of the replacements.
28.249 +- /// Will be printed, for example, when detecting conflicts during replacement
28.250 +- /// deduplication.
28.251 +- std::string Context;
28.252 +-
28.253 +- std::vector<Replacement> Replacements;
28.254 +-};
28.255 +-
28.256 +-/// \brief Calculates the ranges in a single file that are affected by the
28.257 +-/// Replacements. Overlapping ranges will be merged.
28.258 +-///
28.259 +-/// \pre Replacements must be for the same file.
28.260 +-///
28.261 +-/// \returns a non-overlapping and sorted ranges.
28.262 +-std::vector<Range> calculateChangedRanges(const Replacements &Replaces);
28.263 +-
28.264 +-/// \brief Calculates the new ranges after \p Replaces are applied. These
28.265 +-/// include both the original \p Ranges and the affected ranges of \p Replaces
28.266 +-/// in the new code.
28.267 +-///
28.268 +-/// \pre Replacements must be for the same file.
28.269 +-///
28.270 +-/// \return The new ranges after \p Replaces are applied. The new ranges will be
28.271 +-/// sorted and non-overlapping.
28.272 +-std::vector<Range>
28.273 +-calculateRangesAfterReplacements(const Replacements &Replaces,
28.274 +- const std::vector<Range> &Ranges);
28.275 +-
28.276 +-/// \brief Groups a random set of replacements by file path. Replacements
28.277 +-/// related to the same file entry are put into the same vector.
28.278 +-std::map<std::string, Replacements>
28.279 +-groupReplacementsByFile(const Replacements &Replaces);
28.280 +-
28.281 +-/// \brief Merges two sets of replacements with the second set referring to the
28.282 +-/// code after applying the first set. Within both 'First' and 'Second',
28.283 +-/// replacements must not overlap.
28.284 +-Replacements mergeReplacements(const Replacements &First,
28.285 +- const Replacements &Second);
28.286 +-
28.287 +-template <typename Node>
28.288 +-Replacement::Replacement(const SourceManager &Sources,
28.289 +- const Node &NodeToReplace, StringRef ReplacementText,
28.290 +- const LangOptions &LangOpts) {
28.291 +- const CharSourceRange Range =
28.292 +- CharSourceRange::getTokenRange(NodeToReplace->getSourceRange());
28.293 +- setFromSourceRange(Sources, Range, ReplacementText, LangOpts);
28.294 ++ struct TranslationUnitDiagnostics {
28.295 ++ std::string MainSourceFile;
28.296 ++ std::string Context;
28.297 ++ std::vector<Diagnostics> Diags;
28.298 ++ };
28.299 ++ }
28.300 + }
28.301 +-
28.302 +-} // end namespace tooling
28.303 +-} // end namespace clang
28.304 +-
28.305 +-#endif // LLVM_CLANG_TOOLING_CORE_REPLACEMENT_H
28.306 ++#endif
28.307 +\ No newline at end of file
28.308 +Index: lib/Tooling/Core/CMakeLists.txt
28.309 +===================================================================
28.310 +--- lib/Tooling/Core/CMakeLists.txt (revision 278390)
28.311 ++++ lib/Tooling/Core/CMakeLists.txt (working copy)
28.312 +@@ -3,6 +3,7 @@
28.313 + add_clang_library(clangToolingCore
28.314 + Lookup.cpp
28.315 + Replacement.cpp
28.316 ++ Diagnostics.cpp
28.317 + QualTypeNames.cpp
28.318 +
28.319 + LINK_LIBS
28.320 +Index: lib/Tooling/Core/Diagnostics.cpp
28.321 +===================================================================
28.322 +--- lib/Tooling/Core/Diagnostics.cpp (revision 278390)
28.323 ++++ lib/Tooling/Core/Diagnostics.cpp (working copy)
28.324 +@@ -1,113 +1,30 @@
28.325 +-//===--- Lookup.cpp - Framework for clang refactoring tools ---------------===//
28.326 +-//
28.327 +-// The LLVM Compiler Infrastructure
28.328 +-//
28.329 +-// This file is distributed under the University of Illinois Open Source
28.330 +-// License. See LICENSE.TXT for details.
28.331 +-//
28.332 +-//===----------------------------------------------------------------------===//
28.333 +-//
28.334 +-// This file defines helper methods for clang tools performing name lookup.
28.335 +-//
28.336 +-//===----------------------------------------------------------------------===//
28.337 ++#include "clang/Tooling/Core/Diagnostics.h"
28.338 ++#include "clang/Basic/SourceManager.h"
28.339 ++namespace clang {
28.340 ++ namespace tooling {
28.341 +
28.342 +-#include "clang/Tooling/Core/Lookup.h"
28.343 +-#include "clang/AST/Decl.h"
28.344 +-using namespace clang;
28.345 +-using namespace clang::tooling;
28.346 ++ DiagnosticsMessage::DiagnosticsMessage(StringRef Message)
28.347 ++ : Message(Message), FileOffset(0) {
28.348 ++ }
28.349 +
28.350 +-static bool isInsideDifferentNamespaceWithSameName(const DeclContext *DeclA,
28.351 +- const DeclContext *DeclB) {
28.352 +- while (true) {
28.353 +- // Look past non-namespaces on DeclA.
28.354 +- while (DeclA && !isa<NamespaceDecl>(DeclA))
28.355 +- DeclA = DeclA->getParent();
28.356 ++ DiagnosticsMessage::DiagnosticsMessage(StringRef Message,
28.357 ++ const SourceManager &Sources,
28.358 ++ SourceLocation Loc)
28.359 ++ : Message(Message) {
28.360 ++ assert(Loc.isValid() && Loc.isFileID());
28.361 ++ FilePath = Sources.getFilename(Loc);
28.362 ++ FileOffset = Sources.getFileOffset(Loc);
28.363 ++ }
28.364 +
28.365 +- // Look past non-namespaces on DeclB.
28.366 +- while (DeclB && !isa<NamespaceDecl>(DeclB))
28.367 +- DeclB = DeclB->getParent();
28.368 ++ Diagnostics::Diagnostics() {
28.369 ++ }
28.370 +
28.371 +- // We hit the root, no namespace collision.
28.372 +- if (!DeclA || !DeclB)
28.373 +- return false;
28.374 +-
28.375 +- // Literally the same namespace, not a collision.
28.376 +- if (DeclA == DeclB)
28.377 +- return false;
28.378 +-
28.379 +- // Now check the names. If they match we have a different namespace with the
28.380 +- // same name.
28.381 +- if (cast<NamespaceDecl>(DeclA)->getDeclName() ==
28.382 +- cast<NamespaceDecl>(DeclB)->getDeclName())
28.383 +- return true;
28.384 +-
28.385 +- DeclA = DeclA->getParent();
28.386 +- DeclB = DeclB->getParent();
28.387 +- }
28.388 +-}
28.389 +-
28.390 +-static StringRef getBestNamespaceSubstr(const DeclContext *DeclA,
28.391 +- StringRef NewName,
28.392 +- bool HadLeadingColonColon) {
28.393 +- while (true) {
28.394 +- while (DeclA && !isa<NamespaceDecl>(DeclA))
28.395 +- DeclA = DeclA->getParent();
28.396 +-
28.397 +- // Fully qualified it is! Leave :: in place if it's there already.
28.398 +- if (!DeclA)
28.399 +- return HadLeadingColonColon ? NewName : NewName.substr(2);
28.400 +-
28.401 +- // Otherwise strip off redundant namespace qualifications from the new name.
28.402 +- // We use the fully qualified name of the namespace and remove that part
28.403 +- // from NewName if it has an identical prefix.
28.404 +- std::string NS =
28.405 +- "::" + cast<NamespaceDecl>(DeclA)->getQualifiedNameAsString() + "::";
28.406 +- if (NewName.startswith(NS))
28.407 +- return NewName.substr(NS.size());
28.408 +-
28.409 +- // No match yet. Strip of a namespace from the end of the chain and try
28.410 +- // again. This allows to get optimal qualifications even if the old and new
28.411 +- // decl only share common namespaces at a higher level.
28.412 +- DeclA = DeclA->getParent();
28.413 +- }
28.414 +-}
28.415 +-
28.416 +-/// Check if the name specifier begins with a written "::".
28.417 +-static bool isFullyQualified(const NestedNameSpecifier *NNS) {
28.418 +- while (NNS) {
28.419 +- if (NNS->getKind() == NestedNameSpecifier::Global)
28.420 +- return true;
28.421 +- NNS = NNS->getPrefix();
28.422 +- }
28.423 +- return false;
28.424 +-}
28.425 +-
28.426 +-std::string tooling::replaceNestedName(const NestedNameSpecifier *Use,
28.427 +- const DeclContext *UseContext,
28.428 +- const NamedDecl *FromDecl,
28.429 +- StringRef ReplacementString) {
28.430 +- assert(ReplacementString.startswith("::") &&
28.431 +- "Expected fully-qualified name!");
28.432 +-
28.433 +- // We can do a raw name replacement when we are not inside the namespace for
28.434 +- // the original function and it is not in the global namespace. The
28.435 +- // assumption is that outside the original namespace we must have a using
28.436 +- // statement that makes this work out and that other parts of this refactor
28.437 +- // will automatically fix using statements to point to the new function
28.438 +- const bool class_name_only = !Use;
28.439 +- const bool in_global_namespace =
28.440 +- isa<TranslationUnitDecl>(FromDecl->getDeclContext());
28.441 +- if (class_name_only && !in_global_namespace &&
28.442 +- !isInsideDifferentNamespaceWithSameName(FromDecl->getDeclContext(),
28.443 +- UseContext)) {
28.444 +- auto Pos = ReplacementString.rfind("::");
28.445 +- return Pos != StringRef::npos ? ReplacementString.substr(Pos + 2)
28.446 +- : ReplacementString;
28.447 +- }
28.448 +- // We did not match this because of a using statement, so we will need to
28.449 +- // figure out how good a namespace match we have with our destination type.
28.450 +- // We work backwards (from most specific possible namespace to least
28.451 +- // specific).
28.452 +- return getBestNamespaceSubstr(UseContext, ReplacementString,
28.453 +- isFullyQualified(Use));
28.454 +-}
28.455 ++ Diagnostics::Diagnostics(StringRef CheckName,
28.456 ++ Diagnostics::Level DiagLevel,
28.457 ++ bool IsWarningAsError,
28.458 ++ StringRef BuildDirectory)
28.459 ++ : CheckName(CheckName), BuildDirectory(BuildDirectory), DiagLevel(DiagLevel),
28.460 ++ IsWarningAsError(IsWarningAsError) {
28.461 ++ }
28.462 ++ }
28.463 ++}
28.464 +\ No newline at end of file
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/utils/AnalyticsTools.java Sun Jun 25 18:25:05 2017 +0200
29.3 @@ -0,0 +1,208 @@
29.4 +/*
29.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
29.6 + *
29.7 + * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
29.8 + *
29.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
29.10 + * Other names may be trademarks of their respective owners.
29.11 + *
29.12 + * The contents of this file are subject to the terms of either the GNU
29.13 + * General Public License Version 2 only ("GPL") or the Common
29.14 + * Development and Distribution License("CDDL") (collectively, the
29.15 + * "License"). You may not use this file except in compliance with the
29.16 + * License. You can obtain a copy of the License at
29.17 + * http://www.netbeans.org/cddl-gplv2.html
29.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
29.19 + * specific language governing permissions and limitations under the
29.20 + * License. When distributing the software, include this License Header
29.21 + * Notice in each file and include the License file at
29.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
29.23 + * particular file as subject to the "Classpath" exception as provided
29.24 + * by Oracle in the GPL Version 2 section of the License file that
29.25 + * accompanied this code. If applicable, add the following below the
29.26 + * License Header, with the fields enclosed by brackets [] replaced by
29.27 + * your own identifying information:
29.28 + * "Portions Copyrighted [year] [name of copyright owner]"
29.29 + *
29.30 + * If you wish your version of this file to be governed by only the CDDL
29.31 + * or only the GPL Version 2, indicate your decision by adding
29.32 + * "[Contributor] elects to include this software in this distribution
29.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
29.34 + * single choice of license, a recipient has the option to distribute
29.35 + * your version of this file under either the CDDL, the GPL Version 2 or
29.36 + * to extend the choice of license to its licensees as provided above.
29.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
29.38 + * Version 2 license, then the option applies only if the new code is
29.39 + * made subject to such option by the copyright holder.
29.40 + *
29.41 + * Contributor(s): Ilia Gromov
29.42 + */
29.43 +package com.sun.tools.ide.analysis.modernize.utils;
29.44 +
29.45 +import com.sun.tools.ide.analysis.modernize.impl.ModernizeErrorProvider;
29.46 +import java.util.ArrayList;
29.47 +import java.util.List;
29.48 +import org.netbeans.api.project.FileOwnerQuery;
29.49 +import org.netbeans.api.project.Project;
29.50 +import org.netbeans.modules.analysis.spi.Analyzer;
29.51 +import org.netbeans.modules.cnd.analysis.api.AnalyzerResponse;
29.52 +import org.netbeans.modules.cnd.api.model.CsmFile;
29.53 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
29.54 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
29.55 +import org.netbeans.modules.cnd.api.project.NativeFileItem;
29.56 +import org.netbeans.modules.cnd.api.remote.RemoteProject;
29.57 +import org.netbeans.modules.cnd.api.toolchain.CompilerSet;
29.58 +import org.netbeans.modules.cnd.api.toolchain.PredefinedToolKind;
29.59 +import org.netbeans.modules.cnd.api.toolchain.Tool;
29.60 +import org.netbeans.modules.cnd.makeproject.api.configurations.ConfigurationDescriptorProvider;
29.61 +import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
29.62 +import org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfigurationDescriptor;
29.63 +import org.netbeans.modules.cnd.spi.toolchain.ToolchainProject;
29.64 +import org.netbeans.modules.cnd.utils.MIMENames;
29.65 +import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
29.66 +import org.openide.filesystems.FileObject;
29.67 +import org.openide.util.Lookup;
29.68 +
29.69 +/**
29.70 + *
29.71 + * @author Ilia Gromov
29.72 + */
29.73 +public class AnalyticsTools {
29.74 +
29.75 + public static ExecutionEnvironment detectEnvironment(Analyzer.Context context) {
29.76 + if (context.getScope() == null) {
29.77 + return null;
29.78 + }
29.79 + for (FileObject fo : context.getScope().getFiles()) {
29.80 + String mimeType = fo.getMIMEType();
29.81 + if (MIMENames.isHeaderOrCppOrC(mimeType)) {
29.82 + Project project = FileOwnerQuery.getOwner(fo);
29.83 + RemoteProject info = project.getLookup().lookup(RemoteProject.class);
29.84 + if (info != null) {
29.85 + ExecutionEnvironment dh = info.getDevelopmentHost();
29.86 + if (dh != null) {
29.87 + return dh;
29.88 + }
29.89 + }
29.90 + }
29.91 + }
29.92 + return null;
29.93 + }
29.94 +
29.95 + public static CompilerSet toolchain(Lookup.Provider project) {
29.96 + ToolchainProject toolchain = project.getLookup().lookup(ToolchainProject.class);
29.97 + if (toolchain != null) {
29.98 + return toolchain.getCompilerSet();
29.99 + }
29.100 + return null;
29.101 + }
29.102 +
29.103 + public static MakeConfigurationDescriptor getConfigurationDescriptor(CsmFile file, Lookup.Provider project) {
29.104 + if (file != null) {
29.105 + ConfigurationDescriptorProvider pdp = project.getLookup().lookup(ConfigurationDescriptorProvider.class);
29.106 + if (pdp != null) {
29.107 + MakeConfigurationDescriptor makeConfigurationDescriptor = pdp.getConfigurationDescriptor();
29.108 + if (makeConfigurationDescriptor != null) {
29.109 + return makeConfigurationDescriptor;
29.110 + }
29.111 + }
29.112 + }
29.113 +
29.114 + return null;
29.115 + }
29.116 +
29.117 + public static Item findItem(CsmFile file, Lookup.Provider project) {
29.118 + return getConfigurationDescriptor(file, project).findProjectItemByPath(file.getAbsolutePath().toString());
29.119 + }
29.120 +
29.121 + public static void fatalError(AnalyzerResponse.AnalyzerSeverity severity, String id, String message, CsmFile file, CsmErrorProvider.Response response) {
29.122 + CsmErrorInfo fatal = new ModernizeErrorProvider.FatalErrorInfo(id, message);
29.123 + if (response instanceof AnalyzerResponse) {
29.124 + AnalyzerResponse ar = (AnalyzerResponse) response;
29.125 + ar.addError(severity, message, file.getFileObject(), fatal); //NOI18N
29.126 + } else {
29.127 + response.addError(fatal); //NOI18N
29.128 + }
29.129 + }
29.130 +
29.131 + public static String useTool(Item item, Lookup.Provider project) {
29.132 + ToolchainProject toolchain = project.getLookup().lookup(ToolchainProject.class);
29.133 + if (toolchain != null) {
29.134 + CompilerSet set = toolchain.getCompilerSet();
29.135 + if (set != null) {
29.136 + if (set.getCompilerFlavor().isSunStudioCompiler()) {
29.137 + if (item.getLanguage() == NativeFileItem.Language.C) {
29.138 + return set.findTool(PredefinedToolKind.CCompiler).getPath();
29.139 + } else {
29.140 + return set.findTool(PredefinedToolKind.CCCompiler).getPath();
29.141 + }
29.142 + }
29.143 + }
29.144 + }
29.145 + return null;
29.146 + }
29.147 +
29.148 + public static Tool compiler(Item item, Lookup.Provider project) {
29.149 + CompilerSet set = toolchain(project);
29.150 + if (set != null) {
29.151 + if (item.getLanguage() == NativeFileItem.Language.C) {
29.152 + return set.findTool(PredefinedToolKind.CCompiler);
29.153 + } else {
29.154 + return set.findTool(PredefinedToolKind.CCCompiler);
29.155 + }
29.156 + }
29.157 + return null;
29.158 + }
29.159 +
29.160 + public static List<String> scanCommandLine(String line) {
29.161 + List<String> res = new ArrayList<String>();
29.162 + int i = 0;
29.163 + StringBuilder current = new StringBuilder();
29.164 + boolean isSingleQuoteMode = false;
29.165 + boolean isDoubleQuoteMode = false;
29.166 + while (i < line.length()) {
29.167 + char c = line.charAt(i);
29.168 + i++;
29.169 + switch (c) {
29.170 + case '\'': // NOI18N
29.171 + if (isSingleQuoteMode) {
29.172 + isSingleQuoteMode = false;
29.173 + } else if (!isDoubleQuoteMode) {
29.174 + isSingleQuoteMode = true;
29.175 + }
29.176 + current.append(c);
29.177 + break;
29.178 + case '\"': // NOI18N
29.179 + if (isDoubleQuoteMode) {
29.180 + isDoubleQuoteMode = false;
29.181 + } else if (!isSingleQuoteMode) {
29.182 + isDoubleQuoteMode = true;
29.183 + }
29.184 + current.append(c);
29.185 + break;
29.186 + case ' ': // NOI18N
29.187 + case '\t': // NOI18N
29.188 + case '\n': // NOI18N
29.189 + case '\r': // NOI18N
29.190 + if (isSingleQuoteMode || isDoubleQuoteMode) {
29.191 + current.append(c);
29.192 + break;
29.193 + } else {
29.194 + if (current.length() > 0) {
29.195 + res.add(current.toString());
29.196 + current.setLength(0);
29.197 + }
29.198 + }
29.199 + break;
29.200 + default:
29.201 + current.append(c);
29.202 + break;
29.203 + }
29.204 + }
29.205 + if (current.length() > 0) {
29.206 + res.add(current.toString());
29.207 + }
29.208 + return res;
29.209 + }
29.210 +
29.211 +}
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/clang-tidy-3.9-README.txt Sun Jun 25 18:25:05 2017 +0200
30.3 @@ -0,0 +1,2 @@
30.4 +File clang-tidy-3.9p should be placed in this directory before testing.
30.5 +(Won't commit large, ~25Mb binary file to Mercurial repo).
30.6 \ No newline at end of file
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/goldenfiles/ide/analysis/modernize/HeaderTest/src/llvm-header-guard.h Sun Jun 25 18:25:05 2017 +0200
31.3 @@ -0,0 +1,3 @@
31.4 +#ifndef _IDE_ANALYSIS_MODERNIZE_HEADERTEST_PROJECT_WITH_HEADERS_SRC_LLVM_HEADER_GUARD_H
31.5 +#define _IDE_ANALYSIS_MODERNIZE_HEADERTEST_PROJECT_WITH_HEADERS_SRC_LLVM_HEADER_GUARD_H
31.6 +#endif
31.7 \ No newline at end of file
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/goldenfiles/ide/analysis/modernize/SingleCppFileCheckTest/src/modernize-loop-convert.cpp Sun Jun 25 18:25:05 2017 +0200
32.3 @@ -0,0 +1,24 @@
32.4 +#include <vector>
32.5 +
32.6 +using namespace std;
32.7 +
32.8 +int loops() {
32.9 + const int N = 5;
32.10 + int arr[] = {1, 2, 3, 4, 5};
32.11 + vector<int> v;
32.12 + v.push_back(1);
32.13 + v.push_back(2);
32.14 + v.push_back(3);
32.15 +
32.16 + // safe conversion
32.17 + for (auto & elem : arr)
32.18 + cout << elem;
32.19 +
32.20 + // reasonable conversion
32.21 + for (auto & elem : v)
32.22 + cout << elem;
32.23 +
32.24 + // reasonable conversion
32.25 + for (auto & elem : v)
32.26 + cout << elem;
32.27 +}
32.28 \ No newline at end of file
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/goldenfiles/ide/analysis/modernize/SingleCppFileCheckTest/src/modernize-raw-string-literal.cpp Sun Jun 25 18:25:05 2017 +0200
33.3 @@ -0,0 +1,8 @@
33.4 +const char *const Quotes{R"(embedded "quotes")"};
33.5 +const char *const Paragraph{"Line one.\nLine two.\nLine three.\n"};
33.6 +const char *const SingleLine{"Single line.\n"};
33.7 +const char *const TrailingSpace{"Look here -> \n"};
33.8 +const char *const Tab{"One\tTwo\n"};
33.9 +const char *const Bell{"Hello!\a And welcome!"};
33.10 +const char *const Path{R"(C:\Program Files\Vendor\Application.exe)"};
33.11 +const char *const RegEx{R"(\w\([a-z]\))"};
33.12 \ No newline at end of file
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/goldenfiles/ide/analysis/modernize/SingleCppFileCheckTest/src/modernize-use-nullptr.cpp Sun Jun 25 18:25:05 2017 +0200
34.3 @@ -0,0 +1,11 @@
34.4 +#include <cstddef>
34.5 +
34.6 +void assignment() {
34.7 + char *a = nullptr;
34.8 + char *b = nullptr;
34.9 + char c = 0;
34.10 +}
34.11 +
34.12 +int *ret_ptr() {
34.13 + return nullptr;
34.14 +}
34.15 \ No newline at end of file
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/goldenfiles/ide/analysis/modernize/YamlTest/hello-world.json Sun Jun 25 18:25:05 2017 +0200
35.3 @@ -0,0 +1,25 @@
35.4 +---
35.5 +MainSourceFile: ''
35.6 +Diagnostics:
35.7 + CheckName: misc-unused-parameters
35.8 + Level: Warning
35.9 + MessageFilePath: /media/ilia/SSD/code/sputnik/modules/ide.analysis.modernize/build/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/welcome.cc
35.10 + MessageFileOffset: 1615
35.11 + Message: 'parameter ''argc'' is unused'
35.12 + Replacements:
35.13 + - FilePath: $path/ide/analysis/modernize/YamlTest/hello-world/welcome.cc
35.14 + Offset: 1615
35.15 + Length: 4
35.16 + ReplacementText: ' /*argc*/'
35.17 +Diagnostics:
35.18 + CheckName: misc-unused-parameters
35.19 + Level: Warning
35.20 + MessageFilePath: /media/ilia/SSD/code/sputnik/modules/ide.analysis.modernize/build/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/welcome.cc
35.21 + MessageFileOffset: 1627
35.22 + Message: 'parameter ''argv'' is unused'
35.23 + Replacements:
35.24 + - FilePath: $path/ide/analysis/modernize/YamlTest/hello-world/welcome.cc
35.25 + Offset: 1627
35.26 + Length: 4
35.27 + ReplacementText: ' /*argv*/'
35.28 +...
35.29 \ No newline at end of file
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
36.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/HeaderTest/project-with-headers/CMakeLists.txt Sun Jun 25 18:25:05 2017 +0200
36.3 @@ -0,0 +1,2 @@
36.4 +project (HelloCMake CXX)
36.5 +add_subdirectory (src)
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/HeaderTest/project-with-headers/nbproject/configurations.xml Sun Jun 25 18:25:05 2017 +0200
37.3 @@ -0,0 +1,128 @@
37.4 +<?xml version="1.0" encoding="UTF-8"?>
37.5 +<!--
37.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
37.7 +
37.8 +Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
37.9 +
37.10 +Oracle and Java are registered trademarks of Oracle and/or its affiliates.
37.11 +Other names may be trademarks of their respective owners.
37.12 +
37.13 +The contents of this file are subject to the terms of either the GNU
37.14 +General Public License Version 2 only ("GPL") or the Common
37.15 +Development and Distribution License("CDDL") (collectively, the
37.16 +"License"). You may not use this file except in compliance with the
37.17 +License. You can obtain a copy of the License at
37.18 +http://www.netbeans.org/cddl-gplv2.html
37.19 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
37.20 +specific language governing permissions and limitations under the
37.21 +License. When distributing the software, include this License Header
37.22 +Notice in each file and include the License file at
37.23 +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
37.24 +particular file as subject to the "Classpath" exception as provided
37.25 +by Oracle in the GPL Version 2 section of the License file that
37.26 +accompanied this code. If applicable, add the following below the
37.27 +License Header, with the fields enclosed by brackets [] replaced by
37.28 +your own identifying information:
37.29 +"Portions Copyrighted [year] [name of copyright owner]"
37.30 +
37.31 +If you wish your version of this file to be governed by only the CDDL
37.32 +or only the GPL Version 2, indicate your decision by adding
37.33 +"[Contributor] elects to include this software in this distribution
37.34 +under the [CDDL or GPL Version 2] license." If you do not indicate a
37.35 +single choice of license, a recipient has the option to distribute
37.36 +your version of this file under either the CDDL, the GPL Version 2 or
37.37 +to extend the choice of license to its licensees as provided above.
37.38 +However, if you add GPL Version 2 code and therefore, elected the GPL
37.39 +Version 2 license, then the option applies only if the new code is
37.40 +made subject to such option by the copyright holder.
37.41 +
37.42 +Contributor(s):
37.43 +-->
37.44 +<configurationDescriptor version="100">
37.45 + <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
37.46 + <df root="." name="0">
37.47 + <df name="src">
37.48 + <in>llvm-header-guard.cpp</in>
37.49 + </df>
37.50 + </df>
37.51 + <logicalFolder name="ExternalFiles"
37.52 + displayName="Important Files"
37.53 + projectFiles="false"
37.54 + kind="IMPORTANT_FILES_FOLDER">
37.55 + <itemPath>CMakeLists.txt</itemPath>
37.56 + <itemPath>build/Debug/Makefile</itemPath>
37.57 + <itemPath>build/Release/Makefile</itemPath>
37.58 + </logicalFolder>
37.59 + </logicalFolder>
37.60 + <sourceFolderFilter>^(nbproject|build)$</sourceFolderFilter>
37.61 + <sourceRootList>
37.62 + <Elem>.</Elem>
37.63 + </sourceRootList>
37.64 + <projectmakefile>build/Debug/Makefile</projectmakefile>
37.65 + <confs>
37.66 + <conf name="Debug" type="0">
37.67 + <toolsSet>
37.68 + <compilerSet>default</compilerSet>
37.69 + <dependencyChecking>false</dependencyChecking>
37.70 + <rebuildPropChanged>false</rebuildPropChanged>
37.71 + </toolsSet>
37.72 + <flagsDictionary>
37.73 + <element flagsID="0" commonFlags="-std=gnu++11"/>
37.74 + </flagsDictionary>
37.75 + <codeAssistance>
37.76 + </codeAssistance>
37.77 + <makefileType>
37.78 + <makeTool>
37.79 + <buildCommandWorkingDir>build/Debug</buildCommandWorkingDir>
37.80 + <buildCommand>${MAKE} -f Makefile</buildCommand>
37.81 + <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
37.82 + <executablePath>build/Debug/src/welcome</executablePath>
37.83 + <ccTool flags="0">
37.84 + <incDir>
37.85 + <pElem>build/Debug/src</pElem>
37.86 + </incDir>
37.87 + </ccTool>
37.88 + </makeTool>
37.89 + <preBuild>
37.90 + <preBuildCommandWorkingDir>build/Debug</preBuildCommandWorkingDir>
37.91 + <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
37.92 + <preBuildFirst>true</preBuildFirst>
37.93 + </preBuild>
37.94 + </makefileType>
37.95 + <item path="src/llvm-header-guard.cpp" ex="false" tool="1" flavor2="8">
37.96 + <ccTool flags="0">
37.97 + </ccTool>
37.98 + </item>
37.99 + </conf>
37.100 + <conf name="Release" type="0">
37.101 + <toolsSet>
37.102 + <compilerSet>default</compilerSet>
37.103 + <dependencyChecking>false</dependencyChecking>
37.104 + <rebuildPropChanged>false</rebuildPropChanged>
37.105 + </toolsSet>
37.106 + <codeAssistance>
37.107 + </codeAssistance>
37.108 + <makefileType>
37.109 + <makeTool>
37.110 + <buildCommandWorkingDir>build/Release</buildCommandWorkingDir>
37.111 + <buildCommand>${MAKE} -f Makefile</buildCommand>
37.112 + <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
37.113 + <executablePath>build/Release/src/welcome</executablePath>
37.114 + <ccTool>
37.115 + <incDir>
37.116 + <pElem>build/Release/src</pElem>
37.117 + </incDir>
37.118 + <preprocessorList>
37.119 + <Elem>NDEBUG</Elem>
37.120 + </preprocessorList>
37.121 + </ccTool>
37.122 + </makeTool>
37.123 + <preBuild>
37.124 + <preBuildCommandWorkingDir>build/Release</preBuildCommandWorkingDir>
37.125 + <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
37.126 + <preBuildFirst>true</preBuildFirst>
37.127 + </preBuild>
37.128 + </makefileType>
37.129 + </conf>
37.130 + </confs>
37.131 +</configurationDescriptor>
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
38.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/HeaderTest/project-with-headers/nbproject/project.xml Sun Jun 25 18:25:05 2017 +0200
38.3 @@ -0,0 +1,72 @@
38.4 +<?xml version="1.0" encoding="UTF-8"?>
38.5 +<!--
38.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
38.7 +
38.8 +Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
38.9 +
38.10 +Oracle and Java are registered trademarks of Oracle and/or its affiliates.
38.11 +Other names may be trademarks of their respective owners.
38.12 +
38.13 +The contents of this file are subject to the terms of either the GNU
38.14 +General Public License Version 2 only ("GPL") or the Common
38.15 +Development and Distribution License("CDDL") (collectively, the
38.16 +"License"). You may not use this file except in compliance with the
38.17 +License. You can obtain a copy of the License at
38.18 +http://www.netbeans.org/cddl-gplv2.html
38.19 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
38.20 +specific language governing permissions and limitations under the
38.21 +License. When distributing the software, include this License Header
38.22 +Notice in each file and include the License file at
38.23 +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
38.24 +particular file as subject to the "Classpath" exception as provided
38.25 +by Oracle in the GPL Version 2 section of the License file that
38.26 +accompanied this code. If applicable, add the following below the
38.27 +License Header, with the fields enclosed by brackets [] replaced by
38.28 +your own identifying information:
38.29 +"Portions Copyrighted [year] [name of copyright owner]"
38.30 +
38.31 +If you wish your version of this file to be governed by only the CDDL
38.32 +or only the GPL Version 2, indicate your decision by adding
38.33 +"[Contributor] elects to include this software in this distribution
38.34 +under the [CDDL or GPL Version 2] license." If you do not indicate a
38.35 +single choice of license, a recipient has the option to distribute
38.36 +your version of this file under either the CDDL, the GPL Version 2 or
38.37 +to extend the choice of license to its licensees as provided above.
38.38 +However, if you add GPL Version 2 code and therefore, elected the GPL
38.39 +Version 2 license, then the option applies only if the new code is
38.40 +made subject to such option by the copyright holder.
38.41 +
38.42 +Contributor(s):
38.43 +-->
38.44 +<project xmlns="http://www.netbeans.org/ns/project/1">
38.45 + <type>org.netbeans.modules.cnd.makeproject</type>
38.46 + <configuration>
38.47 + <data xmlns="http://www.netbeans.org/ns/make-project/1">
38.48 + <name>hello-cmake-world</name>
38.49 + <c-extensions/>
38.50 + <cpp-extensions>cpp</cpp-extensions>
38.51 + <header-extensions>h</header-extensions>
38.52 + <sourceEncoding>UTF-8</sourceEncoding>
38.53 + <sourceRootList>
38.54 + <sourceRootElem>.</sourceRootElem>
38.55 + </sourceRootList>
38.56 + <make-dep-projects/>
38.57 + <sourceRootList>
38.58 + <sourceRootElem>.</sourceRootElem>
38.59 + </sourceRootList>
38.60 + <confList>
38.61 + <confElem>
38.62 + <name>Debug</name>
38.63 + <type>0</type>
38.64 + </confElem>
38.65 + <confElem>
38.66 + <name>Release</name>
38.67 + <type>0</type>
38.68 + </confElem>
38.69 + </confList>
38.70 + <formatting>
38.71 + <project-formatting-style>false</project-formatting-style>
38.72 + </formatting>
38.73 + </data>
38.74 + </configuration>
38.75 +</project>
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/HeaderTest/project-with-headers/src/CMakeLists.txt Sun Jun 25 18:25:05 2017 +0200
39.3 @@ -0,0 +1,2 @@
39.4 +set(CMAKE_CXX_STANDARD 11)
39.5 +add_library (headers llvm-header-guard.cpp)
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/HeaderTest/project-with-headers/src/llvm-header-guard.cpp Sun Jun 25 18:25:05 2017 +0200
40.3 @@ -0,0 +1,1 @@
40.4 +#include "llvm-header-guard.h"
40.5 \ No newline at end of file
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/MultipleFileTest/project-with-headers/CMakeLists.txt Sun Jun 25 18:25:05 2017 +0200
41.3 @@ -0,0 +1,2 @@
41.4 +project (HelloCMake CXX)
41.5 +add_subdirectory (src)
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/MultipleFileTest/project-with-headers/nbproject/configurations.xml Sun Jun 25 18:25:05 2017 +0200
42.3 @@ -0,0 +1,145 @@
42.4 +<?xml version="1.0" encoding="UTF-8"?>
42.5 +<!--
42.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
42.7 +
42.8 +Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
42.9 +
42.10 +Oracle and Java are registered trademarks of Oracle and/or its affiliates.
42.11 +Other names may be trademarks of their respective owners.
42.12 +
42.13 +The contents of this file are subject to the terms of either the GNU
42.14 +General Public License Version 2 only ("GPL") or the Common
42.15 +Development and Distribution License("CDDL") (collectively, the
42.16 +"License"). You may not use this file except in compliance with the
42.17 +License. You can obtain a copy of the License at
42.18 +http://www.netbeans.org/cddl-gplv2.html
42.19 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
42.20 +specific language governing permissions and limitations under the
42.21 +License. When distributing the software, include this License Header
42.22 +Notice in each file and include the License file at
42.23 +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
42.24 +particular file as subject to the "Classpath" exception as provided
42.25 +by Oracle in the GPL Version 2 section of the License file that
42.26 +accompanied this code. If applicable, add the following below the
42.27 +License Header, with the fields enclosed by brackets [] replaced by
42.28 +your own identifying information:
42.29 +"Portions Copyrighted [year] [name of copyright owner]"
42.30 +
42.31 +If you wish your version of this file to be governed by only the CDDL
42.32 +or only the GPL Version 2, indicate your decision by adding
42.33 +"[Contributor] elects to include this software in this distribution
42.34 +under the [CDDL or GPL Version 2] license." If you do not indicate a
42.35 +single choice of license, a recipient has the option to distribute
42.36 +your version of this file under either the CDDL, the GPL Version 2 or
42.37 +to extend the choice of license to its licensees as provided above.
42.38 +However, if you add GPL Version 2 code and therefore, elected the GPL
42.39 +Version 2 license, then the option applies only if the new code is
42.40 +made subject to such option by the copyright holder.
42.41 +
42.42 +Contributor(s):
42.43 +-->
42.44 +<configurationDescriptor version="100">
42.45 + <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
42.46 + <df root="." name="0">
42.47 + <df name="src">
42.48 + <in>header.h</in>
42.49 + <in>source_1.cpp</in>
42.50 + <in>source_2.cpp</in>
42.51 + <in>source_3.cpp</in>
42.52 + <in>source_4.cpp</in>
42.53 + </df>
42.54 + </df>
42.55 + <logicalFolder name="ExternalFiles"
42.56 + displayName="Important Files"
42.57 + projectFiles="false"
42.58 + kind="IMPORTANT_FILES_FOLDER">
42.59 + <itemPath>CMakeLists.txt</itemPath>
42.60 + <itemPath>build/Debug/Makefile</itemPath>
42.61 + <itemPath>build/Release/Makefile</itemPath>
42.62 + </logicalFolder>
42.63 + </logicalFolder>
42.64 + <sourceFolderFilter>^(nbproject|build)$</sourceFolderFilter>
42.65 + <sourceRootList>
42.66 + <Elem>.</Elem>
42.67 + </sourceRootList>
42.68 + <projectmakefile>build/Debug/Makefile</projectmakefile>
42.69 + <confs>
42.70 + <conf name="Debug" type="0">
42.71 + <toolsSet>
42.72 + <compilerSet>default</compilerSet>
42.73 + <dependencyChecking>false</dependencyChecking>
42.74 + <rebuildPropChanged>false</rebuildPropChanged>
42.75 + </toolsSet>
42.76 + <codeAssistance>
42.77 + </codeAssistance>
42.78 + <makefileType>
42.79 + <makeTool>
42.80 + <buildCommandWorkingDir>build/Debug</buildCommandWorkingDir>
42.81 + <buildCommand>${MAKE} -f Makefile</buildCommand>
42.82 + <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
42.83 + <executablePath>build/Debug/src/welcome</executablePath>
42.84 + <ccTool flags="-std=gnu++11">
42.85 + <incDir>
42.86 + <pElem>build/Debug/src</pElem>
42.87 + </incDir>
42.88 + </ccTool>
42.89 + </makeTool>
42.90 + <preBuild>
42.91 + <preBuildCommandWorkingDir>build/Debug</preBuildCommandWorkingDir>
42.92 + <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
42.93 + <preBuildFirst>true</preBuildFirst>
42.94 + </preBuild>
42.95 + </makefileType>
42.96 + <item path="src/header.h" ex="false" tool="3" flavor2="0">
42.97 + </item>
42.98 + <item path="src/source_1.cpp" ex="false" tool="1" flavor2="0">
42.99 + </item>
42.100 + <item path="src/source_2.cpp" ex="false" tool="1" flavor2="0">
42.101 + </item>
42.102 + <item path="src/source_3.cpp" ex="false" tool="1" flavor2="0">
42.103 + </item>
42.104 + <item path="src/source_4.cpp" ex="false" tool="1" flavor2="0">
42.105 + </item>
42.106 + </conf>
42.107 + <conf name="Release" type="0">
42.108 + <toolsSet>
42.109 + <compilerSet>default</compilerSet>
42.110 + <dependencyChecking>false</dependencyChecking>
42.111 + <rebuildPropChanged>false</rebuildPropChanged>
42.112 + </toolsSet>
42.113 + <codeAssistance>
42.114 + </codeAssistance>
42.115 + <makefileType>
42.116 + <makeTool>
42.117 + <buildCommandWorkingDir>build/Release</buildCommandWorkingDir>
42.118 + <buildCommand>${MAKE} -f Makefile</buildCommand>
42.119 + <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
42.120 + <executablePath>build/Release/src/welcome</executablePath>
42.121 + <ccTool>
42.122 + <incDir>
42.123 + <pElem>build/Release/src</pElem>
42.124 + </incDir>
42.125 + <preprocessorList>
42.126 + <Elem>NDEBUG</Elem>
42.127 + </preprocessorList>
42.128 + </ccTool>
42.129 + </makeTool>
42.130 + <preBuild>
42.131 + <preBuildCommandWorkingDir>build/Release</preBuildCommandWorkingDir>
42.132 + <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
42.133 + <preBuildFirst>true</preBuildFirst>
42.134 + </preBuild>
42.135 + </makefileType>
42.136 + <item path="src/header.h" ex="false" tool="3" flavor2="0">
42.137 + </item>
42.138 + <item path="src/source_1.cpp" ex="false" tool="1" flavor2="0">
42.139 + </item>
42.140 + <item path="src/source_2.cpp" ex="false" tool="1" flavor2="0">
42.141 + </item>
42.142 + <item path="src/source_3.cpp" ex="false" tool="1" flavor2="0">
42.143 + </item>
42.144 + <item path="src/source_4.cpp" ex="false" tool="1" flavor2="0">
42.145 + </item>
42.146 + </conf>
42.147 + </confs>
42.148 +</configurationDescriptor>
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/MultipleFileTest/project-with-headers/nbproject/project.xml Sun Jun 25 18:25:05 2017 +0200
43.3 @@ -0,0 +1,72 @@
43.4 +<?xml version="1.0" encoding="UTF-8"?>
43.5 +<!--
43.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
43.7 +
43.8 +Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
43.9 +
43.10 +Oracle and Java are registered trademarks of Oracle and/or its affiliates.
43.11 +Other names may be trademarks of their respective owners.
43.12 +
43.13 +The contents of this file are subject to the terms of either the GNU
43.14 +General Public License Version 2 only ("GPL") or the Common
43.15 +Development and Distribution License("CDDL") (collectively, the
43.16 +"License"). You may not use this file except in compliance with the
43.17 +License. You can obtain a copy of the License at
43.18 +http://www.netbeans.org/cddl-gplv2.html
43.19 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
43.20 +specific language governing permissions and limitations under the
43.21 +License. When distributing the software, include this License Header
43.22 +Notice in each file and include the License file at
43.23 +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
43.24 +particular file as subject to the "Classpath" exception as provided
43.25 +by Oracle in the GPL Version 2 section of the License file that
43.26 +accompanied this code. If applicable, add the following below the
43.27 +License Header, with the fields enclosed by brackets [] replaced by
43.28 +your own identifying information:
43.29 +"Portions Copyrighted [year] [name of copyright owner]"
43.30 +
43.31 +If you wish your version of this file to be governed by only the CDDL
43.32 +or only the GPL Version 2, indicate your decision by adding
43.33 +"[Contributor] elects to include this software in this distribution
43.34 +under the [CDDL or GPL Version 2] license." If you do not indicate a
43.35 +single choice of license, a recipient has the option to distribute
43.36 +your version of this file under either the CDDL, the GPL Version 2 or
43.37 +to extend the choice of license to its licensees as provided above.
43.38 +However, if you add GPL Version 2 code and therefore, elected the GPL
43.39 +Version 2 license, then the option applies only if the new code is
43.40 +made subject to such option by the copyright holder.
43.41 +
43.42 +Contributor(s):
43.43 +-->
43.44 +<project xmlns="http://www.netbeans.org/ns/project/1">
43.45 + <type>org.netbeans.modules.cnd.makeproject</type>
43.46 + <configuration>
43.47 + <data xmlns="http://www.netbeans.org/ns/make-project/1">
43.48 + <name>hello-cmake-world</name>
43.49 + <c-extensions/>
43.50 + <cpp-extensions>cpp</cpp-extensions>
43.51 + <header-extensions>h</header-extensions>
43.52 + <sourceEncoding>UTF-8</sourceEncoding>
43.53 + <sourceRootList>
43.54 + <sourceRootElem>.</sourceRootElem>
43.55 + </sourceRootList>
43.56 + <make-dep-projects/>
43.57 + <sourceRootList>
43.58 + <sourceRootElem>.</sourceRootElem>
43.59 + </sourceRootList>
43.60 + <confList>
43.61 + <confElem>
43.62 + <name>Debug</name>
43.63 + <type>0</type>
43.64 + </confElem>
43.65 + <confElem>
43.66 + <name>Release</name>
43.67 + <type>0</type>
43.68 + </confElem>
43.69 + </confList>
43.70 + <formatting>
43.71 + <project-formatting-style>false</project-formatting-style>
43.72 + </formatting>
43.73 + </data>
43.74 + </configuration>
43.75 +</project>
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
44.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/MultipleFileTest/project-with-headers/src/CMakeLists.txt Sun Jun 25 18:25:05 2017 +0200
44.3 @@ -0,0 +1,4 @@
44.4 +set(CMAKE_CXX_STANDARD 11)
44.5 +add_library (tu_1 source_1.cpp)
44.6 +add_library (tu_2 source_2.cpp)
44.7 +add_library (tu_3 source_3.cpp)
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
45.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/MultipleFileTest/project-with-headers/src/header.h Sun Jun 25 18:25:05 2017 +0200
45.3 @@ -0,0 +1,8 @@
45.4 +#ifndef HEADER_H
45.5 +#define HEADER_H
45.6 +
45.7 +using namespace std;
45.8 +
45.9 +#endif /* HEADER_H */
45.10 +
45.11 +
45.12 \ No newline at end of file
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
46.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/MultipleFileTest/project-with-headers/src/source_1.cpp Sun Jun 25 18:25:05 2017 +0200
46.3 @@ -0,0 +1,1 @@
46.4 +#include "header.h"
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
47.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/MultipleFileTest/project-with-headers/src/source_2.cpp Sun Jun 25 18:25:05 2017 +0200
47.3 @@ -0,0 +1,1 @@
47.4 +#include "header.h"
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
48.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/MultipleFileTest/project-with-headers/src/source_3.cpp Sun Jun 25 18:25:05 2017 +0200
48.3 @@ -0,0 +1,1 @@
48.4 +#include "header.h"
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
49.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/MultipleFileTest/project-with-headers/src/source_4.cpp Sun Jun 25 18:25:05 2017 +0200
49.3 @@ -0,0 +1,1 @@
49.4 +#include "header.h"
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
50.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/CMakeLists.txt Sun Jun 25 18:25:05 2017 +0200
50.3 @@ -0,0 +1,2 @@
50.4 +project (HelloCMake)
50.5 +add_subdirectory (src)
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
51.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/nbproject/configurations.xml Sun Jun 25 18:25:05 2017 +0200
51.3 @@ -0,0 +1,143 @@
51.4 +<?xml version="1.0" encoding="UTF-8"?>
51.5 +<!--
51.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
51.7 +
51.8 +Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
51.9 +
51.10 +Oracle and Java are registered trademarks of Oracle and/or its affiliates.
51.11 +Other names may be trademarks of their respective owners.
51.12 +
51.13 +The contents of this file are subject to the terms of either the GNU
51.14 +General Public License Version 2 only ("GPL") or the Common
51.15 +Development and Distribution License("CDDL") (collectively, the
51.16 +"License"). You may not use this file except in compliance with the
51.17 +License. You can obtain a copy of the License at
51.18 +http://www.netbeans.org/cddl-gplv2.html
51.19 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
51.20 +specific language governing permissions and limitations under the
51.21 +License. When distributing the software, include this License Header
51.22 +Notice in each file and include the License file at
51.23 +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
51.24 +particular file as subject to the "Classpath" exception as provided
51.25 +by Oracle in the GPL Version 2 section of the License file that
51.26 +accompanied this code. If applicable, add the following below the
51.27 +License Header, with the fields enclosed by brackets [] replaced by
51.28 +your own identifying information:
51.29 +"Portions Copyrighted [year] [name of copyright owner]"
51.30 +
51.31 +If you wish your version of this file to be governed by only the CDDL
51.32 +or only the GPL Version 2, indicate your decision by adding
51.33 +"[Contributor] elects to include this software in this distribution
51.34 +under the [CDDL or GPL Version 2] license." If you do not indicate a
51.35 +single choice of license, a recipient has the option to distribute
51.36 +your version of this file under either the CDDL, the GPL Version 2 or
51.37 +to extend the choice of license to its licensees as provided above.
51.38 +However, if you add GPL Version 2 code and therefore, elected the GPL
51.39 +Version 2 license, then the option applies only if the new code is
51.40 +made subject to such option by the copyright holder.
51.41 +
51.42 +Contributor(s):
51.43 +-->
51.44 +<configurationDescriptor version="100">
51.45 + <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
51.46 + <df root="." name="0">
51.47 + <df name="src">
51.48 + <in>modernize-loop-convert.cpp</in>
51.49 + <in>modernize-raw-string-literal.cpp</in>
51.50 + <in>modernize-use-nullptr.cpp</in>
51.51 + </df>
51.52 + </df>
51.53 + <logicalFolder name="ExternalFiles"
51.54 + displayName="Important Files"
51.55 + projectFiles="false"
51.56 + kind="IMPORTANT_FILES_FOLDER">
51.57 + <itemPath>CMakeLists.txt</itemPath>
51.58 + <itemPath>build/Debug/Makefile</itemPath>
51.59 + <itemPath>build/Release/Makefile</itemPath>
51.60 + </logicalFolder>
51.61 + </logicalFolder>
51.62 + <sourceFolderFilter>^(nbproject|build)$</sourceFolderFilter>
51.63 + <sourceRootList>
51.64 + <Elem>.</Elem>
51.65 + </sourceRootList>
51.66 + <projectmakefile>build/Debug/Makefile</projectmakefile>
51.67 + <confs>
51.68 + <conf name="Debug" type="0">
51.69 + <toolsSet>
51.70 + <compilerSet>default</compilerSet>
51.71 + <dependencyChecking>false</dependencyChecking>
51.72 + <rebuildPropChanged>false</rebuildPropChanged>
51.73 + </toolsSet>
51.74 + <flagsDictionary>
51.75 + <element flagsID="0" commonFlags="-std=gnu++11"/>
51.76 + </flagsDictionary>
51.77 + <codeAssistance>
51.78 + </codeAssistance>
51.79 + <makefileType>
51.80 + <makeTool>
51.81 + <buildCommandWorkingDir>build/Debug</buildCommandWorkingDir>
51.82 + <buildCommand>${MAKE} -f Makefile</buildCommand>
51.83 + <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
51.84 + <executablePath>build/Debug/src/welcome</executablePath>
51.85 + <ccTool flags="0">
51.86 + <incDir>
51.87 + <pElem>build/Debug/src</pElem>
51.88 + </incDir>
51.89 + </ccTool>
51.90 + </makeTool>
51.91 + <preBuild>
51.92 + <preBuildCommandWorkingDir>build/Debug</preBuildCommandWorkingDir>
51.93 + <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
51.94 + <preBuildFirst>true</preBuildFirst>
51.95 + </preBuild>
51.96 + </makefileType>
51.97 + <item path="src/modernize-loop-convert.cpp" ex="false" tool="1" flavor2="8">
51.98 + <ccTool flags="0">
51.99 + </ccTool>
51.100 + </item>
51.101 + <item path="src/modernize-raw-string-literal.cpp"
51.102 + ex="false"
51.103 + tool="1"
51.104 + flavor2="8">
51.105 + <ccTool flags="0">
51.106 + </ccTool>
51.107 + </item>
51.108 + <item path="src/modernize-use-nullptr.cpp" ex="false" tool="1" flavor2="8">
51.109 + <ccTool flags="0">
51.110 + </ccTool>
51.111 + </item>
51.112 + </conf>
51.113 + <conf name="Release" type="0">
51.114 + <toolsSet>
51.115 + <compilerSet>default</compilerSet>
51.116 + <dependencyChecking>false</dependencyChecking>
51.117 + <rebuildPropChanged>false</rebuildPropChanged>
51.118 + </toolsSet>
51.119 + <codeAssistance>
51.120 + </codeAssistance>
51.121 + <makefileType>
51.122 + <makeTool>
51.123 + <buildCommandWorkingDir>build/Release</buildCommandWorkingDir>
51.124 + <buildCommand>${MAKE} -f Makefile</buildCommand>
51.125 + <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
51.126 + <executablePath>build/Release/src/welcome</executablePath>
51.127 + <ccTool>
51.128 + <incDir>
51.129 + <pElem>build/Release/src</pElem>
51.130 + </incDir>
51.131 + <preprocessorList>
51.132 + <Elem>NDEBUG</Elem>
51.133 + </preprocessorList>
51.134 + </ccTool>
51.135 + </makeTool>
51.136 + <preBuild>
51.137 + <preBuildCommandWorkingDir>build/Release</preBuildCommandWorkingDir>
51.138 + <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
51.139 + <preBuildFirst>true</preBuildFirst>
51.140 + </preBuild>
51.141 + </makefileType>
51.142 + <item path="src/modernize-use-nullptr.cpp" ex="false" tool="1" flavor2="0">
51.143 + </item>
51.144 + </conf>
51.145 + </confs>
51.146 +</configurationDescriptor>
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
52.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/nbproject/project.xml Sun Jun 25 18:25:05 2017 +0200
52.3 @@ -0,0 +1,72 @@
52.4 +<?xml version="1.0" encoding="UTF-8"?>
52.5 +<!--
52.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
52.7 +
52.8 +Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
52.9 +
52.10 +Oracle and Java are registered trademarks of Oracle and/or its affiliates.
52.11 +Other names may be trademarks of their respective owners.
52.12 +
52.13 +The contents of this file are subject to the terms of either the GNU
52.14 +General Public License Version 2 only ("GPL") or the Common
52.15 +Development and Distribution License("CDDL") (collectively, the
52.16 +"License"). You may not use this file except in compliance with the
52.17 +License. You can obtain a copy of the License at
52.18 +http://www.netbeans.org/cddl-gplv2.html
52.19 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
52.20 +specific language governing permissions and limitations under the
52.21 +License. When distributing the software, include this License Header
52.22 +Notice in each file and include the License file at
52.23 +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
52.24 +particular file as subject to the "Classpath" exception as provided
52.25 +by Oracle in the GPL Version 2 section of the License file that
52.26 +accompanied this code. If applicable, add the following below the
52.27 +License Header, with the fields enclosed by brackets [] replaced by
52.28 +your own identifying information:
52.29 +"Portions Copyrighted [year] [name of copyright owner]"
52.30 +
52.31 +If you wish your version of this file to be governed by only the CDDL
52.32 +or only the GPL Version 2, indicate your decision by adding
52.33 +"[Contributor] elects to include this software in this distribution
52.34 +under the [CDDL or GPL Version 2] license." If you do not indicate a
52.35 +single choice of license, a recipient has the option to distribute
52.36 +your version of this file under either the CDDL, the GPL Version 2 or
52.37 +to extend the choice of license to its licensees as provided above.
52.38 +However, if you add GPL Version 2 code and therefore, elected the GPL
52.39 +Version 2 license, then the option applies only if the new code is
52.40 +made subject to such option by the copyright holder.
52.41 +
52.42 +Contributor(s):
52.43 +-->
52.44 +<project xmlns="http://www.netbeans.org/ns/project/1">
52.45 + <type>org.netbeans.modules.cnd.makeproject</type>
52.46 + <configuration>
52.47 + <data xmlns="http://www.netbeans.org/ns/make-project/1">
52.48 + <name>hello-cmake-world</name>
52.49 + <c-extensions/>
52.50 + <cpp-extensions>cpp</cpp-extensions>
52.51 + <header-extensions>h</header-extensions>
52.52 + <sourceEncoding>UTF-8</sourceEncoding>
52.53 + <sourceRootList>
52.54 + <sourceRootElem>.</sourceRootElem>
52.55 + </sourceRootList>
52.56 + <make-dep-projects/>
52.57 + <sourceRootList>
52.58 + <sourceRootElem>.</sourceRootElem>
52.59 + </sourceRootList>
52.60 + <confList>
52.61 + <confElem>
52.62 + <name>Debug</name>
52.63 + <type>0</type>
52.64 + </confElem>
52.65 + <confElem>
52.66 + <name>Release</name>
52.67 + <type>0</type>
52.68 + </confElem>
52.69 + </confList>
52.70 + <formatting>
52.71 + <project-formatting-style>false</project-formatting-style>
52.72 + </formatting>
52.73 + </data>
52.74 + </configuration>
52.75 +</project>
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
53.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/CMakeLists.txt Sun Jun 25 18:25:05 2017 +0200
53.3 @@ -0,0 +1,2 @@
53.4 +set(CMAKE_CXX_STANDARD 11)
53.5 +add_library (single-cpp-file-check modernize-use-nullptr.cpp modernize-loop-convert.cpp modernize-raw-string-literal.cpp)
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
54.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/llvm-header-guard.cpp Sun Jun 25 18:25:05 2017 +0200
54.3 @@ -0,0 +1,1 @@
54.4 +#include "llvm-header-guard.h"
54.5 \ No newline at end of file
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
55.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/modernize-loop-convert.cpp Sun Jun 25 18:25:05 2017 +0200
55.3 @@ -0,0 +1,25 @@
55.4 +#include <vector>
55.5 +#include <iostream>
55.6 +
55.7 +using namespace std;
55.8 +
55.9 +int loops() {
55.10 + const int N = 5;
55.11 + int arr[] = {1, 2, 3, 4, 5};
55.12 + vector<int> v;
55.13 + v.push_back(1);
55.14 + v.push_back(2);
55.15 + v.push_back(3);
55.16 +
55.17 + // safe conversion
55.18 + for (int i = 0; i < N; ++i)
55.19 + cout << arr[i];
55.20 +
55.21 + // reasonable conversion
55.22 + for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)
55.23 + cout << *it;
55.24 +
55.25 + // reasonable conversion
55.26 + for (int i = 0; i < v.size(); ++i)
55.27 + cout << v[i];
55.28 +}
55.29 \ No newline at end of file
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
56.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/modernize-raw-string-literal.cpp Sun Jun 25 18:25:05 2017 +0200
56.3 @@ -0,0 +1,8 @@
56.4 +const char *const Quotes{"embedded \"quotes\""};
56.5 +const char *const Paragraph{"Line one.\nLine two.\nLine three.\n"};
56.6 +const char *const SingleLine{"Single line.\n"};
56.7 +const char *const TrailingSpace{"Look here -> \n"};
56.8 +const char *const Tab{"One\tTwo\n"};
56.9 +const char *const Bell{"Hello!\a And welcome!"};
56.10 +const char *const Path{"C:\\Program Files\\Vendor\\Application.exe"};
56.11 +const char *const RegEx{"\\w\\([a-z]\\)"};
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
57.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/modernize-use-nullptr.cpp Sun Jun 25 18:25:05 2017 +0200
57.3 @@ -0,0 +1,11 @@
57.4 +#include <cstddef>
57.5 +
57.6 +void assignment() {
57.7 + char *a = NULL;
57.8 + char *b = 0;
57.9 + char c = 0;
57.10 +}
57.11 +
57.12 +int *ret_ptr() {
57.13 + return 0;
57.14 +}
57.15 \ No newline at end of file
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
58.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/.dep.inc Sun Jun 25 18:25:05 2017 +0200
58.3 @@ -0,0 +1,5 @@
58.4 +# This code depends on make tool being used
58.5 +DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES} ${TESTOBJECTFILES}))
58.6 +ifneq (${DEPFILES},)
58.7 +include ${DEPFILES}
58.8 +endif
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
59.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/Makefile Sun Jun 25 18:25:05 2017 +0200
59.3 @@ -0,0 +1,128 @@
59.4 +#
59.5 +# There exist several targets which are by default empty and which can be
59.6 +# used for execution of your targets. These targets are usually executed
59.7 +# before and after some main targets. They are:
59.8 +#
59.9 +# .build-pre: called before 'build' target
59.10 +# .build-post: called after 'build' target
59.11 +# .clean-pre: called before 'clean' target
59.12 +# .clean-post: called after 'clean' target
59.13 +# .clobber-pre: called before 'clobber' target
59.14 +# .clobber-post: called after 'clobber' target
59.15 +# .all-pre: called before 'all' target
59.16 +# .all-post: called after 'all' target
59.17 +# .help-pre: called before 'help' target
59.18 +# .help-post: called after 'help' target
59.19 +#
59.20 +# Targets beginning with '.' are not intended to be called on their own.
59.21 +#
59.22 +# Main targets can be executed directly, and they are:
59.23 +#
59.24 +# build build a specific configuration
59.25 +# clean remove built files from a configuration
59.26 +# clobber remove all built files
59.27 +# all build all configurations
59.28 +# help print help mesage
59.29 +#
59.30 +# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
59.31 +# .help-impl are implemented in nbproject/makefile-impl.mk.
59.32 +#
59.33 +# Available make variables:
59.34 +#
59.35 +# CND_BASEDIR base directory for relative paths
59.36 +# CND_DISTDIR default top distribution directory (build artifacts)
59.37 +# CND_BUILDDIR default top build directory (object files, ...)
59.38 +# CONF name of current configuration
59.39 +# CND_PLATFORM_${CONF} platform name (current configuration)
59.40 +# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
59.41 +# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
59.42 +# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
59.43 +# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
59.44 +# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
59.45 +# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
59.46 +#
59.47 +# NOCDDL
59.48 +
59.49 +
59.50 +# Environment
59.51 +MKDIR=mkdir
59.52 +CP=cp
59.53 +CCADMIN=CCadmin
59.54 +
59.55 +
59.56 +# build
59.57 +build: .build-post
59.58 +
59.59 +.build-pre:
59.60 +# Add your pre 'build' code here...
59.61 +
59.62 +.build-post: .build-impl
59.63 +# Add your post 'build' code here...
59.64 +
59.65 +
59.66 +# clean
59.67 +clean: .clean-post
59.68 +
59.69 +.clean-pre:
59.70 +# Add your pre 'clean' code here...
59.71 +
59.72 +.clean-post: .clean-impl
59.73 +# Add your post 'clean' code here...
59.74 +
59.75 +
59.76 +# clobber
59.77 +clobber: .clobber-post
59.78 +
59.79 +.clobber-pre:
59.80 +# Add your pre 'clobber' code here...
59.81 +
59.82 +.clobber-post: .clobber-impl
59.83 +# Add your post 'clobber' code here...
59.84 +
59.85 +
59.86 +# all
59.87 +all: .all-post
59.88 +
59.89 +.all-pre:
59.90 +# Add your pre 'all' code here...
59.91 +
59.92 +.all-post: .all-impl
59.93 +# Add your post 'all' code here...
59.94 +
59.95 +
59.96 +# build tests
59.97 +build-tests: .build-tests-post
59.98 +
59.99 +.build-tests-pre:
59.100 +# Add your pre 'build-tests' code here...
59.101 +
59.102 +.build-tests-post: .build-tests-impl
59.103 +# Add your post 'build-tests' code here...
59.104 +
59.105 +
59.106 +# run tests
59.107 +test: .test-post
59.108 +
59.109 +.test-pre: build-tests
59.110 +# Add your pre 'test' code here...
59.111 +
59.112 +.test-post: .test-impl
59.113 +# Add your post 'test' code here...
59.114 +
59.115 +
59.116 +# help
59.117 +help: .help-post
59.118 +
59.119 +.help-pre:
59.120 +# Add your pre 'help' code here...
59.121 +
59.122 +.help-post: .help-impl
59.123 +# Add your post 'help' code here...
59.124 +
59.125 +
59.126 +
59.127 +# include project implementation makefile
59.128 +include nbproject/Makefile-impl.mk
59.129 +
59.130 +# include project make variables
59.131 +include nbproject/Makefile-variables.mk
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
60.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/nbproject/Makefile-Debug.mk Sun Jun 25 18:25:05 2017 +0200
60.3 @@ -0,0 +1,83 @@
60.4 +#
60.5 +# Generated Makefile - do not edit!
60.6 +#
60.7 +# Edit the Makefile in the project folder instead (../Makefile). Each target
60.8 +# has a -pre and a -post target defined where you can add customized code.
60.9 +#
60.10 +# This makefile implements configuration specific macros and targets.
60.11 +
60.12 +
60.13 +# Environment
60.14 +MKDIR=mkdir
60.15 +CP=cp
60.16 +GREP=grep
60.17 +NM=nm
60.18 +CCADMIN=CCadmin
60.19 +RANLIB=ranlib
60.20 +CC=gcc
60.21 +CCC=g++
60.22 +CXX=g++
60.23 +FC=gfortran
60.24 +AS=as
60.25 +
60.26 +# Macros
60.27 +CND_PLATFORM=GNU-Linux
60.28 +CND_DLIB_EXT=so
60.29 +CND_CONF=Debug
60.30 +CND_DISTDIR=dist
60.31 +CND_BUILDDIR=build
60.32 +
60.33 +# Include project Makefile
60.34 +include Makefile
60.35 +
60.36 +# Object Directory
60.37 +OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
60.38 +
60.39 +# Object Files
60.40 +OBJECTFILES= \
60.41 + ${OBJECTDIR}/welcome.o
60.42 +
60.43 +
60.44 +# C Compiler Flags
60.45 +CFLAGS=
60.46 +
60.47 +# CC Compiler Flags
60.48 +CCFLAGS=
60.49 +CXXFLAGS=
60.50 +
60.51 +# Fortran Compiler Flags
60.52 +FFLAGS=
60.53 +
60.54 +# Assembler Flags
60.55 +ASFLAGS=
60.56 +
60.57 +# Link Libraries and Options
60.58 +LDLIBSOPTIONS=
60.59 +
60.60 +# Build Targets
60.61 +.build-conf: ${BUILD_SUBPROJECTS}
60.62 + "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world
60.63 +
60.64 +${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world: ${OBJECTFILES}
60.65 + ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
60.66 + ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world ${OBJECTFILES} ${LDLIBSOPTIONS}
60.67 +
60.68 +${OBJECTDIR}/welcome.o: welcome.cc
60.69 + ${MKDIR} -p ${OBJECTDIR}
60.70 + ${RM} "$@.d"
60.71 + $(COMPILE.cc) -g -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/welcome.o welcome.cc
60.72 +
60.73 +# Subprojects
60.74 +.build-subprojects:
60.75 +
60.76 +# Clean Targets
60.77 +.clean-conf: ${CLEAN_SUBPROJECTS}
60.78 + ${RM} -r ${CND_BUILDDIR}/${CND_CONF}
60.79 +
60.80 +# Subprojects
60.81 +.clean-subprojects:
60.82 +
60.83 +# Enable dependency checking
60.84 +.dep.inc: .depcheck-impl
60.85 +
60.86 +include .dep.inc
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
61.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/nbproject/Makefile-Release.mk Sun Jun 25 18:25:05 2017 +0200
61.3 @@ -0,0 +1,83 @@
61.4 +#
61.5 +# Generated Makefile - do not edit!
61.6 +#
61.7 +# Edit the Makefile in the project folder instead (../Makefile). Each target
61.8 +# has a -pre and a -post target defined where you can add customized code.
61.9 +#
61.10 +# This makefile implements configuration specific macros and targets.
61.11 +
61.12 +
61.13 +# Environment
61.14 +MKDIR=mkdir
61.15 +CP=cp
61.16 +GREP=grep
61.17 +NM=nm
61.18 +CCADMIN=CCadmin
61.19 +RANLIB=ranlib
61.20 +CC=gcc
61.21 +CCC=g++
61.22 +CXX=g++
61.23 +FC=gfortran
61.24 +AS=as
61.25 +
61.26 +# Macros
61.27 +CND_PLATFORM=GNU-Linux
61.28 +CND_DLIB_EXT=so
61.29 +CND_CONF=Release
61.30 +CND_DISTDIR=dist
61.31 +CND_BUILDDIR=build
61.32 +
61.33 +# Include project Makefile
61.34 +include Makefile
61.35 +
61.36 +# Object Directory
61.37 +OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
61.38 +
61.39 +# Object Files
61.40 +OBJECTFILES= \
61.41 + ${OBJECTDIR}/welcome.o
61.42 +
61.43 +
61.44 +# C Compiler Flags
61.45 +CFLAGS=
61.46 +
61.47 +# CC Compiler Flags
61.48 +CCFLAGS=
61.49 +CXXFLAGS=
61.50 +
61.51 +# Fortran Compiler Flags
61.52 +FFLAGS=
61.53 +
61.54 +# Assembler Flags
61.55 +ASFLAGS=
61.56 +
61.57 +# Link Libraries and Options
61.58 +LDLIBSOPTIONS=
61.59 +
61.60 +# Build Targets
61.61 +.build-conf: ${BUILD_SUBPROJECTS}
61.62 + "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world
61.63 +
61.64 +${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world: ${OBJECTFILES}
61.65 + ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
61.66 + ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world ${OBJECTFILES} ${LDLIBSOPTIONS}
61.67 +
61.68 +${OBJECTDIR}/welcome.o: welcome.cc
61.69 + ${MKDIR} -p ${OBJECTDIR}
61.70 + ${RM} "$@.d"
61.71 + $(COMPILE.cc) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/welcome.o welcome.cc
61.72 +
61.73 +# Subprojects
61.74 +.build-subprojects:
61.75 +
61.76 +# Clean Targets
61.77 +.clean-conf: ${CLEAN_SUBPROJECTS}
61.78 + ${RM} -r ${CND_BUILDDIR}/${CND_CONF}
61.79 +
61.80 +# Subprojects
61.81 +.clean-subprojects:
61.82 +
61.83 +# Enable dependency checking
61.84 +.dep.inc: .depcheck-impl
61.85 +
61.86 +include .dep.inc
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
62.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/nbproject/Makefile-impl.mk Sun Jun 25 18:25:05 2017 +0200
62.3 @@ -0,0 +1,133 @@
62.4 +#
62.5 +# Generated Makefile - do not edit!
62.6 +#
62.7 +# Edit the Makefile in the project folder instead (../Makefile). Each target
62.8 +# has a pre- and a post- target defined where you can add customization code.
62.9 +#
62.10 +# This makefile implements macros and targets common to all configurations.
62.11 +#
62.12 +# NOCDDL
62.13 +
62.14 +
62.15 +# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
62.16 +# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
62.17 +# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
62.18 +# and .clean-reqprojects-conf unless SUB has the value 'no'
62.19 +SUB_no=NO
62.20 +SUBPROJECTS=${SUB_${SUB}}
62.21 +BUILD_SUBPROJECTS_=.build-subprojects
62.22 +BUILD_SUBPROJECTS_NO=
62.23 +BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
62.24 +CLEAN_SUBPROJECTS_=.clean-subprojects
62.25 +CLEAN_SUBPROJECTS_NO=
62.26 +CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
62.27 +
62.28 +
62.29 +# Project Name
62.30 +PROJECTNAME=hello-world
62.31 +
62.32 +# Active Configuration
62.33 +DEFAULTCONF=Debug
62.34 +CONF=${DEFAULTCONF}
62.35 +
62.36 +# All Configurations
62.37 +ALLCONFS=Debug Release
62.38 +
62.39 +
62.40 +# build
62.41 +.build-impl: .build-pre .validate-impl .depcheck-impl
62.42 + @#echo "=> Running $@... Configuration=$(CONF)"
62.43 + "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf
62.44 +
62.45 +
62.46 +# clean
62.47 +.clean-impl: .clean-pre .validate-impl .depcheck-impl
62.48 + @#echo "=> Running $@... Configuration=$(CONF)"
62.49 + "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf
62.50 +
62.51 +
62.52 +# clobber
62.53 +.clobber-impl: .clobber-pre .depcheck-impl
62.54 + @#echo "=> Running $@..."
62.55 + for CONF in ${ALLCONFS}; \
62.56 + do \
62.57 + "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
62.58 + done
62.59 +
62.60 +# all
62.61 +.all-impl: .all-pre .depcheck-impl
62.62 + @#echo "=> Running $@..."
62.63 + for CONF in ${ALLCONFS}; \
62.64 + do \
62.65 + "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf; \
62.66 + done
62.67 +
62.68 +# build tests
62.69 +.build-tests-impl: .build-impl .build-tests-pre
62.70 + @#echo "=> Running $@... Configuration=$(CONF)"
62.71 + "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-tests-conf
62.72 +
62.73 +# run tests
62.74 +.test-impl: .build-tests-impl .test-pre
62.75 + @#echo "=> Running $@... Configuration=$(CONF)"
62.76 + "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .test-conf
62.77 +
62.78 +# dependency checking support
62.79 +.depcheck-impl:
62.80 + @echo "# This code depends on make tool being used" >.dep.inc
62.81 + @if [ -n "${MAKE_VERSION}" ]; then \
62.82 + echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES} \$${TESTOBJECTFILES}))" >>.dep.inc; \
62.83 + echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
62.84 + echo "include \$${DEPFILES}" >>.dep.inc; \
62.85 + echo "endif" >>.dep.inc; \
62.86 + else \
62.87 + echo ".KEEP_STATE:" >>.dep.inc; \
62.88 + echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
62.89 + fi
62.90 +
62.91 +# configuration validation
62.92 +.validate-impl:
62.93 + @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
62.94 + then \
62.95 + echo ""; \
62.96 + echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
62.97 + echo "See 'make help' for details."; \
62.98 + echo "Current directory: " `pwd`; \
62.99 + echo ""; \
62.100 + fi
62.101 + @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
62.102 + then \
62.103 + exit 1; \
62.104 + fi
62.105 +
62.106 +
62.107 +# help
62.108 +.help-impl: .help-pre
62.109 + @echo "This makefile supports the following configurations:"
62.110 + @echo " ${ALLCONFS}"
62.111 + @echo ""
62.112 + @echo "and the following targets:"
62.113 + @echo " build (default target)"
62.114 + @echo " clean"
62.115 + @echo " clobber"
62.116 + @echo " all"
62.117 + @echo " help"
62.118 + @echo ""
62.119 + @echo "Makefile Usage:"
62.120 + @echo " make [CONF=<CONFIGURATION>] [SUB=no] build"
62.121 + @echo " make [CONF=<CONFIGURATION>] [SUB=no] clean"
62.122 + @echo " make [SUB=no] clobber"
62.123 + @echo " make [SUB=no] all"
62.124 + @echo " make help"
62.125 + @echo ""
62.126 + @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
62.127 + @echo " also build subprojects."
62.128 + @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
62.129 + @echo " also clean subprojects."
62.130 + @echo "Target 'clobber' will remove all built files from all configurations and,"
62.131 + @echo " unless 'SUB=no', also from subprojects."
62.132 + @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
62.133 + @echo " also build subprojects."
62.134 + @echo "Target 'help' prints this message."
62.135 + @echo ""
62.136 +
63.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
63.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/nbproject/Makefile-variables.mk Sun Jun 25 18:25:05 2017 +0200
63.3 @@ -0,0 +1,35 @@
63.4 +#
63.5 +# Generated - do not edit!
63.6 +#
63.7 +# NOCDDL
63.8 +#
63.9 +CND_BASEDIR=`pwd`
63.10 +CND_BUILDDIR=build
63.11 +CND_DISTDIR=dist
63.12 +# Debug configuration
63.13 +CND_PLATFORM_Debug=GNU-Linux
63.14 +CND_ARTIFACT_DIR_Debug=dist/Debug/GNU-Linux
63.15 +CND_ARTIFACT_NAME_Debug=hello-world
63.16 +CND_ARTIFACT_PATH_Debug=dist/Debug/GNU-Linux/hello-world
63.17 +CND_PACKAGE_DIR_Debug=dist/Debug/GNU-Linux/package
63.18 +CND_PACKAGE_NAME_Debug=hello-world.tar
63.19 +CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux/package/hello-world.tar
63.20 +# Release configuration
63.21 +CND_PLATFORM_Release=GNU-Linux
63.22 +CND_ARTIFACT_DIR_Release=dist/Release/GNU-Linux
63.23 +CND_ARTIFACT_NAME_Release=hello-world
63.24 +CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux/hello-world
63.25 +CND_PACKAGE_DIR_Release=dist/Release/GNU-Linux/package
63.26 +CND_PACKAGE_NAME_Release=hello-world.tar
63.27 +CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux/package/hello-world.tar
63.28 +#
63.29 +# include compiler specific variables
63.30 +#
63.31 +# dmake command
63.32 +ROOT:sh = test -f nbproject/private/Makefile-variables.mk || \
63.33 + (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk)
63.34 +#
63.35 +# gmake command
63.36 +.PHONY: $(shell test -f nbproject/private/Makefile-variables.mk || (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk))
63.37 +#
63.38 +include nbproject/private/Makefile-variables.mk
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
64.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/nbproject/Package-Debug.bash Sun Jun 25 18:25:05 2017 +0200
64.3 @@ -0,0 +1,76 @@
64.4 +#!/bin/bash -x
64.5 +
64.6 +#
64.7 +# Generated - do not edit!
64.8 +#
64.9 +
64.10 +# Macros
64.11 +TOP=`pwd`
64.12 +CND_PLATFORM=GNU-Linux
64.13 +CND_CONF=Debug
64.14 +CND_DISTDIR=dist
64.15 +CND_BUILDDIR=build
64.16 +CND_DLIB_EXT=so
64.17 +NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
64.18 +TMPDIRNAME=tmp-packaging
64.19 +OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world
64.20 +OUTPUT_BASENAME=hello-world
64.21 +PACKAGE_TOP_DIR=hello-world/
64.22 +
64.23 +# Functions
64.24 +function checkReturnCode
64.25 +{
64.26 + rc=$?
64.27 + if [ $rc != 0 ]
64.28 + then
64.29 + exit $rc
64.30 + fi
64.31 +}
64.32 +function makeDirectory
64.33 +# $1 directory path
64.34 +# $2 permission (optional)
64.35 +{
64.36 + mkdir -p "$1"
64.37 + checkReturnCode
64.38 + if [ "$2" != "" ]
64.39 + then
64.40 + chmod $2 "$1"
64.41 + checkReturnCode
64.42 + fi
64.43 +}
64.44 +function copyFileToTmpDir
64.45 +# $1 from-file path
64.46 +# $2 to-file path
64.47 +# $3 permission
64.48 +{
64.49 + cp "$1" "$2"
64.50 + checkReturnCode
64.51 + if [ "$3" != "" ]
64.52 + then
64.53 + chmod $3 "$2"
64.54 + checkReturnCode
64.55 + fi
64.56 +}
64.57 +
64.58 +# Setup
64.59 +cd "${TOP}"
64.60 +mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
64.61 +rm -rf ${NBTMPDIR}
64.62 +mkdir -p ${NBTMPDIR}
64.63 +
64.64 +# Copy files and create directories and links
64.65 +cd "${TOP}"
64.66 +makeDirectory "${NBTMPDIR}/hello-world/bin"
64.67 +copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
64.68 +
64.69 +
64.70 +# Generate tar file
64.71 +cd "${TOP}"
64.72 +rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/hello-world.tar
64.73 +cd ${NBTMPDIR}
64.74 +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/hello-world.tar *
64.75 +checkReturnCode
64.76 +
64.77 +# Cleanup
64.78 +cd "${TOP}"
64.79 +rm -rf ${NBTMPDIR}
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
65.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/nbproject/Package-Release.bash Sun Jun 25 18:25:05 2017 +0200
65.3 @@ -0,0 +1,76 @@
65.4 +#!/bin/bash -x
65.5 +
65.6 +#
65.7 +# Generated - do not edit!
65.8 +#
65.9 +
65.10 +# Macros
65.11 +TOP=`pwd`
65.12 +CND_PLATFORM=GNU-Linux
65.13 +CND_CONF=Release
65.14 +CND_DISTDIR=dist
65.15 +CND_BUILDDIR=build
65.16 +CND_DLIB_EXT=so
65.17 +NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
65.18 +TMPDIRNAME=tmp-packaging
65.19 +OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world
65.20 +OUTPUT_BASENAME=hello-world
65.21 +PACKAGE_TOP_DIR=hello-world/
65.22 +
65.23 +# Functions
65.24 +function checkReturnCode
65.25 +{
65.26 + rc=$?
65.27 + if [ $rc != 0 ]
65.28 + then
65.29 + exit $rc
65.30 + fi
65.31 +}
65.32 +function makeDirectory
65.33 +# $1 directory path
65.34 +# $2 permission (optional)
65.35 +{
65.36 + mkdir -p "$1"
65.37 + checkReturnCode
65.38 + if [ "$2" != "" ]
65.39 + then
65.40 + chmod $2 "$1"
65.41 + checkReturnCode
65.42 + fi
65.43 +}
65.44 +function copyFileToTmpDir
65.45 +# $1 from-file path
65.46 +# $2 to-file path
65.47 +# $3 permission
65.48 +{
65.49 + cp "$1" "$2"
65.50 + checkReturnCode
65.51 + if [ "$3" != "" ]
65.52 + then
65.53 + chmod $3 "$2"
65.54 + checkReturnCode
65.55 + fi
65.56 +}
65.57 +
65.58 +# Setup
65.59 +cd "${TOP}"
65.60 +mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
65.61 +rm -rf ${NBTMPDIR}
65.62 +mkdir -p ${NBTMPDIR}
65.63 +
65.64 +# Copy files and create directories and links
65.65 +cd "${TOP}"
65.66 +makeDirectory "${NBTMPDIR}/hello-world/bin"
65.67 +copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
65.68 +
65.69 +
65.70 +# Generate tar file
65.71 +cd "${TOP}"
65.72 +rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/hello-world.tar
65.73 +cd ${NBTMPDIR}
65.74 +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/hello-world.tar *
65.75 +checkReturnCode
65.76 +
65.77 +# Cleanup
65.78 +cd "${TOP}"
65.79 +rm -rf ${NBTMPDIR}
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
66.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/nbproject/configurations.xml Sun Jun 25 18:25:05 2017 +0200
66.3 @@ -0,0 +1,71 @@
66.4 +<?xml version="1.0" encoding="UTF-8"?>
66.5 +<configurationDescriptor version="100">
66.6 + <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
66.7 + <logicalFolder name="HeaderFiles"
66.8 + displayName="Header Files"
66.9 + projectFiles="true">
66.10 + <itemPath>welcome.h</itemPath>
66.11 + </logicalFolder>
66.12 + <logicalFolder name="ResourceFiles"
66.13 + displayName="Resource Files"
66.14 + projectFiles="true">
66.15 + </logicalFolder>
66.16 + <logicalFolder name="SourceFiles"
66.17 + displayName="Source Files"
66.18 + projectFiles="true">
66.19 + <itemPath>welcome.cc</itemPath>
66.20 + </logicalFolder>
66.21 + <logicalFolder name="TestFiles"
66.22 + displayName="Test Files"
66.23 + projectFiles="false"
66.24 + kind="TEST_LOGICAL_FOLDER">
66.25 + </logicalFolder>
66.26 + <logicalFolder name="ExternalFiles"
66.27 + displayName="Important Files"
66.28 + projectFiles="false"
66.29 + kind="IMPORTANT_FILES_FOLDER">
66.30 + <itemPath>Makefile</itemPath>
66.31 + </logicalFolder>
66.32 + </logicalFolder>
66.33 + <projectmakefile>Makefile</projectmakefile>
66.34 + <confs>
66.35 + <conf name="Debug" type="1">
66.36 + <toolsSet>
66.37 + <compilerSet>default</compilerSet>
66.38 + <dependencyChecking>true</dependencyChecking>
66.39 + <rebuildPropChanged>false</rebuildPropChanged>
66.40 + </toolsSet>
66.41 + <compileType>
66.42 + </compileType>
66.43 + <item path="welcome.cc" ex="false" tool="1" flavor2="0">
66.44 + </item>
66.45 + <item path="welcome.h" ex="false" tool="3" flavor2="0">
66.46 + </item>
66.47 + </conf>
66.48 + <conf name="Release" type="1">
66.49 + <toolsSet>
66.50 + <compilerSet>default</compilerSet>
66.51 + <dependencyChecking>true</dependencyChecking>
66.52 + <rebuildPropChanged>false</rebuildPropChanged>
66.53 + </toolsSet>
66.54 + <compileType>
66.55 + <cTool>
66.56 + <developmentMode>5</developmentMode>
66.57 + </cTool>
66.58 + <ccTool>
66.59 + <developmentMode>5</developmentMode>
66.60 + </ccTool>
66.61 + <fortranCompilerTool>
66.62 + <developmentMode>5</developmentMode>
66.63 + </fortranCompilerTool>
66.64 + <asmTool>
66.65 + <developmentMode>5</developmentMode>
66.66 + </asmTool>
66.67 + </compileType>
66.68 + <item path="welcome.cc" ex="false" tool="1" flavor2="0">
66.69 + </item>
66.70 + <item path="welcome.h" ex="false" tool="3" flavor2="0">
66.71 + </item>
66.72 + </conf>
66.73 + </confs>
66.74 +</configurationDescriptor>
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
67.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/nbproject/project.xml Sun Jun 25 18:25:05 2017 +0200
67.3 @@ -0,0 +1,28 @@
67.4 +<?xml version="1.0" encoding="UTF-8"?>
67.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
67.6 + <type>org.netbeans.modules.cnd.makeproject</type>
67.7 + <configuration>
67.8 + <data xmlns="http://www.netbeans.org/ns/make-project/1">
67.9 + <name>hello-world2</name>
67.10 + <c-extensions/>
67.11 + <cpp-extensions>cc</cpp-extensions>
67.12 + <header-extensions>h</header-extensions>
67.13 + <sourceEncoding>UTF-8</sourceEncoding>
67.14 + <make-dep-projects/>
67.15 + <sourceRootList/>
67.16 + <confList>
67.17 + <confElem>
67.18 + <name>Debug</name>
67.19 + <type>1</type>
67.20 + </confElem>
67.21 + <confElem>
67.22 + <name>Release</name>
67.23 + <type>1</type>
67.24 + </confElem>
67.25 + </confList>
67.26 + <formatting>
67.27 + <project-formatting-style>false</project-formatting-style>
67.28 + </formatting>
67.29 + </data>
67.30 + </configuration>
67.31 +</project>
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
68.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/welcome.cc Sun Jun 25 18:25:05 2017 +0200
68.3 @@ -0,0 +1,38 @@
68.4 +/*
68.5 + * Copyright (c) 2009-2014, Oracle and/or its affiliates. All rights reserved.
68.6 + *
68.7 + * Redistribution and use in source and binary forms, with or without
68.8 + * modification, are permitted provided that the following conditions are met:
68.9 + *
68.10 + * * Redistributions of source code must retain the above copyright notice,
68.11 + * this list of conditions and the following disclaimer.
68.12 + *
68.13 + * * Redistributions in binary form must reproduce the above copyright notice,
68.14 + * this list of conditions and the following disclaimer in the documentation
68.15 + * and/or other materials provided with the distribution.
68.16 + *
68.17 + * * Neither the name of Oracle nor the names of its contributors
68.18 + * may be used to endorse or promote products derived from this software without
68.19 + * specific prior written permission.
68.20 + *
68.21 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
68.22 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
68.23 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
68.24 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
68.25 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
68.26 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
68.27 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
68.28 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
68.29 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
68.30 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
68.31 + * THE POSSIBILITY OF SUCH DAMAGE.
68.32 + */
68.33 +
68.34 +#include <iostream>
68.35 +
68.36 +int main(int argc, char**argv) {
68.37 + // Prints hello message...
68.38 + std::cout << "Hello World!" << std::endl;
68.39 +
68.40 + return 0;
68.41 +}
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
69.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/src/ide/analysis/modernize/HeaderTest.java Sun Jun 25 18:25:05 2017 +0200
69.3 @@ -0,0 +1,62 @@
69.4 +package ide.analysis.modernize;
69.5 +
69.6 +import com.sun.tools.ide.analysis.modernize.impl.ModernizeFix;
69.7 +import com.sun.tools.ide.analysis.modernize.impl.YamlParser;
69.8 +import java.io.File;
69.9 +import java.nio.file.Files;
69.10 +import java.util.List;
69.11 +import static junit.framework.TestCase.fail;
69.12 +import org.netbeans.modules.cnd.test.CndCoreTestUtils;
69.13 +import static org.netbeans.modules.nativeexecution.test.NativeExecutionBaseTestCase.createTempFile;
69.14 +import org.openide.cookies.EditorCookie;
69.15 +import org.openide.filesystems.FileObject;
69.16 +import org.openide.filesystems.FileUtil;
69.17 +import org.openide.loaders.DataObject;
69.18 +
69.19 +/*
69.20 + * To change this license header, choose License Headers in Project Properties.
69.21 + * To change this template file, choose Tools | Templates
69.22 + * and open the template in the editor.
69.23 + */
69.24 +/**
69.25 + *
69.26 + * @author Ilia Gromov
69.27 + */
69.28 +public class HeaderTest extends TidyTestCase {
69.29 +
69.30 + private final String source = "src/llvm-header-guard.cpp";
69.31 + private final String header = "src/llvm-header-guard.h";
69.32 +
69.33 + public HeaderTest() {
69.34 + super("project-with-headers");
69.35 + }
69.36 +
69.37 + public void testLlvmHeaderGuard() {
69.38 + performTest(source, "llvm-header-guard", true);
69.39 + }
69.40 +
69.41 + @Override
69.42 + protected void processTestResults(List<ModernizeFix> fixes, String footerName) throws Exception {
69.43 + for (ModernizeFix fix : fixes) {
69.44 + fix.implement();
69.45 +
69.46 + for (YamlParser.Replacement replacement : fix.getReplacements()) {
69.47 + FileObject fo = FileUtil.toFileObject(new File(replacement.filePath));
69.48 +
69.49 + DataObject dObj = DataObject.find(fo);
69.50 + EditorCookie ec = dObj.getLookup().lookup(EditorCookie.class);
69.51 + ec.saveDocument();
69.52 + }
69.53 + }
69.54 +
69.55 + File diffFile = createTempFile("diff", null, false);
69.56 +
69.57 + boolean diff = CndCoreTestUtils.diff(new File(FileUtil.toFile(getProjectDir()), header), getGoldenFile(header), diffFile);
69.58 +
69.59 + if (diff) {
69.60 + byte[] readAllBytes = Files.readAllBytes(diffFile.toPath());
69.61 + System.err.println(new String(readAllBytes));
69.62 + fail();
69.63 + }
69.64 + }
69.65 +}
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
70.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/src/ide/analysis/modernize/RequestImpl.java Sun Jun 25 18:25:05 2017 +0200
70.3 @@ -0,0 +1,44 @@
70.4 +/*
70.5 + * To change this license header, choose License Headers in Project Properties.
70.6 + * To change this template file, choose Tools | Templates
70.7 + * and open the template in the editor.
70.8 + */
70.9 +package ide.analysis.modernize;
70.10 +
70.11 +import javax.swing.text.Document;
70.12 +import org.netbeans.modules.cnd.api.model.CsmFile;
70.13 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
70.14 +
70.15 +/**
70.16 + *
70.17 + * @author Ilia Gromov
70.18 + */
70.19 +class RequestImpl implements CsmErrorProvider.Request {
70.20 +
70.21 + private final CsmFile csmFile;
70.22 +
70.23 + public RequestImpl(CsmFile csmFile) {
70.24 + this.csmFile = csmFile;
70.25 + }
70.26 +
70.27 + @Override
70.28 + public CsmFile getFile() {
70.29 + return csmFile;
70.30 + }
70.31 +
70.32 + @Override
70.33 + public boolean isCancelled() {
70.34 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
70.35 + }
70.36 +
70.37 + @Override
70.38 + public Document getDocument() {
70.39 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
70.40 + }
70.41 +
70.42 + @Override
70.43 + public CsmErrorProvider.EditorEvent getEvent() {
70.44 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
70.45 + }
70.46 +
70.47 +}
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
71.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/src/ide/analysis/modernize/ResponseImpl.java Sun Jun 25 18:25:05 2017 +0200
71.3 @@ -0,0 +1,46 @@
71.4 +/*
71.5 + * To change this license header, choose License Headers in Project Properties.
71.6 + * To change this template file, choose Tools | Templates
71.7 + * and open the template in the editor.
71.8 + */
71.9 +package ide.analysis.modernize;
71.10 +
71.11 +import com.sun.tools.ide.analysis.modernize.impl.ModernizeErrorInfo;
71.12 +import com.sun.tools.ide.analysis.modernize.impl.ModernizeFix;
71.13 +import com.sun.tools.ide.analysis.modernize.impl.YamlParser;
71.14 +import java.util.List;
71.15 +import junit.framework.TestCase;
71.16 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
71.17 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
71.18 +import org.openide.util.Exceptions;
71.19 +
71.20 +/**
71.21 + *
71.22 + * @author Ilia Gromov
71.23 + */
71.24 +class ResponseImpl implements CsmErrorProvider.Response {
71.25 +
71.26 + private final List<ModernizeFix> fixes;
71.27 +
71.28 + public ResponseImpl(List<ModernizeFix> fixes) {
71.29 + this.fixes = fixes;
71.30 + }
71.31 +
71.32 + @Override
71.33 + public void addError(CsmErrorInfo info) {
71.34 + try {
71.35 + TestCase.assertTrue(info instanceof ModernizeErrorInfo);
71.36 + final List<YamlParser.Replacement> replacements = ((ModernizeErrorInfo) info).getDiagnostics().getReplacements();
71.37 + final String id = ((ModernizeErrorInfo) info).getId();
71.38 + ModernizeFix fix = new ModernizeFix(replacements, id);
71.39 + fixes.add(fix);
71.40 + } catch (Exception ex) {
71.41 + Exceptions.printStackTrace(ex);
71.42 + }
71.43 + }
71.44 +
71.45 + @Override
71.46 + public void done() {
71.47 + }
71.48 +
71.49 +}
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
72.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/src/ide/analysis/modernize/SingleCppFileCheckTest.java Sun Jun 25 18:25:05 2017 +0200
72.3 @@ -0,0 +1,64 @@
72.4 +package ide.analysis.modernize;
72.5 +
72.6 +import com.sun.tools.ide.analysis.modernize.impl.ModernizeFix;
72.7 +import java.io.File;
72.8 +import java.nio.file.Files;
72.9 +import java.util.List;
72.10 +import org.junit.Test;
72.11 +import org.netbeans.modules.cnd.test.CndCoreTestUtils;
72.12 +import org.openide.cookies.EditorCookie;
72.13 +import org.openide.filesystems.FileObject;
72.14 +import org.openide.filesystems.FileUtil;
72.15 +import org.openide.loaders.DataObject;
72.16 +
72.17 +/**
72.18 + *
72.19 + * @author Ilia Gromov
72.20 + */
72.21 +public class SingleCppFileCheckTest extends TidyTestCase {
72.22 +
72.23 + public SingleCppFileCheckTest() {
72.24 + super("hello-cmake-world");
72.25 + }
72.26 +
72.27 + @Override
72.28 + protected void setUp() throws Exception {
72.29 + super.setUp();
72.30 + }
72.31 +
72.32 + public void testModernizeUseNullptr() {
72.33 + performTest("src/modernize-use-nullptr.cpp", "modernize-use-nullptr", true);
72.34 + }
72.35 +
72.36 + public void testModernizeLoopConvert() {
72.37 + performTest("src/modernize-loop-convert.cpp", "modernize-loop-convert", true);
72.38 + }
72.39 +
72.40 + @Test
72.41 + public void testModernizeRawStringLiteral() {
72.42 + performTest("src/modernize-raw-string-literal.cpp", "modernize-raw-string-literal", true);
72.43 + }
72.44 +
72.45 + @Override
72.46 + protected void processTestResults(List<ModernizeFix> fixes, String startFileName) throws Exception {
72.47 + for (ModernizeFix fix : fixes) {
72.48 + fix.implement();
72.49 + }
72.50 +
72.51 + FileObject footer = getSourceFile(startFileName);
72.52 +
72.53 + DataObject dObj = DataObject.find(footer);
72.54 + EditorCookie ec = dObj.getLookup().lookup(EditorCookie.class);
72.55 + ec.saveDocument();
72.56 +
72.57 + File diffFile = createTempFile("diff", null, false);
72.58 +
72.59 + boolean diff = CndCoreTestUtils.diff(FileUtil.toFile(footer), getGoldenFile(startFileName), diffFile);
72.60 +
72.61 + if (diff) {
72.62 + byte[] readAllBytes = Files.readAllBytes(diffFile.toPath());
72.63 + System.err.println(new String(readAllBytes));
72.64 + fail();
72.65 + }
72.66 + }
72.67 +}
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
73.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/src/ide/analysis/modernize/TidyTestCase.java Sun Jun 25 18:25:05 2017 +0200
73.3 @@ -0,0 +1,237 @@
73.4 +/*
73.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
73.6 + *
73.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
73.8 + *
73.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
73.10 + * Other names may be trademarks of their respective owners.
73.11 + *
73.12 + * The contents of this file are subject to the terms of either the GNU
73.13 + * General Public License Version 2 only ("GPL") or the Common
73.14 + * Development and Distribution License("CDDL") (collectively, the
73.15 + * "License"). You may not use this file except in compliance with the
73.16 + * License. You can obtain a copy of the License at
73.17 + * http://www.netbeans.org/cddl-gplv2.html
73.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
73.19 + * specific language governing permissions and limitations under the
73.20 + * License. When distributing the software, include this License Header
73.21 + * Notice in each file and include the License file at
73.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
73.23 + * particular file as subject to the "Classpath" exception as provided
73.24 + * by Oracle in the GPL Version 2 section of the License file that
73.25 + * accompanied this code. If applicable, add the following below the
73.26 + * License Header, with the fields enclosed by brackets [] replaced by
73.27 + * your own identifying information:
73.28 + * "Portions Copyrighted [year] [name of copyright owner]"
73.29 + *
73.30 + * If you wish your version of this file to be governed by only the CDDL
73.31 + * or only the GPL Version 2, indicate your decision by adding
73.32 + * "[Contributor] elects to include this software in this distribution
73.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
73.34 + * single choice of license, a recipient has the option to distribute
73.35 + * your version of this file under either the CDDL, the GPL Version 2 or
73.36 + * to extend the choice of license to its licensees as provided above.
73.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
73.38 + * Version 2 license, then the option applies only if the new code is
73.39 + * made subject to such option by the copyright holder.
73.40 + *
73.41 + * Contributor(s):
73.42 + *
73.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
73.44 + */
73.45 +package ide.analysis.modernize;
73.46 +
73.47 +import com.sun.tools.ide.analysis.modernize.impl.DiagnosticsTool;
73.48 +import com.sun.tools.ide.analysis.modernize.impl.ModernizeAnalyzerImpl;
73.49 +import com.sun.tools.ide.analysis.modernize.impl.ModernizeFix;
73.50 +import com.sun.tools.ide.analysis.modernize.impl.YamlParser;
73.51 +import com.sun.tools.ide.analysis.modernize.utils.AnalyticsTools;
73.52 +import java.io.File;
73.53 +import java.nio.file.Files;
73.54 +import java.nio.file.attribute.PosixFilePermissions;
73.55 +import java.util.ArrayList;
73.56 +import java.util.Arrays;
73.57 +import java.util.Collection;
73.58 +import java.util.Collections;
73.59 +import java.util.List;
73.60 +import java.util.logging.ConsoleHandler;
73.61 +import java.util.logging.Level;
73.62 +import java.util.logging.LogManager;
73.63 +import java.util.prefs.Preferences;
73.64 +import org.netbeans.api.progress.ProgressHandle;
73.65 +import org.netbeans.api.project.Project;
73.66 +import org.netbeans.api.project.ProjectManager;
73.67 +import org.netbeans.api.project.ui.OpenProjects;
73.68 +import org.netbeans.modules.analysis.SPIAccessor;
73.69 +import org.netbeans.modules.analysis.spi.Analyzer;
73.70 +import org.netbeans.modules.cnd.api.model.CsmFile;
73.71 +import org.netbeans.modules.cnd.api.model.CsmModel;
73.72 +import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
73.73 +import org.netbeans.modules.cnd.api.model.CsmProject;
73.74 +import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
73.75 +import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAudit;
73.76 +import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
73.77 +import org.netbeans.modules.cnd.api.project.NativeProject;
73.78 +import org.netbeans.modules.cnd.api.project.NativeProjectRegistry;
73.79 +import org.netbeans.modules.cnd.api.toolchain.CompilerSet;
73.80 +import org.netbeans.modules.cnd.api.toolchain.CompilerSetManager;
73.81 +import org.netbeans.modules.cnd.makeproject.api.MakeProject;
73.82 +import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
73.83 +import org.netbeans.modules.cnd.modelutil.CsmUtilities;
73.84 +import org.netbeans.modules.cnd.test.CndBaseTestCase;
73.85 +import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
73.86 +import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
73.87 +import org.netbeans.modules.refactoring.api.Scope;
73.88 +import org.openide.filesystems.FileObject;
73.89 +import org.openide.filesystems.FileUtil;
73.90 +import org.openide.util.Exceptions;
73.91 +
73.92 +/**
73.93 + *
73.94 + * @author Ilia Gromov
73.95 + */
73.96 +public abstract class TidyTestCase extends CndBaseTestCase {
73.97 +
73.98 + private final String projectName;
73.99 +
73.100 + private List<FileObject> fileObjects;
73.101 + private MakeProject project;
73.102 + private FileObject projectDirFileObject;
73.103 +
73.104 + private final String CLANG_TIDY_PATH = "clang-tidy-3.9p";
73.105 +
73.106 + public TidyTestCase(String projectName) {
73.107 + super(projectName);
73.108 +
73.109 + this.projectName = projectName;
73.110 + }
73.111 +
73.112 + protected static CodeAudit findAudit(Collection<CodeAudit> audits, String id) {
73.113 + for (CodeAudit audit : audits) {
73.114 + if (audit.getID().equals(id)) {
73.115 + return audit;
73.116 + }
73.117 + }
73.118 + return null;
73.119 + }
73.120 +
73.121 + @Override
73.122 + protected void setUp() throws Exception {
73.123 + super.setUp();
73.124 + LogManager.getLogManager().reset();
73.125 +
73.126 + java.util.logging.Logger LOG = java.util.logging.Logger.getLogger("ide.analysis.tidy");
73.127 + LOG.setLevel(Level.ALL);
73.128 +
73.129 + ConsoleHandler consoleHandler = new ConsoleHandler();
73.130 + consoleHandler.setLevel(Level.ALL);
73.131 + LOG.addHandler(consoleHandler);
73.132 +
73.133 + File clangTidyFile = getBinaryFile();
73.134 + Files.setPosixFilePermissions(clangTidyFile.toPath(), PosixFilePermissions.fromString("rwxrwxrwx"));
73.135 +
73.136 + assertTrue(getBinaryFile().exists());
73.137 +
73.138 + File projectDirFile = getDataFile(projectName);
73.139 + projectDirFileObject = FileUtil.toFileObject(projectDirFile);
73.140 +
73.141 + fileObjects = new ArrayList<FileObject>();
73.142 +
73.143 + project = (MakeProject) ProjectManager.getDefault().findProject(projectDirFileObject);
73.144 +
73.145 + OpenProjects.getDefault().open(new Project[]{project}, false);
73.146 + while (!OpenProjects.getDefault().isProjectOpen(project)) {
73.147 + try {
73.148 + Thread.sleep(100);
73.149 + } catch (InterruptedException ex) {
73.150 + Exceptions.printStackTrace(ex);
73.151 + }
73.152 + }
73.153 +
73.154 + CsmModel model = CsmModelAccessor.getModel();
73.155 + assertNotNull(project);
73.156 +
73.157 + NativeProject np = project.getLookup().lookup(NativeProject.class);
73.158 + NativeProjectRegistry.getDefault().register(np);
73.159 + model.enableProject(np);
73.160 + assertNotNull(np);
73.161 +
73.162 + CsmProject csmProject = model.getProject(np);
73.163 + assertNotNull(csmProject);
73.164 +
73.165 + csmProject.waitParse();
73.166 +
73.167 + }
73.168 +
73.169 + public ExecutionEnvironment getExecEnv() {
73.170 + ExecutionEnvironment execEnv = ExecutionEnvironmentFactory.getLocal();
73.171 + return execEnv;
73.172 + }
73.173 +
73.174 + public CompilerSet getCompilerSet() {
73.175 + CompilerSetManager csm = CompilerSetManager.get(getExecEnv());
73.176 + return csm.getDefaultCompilerSet();
73.177 + }
73.178 +
73.179 + public MakeProject getProject() {
73.180 + return project;
73.181 + }
73.182 +
73.183 + public FileObject getProjectDir() {
73.184 + return projectDirFileObject;
73.185 + }
73.186 +
73.187 + public FileObject getSourceFile(String name) {
73.188 + return FileUtil.toFileObject(new File(FileUtil.toFile(getProjectDir()), name));
73.189 + }
73.190 +
73.191 + public File getBinaryFile() {
73.192 + return new File(getDataDir(), CLANG_TIDY_PATH);
73.193 + }
73.194 +
73.195 + protected final void performTest(String startFileName, String checkName, boolean isStartFile) {
73.196 + try {
73.197 + FileObject startFile = getSourceFile(startFileName);
73.198 + assertTrue(startFile.isValid());
73.199 +
73.200 + Scope scope = Scope.create(null, null, Arrays.asList(new FileObject[]{startFile}));
73.201 + Analyzer.Context context = SPIAccessor.ACCESSOR.createContext(scope, null, null, ProgressHandle.createHandle("dummy"), 0, 0);
73.202 + Analyzer.AnalyzerFactory factory = new ModernizeAnalyzerImpl.AnalyzerFactoryImpl();
73.203 +
73.204 + ModernizeAnalyzerImpl analyzer = (ModernizeAnalyzerImpl) factory.createAnalyzer(context);
73.205 + ExecutionEnvironment execEnv = ExecutionEnvironmentFactory.getLocal();
73.206 + final CsmFile csmFile = CsmUtilities.getCsmFile(startFile, true, false);
73.207 + Item item = AnalyticsTools.findItem(csmFile, getProject());
73.208 +
73.209 + Collection<CodeAudit> audits = DiagnosticsTool.getAudits(getBinaryFile().getAbsolutePath(), execEnv, new AuditPreferences(Preferences.userNodeForPackage(this.getClass())));
73.210 + CodeAudit audit = findAudit(audits, checkName);
73.211 + assertNotNull(audit);
73.212 +
73.213 + // ----- BEGIN diagnostics -----
73.214 + DiagnosticsTool diagnosticsTool = new DiagnosticsTool(execEnv, item, getProject(), getBinaryFile().getAbsolutePath());
73.215 +
73.216 + int exitCode = diagnosticsTool.process(Collections.singleton(audit.getID()), csmFile, true);
73.217 + if (exitCode != DiagnosticsTool.STATUS_OK) {
73.218 + fail();
73.219 + }
73.220 +
73.221 + List<YamlParser.Diagnostics> diags = YamlParser.getDefault().parseYaml(diagnosticsTool.getYamlAsString());
73.222 + List<ModernizeFix> fixes = new ArrayList<ModernizeFix>();
73.223 +
73.224 + CsmErrorProvider.Request request = new RequestImpl(csmFile);
73.225 + CsmErrorProvider.Response response = new ResponseImpl(fixes);
73.226 +
73.227 + analyzer.getErrorProvider(null).postProcess(false, csmFile, getProject(), diags, request, response);
73.228 + // ----- END diagnostics -----
73.229 +
73.230 + processTestResults(fixes, startFileName);
73.231 + } catch (Exception ex) {
73.232 + ex.printStackTrace(System.err);
73.233 + fail(ex.toString());
73.234 + }
73.235 + }
73.236 +
73.237 + protected void processTestResults(List<ModernizeFix> fixes, String startFileName) throws Exception {
73.238 +
73.239 + }
73.240 +}
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
74.2 +++ b/c.s.tools.ide.analysis.modernize/test/unit/src/ide/analysis/modernize/YamlTest.java Sun Jun 25 18:25:05 2017 +0200
74.3 @@ -0,0 +1,117 @@
74.4 +/*
74.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
74.6 + *
74.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
74.8 + *
74.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
74.10 + * Other names may be trademarks of their respective owners.
74.11 + *
74.12 + * The contents of this file are subject to the terms of either the GNU
74.13 + * General Public License Version 2 only ("GPL") or the Common
74.14 + * Development and Distribution License("CDDL") (collectively, the
74.15 + * "License"). You may not use this file except in compliance with the
74.16 + * License. You can obtain a copy of the License at
74.17 + * http://www.netbeans.org/cddl-gplv2.html
74.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
74.19 + * specific language governing permissions and limitations under the
74.20 + * License. When distributing the software, include this License Header
74.21 + * Notice in each file and include the License file at
74.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
74.23 + * particular file as subject to the "Classpath" exception as provided
74.24 + * by Oracle in the GPL Version 2 section of the License file that
74.25 + * accompanied this code. If applicable, add the following below the
74.26 + * License Header, with the fields enclosed by brackets [] replaced by
74.27 + * your own identifying information:
74.28 + * "Portions Copyrighted [year] [name of copyright owner]"
74.29 + *
74.30 + * If you wish your version of this file to be governed by only the CDDL
74.31 + * or only the GPL Version 2, indicate your decision by adding
74.32 + * "[Contributor] elects to include this software in this distribution
74.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
74.34 + * single choice of license, a recipient has the option to distribute
74.35 + * your version of this file under either the CDDL, the GPL Version 2 or
74.36 + * to extend the choice of license to its licensees as provided above.
74.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
74.38 + * Version 2 license, then the option applies only if the new code is
74.39 + * made subject to such option by the copyright holder.
74.40 + *
74.41 + * Contributor(s):
74.42 + *
74.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
74.44 + */
74.45 +package ide.analysis.modernize;
74.46 +
74.47 +import com.sun.tools.ide.analysis.modernize.impl.DiagnosticsTool;
74.48 +import com.sun.tools.ide.analysis.modernize.impl.ModernizeAnalyzerImpl;
74.49 +import com.sun.tools.ide.analysis.modernize.utils.AnalyticsTools;
74.50 +import java.io.File;
74.51 +import java.io.IOException;
74.52 +import java.nio.file.Files;
74.53 +import java.util.Arrays;
74.54 +import java.util.Collections;
74.55 +import org.junit.Test;
74.56 +import org.netbeans.api.progress.ProgressHandle;
74.57 +import org.netbeans.modules.analysis.SPIAccessor;
74.58 +import org.netbeans.modules.analysis.spi.Analyzer;
74.59 +import org.netbeans.modules.cnd.api.model.CsmFile;
74.60 +import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
74.61 +import org.netbeans.modules.cnd.modelutil.CsmUtilities;
74.62 +import org.netbeans.modules.cnd.test.CndCoreTestUtils;
74.63 +import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
74.64 +import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
74.65 +import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
74.66 +import org.netbeans.modules.refactoring.api.Scope;
74.67 +import org.openide.filesystems.FileObject;
74.68 +
74.69 +/**
74.70 + *
74.71 + * @author Ilia Gromov
74.72 + */
74.73 +public class YamlTest extends TidyTestCase {
74.74 +
74.75 + public YamlTest() {
74.76 + super("hello-world");
74.77 + }
74.78 +
74.79 + @Test
74.80 + public void testYaml() throws IOException, ConnectionManager.CancellationException {
74.81 + FileObject singleFileObject = getSourceFile("welcome.cc");
74.82 +
74.83 + File goldenFile = getGoldenFile("hello-world.json");
74.84 + String goldenYaml = new String(Files.readAllBytes(goldenFile.toPath()), "UTF-8").replaceAll("\\$path", getDataDir().getAbsolutePath());
74.85 +
74.86 + Scope scope = Scope.create(null, null, Arrays.asList(new FileObject[]{singleFileObject}));
74.87 + Analyzer.Context context = SPIAccessor.ACCESSOR.createContext(scope, null, null, ProgressHandle.createHandle("dummy"), 0, 0);
74.88 +
74.89 + Analyzer.AnalyzerFactory factory = new ModernizeAnalyzerImpl.AnalyzerFactoryImpl();
74.90 + ModernizeAnalyzerImpl analyzer = (ModernizeAnalyzerImpl) factory.createAnalyzer(context);
74.91 +
74.92 + ExecutionEnvironment execEnv = ExecutionEnvironmentFactory.getLocal();
74.93 +
74.94 + CsmFile csmFile = CsmUtilities.getCsmFile(singleFileObject, false, false);
74.95 + Item item = AnalyticsTools.findItem(csmFile, getProject());
74.96 +
74.97 + DiagnosticsTool diagnosticsTool = new DiagnosticsTool(execEnv, item, getProject(), getBinaryFile().getAbsolutePath());
74.98 +
74.99 + int exitCode = diagnosticsTool.process(Collections.singleton("*"), csmFile, true);
74.100 +
74.101 + if (exitCode != DiagnosticsTool.STATUS_OK) {
74.102 + fail();
74.103 + }
74.104 + String yamlAsString = diagnosticsTool.getYamlAsString();
74.105 +
74.106 + File real = File.createTempFile("test", null);
74.107 + Files.write(real.toPath(), yamlAsString.getBytes());
74.108 +
74.109 + File expected = File.createTempFile("test", null);
74.110 + Files.write(expected.toPath(), goldenYaml.getBytes());
74.111 +
74.112 + File diff = File.createTempFile("test", null);
74.113 + if (CndCoreTestUtils.diff(real, expected, diff)) {
74.114 + System.err.println("============DIFF============");
74.115 + System.err.println(new String(Files.readAllBytes(diff.toPath()), "UTF-8"));
74.116 + System.err.println("============DIFF============");
74.117 + fail();
74.118 + }
74.119 + }
74.120 +}
75.1 --- a/callgraph/src/main/java/org/netbeans/lib/callgraph/Arguments.java Sun Jun 25 18:17:37 2017 +0200
75.2 +++ b/callgraph/src/main/java/org/netbeans/lib/callgraph/Arguments.java Sun Jun 25 18:25:05 2017 +0200
75.3 @@ -43,7 +43,6 @@
75.4 */
75.5 package org.netbeans.lib.callgraph;
75.6
75.7 -import com.sun.javafx.scene.traversal.WeightedClosestCorner;
75.8 import java.io.File;
75.9 import java.io.IOException;
75.10 import java.util.Arrays;
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
76.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/build.xml Sun Jun 25 18:25:05 2017 +0200
76.3 @@ -0,0 +1,8 @@
76.4 +<?xml version="1.0" encoding="UTF-8"?>
76.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
76.6 +<!-- for some information on what you could do (e.g. targets to override). -->
76.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
76.8 +<project name="analysis.clangtidy.Linux_x86_64" default="netbeans" basedir=".">
76.9 + <description>Builds, tests, and runs the project analysis.clangtidy.Linux_x86_64.</description>
76.10 + <import file="nbproject/build-impl.xml"/>
76.11 +</project>
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
77.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/manifest.mf Sun Jun 25 18:25:05 2017 +0200
77.3 @@ -0,0 +1,6 @@
77.4 +Manifest-Version: 1.0
77.5 +AutoUpdate-Show-In-Client: true
77.6 +OpenIDE-Module: org.netbeans.modules.analysis.clangtidy.Linux_x86_64
77.7 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/analysis/clangtidy/Linux_x86_64/Bundle.properties
77.8 +OpenIDE-Module-Specification-Version: 1.0.2
77.9 +
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
78.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/nbproject/build-impl.xml Sun Jun 25 18:25:05 2017 +0200
78.3 @@ -0,0 +1,42 @@
78.4 +<?xml version="1.0" encoding="UTF-8"?>
78.5 +<!--
78.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
78.7 +*** EDIT ../build.xml INSTEAD ***
78.8 +-->
78.9 +<project name="org.netbeans.modules.analysis.clangtidy.Linux_x86_64-impl" basedir="..">
78.10 + <fail message="Please build using Ant 1.7.1 or higher.">
78.11 + <condition>
78.12 + <not>
78.13 + <antversion atleast="1.7.1"/>
78.14 + </not>
78.15 + </condition>
78.16 + </fail>
78.17 + <property file="nbproject/private/platform-private.properties"/>
78.18 + <property file="nbproject/platform.properties"/>
78.19 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
78.20 + <attribute name="name"/>
78.21 + <attribute name="value"/>
78.22 + <sequential>
78.23 + <property name="@{name}" value="${@{value}}"/>
78.24 + </sequential>
78.25 + </macrodef>
78.26 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
78.27 + <attribute name="property"/>
78.28 + <attribute name="value"/>
78.29 + <sequential>
78.30 + <property name="@{property}" value="@{value}"/>
78.31 + </sequential>
78.32 + </macrodef>
78.33 + <property file="${user.properties.file}"/>
78.34 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
78.35 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
78.36 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
78.37 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
78.38 + <condition>
78.39 + <not>
78.40 + <contains string="${cluster.path.evaluated}" substring="platform"/>
78.41 + </not>
78.42 + </condition>
78.43 + </fail>
78.44 + <import file="${harness.dir}/build.xml"/>
78.45 +</project>
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
79.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/nbproject/platform.properties Sun Jun 25 18:25:05 2017 +0200
79.3 @@ -0,0 +1,16 @@
79.4 +cluster.path=\
79.5 + ${nbplatform.active.dir}/profiler:\
79.6 + ${nbplatform.active.dir}/nb:\
79.7 + ${nbplatform.active.dir}/websvccommon:\
79.8 + ${nbplatform.active.dir}/java:\
79.9 + ${nbplatform.active.dir}/platform:\
79.10 + ${nbplatform.active.dir}/cnd:\
79.11 + ${nbplatform.active.dir}/ergonomics:\
79.12 + ${nbplatform.active.dir}/cndext:\
79.13 + ${nbplatform.active.dir}/apisupport:\
79.14 + ${nbplatform.active.dir}/extide:\
79.15 + ${nbplatform.active.dir}/javafx:\
79.16 + ${nbplatform.active.dir}/ide:\
79.17 + ${nbplatform.active.dir}/dlight:\
79.18 + ${nbplatform.active.dir}/harness
79.19 +nbplatform.active=default
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
80.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/nbproject/project.properties Sun Jun 25 18:25:05 2017 +0200
80.3 @@ -0,0 +1,9 @@
80.4 +javac.source=1.7
80.5 +javac.compilerargs=-Xlint -Xlint:-serial
80.6 +license.file=src/org/netbeans/modules/analysis/clangtidy/Linux_x86_64/LICENSE.TXT
80.7 +nbm.executable.files=clang-tidy/**
80.8 +nbm.homepage=http://clang.llvm.org/extra/clang-tidy/
80.9 +nbm.module.author=Ilia Gromov
80.10 +nbm.needs.restart=true
80.11 +keystore=nbproject/private/keystore
80.12 +nbm_alias=myself
80.13 \ No newline at end of file
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
81.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/nbproject/project.xml Sun Jun 25 18:25:05 2017 +0200
81.3 @@ -0,0 +1,12 @@
81.4 +<?xml version="1.0" encoding="UTF-8"?>
81.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
81.6 + <type>org.netbeans.modules.apisupport.project</type>
81.7 + <configuration>
81.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
81.9 + <code-name-base>org.netbeans.modules.analysis.clangtidy.Linux_x86_64</code-name-base>
81.10 + <standalone/>
81.11 + <module-dependencies/>
81.12 + <public-packages/>
81.13 + </data>
81.14 + </configuration>
81.15 +</project>
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
82.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/release/clang-tidy/README.txt Sun Jun 25 18:25:05 2017 +0200
82.3 @@ -0,0 +1,1 @@
82.4 +Place clang-tidy binary near this file
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
83.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/src/org/netbeans/modules/analysis/clangtidy/Linux_x86_64/Bundle.properties Sun Jun 25 18:25:05 2017 +0200
83.3 @@ -0,0 +1,3 @@
83.4 +OpenIDE-Module-Display-Category=Analysis tools
83.5 +OpenIDE-Module-Name=Linux x86_64 clang-tidy
83.6 +OpenIDE-Module-Short-Description=Bundled clang-tidy binaries for Linux x86-64
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
84.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/src/org/netbeans/modules/analysis/clangtidy/Linux_x86_64/LICENSE.TXT Sun Jun 25 18:25:05 2017 +0200
84.3 @@ -0,0 +1,157 @@
84.4 +==============================================================================
84.5 +LLVM Release License
84.6 +==============================================================================
84.7 +University of Illinois/NCSA
84.8 +Open Source License
84.9 +
84.10 +Copyright (c) 2003-2016 University of Illinois at Urbana-Champaign.
84.11 +All rights reserved.
84.12 +
84.13 +Developed by:
84.14 +
84.15 + LLVM Team
84.16 +
84.17 + University of Illinois at Urbana-Champaign
84.18 +
84.19 + http://llvm.org
84.20 +
84.21 +Permission is hereby granted, free of charge, to any person obtaining a copy of
84.22 +this software and associated documentation files (the "Software"), to deal with
84.23 +the Software without restriction, including without limitation the rights to
84.24 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
84.25 +of the Software, and to permit persons to whom the Software is furnished to do
84.26 +so, subject to the following conditions:
84.27 +
84.28 + * Redistributions of source code must retain the above copyright notice,
84.29 + this list of conditions and the following disclaimers.
84.30 +
84.31 + * Redistributions in binary form must reproduce the above copyright notice,
84.32 + this list of conditions and the following disclaimers in the
84.33 + documentation and/or other materials provided with the distribution.
84.34 +
84.35 + * Neither the names of the LLVM Team, University of Illinois at
84.36 + Urbana-Champaign, nor the names of its contributors may be used to
84.37 + endorse or promote products derived from this Software without specific
84.38 + prior written permission.
84.39 +
84.40 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84.41 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
84.42 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
84.43 +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
84.44 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
84.45 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
84.46 +SOFTWARE.
84.47 +
84.48 +==============================================================================
84.49 +Copyrights and Licenses for Third Party Software Distributed with LLVM:
84.50 +==============================================================================
84.51 +The LLVM software contains code written by third parties. Such software will
84.52 +have its own individual LICENSE.TXT file in the directory in which it appears.
84.53 +This file will describe the copyrights, license, and restrictions which apply
84.54 +to that code.
84.55 +
84.56 +The disclaimer of warranty in the University of Illinois Open Source License
84.57 +applies to all code in the LLVM Distribution, and nothing in any of the
84.58 +other licenses gives permission to use the names of the LLVM Team or the
84.59 +University of Illinois to endorse or promote products derived from this
84.60 +Software.
84.61 +
84.62 +The following pieces of software have additional or alternate copyrights,
84.63 +licenses, and/or restrictions:
84.64 +
84.65 +Program Directory
84.66 +------- ---------
84.67 +Autoconf llvm/autoconf
84.68 + llvm/projects/ModuleMaker/autoconf
84.69 +Google Test llvm/utils/unittest/googletest
84.70 +OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
84.71 +pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
84.72 +ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
84.73 +md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
84.74 +
84.75 +==============================================================================
84.76 +LLVM Release License
84.77 +==============================================================================
84.78 +University of Illinois/NCSA
84.79 +Open Source License
84.80 +
84.81 +Copyright (c) 2007-2016 University of Illinois at Urbana-Champaign.
84.82 +All rights reserved.
84.83 +
84.84 +Developed by:
84.85 +
84.86 + LLVM Team
84.87 +
84.88 + University of Illinois at Urbana-Champaign
84.89 +
84.90 + http://llvm.org
84.91 +
84.92 +Permission is hereby granted, free of charge, to any person obtaining a copy of
84.93 +this software and associated documentation files (the "Software"), to deal with
84.94 +the Software without restriction, including without limitation the rights to
84.95 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
84.96 +of the Software, and to permit persons to whom the Software is furnished to do
84.97 +so, subject to the following conditions:
84.98 +
84.99 + * Redistributions of source code must retain the above copyright notice,
84.100 + this list of conditions and the following disclaimers.
84.101 +
84.102 + * Redistributions in binary form must reproduce the above copyright notice,
84.103 + this list of conditions and the following disclaimers in the
84.104 + documentation and/or other materials provided with the distribution.
84.105 +
84.106 + * Neither the names of the LLVM Team, University of Illinois at
84.107 + Urbana-Champaign, nor the names of its contributors may be used to
84.108 + endorse or promote products derived from this Software without specific
84.109 + prior written permission.
84.110 +
84.111 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84.112 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
84.113 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
84.114 +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
84.115 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
84.116 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
84.117 +SOFTWARE.
84.118 +
84.119 +==============================================================================
84.120 +The LLVM software contains code written by third parties. Such software will
84.121 +have its own individual LICENSE.TXT file in the directory in which it appears.
84.122 +This file will describe the copyrights, license, and restrictions which apply
84.123 +to that code.
84.124 +
84.125 +The disclaimer of warranty in the University of Illinois Open Source License
84.126 +applies to all code in the LLVM Distribution, and nothing in any of the
84.127 +other licenses gives permission to use the names of the LLVM Team or the
84.128 +University of Illinois to endorse or promote products derived from this
84.129 +Software.
84.130 +
84.131 +The following pieces of software have additional or alternate copyrights,
84.132 +licenses, and/or restrictions:
84.133 +
84.134 +Program Directory
84.135 +------- ---------
84.136 +clang-tidy clang-tidy/cert
84.137 +
84.138 +------------------------------------------------------------------------------
84.139 +clang-tidy CERT Files
84.140 +------------------------------------------------------------------------------
84.141 +All clang-tidy files are licensed under the LLVM license with the following
84.142 +additions:
84.143 +
84.144 +Any file referencing a CERT Secure Coding guideline:
84.145 +Please allow this letter to serve as confirmation that open source projects on
84.146 +http://llvm.org are permitted to link via hypertext to the CERT(R) secure coding
84.147 +guidelines available at https://www.securecoding.cert.org.
84.148 +
84.149 +The foregoing is permitted by the Terms of Use as follows:
84.150 +"Linking to the Service
84.151 +Because we update many of our Web documents regularly, we would prefer that you
84.152 +link to our Web pages whenever possible rather than reproduce them. It is not
84.153 +necessary to request permission to make referential hypertext links to The
84.154 +Service."
84.155 +http://www.sei.cmu.edu/legal/ip/index.cfm.
84.156 +
84.157 +Please allow this letter to also confirm that no formal permission is required
84.158 +to reproduce the title of the content being linked to, nor to reproduce any
84.159 +de Minimis description of such content.
84.160 +
85.1 --- a/ide.analysis.modernize/build.xml Sun Jun 25 18:17:37 2017 +0200
85.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
85.3 @@ -1,8 +0,0 @@
85.4 -<?xml version="1.0" encoding="UTF-8"?>
85.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
85.6 -<!-- for some information on what you could do (e.g. targets to override). -->
85.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
85.8 -<project name="contrib/ide.analysis.modernize" default="netbeans" basedir=".">
85.9 - <description>Builds, tests, and runs the project org.netbeans.modules.ide.analysis.modernize.</description>
85.10 - <import file="../../nbbuild/templates/projectized.xml"/>
85.11 -</project>
86.1 --- a/ide.analysis.modernize/l10n.list Sun Jun 25 18:17:37 2017 +0200
86.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
86.3 @@ -1,2 +0,0 @@
86.4 -src/**/Bundle.properties
86.5 -
87.1 --- a/ide.analysis.modernize/license.txt Sun Jun 25 18:17:37 2017 +0200
87.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
87.3 @@ -1,565 +0,0 @@
87.4 -NetBeans IDE Dual License Header and License Notice
87.5 -
87.6 -Oracle elects to use only the GNU Lesser General Public License version 2.1
87.7 -(LGPL) for any software where a choice of LGPL/GPL license versions are made
87.8 -available with the language indicating that LGPLv2.1/GPLv2 or any later version
87.9 -may be used, or where a choice of which version of the LGPL/GPL is applied is
87.10 -unspecified.
87.11 -For more information on the license please see: the NetBeans License FAQs.
87.12 -
87.13 -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
87.14 -
87.15 -1. Definitions.
87.16 -1.1. "Contributor" means each individual or entity that creates or contributes
87.17 -to the creation of Modifications.
87.18 -1.2. "Contributor Version" means the combination of the Original Software,
87.19 -prior Modifications used by a Contributor (if any), and the Modifications made
87.20 -by that particular Contributor.
87.21 -1.3. "Covered Software" means (a) the Original Software, or (b) Modifications,
87.22 -or (c) the combination of files containing Original Software with files
87.23 -containing Modifications, in each case including portions thereof.
87.24 -1.4. "Executable" means the Covered Software in any form other than Source Code.
87.25 -1.5. "Initial Developer" means the individual or entity that first makes
87.26 -Original Software available under this License.
87.27 -1.6. "Larger Work" means a work which combines Covered Software or portions
87.28 -thereof with code not governed by the terms of this License.
87.29 -1.7. "License" means this document.
87.30 -1.8. "Licensable" means having the right to grant, to the maximum extent
87.31 -possible, whether at the time of the initial grant or subsequently acquired,
87.32 -any and all of the rights conveyed herein.
87.33 -1.9 "Modifications" means the Source Code and Executable form of any of the
87.34 -following:
87.35 -A. Any file that results from an addition to, deletion from or modification of
87.36 -the contents of a file containing Original Software or previous Modifications;
87.37 -B. Any new file that contains any part of the Original Software or previous
87.38 -Modification; or
87.39 -C. Any new file that is contributed or otherwise made available under the terms
87.40 -of this License.
87.41 -1.10. "Original Software" means the Source Code and Executable form of computer
87.42 -software code that is originally released under this License.
87.43 -1.11. "Patent Claims" means any patent claim(s), now owned or hereafter
87.44 -acquired, including without limitation, method, process, and apparatus claims,
87.45 -in any patent Licensable by grantor.
87.46 -1.12. "Source Code" means (a) the common form of computer software code in
87.47 -which modifications are made and (b) associated documentation included in or
87.48 -with such code.
87.49 -1.13. "You" (or "Your") means an individual or a legal entity exercising rights
87.50 -under, and complying with all of the terms of, this License. For legal
87.51 -entities, "You" includes any entity which controls, is controlled by, or is
87.52 -under common control with You. For purposes of this definition, "control" means
87.53 -(a) the power, direct or indirect, to cause the direction or management of such
87.54 -entity, whether by contract or otherwise, or (b) ownership of more than fifty
87.55 -percent (50%) of the outstanding shares or beneficial ownership of such entity.
87.56 -2. License Grants.
87.57 -2.1. The Initial Developer Grant.
87.58 -Conditioned upon Your compliance with Section 3.1 below and subject to third
87.59 -party intellectual property claims, the Initial Developer hereby grants You a
87.60 -world-wide, royalty-free, non-exclusive license:
87.61 -(a) under intellectual property rights (other than patent or trademark)
87.62 -Licensable by Initial Developer, to use, reproduce, modify, display, perform,
87.63 -sublicense and distribute the Original Software (or portions thereof), with or
87.64 -without Modifications, and/or as part of a Larger Work; and
87.65 -(b) under Patent Claims infringed by the making, using or selling of Original
87.66 -Software, to make, have made, use, practice, sell, and offer for sale, and/or
87.67 -otherwise dispose of the Original Software (or portions thereof).
87.68 -(c) The licenses granted in Sections 2.1(a) and (b) are effective on the date
87.69 -Initial Developer first distributes or otherwise makes the Original Software
87.70 -available to a third party under the terms of this License.
87.71 -(d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for
87.72 -code that You delete from the Original Software, or (2) for infringements
87.73 -caused by: (i) the modification of the Original Software, or (ii) the
87.74 -combination of the Original Software with other software or devices.
87.75 -2.2. Contributor Grant.
87.76 -Conditioned upon Your compliance with Section 3.1 below and subject to third
87.77 -party intellectual property claims, each Contributor hereby grants You a
87.78 -world-wide, royalty-free, non-exclusive license:
87.79 -(a) under intellectual property rights (other than patent or trademark)
87.80 -Licensable by Contributor to use, reproduce, modify, display, perform,
87.81 -sublicense and distribute the Modifications created by such Contributor (or
87.82 -portions thereof), either on an unmodified basis, with other Modifications, as
87.83 -Covered Software and/or as part of a Larger Work; and
87.84 -(b) under Patent Claims infringed by the making, using, or selling of
87.85 -Modifications made by that Contributor either alone and/or in combination with
87.86 -its Contributor Version (or portions of such combination), to make, use, sell,
87.87 -offer for sale, have made, and/or otherwise dispose of: (1) Modifications made
87.88 -by that Contributor (or portions thereof); and (2) the combination of
87.89 -Modifications made by that Contributor with its Contributor Version (or
87.90 -portions of such combination).
87.91 -(c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the
87.92 -date Contributor first distributes or otherwise makes the Modifications
87.93 -available to a third party.
87.94 -(d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for
87.95 -any code that Contributor has deleted from the Contributor Version; (2) for
87.96 -infringements caused by: (i) third party modifications of Contributor Version,
87.97 -or (ii) the combination of Modifications made by that Contributor with other
87.98 -software (except as part of the Contributor Version) or other devices; or (3)
87.99 -under Patent Claims infringed by Covered Software in the absence of
87.100 -Modifications made by that Contributor.
87.101 -3. Distribution Obligations.
87.102 -3.1. Availability of Source Code.
87.103 -Any Covered Software that You distribute or otherwise make available in
87.104 -Executable form must also be made available in Source Code form and that Source
87.105 -Code form must be distributed only under the terms of this License. You must
87.106 -include a copy of this License with every copy of the Source Code form of the
87.107 -Covered Software You distribute or otherwise make available. You must inform
87.108 -recipients of any such Covered Software in Executable form as to how they can
87.109 -obtain such Covered Software in Source Code form in a reasonable manner on or
87.110 -through a medium customarily used for software exchange.
87.111 -3.2. Modifications.
87.112 -The Modifications that You create or to which You contribute are governed by
87.113 -the terms of this License. You represent that You believe Your Modifications
87.114 -are Your original creation(s) and/or You have sufficient rights to grant the
87.115 -rights conveyed by this License.
87.116 -3.3. Required Notices.
87.117 -You must include a notice in each of Your Modifications that identifies You as
87.118 -the Contributor of the Modification. You may not remove or alter any copyright,
87.119 -patent or trademark notices contained within the Covered Software, or any
87.120 -notices of licensing or any descriptive text giving attribution to any
87.121 -Contributor or the Initial Developer.
87.122 -3.4. Application of Additional Terms.
87.123 -You may not offer or impose any terms on any Covered Software in Source Code
87.124 -form that alters or restricts the applicable version of this License or the
87.125 -recipients� rights hereunder. You may choose to offer, and to charge a fee
87.126 -for, warranty, support, indemnity or liability obligations to one or more
87.127 -recipients of Covered Software. However, you may do so only on Your own behalf,
87.128 -and not on behalf of the Initial Developer or any Contributor. You must make it
87.129 -absolutely clear that any such warranty, support, indemnity or liability
87.130 -obligation is offered by You alone, and You hereby agree to indemnify the
87.131 -Initial Developer and every Contributor for any liability incurred by the
87.132 -Initial Developer or such Contributor as a result of warranty, support,
87.133 -indemnity or liability terms You offer.
87.134 -3.5. Distribution of Executable Versions.
87.135 -You may distribute the Executable form of the Covered Software under the terms
87.136 -of this License or under the terms of a license of Your choice, which may
87.137 -contain terms different from this License, provided that You are in compliance
87.138 -with the terms of this License and that the license for the Executable form
87.139 -does not attempt to limit or alter the recipient�s rights in the Source Code
87.140 -form from the rights set forth in this License. If You distribute the Covered
87.141 -Software in Executable form under a different license, You must make it
87.142 -absolutely clear that any terms which differ from this License are offered by
87.143 -You alone, not by the Initial Developer or Contributor. You hereby agree to
87.144 -indemnify the Initial Developer and every Contributor for any liability
87.145 -incurred by the Initial Developer or such Contributor as a result of any such
87.146 -terms You offer.
87.147 -3.6. Larger Works.
87.148 -You may create a Larger Work by combining Covered Software with other code not
87.149 -governed by the terms of this License and distribute the Larger Work as a
87.150 -single product. In such a case, You must make sure the requirements of this
87.151 -License are fulfilled for the Covered Software.
87.152 -4. Versions of the License.
87.153 -4.1. New Versions.
87.154 -Oracle Corp. is the initial license steward and may publish revised and/or new
87.155 -versions of this License from time to time. Each version will be given a
87.156 -distinguishing version number. Except as provided in Section 4.3, no one other
87.157 -than the license steward has the right to modify this License.
87.158 -4.2. Effect of New Versions.
87.159 -You may always continue to use, distribute or otherwise make the Covered
87.160 -Software available under the terms of the version of the License under which
87.161 -You originally received the Covered Software. If the Initial Developer includes
87.162 -a notice in the Original Software prohibiting it from being distributed or
87.163 -otherwise made available under any subsequent version of the License, You must
87.164 -distribute and make the Covered Software available under the terms of the
87.165 -version of the License under which You originally received the Covered
87.166 -Software. Otherwise, You may also choose to use, distribute or otherwise make
87.167 -the Covered Software available under the terms of any subsequent version of the
87.168 -License published by the license steward.
87.169 -4.3. Modified Versions.
87.170 -When You are an Initial Developer and You want to create a new license for Your
87.171 -Original Software, You may create and use a modified version of this License if
87.172 -You: (a) rename the license and remove any references to the name of the
87.173 -license steward (except to note that the license differs from this License);
87.174 -and (b) otherwise make it clear that the license contains terms which differ
87.175 -from this License.
87.176 -5. DISCLAIMER OF WARRANTY.
87.177 -COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT
87.178 -WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
87.179 -LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS,
87.180 -MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK
87.181 -AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD
87.182 -ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL
87.183 -DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,
87.184 -REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART
87.185 -OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT
87.186 -UNDER THIS DISCLAIMER.
87.187 -6. TERMINATION.
87.188 -6.1. This License and the rights granted hereunder will terminate automatically
87.189 -if You fail to comply with terms herein and fail to cure such breach within 30
87.190 -days of becoming aware of the breach. Provisions which, by their nature, must
87.191 -remain in effect beyond the termination of this License shall survive.
87.192 -6.2. If You assert a patent infringement claim (excluding declaratory judgment
87.193 -actions) against Initial Developer or a Contributor (the Initial Developer or
87.194 -Contributor against whom You assert such claim is referred to as "Participant")
87.195 -alleging that the Participant Software (meaning the Contributor Version where
87.196 -the Participant is a Contributor or the Original Software where the Participant
87.197 -is the Initial Developer) directly or indirectly infringes any patent, then any
87.198 -and all rights granted directly or indirectly to You by such Participant, the
87.199 -Initial Developer (if the Initial Developer is not the Participant) and all
87.200 -Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days
87.201 -notice from Participant terminate prospectively and automatically at the
87.202 -expiration of such 60 day notice period, unless if within such 60 day period
87.203 -You withdraw Your claim with respect to the Participant Software against such
87.204 -Participant either unilaterally or pursuant to a written agreement with
87.205 -Participant.
87.206 -6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user
87.207 -licenses that have been validly granted by You or any distributor hereunder
87.208 -prior to termination (excluding licenses granted to You by any distributor)
87.209 -shall survive termination.
87.210 -7. LIMITATION OF LIABILITY.
87.211 -UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
87.212 -NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY
87.213 -OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF
87.214 -ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL,
87.215 -INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
87.216 -LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
87.217 -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN
87.218 -IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS
87.219 -LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
87.220 -INJURY RESULTING FROM SUCH PARTY�S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
87.221 -PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
87.222 -LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND
87.223 -LIMITATION MAY NOT APPLY TO YOU.
87.224 -8. U.S. GOVERNMENT END USERS.
87.225 -The Covered Software is a "commercial item," as that term is defined in 48
87.226 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" (as that
87.227 -term is defined at 48 C.F.R. �252.227-7014(a)(1)) and "commercial computer
87.228 -software documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
87.229 -1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through
87.230 -227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software
87.231 -with only those rights set forth herein. This U.S. Government Rights clause is
87.232 -in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision
87.233 -that addresses Government rights in computer software under this License.
87.234 -9. MISCELLANEOUS.
87.235 -This License represents the complete agreement concerning subject matter
87.236 -hereof. If any provision of this License is held to be unenforceable, such
87.237 -provision shall be reformed only to the extent necessary to make it
87.238 -enforceable. This License shall be governed by the law of the jurisdiction
87.239 -specified in a notice contained within the Original Software (except to the
87.240 -extent applicable law, if any, provides otherwise), excluding such
87.241 -jurisdiction�s conflict-of-law provisions. Any litigation relating to this
87.242 -License shall be subject to the jurisdiction of the courts located in the
87.243 -jurisdiction and venue specified in a notice contained within the Original
87.244 -Software, with the losing party responsible for costs, including, without
87.245 -limitation, court costs and reasonable attorneys� fees and expenses. The
87.246 -application of the United Nations Convention on Contracts for the International
87.247 -Sale of Goods is expressly excluded. Any law or regulation which provides that
87.248 -the language of a contract shall be construed against the drafter shall not
87.249 -apply to this License. You agree that You alone are responsible for compliance
87.250 -with the United States export administration regulations (and the export
87.251 -control laws and regulation of any other countries) when You use, distribute or
87.252 -otherwise make available any Covered Software.
87.253 -10. RESPONSIBILITY FOR CLAIMS.
87.254 -As between Initial Developer and the Contributors, each party is responsible
87.255 -for claims and damages arising, directly or indirectly, out of its utilization
87.256 -of rights under this License and You agree to work with Initial Developer and
87.257 -Contributors to distribute such responsibility on an equitable basis. Nothing
87.258 -herein is intended or shall be deemed to constitute any admission of liability.
87.259 -NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
87.260 -(CDDL)
87.261 -The code released under the CDDL shall be governed by the laws of the State of
87.262 -California (excluding conflict-of-law provisions). Any litigation relating to
87.263 -this License shall be subject to the jurisdiction of the Federal Courts of the
87.264 -Northern District of California and the state courts of the State of
87.265 -California, with venue lying in Santa Clara County, California.
87.266 -The GNU General Public License (GPL) Version 2, June 1991
87.267 -
87.268 -Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite
87.269 -330, Boston, MA 02111-1307 USA
87.270 -Everyone is permitted to copy and distribute verbatim copies of this license
87.271 -document, but changing it is not allowed.
87.272 -Preamble
87.273 -The licenses for most software are designed to take away your freedom to share
87.274 -and change it. By contrast, the GNU General Public License is intended to
87.275 -guarantee your freedom to share and change free software--to make sure the
87.276 -software is free for all its users. This General Public License applies to most
87.277 -of the Free Software Foundation's software and to any other program whose
87.278 -authors commit to using it. (Some other Free Software Foundation software is
87.279 -covered by the GNU Library General Public License instead.) You can apply it to
87.280 -your programs, too.
87.281 -When we speak of free software, we are referring to freedom, not price. Our
87.282 -General Public Licenses are designed to make sure that you have the freedom to
87.283 -distribute copies of free software (and charge for this service if you wish),
87.284 -that you receive source code or can get it if you want it, that you can change
87.285 -the software or use pieces of it in new free programs; and that you know you
87.286 -can do these things.
87.287 -To protect your rights, we need to make restrictions that forbid anyone to deny
87.288 -you these rights or to ask you to surrender the rights. These restrictions
87.289 -translate to certain responsibilities for you if you distribute copies of the
87.290 -software, or if you modify it.
87.291 -For example, if you distribute copies of such a program, whether gratis or for
87.292 -a fee, you must give the recipients all the rights that you have. You must make
87.293 -sure that they, too, receive or can get the source code. And you must show them
87.294 -these terms so they know their rights.
87.295 -We protect your rights with two steps: (1) copyright the software, and (2)
87.296 -offer you this license which gives you legal permission to copy, distribute
87.297 -and/or modify the software.
87.298 -Also, for each author's protection and ours, we want to make certain that
87.299 -everyone understands that there is no warranty for this free software. If the
87.300 -software is modified by someone else and passed on, we want its recipients to
87.301 -know that what they have is not the original, so that any problems introduced
87.302 -by others will not reflect on the original authors' reputations.
87.303 -Finally, any free program is threatened constantly by software patents. We wish
87.304 -to avoid the danger that redistributors of a free program will individually
87.305 -obtain patent licenses, in effect making the program proprietary. To prevent
87.306 -this, we have made it clear that any patent must be licensed for everyone's
87.307 -free use or not licensed at all.
87.308 -The precise terms and conditions for copying, distribution and modification
87.309 -follow.
87.310 -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
87.311 -0. This License applies to any program or other work which contains a notice
87.312 -placed by the copyright holder saying it may be distributed under the terms of
87.313 -this General Public License. The "Program", below, refers to any such program
87.314 -or work, and a "work based on the Program" means either the Program or any
87.315 -derivative work under copyright law: that is to say, a work containing the
87.316 -Program or a portion of it, either verbatim or with modifications and/or
87.317 -translated into another language. (Hereinafter, translation is included without
87.318 -limitation in the term "modification".) Each licensee is addressed as "you".
87.319 -Activities other than copying, distribution and modification are not covered by
87.320 -this License; they are outside its scope. The act of running the Program is not
87.321 -restricted, and the output from the Program is covered only if its contents
87.322 -constitute a work based on the Program (independent of having been made by
87.323 -running the Program). Whether that is true depends on what the Program does.
87.324 -1. You may copy and distribute verbatim copies of the Program's source code as
87.325 -you receive it, in any medium, provided that you conspicuously and
87.326 -appropriately publish on each copy an appropriate copyright notice and
87.327 -disclaimer of warranty; keep intact all the notices that refer to this License
87.328 -and to the absence of any warranty; and give any other recipients of the
87.329 -Program a copy of this License along with the Program.
87.330 -You may charge a fee for the physical act of transferring a copy, and you may
87.331 -at your option offer warranty protection in exchange for a fee.
87.332 -2. You may modify your copy or copies of the Program or any portion of it, thus
87.333 -forming a work based on the Program, and copy and distribute such modifications
87.334 -or work under the terms of Section 1 above, provided that you also meet all of
87.335 -these conditions:
87.336 -a) You must cause the modified files to carry prominent notices stating that
87.337 -you changed the files and the date of any change.
87.338 -b) You must cause any work that you distribute or publish, that in whole or in
87.339 -part contains or is derived from the Program or any part thereof, to be
87.340 -licensed as a whole at no charge to all third parties under the terms of this
87.341 -License.
87.342 -c) If the modified program normally reads commands interactively when run, you
87.343 -must cause it, when started running for such interactive use in the most
87.344 -ordinary way, to print or display an announcement including an appropriate
87.345 -copyright notice and a notice that there is no warranty (or else, saying that
87.346 -you provide a warranty) and that users may redistribute the program under these
87.347 -conditions, and telling the user how to view a copy of this License.
87.348 -(Exception: if the Program itself is interactive but does not normally print
87.349 -such an announcement, your work based on the Program is not required to print
87.350 -an announcement.)
87.351 -These requirements apply to the modified work as a whole. If identifiable
87.352 -sections of that work are not derived from the Program, and can be reasonably
87.353 -considered independent and separate works in themselves, then this License, and
87.354 -its terms, do not apply to those sections when you distribute them as separate
87.355 -works. But when you distribute the same sections as part of a whole which is a
87.356 -work based on the Program, the distribution of the whole must be on the terms
87.357 -of this License, whose permissions for other licensees extend to the entire
87.358 -whole, and thus to each and every part regardless of who wrote it.
87.359 -Thus, it is not the intent of this section to claim rights or contest your
87.360 -rights to work written entirely by you; rather, the intent is to exercise the
87.361 -right to control the distribution of derivative or collective works based on
87.362 -the Program.
87.363 -In addition, mere aggregation of another work not based on the Program with the
87.364 -Program (or with a work based on the Program) on a volume of a storage or
87.365 -distribution medium does not bring the other work under the scope of this
87.366 -License.
87.367 -3. You may copy and distribute the Program (or a work based on it, under
87.368 -Section 2) in object code or executable form under the terms of Sections 1 and
87.369 -2 above provided that you also do one of the following:
87.370 -a) Accompany it with the complete corresponding machine-readable source code,
87.371 -which must be distributed under the terms of Sections 1 and 2 above on a medium
87.372 -customarily used for software interchange; or,
87.373 -b) Accompany it with a written offer, valid for at least three years, to give
87.374 -any third party, for a charge no more than your cost of physically performing
87.375 -source distribution, a complete machine-readable copy of the corresponding
87.376 -source code, to be distributed under the terms of Sections 1 and 2 above on a
87.377 -medium customarily used for software interchange; or,
87.378 -c) Accompany it with the information you received as to the offer to distribute
87.379 -corresponding source code. (This alternative is allowed only for noncommercial
87.380 -distribution and only if you received the program in object code or executable
87.381 -form with such an offer, in accord with Subsection b above.)
87.382 -The source code for a work means the preferred form of the work for making
87.383 -modifications to it. For an executable work, complete source code means all the
87.384 -source code for all modules it contains, plus any associated interface
87.385 -definition files, plus the scripts used to control compilation and installation
87.386 -of the executable. However, as a special exception, the source code distributed
87.387 -need not include anything that is normally distributed (in either source or
87.388 -binary form) with the major components (compiler, kernel, and so on) of the
87.389 -operating system on which the executable runs, unless that component itself
87.390 -accompanies the executable.
87.391 -If distribution of executable or object code is made by offering access to copy
87.392 -from a designated place, then offering equivalent access to copy the source
87.393 -code from the same place counts as distribution of the source code, even though
87.394 -third parties are not compelled to copy the source along with the object code.
87.395 -4. You may not copy, modify, sublicense, or distribute the Program except as
87.396 -expressly provided under this License. Any attempt otherwise to copy, modify,
87.397 -sublicense or distribute the Program is void, and will automatically terminate
87.398 -your rights under this License. However, parties who have received copies, or
87.399 -rights, from you under this License will not have their licenses terminated so
87.400 -long as such parties remain in full compliance.
87.401 -5. You are not required to accept this License, since you have not signed it.
87.402 -However, nothing else grants you permission to modify or distribute the Program
87.403 -or its derivative works. These actions are prohibited by law if you do not
87.404 -accept this License. Therefore, by modifying or distributing the Program (or
87.405 -any work based on the Program), you indicate your acceptance of this License to
87.406 -do so, and all its terms and conditions for copying, distributing or modifying
87.407 -the Program or works based on it.
87.408 -6. Each time you redistribute the Program (or any work based on the Program),
87.409 -the recipient automatically receives a license from the original licensor to
87.410 -copy, distribute or modify the Program subject to these terms and conditions.
87.411 -You may not impose any further restrictions on the recipients' exercise of the
87.412 -rights granted herein. You are not responsible for enforcing compliance by
87.413 -third parties to this License.
87.414 -7. If, as a consequence of a court judgment or allegation of patent
87.415 -infringement or for any other reason (not limited to patent issues), conditions
87.416 -are imposed on you (whether by court order, agreement or otherwise) that
87.417 -contradict the conditions of this License, they do not excuse you from the
87.418 -conditions of this License. If you cannot distribute so as to satisfy
87.419 -simultaneously your obligations under this License and any other pertinent
87.420 -obligations, then as a consequence you may not distribute the Program at all.
87.421 -For example, if a patent license would not permit royalty-free redistribution
87.422 -of the Program by all those who receive copies directly or indirectly through
87.423 -you, then the only way you could satisfy both it and this License would be to
87.424 -refrain entirely from distribution of the Program.
87.425 -If any portion of this section is held invalid or unenforceable under any
87.426 -particular circumstance, the balance of the section is intended to apply and
87.427 -the section as a whole is intended to apply in other circumstances.
87.428 -It is not the purpose of this section to induce you to infringe any patents or
87.429 -other property right claims or to contest validity of any such claims; this
87.430 -section has the sole purpose of protecting the integrity of the free software
87.431 -distribution system, which is implemented by public license practices. Many
87.432 -people have made generous contributions to the wide range of software
87.433 -distributed through that system in reliance on consistent application of that
87.434 -system; it is up to the author/donor to decide if he or she is willing to
87.435 -distribute software through any other system and a licensee cannot impose that
87.436 -choice.
87.437 -This section is intended to make thoroughly clear what is believed to be a
87.438 -consequence of the rest of this License.
87.439 -8. If the distribution and/or use of the Program is restricted in certain
87.440 -countries either by patents or by copyrighted interfaces, the original
87.441 -copyright holder who places the Program under this License may add an explicit
87.442 -geographical distribution limitation excluding those countries, so that
87.443 -distribution is permitted only in or among countries not thus excluded. In such
87.444 -case, this License incorporates the limitation as if written in the body of
87.445 -this License.
87.446 -9. The Free Software Foundation may publish revised and/or new versions of the
87.447 -General Public License from time to time. Such new versions will be similar in
87.448 -spirit to the present version, but may differ in detail to address new problems
87.449 -or concerns.
87.450 -Each version is given a distinguishing version number. If the Program specifies
87.451 -a version number of this License which applies to it and "any later version",
87.452 -you have the option of following the terms and conditions either of that
87.453 -version or of any later version published by the Free Software Foundation. If
87.454 -the Program does not specify a version number of this License, you may choose
87.455 -any version ever published by the Free Software Foundation.
87.456 -10. If you wish to incorporate parts of the Program into other free programs
87.457 -whose distribution conditions are different, write to the author to ask for
87.458 -permission. For software which is copyrighted by the Free Software Foundation,
87.459 -write to the Free Software Foundation; we sometimes make exceptions for this.
87.460 -Our decision will be guided by the two goals of preserving the free status of
87.461 -all derivatives of our free software and of promoting the sharing and reuse of
87.462 -software generally.
87.463 -NO WARRANTY
87.464 -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
87.465 -THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
87.466 -STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
87.467 -PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
87.468 -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
87.469 -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
87.470 -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU
87.471 -ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
87.472 -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
87.473 -ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
87.474 -PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
87.475 -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
87.476 -INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
87.477 -BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
87.478 -FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
87.479 -OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
87.480 -END OF TERMS AND CONDITIONS
87.481 -How to Apply These Terms to Your New Programs
87.482 -If you develop a new program, and you want it to be of the greatest possible
87.483 -use to the public, the best way to achieve this is to make it free software
87.484 -which everyone can redistribute and change under these terms.
87.485 -To do so, attach the following notices to the program. It is safest to attach
87.486 -them to the start of each source file to most effectively convey the exclusion
87.487 -of warranty; and each file should have at least the "copyright" line and a
87.488 -pointer to where the full notice is found.
87.489 -One line to give the program's name and a brief idea of what it does.
87.490 -Copyright (C)
87.491 -This program is free software; you can redistribute it and/or modify it under
87.492 -the terms of the GNU General Public License as published by the Free Software
87.493 -Foundation; either version 2 of the License, or (at your option) any later
87.494 -version.
87.495 -This program is distributed in the hope that it will be useful, but WITHOUT ANY
87.496 -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
87.497 -PARTICULAR PURPOSE. See the GNU General Public License for more details.
87.498 -You should have received a copy of the GNU General Public License along with
87.499 -this program; if not, write to the Free Software Foundation, Inc., 59 Temple
87.500 -Place, Suite 330, Boston, MA 02111-1307 USA
87.501 -Also add information on how to contact you by electronic and paper mail.
87.502 -If the program is interactive, make it output a short notice like this when it
87.503 -starts in an interactive mode:
87.504 -Gnomovision version 69, Copyright (C) year name of author
87.505 -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This
87.506 -is free software, and you are welcome to redistribute it under certain
87.507 -conditions; type `show c' for details.
87.508 -The hypothetical commands `show w' and `show c' should show the appropriate
87.509 -parts of the General Public License. Of course, the commands you use may be
87.510 -called something other than `show w' and `show c'; they could even be
87.511 -mouse-clicks or menu items--whatever suits your program.
87.512 -You should also get your employer (if you work as a programmer) or your school,
87.513 -if any, to sign a "copyright disclaimer" for the program, if necessary. Here is
87.514 -a sample; alter the names:
87.515 -Yoyodyne, Inc., hereby disclaims all copyright interest in the program
87.516 -`Gnomovision' (which makes passes at compilers) written by James Hacker.
87.517 -signature of Ty Coon, 1 April 1989
87.518 -Ty Coon, President of Vice
87.519 -This General Public License does not permit incorporating your program into
87.520 -proprietary programs. If your program is a subroutine library, you may consider
87.521 -it more useful to permit linking proprietary applications with the library. If
87.522 -this is what you want to do, use the GNU Library General Public License instead
87.523 -of this License.
87.524 -"CLASSPATH" EXCEPTION TO THE GPL VERSION 2
87.525 -Certain source files distributed by Oracle America, Inc. and/or its affiliates
87.526 -are subject to the following clarification and special exception to the GPLv2,
87.527 -based on the GNU Project exception for its Classpath libraries, known as the
87.528 -GNU Classpath Exception, but only where Oracle has expressly included in the
87.529 -particular source file's header the words "Oracle designates this particular
87.530 -file as subject to the "Classpath" exception as provided by Oracle in the
87.531 -LICENSE file that accompanied this code."
87.532 -You should also note that Oracle includes multiple, independent programs in
87.533 -this software package. Some of those programs are provided under licenses
87.534 -deemed incompatible with the GPLv2 by the Free Software Foundation and others.
87.535 -For example, the package includes programs licensed under the Apache License,
87.536 -Version 2.0. Such programs are licensed to you under their original licenses.
87.537 -Oracle facilitates your further distribution of this package by adding the
87.538 -Classpath Exception to the necessary parts of its GPLv2 code, which permits you
87.539 -to use that code in combination with other independent modules not licensed
87.540 -under the GPLv2. However, note that this would not permit you to commingle code
87.541 -under an incompatible license with Oracle's GPLv2 licensed code by, for
87.542 -example, cutting and pasting such code into a file also containing Oracle's
87.543 -GPLv2 licensed code and then distributing the result.
87.544 -Additionally, if you were to remove the Classpath Exception from any of the
87.545 -files to which it applies and distribute the result, you would likely be
87.546 -required to license some or all of the other code in that distribution under
87.547 -the GPLv2 as well, and since the GPLv2 is incompatible with the license terms
87.548 -of some items included in the distribution by Oracle, removing the Classpath
87.549 -Exception could therefore effectively compromise your ability to further
87.550 -distribute the package.
87.551 -Proceed with caution and we recommend that you obtain the advice of a lawyer
87.552 -skilled in open source matters before removing the Classpath Exception or
87.553 -making modifications to this package which may subsequently be redistributed
87.554 -and/or involve the use of third party software.
87.555 -CLASSPATH EXCEPTION
87.556 -Linking this library statically or dynamically with other modules is making a
87.557 -combined work based on this library. Thus, the terms and conditions of the GNU
87.558 -General Public License version 2 cover the whole combination.
87.559 -As a special exception, the copyright holders of this library give you
87.560 -permission to link this library with independent modules to produce an
87.561 -executable, regardless of the license terms of these independent modules, and
87.562 -to copy and distribute the resulting executable under terms of your choice,
87.563 -provided that you also meet, for each linked independent module, the terms and
87.564 -conditions of the license of that module. An independent module is a module
87.565 -which is not derived from or based on this library. If you modify this library,
87.566 -you may extend this exception to your version of the library, but you are not
87.567 -obligated to do so. If you do not wish to do so, delete this exception
87.568 -statement from your version.
88.1 --- a/ide.analysis.modernize/manifest.mf Sun Jun 25 18:17:37 2017 +0200
88.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
88.3 @@ -1,6 +0,0 @@
88.4 -Manifest-Version: 1.0
88.5 -AutoUpdate-Show-In-Client: true
88.6 -OpenIDE-Module: org.netbeans.modules.ide.analysis.modernize
88.7 -OpenIDE-Module-Layer: org/netbeans/modules/ide/analysis/modernize/layer.xml
88.8 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/ide/analysis/modernize/Bundle.properties
88.9 -OpenIDE-Module-Specification-Version: 1.1.1
89.1 --- a/ide.analysis.modernize/nbproject/project.properties Sun Jun 25 18:17:37 2017 +0200
89.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
89.3 @@ -1,13 +0,0 @@
89.4 -javac.source=1.7
89.5 -javac.compilerargs=-Xlint -Xlint:-serial
89.6 -
89.7 -license.file=license.txt
89.8 -nbm.module.author=Ilia Gromov
89.9 -nbm.needs.restart=true
89.10 -test.unit.cp.extra=../../cnd.modelimpl/build/test/unit/classes:\
89.11 -../../cnd/build/test/unit/classes:\
89.12 -../../dlight.nativeexecution/build/test/unit/classes:\
89.13 -../../editor.mimelookup/build/test/unit/classes:\
89.14 -../../cnd.classview/build/test/unit/classes
89.15 -
89.16 -test.unit.run.cp.extra=../../editor.mimelookup/build/test/unit/classes
90.1 --- a/ide.analysis.modernize/nbproject/project.xml Sun Jun 25 18:17:37 2017 +0200
90.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
90.3 @@ -1,334 +0,0 @@
90.4 -<?xml version="1.0" encoding="UTF-8"?>
90.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
90.6 - <type>org.netbeans.modules.apisupport.project</type>
90.7 - <configuration>
90.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
90.9 - <code-name-base>org.netbeans.modules.ide.analysis.modernize</code-name-base>
90.10 - <module-dependencies>
90.11 - <dependency>
90.12 - <code-name-base>org.netbeans.api.progress</code-name-base>
90.13 - <build-prerequisite/>
90.14 - <compile-dependency/>
90.15 - <run-dependency>
90.16 - <release-version>1</release-version>
90.17 - <specification-version>1.46.1</specification-version>
90.18 - </run-dependency>
90.19 - </dependency>
90.20 - <dependency>
90.21 - <code-name-base>org.netbeans.api.progress.nb</code-name-base>
90.22 - <build-prerequisite/>
90.23 - <compile-dependency/>
90.24 - <run-dependency>
90.25 - <specification-version>1.46.1</specification-version>
90.26 - </run-dependency>
90.27 - </dependency>
90.28 - <dependency>
90.29 - <code-name-base>org.netbeans.modules.cnd.analysis.api</code-name-base>
90.30 - <build-prerequisite/>
90.31 - <compile-dependency/>
90.32 - <run-dependency>
90.33 - <specification-version>1.3.1</specification-version>
90.34 - </run-dependency>
90.35 - </dependency>
90.36 - <dependency>
90.37 - <code-name-base>org.netbeans.modules.cnd.api.model</code-name-base>
90.38 - <build-prerequisite/>
90.39 - <compile-dependency/>
90.40 - <run-dependency>
90.41 - <release-version>1</release-version>
90.42 - <specification-version>1.13.1.1</specification-version>
90.43 - </run-dependency>
90.44 - </dependency>
90.45 - <dependency>
90.46 - <code-name-base>org.netbeans.modules.cnd.api.project</code-name-base>
90.47 - <build-prerequisite/>
90.48 - <compile-dependency/>
90.49 - <run-dependency>
90.50 - <release-version>1</release-version>
90.51 - <specification-version>1.31.4</specification-version>
90.52 - </run-dependency>
90.53 - </dependency>
90.54 - <dependency>
90.55 - <code-name-base>org.netbeans.modules.cnd.api.remote</code-name-base>
90.56 - <build-prerequisite/>
90.57 - <compile-dependency/>
90.58 - <run-dependency>
90.59 - <release-version>1</release-version>
90.60 - <specification-version>1.22.2</specification-version>
90.61 - </run-dependency>
90.62 - </dependency>
90.63 - <dependency>
90.64 - <code-name-base>org.netbeans.modules.cnd.kit</code-name-base>
90.65 - <run-dependency>
90.66 - <specification-version>1.30.5.1</specification-version>
90.67 - </run-dependency>
90.68 - </dependency>
90.69 - <dependency>
90.70 - <code-name-base>org.netbeans.modules.cnd.makeproject</code-name-base>
90.71 - <build-prerequisite/>
90.72 - <compile-dependency/>
90.73 - <run-dependency>
90.74 - <release-version>2</release-version>
90.75 - <specification-version>1.15.0.1</specification-version>
90.76 - </run-dependency>
90.77 - </dependency>
90.78 - <dependency>
90.79 - <code-name-base>org.netbeans.modules.cnd.model.services</code-name-base>
90.80 - <build-prerequisite/>
90.81 - <compile-dependency/>
90.82 - <run-dependency>
90.83 - <release-version>1</release-version>
90.84 - <specification-version>1.42.16</specification-version>
90.85 - </run-dependency>
90.86 - </dependency>
90.87 - <dependency>
90.88 - <code-name-base>org.netbeans.modules.cnd.modelutil</code-name-base>
90.89 - <build-prerequisite/>
90.90 - <compile-dependency/>
90.91 - <run-dependency>
90.92 - <release-version>1</release-version>
90.93 - <specification-version>1.14.0.1</specification-version>
90.94 - </run-dependency>
90.95 - </dependency>
90.96 - <dependency>
90.97 - <code-name-base>org.netbeans.modules.cnd.toolchain</code-name-base>
90.98 - <build-prerequisite/>
90.99 - <compile-dependency/>
90.100 - <run-dependency>
90.101 - <specification-version>1.5.0.1</specification-version>
90.102 - </run-dependency>
90.103 - </dependency>
90.104 - <dependency>
90.105 - <code-name-base>org.netbeans.modules.cnd.utils</code-name-base>
90.106 - <build-prerequisite/>
90.107 - <compile-dependency/>
90.108 - <run-dependency>
90.109 - <specification-version>1.17.1</specification-version>
90.110 - </run-dependency>
90.111 - </dependency>
90.112 - <dependency>
90.113 - <code-name-base>org.netbeans.modules.cnd.utils.ui</code-name-base>
90.114 - <build-prerequisite/>
90.115 - <compile-dependency/>
90.116 - <run-dependency>
90.117 - <specification-version>1.0</specification-version>
90.118 - </run-dependency>
90.119 - </dependency>
90.120 - <dependency>
90.121 - <code-name-base>org.netbeans.modules.code.analysis</code-name-base>
90.122 - <build-prerequisite/>
90.123 - <compile-dependency/>
90.124 - <run-dependency>
90.125 - <release-version>0</release-version>
90.126 - <specification-version>1.8</specification-version>
90.127 - </run-dependency>
90.128 - </dependency>
90.129 - <dependency>
90.130 - <code-name-base>org.netbeans.modules.dlight.nativeexecution</code-name-base>
90.131 - <build-prerequisite/>
90.132 - <compile-dependency/>
90.133 - <run-dependency>
90.134 - <specification-version>1.10.3</specification-version>
90.135 - </run-dependency>
90.136 - </dependency>
90.137 - <dependency>
90.138 - <code-name-base>org.netbeans.modules.dlight.remote</code-name-base>
90.139 - <build-prerequisite/>
90.140 - <compile-dependency/>
90.141 - <run-dependency>
90.142 - <specification-version>1.28.7.1</specification-version>
90.143 - </run-dependency>
90.144 - </dependency>
90.145 - <dependency>
90.146 - <code-name-base>org.netbeans.modules.dlight.remote.ui</code-name-base>
90.147 - <build-prerequisite/>
90.148 - <compile-dependency/>
90.149 - <run-dependency>
90.150 - <specification-version>1.1.0</specification-version>
90.151 - </run-dependency>
90.152 - </dependency>
90.153 - <dependency>
90.154 - <code-name-base>org.netbeans.modules.editor.document</code-name-base>
90.155 - <build-prerequisite/>
90.156 - <compile-dependency/>
90.157 - <run-dependency>
90.158 - <specification-version>1.6.0.1</specification-version>
90.159 - </run-dependency>
90.160 - </dependency>
90.161 - <dependency>
90.162 - <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
90.163 - <build-prerequisite/>
90.164 - <compile-dependency/>
90.165 - <run-dependency>
90.166 - <release-version>3</release-version>
90.167 - <specification-version>4.3.1.22.1.44</specification-version>
90.168 - </run-dependency>
90.169 - </dependency>
90.170 - <dependency>
90.171 - <code-name-base>org.netbeans.modules.options.api</code-name-base>
90.172 - <build-prerequisite/>
90.173 - <compile-dependency/>
90.174 - <run-dependency>
90.175 - <release-version>1</release-version>
90.176 - <specification-version>1.22</specification-version>
90.177 - </run-dependency>
90.178 - </dependency>
90.179 - <dependency>
90.180 - <code-name-base>org.netbeans.modules.projectapi</code-name-base>
90.181 - <build-prerequisite/>
90.182 - <compile-dependency/>
90.183 - <run-dependency>
90.184 - <release-version>1</release-version>
90.185 - <specification-version>1.36</specification-version>
90.186 - </run-dependency>
90.187 - </dependency>
90.188 - <dependency>
90.189 - <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
90.190 - <build-prerequisite/>
90.191 - <compile-dependency/>
90.192 - <run-dependency>
90.193 - <specification-version>1.47.1.1</specification-version>
90.194 - </run-dependency>
90.195 - </dependency>
90.196 - <dependency>
90.197 - <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
90.198 - <build-prerequisite/>
90.199 - <compile-dependency/>
90.200 - <run-dependency>
90.201 - <release-version>0-1</release-version>
90.202 - <specification-version>1.18.0.7.9</specification-version>
90.203 - </run-dependency>
90.204 - </dependency>
90.205 - <dependency>
90.206 - <code-name-base>org.openide.awt</code-name-base>
90.207 - <build-prerequisite/>
90.208 - <compile-dependency/>
90.209 - <run-dependency>
90.210 - <specification-version>7.31</specification-version>
90.211 - </run-dependency>
90.212 - </dependency>
90.213 - <dependency>
90.214 - <code-name-base>org.openide.filesystems</code-name-base>
90.215 - <build-prerequisite/>
90.216 - <compile-dependency/>
90.217 - <run-dependency>
90.218 - <specification-version>9.8.1</specification-version>
90.219 - </run-dependency>
90.220 - </dependency>
90.221 - <dependency>
90.222 - <code-name-base>org.openide.filesystems.nb</code-name-base>
90.223 - <build-prerequisite/>
90.224 - <compile-dependency/>
90.225 - <run-dependency>
90.226 - <specification-version>9.7.1</specification-version>
90.227 - </run-dependency>
90.228 - </dependency>
90.229 - <dependency>
90.230 - <code-name-base>org.openide.loaders</code-name-base>
90.231 - <build-prerequisite/>
90.232 - <compile-dependency/>
90.233 - <run-dependency>
90.234 - <specification-version>7.61</specification-version>
90.235 - </run-dependency>
90.236 - </dependency>
90.237 - <dependency>
90.238 - <code-name-base>org.openide.modules</code-name-base>
90.239 - <build-prerequisite/>
90.240 - <compile-dependency/>
90.241 - <run-dependency>
90.242 - <specification-version>7.47.1</specification-version>
90.243 - </run-dependency>
90.244 - </dependency>
90.245 - <dependency>
90.246 - <code-name-base>org.openide.text</code-name-base>
90.247 - <build-prerequisite/>
90.248 - <compile-dependency/>
90.249 - <run-dependency>
90.250 - <specification-version>6.66.1</specification-version>
90.251 - </run-dependency>
90.252 - </dependency>
90.253 - <dependency>
90.254 - <code-name-base>org.openide.util</code-name-base>
90.255 - <build-prerequisite/>
90.256 - <compile-dependency/>
90.257 - <run-dependency>
90.258 - <specification-version>9.3</specification-version>
90.259 - </run-dependency>
90.260 - </dependency>
90.261 - <dependency>
90.262 - <code-name-base>org.openide.util.lookup</code-name-base>
90.263 - <build-prerequisite/>
90.264 - <compile-dependency/>
90.265 - <run-dependency>
90.266 - <specification-version>8.23</specification-version>
90.267 - </run-dependency>
90.268 - </dependency>
90.269 - <dependency>
90.270 - <code-name-base>org.openide.util.ui</code-name-base>
90.271 - <build-prerequisite/>
90.272 - <compile-dependency/>
90.273 - <run-dependency>
90.274 - <specification-version>9.3</specification-version>
90.275 - </run-dependency>
90.276 - </dependency>
90.277 - <dependency>
90.278 - <code-name-base>org.openide.windows</code-name-base>
90.279 - <build-prerequisite/>
90.280 - <compile-dependency/>
90.281 - <run-dependency>
90.282 - <specification-version>6.74.1</specification-version>
90.283 - </run-dependency>
90.284 - </dependency>
90.285 - </module-dependencies>
90.286 - <test-dependencies>
90.287 - <test-type>
90.288 - <name>unit</name>
90.289 - <test-dependency>
90.290 - <code-name-base>org.netbeans.libs.junit4</code-name-base>
90.291 - <compile-dependency/>
90.292 - </test-dependency>
90.293 - <test-dependency>
90.294 - <code-name-base>org.netbeans.modules.cnd.classview</code-name-base>
90.295 - <compile-dependency/>
90.296 - </test-dependency>
90.297 - <test-dependency>
90.298 - <code-name-base>org.netbeans.modules.cnd.kit</code-name-base>
90.299 - <recursive/>
90.300 - <compile-dependency/>
90.301 - <test/>
90.302 - </test-dependency>
90.303 - <test-dependency>
90.304 - <code-name-base>org.netbeans.modules.cnd.makeproject</code-name-base>
90.305 - <recursive/>
90.306 - <compile-dependency/>
90.307 - <test/>
90.308 - </test-dependency>
90.309 - <test-dependency>
90.310 - <code-name-base>org.netbeans.modules.cnd.modelimpl</code-name-base>
90.311 - <recursive/>
90.312 - <compile-dependency/>
90.313 - <test/>
90.314 - </test-dependency>
90.315 - <test-dependency>
90.316 - <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
90.317 - <recursive/>
90.318 - <compile-dependency/>
90.319 - <test/>
90.320 - </test-dependency>
90.321 - <test-dependency>
90.322 - <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
90.323 - <recursive/>
90.324 - <compile-dependency/>
90.325 - </test-dependency>
90.326 - <test-dependency>
90.327 - <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
90.328 - <recursive/>
90.329 - <compile-dependency/>
90.330 - <test/>
90.331 - </test-dependency>
90.332 - </test-type>
90.333 - </test-dependencies>
90.334 - <public-packages/>
90.335 - </data>
90.336 - </configuration>
90.337 -</project>
91.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/Bundle.properties Sun Jun 25 18:17:37 2017 +0200
91.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
91.3 @@ -1,8 +0,0 @@
91.4 -OpenIDE-Module-Display-Category=Oracle Developer Studio
91.5 -OpenIDE-Module-Long-Description=\
91.6 - This plugin enables clang-tidy analysis on C/C++ projects and files via Source->Inspect or right in the Editor.\n\
91.7 - Works only with "Clang-tidy wrapper for <OS> <bitness>" plugin.\n\n\
91.8 - Please note that in order to have clang-tidy hints in the Editor you should run Source->Inspect on your whole project.\n\
91.9 - You can view list of checks and enable/disable them in Options->Editor->Hints.
91.10 -OpenIDE-Module-Name=Clang-TIdy integration
91.11 -OpenIDE-Module-Short-Description=clang-tidy analyzer integration
92.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/AnalyzedFiles.java Sun Jun 25 18:17:37 2017 +0200
92.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
92.3 @@ -1,114 +0,0 @@
92.4 -/*
92.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
92.6 - *
92.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
92.8 - *
92.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
92.10 - * Other names may be trademarks of their respective owners.
92.11 - *
92.12 - * The contents of this file are subject to the terms of either the GNU
92.13 - * General Public License Version 2 only ("GPL") or the Common
92.14 - * Development and Distribution License("CDDL") (collectively, the
92.15 - * "License"). You may not use this file except in compliance with the
92.16 - * License. You can obtain a copy of the License at
92.17 - * http://www.netbeans.org/cddl-gplv2.html
92.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
92.19 - * specific language governing permissions and limitations under the
92.20 - * License. When distributing the software, include this License Header
92.21 - * Notice in each file and include the License file at
92.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
92.23 - * particular file as subject to the "Classpath" exception as provided
92.24 - * by Oracle in the GPL Version 2 section of the License file that
92.25 - * accompanied this code. If applicable, add the following below the
92.26 - * License Header, with the fields enclosed by brackets [] replaced by
92.27 - * your own identifying information:
92.28 - * "Portions Copyrighted [year] [name of copyright owner]"
92.29 - *
92.30 - * If you wish your version of this file to be governed by only the CDDL
92.31 - * or only the GPL Version 2, indicate your decision by adding
92.32 - * "[Contributor] elects to include this software in this distribution
92.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
92.34 - * single choice of license, a recipient has the option to distribute
92.35 - * your version of this file under either the CDDL, the GPL Version 2 or
92.36 - * to extend the choice of license to its licensees as provided above.
92.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
92.38 - * Version 2 license, then the option applies only if the new code is
92.39 - * made subject to such option by the copyright holder.
92.40 - *
92.41 - * Contributor(s): Ilia Gromov
92.42 - */
92.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
92.44 -
92.45 -import java.util.Collection;
92.46 -import java.util.HashMap;
92.47 -import java.util.HashSet;
92.48 -import java.util.Map;
92.49 -import java.util.Set;
92.50 -import org.netbeans.modules.cnd.api.model.CsmFile;
92.51 -
92.52 -/**
92.53 - * This cache is designed to help Editor showing correct checks for included
92.54 - * files.
92.55 - *
92.56 - * @param <T>
92.57 - */
92.58 -public class AnalyzedFiles {
92.59 -
92.60 - private final Map<CsmFile, Set<CsmFile>> hierarchyCache = new HashMap<CsmFile, Set<CsmFile>>();
92.61 -// private final Map<FileObject, Set<CsmErrorInfo>> diagnosticsCache = new HashMap<FileObject, Set<CsmErrorInfo>>();
92.62 -
92.63 -// public void cacheDiagnostics(FileObject fo, CsmErrorInfo info) {
92.64 -// Set<CsmErrorInfo> alreadyMapped = diagnosticsCache.get(fo);
92.65 -//
92.66 -// if (alreadyMapped == null) {
92.67 -// alreadyMapped = new HashSet<CsmErrorInfo>();
92.68 -// diagnosticsCache.put(fo, alreadyMapped);
92.69 -// }
92.70 -//
92.71 -// alreadyMapped.add(info);
92.72 -// }
92.73 - public void cacheHierarchy(CsmFile startFile, Collection<CsmFile> includedFiles) {
92.74 - Set<CsmFile> alreadyMapped = hierarchyCache.get(startFile);
92.75 -
92.76 - if (alreadyMapped == null) {
92.77 - alreadyMapped = new HashSet<CsmFile>();
92.78 - hierarchyCache.put(startFile, alreadyMapped);
92.79 - }
92.80 -
92.81 - alreadyMapped.addAll(includedFiles);
92.82 - }
92.83 -
92.84 -// public Set<CsmErrorInfo> getDiagnostics(FileObject fo) {
92.85 -// return diagnosticsCache.get(fo);
92.86 -// }
92.87 -
92.88 - public Collection<? extends CsmFile> getStartFiles(CsmFile includedFile) {
92.89 - Set<CsmFile> result = new HashSet<CsmFile>();
92.90 - for (Map.Entry<CsmFile, Set<CsmFile>> entry : hierarchyCache.entrySet()) {
92.91 - CsmFile key = entry.getKey();
92.92 - Set<CsmFile> value = entry.getValue();
92.93 -
92.94 - if (value.contains(includedFile)) {
92.95 - result.add(key);
92.96 - }
92.97 - }
92.98 - return result;
92.99 - }
92.100 -
92.101 - public boolean isStartFile(CsmFile file) {
92.102 - return hierarchyCache.containsKey(file);
92.103 - }
92.104 -
92.105 - public void clear() {
92.106 - hierarchyCache.clear();
92.107 - }
92.108 -
92.109 - public static AnalyzedFiles getDefault() {
92.110 - return HOLDER.INSTANCE;
92.111 - }
92.112 -
92.113 - private static class HOLDER {
92.114 -
92.115 - public static final AnalyzedFiles INSTANCE = new AnalyzedFiles();
92.116 - }
92.117 -}
93.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/Bundle.properties Sun Jun 25 18:17:37 2017 +0200
93.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
93.3 @@ -1,59 +0,0 @@
93.4 -#
93.5 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
93.6 -#
93.7 -# Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
93.8 -#
93.9 -# The contents of this file are subject to the terms of either the GNU
93.10 -# General Public License Version 2 only ("GPL") or the Common
93.11 -# Development and Distribution License("CDDL") (collectively, the
93.12 -# "License"). You may not use this file except in compliance with the
93.13 -# License. You can obtain a copy of the License at
93.14 -# http://www.netbeans.org/cddl-gplv2.html
93.15 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
93.16 -# specific language governing permissions and limitations under the
93.17 -# License. When distributing the software, include this License Header
93.18 -# Notice in each file and include the License file at
93.19 -# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
93.20 -# particular file as subject to the "Classpath" exception as provided
93.21 -# by Sun in the GPL Version 2 section of the License file that
93.22 -# accompanied this code. If applicable, add the following below the
93.23 -# License Header, with the fields enclosed by brackets [] replaced by
93.24 -# your own identifying information:
93.25 -# "Portions Copyrighted [year] [name of copyright owner]"
93.26 -#
93.27 -# Contributor(s):
93.28 -#
93.29 -# The Original Software is NetBeans. The Initial Developer of the Original
93.30 -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
93.31 -# Microsystems, Inc. All Rights Reserved.
93.32 -#
93.33 -# If you wish your version of this file to be governed by only the CDDL
93.34 -# or only the GPL Version 2, indicate your decision by adding
93.35 -# "[Contributor] elects to include this software in this distribution
93.36 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
93.37 -# single choice of license, a recipient has the option to distribute
93.38 -# your version of this file under either the CDDL, the GPL Version 2 or
93.39 -# to extend the choice of license to its licensees as provided above.
93.40 -# However, if you add GPL Version 2 code and therefore, elected the GPL
93.41 -# Version 2 license, then the option applies only if the new code is
93.42 -# made subject to such option by the copyright holder.
93.43 -#
93.44 -
93.45 -LBL_ProviderName=C/C++ Errors
93.46 -LBL_ProviderDescription=C/C++ errors and warnings
93.47 -
93.48 -#Previse errors
93.49 -Modernize_NAME=Clang-Tidy analyzer
93.50 -Modernize_DESCRIPTION=Show warnings identified by clang-tidy.\
93.51 - <br>clang-tidy is a clang-based C++ \u201clinter\u201d tool. Its purpose is to provide an extensible framework for diagnosing and fixing typical programming errors, like style violations, interface misuse, or bugs that can be deduced via static analysis. \
93.52 - <br>Expand the node to specify which static checks you want to be displayed.
93.53 -DisableHint=Configure clang-tidy analyzer - {0}
93.54 -
93.55 -#internal error
93.56 -tool.error=Oracle Developer Studio compilers not found
93.57 -remote.mode.error=Unsupported remote mode
93.58 -remote.mode.error.info=Mode {0}
93.59 -temporary.file.error=Cannot create temporary file
93.60 -compile.file.error=Clang-tidy was unable to analyze file
93.61 -fatal.analyze.error=Clang-tidy was unable to analyze file
93.62 -compile.file.error.info=Exit code: {0}
94.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/ConfigureHintsFix.java Sun Jun 25 18:17:37 2017 +0200
94.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
94.3 @@ -1,80 +0,0 @@
94.4 -/*
94.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
94.6 - *
94.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
94.8 - *
94.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
94.10 - * Other names may be trademarks of their respective owners.
94.11 - *
94.12 - * The contents of this file are subject to the terms of either the GNU
94.13 - * General Public License Version 2 only ("GPL") or the Common
94.14 - * Development and Distribution License("CDDL") (collectively, the
94.15 - * "License"). You may not use this file except in compliance with the
94.16 - * License. You can obtain a copy of the License at
94.17 - * http://www.netbeans.org/cddl-gplv2.html
94.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
94.19 - * specific language governing permissions and limitations under the
94.20 - * License. When distributing the software, include this License Header
94.21 - * Notice in each file and include the License file at
94.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
94.23 - * particular file as subject to the "Classpath" exception as provided
94.24 - * by Oracle in the GPL Version 2 section of the License file that
94.25 - * accompanied this code. If applicable, add the following below the
94.26 - * License Header, with the fields enclosed by brackets [] replaced by
94.27 - * your own identifying information:
94.28 - * "Portions Copyrighted [year] [name of copyright owner]"
94.29 - *
94.30 - * If you wish your version of this file to be governed by only the CDDL
94.31 - * or only the GPL Version 2, indicate your decision by adding
94.32 - * "[Contributor] elects to include this software in this distribution
94.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
94.34 - * single choice of license, a recipient has the option to distribute
94.35 - * your version of this file under either the CDDL, the GPL Version 2 or
94.36 - * to extend the choice of license to its licensees as provided above.
94.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
94.38 - * Version 2 license, then the option applies only if the new code is
94.39 - * made subject to such option by the copyright holder.
94.40 - *
94.41 - * Contributor(s): Ilia Gromov
94.42 - */
94.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
94.44 -
94.45 -import org.netbeans.api.options.OptionsDisplayer;
94.46 -import org.netbeans.spi.editor.hints.ChangeInfo;
94.47 -import org.netbeans.spi.editor.hints.EnhancedFix;
94.48 -import org.openide.util.NbBundle;
94.49 -
94.50 -class ConfigureHintsFix implements EnhancedFix {
94.51 -
94.52 - private final ModernizeErrorInfo error;
94.53 - private final String text;
94.54 -
94.55 - ConfigureHintsFix(ModernizeErrorInfo error) {
94.56 - this.error = error;
94.57 - String id = error.getId();
94.58 - this.text = (id.startsWith("-")) ? id.substring(1) : id; //NOI18N
94.59 - }
94.60 -
94.61 - @Override
94.62 - public String getText() {
94.63 - return NbBundle.getMessage(ModernizeErrorProvider.class, "DisableHint", text); // NOI18N
94.64 - }
94.65 -
94.66 - @Override
94.67 - public ChangeInfo implement() throws Exception {
94.68 - String provider = ModernizeErrorProvider.NAME;
94.69 - String name = error.getId();
94.70 - OptionsDisplayer.getDefault().open("Editor/Hints/text/x-cnd+sourcefile/" + provider + "/" + name); // NOI18N
94.71 - return null;
94.72 - }
94.73 -
94.74 - @Override
94.75 - public CharSequence getSortText() {
94.76 - //Hint opening options dialog should always be the lastest in offered list
94.77 - return Integer.toString(Integer.MAX_VALUE);
94.78 - }
94.79 -
94.80 - public ModernizeErrorInfo getError() {
94.81 - return error;
94.82 - }
94.83 -}
95.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/DiagnosticsTool.java Sun Jun 25 18:17:37 2017 +0200
95.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
95.3 @@ -1,307 +0,0 @@
95.4 -/*
95.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
95.6 - *
95.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
95.8 - *
95.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
95.10 - * Other names may be trademarks of their respective owners.
95.11 - *
95.12 - * The contents of this file are subject to the terms of either the GNU
95.13 - * General Public License Version 2 only ("GPL") or the Common
95.14 - * Development and Distribution License("CDDL") (collectively, the
95.15 - * "License"). You may not use this file except in compliance with the
95.16 - * License. You can obtain a copy of the License at
95.17 - * http://www.netbeans.org/cddl-gplv2.html
95.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
95.19 - * specific language governing permissions and limitations under the
95.20 - * License. When distributing the software, include this License Header
95.21 - * Notice in each file and include the License file at
95.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
95.23 - * particular file as subject to the "Classpath" exception as provided
95.24 - * by Oracle in the GPL Version 2 section of the License file that
95.25 - * accompanied this code. If applicable, add the following below the
95.26 - * License Header, with the fields enclosed by brackets [] replaced by
95.27 - * your own identifying information:
95.28 - * "Portions Copyrighted [year] [name of copyright owner]"
95.29 - *
95.30 - * If you wish your version of this file to be governed by only the CDDL
95.31 - * or only the GPL Version 2, indicate your decision by adding
95.32 - * "[Contributor] elects to include this software in this distribution
95.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
95.34 - * single choice of license, a recipient has the option to distribute
95.35 - * your version of this file under either the CDDL, the GPL Version 2 or
95.36 - * to extend the choice of license to its licensees as provided above.
95.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
95.38 - * Version 2 license, then the option applies only if the new code is
95.39 - * made subject to such option by the copyright holder.
95.40 - *
95.41 - * Contributor(s): Ilia Gromov
95.42 - */
95.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
95.44 -
95.45 -import org.netbeans.modules.ide.analysis.modernize.utils.AnalyticsTools;
95.46 -import java.io.BufferedReader;
95.47 -import java.io.File;
95.48 -import java.io.FileReader;
95.49 -import java.io.IOException;
95.50 -import java.nio.file.Files;
95.51 -import java.nio.file.Path;
95.52 -import java.util.ArrayList;
95.53 -import java.util.Collection;
95.54 -import java.util.Collections;
95.55 -import java.util.List;
95.56 -import java.util.logging.Level;
95.57 -import java.util.logging.Logger;
95.58 -import org.netbeans.modules.cnd.api.model.CsmFile;
95.59 -import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
95.60 -import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAudit;
95.61 -import org.netbeans.modules.cnd.api.toolchain.AbstractCompiler;
95.62 -import static org.netbeans.modules.cnd.api.toolchain.PredefinedToolKind.CCCompiler;
95.63 -import static org.netbeans.modules.cnd.api.toolchain.PredefinedToolKind.CCompiler;
95.64 -import org.netbeans.modules.cnd.api.toolchain.Tool;
95.65 -import org.netbeans.modules.cnd.makeproject.api.MakeProject;
95.66 -import org.netbeans.modules.cnd.makeproject.api.configurations.CCCCompilerConfiguration;
95.67 -import org.netbeans.modules.cnd.makeproject.api.configurations.CCCompilerConfiguration;
95.68 -import org.netbeans.modules.cnd.makeproject.api.configurations.CCompilerConfiguration;
95.69 -import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
95.70 -import org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration;
95.71 -import org.netbeans.modules.cnd.makeproject.api.support.MakeProjectOptionsFormat;
95.72 -import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
95.73 -import org.netbeans.modules.nativeexecution.api.HostInfo;
95.74 -import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
95.75 -import org.netbeans.modules.nativeexecution.api.util.HostInfoUtils;
95.76 -import org.netbeans.modules.nativeexecution.api.util.ProcessUtils;
95.77 -import org.openide.filesystems.FileObject;
95.78 -import org.openide.filesystems.FileUtil;
95.79 -
95.80 -/**
95.81 - *
95.82 - * @author Ilia Gromov
95.83 - */
95.84 -public class DiagnosticsTool {
95.85 -
95.86 - public static final Logger LOG = Logger.getLogger("ide.analysis.tidy"); //NOI18N
95.87 - public static final String CACHE_ID = "TIDY-CACHE"; //NOI18N
95.88 -
95.89 - public static final int STATUS_OK = 0;
95.90 - public static final int STATUS_IO_ERROR = -1;
95.91 -
95.92 - public static List<CodeAudit> getAudits(String path, ExecutionEnvironment env, AuditPreferences preferences) {
95.93 - List<CodeAudit> res = new ArrayList<>();
95.94 -
95.95 - ProcessUtils.ExitStatus status = ProcessUtils.execute(env, path, new String[]{"-checks=*", "-list-checks", "dummy", "--"}); // NOI18N
95.96 -
95.97 - if (status.exitCode == 0) {
95.98 - String out = status.getOutputString();
95.99 - out = out.substring(status.getOutputString().indexOf('\n') + 1);
95.100 - String[] checks = out.split("\n"); // NOI18N
95.101 -
95.102 - FileObject disabledChecksFolder = FileUtil.getConfigFile("Analysis/Clang-Tidy/Disabled_Default"); // NOI18N
95.103 -
95.104 - List<String> disabledChecks = new ArrayList<>();
95.105 - for (FileObject fileObject : disabledChecksFolder.getChildren()) {
95.106 - disabledChecks.add(fileObject.getName());
95.107 - }
95.108 -
95.109 - for (String check : checks) {
95.110 - check = check.trim();
95.111 - ModernizeCodeAudit myCodeAudit = new ModernizeCodeAudit(
95.112 - check,
95.113 - check,
95.114 - check,
95.115 - "warning", //NOI18N
95.116 - !disabledChecks.contains(check),
95.117 - preferences);
95.118 - res.add(myCodeAudit);
95.119 - }
95.120 - }
95.121 -
95.122 - return res;
95.123 - }
95.124 -
95.125 - private final ExecutionEnvironment execEnv;
95.126 - private final Item item;
95.127 - private final MakeProject project;
95.128 - private final String binaryPath;
95.129 -
95.130 - private StringBuilder buf;
95.131 -
95.132 - public DiagnosticsTool(ExecutionEnvironment execEnv, Item item, MakeProject project, String binaryPath) {
95.133 - this.execEnv = execEnv;
95.134 - this.item = item;
95.135 - this.project = project;
95.136 - this.binaryPath = binaryPath;
95.137 - }
95.138 -
95.139 - /**
95.140 - * @return clang-tidy's exit code or negative code if some other problem has
95.141 - * occurred.
95.142 - */
95.143 - public int process(Collection<String> checks, CsmFile csmFile, boolean isStartFile) throws ConnectionManager.CancellationException, IOException {
95.144 - // TODO: can we split analyzer (Source -> Inspect) ant editor error providing?
95.145 -
95.146 - final String directoryMacro = "xDIRx"; //NOI18N
95.147 -
95.148 - File tmpDir = null;
95.149 - try {
95.150 - List<String> args = new ArrayList<String>();
95.151 -
95.152 - HostInfo hostInfo = HostInfoUtils.getHostInfo(execEnv);
95.153 -
95.154 - try {
95.155 - if (execEnv.isRemote()) {
95.156 - tmpDir = Files.createTempDirectory(hostInfo.getTempDirFile().toPath(), "tidy").toFile(); //NOI18N
95.157 - } else {
95.158 - tmpDir = Files.createTempDirectory("tidy").toFile(); //NOI18N
95.159 - }
95.160 - } catch (IOException ex) {
95.161 - return -1;
95.162 - }
95.163 -
95.164 - Path tmpFile = Files.createTempFile(tmpDir.toPath(), null, null);
95.165 -
95.166 - args.add("-header-filter=.*"); //NOI18N
95.167 - StringBuilder sb = new StringBuilder("-checks=");// NOI18N
95.168 - for (String check : checks) {
95.169 - sb.append(check);
95.170 - sb.append(","); // NOI18N
95.171 - }
95.172 - args.add(sb.toString().substring(0, sb.length() - 1));
95.173 -
95.174 - args.add("-export-fixes=" + tmpFile); // NOI18N
95.175 - int directoryIdx = args.size() - 1;
95.176 -
95.177 - Collection<? extends CsmFile> startFiles = Collections.EMPTY_LIST;
95.178 - args.add(csmFile.getFileObject().getPath());
95.179 -
95.180 - args.add("--"); //NOI18N
95.181 - args.addAll(getAdditionalFlags(csmFile));
95.182 -
95.183 - List<String> copy = new ArrayList<String>(args);
95.184 -
95.185 - copy.set(directoryIdx, copy.get(directoryIdx).replace(directoryMacro, tmpDir.getAbsolutePath()));
95.186 -
95.187 - // TODO: execute in the ${WORKING_DIR} ? Because we can have relative path includes (-Isrc/libs/abcd)
95.188 - ProcessUtils.ExitStatus executeStatus = ProcessUtils.executeInDir(tmpDir.getAbsolutePath(),
95.189 - execEnv,
95.190 - binaryPath,
95.191 - copy.toArray(new String[copy.size()]));
95.192 -
95.193 - if (executeStatus.exitCode != STATUS_OK) {
95.194 - LOG.log(Level.INFO, "clang-tidy exit code {0}: {1}", new Object[]{executeStatus.exitCode, arrayAsString(binaryPath, copy)});
95.195 - LOG.fine(executeStatus.getOutputString());
95.196 - LOG.fine(executeStatus.getErrorString());
95.197 - return executeStatus.exitCode;
95.198 - } else {
95.199 - LOG.log(Level.FINEST, "{0}", arrayAsString(binaryPath, copy));
95.200 - LOG.finest(executeStatus.getOutputString());
95.201 - LOG.finest(executeStatus.getErrorString());
95.202 - }
95.203 -
95.204 - File[] listFiles = tmpDir.listFiles();
95.205 -
95.206 - if (listFiles.length != 1) {
95.207 - return STATUS_IO_ERROR;
95.208 - }
95.209 -
95.210 - File yamlFile = listFiles[0];
95.211 -
95.212 - BufferedReader in = new BufferedReader(new FileReader(yamlFile));
95.213 - buf = new StringBuilder();
95.214 - while (true) {
95.215 - String s = in.readLine();
95.216 - if (s == null) {
95.217 - break;
95.218 - }
95.219 - buf.append(s).append('\n'); //NOI18N
95.220 - }
95.221 -
95.222 - } finally {
95.223 - try {
95.224 - tmpDir.delete();
95.225 - } catch (Exception x) {
95.226 -
95.227 - }
95.228 - }
95.229 -
95.230 - return STATUS_OK;
95.231 - }
95.232 -
95.233 - private List<String> getAdditionalFlags(CsmFile csmFile) {
95.234 - List<String> all = new ArrayList<String>();
95.235 -
95.236 - Tool tool = AnalyticsTools.compiler(item, project);
95.237 -
95.238 - if (tool instanceof AbstractCompiler) {
95.239 - AbstractCompiler compiler = (AbstractCompiler) tool;
95.240 -
95.241 - for (String systemIncludeDirectory : compiler.getSystemIncludeDirectories()) {
95.242 - all.add("-I" + systemIncludeDirectory); //NOI18N
95.243 - }
95.244 -
95.245 - MakeConfiguration activeConfiguration = AnalyticsTools.getConfigurationDescriptor(csmFile, project).getActiveConfiguration();
95.246 -
95.247 - String options = "";
95.248 -// // compileSingleUnmanage as reference
95.249 -// // don't use getAllOptions - we need not -w flag
95.250 - if (tool.getKind() == CCCompiler) {
95.251 - CCCompilerConfiguration ccc = activeConfiguration.getCCCompilerConfiguration();
95.252 - options += ccc.getPreprocessorOptions(compiler.getCompilerSet());
95.253 - options += ccc.getIncludeDirectoriesOptions(compiler.getCompilerSet());
95.254 -// options += getLibrariesFlags();
95.255 - options += compiler.getCppStandardOptions(ccc.getInheritedCppStandard());
95.256 - if (!options.contains("-std=")) { //NOI18N
95.257 - switch (item.getLanguageFlavor()) {
95.258 - case CPP98:
95.259 - options += " -std=c++98"; //NOI18N
95.260 - break;
95.261 - case CPP11:
95.262 - options += " -std=c++11"; //NOI18N
95.263 - break;
95.264 - case CPP14:
95.265 - options += " -std=c++14"; //NOI18N
95.266 - break;
95.267 - }
95.268 - }
95.269 - } else if (tool.getKind() == CCompiler) {
95.270 - CCompilerConfiguration cc = activeConfiguration.getCCompilerConfiguration();
95.271 - options += cc.getPreprocessorOptions(compiler.getCompilerSet());
95.272 - options += cc.getIncludeDirectoriesOptions(compiler.getCompilerSet());
95.273 - options += compiler.getCStandardOptions(cc.getInheritedCStandard());
95.274 - if (!options.contains("-std=")) { //NOI18N
95.275 - switch (item.getLanguageFlavor()) {
95.276 - case C11:
95.277 - options += " -std=c11"; //NOI18N
95.278 - break;
95.279 - case C89:
95.280 - options += " -std=c89"; //NOI18N
95.281 - break;
95.282 - case C99:
95.283 - options += " -std=c99"; //NOI18N
95.284 - break;
95.285 - }
95.286 - }
95.287 - }
95.288 -
95.289 - List<String> optionsList = AnalyticsTools.scanCommandLine(MakeProjectOptionsFormat.reformatWhitespaces(options));
95.290 - all.addAll(optionsList);
95.291 - }
95.292 -
95.293 - return all;
95.294 - }
95.295 -
95.296 - public String getYamlAsString() {
95.297 - if (buf == null) {
95.298 - throw new IllegalStateException();
95.299 - }
95.300 - return buf.toString();
95.301 - }
95.302 -
95.303 - private static String arrayAsString(String binary, List<String> list) {
95.304 - StringBuilder sb = new StringBuilder(binary).append(" "); //NOI18N
95.305 - for (String string : list) {
95.306 - sb.append(string).append(" "); //NOI18N
95.307 - }
95.308 - return sb.toString();
95.309 - }
95.310 -}
96.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/ModernizeAnalyzerImpl.java Sun Jun 25 18:17:37 2017 +0200
96.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
96.3 @@ -1,214 +0,0 @@
96.4 -/*
96.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
96.6 - *
96.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
96.8 - *
96.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
96.10 - * Other names may be trademarks of their respective owners.
96.11 - *
96.12 - * The contents of this file are subject to the terms of either the GNU
96.13 - * General Public License Version 2 only ("GPL") or the Common
96.14 - * Development and Distribution License("CDDL") (collectively, the
96.15 - * "License"). You may not use this file except in compliance with the
96.16 - * License. You can obtain a copy of the License at
96.17 - * http://www.netbeans.org/cddl-gplv2.html
96.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
96.19 - * specific language governing permissions and limitations under the
96.20 - * License. When distributing the software, include this License Header
96.21 - * Notice in each file and include the License file at
96.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
96.23 - * particular file as subject to the "Classpath" exception as provided
96.24 - * by Oracle in the GPL Version 2 section of the License file that
96.25 - * accompanied this code. If applicable, add the following below the
96.26 - * License Header, with the fields enclosed by brackets [] replaced by
96.27 - * your own identifying information:
96.28 - * "Portions Copyrighted [year] [name of copyright owner]"
96.29 - *
96.30 - * If you wish your version of this file to be governed by only the CDDL
96.31 - * or only the GPL Version 2, indicate your decision by adding
96.32 - * "[Contributor] elects to include this software in this distribution
96.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
96.34 - * single choice of license, a recipient has the option to distribute
96.35 - * your version of this file under either the CDDL, the GPL Version 2 or
96.36 - * to extend the choice of license to its licensees as provided above.
96.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
96.38 - * Version 2 license, then the option applies only if the new code is
96.39 - * made subject to such option by the copyright holder.
96.40 - *
96.41 - * Contributor(s): Ilia Gromov
96.42 - */
96.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
96.44 -
96.45 -import org.netbeans.modules.ide.analysis.modernize.options.ClangAnalyzerOptions;
96.46 -import org.netbeans.modules.ide.analysis.modernize.resources.BundleUtilities;
96.47 -import java.io.CharConversionException;
96.48 -import java.io.File;
96.49 -import java.util.ArrayList;
96.50 -import java.util.Arrays;
96.51 -import java.util.Collection;
96.52 -import java.util.Collections;
96.53 -import java.util.List;
96.54 -import java.util.concurrent.atomic.AtomicBoolean;
96.55 -import java.util.prefs.Preferences;
96.56 -import org.netbeans.modules.analysis.spi.Analyzer;
96.57 -import org.netbeans.modules.cnd.analysis.api.AbstractAnalyzer;
96.58 -import org.netbeans.modules.cnd.analysis.api.AbstractHintsPanel;
96.59 -import org.netbeans.modules.cnd.api.model.CsmFile;
96.60 -import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAudit;
96.61 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
96.62 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
96.63 -import org.netbeans.modules.cnd.modelutil.CsmUtilities;
96.64 -import org.netbeans.modules.cnd.utils.CndPathUtilities;
96.65 -import org.netbeans.spi.editor.hints.ErrorDescription;
96.66 -import org.netbeans.spi.editor.hints.ErrorDescriptionFactory;
96.67 -import org.netbeans.spi.editor.hints.LazyFixList;
96.68 -import org.netbeans.spi.editor.hints.Severity;
96.69 -import org.openide.filesystems.FileObject;
96.70 -import org.openide.util.ImageUtilities;
96.71 -import org.openide.util.NbBundle;
96.72 -import org.openide.util.lookup.ServiceProvider;
96.73 -import org.openide.xml.XMLUtil;
96.74 -
96.75 -public class ModernizeAnalyzerImpl extends AbstractAnalyzer {
96.76 -
96.77 - private static final String PREFIX = "tidy-"; //NOI18N
96.78 -
96.79 - private ModernizeAnalyzerImpl(Context ctx) {
96.80 - super(ctx);
96.81 - }
96.82 -
96.83 - @Override
96.84 - public ModernizeErrorProvider getErrorProvider(Preferences preferences) {
96.85 - return ModernizeErrorProvider.getInstance();
96.86 - }
96.87 -
96.88 - @Override
96.89 - protected boolean isCompileUnitBased() {
96.90 - return true;
96.91 - }
96.92 -
96.93 - @Override
96.94 - protected Collection<? extends ErrorDescription> doRunImpl(final FileObject sr, final Context ctx, final CsmErrorProvider provider, final AtomicBoolean cancel) {
96.95 - final CsmFile csmFile = CsmUtilities.getCsmFile(sr, false, false);
96.96 - if (csmFile == null) {
96.97 - return Collections.<ErrorDescription>emptyList();
96.98 - }
96.99 - CsmErrorProvider.Request request = new RequestImpl(csmFile, ctx, cancel);
96.100 - final ArrayList<ErrorDescription> res = new ArrayList<ErrorDescription>();
96.101 - CsmErrorProvider.Response responce = new ResponseImpl(sr, res, cancel);
96.102 - provider.getErrors(request, responce);
96.103 - return res;
96.104 - }
96.105 -
96.106 - protected static class ResponseImpl extends AbstractResponse {
96.107 -
96.108 - public ResponseImpl(FileObject sr, ArrayList<ErrorDescription> res, AtomicBoolean cancel) {
96.109 - super(sr, res, cancel);
96.110 - }
96.111 -
96.112 - @Override
96.113 - protected ErrorDescription addErrorImpl(CsmErrorInfo errorInfo, FileObject fo) {
96.114 - String messages[] = errorInfo.getMessage().split("\n"); //NOI18N
96.115 - if (messages.length > 0) {
96.116 - StringBuilder sb = new StringBuilder();
96.117 - if (errorInfo instanceof ModernizeErrorInfo) {
96.118 - ModernizeErrorInfo mei = (ModernizeErrorInfo) errorInfo;
96.119 - sb.append("<pre>"); //NOI18N
96.120 - sb.append("["); //NOI18N
96.121 - sb.append(mei.getId());
96.122 - sb.append("]"); //NOI18N
96.123 - sb.append("\n"); //NOI18N
96.124 - List<YamlParser.Replacement> replacements = mei.getDiagnostics().getReplacements();
96.125 - if (replacements.isEmpty()) {
96.126 - sb.append(CndPathUtilities.getRelativePath(mei.getProject().getProjectRoot(), mei.getDiagnostics().getMessageFilePath())).append(" "); //NOI18N
96.127 - sb.append(mei.getDiagnostics().getMessageFileOffset()).append("\n");
96.128 - } else {
96.129 - for (YamlParser.Replacement replacement : replacements) {
96.130 - sb.append("\n"); //NOI18N
96.131 - sb.append("Replacement: "); //NOI18N
96.132 - sb.append(CndPathUtilities.getRelativePath(mei.getProject().getProjectRoot(), replacement.filePath)).append(" "); //NOI18N
96.133 - sb.append(replacement.offset).append("-").append(replacement.offset + replacement.length).append("\n"); //NOI18N
96.134 - String attributeValue = replacement.replacementText;
96.135 - try {
96.136 - attributeValue = XMLUtil.toAttributeValue(replacement.replacementText);
96.137 - } catch (CharConversionException ex) {
96.138 - }
96.139 - sb.append(attributeValue).append("\n"); //NOI18N
96.140 - }
96.141 - }
96.142 - sb.append(mei.getMessage());
96.143 - sb.append("</pre>"); //NOI18N
96.144 -
96.145 - LazyFixList list = new LazyFixListImpl();
96.146 -
96.147 - return ErrorDescriptionFactory.createErrorDescription(PREFIX + mei.getId(), Severity.valueOf(mei.getSeverity().toString().toUpperCase()),
96.148 - messages[0], sb.toString(), list, fo, errorInfo.getStartOffset(), errorInfo.getStartOffset());
96.149 - }
96.150 - }
96.151 - return null;
96.152 - }
96.153 - }
96.154 -
96.155 - @ServiceProvider(service = AnalyzerFactory.class)
96.156 - public static final class AnalyzerFactoryImpl extends AnalyzerFactory {
96.157 -
96.158 - public AnalyzerFactoryImpl() {
96.159 - super(ModernizeErrorProvider.NAME,
96.160 - NbBundle.getMessage(ModernizeErrorProvider.class, "Modernize_NAME"), //NOI18N
96.161 - ImageUtilities.loadImage("ide/analysis/modernize/impl/bugs.png")); //NOI18N
96.162 - }
96.163 -
96.164 - @Override
96.165 - public Iterable<? extends WarningDescription> getWarnings() {
96.166 - List<WarningDescription> result = new ArrayList<WarningDescription>();
96.167 - final ModernizeErrorProvider provider = ModernizeErrorProvider.getInstance();
96.168 - for (CodeAudit audit : provider.getAudits()) {
96.169 - result.add(WarningDescription.create(PREFIX + audit.getID(), audit.getName(), ModernizeErrorProvider.NAME, provider.getDisplayName()));
96.170 - }
96.171 - String[] fatals = BundleUtilities.getFatalErrors();
96.172 - for (String id : fatals) { //NOI18N
96.173 - if (!id.isEmpty()) {
96.174 - result.add(WarningDescription.create(PREFIX + id, BundleUtilities.getDescription(id), ModernizeErrorProvider.NAME, provider.getDisplayName()));
96.175 - }
96.176 - }
96.177 - return result;
96.178 - }
96.179 -
96.180 - @Override
96.181 - public CustomizerProvider<Void, AbstractHintsPanel> getCustomizerProvider() {
96.182 - return new CustomizerProvider<Void, AbstractHintsPanel>() {
96.183 -
96.184 - @Override
96.185 - public Void initialize() {
96.186 - return null;
96.187 - }
96.188 -
96.189 - @Override
96.190 - public AbstractHintsPanel createComponent(CustomizerContext<Void, AbstractHintsPanel> context) {
96.191 - return AbstractAnalyzer.createComponent(ModernizeErrorProvider.getInstance());
96.192 - }
96.193 - };
96.194 - }
96.195 -
96.196 - @Override
96.197 - public Collection<? extends MissingPlugin> requiredPlugins(Context context) {
96.198 -// ExecutionEnvironment env = detectEnvironment(context);
96.199 -// if (env == null) {
96.200 -// env = ExecutionEnvironmentFactory.getLocal();
96.201 -// }
96.202 - String installedTool = ClangAnalyzerOptions.getClangAnalyzerPath();
96.203 - if (installedTool == null || !new File(installedTool).exists()) {
96.204 - String codeBase = ClangAnalyzerOptions.getMissingModuleName();
96.205 - if (codeBase != null) {
96.206 - return Arrays.asList(new MissingPlugin(codeBase, NbBundle.getMessage(ModernizeAnalyzerImpl.class, "Modernize_NAME"))); //NOI18N
96.207 - }
96.208 - }
96.209 - return Collections.emptyList();
96.210 - }
96.211 -
96.212 - @Override
96.213 - public Analyzer createAnalyzer(Context context) {
96.214 - return new ModernizeAnalyzerImpl(context);
96.215 - }
96.216 - }
96.217 -}
97.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/ModernizeCodeAudit.java Sun Jun 25 18:17:37 2017 +0200
97.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
97.3 @@ -1,120 +0,0 @@
97.4 -/*
97.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
97.6 - *
97.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
97.8 - *
97.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
97.10 - * Other names may be trademarks of their respective owners.
97.11 - *
97.12 - * The contents of this file are subject to the terms of either the GNU
97.13 - * General Public License Version 2 only ("GPL") or the Common
97.14 - * Development and Distribution License("CDDL") (collectively, the
97.15 - * "License"). You may not use this file except in compliance with the
97.16 - * License. You can obtain a copy of the License at
97.17 - * http://www.netbeans.org/cddl-gplv2.html
97.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
97.19 - * specific language governing permissions and limitations under the
97.20 - * License. When distributing the software, include this License Header
97.21 - * Notice in each file and include the License file at
97.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
97.23 - * particular file as subject to the "Classpath" exception as provided
97.24 - * by Oracle in the GPL Version 2 section of the License file that
97.25 - * accompanied this code. If applicable, add the following below the
97.26 - * License Header, with the fields enclosed by brackets [] replaced by
97.27 - * your own identifying information:
97.28 - * "Portions Copyrighted [year] [name of copyright owner]"
97.29 - *
97.30 - * If you wish your version of this file to be governed by only the CDDL
97.31 - * or only the GPL Version 2, indicate your decision by adding
97.32 - * "[Contributor] elects to include this software in this distribution
97.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
97.34 - * single choice of license, a recipient has the option to distribute
97.35 - * your version of this file under either the CDDL, the GPL Version 2 or
97.36 - * to extend the choice of license to its licensees as provided above.
97.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
97.38 - * Version 2 license, then the option applies only if the new code is
97.39 - * made subject to such option by the copyright holder.
97.40 - *
97.41 - * Contributor(s): Ilia Gromov
97.42 - */
97.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
97.44 -
97.45 -import org.netbeans.modules.cnd.api.model.syntaxerr.AbstractCodeAudit;
97.46 -import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
97.47 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
97.48 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
97.49 -
97.50 -final class ModernizeCodeAudit extends AbstractCodeAudit {
97.51 -
97.52 - private final String id;
97.53 - private final String name;
97.54 - private final String description;
97.55 - private final String defaultSeverity;
97.56 - private final boolean defaultEnabled;
97.57 - private final AuditPreferences myPreferences;
97.58 -
97.59 - public ModernizeCodeAudit(String id, String name, String description, String defaultSeverity, boolean defaultEnabled, AuditPreferences myPreferences) {
97.60 - super(id, name, description, defaultSeverity, defaultEnabled, myPreferences);
97.61 - this.id = id;
97.62 - this.name = name;
97.63 - this.description = description;
97.64 - this.defaultSeverity = defaultSeverity;
97.65 - this.defaultEnabled = defaultEnabled;
97.66 - this.myPreferences = myPreferences;
97.67 - }
97.68 -
97.69 - @Override
97.70 - public String getID() {
97.71 - return id;
97.72 - }
97.73 -
97.74 - @Override
97.75 - public String getName() {
97.76 - return name;
97.77 - }
97.78 -
97.79 - @Override
97.80 - public String getDescription() {
97.81 - return description;
97.82 - }
97.83 -
97.84 - public static CsmErrorInfo.Severity toSeverity(String severity) {
97.85 - if ("error".equals(severity)) { // NOI18N
97.86 - return CsmErrorInfo.Severity.ERROR;
97.87 - } else if ("warning".equals(severity)) { // NOI18N
97.88 - return CsmErrorInfo.Severity.WARNING;
97.89 - } else {
97.90 - return CsmErrorInfo.Severity.HINT;
97.91 - }
97.92 - }
97.93 -
97.94 - @Override
97.95 - public String getKind() {
97.96 - return "inspection"; //NOI18N
97.97 - }
97.98 -
97.99 - @Override
97.100 - public AuditPreferences getPreferences() {
97.101 - return myPreferences;
97.102 - }
97.103 -
97.104 - @Override
97.105 - public boolean getDefaultEnabled() {
97.106 - return defaultEnabled;
97.107 - }
97.108 -
97.109 - @Override
97.110 - public String getDefaultSeverity() {
97.111 - return defaultSeverity;
97.112 - }
97.113 -
97.114 - @Override
97.115 - public boolean isSupportedEvent(CsmErrorProvider.EditorEvent kind) {
97.116 - return true;
97.117 - }
97.118 -
97.119 - @Override
97.120 - public void doGetErrors(CsmErrorProvider.Request request, CsmErrorProvider.Response response) {
97.121 - throw new UnsupportedOperationException("Not supported yet."); //NOI18N
97.122 - }
97.123 -}
98.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/ModernizeErrorInfo.java Sun Jun 25 18:17:37 2017 +0200
98.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
98.3 @@ -1,141 +0,0 @@
98.4 -/*
98.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
98.6 - *
98.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
98.8 - *
98.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
98.10 - * Other names may be trademarks of their respective owners.
98.11 - *
98.12 - * The contents of this file are subject to the terms of either the GNU
98.13 - * General Public License Version 2 only ("GPL") or the Common
98.14 - * Development and Distribution License("CDDL") (collectively, the
98.15 - * "License"). You may not use this file except in compliance with the
98.16 - * License. You can obtain a copy of the License at
98.17 - * http://www.netbeans.org/cddl-gplv2.html
98.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
98.19 - * specific language governing permissions and limitations under the
98.20 - * License. When distributing the software, include this License Header
98.21 - * Notice in each file and include the License file at
98.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
98.23 - * particular file as subject to the "Classpath" exception as provided
98.24 - * by Oracle in the GPL Version 2 section of the License file that
98.25 - * accompanied this code. If applicable, add the following below the
98.26 - * License Header, with the fields enclosed by brackets [] replaced by
98.27 - * your own identifying information:
98.28 - * "Portions Copyrighted [year] [name of copyright owner]"
98.29 - *
98.30 - * If you wish your version of this file to be governed by only the CDDL
98.31 - * or only the GPL Version 2, indicate your decision by adding
98.32 - * "[Contributor] elects to include this software in this distribution
98.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
98.34 - * single choice of license, a recipient has the option to distribute
98.35 - * your version of this file under either the CDDL, the GPL Version 2 or
98.36 - * to extend the choice of license to its licensees as provided above.
98.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
98.38 - * Version 2 license, then the option applies only if the new code is
98.39 - * made subject to such option by the copyright holder.
98.40 - *
98.41 - * Contributor(s): Ilia Gromov
98.42 - */
98.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
98.44 -
98.45 -import java.util.Objects;
98.46 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
98.47 -import org.netbeans.modules.cnd.api.project.NativeProject;
98.48 -import org.openide.util.Lookup;
98.49 -
98.50 -public class ModernizeErrorInfo implements CsmErrorInfo, ModernizeErrorProvider.ErrorInfoWithId {
98.51 -
98.52 - private final YamlParser.Diagnostics diag;
98.53 - private final String message;
98.54 - private final NativeProject project;
98.55 -
98.56 - private final int startOffset;
98.57 - private final int endOffset;
98.58 -
98.59 - public ModernizeErrorInfo(YamlParser.Diagnostics diag, String message, Lookup.Provider project) {
98.60 - this.diag = diag;
98.61 - this.message = message;
98.62 - this.project = project.getLookup().lookup(NativeProject.class);
98.63 -
98.64 - if (diag.getReplacements().isEmpty()) {
98.65 - startOffset = diag.getMessageFileOffset();
98.66 - endOffset = diag.getMessageFileOffset();
98.67 - } else {
98.68 - YamlParser.Replacement first = diag.getReplacements().get(0);
98.69 - startOffset = first.offset;
98.70 - endOffset = first.offset + first.length;
98.71 - }
98.72 - }
98.73 -
98.74 - public NativeProject getProject() {
98.75 - return project;
98.76 - }
98.77 -
98.78 - @Override
98.79 - public String getMessage() {
98.80 - return message;
98.81 - }
98.82 -
98.83 - @Override
98.84 - public Severity getSeverity() {
98.85 - return Severity.valueOf(diag.getLevel().toString().toUpperCase());
98.86 - }
98.87 -
98.88 - @Override
98.89 - public int getStartOffset() {
98.90 - return startOffset;
98.91 - }
98.92 -
98.93 - @Override
98.94 - public int getEndOffset() {
98.95 - return endOffset;
98.96 - }
98.97 -
98.98 - public YamlParser.Diagnostics getDiagnostics() {
98.99 - return diag;
98.100 - }
98.101 -
98.102 - @Override
98.103 - public String getId() {
98.104 - return diag.getCheckName();
98.105 - }
98.106 -
98.107 - public boolean isNeedConfigureHint() {
98.108 - return true;
98.109 - }
98.110 -
98.111 - @Override
98.112 - public int hashCode() {
98.113 - int hash = 3;
98.114 - hash = 19 * hash + this.diag.getCheckName().hashCode();
98.115 - hash = 19 * hash + this.startOffset;
98.116 - hash = 19 * hash + this.endOffset;
98.117 - return hash;
98.118 - }
98.119 -
98.120 - @Override
98.121 - public boolean equals(Object obj) {
98.122 - if (this == obj) {
98.123 - return true;
98.124 - }
98.125 - if (obj == null) {
98.126 - return false;
98.127 - }
98.128 - if (getClass() != obj.getClass()) {
98.129 - return false;
98.130 - }
98.131 - final ModernizeErrorInfo other = (ModernizeErrorInfo) obj;
98.132 - if (this.startOffset != other.startOffset) {
98.133 - return false;
98.134 - }
98.135 - if (this.endOffset != other.endOffset) {
98.136 - return false;
98.137 - }
98.138 - if (!(this.diag.getCheckName().equals(other.diag.getCheckName()))) {
98.139 - return false;
98.140 - }
98.141 - return true;
98.142 - }
98.143 -
98.144 -}
99.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/ModernizeErrorProvider.java Sun Jun 25 18:17:37 2017 +0200
99.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
99.3 @@ -1,422 +0,0 @@
99.4 -/*
99.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
99.6 - *
99.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
99.8 - *
99.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
99.10 - * Other names may be trademarks of their respective owners.
99.11 - *
99.12 - * The contents of this file are subject to the terms of either the GNU
99.13 - * General Public License Version 2 only ("GPL") or the Common
99.14 - * Development and Distribution License("CDDL") (collectively, the
99.15 - * "License"). You may not use this file except in compliance with the
99.16 - * License. You can obtain a copy of the License at
99.17 - * http://www.netbeans.org/cddl-gplv2.html
99.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
99.19 - * specific language governing permissions and limitations under the
99.20 - * License. When distributing the software, include this License Header
99.21 - * Notice in each file and include the License file at
99.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
99.23 - * particular file as subject to the "Classpath" exception as provided
99.24 - * by Oracle in the GPL Version 2 section of the License file that
99.25 - * accompanied this code. If applicable, add the following below the
99.26 - * License Header, with the fields enclosed by brackets [] replaced by
99.27 - * your own identifying information:
99.28 - * "Portions Copyrighted [year] [name of copyright owner]"
99.29 - *
99.30 - * If you wish your version of this file to be governed by only the CDDL
99.31 - * or only the GPL Version 2, indicate your decision by adding
99.32 - * "[Contributor] elects to include this software in this distribution
99.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
99.34 - * single choice of license, a recipient has the option to distribute
99.35 - * your version of this file under either the CDDL, the GPL Version 2 or
99.36 - * to extend the choice of license to its licensees as provided above.
99.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
99.38 - * Version 2 license, then the option applies only if the new code is
99.39 - * made subject to such option by the copyright holder.
99.40 - *
99.41 - * Contributor(s): Ilia Gromov
99.42 - */
99.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
99.44 -
99.45 -import org.netbeans.modules.ide.analysis.modernize.impl.ModernizeAnalyzerImpl.ResponseImpl;
99.46 -import org.netbeans.modules.ide.analysis.modernize.impl.YamlParser.Replacement;
99.47 -import org.netbeans.modules.ide.analysis.modernize.options.AnalyzerPreferences;
99.48 -import org.netbeans.modules.ide.analysis.modernize.options.ClangAnalyzerOptions;
99.49 -import static org.netbeans.modules.ide.analysis.modernize.utils.AnalyticsTools.fatalError;
99.50 -import static org.netbeans.modules.ide.analysis.modernize.utils.AnalyticsTools.findItem;
99.51 -import java.io.File;
99.52 -import java.io.IOException;
99.53 -import java.util.ArrayList;
99.54 -import java.util.Collection;
99.55 -import java.util.Collections;
99.56 -import java.util.List;
99.57 -import java.util.logging.Level;
99.58 -import java.util.logging.Logger;
99.59 -import java.util.prefs.Preferences;
99.60 -import javax.swing.JComponent;
99.61 -import javax.swing.JLabel;
99.62 -import org.netbeans.modules.cnd.analysis.api.AbstractCustomizerProvider;
99.63 -import org.netbeans.modules.cnd.analysis.api.AnalyzerResponse;
99.64 -import org.netbeans.modules.cnd.api.model.CsmFile;
99.65 -import org.netbeans.modules.cnd.api.model.syntaxerr.AbstractCodeAudit;
99.66 -import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
99.67 -import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAudit;
99.68 -import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAuditFactory;
99.69 -import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAuditProvider;
99.70 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
99.71 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo.Severity;
99.72 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfoHintProvider;
99.73 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
99.74 -import org.netbeans.modules.cnd.api.project.NativeFileItem.Language;
99.75 -import org.netbeans.modules.cnd.api.project.NativeProject;
99.76 -import org.netbeans.modules.cnd.api.remote.RemoteProject;
99.77 -import org.netbeans.modules.cnd.makeproject.api.MakeProject;
99.78 -import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
99.79 -import org.netbeans.modules.cnd.modelutil.CsmUtilities;
99.80 -import org.netbeans.modules.cnd.utils.MIMENames;
99.81 -import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
99.82 -import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
99.83 -import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
99.84 -import org.netbeans.spi.editor.hints.Fix;
99.85 -import org.openide.awt.Actions;
99.86 -import org.openide.filesystems.FileObject;
99.87 -import org.openide.filesystems.FileUtil;
99.88 -import org.openide.util.Exceptions;
99.89 -import org.openide.util.Lookup;
99.90 -import org.openide.util.NbBundle;
99.91 -import org.openide.util.lookup.ServiceProvider;
99.92 -import org.openide.util.lookup.ServiceProviders;
99.93 -
99.94 -@ServiceProviders({
99.95 - @ServiceProvider(service = CsmErrorProvider.class, position = 2100)
99.96 - ,
99.97 - @ServiceProvider(service = CodeAuditProvider.class, position = 2100)
99.98 -})
99.99 -public final class ModernizeErrorProvider extends CsmErrorProvider implements CodeAuditProvider, AbstractCustomizerProvider {
99.100 -
99.101 - public static final Logger LOG = Logger.getLogger("ide.analysis.tidy"); //NOI18N
99.102 - private Collection<CodeAudit> audits;
99.103 - public static final String NAME = "Modernize"; //NOI18N
99.104 -
99.105 - public static ModernizeErrorProvider getInstance() {
99.106 - for (CsmErrorProvider provider : Lookup.getDefault().lookupAll(CsmErrorProvider.class)) {
99.107 - if (NAME.equals(provider.getName()) && provider instanceof ModernizeErrorProvider) {
99.108 - return (ModernizeErrorProvider) provider;
99.109 - }
99.110 - }
99.111 - return null;
99.112 - }
99.113 -
99.114 - @Override
99.115 - protected boolean validate(Request request) {
99.116 - CsmFile file = request.getFile();
99.117 - return file != null;
99.118 - }
99.119 -
99.120 - @Override
99.121 - public boolean hasHintControlPanel() {
99.122 - return true;
99.123 - }
99.124 -
99.125 - @Override
99.126 - public String getName() {
99.127 - return NAME;
99.128 - }
99.129 -
99.130 - @Override
99.131 - public String getDisplayName() {
99.132 - return NbBundle.getMessage(ModernizeErrorProvider.class, "Modernize_NAME"); //NOI18N
99.133 - }
99.134 -
99.135 - @Override
99.136 - public String getDescription() {
99.137 - return NbBundle.getMessage(ModernizeErrorProvider.class, "Modernize_DESCRIPTION"); //NOI18N
99.138 - }
99.139 -
99.140 - @Override
99.141 - public String getMimeType() {
99.142 - return MIMENames.SOURCES_MIME_TYPE;
99.143 - }
99.144 -
99.145 - @Override
99.146 - public boolean isSupportedEvent(EditorEvent kind) {
99.147 - return kind == EditorEvent.FileBased;
99.148 - }
99.149 -
99.150 - @Override
99.151 - protected void doGetErrors(CsmErrorProvider.Request request, CsmErrorProvider.Response response) {
99.152 - CsmFile file = request.getFile();
99.153 - if (file != null) {
99.154 - if (request.isCancelled()) {
99.155 - return;
99.156 - }
99.157 - Object platformProject = file.getProject().getPlatformProject();
99.158 - if (platformProject instanceof NativeProject) {
99.159 - Lookup.Provider project = ((NativeProject) platformProject).getProject();
99.160 - if (project != null) {
99.161 - if (request.isCancelled()) {
99.162 - return;
99.163 - }
99.164 - Thread currentThread = Thread.currentThread();
99.165 - currentThread.setName("Provider " + getName() + " prosess " + file.getAbsolutePath()); // NOI18N
99.166 - RemoteProject info = project.getLookup().lookup(RemoteProject.class);
99.167 - if (info != null) {
99.168 - ExecutionEnvironment execEnv = info.getDevelopmentHost();
99.169 - if (execEnv != null) {
99.170 - if (request.isCancelled()) {
99.171 - return;
99.172 - }
99.173 - if (ConnectionManager.getInstance().isConnectedTo(execEnv)) {
99.174 - Item item = findItem(file, project);
99.175 - if (item != null) {
99.176 - if (request.isCancelled()) {
99.177 - return;
99.178 - }
99.179 - // Temporarily analyzing even excluded items
99.180 - if (/* !item.isExcluded() && */(item.getLanguage() == Language.C || item.getLanguage() == Language.CPP || item.getLanguage() == Language.C_HEADER)) {
99.181 - analyze(execEnv, item, project, request, response);
99.182 - }
99.183 - }
99.184 - }
99.185 - }
99.186 - }
99.187 - }
99.188 - }
99.189 - }
99.190 - }
99.191 -
99.192 - public void analyze(ExecutionEnvironment execEnv, Item item, Lookup.Provider project, CsmErrorProvider.Request request, CsmErrorProvider.Response response) {
99.193 - String binaryPath = ClangAnalyzerOptions.getClangAnalyzerPath();
99.194 - boolean isAnalyzer = response instanceof ModernizeAnalyzerImpl.ResponseImpl;
99.195 - if (binaryPath == null) {
99.196 - Level level = isAnalyzer ? Level.INFO : Level.FINE;
99.197 - LOG.log(level, "clang-tidy needs to be installed as a plugin"); //NOI18N
99.198 - return;
99.199 - }
99.200 -
99.201 - if (isAnalyzer && isNewRun()) {
99.202 - AnalyzedFiles.getDefault().clear();
99.203 - }
99.204 -
99.205 - DiagnosticsTool diagnosticsTool = new DiagnosticsTool(execEnv, item, (MakeProject) project, binaryPath);
99.206 - try {
99.207 - CsmFile csmFile = request.getFile();
99.208 - Collection<String> checks = /*isAnalyzer ? Collections.singleton("*") : */ getEnabledChecks(); //NOI18N
99.209 -
99.210 - Collection<CsmFile> tu = new ArrayList<CsmFile>();
99.211 - if (isAnalyzer) {
99.212 - tu.add(csmFile);
99.213 - } else {
99.214 - if (AnalyzedFiles.getDefault().isStartFile(csmFile)) {
99.215 - tu.add(csmFile);
99.216 - } else {
99.217 - tu.addAll(AnalyzedFiles.getDefault().getStartFiles(csmFile));
99.218 - }
99.219 - }
99.220 -
99.221 - if (!isAnalyzer) {
99.222 - response = new ResponseMerger(response);
99.223 - }
99.224 -
99.225 - for (CsmFile startFile : tu) {
99.226 - int exitCode = diagnosticsTool.process(checks, startFile, true);
99.227 - if (exitCode != DiagnosticsTool.STATUS_OK) {
99.228 - String error = NbBundle.getMessage(ModernizeErrorProvider.class, "compile.file.error"); //NOI18N
99.229 - String info = NbBundle.getMessage(ModernizeErrorProvider.class, "compile.file.error.info", "" + exitCode); //NOI18N
99.230 - fatalError(AnalyzerResponse.AnalyzerSeverity.FileError, "fatal.analyze.error", error + "\n" + info, csmFile, response); //NOI18N
99.231 - return;
99.232 - }
99.233 - List<YamlParser.Diagnostics> results = YamlParser.getDefault().parseYaml(diagnosticsTool.getYamlAsString());
99.234 - postProcess(isAnalyzer, startFile, project, results, request, response);
99.235 - }
99.236 -
99.237 - if (!isAnalyzer) {
99.238 - response.done();
99.239 - }
99.240 -
99.241 - } catch (ConnectionManager.CancellationException ex) {
99.242 - Exceptions.printStackTrace(ex);
99.243 - } catch (IOException ex) {
99.244 - Exceptions.printStackTrace(ex);
99.245 - }
99.246 - }
99.247 -
99.248 - private static CsmErrorProvider last;
99.249 -
99.250 - private boolean isNewRun() {
99.251 - if (last == null || this != last) {
99.252 - last = this;
99.253 - return true;
99.254 - }
99.255 - return false;
99.256 - }
99.257 -
99.258 - public void postProcess(boolean isAnalyzer, CsmFile startFile, Lookup.Provider project, List<YamlParser.Diagnostics> results, CsmErrorProvider.Request request, CsmErrorProvider.Response response) {
99.259 - CsmFile file = request.getFile();
99.260 - List<CsmFile> otherCsmFiles = new ArrayList<CsmFile>();
99.261 -
99.262 - for (YamlParser.Diagnostics diag : results) {
99.263 - // TODO: don't add "Configure Hint" fix multiple times for one line
99.264 - FileObject fo = FileUtil.toFileObject(new File(diag.getMessageFilePath()));
99.265 - CsmFile csmFile = CsmUtilities.getCsmFile(fo, false, false);
99.266 -
99.267 - // Composing a preview message. Showing a start file for compilation unit
99.268 - // in case we analysing a header file
99.269 - String message;
99.270 - if (startFile.equals(file) && csmFile.equals(file)) {
99.271 - message = String.format("[%s]: %s", diag.getCheckName(), diag.getMessage()); //NOI18N
99.272 - } else {
99.273 - message = String.format("[%s; %s]: %s", diag.getCheckName(), startFile.getName(), diag.getMessage()); //NOI18N
99.274 - }
99.275 -
99.276 - ModernizeErrorInfo info = new ModernizeErrorInfo(diag, message, project); //NOI18N
99.277 -
99.278 - if (isAnalyzer) {
99.279 - // Add found errors for all files (can be other files from compileUnit)
99.280 - ((ResponseImpl) response).addError(AnalyzerResponse.AnalyzerSeverity.DetectedError, null, fo, info);
99.281 -
99.282 - if (!csmFile.equals(file)) {
99.283 - // May be not header (e.g BBB.cc: AAA.cc -> (includes) BBB.cc -> ... )
99.284 - otherCsmFiles.add(csmFile);
99.285 - }
99.286 - } else if (fo.equals(file.getFileObject())) {
99.287 - // Add found errors only for file displayed in Editor
99.288 - response.addError(info);
99.289 - }
99.290 - }
99.291 -
99.292 - if (isAnalyzer /* and not empty? */) {
99.293 - AnalyzedFiles.getDefault().cacheHierarchy(file, otherCsmFiles);
99.294 - }
99.295 - }
99.296 -
99.297 - @ServiceProvider(path = CodeAuditFactory.REGISTRATION_PATH + ModernizeErrorProvider.NAME, service = CodeAuditFactory.class, position = 4000)
99.298 - public static final class Factory implements CodeAuditFactory {
99.299 -
99.300 - @Override
99.301 - public AbstractCodeAudit create(AuditPreferences preferences) {
99.302 - String id = NbBundle.getMessage(ModernizeCodeAudit.class, "LBL_ProviderName"); // NOI18N
99.303 - String description = NbBundle.getMessage(ModernizeCodeAudit.class, "LBL_ProviderDescription"); // NOI18N
99.304 - return new ModernizeCodeAudit(id, id, description, "error", false, preferences); // NOI18N
99.305 - }
99.306 - }
99.307 -
99.308 - private String oldPath;
99.309 -
99.310 - @Override
99.311 - public synchronized Collection<CodeAudit> getAudits() {
99.312 - String path = ClangAnalyzerOptions.getClangAnalyzerPath();
99.313 -
99.314 - if (path == null) {
99.315 - return Collections.emptyList();
99.316 - }
99.317 -
99.318 - if (oldPath == null) {
99.319 - oldPath = path;
99.320 - }
99.321 -
99.322 - if (audits == null || !oldPath.equals(path)) {
99.323 - List<CodeAudit> res = DiagnosticsTool.getAudits(path, ExecutionEnvironmentFactory.getLocal(), AnalyzerPreferences.getAuditPreferences());
99.324 -
99.325 - audits = res;
99.326 - oldPath = path;
99.327 - }
99.328 - return audits;
99.329 - }
99.330 -
99.331 - public Collection<String> getEnabledChecks() {
99.332 - Collection<CodeAudit> auditList = getAudits();
99.333 - List<String> enabled = new ArrayList<String>();
99.334 - for (CodeAudit codeAudit : auditList) {
99.335 - if (codeAudit.isEnabled()) {
99.336 - enabled.add(codeAudit.getID());
99.337 - }
99.338 - }
99.339 - return enabled.size() == auditList.size() ? Collections.singleton("*") : enabled; //NOI18N
99.340 - }
99.341 -
99.342 - @Override
99.343 - public AuditPreferences getPreferences() {
99.344 - return AnalyzerPreferences.getAuditPreferences();
99.345 - }
99.346 -
99.347 - @Override
99.348 - public JComponent createComponent(Preferences context) {
99.349 - return new JLabel();
99.350 - }
99.351 -
99.352 - public static interface ErrorInfoWithId {
99.353 -
99.354 - String getId();
99.355 - }
99.356 -
99.357 - public static final class FatalErrorInfo implements CsmErrorInfo, ErrorInfoWithId {
99.358 -
99.359 - private final String id;
99.360 - private final String message;
99.361 -
99.362 - public FatalErrorInfo(String id, String message) {
99.363 - this.id = id;
99.364 - this.message = message;
99.365 - }
99.366 -
99.367 - @Override
99.368 - public String getMessage() {
99.369 - return message;
99.370 - }
99.371 -
99.372 - @Override
99.373 - public Severity getSeverity() {
99.374 - return Severity.WARNING;
99.375 - }
99.376 -
99.377 - @Override
99.378 - public int getStartOffset() {
99.379 - return 0;
99.380 - }
99.381 -
99.382 - @Override
99.383 - public int getEndOffset() {
99.384 - return 1;
99.385 - }
99.386 -
99.387 - @Override
99.388 - public String getId() {
99.389 - return id;
99.390 - }
99.391 - }
99.392 -
99.393 - @ServiceProvider(service = CsmErrorInfoHintProvider.class, position = 9100)
99.394 - public final static class ModerinzeHintProvider extends CsmErrorInfoHintProvider {
99.395 -
99.396 - @Override
99.397 - protected List<Fix> doGetFixes(CsmErrorInfo info, List<Fix> alreadyFound) {
99.398 - if (info instanceof ModernizeErrorInfo) {
99.399 - alreadyFound.add(new ConfigureHintsFix((ModernizeErrorInfo) info));
99.400 - }
99.401 - return alreadyFound;
99.402 - }
99.403 - }
99.404 -
99.405 - @ServiceProvider(service = CsmErrorInfoHintProvider.class, position = 1600)
99.406 - public static final class ModernizeFixProvider extends CsmErrorInfoHintProvider {
99.407 -
99.408 - @Override
99.409 - protected List<Fix> doGetFixes(CsmErrorInfo info, List<Fix> alreadyFound) {
99.410 - alreadyFound.addAll(createFixes(info));
99.411 - return alreadyFound;
99.412 - }
99.413 - }
99.414 -
99.415 - private static List<? extends Fix> createFixes(CsmErrorInfo info) {
99.416 - if (info instanceof ModernizeErrorInfo) {
99.417 - ModernizeErrorInfo mei = (ModernizeErrorInfo) info;
99.418 - List<Replacement> replacements = mei.getDiagnostics().getReplacements();
99.419 - if (!replacements.isEmpty()) {
99.420 - return Collections.singletonList(new ModernizeFix(replacements, mei.getId()));
99.421 - }
99.422 - }
99.423 - return Collections.EMPTY_LIST;
99.424 - }
99.425 -}
100.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/ModernizeFix.java Sun Jun 25 18:17:37 2017 +0200
100.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
100.3 @@ -1,133 +0,0 @@
100.4 -/*
100.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
100.6 - *
100.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
100.8 - *
100.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
100.10 - * Other names may be trademarks of their respective owners.
100.11 - *
100.12 - * The contents of this file are subject to the terms of either the GNU
100.13 - * General Public License Version 2 only ("GPL") or the Common
100.14 - * Development and Distribution License("CDDL") (collectively, the
100.15 - * "License"). You may not use this file except in compliance with the
100.16 - * License. You can obtain a copy of the License at
100.17 - * http://www.netbeans.org/cddl-gplv2.html
100.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
100.19 - * specific language governing permissions and limitations under the
100.20 - * License. When distributing the software, include this License Header
100.21 - * Notice in each file and include the License file at
100.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
100.23 - * particular file as subject to the "Classpath" exception as provided
100.24 - * by Oracle in the GPL Version 2 section of the License file that
100.25 - * accompanied this code. If applicable, add the following below the
100.26 - * License Header, with the fields enclosed by brackets [] replaced by
100.27 - * your own identifying information:
100.28 - * "Portions Copyrighted [year] [name of copyright owner]"
100.29 - *
100.30 - * If you wish your version of this file to be governed by only the CDDL
100.31 - * or only the GPL Version 2, indicate your decision by adding
100.32 - * "[Contributor] elects to include this software in this distribution
100.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
100.34 - * single choice of license, a recipient has the option to distribute
100.35 - * your version of this file under either the CDDL, the GPL Version 2 or
100.36 - * to extend the choice of license to its licensees as provided above.
100.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
100.38 - * Version 2 license, then the option applies only if the new code is
100.39 - * made subject to such option by the copyright holder.
100.40 - *
100.41 - * Contributor(s): Ilia Gromov
100.42 - */
100.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
100.44 -
100.45 -import java.io.File;
100.46 -import java.util.List;
100.47 -import javax.swing.text.Document;
100.48 -import javax.swing.text.Position;
100.49 -import org.netbeans.editor.BaseDocument;
100.50 -import org.netbeans.modules.cnd.api.model.CsmFile;
100.51 -import org.netbeans.modules.cnd.modelutil.CsmUtilities;
100.52 -import org.netbeans.spi.editor.hints.ChangeInfo;
100.53 -import org.netbeans.spi.editor.hints.EnhancedFix;
100.54 -import org.openide.filesystems.FileObject;
100.55 -import org.openide.filesystems.FileUtil;
100.56 -import org.openide.text.CloneableEditorSupport;
100.57 -import org.openide.text.PositionRef;
100.58 -
100.59 -/**
100.60 - *
100.61 - * @author Ilia Gromov
100.62 - */
100.63 -public class ModernizeFix implements EnhancedFix {
100.64 -
100.65 - private final YamlParser.Replacement[] replacements;
100.66 - private final String text;
100.67 - private CloneableEditorSupport ces;
100.68 - private final PositionRef[] beg;
100.69 - private final PositionRef[] end;
100.70 -
100.71 - public ModernizeFix(List<YamlParser.Replacement> replacementList, String id) {
100.72 - this.beg = new PositionRef[replacementList.size()];
100.73 - this.end = new PositionRef[replacementList.size()];
100.74 - this.replacements = replacementList.toArray(new YamlParser.Replacement[replacementList.size()]);
100.75 - this.text = (id.startsWith("-")) ? id.substring(1) : id; //NOI18N
100.76 - for (int i = 0; i < replacements.length; i++) {
100.77 - YamlParser.Replacement replacement = replacements[i];
100.78 - FileObject fo = FileUtil.toFileObject(new File(replacement.filePath));
100.79 - CsmFile csmFile = CsmUtilities.getCsmFile(fo, false, false);
100.80 - if (csmFile != null) {
100.81 - ces = CsmUtilities.findCloneableEditorSupport(csmFile);
100.82 - if (ces != null) {
100.83 - beg[i] = ces.createPositionRef(replacement.offset, Position.Bias.Forward);
100.84 - end[i] = ces.createPositionRef(replacement.offset + replacement.length, Position.Bias.Backward);
100.85 - } else {
100.86 - }
100.87 - }
100.88 - }
100.89 - } //NOI18N
100.90 -
100.91 - @Override
100.92 - public String getText() {
100.93 - return "Apply replacement - " + text; //NOI18N
100.94 - }
100.95 -
100.96 - @Override
100.97 - public ChangeInfo implement() throws Exception {
100.98 - Document doc = CsmUtilities.openDocument(ces);
100.99 - if (doc instanceof BaseDocument) {
100.100 - Position min = beg[0];
100.101 - Position max = end[0];
100.102 - for (int i = 0; i < replacements.length; i++) {
100.103 - YamlParser.Replacement replacement = replacements[i];
100.104 - PositionRef b = beg[i];
100.105 - PositionRef e = end[i];
100.106 - if (b != null && e != null) {
100.107 - int newBeg = b.getOffset();
100.108 - int newLength = e.getOffset() - b.getOffset();
100.109 - if (b.getOffset() < min.getOffset()) {
100.110 - min = b;
100.111 - }
100.112 - if (e.getOffset() > max.getOffset()) {
100.113 - max = e;
100.114 - }
100.115 - if (newLength < 1) {
100.116 - // TODO: temp fix
100.117 - newLength = 0;
100.118 - }
100.119 - ((BaseDocument) doc).replace(newBeg, newLength, replacement.replacementText, null);
100.120 - }
100.121 - }
100.122 - return new ChangeInfo(min, max);
100.123 - }
100.124 - return null;
100.125 - }
100.126 -
100.127 - @Override
100.128 - public CharSequence getSortText() {
100.129 - return Integer.toString(Integer.MIN_VALUE);
100.130 - }
100.131 -
100.132 - public YamlParser.Replacement[] getReplacements() {
100.133 - return replacements;
100.134 - }
100.135 -
100.136 -}
101.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/ResponseMerger.java Sun Jun 25 18:17:37 2017 +0200
101.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
101.3 @@ -1,73 +0,0 @@
101.4 -/*
101.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
101.6 - *
101.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
101.8 - *
101.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
101.10 - * Other names may be trademarks of their respective owners.
101.11 - *
101.12 - * The contents of this file are subject to the terms of either the GNU
101.13 - * General Public License Version 2 only ("GPL") or the Common
101.14 - * Development and Distribution License("CDDL") (collectively, the
101.15 - * "License"). You may not use this file except in compliance with the
101.16 - * License. You can obtain a copy of the License at
101.17 - * http://www.netbeans.org/cddl-gplv2.html
101.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
101.19 - * specific language governing permissions and limitations under the
101.20 - * License. When distributing the software, include this License Header
101.21 - * Notice in each file and include the License file at
101.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
101.23 - * particular file as subject to the "Classpath" exception as provided
101.24 - * by Oracle in the GPL Version 2 section of the License file that
101.25 - * accompanied this code. If applicable, add the following below the
101.26 - * License Header, with the fields enclosed by brackets [] replaced by
101.27 - * your own identifying information:
101.28 - * "Portions Copyrighted [year] [name of copyright owner]"
101.29 - *
101.30 - * If you wish your version of this file to be governed by only the CDDL
101.31 - * or only the GPL Version 2, indicate your decision by adding
101.32 - * "[Contributor] elects to include this software in this distribution
101.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
101.34 - * single choice of license, a recipient has the option to distribute
101.35 - * your version of this file under either the CDDL, the GPL Version 2 or
101.36 - * to extend the choice of license to its licensees as provided above.
101.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
101.38 - * Version 2 license, then the option applies only if the new code is
101.39 - * made subject to such option by the copyright holder.
101.40 - *
101.41 - * Contributor(s): Ilia Gromov
101.42 - */
101.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
101.44 -
101.45 -import java.util.HashSet;
101.46 -import java.util.Set;
101.47 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
101.48 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
101.49 -
101.50 -/**
101.51 - *
101.52 - * @author Ilia Gromov
101.53 - */
101.54 -public class ResponseMerger implements CsmErrorProvider.Response {
101.55 -
101.56 - private final Set<CsmErrorInfo> bag = new HashSet<>();
101.57 - private final CsmErrorProvider.Response delegate;
101.58 -
101.59 - public ResponseMerger(CsmErrorProvider.Response delegate) {
101.60 - this.delegate = delegate;
101.61 - }
101.62 -
101.63 - @Override
101.64 - public void addError(CsmErrorInfo errorInfo) {
101.65 - bag.add(errorInfo);
101.66 - }
101.67 -
101.68 - @Override
101.69 - public void done() {
101.70 - for (CsmErrorInfo modernizeErrorInfo : bag) {
101.71 - delegate.addError(modernizeErrorInfo);
101.72 - }
101.73 - delegate.done();
101.74 - bag.clear();
101.75 - }
101.76 -}
102.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/YamlParser.java Sun Jun 25 18:17:37 2017 +0200
102.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
102.3 @@ -1,357 +0,0 @@
102.4 -/*
102.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
102.6 - *
102.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
102.8 - *
102.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
102.10 - * Other names may be trademarks of their respective owners.
102.11 - *
102.12 - * The contents of this file are subject to the terms of either the GNU
102.13 - * General Public License Version 2 only ("GPL") or the Common
102.14 - * Development and Distribution License("CDDL") (collectively, the
102.15 - * "License"). You may not use this file except in compliance with the
102.16 - * License. You can obtain a copy of the License at
102.17 - * http://www.netbeans.org/cddl-gplv2.html
102.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
102.19 - * specific language governing permissions and limitations under the
102.20 - * License. When distributing the software, include this License Header
102.21 - * Notice in each file and include the License file at
102.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
102.23 - * particular file as subject to the "Classpath" exception as provided
102.24 - * by Oracle in the GPL Version 2 section of the License file that
102.25 - * accompanied this code. If applicable, add the following below the
102.26 - * License Header, with the fields enclosed by brackets [] replaced by
102.27 - * your own identifying information:
102.28 - * "Portions Copyrighted [year] [name of copyright owner]"
102.29 - *
102.30 - * If you wish your version of this file to be governed by only the CDDL
102.31 - * or only the GPL Version 2, indicate your decision by adding
102.32 - * "[Contributor] elects to include this software in this distribution
102.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
102.34 - * single choice of license, a recipient has the option to distribute
102.35 - * your version of this file under either the CDDL, the GPL Version 2 or
102.36 - * to extend the choice of license to its licensees as provided above.
102.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
102.38 - * Version 2 license, then the option applies only if the new code is
102.39 - * made subject to such option by the copyright holder.
102.40 - *
102.41 - * Contributor(s): Ilia Gromov
102.42 - */
102.43 -package org.netbeans.modules.ide.analysis.modernize.impl;
102.44 -
102.45 -import static org.netbeans.modules.ide.analysis.modernize.impl.YamlParser.Diagnostics.UNDEFINED;
102.46 -import java.util.ArrayList;
102.47 -import java.util.Collections;
102.48 -import java.util.List;
102.49 -import java.util.StringTokenizer;
102.50 -import java.util.logging.Level;
102.51 -
102.52 -/**
102.53 - *
102.54 - * @author Ilia Gromov
102.55 - */
102.56 -public class YamlParser {
102.57 - // TODO check for no-replacements case
102.58 -
102.59 - private static final YamlParser INSTANCE = new YamlParser();
102.60 -
102.61 - public static YamlParser getDefault() {
102.62 - return INSTANCE;
102.63 - }
102.64 -
102.65 - private static final String OPEN_TAG = "---"; //NOI18N
102.66 - private static final String CLOSE_TAG = "..."; //NOI18N
102.67 -
102.68 - private static final String MAIN_SOURCE_FILE = "MainSourceFile"; //NOI18N
102.69 - private static final String CHECK_NAME = "CheckName"; //NOI18N
102.70 - private static final String LEVEL = "Level"; //NOI18N
102.71 - private static final String MESSAGE_FILE_PATH = "MessageFilePath"; //NOI18N
102.72 - private static final String MESSAGE_FILE_OFFSET = "MessageFileOffset"; //NOI18N
102.73 - private static final String MESSAGE = "Message"; //NOI18N
102.74 - private static final String REPLACEMENTS = "Replacements"; //NOI18N
102.75 - private static final String DIAGNOSTICS = "Diagnostics"; //NOI18N
102.76 -
102.77 - private static final String FILE_PATH = "FilePath"; //NOI18N
102.78 - private static final String OFFSET = "Offset"; //NOI18N
102.79 - private static final String LENGTH = "Length"; //NOI18N
102.80 - private static final String REPLACEMENT_TEXT = "ReplacementText"; //NOI18N
102.81 -
102.82 - // clang-modernize:
102.83 -// ---
102.84 -// MainSourceFile: /home/ilia/NetBeansProjects/CppApplication_46/main.cpp
102.85 -// Replacements:
102.86 -// - FilePath: /home/ilia/NetBeansProjects/CppApplication_46/newfile.h
102.87 -// Offset: 101
102.88 -// Length: 1
102.89 -// ReplacementText: nullptr
102.90 -// - FilePath: /home/ilia/NetBeansProjects/CppApplication_46/newfile1.h
102.91 -// Offset: 380
102.92 -// Length: 1
102.93 -// ReplacementText: nullptr
102.94 -// - FilePath: /home/ilia/NetBeansProjects/CppApplication_46/main.cpp
102.95 -// Offset: 152
102.96 -// Length: 1
102.97 -// ReplacementText: nullptr
102.98 -// ...
102.99 - // clang-tidy:
102.100 -// ---
102.101 -// MainSourceFile: ''
102.102 -// Diagnostics:
102.103 -// CheckName: misc-macro-parentheses
102.104 -// Replacements:
102.105 -// - FilePath: /media/SSD_/code/zdoom/main_1.cpp
102.106 -// Offset: 1352
102.107 -// Length: 0
102.108 -// ReplacementText: '('
102.109 -// - FilePath: /media/SSD_/code/zdoom/main_1.cpp
102.110 -// Offset: 1353
102.111 -// Length: 0
102.112 -// ReplacementText: ')'
102.113 -// Diagnostics:
102.114 -// CheckName: misc-macro-parentheses
102.115 -// Replacements:
102.116 -// - FilePath: /media/SSD_/code/zdoom/main_1.cpp
102.117 -// Offset: 1446
102.118 -// Length: 0
102.119 -// ReplacementText: '('
102.120 -// - FilePath: /media/SSD_/code/zdoom/main_1.cpp
102.121 -// Offset: 1447
102.122 -// Length: 0
102.123 -// ReplacementText: ')'
102.124 -// ...
102.125 - public List<Diagnostics> parseYaml(String output) {
102.126 - try {
102.127 - if (output.isEmpty()) {
102.128 - // No warnings in header = no 'Main Source File' element
102.129 - return Collections.EMPTY_LIST;
102.130 - }
102.131 - StringTokenizer st = new StringTokenizer(output, "\n"); //NOI18N
102.132 - String line;
102.133 -
102.134 - // ---
102.135 - line = st.nextToken();
102.136 -
102.137 - line = st.nextToken();
102.138 - String mainSourceFile = getValue(MAIN_SOURCE_FILE, line);
102.139 -
102.140 - // Replacements:
102.141 - line = st.nextToken();
102.142 - ClangTidyVersion version = line.contains(REPLACEMENTS)
102.143 - ? ClangTidyVersion.OLD_FORMAT
102.144 - : ClangTidyVersion.NEW_FORMAT;
102.145 -
102.146 - List<Diagnostics> list = version.parser.parse(st);
102.147 -
102.148 - return list;
102.149 - } catch (Exception ex) {
102.150 - ModernizeErrorProvider.LOG.log(Level.INFO, "Can't parse output line");
102.151 - return Collections.EMPTY_LIST;
102.152 - }
102.153 - }
102.154 -
102.155 - private static List<Replacement> parseReplacements(StringTokenizer st) {
102.156 - List<Replacement> replacements = new ArrayList<Replacement>();
102.157 - String line;
102.158 -
102.159 - // eat Replacements:
102.160 - line = st.nextToken();
102.161 -
102.162 - if (!line.contains(REPLACEMENTS)) {
102.163 - return replacements;
102.164 - }
102.165 -
102.166 - while (st.hasMoreTokens()) {
102.167 - line = st.nextToken();
102.168 -
102.169 - if (line.equals(CLOSE_TAG) || !line.contains(FILE_PATH)) {
102.170 - break;
102.171 - }
102.172 -
102.173 - String filePath = getValue(FILE_PATH, line);
102.174 -
102.175 - line = st.nextToken();
102.176 - int offset = Integer.parseInt(getValue(OFFSET, line));
102.177 -
102.178 - line = st.nextToken();
102.179 - int length = Integer.parseInt(getValue(LENGTH, line));
102.180 -
102.181 - line = st.nextToken();
102.182 - String replacementText = getValue(REPLACEMENT_TEXT, line);
102.183 - while (replacementText == null && st.hasMoreElements()) {
102.184 - line = line + "\n" + st.nextElement(); //NOI18N
102.185 - replacementText = getValue(REPLACEMENT_TEXT, line);
102.186 - }
102.187 -
102.188 - Replacement replacement = new Replacement(filePath, offset, length, replacementText);
102.189 - replacements.add(replacement);
102.190 -
102.191 - }
102.192 - return replacements;
102.193 - }
102.194 -
102.195 - private static String getValue(String key, String line) {
102.196 - int keyStart = line.indexOf(key);
102.197 - assert keyStart != -1;
102.198 - int keyEnd = keyStart + key.length() + 1;
102.199 - String trimmed = line.substring(keyEnd).trim();
102.200 - boolean isTextValue = trimmed.charAt(0) == '\'';
102.201 - if (isTextValue) {
102.202 - if (trimmed.length() == 1) {
102.203 - // '
102.204 - // abcd'
102.205 - return null;
102.206 - } else if (trimmed.charAt(trimmed.length() - 1) == '\'') {
102.207 - trimmed = trimmed.substring(1, trimmed.length() - 1);
102.208 - } else {
102.209 - return null;
102.210 - }
102.211 - }
102.212 - return trimmed;
102.213 - }
102.214 -
102.215 - public static class TranslationUnitDiagnostics {
102.216 -
102.217 - private final String mainSourceFilePath;
102.218 - private final String context;
102.219 - private final List<Diagnostics> diags;
102.220 -
102.221 - public TranslationUnitDiagnostics(String mainSourceFilePath, String context, List<Diagnostics> diags) {
102.222 - this.mainSourceFilePath = mainSourceFilePath;
102.223 - this.context = context;
102.224 - this.diags = diags;
102.225 - }
102.226 -
102.227 - public String getMainSourceFilePath() {
102.228 - return mainSourceFilePath;
102.229 - }
102.230 -
102.231 - public String getContext() {
102.232 - return context;
102.233 - }
102.234 -
102.235 - public List<Diagnostics> getDiags() {
102.236 - return diags;
102.237 - }
102.238 - }
102.239 -
102.240 - public static class Diagnostics {
102.241 -
102.242 - public static final String UNDEFINED = "undefined"; // NOI18N
102.243 -
102.244 - public enum Level {
102.245 - warning, error
102.246 - }
102.247 -
102.248 - private final String checkName;
102.249 - private final Diagnostics.Level level;
102.250 - private final String messageFilePath;
102.251 - private final int messageFileOffset;
102.252 - private final String message;
102.253 - private final List<Replacement> replacements;
102.254 -
102.255 - public Diagnostics(String checkName, Diagnostics.Level level, String messageFilePath, int messageFileOffset, String message, List<Replacement> replacements) {
102.256 - this.checkName = checkName;
102.257 - this.level = level;
102.258 - this.messageFilePath = messageFilePath;
102.259 - this.messageFileOffset = messageFileOffset;
102.260 - this.message = message;
102.261 - this.replacements = replacements;
102.262 - }
102.263 -
102.264 - public String getCheckName() {
102.265 - return checkName;
102.266 - }
102.267 -
102.268 - public Level getLevel() {
102.269 - return level;
102.270 - }
102.271 -
102.272 - public String getMessageFilePath() {
102.273 - return messageFilePath;
102.274 - }
102.275 -
102.276 - public int getMessageFileOffset() {
102.277 - return messageFileOffset;
102.278 - }
102.279 -
102.280 - public String getMessage() {
102.281 - return message;
102.282 - }
102.283 -
102.284 - public List<Replacement> getReplacements() {
102.285 - return replacements;
102.286 - }
102.287 - }
102.288 -
102.289 - public static class Replacement {
102.290 -
102.291 - public final String filePath;
102.292 - public final int offset;
102.293 - public final int length;
102.294 - public final String replacementText;
102.295 -
102.296 - public Replacement(String FilePath, int offset, int length, String replacementText) {
102.297 - this.filePath = FilePath;
102.298 - this.offset = offset;
102.299 - this.length = length;
102.300 - this.replacementText = replacementText;
102.301 - }
102.302 - }
102.303 -
102.304 - private static enum ClangTidyVersion {
102.305 - NEW_FORMAT(new NewFormatParser()),
102.306 - OLD_FORMAT(new OldFormatParser());
102.307 -
102.308 - public final TidyParser parser;
102.309 -
102.310 - private ClangTidyVersion(TidyParser parser) {
102.311 - this.parser = parser;
102.312 - }
102.313 - }
102.314 -
102.315 - private static abstract class TidyParser {
102.316 -
102.317 - abstract List<Diagnostics> parse(StringTokenizer st);
102.318 - }
102.319 -
102.320 - private static class NewFormatParser extends TidyParser {
102.321 -
102.322 - @Override
102.323 - public List<Diagnostics> parse(StringTokenizer st) {
102.324 - List<Diagnostics> list = new ArrayList<Diagnostics>();
102.325 -
102.326 - String line;
102.327 - while (st.hasMoreElements()) {
102.328 - line = st.nextToken();
102.329 - String checkName = getValue(CHECK_NAME, line);
102.330 -
102.331 - line = st.nextToken();
102.332 - Diagnostics.Level level = Diagnostics.Level.valueOf(getValue(LEVEL, line).toLowerCase());
102.333 -
102.334 - line = st.nextToken();
102.335 - String messageFilePath = getValue(MESSAGE_FILE_PATH, line);
102.336 -
102.337 - line = st.nextToken();
102.338 - int messageFileOffset = Integer.parseInt(getValue(MESSAGE_FILE_OFFSET, line));
102.339 -
102.340 - line = st.nextToken();
102.341 - String message = getValue(MESSAGE, line);
102.342 -
102.343 - List<Replacement> replacements = parseReplacements(st);
102.344 -
102.345 - list.add(new Diagnostics(checkName, level, messageFilePath, messageFileOffset, message, replacements));
102.346 - }
102.347 - return list;
102.348 - }
102.349 -
102.350 - }
102.351 -
102.352 - private static class OldFormatParser extends TidyParser {
102.353 -
102.354 - @Override
102.355 - public List<Diagnostics> parse(StringTokenizer st) {
102.356 - List<Replacement> parseReplacements = parseReplacements(st);
102.357 - return Collections.singletonList(new Diagnostics(UNDEFINED, Diagnostics.Level.warning, "", -1, "", parseReplacements)); //NOI18N
102.358 - }
102.359 - }
102.360 -}
103.1 Binary file ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/impl/bugs.png has changed
104.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/layer.xml Sun Jun 25 18:17:37 2017 +0200
104.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
104.3 @@ -1,75 +0,0 @@
104.4 -<?xml version="1.0" encoding="UTF-8"?>
104.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
104.6 -<filesystem>
104.7 - <folder name="Analysis">
104.8 - <folder name="Clang-Tidy">
104.9 - <folder name="Disabled_Default">
104.10 - <file name="misc-unused-parameters">
104.11 - <![CDATA[False positive activation]]>
104.12 - </file>
104.13 - <file name="misc-unused-parameters">
104.14 - <![CDATA[False positive activation]]>
104.15 - </file>
104.16 - <file name="google-runtime-int">
104.17 - <![CDATA[Too much warnings]]>
104.18 - </file>
104.19 - <file name="modernize-use-nullptr">
104.20 - <![CDATA[Too much warnings]]>
104.21 - </file>
104.22 - <file name="modernize-use-default">
104.23 - <![CDATA[Too much warnings]]>
104.24 - </file>
104.25 - <file name="google-runtime-references">
104.26 - <![CDATA[Too much warnings]]>
104.27 - </file>
104.28 - <file name="modernize-redundant-void-arg">
104.29 - <![CDATA[Too much warnings]]>
104.30 - </file>
104.31 - <file name="readability-implicit-bool-cast">
104.32 - <![CDATA[Too much warnings]]>
104.33 - </file>
104.34 - <file name="cppcoreguidelines-pro-bounds-pointer-arithmetic">
104.35 - <![CDATA[Too much warnings]]>
104.36 - </file>
104.37 - <file name="google-readability-casting">
104.38 - <![CDATA[Too much warnings]]>
104.39 - </file>
104.40 - <file name="misc-macro-parentheses">
104.41 - <![CDATA[Too much warnings]]>
104.42 - </file>
104.43 -
104.44 - <file name="google-readability-braces-around-statements">
104.45 - <![CDATA[Project-specific readability check]]>
104.46 - </file>
104.47 - <file name="readability-named-parameter">
104.48 - <![CDATA[Project-specific readability check]]>
104.49 - </file>
104.50 - <file name="llvm-header-guard">
104.51 - <![CDATA[Project-specific readability check]]>
104.52 - </file>
104.53 - <file name="google-readability-casting">
104.54 - <![CDATA[Project-specific readability check]]>
104.55 - </file>
104.56 - <file name="google-readability-namespace-comments">
104.57 - <![CDATA[Project-specific readability check]]>
104.58 - </file>
104.59 - <file name="readability-braces-around-statements">
104.60 - <![CDATA[Project-specific readability check]]>
104.61 - </file>
104.62 - <file name="llvm-include-order">
104.63 - <![CDATA[Project-specific readability check]]>
104.64 - </file>
104.65 - <file name="readability-else-after-return">
104.66 - <![CDATA[Project-specific readability check]]>
104.67 - </file>
104.68 - <file name="cppcoreguidelines-pro-type-union-access">
104.69 - <![CDATA[Requires specific library]]>
104.70 - </file>
104.71 - </folder>
104.72 - <folder name="Strict_Checks">
104.73 - <file name="readability-inconsistent-declaration-parameter-name"></file>
104.74 - <file name="misc-unused-using-decls"></file>
104.75 - </folder>
104.76 - </folder>
104.77 - </folder>
104.78 -</filesystem>
105.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/options/AnalyzerPreferences.java Sun Jun 25 18:17:37 2017 +0200
105.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
105.3 @@ -1,66 +0,0 @@
105.4 -/*
105.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
105.6 - *
105.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
105.8 - *
105.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
105.10 - * Other names may be trademarks of their respective owners.
105.11 - *
105.12 - * The contents of this file are subject to the terms of either the GNU
105.13 - * General Public License Version 2 only ("GPL") or the Common
105.14 - * Development and Distribution License("CDDL") (collectively, the
105.15 - * "License"). You may not use this file except in compliance with the
105.16 - * License. You can obtain a copy of the License at
105.17 - * http://www.netbeans.org/cddl-gplv2.html
105.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
105.19 - * specific language governing permissions and limitations under the
105.20 - * License. When distributing the software, include this License Header
105.21 - * Notice in each file and include the License file at
105.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
105.23 - * particular file as subject to the "Classpath" exception as provided
105.24 - * by Oracle in the GPL Version 2 section of the License file that
105.25 - * accompanied this code. If applicable, add the following below the
105.26 - * License Header, with the fields enclosed by brackets [] replaced by
105.27 - * your own identifying information:
105.28 - * "Portions Copyrighted [year] [name of copyright owner]"
105.29 - *
105.30 - * If you wish your version of this file to be governed by only the CDDL
105.31 - * or only the GPL Version 2, indicate your decision by adding
105.32 - * "[Contributor] elects to include this software in this distribution
105.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
105.34 - * single choice of license, a recipient has the option to distribute
105.35 - * your version of this file under either the CDDL, the GPL Version 2 or
105.36 - * to extend the choice of license to its licensees as provided above.
105.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
105.38 - * Version 2 license, then the option applies only if the new code is
105.39 - * made subject to such option by the copyright holder.
105.40 - *
105.41 - * Contributor(s): Ilia Gromov
105.42 - */
105.43 -
105.44 -package org.netbeans.modules.ide.analysis.modernize.options;
105.45 -
105.46 -import java.util.prefs.Preferences;
105.47 -import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
105.48 -
105.49 -/**
105.50 - *
105.51 - * @author Ilia Gromov
105.52 - */
105.53 -public class AnalyzerPreferences {
105.54 -
105.55 - private static final String NODE_NAME = "clang-tidy"; //NOI18N
105.56 -
105.57 - public static AuditPreferences getAuditPreferences() {
105.58 - return Holder.PREFS;
105.59 - }
105.60 -
105.61 - public static Preferences getPreferences() {
105.62 - return Holder.PREFS.getPreferences();
105.63 - }
105.64 -
105.65 - private static final class Holder {
105.66 -
105.67 - static final AuditPreferences PREFS = new AuditPreferences(AuditPreferences.AUDIT_PREFERENCES_ROOT.node(NODE_NAME));
105.68 - }
105.69 -}
106.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/options/Bundle.properties Sun Jun 25 18:17:37 2017 +0200
106.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
106.3 @@ -1,15 +0,0 @@
106.4 -PreviseOptions.confidenceLabel.text=&Confidence:
106.5 -
106.6 -SURE_CONFIDENCE=Sure
106.7 -HIGH_CONFIDENCE=High
106.8 -MEDIUM_CONFIDENCE=Medium
106.9 -LOW_CONFIDENCE=Low
106.10 -Parfait.tool.collection=
106.11 -ParfaitOptions.pathToParfait.notfound=Not Found
106.12 -ParfaitOptions.browse.text=...
106.13 -SELECT_TOOL_TITLE=Select Clang Binary Folder
106.14 -ParfaitOptions.connect.text=Connect to host {0}
106.15 -Parfait.tool.collection_1=clang-tidy
106.16 -ModernizeOptions.browseButton.text=...
106.17 -ModernizeOptions.jLabel2.text=build host
106.18 -ModernizeOptions.pathToAnalyzer.text=
107.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/options/ClangAnalyzerOptions.java Sun Jun 25 18:17:37 2017 +0200
107.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
107.3 @@ -1,167 +0,0 @@
107.4 -/*
107.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
107.6 - *
107.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
107.8 - *
107.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
107.10 - * Other names may be trademarks of their respective owners.
107.11 - *
107.12 - * The contents of this file are subject to the terms of either the GNU
107.13 - * General Public License Version 2 only ("GPL") or the Common
107.14 - * Development and Distribution License("CDDL") (collectively, the
107.15 - * "License"). You may not use this file except in compliance with the
107.16 - * License. You can obtain a copy of the License at
107.17 - * http://www.netbeans.org/cddl-gplv2.html
107.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
107.19 - * specific language governing permissions and limitations under the
107.20 - * License. When distributing the software, include this License Header
107.21 - * Notice in each file and include the License file at
107.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
107.23 - * particular file as subject to the "Classpath" exception as provided
107.24 - * by Oracle in the GPL Version 2 section of the License file that
107.25 - * accompanied this code. If applicable, add the following below the
107.26 - * License Header, with the fields enclosed by brackets [] replaced by
107.27 - * your own identifying information:
107.28 - * "Portions Copyrighted [year] [name of copyright owner]"
107.29 - *
107.30 - * If you wish your version of this file to be governed by only the CDDL
107.31 - * or only the GPL Version 2, indicate your decision by adding
107.32 - * "[Contributor] elects to include this software in this distribution
107.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
107.34 - * single choice of license, a recipient has the option to distribute
107.35 - * your version of this file under either the CDDL, the GPL Version 2 or
107.36 - * to extend the choice of license to its licensees as provided above.
107.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
107.38 - * Version 2 license, then the option applies only if the new code is
107.39 - * made subject to such option by the copyright holder.
107.40 - *
107.41 - * Contributor(s): Ilia Gromov
107.42 - */
107.43 -
107.44 -package org.netbeans.modules.ide.analysis.modernize.options;
107.45 -
107.46 -import java.io.File;
107.47 -import java.io.IOException;
107.48 -import java.util.Collections;
107.49 -import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
107.50 -import org.netbeans.modules.nativeexecution.api.HostInfo;
107.51 -import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
107.52 -import org.netbeans.modules.nativeexecution.api.util.HostInfoUtils;
107.53 -import org.openide.modules.InstalledFileLocator;
107.54 -
107.55 -/**
107.56 - *
107.57 - * @author Ilia Gromov
107.58 - */
107.59 -public class ClangAnalyzerOptions {
107.60 -
107.61 - public static final String CLANG_BINARY_NAME = "clang-tidy"; //NOI18N
107.62 - public static final String CLANG_BINARY_PATH = "clang-tidy-path"; //NOI18N
107.63 -
107.64 - private static String findInPaths() {
107.65 - String binaryName = CLANG_BINARY_NAME + "-" + getCodeBase(); //NOI18N
107.66 - String result = HostInfoUtils.searchFile(ExecutionEnvironmentFactory.getLocal(), Collections.<String>emptyList(), binaryName, true); // NOI18N
107.67 - return result;
107.68 - }
107.69 -
107.70 - public static String getClangAnalyzerPath() {
107.71 - String result = AnalyzerPreferences.getPreferences().get(CLANG_BINARY_PATH, ""); //NOI18N
107.72 - String oldValue = result;
107.73 - if (result.isEmpty()) {
107.74 - String toolPath = System.getProperty("devstudio.clangtidy.path"); //NOI18N
107.75 - if (toolPath != null) {
107.76 - result = toolPath;
107.77 - }
107.78 - }
107.79 - if (result.isEmpty()) {
107.80 - final String codeBase = getCodeBase();
107.81 - String relativePath = String.format("%s/%s-%s", CLANG_BINARY_NAME, CLANG_BINARY_NAME, codeBase); //NOI18N
107.82 - File toolFile = InstalledFileLocator.getDefault().locate(relativePath, codeBase, false);
107.83 - if (toolFile != null && toolFile.exists()) {
107.84 - result = toolFile.getAbsolutePath();
107.85 - }
107.86 - }
107.87 - if (result.isEmpty()) {
107.88 - String toolPath = findInPaths();
107.89 - if (toolPath != null) {
107.90 - result = toolPath;
107.91 - }
107.92 - }
107.93 - if (result.isEmpty()) {
107.94 - return null;
107.95 - } else {
107.96 - if (!oldValue.equals(result)) {
107.97 - AnalyzerPreferences.getPreferences().put(CLANG_BINARY_PATH, result);
107.98 - }
107.99 - }
107.100 - return result;
107.101 - }
107.102 -
107.103 - public static String getMissingModuleName() {
107.104 - return "com.oracle.tools.analysis.clangtidy." + getCodeBase(); //NOI18N
107.105 - }
107.106 -
107.107 - public static String getCodeBase() {
107.108 - HostInfo hostInfo = null;
107.109 - try {
107.110 - hostInfo = HostInfoUtils.getHostInfo(ExecutionEnvironmentFactory.getLocal());
107.111 - } catch (IOException ex) {
107.112 - ex.printStackTrace(System.err);
107.113 - } catch (ConnectionManager.CancellationException ex) {
107.114 - ex.printStackTrace(System.err);
107.115 - }
107.116 - String module = null;
107.117 - if (hostInfo != null) {
107.118 - switch (hostInfo.getOS().getFamily()) {
107.119 - case SUNOS:
107.120 - switch (hostInfo.getCpuFamily()) {
107.121 - case X86:
107.122 - switch (hostInfo.getOS().getBitness()) {
107.123 - case _32:
107.124 - module = "SunOS_x86"; // NOI18N
107.125 - break;
107.126 - case _64:
107.127 - module = "SunOS_x86_64"; // NOI18N
107.128 - break;
107.129 - }
107.130 - break;
107.131 - case SPARC:
107.132 - module = "SunOS_sparc"; // NOI18N
107.133 - break;
107.134 - }
107.135 - break;
107.136 - case LINUX:
107.137 - switch (hostInfo.getOS().getBitness()) {
107.138 - case _32:
107.139 - module = "Linux_x86"; // NOI18N
107.140 - break;
107.141 - case _64:
107.142 - module = "Linux_x86_64"; // NOI18N
107.143 - break;
107.144 - }
107.145 - break;
107.146 - case WINDOWS:
107.147 - switch (hostInfo.getOS().getBitness()) {
107.148 - case _32:
107.149 - module = "Windows_x86"; // NOI18N
107.150 - break;
107.151 - case _64:
107.152 - module = "Windows_x86_64"; // NOI18N
107.153 - break;
107.154 - }
107.155 - break;
107.156 - case MACOSX:
107.157 - switch (hostInfo.getOS().getBitness()) {
107.158 - case _32:
107.159 - module = "MacOSX_x86"; // NOI18N
107.160 - break;
107.161 - case _64:
107.162 - module = "MacOSX_x86_64"; // NOI18N
107.163 - break;
107.164 - }
107.165 - break;
107.166 - }
107.167 - }
107.168 - return module;
107.169 - }
107.170 -}
108.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/resources/Bundle.properties Sun Jun 25 18:17:37 2017 +0200
108.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
108.3 @@ -1,6 +0,0 @@
108.4 -fatals=fatal.unsupported.remote;fatal.tmp;fatal.analyze.error;fatal.language.flavor
108.5 -
108.6 -fatal.unsupported.remote= fatal: Unsupported remote mode
108.7 -fatal.tmp= fatal: Cannot create temporary file
108.8 -fatal.analyze.error= fatal: Unable to analyze file
108.9 -fatal.language.flavor= fatal: Clang-tidy can be used with C++11 or later standard only
108.10 \ No newline at end of file
109.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/resources/BundleUtilities.java Sun Jun 25 18:17:37 2017 +0200
109.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
109.3 @@ -1,61 +0,0 @@
109.4 -/*
109.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
109.6 - *
109.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
109.8 - *
109.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
109.10 - * Other names may be trademarks of their respective owners.
109.11 - *
109.12 - * The contents of this file are subject to the terms of either the GNU
109.13 - * General Public License Version 2 only ("GPL") or the Common
109.14 - * Development and Distribution License("CDDL") (collectively, the
109.15 - * "License"). You may not use this file except in compliance with the
109.16 - * License. You can obtain a copy of the License at
109.17 - * http://www.netbeans.org/cddl-gplv2.html
109.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
109.19 - * specific language governing permissions and limitations under the
109.20 - * License. When distributing the software, include this License Header
109.21 - * Notice in each file and include the License file at
109.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
109.23 - * particular file as subject to the "Classpath" exception as provided
109.24 - * by Oracle in the GPL Version 2 section of the License file that
109.25 - * accompanied this code. If applicable, add the following below the
109.26 - * License Header, with the fields enclosed by brackets [] replaced by
109.27 - * your own identifying information:
109.28 - * "Portions Copyrighted [year] [name of copyright owner]"
109.29 - *
109.30 - * If you wish your version of this file to be governed by only the CDDL
109.31 - * or only the GPL Version 2, indicate your decision by adding
109.32 - * "[Contributor] elects to include this software in this distribution
109.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
109.34 - * single choice of license, a recipient has the option to distribute
109.35 - * your version of this file under either the CDDL, the GPL Version 2 or
109.36 - * to extend the choice of license to its licensees as provided above.
109.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
109.38 - * Version 2 license, then the option applies only if the new code is
109.39 - * made subject to such option by the copyright holder.
109.40 - *
109.41 - * Contributor(s): Ilia Gromov
109.42 - */
109.43 -package org.netbeans.modules.ide.analysis.modernize.resources;
109.44 -
109.45 -import org.openide.util.NbBundle;
109.46 -
109.47 -/**
109.48 - *
109.49 - * @author Ilia Gromov
109.50 - */
109.51 -public class BundleUtilities {
109.52 -
109.53 - public static String[] getFlags() {
109.54 - return NbBundle.getMessage(BundleUtilities.class, "flags").split(";");
109.55 - }
109.56 -
109.57 - public static String getDescription(String key) {
109.58 - return NbBundle.getMessage(BundleUtilities.class, key);
109.59 - }
109.60 -
109.61 - public static String[] getFatalErrors() {
109.62 - return NbBundle.getMessage(BundleUtilities.class, "fatals").split(";");
109.63 - }
109.64 -}
110.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/tools-clang-tools-extra.patch Sun Jun 25 18:17:37 2017 +0200
110.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
110.3 @@ -1,139 +0,0 @@
110.4 -Index: clang-tidy/ClangTidy.cpp
110.5 -===================================================================
110.6 ---- clang-tidy/ClangTidy.cpp (revision 278390)
110.7 -+++ clang-tidy/ClangTidy.cpp (working copy)
110.8 -@@ -35,6 +35,7 @@
110.9 - #include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
110.10 - #include "clang/Tooling/Refactoring.h"
110.11 - #include "clang/Tooling/ReplacementsYaml.h"
110.12 -+#include "clang/Tooling/DiagnosticsYaml.h"
110.13 - #include "clang/Tooling/Tooling.h"
110.14 - #include "llvm/Support/Process.h"
110.15 - #include "llvm/Support/Signals.h"
110.16 -@@ -509,13 +510,10 @@
110.17 -
110.18 - void exportReplacements(const std::vector<ClangTidyError> &Errors,
110.19 - raw_ostream &OS) {
110.20 -- tooling::TranslationUnitReplacements TUR;
110.21 -- for (const ClangTidyError &Error : Errors)
110.22 -- TUR.Replacements.insert(TUR.Replacements.end(), Error.Fix.begin(),
110.23 -- Error.Fix.end());
110.24 --
110.25 - yaml::Output YAML(OS);
110.26 -- YAML << TUR;
110.27 -+ TranslationUnitDiagnostics TUD;
110.28 -+ TUD.Diags.insert(TUD.Diags.end(), Errors.begin(), Errors.end());
110.29 -+ YAML << TUD;
110.30 - }
110.31 -
110.32 - } // namespace tidy
110.33 -Index: clang-tidy/ClangTidyDiagnosticConsumer.cpp
110.34 -===================================================================
110.35 ---- clang-tidy/ClangTidyDiagnosticConsumer.cpp (revision 278390)
110.36 -+++ clang-tidy/ClangTidyDiagnosticConsumer.cpp (working copy)
110.37 -@@ -102,25 +102,6 @@
110.38 - };
110.39 - } // end anonymous namespace
110.40 -
110.41 --ClangTidyMessage::ClangTidyMessage(StringRef Message)
110.42 -- : Message(Message), FileOffset(0) {}
110.43 --
110.44 --ClangTidyMessage::ClangTidyMessage(StringRef Message,
110.45 -- const SourceManager &Sources,
110.46 -- SourceLocation Loc)
110.47 -- : Message(Message) {
110.48 -- assert(Loc.isValid() && Loc.isFileID());
110.49 -- FilePath = Sources.getFilename(Loc);
110.50 -- FileOffset = Sources.getFileOffset(Loc);
110.51 --}
110.52 --
110.53 --ClangTidyError::ClangTidyError(StringRef CheckName,
110.54 -- ClangTidyError::Level DiagLevel,
110.55 -- bool IsWarningAsError,
110.56 -- StringRef BuildDirectory)
110.57 -- : CheckName(CheckName), BuildDirectory(BuildDirectory), DiagLevel(DiagLevel),
110.58 -- IsWarningAsError(IsWarningAsError) {}
110.59 --
110.60 - // Returns true if GlobList starts with the negative indicator ('-'), removes it
110.61 - // from the GlobList.
110.62 - static bool ConsumeNegativeIndicator(StringRef &GlobList) {
110.63 -Index: clang-tidy/ClangTidyDiagnosticConsumer.h
110.64 -===================================================================
110.65 ---- clang-tidy/ClangTidyDiagnosticConsumer.h (revision 278390)
110.66 -+++ clang-tidy/ClangTidyDiagnosticConsumer.h (working copy)
110.67 -@@ -14,6 +14,7 @@
110.68 - #include "clang/Basic/Diagnostic.h"
110.69 - #include "clang/Basic/SourceManager.h"
110.70 - #include "clang/Tooling/Refactoring.h"
110.71 -+#include "clang/Tooling/Core/Diagnostics.h"
110.72 - #include "llvm/ADT/DenseMap.h"
110.73 - #include "llvm/ADT/StringMap.h"
110.74 - #include "llvm/Support/Regex.h"
110.75 -@@ -32,52 +33,9 @@
110.76 -
110.77 - namespace tidy {
110.78 -
110.79 --/// \brief A message from a clang-tidy check.
110.80 --///
110.81 --/// Note that this is independent of a \c SourceManager.
110.82 --struct ClangTidyMessage {
110.83 -- ClangTidyMessage(StringRef Message = "");
110.84 -- ClangTidyMessage(StringRef Message, const SourceManager &Sources,
110.85 -- SourceLocation Loc);
110.86 -- std::string Message;
110.87 -- std::string FilePath;
110.88 -- unsigned FileOffset;
110.89 --};
110.90 -+typedef clang::tooling::DiagnosticsMessage ClangTidyMessage;
110.91 -+typedef clang::tooling::Diagnostics ClangTidyError;
110.92 -
110.93 --/// \brief A detected error complete with information to display diagnostic and
110.94 --/// automatic fix.
110.95 --///
110.96 --/// This is used as an intermediate format to transport Diagnostics without a
110.97 --/// dependency on a SourceManager.
110.98 --///
110.99 --/// FIXME: Make Diagnostics flexible enough to support this directly.
110.100 --struct ClangTidyError {
110.101 -- enum Level {
110.102 -- Warning = DiagnosticsEngine::Warning,
110.103 -- Error = DiagnosticsEngine::Error
110.104 -- };
110.105 --
110.106 -- ClangTidyError(StringRef CheckName, Level DiagLevel, bool IsWarningAsError,
110.107 -- StringRef BuildDirectory);
110.108 --
110.109 -- std::string CheckName;
110.110 -- ClangTidyMessage Message;
110.111 -- tooling::Replacements Fix;
110.112 -- SmallVector<ClangTidyMessage, 1> Notes;
110.113 --
110.114 -- // A build directory of the diagnostic source file.
110.115 -- //
110.116 -- // It's an absolute path which is `directory` field of the source file in
110.117 -- // compilation database. If users don't specify the compilation database
110.118 -- // directory, it is the current directory where clang-tidy runs.
110.119 -- //
110.120 -- // Note: it is empty in unittest.
110.121 -- std::string BuildDirectory;
110.122 --
110.123 -- Level DiagLevel;
110.124 -- bool IsWarningAsError;
110.125 --};
110.126 --
110.127 - /// \brief Read-only set of strings represented as a list of positive and
110.128 - /// negative globs. Positive globs add all matched strings to the set, negative
110.129 - /// globs remove them in the order of appearance in the list.
110.130 -Index: clang-tidy/tool/ClangTidyMain.cpp
110.131 -===================================================================
110.132 ---- clang-tidy/tool/ClangTidyMain.cpp (revision 278390)
110.133 -+++ clang-tidy/tool/ClangTidyMain.cpp (working copy)
110.134 -@@ -389,7 +389,7 @@
110.135 -
110.136 - // -fix-errors implies -fix.
110.137 - handleErrors(Errors, (FixErrors || Fix) && !DisableFixes, WErrorCount);
110.138 --
110.139 -+
110.140 - if (!ExportFixes.empty() && !Errors.empty()) {
110.141 - std::error_code EC;
110.142 - llvm::raw_fd_ostream OS(ExportFixes, EC, llvm::sys::fs::F_None);
111.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/tools-clang.patch Sun Jun 25 18:17:37 2017 +0200
111.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
111.3 @@ -1,461 +0,0 @@
111.4 -Index: include/clang/Tooling/Core/Diagnostics.h
111.5 -===================================================================
111.6 ---- include/clang/Tooling/Core/Diagnostics.h (revision 278390)
111.7 -+++ include/clang/Tooling/Core/Diagnostics.h (working copy)
111.8 -@@ -1,254 +1,54 @@
111.9 --//===--- Replacement.h - Framework for clang refactoring tools --*- C++ -*-===//
111.10 --//
111.11 --// The LLVM Compiler Infrastructure
111.12 --//
111.13 --// This file is distributed under the University of Illinois Open Source
111.14 --// License. See LICENSE.TXT for details.
111.15 --//
111.16 --//===----------------------------------------------------------------------===//
111.17 --//
111.18 --// Classes supporting refactorings that span multiple translation units.
111.19 --// While single translation unit refactorings are supported via the Rewriter,
111.20 --// when refactoring multiple translation units changes must be stored in a
111.21 --// SourceManager independent form, duplicate changes need to be removed, and
111.22 --// all changes must be applied at once at the end of the refactoring so that
111.23 --// the code is always parseable.
111.24 --//
111.25 --//===----------------------------------------------------------------------===//
111.26 --
111.27 --#ifndef LLVM_CLANG_TOOLING_CORE_REPLACEMENT_H
111.28 --#define LLVM_CLANG_TOOLING_CORE_REPLACEMENT_H
111.29 --
111.30 --#include "clang/Basic/LangOptions.h"
111.31 --#include "clang/Basic/SourceLocation.h"
111.32 --#include "llvm/ADT/StringRef.h"
111.33 --#include "llvm/Support/Error.h"
111.34 --#include <map>
111.35 --#include <set>
111.36 -+#ifndef LLVM_CLANG_TOOLING_CORE_DIAGNOSTICS_H
111.37 -+#define LLVM_CLANG_TOOLING_CORE_DIAGNOSTICS_H
111.38 -+#include "clang/Basic/Diagnostic.h"
111.39 -+#include "llvm/ADT/SmallVector.h"
111.40 -+#include "Replacement.h"
111.41 - #include <string>
111.42 --#include <vector>
111.43 --
111.44 - namespace clang {
111.45 -+ namespace tooling {
111.46 -
111.47 --class Rewriter;
111.48 -+ struct DiagnosticsMessage {
111.49 -+ DiagnosticsMessage(StringRef Message = "");
111.50 -+ DiagnosticsMessage(StringRef Message, const SourceManager &Sources,
111.51 -+ SourceLocation Loc);
111.52 -+ std::string Message;
111.53 -+ std::string FilePath;
111.54 -+ unsigned FileOffset;
111.55 -+ };
111.56 -
111.57 --namespace tooling {
111.58 -+ struct Diagnostics {
111.59 -
111.60 --/// \brief A source range independent of the \c SourceManager.
111.61 --class Range {
111.62 --public:
111.63 -- Range() : Offset(0), Length(0) {}
111.64 -- Range(unsigned Offset, unsigned Length) : Offset(Offset), Length(Length) {}
111.65 -+ enum Level {
111.66 -+ Warning = DiagnosticsEngine::Warning,
111.67 -+ Error = DiagnosticsEngine::Error
111.68 -+ };
111.69 -
111.70 -- /// \brief Accessors.
111.71 -- /// @{
111.72 -- unsigned getOffset() const { return Offset; }
111.73 -- unsigned getLength() const { return Length; }
111.74 -- /// @}
111.75 -+ Diagnostics();
111.76 -+ Diagnostics(StringRef CheckName, Level DiagLevel, bool IsWarningAsError,
111.77 -+ StringRef BuildDirectory);
111.78 -+ std::string CheckName;
111.79 -+ DiagnosticsMessage Message;
111.80 -+ tooling::Replacements Fix;
111.81 -+ SmallVector<DiagnosticsMessage, 1> Notes;
111.82 -
111.83 -- /// \name Range Predicates
111.84 -- /// @{
111.85 -- /// \brief Whether this range overlaps with \p RHS or not.
111.86 -- bool overlapsWith(Range RHS) const {
111.87 -- return Offset + Length > RHS.Offset && Offset < RHS.Offset + RHS.Length;
111.88 -- }
111.89 -+ // A build directory of the diagnostic source file.
111.90 -+ //
111.91 -+ // It's an absolute path which is `directory` field of the source file in
111.92 -+ // compilation database. If users don't specify the compilation database
111.93 -+ // directory, it is the current directory where clang-tidy runs.
111.94 -+ //
111.95 -+ // Note: it is empty in unittest.
111.96 -+ std::string BuildDirectory;
111.97 -
111.98 -- /// \brief Whether this range contains \p RHS or not.
111.99 -- bool contains(Range RHS) const {
111.100 -- return RHS.Offset >= Offset &&
111.101 -- (RHS.Offset + RHS.Length) <= (Offset + Length);
111.102 -- }
111.103 -+ Level DiagLevel;
111.104 -+ bool IsWarningAsError;
111.105 -+ };
111.106 -
111.107 -- /// \brief Whether this range equals to \p RHS or not.
111.108 -- bool operator==(const Range &RHS) const {
111.109 -- return Offset == RHS.getOffset() && Length == RHS.getLength();
111.110 -- }
111.111 -- /// @}
111.112 --
111.113 --private:
111.114 -- unsigned Offset;
111.115 -- unsigned Length;
111.116 --};
111.117 --
111.118 --/// \brief A text replacement.
111.119 --///
111.120 --/// Represents a SourceManager independent replacement of a range of text in a
111.121 --/// specific file.
111.122 --class Replacement {
111.123 --public:
111.124 -- /// \brief Creates an invalid (not applicable) replacement.
111.125 -- Replacement();
111.126 --
111.127 -- /// \brief Creates a replacement of the range [Offset, Offset+Length) in
111.128 -- /// FilePath with ReplacementText.
111.129 -- ///
111.130 -- /// \param FilePath A source file accessible via a SourceManager.
111.131 -- /// \param Offset The byte offset of the start of the range in the file.
111.132 -- /// \param Length The length of the range in bytes.
111.133 -- Replacement(StringRef FilePath, unsigned Offset, unsigned Length,
111.134 -- StringRef ReplacementText);
111.135 --
111.136 -- /// \brief Creates a Replacement of the range [Start, Start+Length) with
111.137 -- /// ReplacementText.
111.138 -- Replacement(const SourceManager &Sources, SourceLocation Start,
111.139 -- unsigned Length, StringRef ReplacementText);
111.140 --
111.141 -- /// \brief Creates a Replacement of the given range with ReplacementText.
111.142 -- Replacement(const SourceManager &Sources, const CharSourceRange &Range,
111.143 -- StringRef ReplacementText,
111.144 -- const LangOptions &LangOpts = LangOptions());
111.145 --
111.146 -- /// \brief Creates a Replacement of the node with ReplacementText.
111.147 -- template <typename Node>
111.148 -- Replacement(const SourceManager &Sources, const Node &NodeToReplace,
111.149 -- StringRef ReplacementText,
111.150 -- const LangOptions &LangOpts = LangOptions());
111.151 --
111.152 -- /// \brief Returns whether this replacement can be applied to a file.
111.153 -- ///
111.154 -- /// Only replacements that are in a valid file can be applied.
111.155 -- bool isApplicable() const;
111.156 --
111.157 -- /// \brief Accessors.
111.158 -- /// @{
111.159 -- StringRef getFilePath() const { return FilePath; }
111.160 -- unsigned getOffset() const { return ReplacementRange.getOffset(); }
111.161 -- unsigned getLength() const { return ReplacementRange.getLength(); }
111.162 -- StringRef getReplacementText() const { return ReplacementText; }
111.163 -- /// @}
111.164 --
111.165 -- /// \brief Applies the replacement on the Rewriter.
111.166 -- bool apply(Rewriter &Rewrite) const;
111.167 --
111.168 -- /// \brief Returns a human readable string representation.
111.169 -- std::string toString() const;
111.170 --
111.171 -- private:
111.172 -- void setFromSourceLocation(const SourceManager &Sources,
111.173 -- SourceLocation Start, unsigned Length,
111.174 -- StringRef ReplacementText);
111.175 -- void setFromSourceRange(const SourceManager &Sources,
111.176 -- const CharSourceRange &Range,
111.177 -- StringRef ReplacementText,
111.178 -- const LangOptions &LangOpts);
111.179 --
111.180 -- std::string FilePath;
111.181 -- Range ReplacementRange;
111.182 -- std::string ReplacementText;
111.183 --};
111.184 --
111.185 --/// \brief Less-than operator between two Replacements.
111.186 --bool operator<(const Replacement &LHS, const Replacement &RHS);
111.187 --
111.188 --/// \brief Equal-to operator between two Replacements.
111.189 --bool operator==(const Replacement &LHS, const Replacement &RHS);
111.190 --
111.191 --/// \brief A set of Replacements.
111.192 --/// FIXME: Change to a vector and deduplicate in the RefactoringTool.
111.193 --typedef std::set<Replacement> Replacements;
111.194 --
111.195 --/// \brief Apply all replacements in \p Replaces to the Rewriter \p Rewrite.
111.196 --///
111.197 --/// Replacement applications happen independently of the success of
111.198 --/// other applications.
111.199 --///
111.200 --/// \returns true if all replacements apply. false otherwise.
111.201 --bool applyAllReplacements(const Replacements &Replaces, Rewriter &Rewrite);
111.202 --
111.203 --/// \brief Apply all replacements in \p Replaces to the Rewriter \p Rewrite.
111.204 --///
111.205 --/// Replacement applications happen independently of the success of
111.206 --/// other applications.
111.207 --///
111.208 --/// \returns true if all replacements apply. false otherwise.
111.209 --bool applyAllReplacements(const std::vector<Replacement> &Replaces,
111.210 -- Rewriter &Rewrite);
111.211 --
111.212 --/// \brief Applies all replacements in \p Replaces to \p Code.
111.213 --///
111.214 --/// This completely ignores the path stored in each replacement. If all
111.215 --/// replacements are applied successfully, this returns the code with
111.216 --/// replacements applied; otherwise, an llvm::Error carrying llvm::StringError
111.217 --/// is returned (the Error message can be converted to string using
111.218 --/// `llvm::toString()` and 'std::error_code` in the `Error` should be ignored).
111.219 --llvm::Expected<std::string> applyAllReplacements(StringRef Code,
111.220 -- const Replacements &Replaces);
111.221 --
111.222 --/// \brief Calculates how a code \p Position is shifted when \p Replaces are
111.223 --/// applied.
111.224 --unsigned shiftedCodePosition(const Replacements& Replaces, unsigned Position);
111.225 --
111.226 --/// \brief Calculates how a code \p Position is shifted when \p Replaces are
111.227 --/// applied.
111.228 --///
111.229 --/// \pre Replaces[i].getOffset() <= Replaces[i+1].getOffset().
111.230 --unsigned shiftedCodePosition(const std::vector<Replacement> &Replaces,
111.231 -- unsigned Position);
111.232 --
111.233 --/// \brief Removes duplicate Replacements and reports if Replacements conflict
111.234 --/// with one another. All Replacements are assumed to be in the same file.
111.235 --///
111.236 --/// \post Replaces[i].getOffset() <= Replaces[i+1].getOffset().
111.237 --///
111.238 --/// This function sorts \p Replaces so that conflicts can be reported simply by
111.239 --/// offset into \p Replaces and number of elements in the conflict.
111.240 --void deduplicate(std::vector<Replacement> &Replaces,
111.241 -- std::vector<Range> &Conflicts);
111.242 --
111.243 --/// \brief Collection of Replacements generated from a single translation unit.
111.244 --struct TranslationUnitReplacements {
111.245 -- /// Name of the main source for the translation unit.
111.246 -- std::string MainSourceFile;
111.247 --
111.248 -- /// A freeform chunk of text to describe the context of the replacements.
111.249 -- /// Will be printed, for example, when detecting conflicts during replacement
111.250 -- /// deduplication.
111.251 -- std::string Context;
111.252 --
111.253 -- std::vector<Replacement> Replacements;
111.254 --};
111.255 --
111.256 --/// \brief Calculates the ranges in a single file that are affected by the
111.257 --/// Replacements. Overlapping ranges will be merged.
111.258 --///
111.259 --/// \pre Replacements must be for the same file.
111.260 --///
111.261 --/// \returns a non-overlapping and sorted ranges.
111.262 --std::vector<Range> calculateChangedRanges(const Replacements &Replaces);
111.263 --
111.264 --/// \brief Calculates the new ranges after \p Replaces are applied. These
111.265 --/// include both the original \p Ranges and the affected ranges of \p Replaces
111.266 --/// in the new code.
111.267 --///
111.268 --/// \pre Replacements must be for the same file.
111.269 --///
111.270 --/// \return The new ranges after \p Replaces are applied. The new ranges will be
111.271 --/// sorted and non-overlapping.
111.272 --std::vector<Range>
111.273 --calculateRangesAfterReplacements(const Replacements &Replaces,
111.274 -- const std::vector<Range> &Ranges);
111.275 --
111.276 --/// \brief Groups a random set of replacements by file path. Replacements
111.277 --/// related to the same file entry are put into the same vector.
111.278 --std::map<std::string, Replacements>
111.279 --groupReplacementsByFile(const Replacements &Replaces);
111.280 --
111.281 --/// \brief Merges two sets of replacements with the second set referring to the
111.282 --/// code after applying the first set. Within both 'First' and 'Second',
111.283 --/// replacements must not overlap.
111.284 --Replacements mergeReplacements(const Replacements &First,
111.285 -- const Replacements &Second);
111.286 --
111.287 --template <typename Node>
111.288 --Replacement::Replacement(const SourceManager &Sources,
111.289 -- const Node &NodeToReplace, StringRef ReplacementText,
111.290 -- const LangOptions &LangOpts) {
111.291 -- const CharSourceRange Range =
111.292 -- CharSourceRange::getTokenRange(NodeToReplace->getSourceRange());
111.293 -- setFromSourceRange(Sources, Range, ReplacementText, LangOpts);
111.294 -+ struct TranslationUnitDiagnostics {
111.295 -+ std::string MainSourceFile;
111.296 -+ std::string Context;
111.297 -+ std::vector<Diagnostics> Diags;
111.298 -+ };
111.299 -+ }
111.300 - }
111.301 --
111.302 --} // end namespace tooling
111.303 --} // end namespace clang
111.304 --
111.305 --#endif // LLVM_CLANG_TOOLING_CORE_REPLACEMENT_H
111.306 -+#endif
111.307 -\ No newline at end of file
111.308 -Index: lib/Tooling/Core/CMakeLists.txt
111.309 -===================================================================
111.310 ---- lib/Tooling/Core/CMakeLists.txt (revision 278390)
111.311 -+++ lib/Tooling/Core/CMakeLists.txt (working copy)
111.312 -@@ -3,6 +3,7 @@
111.313 - add_clang_library(clangToolingCore
111.314 - Lookup.cpp
111.315 - Replacement.cpp
111.316 -+ Diagnostics.cpp
111.317 - QualTypeNames.cpp
111.318 -
111.319 - LINK_LIBS
111.320 -Index: lib/Tooling/Core/Diagnostics.cpp
111.321 -===================================================================
111.322 ---- lib/Tooling/Core/Diagnostics.cpp (revision 278390)
111.323 -+++ lib/Tooling/Core/Diagnostics.cpp (working copy)
111.324 -@@ -1,113 +1,30 @@
111.325 --//===--- Lookup.cpp - Framework for clang refactoring tools ---------------===//
111.326 --//
111.327 --// The LLVM Compiler Infrastructure
111.328 --//
111.329 --// This file is distributed under the University of Illinois Open Source
111.330 --// License. See LICENSE.TXT for details.
111.331 --//
111.332 --//===----------------------------------------------------------------------===//
111.333 --//
111.334 --// This file defines helper methods for clang tools performing name lookup.
111.335 --//
111.336 --//===----------------------------------------------------------------------===//
111.337 -+#include "clang/Tooling/Core/Diagnostics.h"
111.338 -+#include "clang/Basic/SourceManager.h"
111.339 -+namespace clang {
111.340 -+ namespace tooling {
111.341 -
111.342 --#include "clang/Tooling/Core/Lookup.h"
111.343 --#include "clang/AST/Decl.h"
111.344 --using namespace clang;
111.345 --using namespace clang::tooling;
111.346 -+ DiagnosticsMessage::DiagnosticsMessage(StringRef Message)
111.347 -+ : Message(Message), FileOffset(0) {
111.348 -+ }
111.349 -
111.350 --static bool isInsideDifferentNamespaceWithSameName(const DeclContext *DeclA,
111.351 -- const DeclContext *DeclB) {
111.352 -- while (true) {
111.353 -- // Look past non-namespaces on DeclA.
111.354 -- while (DeclA && !isa<NamespaceDecl>(DeclA))
111.355 -- DeclA = DeclA->getParent();
111.356 -+ DiagnosticsMessage::DiagnosticsMessage(StringRef Message,
111.357 -+ const SourceManager &Sources,
111.358 -+ SourceLocation Loc)
111.359 -+ : Message(Message) {
111.360 -+ assert(Loc.isValid() && Loc.isFileID());
111.361 -+ FilePath = Sources.getFilename(Loc);
111.362 -+ FileOffset = Sources.getFileOffset(Loc);
111.363 -+ }
111.364 -
111.365 -- // Look past non-namespaces on DeclB.
111.366 -- while (DeclB && !isa<NamespaceDecl>(DeclB))
111.367 -- DeclB = DeclB->getParent();
111.368 -+ Diagnostics::Diagnostics() {
111.369 -+ }
111.370 -
111.371 -- // We hit the root, no namespace collision.
111.372 -- if (!DeclA || !DeclB)
111.373 -- return false;
111.374 --
111.375 -- // Literally the same namespace, not a collision.
111.376 -- if (DeclA == DeclB)
111.377 -- return false;
111.378 --
111.379 -- // Now check the names. If they match we have a different namespace with the
111.380 -- // same name.
111.381 -- if (cast<NamespaceDecl>(DeclA)->getDeclName() ==
111.382 -- cast<NamespaceDecl>(DeclB)->getDeclName())
111.383 -- return true;
111.384 --
111.385 -- DeclA = DeclA->getParent();
111.386 -- DeclB = DeclB->getParent();
111.387 -- }
111.388 --}
111.389 --
111.390 --static StringRef getBestNamespaceSubstr(const DeclContext *DeclA,
111.391 -- StringRef NewName,
111.392 -- bool HadLeadingColonColon) {
111.393 -- while (true) {
111.394 -- while (DeclA && !isa<NamespaceDecl>(DeclA))
111.395 -- DeclA = DeclA->getParent();
111.396 --
111.397 -- // Fully qualified it is! Leave :: in place if it's there already.
111.398 -- if (!DeclA)
111.399 -- return HadLeadingColonColon ? NewName : NewName.substr(2);
111.400 --
111.401 -- // Otherwise strip off redundant namespace qualifications from the new name.
111.402 -- // We use the fully qualified name of the namespace and remove that part
111.403 -- // from NewName if it has an identical prefix.
111.404 -- std::string NS =
111.405 -- "::" + cast<NamespaceDecl>(DeclA)->getQualifiedNameAsString() + "::";
111.406 -- if (NewName.startswith(NS))
111.407 -- return NewName.substr(NS.size());
111.408 --
111.409 -- // No match yet. Strip of a namespace from the end of the chain and try
111.410 -- // again. This allows to get optimal qualifications even if the old and new
111.411 -- // decl only share common namespaces at a higher level.
111.412 -- DeclA = DeclA->getParent();
111.413 -- }
111.414 --}
111.415 --
111.416 --/// Check if the name specifier begins with a written "::".
111.417 --static bool isFullyQualified(const NestedNameSpecifier *NNS) {
111.418 -- while (NNS) {
111.419 -- if (NNS->getKind() == NestedNameSpecifier::Global)
111.420 -- return true;
111.421 -- NNS = NNS->getPrefix();
111.422 -- }
111.423 -- return false;
111.424 --}
111.425 --
111.426 --std::string tooling::replaceNestedName(const NestedNameSpecifier *Use,
111.427 -- const DeclContext *UseContext,
111.428 -- const NamedDecl *FromDecl,
111.429 -- StringRef ReplacementString) {
111.430 -- assert(ReplacementString.startswith("::") &&
111.431 -- "Expected fully-qualified name!");
111.432 --
111.433 -- // We can do a raw name replacement when we are not inside the namespace for
111.434 -- // the original function and it is not in the global namespace. The
111.435 -- // assumption is that outside the original namespace we must have a using
111.436 -- // statement that makes this work out and that other parts of this refactor
111.437 -- // will automatically fix using statements to point to the new function
111.438 -- const bool class_name_only = !Use;
111.439 -- const bool in_global_namespace =
111.440 -- isa<TranslationUnitDecl>(FromDecl->getDeclContext());
111.441 -- if (class_name_only && !in_global_namespace &&
111.442 -- !isInsideDifferentNamespaceWithSameName(FromDecl->getDeclContext(),
111.443 -- UseContext)) {
111.444 -- auto Pos = ReplacementString.rfind("::");
111.445 -- return Pos != StringRef::npos ? ReplacementString.substr(Pos + 2)
111.446 -- : ReplacementString;
111.447 -- }
111.448 -- // We did not match this because of a using statement, so we will need to
111.449 -- // figure out how good a namespace match we have with our destination type.
111.450 -- // We work backwards (from most specific possible namespace to least
111.451 -- // specific).
111.452 -- return getBestNamespaceSubstr(UseContext, ReplacementString,
111.453 -- isFullyQualified(Use));
111.454 --}
111.455 -+ Diagnostics::Diagnostics(StringRef CheckName,
111.456 -+ Diagnostics::Level DiagLevel,
111.457 -+ bool IsWarningAsError,
111.458 -+ StringRef BuildDirectory)
111.459 -+ : CheckName(CheckName), BuildDirectory(BuildDirectory), DiagLevel(DiagLevel),
111.460 -+ IsWarningAsError(IsWarningAsError) {
111.461 -+ }
111.462 -+ }
111.463 -+}
111.464 -\ No newline at end of file
112.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/utils/AnalyticsTools.java Sun Jun 25 18:17:37 2017 +0200
112.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
112.3 @@ -1,208 +0,0 @@
112.4 -/*
112.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
112.6 - *
112.7 - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
112.8 - *
112.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
112.10 - * Other names may be trademarks of their respective owners.
112.11 - *
112.12 - * The contents of this file are subject to the terms of either the GNU
112.13 - * General Public License Version 2 only ("GPL") or the Common
112.14 - * Development and Distribution License("CDDL") (collectively, the
112.15 - * "License"). You may not use this file except in compliance with the
112.16 - * License. You can obtain a copy of the License at
112.17 - * http://www.netbeans.org/cddl-gplv2.html
112.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
112.19 - * specific language governing permissions and limitations under the
112.20 - * License. When distributing the software, include this License Header
112.21 - * Notice in each file and include the License file at
112.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
112.23 - * particular file as subject to the "Classpath" exception as provided
112.24 - * by Oracle in the GPL Version 2 section of the License file that
112.25 - * accompanied this code. If applicable, add the following below the
112.26 - * License Header, with the fields enclosed by brackets [] replaced by
112.27 - * your own identifying information:
112.28 - * "Portions Copyrighted [year] [name of copyright owner]"
112.29 - *
112.30 - * If you wish your version of this file to be governed by only the CDDL
112.31 - * or only the GPL Version 2, indicate your decision by adding
112.32 - * "[Contributor] elects to include this software in this distribution
112.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
112.34 - * single choice of license, a recipient has the option to distribute
112.35 - * your version of this file under either the CDDL, the GPL Version 2 or
112.36 - * to extend the choice of license to its licensees as provided above.
112.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
112.38 - * Version 2 license, then the option applies only if the new code is
112.39 - * made subject to such option by the copyright holder.
112.40 - *
112.41 - * Contributor(s): Ilia Gromov
112.42 - */
112.43 -package org.netbeans.modules.ide.analysis.modernize.utils;
112.44 -
112.45 -import org.netbeans.modules.ide.analysis.modernize.impl.ModernizeErrorProvider;
112.46 -import java.util.ArrayList;
112.47 -import java.util.List;
112.48 -import org.netbeans.api.project.FileOwnerQuery;
112.49 -import org.netbeans.api.project.Project;
112.50 -import org.netbeans.modules.analysis.spi.Analyzer;
112.51 -import org.netbeans.modules.cnd.analysis.api.AnalyzerResponse;
112.52 -import org.netbeans.modules.cnd.api.model.CsmFile;
112.53 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
112.54 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
112.55 -import org.netbeans.modules.cnd.api.project.NativeFileItem;
112.56 -import org.netbeans.modules.cnd.api.remote.RemoteProject;
112.57 -import org.netbeans.modules.cnd.api.toolchain.CompilerSet;
112.58 -import org.netbeans.modules.cnd.api.toolchain.PredefinedToolKind;
112.59 -import org.netbeans.modules.cnd.api.toolchain.Tool;
112.60 -import org.netbeans.modules.cnd.makeproject.api.configurations.ConfigurationDescriptorProvider;
112.61 -import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
112.62 -import org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfigurationDescriptor;
112.63 -import org.netbeans.modules.cnd.spi.toolchain.ToolchainProject;
112.64 -import org.netbeans.modules.cnd.utils.MIMENames;
112.65 -import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
112.66 -import org.openide.filesystems.FileObject;
112.67 -import org.openide.util.Lookup;
112.68 -
112.69 -/**
112.70 - *
112.71 - * @author Ilia Gromov
112.72 - */
112.73 -public class AnalyticsTools {
112.74 -
112.75 - public static ExecutionEnvironment detectEnvironment(Analyzer.Context context) {
112.76 - if (context.getScope() == null) {
112.77 - return null;
112.78 - }
112.79 - for (FileObject fo : context.getScope().getFiles()) {
112.80 - String mimeType = fo.getMIMEType();
112.81 - if (MIMENames.isHeaderOrCppOrC(mimeType)) {
112.82 - Project project = FileOwnerQuery.getOwner(fo);
112.83 - RemoteProject info = project.getLookup().lookup(RemoteProject.class);
112.84 - if (info != null) {
112.85 - ExecutionEnvironment dh = info.getDevelopmentHost();
112.86 - if (dh != null) {
112.87 - return dh;
112.88 - }
112.89 - }
112.90 - }
112.91 - }
112.92 - return null;
112.93 - }
112.94 -
112.95 - public static CompilerSet toolchain(Lookup.Provider project) {
112.96 - ToolchainProject toolchain = project.getLookup().lookup(ToolchainProject.class);
112.97 - if (toolchain != null) {
112.98 - return toolchain.getCompilerSet();
112.99 - }
112.100 - return null;
112.101 - }
112.102 -
112.103 - public static MakeConfigurationDescriptor getConfigurationDescriptor(CsmFile file, Lookup.Provider project) {
112.104 - if (file != null) {
112.105 - ConfigurationDescriptorProvider pdp = project.getLookup().lookup(ConfigurationDescriptorProvider.class);
112.106 - if (pdp != null) {
112.107 - MakeConfigurationDescriptor makeConfigurationDescriptor = pdp.getConfigurationDescriptor();
112.108 - if (makeConfigurationDescriptor != null) {
112.109 - return makeConfigurationDescriptor;
112.110 - }
112.111 - }
112.112 - }
112.113 -
112.114 - return null;
112.115 - }
112.116 -
112.117 - public static Item findItem(CsmFile file, Lookup.Provider project) {
112.118 - return getConfigurationDescriptor(file, project).findProjectItemByPath(file.getAbsolutePath().toString());
112.119 - }
112.120 -
112.121 - public static void fatalError(AnalyzerResponse.AnalyzerSeverity severity, String id, String message, CsmFile file, CsmErrorProvider.Response response) {
112.122 - CsmErrorInfo fatal = new ModernizeErrorProvider.FatalErrorInfo(id, message);
112.123 - if (response instanceof AnalyzerResponse) {
112.124 - AnalyzerResponse ar = (AnalyzerResponse) response;
112.125 - ar.addError(severity, message, file.getFileObject(), fatal); //NOI18N
112.126 - } else {
112.127 - response.addError(fatal); //NOI18N
112.128 - }
112.129 - }
112.130 -
112.131 - public static String useTool(Item item, Lookup.Provider project) {
112.132 - ToolchainProject toolchain = project.getLookup().lookup(ToolchainProject.class);
112.133 - if (toolchain != null) {
112.134 - CompilerSet set = toolchain.getCompilerSet();
112.135 - if (set != null) {
112.136 - if (set.getCompilerFlavor().isSunStudioCompiler()) {
112.137 - if (item.getLanguage() == NativeFileItem.Language.C) {
112.138 - return set.findTool(PredefinedToolKind.CCompiler).getPath();
112.139 - } else {
112.140 - return set.findTool(PredefinedToolKind.CCCompiler).getPath();
112.141 - }
112.142 - }
112.143 - }
112.144 - }
112.145 - return null;
112.146 - }
112.147 -
112.148 - public static Tool compiler(Item item, Lookup.Provider project) {
112.149 - CompilerSet set = toolchain(project);
112.150 - if (set != null) {
112.151 - if (item.getLanguage() == NativeFileItem.Language.C) {
112.152 - return set.findTool(PredefinedToolKind.CCompiler);
112.153 - } else {
112.154 - return set.findTool(PredefinedToolKind.CCCompiler);
112.155 - }
112.156 - }
112.157 - return null;
112.158 - }
112.159 -
112.160 - public static List<String> scanCommandLine(String line) {
112.161 - List<String> res = new ArrayList<String>();
112.162 - int i = 0;
112.163 - StringBuilder current = new StringBuilder();
112.164 - boolean isSingleQuoteMode = false;
112.165 - boolean isDoubleQuoteMode = false;
112.166 - while (i < line.length()) {
112.167 - char c = line.charAt(i);
112.168 - i++;
112.169 - switch (c) {
112.170 - case '\'': // NOI18N
112.171 - if (isSingleQuoteMode) {
112.172 - isSingleQuoteMode = false;
112.173 - } else if (!isDoubleQuoteMode) {
112.174 - isSingleQuoteMode = true;
112.175 - }
112.176 - current.append(c);
112.177 - break;
112.178 - case '\"': // NOI18N
112.179 - if (isDoubleQuoteMode) {
112.180 - isDoubleQuoteMode = false;
112.181 - } else if (!isSingleQuoteMode) {
112.182 - isDoubleQuoteMode = true;
112.183 - }
112.184 - current.append(c);
112.185 - break;
112.186 - case ' ': // NOI18N
112.187 - case '\t': // NOI18N
112.188 - case '\n': // NOI18N
112.189 - case '\r': // NOI18N
112.190 - if (isSingleQuoteMode || isDoubleQuoteMode) {
112.191 - current.append(c);
112.192 - break;
112.193 - } else {
112.194 - if (current.length() > 0) {
112.195 - res.add(current.toString());
112.196 - current.setLength(0);
112.197 - }
112.198 - }
112.199 - break;
112.200 - default:
112.201 - current.append(c);
112.202 - break;
112.203 - }
112.204 - }
112.205 - if (current.length() > 0) {
112.206 - res.add(current.toString());
112.207 - }
112.208 - return res;
112.209 - }
112.210 -
112.211 -}
113.1 --- a/ide.analysis.modernize/test/unit/data/clang-tidy-3.9-README.txt Sun Jun 25 18:17:37 2017 +0200
113.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
113.3 @@ -1,2 +0,0 @@
113.4 -File clang-tidy-3.9p should be placed in this directory before testing.
113.5 -(Won't commit large, ~25Mb binary file to Mercurial repo).
113.6 \ No newline at end of file
114.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/HeaderTest/project-with-headers/CMakeLists.txt Sun Jun 25 18:17:37 2017 +0200
114.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
114.3 @@ -1,2 +0,0 @@
114.4 -project (HelloCMake CXX)
114.5 -add_subdirectory (src)
115.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/HeaderTest/project-with-headers/nbproject/configurations.xml Sun Jun 25 18:17:37 2017 +0200
115.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
115.3 @@ -1,128 +0,0 @@
115.4 -<?xml version="1.0" encoding="UTF-8"?>
115.5 -<!--
115.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
115.7 -
115.8 -Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
115.9 -
115.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
115.11 -Other names may be trademarks of their respective owners.
115.12 -
115.13 -The contents of this file are subject to the terms of either the GNU
115.14 -General Public License Version 2 only ("GPL") or the Common
115.15 -Development and Distribution License("CDDL") (collectively, the
115.16 -"License"). You may not use this file except in compliance with the
115.17 -License. You can obtain a copy of the License at
115.18 -http://www.netbeans.org/cddl-gplv2.html
115.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
115.20 -specific language governing permissions and limitations under the
115.21 -License. When distributing the software, include this License Header
115.22 -Notice in each file and include the License file at
115.23 -nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
115.24 -particular file as subject to the "Classpath" exception as provided
115.25 -by Oracle in the GPL Version 2 section of the License file that
115.26 -accompanied this code. If applicable, add the following below the
115.27 -License Header, with the fields enclosed by brackets [] replaced by
115.28 -your own identifying information:
115.29 -"Portions Copyrighted [year] [name of copyright owner]"
115.30 -
115.31 -If you wish your version of this file to be governed by only the CDDL
115.32 -or only the GPL Version 2, indicate your decision by adding
115.33 -"[Contributor] elects to include this software in this distribution
115.34 -under the [CDDL or GPL Version 2] license." If you do not indicate a
115.35 -single choice of license, a recipient has the option to distribute
115.36 -your version of this file under either the CDDL, the GPL Version 2 or
115.37 -to extend the choice of license to its licensees as provided above.
115.38 -However, if you add GPL Version 2 code and therefore, elected the GPL
115.39 -Version 2 license, then the option applies only if the new code is
115.40 -made subject to such option by the copyright holder.
115.41 -
115.42 -Contributor(s):
115.43 --->
115.44 -<configurationDescriptor version="100">
115.45 - <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
115.46 - <df root="." name="0">
115.47 - <df name="src">
115.48 - <in>llvm-header-guard.cpp</in>
115.49 - </df>
115.50 - </df>
115.51 - <logicalFolder name="ExternalFiles"
115.52 - displayName="Important Files"
115.53 - projectFiles="false"
115.54 - kind="IMPORTANT_FILES_FOLDER">
115.55 - <itemPath>CMakeLists.txt</itemPath>
115.56 - <itemPath>build/Debug/Makefile</itemPath>
115.57 - <itemPath>build/Release/Makefile</itemPath>
115.58 - </logicalFolder>
115.59 - </logicalFolder>
115.60 - <sourceFolderFilter>^(nbproject|build)$</sourceFolderFilter>
115.61 - <sourceRootList>
115.62 - <Elem>.</Elem>
115.63 - </sourceRootList>
115.64 - <projectmakefile>build/Debug/Makefile</projectmakefile>
115.65 - <confs>
115.66 - <conf name="Debug" type="0">
115.67 - <toolsSet>
115.68 - <compilerSet>default</compilerSet>
115.69 - <dependencyChecking>false</dependencyChecking>
115.70 - <rebuildPropChanged>false</rebuildPropChanged>
115.71 - </toolsSet>
115.72 - <flagsDictionary>
115.73 - <element flagsID="0" commonFlags="-std=gnu++11"/>
115.74 - </flagsDictionary>
115.75 - <codeAssistance>
115.76 - </codeAssistance>
115.77 - <makefileType>
115.78 - <makeTool>
115.79 - <buildCommandWorkingDir>build/Debug</buildCommandWorkingDir>
115.80 - <buildCommand>${MAKE} -f Makefile</buildCommand>
115.81 - <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
115.82 - <executablePath>build/Debug/src/welcome</executablePath>
115.83 - <ccTool flags="0">
115.84 - <incDir>
115.85 - <pElem>build/Debug/src</pElem>
115.86 - </incDir>
115.87 - </ccTool>
115.88 - </makeTool>
115.89 - <preBuild>
115.90 - <preBuildCommandWorkingDir>build/Debug</preBuildCommandWorkingDir>
115.91 - <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
115.92 - <preBuildFirst>true</preBuildFirst>
115.93 - </preBuild>
115.94 - </makefileType>
115.95 - <item path="src/llvm-header-guard.cpp" ex="false" tool="1" flavor2="8">
115.96 - <ccTool flags="0">
115.97 - </ccTool>
115.98 - </item>
115.99 - </conf>
115.100 - <conf name="Release" type="0">
115.101 - <toolsSet>
115.102 - <compilerSet>default</compilerSet>
115.103 - <dependencyChecking>false</dependencyChecking>
115.104 - <rebuildPropChanged>false</rebuildPropChanged>
115.105 - </toolsSet>
115.106 - <codeAssistance>
115.107 - </codeAssistance>
115.108 - <makefileType>
115.109 - <makeTool>
115.110 - <buildCommandWorkingDir>build/Release</buildCommandWorkingDir>
115.111 - <buildCommand>${MAKE} -f Makefile</buildCommand>
115.112 - <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
115.113 - <executablePath>build/Release/src/welcome</executablePath>
115.114 - <ccTool>
115.115 - <incDir>
115.116 - <pElem>build/Release/src</pElem>
115.117 - </incDir>
115.118 - <preprocessorList>
115.119 - <Elem>NDEBUG</Elem>
115.120 - </preprocessorList>
115.121 - </ccTool>
115.122 - </makeTool>
115.123 - <preBuild>
115.124 - <preBuildCommandWorkingDir>build/Release</preBuildCommandWorkingDir>
115.125 - <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
115.126 - <preBuildFirst>true</preBuildFirst>
115.127 - </preBuild>
115.128 - </makefileType>
115.129 - </conf>
115.130 - </confs>
115.131 -</configurationDescriptor>
116.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/HeaderTest/project-with-headers/nbproject/project.xml Sun Jun 25 18:17:37 2017 +0200
116.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
116.3 @@ -1,72 +0,0 @@
116.4 -<?xml version="1.0" encoding="UTF-8"?>
116.5 -<!--
116.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
116.7 -
116.8 -Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
116.9 -
116.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
116.11 -Other names may be trademarks of their respective owners.
116.12 -
116.13 -The contents of this file are subject to the terms of either the GNU
116.14 -General Public License Version 2 only ("GPL") or the Common
116.15 -Development and Distribution License("CDDL") (collectively, the
116.16 -"License"). You may not use this file except in compliance with the
116.17 -License. You can obtain a copy of the License at
116.18 -http://www.netbeans.org/cddl-gplv2.html
116.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
116.20 -specific language governing permissions and limitations under the
116.21 -License. When distributing the software, include this License Header
116.22 -Notice in each file and include the License file at
116.23 -nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
116.24 -particular file as subject to the "Classpath" exception as provided
116.25 -by Oracle in the GPL Version 2 section of the License file that
116.26 -accompanied this code. If applicable, add the following below the
116.27 -License Header, with the fields enclosed by brackets [] replaced by
116.28 -your own identifying information:
116.29 -"Portions Copyrighted [year] [name of copyright owner]"
116.30 -
116.31 -If you wish your version of this file to be governed by only the CDDL
116.32 -or only the GPL Version 2, indicate your decision by adding
116.33 -"[Contributor] elects to include this software in this distribution
116.34 -under the [CDDL or GPL Version 2] license." If you do not indicate a
116.35 -single choice of license, a recipient has the option to distribute
116.36 -your version of this file under either the CDDL, the GPL Version 2 or
116.37 -to extend the choice of license to its licensees as provided above.
116.38 -However, if you add GPL Version 2 code and therefore, elected the GPL
116.39 -Version 2 license, then the option applies only if the new code is
116.40 -made subject to such option by the copyright holder.
116.41 -
116.42 -Contributor(s):
116.43 --->
116.44 -<project xmlns="http://www.netbeans.org/ns/project/1">
116.45 - <type>org.netbeans.modules.cnd.makeproject</type>
116.46 - <configuration>
116.47 - <data xmlns="http://www.netbeans.org/ns/make-project/1">
116.48 - <name>hello-cmake-world</name>
116.49 - <c-extensions/>
116.50 - <cpp-extensions>cpp</cpp-extensions>
116.51 - <header-extensions>h</header-extensions>
116.52 - <sourceEncoding>UTF-8</sourceEncoding>
116.53 - <sourceRootList>
116.54 - <sourceRootElem>.</sourceRootElem>
116.55 - </sourceRootList>
116.56 - <make-dep-projects/>
116.57 - <sourceRootList>
116.58 - <sourceRootElem>.</sourceRootElem>
116.59 - </sourceRootList>
116.60 - <confList>
116.61 - <confElem>
116.62 - <name>Debug</name>
116.63 - <type>0</type>
116.64 - </confElem>
116.65 - <confElem>
116.66 - <name>Release</name>
116.67 - <type>0</type>
116.68 - </confElem>
116.69 - </confList>
116.70 - <formatting>
116.71 - <project-formatting-style>false</project-formatting-style>
116.72 - </formatting>
116.73 - </data>
116.74 - </configuration>
116.75 -</project>
117.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/HeaderTest/project-with-headers/src/CMakeLists.txt Sun Jun 25 18:17:37 2017 +0200
117.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
117.3 @@ -1,2 +0,0 @@
117.4 -set(CMAKE_CXX_STANDARD 11)
117.5 -add_library (headers llvm-header-guard.cpp)
118.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/HeaderTest/project-with-headers/src/llvm-header-guard.cpp Sun Jun 25 18:17:37 2017 +0200
118.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
118.3 @@ -1,1 +0,0 @@
118.4 -#include "llvm-header-guard.h"
118.5 \ No newline at end of file
119.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/CMakeLists.txt Sun Jun 25 18:17:37 2017 +0200
119.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
119.3 @@ -1,2 +0,0 @@
119.4 -project (HelloCMake)
119.5 -add_subdirectory (src)
120.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/nbproject/configurations.xml Sun Jun 25 18:17:37 2017 +0200
120.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
120.3 @@ -1,143 +0,0 @@
120.4 -<?xml version="1.0" encoding="UTF-8"?>
120.5 -<!--
120.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
120.7 -
120.8 -Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
120.9 -
120.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
120.11 -Other names may be trademarks of their respective owners.
120.12 -
120.13 -The contents of this file are subject to the terms of either the GNU
120.14 -General Public License Version 2 only ("GPL") or the Common
120.15 -Development and Distribution License("CDDL") (collectively, the
120.16 -"License"). You may not use this file except in compliance with the
120.17 -License. You can obtain a copy of the License at
120.18 -http://www.netbeans.org/cddl-gplv2.html
120.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
120.20 -specific language governing permissions and limitations under the
120.21 -License. When distributing the software, include this License Header
120.22 -Notice in each file and include the License file at
120.23 -nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
120.24 -particular file as subject to the "Classpath" exception as provided
120.25 -by Oracle in the GPL Version 2 section of the License file that
120.26 -accompanied this code. If applicable, add the following below the
120.27 -License Header, with the fields enclosed by brackets [] replaced by
120.28 -your own identifying information:
120.29 -"Portions Copyrighted [year] [name of copyright owner]"
120.30 -
120.31 -If you wish your version of this file to be governed by only the CDDL
120.32 -or only the GPL Version 2, indicate your decision by adding
120.33 -"[Contributor] elects to include this software in this distribution
120.34 -under the [CDDL or GPL Version 2] license." If you do not indicate a
120.35 -single choice of license, a recipient has the option to distribute
120.36 -your version of this file under either the CDDL, the GPL Version 2 or
120.37 -to extend the choice of license to its licensees as provided above.
120.38 -However, if you add GPL Version 2 code and therefore, elected the GPL
120.39 -Version 2 license, then the option applies only if the new code is
120.40 -made subject to such option by the copyright holder.
120.41 -
120.42 -Contributor(s):
120.43 --->
120.44 -<configurationDescriptor version="100">
120.45 - <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
120.46 - <df root="." name="0">
120.47 - <df name="src">
120.48 - <in>modernize-loop-convert.cpp</in>
120.49 - <in>modernize-raw-string-literal.cpp</in>
120.50 - <in>modernize-use-nullptr.cpp</in>
120.51 - </df>
120.52 - </df>
120.53 - <logicalFolder name="ExternalFiles"
120.54 - displayName="Important Files"
120.55 - projectFiles="false"
120.56 - kind="IMPORTANT_FILES_FOLDER">
120.57 - <itemPath>CMakeLists.txt</itemPath>
120.58 - <itemPath>build/Debug/Makefile</itemPath>
120.59 - <itemPath>build/Release/Makefile</itemPath>
120.60 - </logicalFolder>
120.61 - </logicalFolder>
120.62 - <sourceFolderFilter>^(nbproject|build)$</sourceFolderFilter>
120.63 - <sourceRootList>
120.64 - <Elem>.</Elem>
120.65 - </sourceRootList>
120.66 - <projectmakefile>build/Debug/Makefile</projectmakefile>
120.67 - <confs>
120.68 - <conf name="Debug" type="0">
120.69 - <toolsSet>
120.70 - <compilerSet>default</compilerSet>
120.71 - <dependencyChecking>false</dependencyChecking>
120.72 - <rebuildPropChanged>false</rebuildPropChanged>
120.73 - </toolsSet>
120.74 - <flagsDictionary>
120.75 - <element flagsID="0" commonFlags="-std=gnu++11"/>
120.76 - </flagsDictionary>
120.77 - <codeAssistance>
120.78 - </codeAssistance>
120.79 - <makefileType>
120.80 - <makeTool>
120.81 - <buildCommandWorkingDir>build/Debug</buildCommandWorkingDir>
120.82 - <buildCommand>${MAKE} -f Makefile</buildCommand>
120.83 - <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
120.84 - <executablePath>build/Debug/src/welcome</executablePath>
120.85 - <ccTool flags="0">
120.86 - <incDir>
120.87 - <pElem>build/Debug/src</pElem>
120.88 - </incDir>
120.89 - </ccTool>
120.90 - </makeTool>
120.91 - <preBuild>
120.92 - <preBuildCommandWorkingDir>build/Debug</preBuildCommandWorkingDir>
120.93 - <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
120.94 - <preBuildFirst>true</preBuildFirst>
120.95 - </preBuild>
120.96 - </makefileType>
120.97 - <item path="src/modernize-loop-convert.cpp" ex="false" tool="1" flavor2="8">
120.98 - <ccTool flags="0">
120.99 - </ccTool>
120.100 - </item>
120.101 - <item path="src/modernize-raw-string-literal.cpp"
120.102 - ex="false"
120.103 - tool="1"
120.104 - flavor2="8">
120.105 - <ccTool flags="0">
120.106 - </ccTool>
120.107 - </item>
120.108 - <item path="src/modernize-use-nullptr.cpp" ex="false" tool="1" flavor2="8">
120.109 - <ccTool flags="0">
120.110 - </ccTool>
120.111 - </item>
120.112 - </conf>
120.113 - <conf name="Release" type="0">
120.114 - <toolsSet>
120.115 - <compilerSet>default</compilerSet>
120.116 - <dependencyChecking>false</dependencyChecking>
120.117 - <rebuildPropChanged>false</rebuildPropChanged>
120.118 - </toolsSet>
120.119 - <codeAssistance>
120.120 - </codeAssistance>
120.121 - <makefileType>
120.122 - <makeTool>
120.123 - <buildCommandWorkingDir>build/Release</buildCommandWorkingDir>
120.124 - <buildCommand>${MAKE} -f Makefile</buildCommand>
120.125 - <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
120.126 - <executablePath>build/Release/src/welcome</executablePath>
120.127 - <ccTool>
120.128 - <incDir>
120.129 - <pElem>build/Release/src</pElem>
120.130 - </incDir>
120.131 - <preprocessorList>
120.132 - <Elem>NDEBUG</Elem>
120.133 - </preprocessorList>
120.134 - </ccTool>
120.135 - </makeTool>
120.136 - <preBuild>
120.137 - <preBuildCommandWorkingDir>build/Release</preBuildCommandWorkingDir>
120.138 - <preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../..</preBuildCommand>
120.139 - <preBuildFirst>true</preBuildFirst>
120.140 - </preBuild>
120.141 - </makefileType>
120.142 - <item path="src/modernize-use-nullptr.cpp" ex="false" tool="1" flavor2="0">
120.143 - </item>
120.144 - </conf>
120.145 - </confs>
120.146 -</configurationDescriptor>
121.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/nbproject/project.xml Sun Jun 25 18:17:37 2017 +0200
121.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
121.3 @@ -1,72 +0,0 @@
121.4 -<?xml version="1.0" encoding="UTF-8"?>
121.5 -<!--
121.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
121.7 -
121.8 -Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
121.9 -
121.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
121.11 -Other names may be trademarks of their respective owners.
121.12 -
121.13 -The contents of this file are subject to the terms of either the GNU
121.14 -General Public License Version 2 only ("GPL") or the Common
121.15 -Development and Distribution License("CDDL") (collectively, the
121.16 -"License"). You may not use this file except in compliance with the
121.17 -License. You can obtain a copy of the License at
121.18 -http://www.netbeans.org/cddl-gplv2.html
121.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
121.20 -specific language governing permissions and limitations under the
121.21 -License. When distributing the software, include this License Header
121.22 -Notice in each file and include the License file at
121.23 -nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
121.24 -particular file as subject to the "Classpath" exception as provided
121.25 -by Oracle in the GPL Version 2 section of the License file that
121.26 -accompanied this code. If applicable, add the following below the
121.27 -License Header, with the fields enclosed by brackets [] replaced by
121.28 -your own identifying information:
121.29 -"Portions Copyrighted [year] [name of copyright owner]"
121.30 -
121.31 -If you wish your version of this file to be governed by only the CDDL
121.32 -or only the GPL Version 2, indicate your decision by adding
121.33 -"[Contributor] elects to include this software in this distribution
121.34 -under the [CDDL or GPL Version 2] license." If you do not indicate a
121.35 -single choice of license, a recipient has the option to distribute
121.36 -your version of this file under either the CDDL, the GPL Version 2 or
121.37 -to extend the choice of license to its licensees as provided above.
121.38 -However, if you add GPL Version 2 code and therefore, elected the GPL
121.39 -Version 2 license, then the option applies only if the new code is
121.40 -made subject to such option by the copyright holder.
121.41 -
121.42 -Contributor(s):
121.43 --->
121.44 -<project xmlns="http://www.netbeans.org/ns/project/1">
121.45 - <type>org.netbeans.modules.cnd.makeproject</type>
121.46 - <configuration>
121.47 - <data xmlns="http://www.netbeans.org/ns/make-project/1">
121.48 - <name>hello-cmake-world</name>
121.49 - <c-extensions/>
121.50 - <cpp-extensions>cpp</cpp-extensions>
121.51 - <header-extensions>h</header-extensions>
121.52 - <sourceEncoding>UTF-8</sourceEncoding>
121.53 - <sourceRootList>
121.54 - <sourceRootElem>.</sourceRootElem>
121.55 - </sourceRootList>
121.56 - <make-dep-projects/>
121.57 - <sourceRootList>
121.58 - <sourceRootElem>.</sourceRootElem>
121.59 - </sourceRootList>
121.60 - <confList>
121.61 - <confElem>
121.62 - <name>Debug</name>
121.63 - <type>0</type>
121.64 - </confElem>
121.65 - <confElem>
121.66 - <name>Release</name>
121.67 - <type>0</type>
121.68 - </confElem>
121.69 - </confList>
121.70 - <formatting>
121.71 - <project-formatting-style>false</project-formatting-style>
121.72 - </formatting>
121.73 - </data>
121.74 - </configuration>
121.75 -</project>
122.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/CMakeLists.txt Sun Jun 25 18:17:37 2017 +0200
122.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
122.3 @@ -1,2 +0,0 @@
122.4 -set(CMAKE_CXX_STANDARD 11)
122.5 -add_library (single-cpp-file-check modernize-use-nullptr.cpp modernize-loop-convert.cpp modernize-raw-string-literal.cpp)
123.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/llvm-header-guard.cpp Sun Jun 25 18:17:37 2017 +0200
123.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
123.3 @@ -1,1 +0,0 @@
123.4 -#include "llvm-header-guard.h"
123.5 \ No newline at end of file
124.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/modernize-loop-convert.cpp Sun Jun 25 18:17:37 2017 +0200
124.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
124.3 @@ -1,25 +0,0 @@
124.4 -#include <vector>
124.5 -#include <iostream>
124.6 -
124.7 -using namespace std;
124.8 -
124.9 -int loops() {
124.10 - const int N = 5;
124.11 - int arr[] = {1, 2, 3, 4, 5};
124.12 - vector<int> v;
124.13 - v.push_back(1);
124.14 - v.push_back(2);
124.15 - v.push_back(3);
124.16 -
124.17 - // safe conversion
124.18 - for (int i = 0; i < N; ++i)
124.19 - cout << arr[i];
124.20 -
124.21 - // reasonable conversion
124.22 - for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)
124.23 - cout << *it;
124.24 -
124.25 - // reasonable conversion
124.26 - for (int i = 0; i < v.size(); ++i)
124.27 - cout << v[i];
124.28 -}
124.29 \ No newline at end of file
125.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/modernize-raw-string-literal.cpp Sun Jun 25 18:17:37 2017 +0200
125.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
125.3 @@ -1,8 +0,0 @@
125.4 -const char *const Quotes{"embedded \"quotes\""};
125.5 -const char *const Paragraph{"Line one.\nLine two.\nLine three.\n"};
125.6 -const char *const SingleLine{"Single line.\n"};
125.7 -const char *const TrailingSpace{"Look here -> \n"};
125.8 -const char *const Tab{"One\tTwo\n"};
125.9 -const char *const Bell{"Hello!\a And welcome!"};
125.10 -const char *const Path{"C:\\Program Files\\Vendor\\Application.exe"};
125.11 -const char *const RegEx{"\\w\\([a-z]\\)"};
126.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/hello-cmake-world/src/modernize-use-nullptr.cpp Sun Jun 25 18:17:37 2017 +0200
126.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
126.3 @@ -1,11 +0,0 @@
126.4 -#include <cstddef>
126.5 -
126.6 -void assignment() {
126.7 - char *a = NULL;
126.8 - char *b = 0;
126.9 - char c = 0;
126.10 -}
126.11 -
126.12 -int *ret_ptr() {
126.13 - return 0;
126.14 -}
126.15 \ No newline at end of file
127.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/.dep.inc Sun Jun 25 18:17:37 2017 +0200
127.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
127.3 @@ -1,5 +0,0 @@
127.4 -# This code depends on make tool being used
127.5 -DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES} ${TESTOBJECTFILES}))
127.6 -ifneq (${DEPFILES},)
127.7 -include ${DEPFILES}
127.8 -endif
128.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/Makefile Sun Jun 25 18:17:37 2017 +0200
128.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
128.3 @@ -1,128 +0,0 @@
128.4 -#
128.5 -# There exist several targets which are by default empty and which can be
128.6 -# used for execution of your targets. These targets are usually executed
128.7 -# before and after some main targets. They are:
128.8 -#
128.9 -# .build-pre: called before 'build' target
128.10 -# .build-post: called after 'build' target
128.11 -# .clean-pre: called before 'clean' target
128.12 -# .clean-post: called after 'clean' target
128.13 -# .clobber-pre: called before 'clobber' target
128.14 -# .clobber-post: called after 'clobber' target
128.15 -# .all-pre: called before 'all' target
128.16 -# .all-post: called after 'all' target
128.17 -# .help-pre: called before 'help' target
128.18 -# .help-post: called after 'help' target
128.19 -#
128.20 -# Targets beginning with '.' are not intended to be called on their own.
128.21 -#
128.22 -# Main targets can be executed directly, and they are:
128.23 -#
128.24 -# build build a specific configuration
128.25 -# clean remove built files from a configuration
128.26 -# clobber remove all built files
128.27 -# all build all configurations
128.28 -# help print help mesage
128.29 -#
128.30 -# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
128.31 -# .help-impl are implemented in nbproject/makefile-impl.mk.
128.32 -#
128.33 -# Available make variables:
128.34 -#
128.35 -# CND_BASEDIR base directory for relative paths
128.36 -# CND_DISTDIR default top distribution directory (build artifacts)
128.37 -# CND_BUILDDIR default top build directory (object files, ...)
128.38 -# CONF name of current configuration
128.39 -# CND_PLATFORM_${CONF} platform name (current configuration)
128.40 -# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
128.41 -# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
128.42 -# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
128.43 -# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
128.44 -# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
128.45 -# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
128.46 -#
128.47 -# NOCDDL
128.48 -
128.49 -
128.50 -# Environment
128.51 -MKDIR=mkdir
128.52 -CP=cp
128.53 -CCADMIN=CCadmin
128.54 -
128.55 -
128.56 -# build
128.57 -build: .build-post
128.58 -
128.59 -.build-pre:
128.60 -# Add your pre 'build' code here...
128.61 -
128.62 -.build-post: .build-impl
128.63 -# Add your post 'build' code here...
128.64 -
128.65 -
128.66 -# clean
128.67 -clean: .clean-post
128.68 -
128.69 -.clean-pre:
128.70 -# Add your pre 'clean' code here...
128.71 -
128.72 -.clean-post: .clean-impl
128.73 -# Add your post 'clean' code here...
128.74 -
128.75 -
128.76 -# clobber
128.77 -clobber: .clobber-post
128.78 -
128.79 -.clobber-pre:
128.80 -# Add your pre 'clobber' code here...
128.81 -
128.82 -.clobber-post: .clobber-impl
128.83 -# Add your post 'clobber' code here...
128.84 -
128.85 -
128.86 -# all
128.87 -all: .all-post
128.88 -
128.89 -.all-pre:
128.90 -# Add your pre 'all' code here...
128.91 -
128.92 -.all-post: .all-impl
128.93 -# Add your post 'all' code here...
128.94 -
128.95 -
128.96 -# build tests
128.97 -build-tests: .build-tests-post
128.98 -
128.99 -.build-tests-pre:
128.100 -# Add your pre 'build-tests' code here...
128.101 -
128.102 -.build-tests-post: .build-tests-impl
128.103 -# Add your post 'build-tests' code here...
128.104 -
128.105 -
128.106 -# run tests
128.107 -test: .test-post
128.108 -
128.109 -.test-pre: build-tests
128.110 -# Add your pre 'test' code here...
128.111 -
128.112 -.test-post: .test-impl
128.113 -# Add your post 'test' code here...
128.114 -
128.115 -
128.116 -# help
128.117 -help: .help-post
128.118 -
128.119 -.help-pre:
128.120 -# Add your pre 'help' code here...
128.121 -
128.122 -.help-post: .help-impl
128.123 -# Add your post 'help' code here...
128.124 -
128.125 -
128.126 -
128.127 -# include project implementation makefile
128.128 -include nbproject/Makefile-impl.mk
128.129 -
128.130 -# include project make variables
128.131 -include nbproject/Makefile-variables.mk
129.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/nbproject/Makefile-Debug.mk Sun Jun 25 18:17:37 2017 +0200
129.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
129.3 @@ -1,83 +0,0 @@
129.4 -#
129.5 -# Generated Makefile - do not edit!
129.6 -#
129.7 -# Edit the Makefile in the project folder instead (../Makefile). Each target
129.8 -# has a -pre and a -post target defined where you can add customized code.
129.9 -#
129.10 -# This makefile implements configuration specific macros and targets.
129.11 -
129.12 -
129.13 -# Environment
129.14 -MKDIR=mkdir
129.15 -CP=cp
129.16 -GREP=grep
129.17 -NM=nm
129.18 -CCADMIN=CCadmin
129.19 -RANLIB=ranlib
129.20 -CC=gcc
129.21 -CCC=g++
129.22 -CXX=g++
129.23 -FC=gfortran
129.24 -AS=as
129.25 -
129.26 -# Macros
129.27 -CND_PLATFORM=GNU-Linux
129.28 -CND_DLIB_EXT=so
129.29 -CND_CONF=Debug
129.30 -CND_DISTDIR=dist
129.31 -CND_BUILDDIR=build
129.32 -
129.33 -# Include project Makefile
129.34 -include Makefile
129.35 -
129.36 -# Object Directory
129.37 -OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
129.38 -
129.39 -# Object Files
129.40 -OBJECTFILES= \
129.41 - ${OBJECTDIR}/welcome.o
129.42 -
129.43 -
129.44 -# C Compiler Flags
129.45 -CFLAGS=
129.46 -
129.47 -# CC Compiler Flags
129.48 -CCFLAGS=
129.49 -CXXFLAGS=
129.50 -
129.51 -# Fortran Compiler Flags
129.52 -FFLAGS=
129.53 -
129.54 -# Assembler Flags
129.55 -ASFLAGS=
129.56 -
129.57 -# Link Libraries and Options
129.58 -LDLIBSOPTIONS=
129.59 -
129.60 -# Build Targets
129.61 -.build-conf: ${BUILD_SUBPROJECTS}
129.62 - "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world
129.63 -
129.64 -${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world: ${OBJECTFILES}
129.65 - ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
129.66 - ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world ${OBJECTFILES} ${LDLIBSOPTIONS}
129.67 -
129.68 -${OBJECTDIR}/welcome.o: welcome.cc
129.69 - ${MKDIR} -p ${OBJECTDIR}
129.70 - ${RM} "$@.d"
129.71 - $(COMPILE.cc) -g -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/welcome.o welcome.cc
129.72 -
129.73 -# Subprojects
129.74 -.build-subprojects:
129.75 -
129.76 -# Clean Targets
129.77 -.clean-conf: ${CLEAN_SUBPROJECTS}
129.78 - ${RM} -r ${CND_BUILDDIR}/${CND_CONF}
129.79 -
129.80 -# Subprojects
129.81 -.clean-subprojects:
129.82 -
129.83 -# Enable dependency checking
129.84 -.dep.inc: .depcheck-impl
129.85 -
129.86 -include .dep.inc
130.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/nbproject/Makefile-Release.mk Sun Jun 25 18:17:37 2017 +0200
130.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
130.3 @@ -1,83 +0,0 @@
130.4 -#
130.5 -# Generated Makefile - do not edit!
130.6 -#
130.7 -# Edit the Makefile in the project folder instead (../Makefile). Each target
130.8 -# has a -pre and a -post target defined where you can add customized code.
130.9 -#
130.10 -# This makefile implements configuration specific macros and targets.
130.11 -
130.12 -
130.13 -# Environment
130.14 -MKDIR=mkdir
130.15 -CP=cp
130.16 -GREP=grep
130.17 -NM=nm
130.18 -CCADMIN=CCadmin
130.19 -RANLIB=ranlib
130.20 -CC=gcc
130.21 -CCC=g++
130.22 -CXX=g++
130.23 -FC=gfortran
130.24 -AS=as
130.25 -
130.26 -# Macros
130.27 -CND_PLATFORM=GNU-Linux
130.28 -CND_DLIB_EXT=so
130.29 -CND_CONF=Release
130.30 -CND_DISTDIR=dist
130.31 -CND_BUILDDIR=build
130.32 -
130.33 -# Include project Makefile
130.34 -include Makefile
130.35 -
130.36 -# Object Directory
130.37 -OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
130.38 -
130.39 -# Object Files
130.40 -OBJECTFILES= \
130.41 - ${OBJECTDIR}/welcome.o
130.42 -
130.43 -
130.44 -# C Compiler Flags
130.45 -CFLAGS=
130.46 -
130.47 -# CC Compiler Flags
130.48 -CCFLAGS=
130.49 -CXXFLAGS=
130.50 -
130.51 -# Fortran Compiler Flags
130.52 -FFLAGS=
130.53 -
130.54 -# Assembler Flags
130.55 -ASFLAGS=
130.56 -
130.57 -# Link Libraries and Options
130.58 -LDLIBSOPTIONS=
130.59 -
130.60 -# Build Targets
130.61 -.build-conf: ${BUILD_SUBPROJECTS}
130.62 - "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world
130.63 -
130.64 -${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world: ${OBJECTFILES}
130.65 - ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
130.66 - ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world ${OBJECTFILES} ${LDLIBSOPTIONS}
130.67 -
130.68 -${OBJECTDIR}/welcome.o: welcome.cc
130.69 - ${MKDIR} -p ${OBJECTDIR}
130.70 - ${RM} "$@.d"
130.71 - $(COMPILE.cc) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/welcome.o welcome.cc
130.72 -
130.73 -# Subprojects
130.74 -.build-subprojects:
130.75 -
130.76 -# Clean Targets
130.77 -.clean-conf: ${CLEAN_SUBPROJECTS}
130.78 - ${RM} -r ${CND_BUILDDIR}/${CND_CONF}
130.79 -
130.80 -# Subprojects
130.81 -.clean-subprojects:
130.82 -
130.83 -# Enable dependency checking
130.84 -.dep.inc: .depcheck-impl
130.85 -
130.86 -include .dep.inc
131.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/nbproject/Makefile-impl.mk Sun Jun 25 18:17:37 2017 +0200
131.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
131.3 @@ -1,133 +0,0 @@
131.4 -#
131.5 -# Generated Makefile - do not edit!
131.6 -#
131.7 -# Edit the Makefile in the project folder instead (../Makefile). Each target
131.8 -# has a pre- and a post- target defined where you can add customization code.
131.9 -#
131.10 -# This makefile implements macros and targets common to all configurations.
131.11 -#
131.12 -# NOCDDL
131.13 -
131.14 -
131.15 -# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
131.16 -# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
131.17 -# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
131.18 -# and .clean-reqprojects-conf unless SUB has the value 'no'
131.19 -SUB_no=NO
131.20 -SUBPROJECTS=${SUB_${SUB}}
131.21 -BUILD_SUBPROJECTS_=.build-subprojects
131.22 -BUILD_SUBPROJECTS_NO=
131.23 -BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
131.24 -CLEAN_SUBPROJECTS_=.clean-subprojects
131.25 -CLEAN_SUBPROJECTS_NO=
131.26 -CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
131.27 -
131.28 -
131.29 -# Project Name
131.30 -PROJECTNAME=hello-world
131.31 -
131.32 -# Active Configuration
131.33 -DEFAULTCONF=Debug
131.34 -CONF=${DEFAULTCONF}
131.35 -
131.36 -# All Configurations
131.37 -ALLCONFS=Debug Release
131.38 -
131.39 -
131.40 -# build
131.41 -.build-impl: .build-pre .validate-impl .depcheck-impl
131.42 - @#echo "=> Running $@... Configuration=$(CONF)"
131.43 - "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf
131.44 -
131.45 -
131.46 -# clean
131.47 -.clean-impl: .clean-pre .validate-impl .depcheck-impl
131.48 - @#echo "=> Running $@... Configuration=$(CONF)"
131.49 - "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf
131.50 -
131.51 -
131.52 -# clobber
131.53 -.clobber-impl: .clobber-pre .depcheck-impl
131.54 - @#echo "=> Running $@..."
131.55 - for CONF in ${ALLCONFS}; \
131.56 - do \
131.57 - "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
131.58 - done
131.59 -
131.60 -# all
131.61 -.all-impl: .all-pre .depcheck-impl
131.62 - @#echo "=> Running $@..."
131.63 - for CONF in ${ALLCONFS}; \
131.64 - do \
131.65 - "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf; \
131.66 - done
131.67 -
131.68 -# build tests
131.69 -.build-tests-impl: .build-impl .build-tests-pre
131.70 - @#echo "=> Running $@... Configuration=$(CONF)"
131.71 - "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-tests-conf
131.72 -
131.73 -# run tests
131.74 -.test-impl: .build-tests-impl .test-pre
131.75 - @#echo "=> Running $@... Configuration=$(CONF)"
131.76 - "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .test-conf
131.77 -
131.78 -# dependency checking support
131.79 -.depcheck-impl:
131.80 - @echo "# This code depends on make tool being used" >.dep.inc
131.81 - @if [ -n "${MAKE_VERSION}" ]; then \
131.82 - echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES} \$${TESTOBJECTFILES}))" >>.dep.inc; \
131.83 - echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
131.84 - echo "include \$${DEPFILES}" >>.dep.inc; \
131.85 - echo "endif" >>.dep.inc; \
131.86 - else \
131.87 - echo ".KEEP_STATE:" >>.dep.inc; \
131.88 - echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
131.89 - fi
131.90 -
131.91 -# configuration validation
131.92 -.validate-impl:
131.93 - @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
131.94 - then \
131.95 - echo ""; \
131.96 - echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
131.97 - echo "See 'make help' for details."; \
131.98 - echo "Current directory: " `pwd`; \
131.99 - echo ""; \
131.100 - fi
131.101 - @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
131.102 - then \
131.103 - exit 1; \
131.104 - fi
131.105 -
131.106 -
131.107 -# help
131.108 -.help-impl: .help-pre
131.109 - @echo "This makefile supports the following configurations:"
131.110 - @echo " ${ALLCONFS}"
131.111 - @echo ""
131.112 - @echo "and the following targets:"
131.113 - @echo " build (default target)"
131.114 - @echo " clean"
131.115 - @echo " clobber"
131.116 - @echo " all"
131.117 - @echo " help"
131.118 - @echo ""
131.119 - @echo "Makefile Usage:"
131.120 - @echo " make [CONF=<CONFIGURATION>] [SUB=no] build"
131.121 - @echo " make [CONF=<CONFIGURATION>] [SUB=no] clean"
131.122 - @echo " make [SUB=no] clobber"
131.123 - @echo " make [SUB=no] all"
131.124 - @echo " make help"
131.125 - @echo ""
131.126 - @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
131.127 - @echo " also build subprojects."
131.128 - @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
131.129 - @echo " also clean subprojects."
131.130 - @echo "Target 'clobber' will remove all built files from all configurations and,"
131.131 - @echo " unless 'SUB=no', also from subprojects."
131.132 - @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
131.133 - @echo " also build subprojects."
131.134 - @echo "Target 'help' prints this message."
131.135 - @echo ""
131.136 -
132.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/nbproject/Makefile-variables.mk Sun Jun 25 18:17:37 2017 +0200
132.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
132.3 @@ -1,35 +0,0 @@
132.4 -#
132.5 -# Generated - do not edit!
132.6 -#
132.7 -# NOCDDL
132.8 -#
132.9 -CND_BASEDIR=`pwd`
132.10 -CND_BUILDDIR=build
132.11 -CND_DISTDIR=dist
132.12 -# Debug configuration
132.13 -CND_PLATFORM_Debug=GNU-Linux
132.14 -CND_ARTIFACT_DIR_Debug=dist/Debug/GNU-Linux
132.15 -CND_ARTIFACT_NAME_Debug=hello-world
132.16 -CND_ARTIFACT_PATH_Debug=dist/Debug/GNU-Linux/hello-world
132.17 -CND_PACKAGE_DIR_Debug=dist/Debug/GNU-Linux/package
132.18 -CND_PACKAGE_NAME_Debug=hello-world.tar
132.19 -CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux/package/hello-world.tar
132.20 -# Release configuration
132.21 -CND_PLATFORM_Release=GNU-Linux
132.22 -CND_ARTIFACT_DIR_Release=dist/Release/GNU-Linux
132.23 -CND_ARTIFACT_NAME_Release=hello-world
132.24 -CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux/hello-world
132.25 -CND_PACKAGE_DIR_Release=dist/Release/GNU-Linux/package
132.26 -CND_PACKAGE_NAME_Release=hello-world.tar
132.27 -CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux/package/hello-world.tar
132.28 -#
132.29 -# include compiler specific variables
132.30 -#
132.31 -# dmake command
132.32 -ROOT:sh = test -f nbproject/private/Makefile-variables.mk || \
132.33 - (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk)
132.34 -#
132.35 -# gmake command
132.36 -.PHONY: $(shell test -f nbproject/private/Makefile-variables.mk || (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk))
132.37 -#
132.38 -include nbproject/private/Makefile-variables.mk
133.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/nbproject/Package-Debug.bash Sun Jun 25 18:17:37 2017 +0200
133.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
133.3 @@ -1,76 +0,0 @@
133.4 -#!/bin/bash -x
133.5 -
133.6 -#
133.7 -# Generated - do not edit!
133.8 -#
133.9 -
133.10 -# Macros
133.11 -TOP=`pwd`
133.12 -CND_PLATFORM=GNU-Linux
133.13 -CND_CONF=Debug
133.14 -CND_DISTDIR=dist
133.15 -CND_BUILDDIR=build
133.16 -CND_DLIB_EXT=so
133.17 -NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
133.18 -TMPDIRNAME=tmp-packaging
133.19 -OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world
133.20 -OUTPUT_BASENAME=hello-world
133.21 -PACKAGE_TOP_DIR=hello-world/
133.22 -
133.23 -# Functions
133.24 -function checkReturnCode
133.25 -{
133.26 - rc=$?
133.27 - if [ $rc != 0 ]
133.28 - then
133.29 - exit $rc
133.30 - fi
133.31 -}
133.32 -function makeDirectory
133.33 -# $1 directory path
133.34 -# $2 permission (optional)
133.35 -{
133.36 - mkdir -p "$1"
133.37 - checkReturnCode
133.38 - if [ "$2" != "" ]
133.39 - then
133.40 - chmod $2 "$1"
133.41 - checkReturnCode
133.42 - fi
133.43 -}
133.44 -function copyFileToTmpDir
133.45 -# $1 from-file path
133.46 -# $2 to-file path
133.47 -# $3 permission
133.48 -{
133.49 - cp "$1" "$2"
133.50 - checkReturnCode
133.51 - if [ "$3" != "" ]
133.52 - then
133.53 - chmod $3 "$2"
133.54 - checkReturnCode
133.55 - fi
133.56 -}
133.57 -
133.58 -# Setup
133.59 -cd "${TOP}"
133.60 -mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
133.61 -rm -rf ${NBTMPDIR}
133.62 -mkdir -p ${NBTMPDIR}
133.63 -
133.64 -# Copy files and create directories and links
133.65 -cd "${TOP}"
133.66 -makeDirectory "${NBTMPDIR}/hello-world/bin"
133.67 -copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
133.68 -
133.69 -
133.70 -# Generate tar file
133.71 -cd "${TOP}"
133.72 -rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/hello-world.tar
133.73 -cd ${NBTMPDIR}
133.74 -tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/hello-world.tar *
133.75 -checkReturnCode
133.76 -
133.77 -# Cleanup
133.78 -cd "${TOP}"
133.79 -rm -rf ${NBTMPDIR}
134.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/nbproject/Package-Release.bash Sun Jun 25 18:17:37 2017 +0200
134.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
134.3 @@ -1,76 +0,0 @@
134.4 -#!/bin/bash -x
134.5 -
134.6 -#
134.7 -# Generated - do not edit!
134.8 -#
134.9 -
134.10 -# Macros
134.11 -TOP=`pwd`
134.12 -CND_PLATFORM=GNU-Linux
134.13 -CND_CONF=Release
134.14 -CND_DISTDIR=dist
134.15 -CND_BUILDDIR=build
134.16 -CND_DLIB_EXT=so
134.17 -NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
134.18 -TMPDIRNAME=tmp-packaging
134.19 -OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello-world
134.20 -OUTPUT_BASENAME=hello-world
134.21 -PACKAGE_TOP_DIR=hello-world/
134.22 -
134.23 -# Functions
134.24 -function checkReturnCode
134.25 -{
134.26 - rc=$?
134.27 - if [ $rc != 0 ]
134.28 - then
134.29 - exit $rc
134.30 - fi
134.31 -}
134.32 -function makeDirectory
134.33 -# $1 directory path
134.34 -# $2 permission (optional)
134.35 -{
134.36 - mkdir -p "$1"
134.37 - checkReturnCode
134.38 - if [ "$2" != "" ]
134.39 - then
134.40 - chmod $2 "$1"
134.41 - checkReturnCode
134.42 - fi
134.43 -}
134.44 -function copyFileToTmpDir
134.45 -# $1 from-file path
134.46 -# $2 to-file path
134.47 -# $3 permission
134.48 -{
134.49 - cp "$1" "$2"
134.50 - checkReturnCode
134.51 - if [ "$3" != "" ]
134.52 - then
134.53 - chmod $3 "$2"
134.54 - checkReturnCode
134.55 - fi
134.56 -}
134.57 -
134.58 -# Setup
134.59 -cd "${TOP}"
134.60 -mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
134.61 -rm -rf ${NBTMPDIR}
134.62 -mkdir -p ${NBTMPDIR}
134.63 -
134.64 -# Copy files and create directories and links
134.65 -cd "${TOP}"
134.66 -makeDirectory "${NBTMPDIR}/hello-world/bin"
134.67 -copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
134.68 -
134.69 -
134.70 -# Generate tar file
134.71 -cd "${TOP}"
134.72 -rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/hello-world.tar
134.73 -cd ${NBTMPDIR}
134.74 -tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/hello-world.tar *
134.75 -checkReturnCode
134.76 -
134.77 -# Cleanup
134.78 -cd "${TOP}"
134.79 -rm -rf ${NBTMPDIR}
135.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/nbproject/configurations.xml Sun Jun 25 18:17:37 2017 +0200
135.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
135.3 @@ -1,71 +0,0 @@
135.4 -<?xml version="1.0" encoding="UTF-8"?>
135.5 -<configurationDescriptor version="100">
135.6 - <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
135.7 - <logicalFolder name="HeaderFiles"
135.8 - displayName="Header Files"
135.9 - projectFiles="true">
135.10 - <itemPath>welcome.h</itemPath>
135.11 - </logicalFolder>
135.12 - <logicalFolder name="ResourceFiles"
135.13 - displayName="Resource Files"
135.14 - projectFiles="true">
135.15 - </logicalFolder>
135.16 - <logicalFolder name="SourceFiles"
135.17 - displayName="Source Files"
135.18 - projectFiles="true">
135.19 - <itemPath>welcome.cc</itemPath>
135.20 - </logicalFolder>
135.21 - <logicalFolder name="TestFiles"
135.22 - displayName="Test Files"
135.23 - projectFiles="false"
135.24 - kind="TEST_LOGICAL_FOLDER">
135.25 - </logicalFolder>
135.26 - <logicalFolder name="ExternalFiles"
135.27 - displayName="Important Files"
135.28 - projectFiles="false"
135.29 - kind="IMPORTANT_FILES_FOLDER">
135.30 - <itemPath>Makefile</itemPath>
135.31 - </logicalFolder>
135.32 - </logicalFolder>
135.33 - <projectmakefile>Makefile</projectmakefile>
135.34 - <confs>
135.35 - <conf name="Debug" type="1">
135.36 - <toolsSet>
135.37 - <compilerSet>default</compilerSet>
135.38 - <dependencyChecking>true</dependencyChecking>
135.39 - <rebuildPropChanged>false</rebuildPropChanged>
135.40 - </toolsSet>
135.41 - <compileType>
135.42 - </compileType>
135.43 - <item path="welcome.cc" ex="false" tool="1" flavor2="0">
135.44 - </item>
135.45 - <item path="welcome.h" ex="false" tool="3" flavor2="0">
135.46 - </item>
135.47 - </conf>
135.48 - <conf name="Release" type="1">
135.49 - <toolsSet>
135.50 - <compilerSet>default</compilerSet>
135.51 - <dependencyChecking>true</dependencyChecking>
135.52 - <rebuildPropChanged>false</rebuildPropChanged>
135.53 - </toolsSet>
135.54 - <compileType>
135.55 - <cTool>
135.56 - <developmentMode>5</developmentMode>
135.57 - </cTool>
135.58 - <ccTool>
135.59 - <developmentMode>5</developmentMode>
135.60 - </ccTool>
135.61 - <fortranCompilerTool>
135.62 - <developmentMode>5</developmentMode>
135.63 - </fortranCompilerTool>
135.64 - <asmTool>
135.65 - <developmentMode>5</developmentMode>
135.66 - </asmTool>
135.67 - </compileType>
135.68 - <item path="welcome.cc" ex="false" tool="1" flavor2="0">
135.69 - </item>
135.70 - <item path="welcome.h" ex="false" tool="3" flavor2="0">
135.71 - </item>
135.72 - </conf>
135.73 - </confs>
135.74 -</configurationDescriptor>
136.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/nbproject/project.xml Sun Jun 25 18:17:37 2017 +0200
136.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
136.3 @@ -1,28 +0,0 @@
136.4 -<?xml version="1.0" encoding="UTF-8"?>
136.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
136.6 - <type>org.netbeans.modules.cnd.makeproject</type>
136.7 - <configuration>
136.8 - <data xmlns="http://www.netbeans.org/ns/make-project/1">
136.9 - <name>hello-world2</name>
136.10 - <c-extensions/>
136.11 - <cpp-extensions>cc</cpp-extensions>
136.12 - <header-extensions>h</header-extensions>
136.13 - <sourceEncoding>UTF-8</sourceEncoding>
136.14 - <make-dep-projects/>
136.15 - <sourceRootList/>
136.16 - <confList>
136.17 - <confElem>
136.18 - <name>Debug</name>
136.19 - <type>1</type>
136.20 - </confElem>
136.21 - <confElem>
136.22 - <name>Release</name>
136.23 - <type>1</type>
136.24 - </confElem>
136.25 - </confList>
136.26 - <formatting>
136.27 - <project-formatting-style>false</project-formatting-style>
136.28 - </formatting>
136.29 - </data>
136.30 - </configuration>
136.31 -</project>
137.1 --- a/ide.analysis.modernize/test/unit/data/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world/welcome.cc Sun Jun 25 18:17:37 2017 +0200
137.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
137.3 @@ -1,38 +0,0 @@
137.4 -/*
137.5 - * Copyright (c) 2009-2014, Oracle and/or its affiliates. All rights reserved.
137.6 - *
137.7 - * Redistribution and use in source and binary forms, with or without
137.8 - * modification, are permitted provided that the following conditions are met:
137.9 - *
137.10 - * * Redistributions of source code must retain the above copyright notice,
137.11 - * this list of conditions and the following disclaimer.
137.12 - *
137.13 - * * Redistributions in binary form must reproduce the above copyright notice,
137.14 - * this list of conditions and the following disclaimer in the documentation
137.15 - * and/or other materials provided with the distribution.
137.16 - *
137.17 - * * Neither the name of Oracle nor the names of its contributors
137.18 - * may be used to endorse or promote products derived from this software without
137.19 - * specific prior written permission.
137.20 - *
137.21 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
137.22 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
137.23 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
137.24 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
137.25 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
137.26 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
137.27 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
137.28 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
137.29 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
137.30 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
137.31 - * THE POSSIBILITY OF SUCH DAMAGE.
137.32 - */
137.33 -
137.34 -#include <iostream>
137.35 -
137.36 -int main(int argc, char**argv) {
137.37 - // Prints hello message...
137.38 - std::cout << "Hello World!" << std::endl;
137.39 -
137.40 - return 0;
137.41 -}
138.1 --- a/ide.analysis.modernize/test/unit/data/goldenfiles/com/sun/tools/ide/analysis/modernize/HeaderTest/src/llvm-header-guard.h Sun Jun 25 18:17:37 2017 +0200
138.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
138.3 @@ -1,3 +0,0 @@
138.4 -#ifndef _IDE_ANALYSIS_MODERNIZE_HEADERTEST_PROJECT_WITH_HEADERS_SRC_LLVM_HEADER_GUARD_H
138.5 -#define _IDE_ANALYSIS_MODERNIZE_HEADERTEST_PROJECT_WITH_HEADERS_SRC_LLVM_HEADER_GUARD_H
138.6 -#endif
138.7 \ No newline at end of file
139.1 --- a/ide.analysis.modernize/test/unit/data/goldenfiles/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/src/modernize-loop-convert.cpp Sun Jun 25 18:17:37 2017 +0200
139.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
139.3 @@ -1,24 +0,0 @@
139.4 -#include <vector>
139.5 -
139.6 -using namespace std;
139.7 -
139.8 -int loops() {
139.9 - const int N = 5;
139.10 - int arr[] = {1, 2, 3, 4, 5};
139.11 - vector<int> v;
139.12 - v.push_back(1);
139.13 - v.push_back(2);
139.14 - v.push_back(3);
139.15 -
139.16 - // safe conversion
139.17 - for (auto & elem : arr)
139.18 - cout << elem;
139.19 -
139.20 - // reasonable conversion
139.21 - for (auto & elem : v)
139.22 - cout << elem;
139.23 -
139.24 - // reasonable conversion
139.25 - for (auto & elem : v)
139.26 - cout << elem;
139.27 -}
139.28 \ No newline at end of file
140.1 --- a/ide.analysis.modernize/test/unit/data/goldenfiles/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/src/modernize-raw-string-literal.cpp Sun Jun 25 18:17:37 2017 +0200
140.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
140.3 @@ -1,8 +0,0 @@
140.4 -const char *const Quotes{R"(embedded "quotes")"};
140.5 -const char *const Paragraph{"Line one.\nLine two.\nLine three.\n"};
140.6 -const char *const SingleLine{"Single line.\n"};
140.7 -const char *const TrailingSpace{"Look here -> \n"};
140.8 -const char *const Tab{"One\tTwo\n"};
140.9 -const char *const Bell{"Hello!\a And welcome!"};
140.10 -const char *const Path{R"(C:\Program Files\Vendor\Application.exe)"};
140.11 -const char *const RegEx{R"(\w\([a-z]\))"};
140.12 \ No newline at end of file
141.1 --- a/ide.analysis.modernize/test/unit/data/goldenfiles/com/sun/tools/ide/analysis/modernize/SingleCppFileCheckTest/src/modernize-use-nullptr.cpp Sun Jun 25 18:17:37 2017 +0200
141.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
141.3 @@ -1,11 +0,0 @@
141.4 -#include <cstddef>
141.5 -
141.6 -void assignment() {
141.7 - char *a = nullptr;
141.8 - char *b = nullptr;
141.9 - char c = 0;
141.10 -}
141.11 -
141.12 -int *ret_ptr() {
141.13 - return nullptr;
141.14 -}
141.15 \ No newline at end of file
142.1 --- a/ide.analysis.modernize/test/unit/data/goldenfiles/com/sun/tools/ide/analysis/modernize/YamlTest/hello-world.json Sun Jun 25 18:17:37 2017 +0200
142.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
142.3 @@ -1,25 +0,0 @@
142.4 ----
142.5 -MainSourceFile: ''
142.6 -Diagnostics:
142.7 - CheckName: misc-unused-parameters
142.8 - Level: Warning
142.9 - MessageFilePath: /media/ilia/SSD/code/sputnik/modules/ide.analysis.modernize/build/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/welcome.cc
142.10 - MessageFileOffset: 1615
142.11 - Message: 'parameter ''argc'' is unused'
142.12 - Replacements:
142.13 - - FilePath: $path/ide/analysis/modernize/YamlTest/hello-world/welcome.cc
142.14 - Offset: 1615
142.15 - Length: 4
142.16 - ReplacementText: ' /*argc*/'
142.17 -Diagnostics:
142.18 - CheckName: misc-unused-parameters
142.19 - Level: Warning
142.20 - MessageFilePath: /media/ilia/SSD/code/sputnik/modules/ide.analysis.modernize/build/test/unit/data/ide/analysis/modernize/YamlTest/hello-world/welcome.cc
142.21 - MessageFileOffset: 1627
142.22 - Message: 'parameter ''argv'' is unused'
142.23 - Replacements:
142.24 - - FilePath: $path/ide/analysis/modernize/YamlTest/hello-world/welcome.cc
142.25 - Offset: 1627
142.26 - Length: 4
142.27 - ReplacementText: ' /*argv*/'
142.28 -...
142.29 \ No newline at end of file
143.1 --- a/ide.analysis.modernize/test/unit/src/ide/analysis/modernize/HeaderTest.java Sun Jun 25 18:17:37 2017 +0200
143.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
143.3 @@ -1,62 +0,0 @@
143.4 -package ide.analysis.modernize;
143.5 -
143.6 -import org.netbeans.modules.ide.analysis.modernize.impl.ModernizeFix;
143.7 -import org.netbeans.modules.ide.analysis.modernize.impl.YamlParser;
143.8 -import java.io.File;
143.9 -import java.nio.file.Files;
143.10 -import java.util.List;
143.11 -import static junit.framework.TestCase.fail;
143.12 -import org.netbeans.modules.cnd.test.CndCoreTestUtils;
143.13 -import static org.netbeans.modules.nativeexecution.test.NativeExecutionBaseTestCase.createTempFile;
143.14 -import org.openide.cookies.EditorCookie;
143.15 -import org.openide.filesystems.FileObject;
143.16 -import org.openide.filesystems.FileUtil;
143.17 -import org.openide.loaders.DataObject;
143.18 -
143.19 -/*
143.20 - * To change this license header, choose License Headers in Project Properties.
143.21 - * To change this template file, choose Tools | Templates
143.22 - * and open the template in the editor.
143.23 - */
143.24 -/**
143.25 - *
143.26 - * @author Ilia Gromov
143.27 - */
143.28 -public class HeaderTest extends TidyTestCase {
143.29 -
143.30 - private final String source = "src/llvm-header-guard.cpp";
143.31 - private final String header = "src/llvm-header-guard.h";
143.32 -
143.33 - public HeaderTest() {
143.34 - super("project-with-headers");
143.35 - }
143.36 -
143.37 - public void testLlvmHeaderGuard() {
143.38 - performTest(source, "llvm-header-guard", true);
143.39 - }
143.40 -
143.41 - @Override
143.42 - protected void processTestResults(List<ModernizeFix> fixes, String footerName) throws Exception {
143.43 - for (ModernizeFix fix : fixes) {
143.44 - fix.implement();
143.45 -
143.46 - for (YamlParser.Replacement replacement : fix.getReplacements()) {
143.47 - FileObject fo = FileUtil.toFileObject(new File(replacement.filePath));
143.48 -
143.49 - DataObject dObj = DataObject.find(fo);
143.50 - EditorCookie ec = dObj.getLookup().lookup(EditorCookie.class);
143.51 - ec.saveDocument();
143.52 - }
143.53 - }
143.54 -
143.55 - File diffFile = createTempFile("diff", null, false);
143.56 -
143.57 - boolean diff = CndCoreTestUtils.diff(new File(FileUtil.toFile(getProjectDir()), header), getGoldenFile(header), diffFile);
143.58 -
143.59 - if (diff) {
143.60 - byte[] readAllBytes = Files.readAllBytes(diffFile.toPath());
143.61 - System.err.println(new String(readAllBytes));
143.62 - fail();
143.63 - }
143.64 - }
143.65 -}
144.1 --- a/ide.analysis.modernize/test/unit/src/ide/analysis/modernize/RequestImpl.java Sun Jun 25 18:17:37 2017 +0200
144.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
144.3 @@ -1,44 +0,0 @@
144.4 -/*
144.5 - * To change this license header, choose License Headers in Project Properties.
144.6 - * To change this template file, choose Tools | Templates
144.7 - * and open the template in the editor.
144.8 - */
144.9 -package ide.analysis.modernize;
144.10 -
144.11 -import javax.swing.text.Document;
144.12 -import org.netbeans.modules.cnd.api.model.CsmFile;
144.13 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
144.14 -
144.15 -/**
144.16 - *
144.17 - * @author Ilia Gromov
144.18 - */
144.19 -class RequestImpl implements CsmErrorProvider.Request {
144.20 -
144.21 - private final CsmFile csmFile;
144.22 -
144.23 - public RequestImpl(CsmFile csmFile) {
144.24 - this.csmFile = csmFile;
144.25 - }
144.26 -
144.27 - @Override
144.28 - public CsmFile getFile() {
144.29 - return csmFile;
144.30 - }
144.31 -
144.32 - @Override
144.33 - public boolean isCancelled() {
144.34 - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
144.35 - }
144.36 -
144.37 - @Override
144.38 - public Document getDocument() {
144.39 - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
144.40 - }
144.41 -
144.42 - @Override
144.43 - public CsmErrorProvider.EditorEvent getEvent() {
144.44 - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
144.45 - }
144.46 -
144.47 -}
145.1 --- a/ide.analysis.modernize/test/unit/src/ide/analysis/modernize/ResponseImpl.java Sun Jun 25 18:17:37 2017 +0200
145.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
145.3 @@ -1,46 +0,0 @@
145.4 -/*
145.5 - * To change this license header, choose License Headers in Project Properties.
145.6 - * To change this template file, choose Tools | Templates
145.7 - * and open the template in the editor.
145.8 - */
145.9 -package ide.analysis.modernize;
145.10 -
145.11 -import org.netbeans.modules.ide.analysis.modernize.impl.ModernizeErrorInfo;
145.12 -import org.netbeans.modules.ide.analysis.modernize.impl.ModernizeFix;
145.13 -import org.netbeans.modules.ide.analysis.modernize.impl.YamlParser;
145.14 -import java.util.List;
145.15 -import junit.framework.TestCase;
145.16 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
145.17 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
145.18 -import org.openide.util.Exceptions;
145.19 -
145.20 -/**
145.21 - *
145.22 - * @author Ilia Gromov
145.23 - */
145.24 -class ResponseImpl implements CsmErrorProvider.Response {
145.25 -
145.26 - private final List<ModernizeFix> fixes;
145.27 -
145.28 - public ResponseImpl(List<ModernizeFix> fixes) {
145.29 - this.fixes = fixes;
145.30 - }
145.31 -
145.32 - @Override
145.33 - public void addError(CsmErrorInfo info) {
145.34 - try {
145.35 - TestCase.assertTrue(info instanceof ModernizeErrorInfo);
145.36 - final List<YamlParser.Replacement> replacements = ((ModernizeErrorInfo) info).getDiagnostics().getReplacements();
145.37 - final String id = ((ModernizeErrorInfo) info).getId();
145.38 - ModernizeFix fix = new ModernizeFix(replacements, id);
145.39 - fixes.add(fix);
145.40 - } catch (Exception ex) {
145.41 - Exceptions.printStackTrace(ex);
145.42 - }
145.43 - }
145.44 -
145.45 - @Override
145.46 - public void done() {
145.47 - }
145.48 -
145.49 -}
146.1 --- a/ide.analysis.modernize/test/unit/src/ide/analysis/modernize/SingleCppFileCheckTest.java Sun Jun 25 18:17:37 2017 +0200
146.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
146.3 @@ -1,64 +0,0 @@
146.4 -package ide.analysis.modernize;
146.5 -
146.6 -import org.netbeans.modules.ide.analysis.modernize.impl.ModernizeFix;
146.7 -import java.io.File;
146.8 -import java.nio.file.Files;
146.9 -import java.util.List;
146.10 -import org.junit.Test;
146.11 -import org.netbeans.modules.cnd.test.CndCoreTestUtils;
146.12 -import org.openide.cookies.EditorCookie;
146.13 -import org.openide.filesystems.FileObject;
146.14 -import org.openide.filesystems.FileUtil;
146.15 -import org.openide.loaders.DataObject;
146.16 -
146.17 -/**
146.18 - *
146.19 - * @author Ilia Gromov
146.20 - */
146.21 -public class SingleCppFileCheckTest extends TidyTestCase {
146.22 -
146.23 - public SingleCppFileCheckTest() {
146.24 - super("hello-cmake-world");
146.25 - }
146.26 -
146.27 - @Override
146.28 - protected void setUp() throws Exception {
146.29 - super.setUp();
146.30 - }
146.31 -
146.32 - public void testModernizeUseNullptr() {
146.33 - performTest("src/modernize-use-nullptr.cpp", "modernize-use-nullptr", true);
146.34 - }
146.35 -
146.36 - public void testModernizeLoopConvert() {
146.37 - performTest("src/modernize-loop-convert.cpp", "modernize-loop-convert", true);
146.38 - }
146.39 -
146.40 - @Test
146.41 - public void testModernizeRawStringLiteral() {
146.42 - performTest("src/modernize-raw-string-literal.cpp", "modernize-raw-string-literal", true);
146.43 - }
146.44 -
146.45 - @Override
146.46 - protected void processTestResults(List<ModernizeFix> fixes, String startFileName) throws Exception {
146.47 - for (ModernizeFix fix : fixes) {
146.48 - fix.implement();
146.49 - }
146.50 -
146.51 - FileObject footer = getSourceFile(startFileName);
146.52 -
146.53 - DataObject dObj = DataObject.find(footer);
146.54 - EditorCookie ec = dObj.getLookup().lookup(EditorCookie.class);
146.55 - ec.saveDocument();
146.56 -
146.57 - File diffFile = createTempFile("diff", null, false);
146.58 -
146.59 - boolean diff = CndCoreTestUtils.diff(FileUtil.toFile(footer), getGoldenFile(startFileName), diffFile);
146.60 -
146.61 - if (diff) {
146.62 - byte[] readAllBytes = Files.readAllBytes(diffFile.toPath());
146.63 - System.err.println(new String(readAllBytes));
146.64 - fail();
146.65 - }
146.66 - }
146.67 -}
147.1 --- a/ide.analysis.modernize/test/unit/src/ide/analysis/modernize/TidyTestCase.java Sun Jun 25 18:17:37 2017 +0200
147.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
147.3 @@ -1,237 +0,0 @@
147.4 -/*
147.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
147.6 - *
147.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
147.8 - *
147.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
147.10 - * Other names may be trademarks of their respective owners.
147.11 - *
147.12 - * The contents of this file are subject to the terms of either the GNU
147.13 - * General Public License Version 2 only ("GPL") or the Common
147.14 - * Development and Distribution License("CDDL") (collectively, the
147.15 - * "License"). You may not use this file except in compliance with the
147.16 - * License. You can obtain a copy of the License at
147.17 - * http://www.netbeans.org/cddl-gplv2.html
147.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
147.19 - * specific language governing permissions and limitations under the
147.20 - * License. When distributing the software, include this License Header
147.21 - * Notice in each file and include the License file at
147.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
147.23 - * particular file as subject to the "Classpath" exception as provided
147.24 - * by Oracle in the GPL Version 2 section of the License file that
147.25 - * accompanied this code. If applicable, add the following below the
147.26 - * License Header, with the fields enclosed by brackets [] replaced by
147.27 - * your own identifying information:
147.28 - * "Portions Copyrighted [year] [name of copyright owner]"
147.29 - *
147.30 - * If you wish your version of this file to be governed by only the CDDL
147.31 - * or only the GPL Version 2, indicate your decision by adding
147.32 - * "[Contributor] elects to include this software in this distribution
147.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
147.34 - * single choice of license, a recipient has the option to distribute
147.35 - * your version of this file under either the CDDL, the GPL Version 2 or
147.36 - * to extend the choice of license to its licensees as provided above.
147.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
147.38 - * Version 2 license, then the option applies only if the new code is
147.39 - * made subject to such option by the copyright holder.
147.40 - *
147.41 - * Contributor(s):
147.42 - *
147.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
147.44 - */
147.45 -package ide.analysis.modernize;
147.46 -
147.47 -import org.netbeans.modules.ide.analysis.modernize.impl.DiagnosticsTool;
147.48 -import org.netbeans.modules.ide.analysis.modernize.impl.ModernizeAnalyzerImpl;
147.49 -import org.netbeans.modules.ide.analysis.modernize.impl.ModernizeFix;
147.50 -import org.netbeans.modules.ide.analysis.modernize.impl.YamlParser;
147.51 -import org.netbeans.modules.ide.analysis.modernize.utils.AnalyticsTools;
147.52 -import java.io.File;
147.53 -import java.nio.file.Files;
147.54 -import java.nio.file.attribute.PosixFilePermissions;
147.55 -import java.util.ArrayList;
147.56 -import java.util.Arrays;
147.57 -import java.util.Collection;
147.58 -import java.util.Collections;
147.59 -import java.util.List;
147.60 -import java.util.logging.ConsoleHandler;
147.61 -import java.util.logging.Level;
147.62 -import java.util.logging.LogManager;
147.63 -import java.util.prefs.Preferences;
147.64 -import org.netbeans.api.progress.ProgressHandle;
147.65 -import org.netbeans.api.project.Project;
147.66 -import org.netbeans.api.project.ProjectManager;
147.67 -import org.netbeans.api.project.ui.OpenProjects;
147.68 -import org.netbeans.modules.analysis.SPIAccessor;
147.69 -import org.netbeans.modules.analysis.spi.Analyzer;
147.70 -import org.netbeans.modules.cnd.api.model.CsmFile;
147.71 -import org.netbeans.modules.cnd.api.model.CsmModel;
147.72 -import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
147.73 -import org.netbeans.modules.cnd.api.model.CsmProject;
147.74 -import org.netbeans.modules.cnd.api.model.syntaxerr.AuditPreferences;
147.75 -import org.netbeans.modules.cnd.api.model.syntaxerr.CodeAudit;
147.76 -import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
147.77 -import org.netbeans.modules.cnd.api.project.NativeProject;
147.78 -import org.netbeans.modules.cnd.api.project.NativeProjectRegistry;
147.79 -import org.netbeans.modules.cnd.api.toolchain.CompilerSet;
147.80 -import org.netbeans.modules.cnd.api.toolchain.CompilerSetManager;
147.81 -import org.netbeans.modules.cnd.makeproject.api.MakeProject;
147.82 -import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
147.83 -import org.netbeans.modules.cnd.modelutil.CsmUtilities;
147.84 -import org.netbeans.modules.cnd.test.CndBaseTestCase;
147.85 -import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
147.86 -import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
147.87 -import org.netbeans.modules.refactoring.api.Scope;
147.88 -import org.openide.filesystems.FileObject;
147.89 -import org.openide.filesystems.FileUtil;
147.90 -import org.openide.util.Exceptions;
147.91 -
147.92 -/**
147.93 - *
147.94 - * @author Ilia Gromov
147.95 - */
147.96 -public abstract class TidyTestCase extends CndBaseTestCase {
147.97 -
147.98 - private final String projectName;
147.99 -
147.100 - private List<FileObject> fileObjects;
147.101 - private MakeProject project;
147.102 - private FileObject projectDirFileObject;
147.103 -
147.104 - private final String CLANG_TIDY_PATH = "clang-tidy-3.9p";
147.105 -
147.106 - public TidyTestCase(String projectName) {
147.107 - super(projectName);
147.108 -
147.109 - this.projectName = projectName;
147.110 - }
147.111 -
147.112 - protected static CodeAudit findAudit(Collection<CodeAudit> audits, String id) {
147.113 - for (CodeAudit audit : audits) {
147.114 - if (audit.getID().equals(id)) {
147.115 - return audit;
147.116 - }
147.117 - }
147.118 - return null;
147.119 - }
147.120 -
147.121 - @Override
147.122 - protected void setUp() throws Exception {
147.123 - super.setUp();
147.124 - LogManager.getLogManager().reset();
147.125 -
147.126 - java.util.logging.Logger LOG = java.util.logging.Logger.getLogger("ide.analysis.tidy");
147.127 - LOG.setLevel(Level.ALL);
147.128 -
147.129 - ConsoleHandler consoleHandler = new ConsoleHandler();
147.130 - consoleHandler.setLevel(Level.ALL);
147.131 - LOG.addHandler(consoleHandler);
147.132 -
147.133 - File clangTidyFile = getBinaryFile();
147.134 - Files.setPosixFilePermissions(clangTidyFile.toPath(), PosixFilePermissions.fromString("rwxrwxrwx"));
147.135 -
147.136 - assertTrue(getBinaryFile().exists());
147.137 -
147.138 - File projectDirFile = getDataFile(projectName);
147.139 - projectDirFileObject = FileUtil.toFileObject(projectDirFile);
147.140 -
147.141 - fileObjects = new ArrayList<FileObject>();
147.142 -
147.143 - project = (MakeProject) ProjectManager.getDefault().findProject(projectDirFileObject);
147.144 -
147.145 - OpenProjects.getDefault().open(new Project[]{project}, false);
147.146 - while (!OpenProjects.getDefault().isProjectOpen(project)) {
147.147 - try {
147.148 - Thread.sleep(100);
147.149 - } catch (InterruptedException ex) {
147.150 - Exceptions.printStackTrace(ex);
147.151 - }
147.152 - }
147.153 -
147.154 - CsmModel model = CsmModelAccessor.getModel();
147.155 - assertNotNull(project);
147.156 -
147.157 - NativeProject np = project.getLookup().lookup(NativeProject.class);
147.158 - NativeProjectRegistry.getDefault().register(np);
147.159 - model.enableProject(np);
147.160 - assertNotNull(np);
147.161 -
147.162 - CsmProject csmProject = model.getProject(np);
147.163 - assertNotNull(csmProject);
147.164 -
147.165 - csmProject.waitParse();
147.166 -
147.167 - }
147.168 -
147.169 - public ExecutionEnvironment getExecEnv() {
147.170 - ExecutionEnvironment execEnv = ExecutionEnvironmentFactory.getLocal();
147.171 - return execEnv;
147.172 - }
147.173 -
147.174 - public CompilerSet getCompilerSet() {
147.175 - CompilerSetManager csm = CompilerSetManager.get(getExecEnv());
147.176 - return csm.getDefaultCompilerSet();
147.177 - }
147.178 -
147.179 - public MakeProject getProject() {
147.180 - return project;
147.181 - }
147.182 -
147.183 - public FileObject getProjectDir() {
147.184 - return projectDirFileObject;
147.185 - }
147.186 -
147.187 - public FileObject getSourceFile(String name) {
147.188 - return FileUtil.toFileObject(new File(FileUtil.toFile(getProjectDir()), name));
147.189 - }
147.190 -
147.191 - public File getBinaryFile() {
147.192 - return new File(getDataDir(), CLANG_TIDY_PATH);
147.193 - }
147.194 -
147.195 - protected final void performTest(String startFileName, String checkName, boolean isStartFile) {
147.196 - try {
147.197 - FileObject startFile = getSourceFile(startFileName);
147.198 - assertTrue(startFile.isValid());
147.199 -
147.200 - Scope scope = Scope.create(null, null, Arrays.asList(new FileObject[]{startFile}));
147.201 - Analyzer.Context context = SPIAccessor.ACCESSOR.createContext(scope, null, null, ProgressHandle.createHandle("dummy"), 0, 0);
147.202 - Analyzer.AnalyzerFactory factory = new ModernizeAnalyzerImpl.AnalyzerFactoryImpl();
147.203 -
147.204 - ModernizeAnalyzerImpl analyzer = (ModernizeAnalyzerImpl) factory.createAnalyzer(context);
147.205 - ExecutionEnvironment execEnv = ExecutionEnvironmentFactory.getLocal();
147.206 - final CsmFile csmFile = CsmUtilities.getCsmFile(startFile, true, false);
147.207 - Item item = AnalyticsTools.findItem(csmFile, getProject());
147.208 -
147.209 - Collection<CodeAudit> audits = DiagnosticsTool.getAudits(getBinaryFile().getAbsolutePath(), execEnv, new AuditPreferences(Preferences.userNodeForPackage(this.getClass())));
147.210 - CodeAudit audit = findAudit(audits, checkName);
147.211 - assertNotNull(audit);
147.212 -
147.213 - // ----- BEGIN diagnostics -----
147.214 - DiagnosticsTool diagnosticsTool = new DiagnosticsTool(execEnv, item, getProject(), getBinaryFile().getAbsolutePath());
147.215 -
147.216 - int exitCode = diagnosticsTool.process(Collections.singleton(audit.getID()), csmFile, true);
147.217 - if (exitCode != DiagnosticsTool.STATUS_OK) {
147.218 - fail();
147.219 - }
147.220 -
147.221 - List<YamlParser.Diagnostics> diags = YamlParser.getDefault().parseYaml(diagnosticsTool.getYamlAsString());
147.222 - List<ModernizeFix> fixes = new ArrayList<ModernizeFix>();
147.223 -
147.224 - CsmErrorProvider.Request request = new RequestImpl(csmFile);
147.225 - CsmErrorProvider.Response response = new ResponseImpl(fixes);
147.226 -
147.227 - analyzer.getErrorProvider(null).postProcess(false, csmFile, getProject(), diags, request, response);
147.228 - // ----- END diagnostics -----
147.229 -
147.230 - processTestResults(fixes, startFileName);
147.231 - } catch (Exception ex) {
147.232 - ex.printStackTrace(System.err);
147.233 - fail(ex.toString());
147.234 - }
147.235 - }
147.236 -
147.237 - protected void processTestResults(List<ModernizeFix> fixes, String startFileName) throws Exception {
147.238 -
147.239 - }
147.240 -}
148.1 --- a/ide.analysis.modernize/test/unit/src/ide/analysis/modernize/YamlTest.java Sun Jun 25 18:17:37 2017 +0200
148.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
148.3 @@ -1,117 +0,0 @@
148.4 -/*
148.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
148.6 - *
148.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
148.8 - *
148.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
148.10 - * Other names may be trademarks of their respective owners.
148.11 - *
148.12 - * The contents of this file are subject to the terms of either the GNU
148.13 - * General Public License Version 2 only ("GPL") or the Common
148.14 - * Development and Distribution License("CDDL") (collectively, the
148.15 - * "License"). You may not use this file except in compliance with the
148.16 - * License. You can obtain a copy of the License at
148.17 - * http://www.netbeans.org/cddl-gplv2.html
148.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
148.19 - * specific language governing permissions and limitations under the
148.20 - * License. When distributing the software, include this License Header
148.21 - * Notice in each file and include the License file at
148.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
148.23 - * particular file as subject to the "Classpath" exception as provided
148.24 - * by Oracle in the GPL Version 2 section of the License file that
148.25 - * accompanied this code. If applicable, add the following below the
148.26 - * License Header, with the fields enclosed by brackets [] replaced by
148.27 - * your own identifying information:
148.28 - * "Portions Copyrighted [year] [name of copyright owner]"
148.29 - *
148.30 - * If you wish your version of this file to be governed by only the CDDL
148.31 - * or only the GPL Version 2, indicate your decision by adding
148.32 - * "[Contributor] elects to include this software in this distribution
148.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
148.34 - * single choice of license, a recipient has the option to distribute
148.35 - * your version of this file under either the CDDL, the GPL Version 2 or
148.36 - * to extend the choice of license to its licensees as provided above.
148.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
148.38 - * Version 2 license, then the option applies only if the new code is
148.39 - * made subject to such option by the copyright holder.
148.40 - *
148.41 - * Contributor(s):
148.42 - *
148.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
148.44 - */
148.45 -package ide.analysis.modernize;
148.46 -
148.47 -import org.netbeans.modules.ide.analysis.modernize.impl.DiagnosticsTool;
148.48 -import org.netbeans.modules.ide.analysis.modernize.impl.ModernizeAnalyzerImpl;
148.49 -import org.netbeans.modules.ide.analysis.modernize.utils.AnalyticsTools;
148.50 -import java.io.File;
148.51 -import java.io.IOException;
148.52 -import java.nio.file.Files;
148.53 -import java.util.Arrays;
148.54 -import java.util.Collections;
148.55 -import org.junit.Test;
148.56 -import org.netbeans.api.progress.ProgressHandle;
148.57 -import org.netbeans.modules.analysis.SPIAccessor;
148.58 -import org.netbeans.modules.analysis.spi.Analyzer;
148.59 -import org.netbeans.modules.cnd.api.model.CsmFile;
148.60 -import org.netbeans.modules.cnd.makeproject.api.configurations.Item;
148.61 -import org.netbeans.modules.cnd.modelutil.CsmUtilities;
148.62 -import org.netbeans.modules.cnd.test.CndCoreTestUtils;
148.63 -import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
148.64 -import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
148.65 -import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
148.66 -import org.netbeans.modules.refactoring.api.Scope;
148.67 -import org.openide.filesystems.FileObject;
148.68 -
148.69 -/**
148.70 - *
148.71 - * @author Ilia Gromov
148.72 - */
148.73 -public class YamlTest extends TidyTestCase {
148.74 -
148.75 - public YamlTest() {
148.76 - super("hello-world");
148.77 - }
148.78 -
148.79 - @Test
148.80 - public void testYaml() throws IOException, ConnectionManager.CancellationException {
148.81 - FileObject singleFileObject = getSourceFile("welcome.cc");
148.82 -
148.83 - File goldenFile = getGoldenFile("hello-world.json");
148.84 - String goldenYaml = new String(Files.readAllBytes(goldenFile.toPath()), "UTF-8").replaceAll("\\$path", getDataDir().getAbsolutePath());
148.85 -
148.86 - Scope scope = Scope.create(null, null, Arrays.asList(new FileObject[]{singleFileObject}));
148.87 - Analyzer.Context context = SPIAccessor.ACCESSOR.createContext(scope, null, null, ProgressHandle.createHandle("dummy"), 0, 0);
148.88 -
148.89 - Analyzer.AnalyzerFactory factory = new ModernizeAnalyzerImpl.AnalyzerFactoryImpl();
148.90 - ModernizeAnalyzerImpl analyzer = (ModernizeAnalyzerImpl) factory.createAnalyzer(context);
148.91 -
148.92 - ExecutionEnvironment execEnv = ExecutionEnvironmentFactory.getLocal();
148.93 -
148.94 - CsmFile csmFile = CsmUtilities.getCsmFile(singleFileObject, false, false);
148.95 - Item item = AnalyticsTools.findItem(csmFile, getProject());
148.96 -
148.97 - DiagnosticsTool diagnosticsTool = new DiagnosticsTool(execEnv, item, getProject(), getBinaryFile().getAbsolutePath());
148.98 -
148.99 - int exitCode = diagnosticsTool.process(Collections.singleton("*"), csmFile, true);
148.100 -
148.101 - if (exitCode != DiagnosticsTool.STATUS_OK) {
148.102 - fail();
148.103 - }
148.104 - String yamlAsString = diagnosticsTool.getYamlAsString();
148.105 -
148.106 - File real = File.createTempFile("test", null);
148.107 - Files.write(real.toPath(), yamlAsString.getBytes());
148.108 -
148.109 - File expected = File.createTempFile("test", null);
148.110 - Files.write(expected.toPath(), goldenYaml.getBytes());
148.111 -
148.112 - File diff = File.createTempFile("test", null);
148.113 - if (CndCoreTestUtils.diff(real, expected, diff)) {
148.114 - System.err.println("============DIFF============");
148.115 - System.err.println(new String(Files.readAllBytes(diff.toPath()), "UTF-8"));
148.116 - System.err.println("============DIFF============");
148.117 - fail();
148.118 - }
148.119 - }
148.120 -}
149.1 --- a/ssinstaller/engine/nbproject/build-impl.xml Sun Jun 25 18:17:37 2017 +0200
149.2 +++ b/ssinstaller/engine/nbproject/build-impl.xml Sun Jun 25 18:25:05 2017 +0200
149.3 @@ -12,14 +12,21 @@
149.4 - execution
149.5 - debugging
149.6 - javadoc
149.7 - - junit compilation
149.8 - - junit execution
149.9 - - junit debugging
149.10 + - test compilation
149.11 + - test execution
149.12 + - test debugging
149.13 - applet
149.14 - cleanup
149.15
149.16 -->
149.17 <project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Sun_Studio_Installer_Engine-impl">
149.18 + <fail message="Please build using Ant 1.8.0 or higher.">
149.19 + <condition>
149.20 + <not>
149.21 + <antversion atleast="1.8.0"/>
149.22 + </not>
149.23 + </condition>
149.24 + </fail>
149.25 <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
149.26 <!--
149.27 ======================
149.28 @@ -39,28 +46,78 @@
149.29 <property file="${user.properties.file}"/>
149.30 <!-- The two properties below are usually overridden -->
149.31 <!-- by the active platform. Just a fallback. -->
149.32 - <property name="default.javac.source" value="1.4"/>
149.33 - <property name="default.javac.target" value="1.4"/>
149.34 + <property name="default.javac.source" value="1.6"/>
149.35 + <property name="default.javac.target" value="1.6"/>
149.36 </target>
149.37 <target depends="-pre-init,-init-private,-init-user" name="-init-project">
149.38 <property file="nbproject/configs/${config}.properties"/>
149.39 <property file="nbproject/project.properties"/>
149.40 </target>
149.41 <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
149.42 + <property name="platform.java" value="${java.home}/bin/java"/>
149.43 <available file="${manifest.file}" property="manifest.available"/>
149.44 - <condition property="manifest.available+main.class">
149.45 + <condition property="splashscreen.available">
149.46 <and>
149.47 - <isset property="manifest.available"/>
149.48 + <not>
149.49 + <equals arg1="${application.splash}" arg2="" trim="true"/>
149.50 + </not>
149.51 + <available file="${application.splash}"/>
149.52 + </and>
149.53 + </condition>
149.54 + <condition property="main.class.available">
149.55 + <and>
149.56 <isset property="main.class"/>
149.57 <not>
149.58 <equals arg1="${main.class}" arg2="" trim="true"/>
149.59 </not>
149.60 </and>
149.61 </condition>
149.62 - <condition property="manifest.available+main.class+mkdist.available">
149.63 + <condition property="profile.available">
149.64 <and>
149.65 - <istrue value="${manifest.available+main.class}"/>
149.66 + <isset property="javac.profile"/>
149.67 + <length length="0" string="${javac.profile}" when="greater"/>
149.68 + <matches pattern="((1\.[89])|9)(\..*)?" string="${javac.source}"/>
149.69 + </and>
149.70 + </condition>
149.71 + <condition property="do.archive">
149.72 + <or>
149.73 + <not>
149.74 + <istrue value="${jar.archive.disabled}"/>
149.75 + </not>
149.76 + <istrue value="${not.archive.disabled}"/>
149.77 + </or>
149.78 + </condition>
149.79 + <condition property="do.mkdist">
149.80 + <and>
149.81 + <isset property="do.archive"/>
149.82 <isset property="libs.CopyLibs.classpath"/>
149.83 + <not>
149.84 + <istrue value="${mkdist.disabled}"/>
149.85 + </not>
149.86 + </and>
149.87 + </condition>
149.88 + <condition property="do.archive+manifest.available">
149.89 + <and>
149.90 + <isset property="manifest.available"/>
149.91 + <istrue value="${do.archive}"/>
149.92 + </and>
149.93 + </condition>
149.94 + <condition property="do.archive+main.class.available">
149.95 + <and>
149.96 + <isset property="main.class.available"/>
149.97 + <istrue value="${do.archive}"/>
149.98 + </and>
149.99 + </condition>
149.100 + <condition property="do.archive+splashscreen.available">
149.101 + <and>
149.102 + <isset property="splashscreen.available"/>
149.103 + <istrue value="${do.archive}"/>
149.104 + </and>
149.105 + </condition>
149.106 + <condition property="do.archive+profile.available">
149.107 + <and>
149.108 + <isset property="profile.available"/>
149.109 + <istrue value="${do.archive}"/>
149.110 </and>
149.111 </condition>
149.112 <condition property="have.tests">
149.113 @@ -87,6 +144,7 @@
149.114 </and>
149.115 </condition>
149.116 <property name="run.jvmargs" value=""/>
149.117 + <property name="run.jvmargs.ide" value=""/>
149.118 <property name="javac.compilerargs" value=""/>
149.119 <property name="work.dir" value="${basedir}"/>
149.120 <condition property="no.deps">
149.121 @@ -98,6 +156,8 @@
149.122 <property name="javadoc.preview" value="true"/>
149.123 <property name="application.args" value=""/>
149.124 <property name="source.encoding" value="${file.encoding}"/>
149.125 + <property name="runtime.encoding" value="${source.encoding}"/>
149.126 + <property name="manifest.encoding" value="${source.encoding}"/>
149.127 <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
149.128 <and>
149.129 <isset property="javadoc.encoding"/>
149.130 @@ -113,12 +173,58 @@
149.131 <condition property="do.depend.true">
149.132 <istrue value="${do.depend}"/>
149.133 </condition>
149.134 - <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
149.135 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
149.136 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
149.137 <and>
149.138 - <isset property="jaxws.endorsed.dir"/>
149.139 - <available file="nbproject/jaxws-build.xml"/>
149.140 + <isset property="endorsed.classpath"/>
149.141 + <not>
149.142 + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/>
149.143 + </not>
149.144 </and>
149.145 </condition>
149.146 + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}">
149.147 + <isset property="profile.available"/>
149.148 + </condition>
149.149 + <condition else="false" property="jdkBug6558476">
149.150 + <and>
149.151 + <matches pattern="1\.[56]" string="${java.specification.version}"/>
149.152 + <not>
149.153 + <os family="unix"/>
149.154 + </not>
149.155 + </and>
149.156 + </condition>
149.157 + <condition else="false" property="javac.fork">
149.158 + <or>
149.159 + <istrue value="${jdkBug6558476}"/>
149.160 + <istrue value="${javac.external.vm}"/>
149.161 + </or>
149.162 + </condition>
149.163 + <property name="jar.index" value="false"/>
149.164 + <property name="jar.index.metainf" value="${jar.index}"/>
149.165 + <property name="copylibs.rebase" value="true"/>
149.166 + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
149.167 + <condition property="junit.available">
149.168 + <or>
149.169 + <available classname="org.junit.Test" classpath="${run.test.classpath}"/>
149.170 + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
149.171 + </or>
149.172 + </condition>
149.173 + <condition property="testng.available">
149.174 + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
149.175 + </condition>
149.176 + <condition property="junit+testng.available">
149.177 + <and>
149.178 + <istrue value="${junit.available}"/>
149.179 + <istrue value="${testng.available}"/>
149.180 + </and>
149.181 + </condition>
149.182 + <condition else="testng" property="testng.mode" value="mixed">
149.183 + <istrue value="${junit+testng.available}"/>
149.184 + </condition>
149.185 + <condition else="" property="testng.debug.mode" value="-mixed">
149.186 + <istrue value="${junit+testng.available}"/>
149.187 + </condition>
149.188 + <property name="java.failonerror" value="true"/>
149.189 </target>
149.190 <target name="-post-init">
149.191 <!-- Empty placeholder for easier customization. -->
149.192 @@ -146,26 +252,81 @@
149.193 </sequential>
149.194 </macrodef>
149.195 </target>
149.196 - <target name="-init-macrodef-javac">
149.197 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
149.198 <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
149.199 <attribute default="${src.dir}:${reglib.src.dir}" name="srcdir"/>
149.200 <attribute default="${build.classes.dir}" name="destdir"/>
149.201 <attribute default="${javac.classpath}" name="classpath"/>
149.202 + <attribute default="${javac.processorpath}" name="processorpath"/>
149.203 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
149.204 <attribute default="${includes}" name="includes"/>
149.205 <attribute default="${excludes}" name="excludes"/>
149.206 <attribute default="${javac.debug}" name="debug"/>
149.207 - <attribute default="" name="sourcepath"/>
149.208 + <attribute default="${empty.dir}" name="sourcepath"/>
149.209 + <attribute default="${empty.dir}" name="gensrcdir"/>
149.210 <element name="customize" optional="true"/>
149.211 <sequential>
149.212 - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
149.213 + <property location="${build.dir}/empty" name="empty.dir"/>
149.214 + <mkdir dir="${empty.dir}"/>
149.215 + <mkdir dir="@{apgeneratedsrcdir}"/>
149.216 + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
149.217 + <src>
149.218 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
149.219 + <include name="*"/>
149.220 + </dirset>
149.221 + </src>
149.222 <classpath>
149.223 <path path="@{classpath}"/>
149.224 </classpath>
149.225 - <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
149.226 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
149.227 + <compilerarg line="${javac.profile.cmd.line.arg}"/>
149.228 + <compilerarg line="${javac.compilerargs}"/>
149.229 + <compilerarg value="-processorpath"/>
149.230 + <compilerarg path="@{processorpath}:${empty.dir}"/>
149.231 + <compilerarg line="${ap.processors.internal}"/>
149.232 + <compilerarg line="${annotation.processing.processor.options}"/>
149.233 + <compilerarg value="-s"/>
149.234 + <compilerarg path="@{apgeneratedsrcdir}"/>
149.235 + <compilerarg line="${ap.proc.none.internal}"/>
149.236 <customize/>
149.237 </javac>
149.238 </sequential>
149.239 </macrodef>
149.240 + </target>
149.241 + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
149.242 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
149.243 + <attribute default="${src.dir}:${reglib.src.dir}" name="srcdir"/>
149.244 + <attribute default="${build.classes.dir}" name="destdir"/>
149.245 + <attribute default="${javac.classpath}" name="classpath"/>
149.246 + <attribute default="${javac.processorpath}" name="processorpath"/>
149.247 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
149.248 + <attribute default="${includes}" name="includes"/>
149.249 + <attribute default="${excludes}" name="excludes"/>
149.250 + <attribute default="${javac.debug}" name="debug"/>
149.251 + <attribute default="${empty.dir}" name="sourcepath"/>
149.252 + <attribute default="${empty.dir}" name="gensrcdir"/>
149.253 + <element name="customize" optional="true"/>
149.254 + <sequential>
149.255 + <property location="${build.dir}/empty" name="empty.dir"/>
149.256 + <mkdir dir="${empty.dir}"/>
149.257 + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
149.258 + <src>
149.259 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
149.260 + <include name="*"/>
149.261 + </dirset>
149.262 + </src>
149.263 + <classpath>
149.264 + <path path="@{classpath}"/>
149.265 + </classpath>
149.266 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
149.267 + <compilerarg line="${javac.profile.cmd.line.arg}"/>
149.268 + <compilerarg line="${javac.compilerargs}"/>
149.269 + <customize/>
149.270 + </javac>
149.271 + </sequential>
149.272 + </macrodef>
149.273 + </target>
149.274 + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
149.275 <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
149.276 <attribute default="${src.dir}:${reglib.src.dir}" name="srcdir"/>
149.277 <attribute default="${build.classes.dir}" name="destdir"/>
149.278 @@ -182,44 +343,390 @@
149.279 <attribute default="${build.classes.dir}" name="destdir"/>
149.280 <sequential>
149.281 <fail unless="javac.includes">Must set javac.includes</fail>
149.282 - <pathconvert pathsep="," property="javac.includes.binary">
149.283 + <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
149.284 <path>
149.285 <filelist dir="@{destdir}" files="${javac.includes}"/>
149.286 </path>
149.287 <globmapper from="*.java" to="*.class"/>
149.288 </pathconvert>
149.289 + <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
149.290 + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
149.291 <delete>
149.292 - <files includes="${javac.includes.binary}"/>
149.293 + <files includesfile="${javac.includesfile.binary}"/>
149.294 + </delete>
149.295 + <delete>
149.296 + <fileset file="${javac.includesfile.binary}"/>
149.297 </delete>
149.298 </sequential>
149.299 </macrodef>
149.300 </target>
149.301 - <target name="-init-macrodef-junit">
149.302 + <target if="${junit.available}" name="-init-macrodef-junit-init">
149.303 + <condition else="false" property="nb.junit.batch" value="true">
149.304 + <and>
149.305 + <istrue value="${junit.available}"/>
149.306 + <not>
149.307 + <isset property="test.method"/>
149.308 + </not>
149.309 + </and>
149.310 + </condition>
149.311 + <condition else="false" property="nb.junit.single" value="true">
149.312 + <and>
149.313 + <istrue value="${junit.available}"/>
149.314 + <isset property="test.method"/>
149.315 + </and>
149.316 + </condition>
149.317 + </target>
149.318 + <target name="-init-test-properties">
149.319 + <property name="test.binaryincludes" value="<nothing>"/>
149.320 + <property name="test.binarytestincludes" value=""/>
149.321 + <property name="test.binaryexcludes" value=""/>
149.322 + </target>
149.323 + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
149.324 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
149.325 <attribute default="${includes}" name="includes"/>
149.326 <attribute default="${excludes}" name="excludes"/>
149.327 <attribute default="**" name="testincludes"/>
149.328 + <attribute default="" name="testmethods"/>
149.329 + <element name="customize" optional="true"/>
149.330 <sequential>
149.331 - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
149.332 - <batchtest todir="${build.test.results.dir}">
149.333 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
149.334 - <filename name="@{testincludes}"/>
149.335 - </fileset>
149.336 - </batchtest>
149.337 - <classpath>
149.338 - <path path="${run.test.classpath}"/>
149.339 - </classpath>
149.340 + <property name="junit.forkmode" value="perTest"/>
149.341 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
149.342 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
149.343 <syspropertyset>
149.344 <propertyref prefix="test-sys-prop."/>
149.345 <mapper from="test-sys-prop.*" to="*" type="glob"/>
149.346 </syspropertyset>
149.347 <formatter type="brief" usefile="false"/>
149.348 <formatter type="xml"/>
149.349 - <jvmarg line="${run.jvmargs}"/>
149.350 + <jvmarg value="-ea"/>
149.351 + <customize/>
149.352 </junit>
149.353 </sequential>
149.354 </macrodef>
149.355 </target>
149.356 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
149.357 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
149.358 + <attribute default="${includes}" name="includes"/>
149.359 + <attribute default="${excludes}" name="excludes"/>
149.360 + <attribute default="**" name="testincludes"/>
149.361 + <attribute default="" name="testmethods"/>
149.362 + <element name="customize" optional="true"/>
149.363 + <sequential>
149.364 + <property name="junit.forkmode" value="perTest"/>
149.365 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
149.366 + <batchtest todir="${build.test.results.dir}">
149.367 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
149.368 + <filename name="@{testincludes}"/>
149.369 + </fileset>
149.370 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
149.371 + <filename name="${test.binarytestincludes}"/>
149.372 + </fileset>
149.373 + </batchtest>
149.374 + <syspropertyset>
149.375 + <propertyref prefix="test-sys-prop."/>
149.376 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
149.377 + </syspropertyset>
149.378 + <formatter type="brief" usefile="false"/>
149.379 + <formatter type="xml"/>
149.380 + <jvmarg value="-ea"/>
149.381 + <customize/>
149.382 + </junit>
149.383 + </sequential>
149.384 + </macrodef>
149.385 + </target>
149.386 + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
149.387 + <target if="${testng.available}" name="-init-macrodef-testng">
149.388 + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
149.389 + <attribute default="${includes}" name="includes"/>
149.390 + <attribute default="${excludes}" name="excludes"/>
149.391 + <attribute default="**" name="testincludes"/>
149.392 + <attribute default="" name="testmethods"/>
149.393 + <element name="customize" optional="true"/>
149.394 + <sequential>
149.395 + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
149.396 + <isset property="test.method"/>
149.397 + </condition>
149.398 + <union id="test.set">
149.399 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
149.400 + <filename name="@{testincludes}"/>
149.401 + </fileset>
149.402 + </union>
149.403 + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
149.404 + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="Sun_Studio_Installer_Engine" testname="TestNG tests" workingDir="${work.dir}">
149.405 + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
149.406 + <propertyset>
149.407 + <propertyref prefix="test-sys-prop."/>
149.408 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
149.409 + </propertyset>
149.410 + <customize/>
149.411 + </testng>
149.412 + </sequential>
149.413 + </macrodef>
149.414 + </target>
149.415 + <target name="-init-macrodef-test-impl">
149.416 + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
149.417 + <attribute default="${includes}" name="includes"/>
149.418 + <attribute default="${excludes}" name="excludes"/>
149.419 + <attribute default="**" name="testincludes"/>
149.420 + <attribute default="" name="testmethods"/>
149.421 + <element implicit="true" name="customize" optional="true"/>
149.422 + <sequential>
149.423 + <echo>No tests executed.</echo>
149.424 + </sequential>
149.425 + </macrodef>
149.426 + </target>
149.427 + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
149.428 + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
149.429 + <attribute default="${includes}" name="includes"/>
149.430 + <attribute default="${excludes}" name="excludes"/>
149.431 + <attribute default="**" name="testincludes"/>
149.432 + <attribute default="" name="testmethods"/>
149.433 + <element implicit="true" name="customize" optional="true"/>
149.434 + <sequential>
149.435 + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
149.436 + <customize/>
149.437 + </j2seproject3:junit>
149.438 + </sequential>
149.439 + </macrodef>
149.440 + </target>
149.441 + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
149.442 + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
149.443 + <attribute default="${includes}" name="includes"/>
149.444 + <attribute default="${excludes}" name="excludes"/>
149.445 + <attribute default="**" name="testincludes"/>
149.446 + <attribute default="" name="testmethods"/>
149.447 + <element implicit="true" name="customize" optional="true"/>
149.448 + <sequential>
149.449 + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
149.450 + <customize/>
149.451 + </j2seproject3:testng>
149.452 + </sequential>
149.453 + </macrodef>
149.454 + </target>
149.455 + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
149.456 + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
149.457 + <attribute default="${includes}" name="includes"/>
149.458 + <attribute default="${excludes}" name="excludes"/>
149.459 + <attribute default="**" name="testincludes"/>
149.460 + <attribute default="" name="testmethods"/>
149.461 + <sequential>
149.462 + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
149.463 + <customize>
149.464 + <classpath>
149.465 + <path path="${run.test.classpath}"/>
149.466 + </classpath>
149.467 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
149.468 + <jvmarg line="${run.jvmargs}"/>
149.469 + <jvmarg line="${run.jvmargs.ide}"/>
149.470 + </customize>
149.471 + </j2seproject3:test-impl>
149.472 + </sequential>
149.473 + </macrodef>
149.474 + </target>
149.475 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
149.476 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
149.477 + <attribute default="${includes}" name="includes"/>
149.478 + <attribute default="${excludes}" name="excludes"/>
149.479 + <attribute default="**" name="testincludes"/>
149.480 + <attribute default="" name="testmethods"/>
149.481 + <element name="customize" optional="true"/>
149.482 + <sequential>
149.483 + <property name="junit.forkmode" value="perTest"/>
149.484 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
149.485 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
149.486 + <syspropertyset>
149.487 + <propertyref prefix="test-sys-prop."/>
149.488 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
149.489 + </syspropertyset>
149.490 + <formatter type="brief" usefile="false"/>
149.491 + <formatter type="xml"/>
149.492 + <jvmarg value="-ea"/>
149.493 + <jvmarg line="${debug-args-line}"/>
149.494 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
149.495 + <customize/>
149.496 + </junit>
149.497 + </sequential>
149.498 + </macrodef>
149.499 + </target>
149.500 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
149.501 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
149.502 + <attribute default="${includes}" name="includes"/>
149.503 + <attribute default="${excludes}" name="excludes"/>
149.504 + <attribute default="**" name="testincludes"/>
149.505 + <attribute default="" name="testmethods"/>
149.506 + <element name="customize" optional="true"/>
149.507 + <sequential>
149.508 + <property name="junit.forkmode" value="perTest"/>
149.509 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
149.510 + <batchtest todir="${build.test.results.dir}">
149.511 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
149.512 + <filename name="@{testincludes}"/>
149.513 + </fileset>
149.514 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
149.515 + <filename name="${test.binarytestincludes}"/>
149.516 + </fileset>
149.517 + </batchtest>
149.518 + <syspropertyset>
149.519 + <propertyref prefix="test-sys-prop."/>
149.520 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
149.521 + </syspropertyset>
149.522 + <formatter type="brief" usefile="false"/>
149.523 + <formatter type="xml"/>
149.524 + <jvmarg value="-ea"/>
149.525 + <jvmarg line="${debug-args-line}"/>
149.526 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
149.527 + <customize/>
149.528 + </junit>
149.529 + </sequential>
149.530 + </macrodef>
149.531 + </target>
149.532 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
149.533 + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
149.534 + <attribute default="${includes}" name="includes"/>
149.535 + <attribute default="${excludes}" name="excludes"/>
149.536 + <attribute default="**" name="testincludes"/>
149.537 + <attribute default="" name="testmethods"/>
149.538 + <element implicit="true" name="customize" optional="true"/>
149.539 + <sequential>
149.540 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
149.541 + <customize/>
149.542 + </j2seproject3:junit-debug>
149.543 + </sequential>
149.544 + </macrodef>
149.545 + </target>
149.546 + <target if="${testng.available}" name="-init-macrodef-testng-debug">
149.547 + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
149.548 + <attribute default="${main.class}" name="testClass"/>
149.549 + <attribute default="" name="testMethod"/>
149.550 + <element name="customize2" optional="true"/>
149.551 + <sequential>
149.552 + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
149.553 + <isset property="test.method"/>
149.554 + </condition>
149.555 + <condition else="-suitename Sun_Studio_Installer_Engine -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
149.556 + <matches pattern=".*\.xml" string="@{testClass}"/>
149.557 + </condition>
149.558 + <delete dir="${build.test.results.dir}" quiet="true"/>
149.559 + <mkdir dir="${build.test.results.dir}"/>
149.560 + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
149.561 + <customize>
149.562 + <customize2/>
149.563 + <jvmarg value="-ea"/>
149.564 + <arg line="${testng.debug.mode}"/>
149.565 + <arg line="-d ${build.test.results.dir}"/>
149.566 + <arg line="-listener org.testng.reporters.VerboseReporter"/>
149.567 + <arg line="${testng.cmd.args}"/>
149.568 + </customize>
149.569 + </j2seproject3:debug>
149.570 + </sequential>
149.571 + </macrodef>
149.572 + </target>
149.573 + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
149.574 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
149.575 + <attribute default="${main.class}" name="testClass"/>
149.576 + <attribute default="" name="testMethod"/>
149.577 + <element implicit="true" name="customize2" optional="true"/>
149.578 + <sequential>
149.579 + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
149.580 + <customize2/>
149.581 + </j2seproject3:testng-debug>
149.582 + </sequential>
149.583 + </macrodef>
149.584 + </target>
149.585 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
149.586 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
149.587 + <attribute default="${includes}" name="includes"/>
149.588 + <attribute default="${excludes}" name="excludes"/>
149.589 + <attribute default="**" name="testincludes"/>
149.590 + <attribute default="" name="testmethods"/>
149.591 + <attribute default="${main.class}" name="testClass"/>
149.592 + <attribute default="" name="testMethod"/>
149.593 + <sequential>
149.594 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
149.595 + <customize>
149.596 + <classpath>
149.597 + <path path="${run.test.classpath}"/>
149.598 + </classpath>
149.599 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
149.600 + <jvmarg line="${run.jvmargs}"/>
149.601 + <jvmarg line="${run.jvmargs.ide}"/>
149.602 + </customize>
149.603 + </j2seproject3:test-debug-impl>
149.604 + </sequential>
149.605 + </macrodef>
149.606 + </target>
149.607 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
149.608 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
149.609 + <attribute default="${includes}" name="includes"/>
149.610 + <attribute default="${excludes}" name="excludes"/>
149.611 + <attribute default="**" name="testincludes"/>
149.612 + <attribute default="" name="testmethods"/>
149.613 + <attribute default="${main.class}" name="testClass"/>
149.614 + <attribute default="" name="testMethod"/>
149.615 + <sequential>
149.616 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
149.617 + <customize2>
149.618 + <syspropertyset>
149.619 + <propertyref prefix="test-sys-prop."/>
149.620 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
149.621 + </syspropertyset>
149.622 + </customize2>
149.623 + </j2seproject3:testng-debug-impl>
149.624 + </sequential>
149.625 + </macrodef>
149.626 + </target>
149.627 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
149.628 + <!--
149.629 + pre NB7.2 profiling section; consider it deprecated
149.630 + -->
149.631 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
149.632 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
149.633 + <!-- Empty placeholder for easier customization. -->
149.634 + <!-- You can override this target in the ../build.xml file. -->
149.635 + </target>
149.636 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
149.637 + <!-- Empty placeholder for easier customization. -->
149.638 + <!-- You can override this target in the ../build.xml file. -->
149.639 + </target>
149.640 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
149.641 + <macrodef name="resolve">
149.642 + <attribute name="name"/>
149.643 + <attribute name="value"/>
149.644 + <sequential>
149.645 + <property name="@{name}" value="${env.@{value}}"/>
149.646 + </sequential>
149.647 + </macrodef>
149.648 + <macrodef name="profile">
149.649 + <attribute default="${main.class}" name="classname"/>
149.650 + <element name="customize" optional="true"/>
149.651 + <sequential>
149.652 + <property environment="env"/>
149.653 + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
149.654 + <java classname="@{classname}" dir="${profiler.info.dir}" failonerror="${java.failonerror}" fork="true" jvm="${profiler.info.jvm}">
149.655 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
149.656 + <jvmarg value="${profiler.info.jvmargs.agent}"/>
149.657 + <jvmarg line="${profiler.info.jvmargs}"/>
149.658 + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
149.659 + <arg line="${application.args}"/>
149.660 + <classpath>
149.661 + <path path="${run.classpath}"/>
149.662 + </classpath>
149.663 + <syspropertyset>
149.664 + <propertyref prefix="run-sys-prop."/>
149.665 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
149.666 + </syspropertyset>
149.667 + <customize/>
149.668 + </java>
149.669 + </sequential>
149.670 + </macrodef>
149.671 + </target>
149.672 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
149.673 + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
149.674 + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
149.675 + </target>
149.676 + <!--
149.677 + end of pre NB7.2 profiling section
149.678 + -->
149.679 <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
149.680 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
149.681 <attribute default="${main.class}" name="name"/>
149.682 @@ -270,10 +777,14 @@
149.683 <attribute default="${debug.classpath}" name="classpath"/>
149.684 <element name="customize" optional="true"/>
149.685 <sequential>
149.686 - <java classname="@{classname}" dir="${work.dir}" fork="true">
149.687 + <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
149.688 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
149.689 <jvmarg line="${debug-args-line}"/>
149.690 <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
149.691 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
149.692 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
149.693 <jvmarg line="${run.jvmargs}"/>
149.694 + <jvmarg line="${run.jvmargs.ide}"/>
149.695 <classpath>
149.696 <path path="@{classpath}"/>
149.697 </classpath>
149.698 @@ -289,12 +800,18 @@
149.699 <target name="-init-macrodef-java">
149.700 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
149.701 <attribute default="${main.class}" name="classname"/>
149.702 + <attribute default="${run.classpath}" name="classpath"/>
149.703 + <attribute default="jvm" name="jvm"/>
149.704 <element name="customize" optional="true"/>
149.705 <sequential>
149.706 - <java classname="@{classname}" dir="${work.dir}" fork="true">
149.707 + <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
149.708 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
149.709 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
149.710 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
149.711 <jvmarg line="${run.jvmargs}"/>
149.712 + <jvmarg line="${run.jvmargs.ide}"/>
149.713 <classpath>
149.714 - <path path="${run.classpath}"/>
149.715 + <path path="@{classpath}"/>
149.716 </classpath>
149.717 <syspropertyset>
149.718 <propertyref prefix="run-sys-prop."/>
149.719 @@ -305,22 +822,105 @@
149.720 </sequential>
149.721 </macrodef>
149.722 </target>
149.723 + <target name="-init-macrodef-copylibs">
149.724 + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
149.725 + <attribute default="${manifest.file}" name="manifest"/>
149.726 + <element name="customize" optional="true"/>
149.727 + <sequential>
149.728 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
149.729 + <pathconvert property="run.classpath.without.build.classes.dir">
149.730 + <path path="${run.classpath}"/>
149.731 + <map from="${build.classes.dir.resolved}" to=""/>
149.732 + </pathconvert>
149.733 + <pathconvert pathsep=" " property="jar.classpath">
149.734 + <path path="${run.classpath.without.build.classes.dir}"/>
149.735 + <chainedmapper>
149.736 + <flattenmapper/>
149.737 + <filtermapper>
149.738 + <replacestring from=" " to="%20"/>
149.739 + </filtermapper>
149.740 + <globmapper from="*" to="lib/*"/>
149.741 + </chainedmapper>
149.742 + </pathconvert>
149.743 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
149.744 + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" manifestencoding="UTF-8" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
149.745 + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
149.746 + <manifest>
149.747 + <attribute name="Class-Path" value="${jar.classpath}"/>
149.748 + <customize/>
149.749 + </manifest>
149.750 + </copylibs>
149.751 + </sequential>
149.752 + </macrodef>
149.753 + </target>
149.754 <target name="-init-presetdef-jar">
149.755 <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
149.756 - <jar compress="${jar.compress}" jarfile="${dist.jar}">
149.757 - <j2seproject1:fileset dir="${build.classes.dir}"/>
149.758 + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifestencoding="UTF-8">
149.759 + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
149.760 </jar>
149.761 </presetdef>
149.762 </target>
149.763 - <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
149.764 + <target name="-init-ap-cmdline-properties">
149.765 + <property name="annotation.processing.enabled" value="true"/>
149.766 + <property name="annotation.processing.processors.list" value=""/>
149.767 + <property name="annotation.processing.processor.options" value=""/>
149.768 + <property name="annotation.processing.run.all.processors" value="true"/>
149.769 + <property name="javac.processorpath" value="${javac.classpath}"/>
149.770 + <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
149.771 + <condition property="ap.supported.internal" value="true">
149.772 + <not>
149.773 + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
149.774 + </not>
149.775 + </condition>
149.776 + </target>
149.777 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
149.778 + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
149.779 + <isfalse value="${annotation.processing.run.all.processors}"/>
149.780 + </condition>
149.781 + <condition else="" property="ap.proc.none.internal" value="-proc:none">
149.782 + <isfalse value="${annotation.processing.enabled}"/>
149.783 + </condition>
149.784 + </target>
149.785 + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
149.786 + <property name="ap.cmd.line.internal" value=""/>
149.787 + </target>
149.788 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
149.789 <!--
149.790 ===================
149.791 COMPILATION SECTION
149.792 ===================
149.793 -->
149.794 - <target depends="init" name="deps-jar" unless="no.deps">
149.795 - <ant antfile="${project.NBI_Engine}/build.xml" inheritall="false" target="jar"/>
149.796 - <ant antfile="${project.org_netbeans_modules_reglib}/build.xml" inheritall="false" target="netbeans"/>
149.797 + <target name="-deps-jar-init" unless="built-jar.properties">
149.798 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
149.799 + <delete file="${built-jar.properties}" quiet="true"/>
149.800 + </target>
149.801 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
149.802 + <echo level="warn" message="Cycle detected: Sun Studio Installer Engine was already built"/>
149.803 + </target>
149.804 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
149.805 + <mkdir dir="${build.dir}"/>
149.806 + <touch file="${built-jar.properties}" verbose="false"/>
149.807 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
149.808 + <antcall target="-warn-already-built-jar"/>
149.809 + <propertyfile file="${built-jar.properties}">
149.810 + <entry key="${basedir}" value=""/>
149.811 + </propertyfile>
149.812 + <antcall target="-maybe-call-dep">
149.813 + <param name="call.built.properties" value="${built-jar.properties}"/>
149.814 + <param location="${project.NBI_Engine}" name="call.subproject"/>
149.815 + <param location="${project.NBI_Engine}/build.xml" name="call.script"/>
149.816 + <param name="call.target" value="jar"/>
149.817 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
149.818 + <param name="transfer.not.archive.disabled" value="true"/>
149.819 + </antcall>
149.820 + <antcall target="-maybe-call-dep">
149.821 + <param name="call.built.properties" value="${built-jar.properties}"/>
149.822 + <param location="${project.org_netbeans_modules_reglib}" name="call.subproject"/>
149.823 + <param location="${project.org_netbeans_modules_reglib}/build.xml" name="call.script"/>
149.824 + <param name="call.target" value="netbeans"/>
149.825 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
149.826 + <param name="transfer.not.archive.disabled" value="true"/>
149.827 + </antcall>
149.828 </target>
149.829 <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
149.830 <target depends="init" name="-check-automatic-build">
149.831 @@ -337,15 +937,26 @@
149.832 <!-- You can override this target in the ../build.xml file. -->
149.833 </target>
149.834 <target if="do.depend.true" name="-compile-depend">
149.835 - <j2seproject3:depend/>
149.836 + <pathconvert property="build.generated.subdirs">
149.837 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
149.838 + <include name="*"/>
149.839 + </dirset>
149.840 + </pathconvert>
149.841 + <j2seproject3:depend srcdir="${src.dir}:${reglib.src.dir}:${build.generated.subdirs}"/>
149.842 </target>
149.843 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
149.844 - <j2seproject3:javac/>
149.845 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
149.846 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
149.847 <copy todir="${build.classes.dir}">
149.848 <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
149.849 <fileset dir="${reglib.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
149.850 </copy>
149.851 </target>
149.852 + <target if="has.persistence.xml" name="-copy-persistence-xml">
149.853 + <mkdir dir="${build.classes.dir}/META-INF"/>
149.854 + <copy todir="${build.classes.dir}/META-INF">
149.855 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
149.856 + </copy>
149.857 + </target>
149.858 <target name="-post-compile">
149.859 <!-- Empty placeholder for easier customization. -->
149.860 <!-- You can override this target in the ../build.xml file. -->
149.861 @@ -358,13 +969,13 @@
149.862 <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
149.863 <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
149.864 <j2seproject3:force-recompile/>
149.865 - <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}:${reglib.src.dir}"/>
149.866 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}:${reglib.src.dir}"/>
149.867 </target>
149.868 <target name="-post-compile-single">
149.869 <!-- Empty placeholder for easier customization. -->
149.870 <!-- You can override this target in the ../build.xml file. -->
149.871 </target>
149.872 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
149.873 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
149.874 <!--
149.875 ====================
149.876 JAR BUILDING SECTION
149.877 @@ -378,57 +989,67 @@
149.878 <!-- Empty placeholder for easier customization. -->
149.879 <!-- You can override this target in the ../build.xml file. -->
149.880 </target>
149.881 - <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
149.882 - <j2seproject1:jar/>
149.883 + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available">
149.884 + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
149.885 + <touch file="${tmp.manifest.file}" verbose="false"/>
149.886 </target>
149.887 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
149.888 - <j2seproject1:jar manifest="${manifest.file}"/>
149.889 + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest">
149.890 + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
149.891 + <copy encoding="${manifest.encoding}" file="${manifest.file}" outputencoding="UTF-8" tofile="${tmp.manifest.file}"/>
149.892 </target>
149.893 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
149.894 - <j2seproject1:jar manifest="${manifest.file}">
149.895 - <j2seproject1:manifest>
149.896 - <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
149.897 - </j2seproject1:manifest>
149.898 - </j2seproject1:jar>
149.899 - <echo>To run this application from the command line without Ant, try:</echo>
149.900 + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass">
149.901 + <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
149.902 + <attribute name="Main-Class" value="${main.class}"/>
149.903 + </manifest>
149.904 + </target>
149.905 + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile">
149.906 + <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
149.907 + <attribute name="Profile" value="${javac.profile}"/>
149.908 + </manifest>
149.909 + </target>
149.910 + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen">
149.911 + <basename file="${application.splash}" property="splashscreen.basename"/>
149.912 + <mkdir dir="${build.classes.dir}/META-INF"/>
149.913 + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
149.914 + <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
149.915 + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
149.916 + </manifest>
149.917 + </target>
149.918 + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs">
149.919 + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
149.920 + <echo level="info">To run this application from the command line without Ant, try:</echo>
149.921 + <property location="${dist.jar}" name="dist.jar.resolved"/>
149.922 + <echo level="info">java -jar "${dist.jar.resolved}"</echo>
149.923 + </target>
149.924 + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist">
149.925 + <j2seproject1:jar manifest="${tmp.manifest.file}"/>
149.926 <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
149.927 <property location="${dist.jar}" name="dist.jar.resolved"/>
149.928 <pathconvert property="run.classpath.with.dist.jar">
149.929 <path path="${run.classpath}"/>
149.930 <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
149.931 </pathconvert>
149.932 - <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
149.933 + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}">
149.934 + <isset property="main.class.available"/>
149.935 + </condition>
149.936 + <condition else="debug" property="jar.usage.level" value="info">
149.937 + <isset property="main.class.available"/>
149.938 + </condition>
149.939 + <echo level="${jar.usage.level}" message="${jar.usage.message}"/>
149.940 </target>
149.941 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
149.942 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
149.943 - <pathconvert property="run.classpath.without.build.classes.dir">
149.944 - <path path="${run.classpath}"/>
149.945 - <map from="${build.classes.dir.resolved}" to=""/>
149.946 - </pathconvert>
149.947 - <pathconvert pathsep=" " property="jar.classpath">
149.948 - <path path="${run.classpath.without.build.classes.dir}"/>
149.949 - <chainedmapper>
149.950 - <flattenmapper/>
149.951 - <globmapper from="*" to="lib/*"/>
149.952 - </chainedmapper>
149.953 - </pathconvert>
149.954 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
149.955 - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
149.956 - <fileset dir="${build.classes.dir}"/>
149.957 - <manifest>
149.958 - <attribute name="Main-Class" value="${main.class}"/>
149.959 - <attribute name="Class-Path" value="${jar.classpath}"/>
149.960 - </manifest>
149.961 - </copylibs>
149.962 - <echo>To run this application from the command line without Ant, try:</echo>
149.963 - <property location="${dist.jar}" name="dist.jar.resolved"/>
149.964 - <echo>java -jar "${dist.jar.resolved}"</echo>
149.965 + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest">
149.966 + <delete>
149.967 + <fileset file="${tmp.manifest.file}"/>
149.968 + </delete>
149.969 </target>
149.970 + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/>
149.971 + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/>
149.972 <target name="-post-jar">
149.973 <!-- Empty placeholder for easier customization. -->
149.974 <!-- You can override this target in the ../build.xml file. -->
149.975 </target>
149.976 - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
149.977 + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/>
149.978 + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/>
149.979 <!--
149.980 =================
149.981 EXECUTION SECTION
149.982 @@ -444,10 +1065,14 @@
149.983 <target name="-do-not-recompile">
149.984 <property name="javac.includes.binary" value=""/>
149.985 </target>
149.986 - <target depends="init,-do-not-recompile,compile-single" name="run-single">
149.987 + <target depends="init,compile-single" name="run-single">
149.988 <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
149.989 <j2seproject1:java classname="${run.class}"/>
149.990 </target>
149.991 + <target depends="init,compile-test-single" name="run-test-with-main">
149.992 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
149.993 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
149.994 + </target>
149.995 <!--
149.996 =================
149.997 DEBUGGING SECTION
149.998 @@ -456,6 +1081,9 @@
149.999 <target depends="init" if="netbeans.home" name="-debug-start-debugger">
149.1000 <j2seproject1:nbjpdastart name="${debug.class}"/>
149.1001 </target>
149.1002 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
149.1003 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
149.1004 + </target>
149.1005 <target depends="init,compile" name="-debug-start-debuggee">
149.1006 <j2seproject3:debug>
149.1007 <customize>
149.1008 @@ -472,7 +1100,12 @@
149.1009 <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
149.1010 <j2seproject3:debug classname="${debug.class}"/>
149.1011 </target>
149.1012 - <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
149.1013 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
149.1014 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
149.1015 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
149.1016 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
149.1017 + </target>
149.1018 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
149.1019 <target depends="init" name="-pre-debug-fix">
149.1020 <fail unless="fix.includes">Must set fix.includes</fail>
149.1021 <property name="javac.includes" value="${fix.includes}.java"/>
149.1022 @@ -482,23 +1115,149 @@
149.1023 </target>
149.1024 <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
149.1025 <!--
149.1026 + =================
149.1027 + PROFILING SECTION
149.1028 + =================
149.1029 + -->
149.1030 + <!--
149.1031 + pre NB7.2 profiler integration
149.1032 + -->
149.1033 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
149.1034 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
149.1035 + <nbprofiledirect>
149.1036 + <classpath>
149.1037 + <path path="${run.classpath}"/>
149.1038 + </classpath>
149.1039 + </nbprofiledirect>
149.1040 + <profile/>
149.1041 + </target>
149.1042 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
149.1043 + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
149.1044 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
149.1045 + <nbprofiledirect>
149.1046 + <classpath>
149.1047 + <path path="${run.classpath}"/>
149.1048 + </classpath>
149.1049 + </nbprofiledirect>
149.1050 + <profile classname="${profile.class}"/>
149.1051 + </target>
149.1052 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
149.1053 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
149.1054 + <nbprofiledirect>
149.1055 + <classpath>
149.1056 + <path path="${run.classpath}"/>
149.1057 + </classpath>
149.1058 + </nbprofiledirect>
149.1059 + <profile classname="sun.applet.AppletViewer">
149.1060 + <customize>
149.1061 + <arg value="${applet.url}"/>
149.1062 + </customize>
149.1063 + </profile>
149.1064 + </target>
149.1065 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
149.1066 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
149.1067 + <nbprofiledirect>
149.1068 + <classpath>
149.1069 + <path path="${run.test.classpath}"/>
149.1070 + </classpath>
149.1071 + </nbprofiledirect>
149.1072 + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
149.1073 + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
149.1074 + <jvmarg value="${profiler.info.jvmargs.agent}"/>
149.1075 + <jvmarg line="${profiler.info.jvmargs}"/>
149.1076 + <test name="${profile.class}"/>
149.1077 + <classpath>
149.1078 + <path path="${run.test.classpath}"/>
149.1079 + </classpath>
149.1080 + <syspropertyset>
149.1081 + <propertyref prefix="test-sys-prop."/>
149.1082 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
149.1083 + </syspropertyset>
149.1084 + <formatter type="brief" usefile="false"/>
149.1085 + <formatter type="xml"/>
149.1086 + </junit>
149.1087 + </target>
149.1088 + <!--
149.1089 + end of pre NB72 profiling section
149.1090 + -->
149.1091 + <target if="netbeans.home" name="-profile-check">
149.1092 + <condition property="profiler.configured">
149.1093 + <or>
149.1094 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
149.1095 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
149.1096 + </or>
149.1097 + </condition>
149.1098 + </target>
149.1099 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
149.1100 + <startprofiler/>
149.1101 + <antcall target="run"/>
149.1102 + </target>
149.1103 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
149.1104 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
149.1105 + <startprofiler/>
149.1106 + <antcall target="run-single"/>
149.1107 + </target>
149.1108 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
149.1109 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
149.1110 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
149.1111 + <startprofiler/>
149.1112 + <antcall target="test-single"/>
149.1113 + </target>
149.1114 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
149.1115 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
149.1116 + <startprofiler/>
149.1117 + <antcall target="run-test-with-main"/>
149.1118 + </target>
149.1119 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
149.1120 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
149.1121 + <startprofiler/>
149.1122 + <antcall target="run-applet"/>
149.1123 + </target>
149.1124 + <!--
149.1125 ===============
149.1126 JAVADOC SECTION
149.1127 ===============
149.1128 -->
149.1129 - <target depends="init" name="-javadoc-build">
149.1130 + <target depends="init" if="have.sources" name="-javadoc-build">
149.1131 <mkdir dir="${dist.javadoc.dir}"/>
149.1132 - <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
149.1133 + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
149.1134 + <and>
149.1135 + <isset property="endorsed.classpath.cmd.line.arg"/>
149.1136 + <not>
149.1137 + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
149.1138 + </not>
149.1139 + </and>
149.1140 + </condition>
149.1141 + <condition else="" property="bug5101868workaround" value="*.java">
149.1142 + <matches pattern="1\.[56](\..*)?" string="${java.version}"/>
149.1143 + </condition>
149.1144 + <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
149.1145 <classpath>
149.1146 <path path="${javac.classpath}"/>
149.1147 </classpath>
149.1148 - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
149.1149 + <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
149.1150 <filename name="**/*.java"/>
149.1151 </fileset>
149.1152 - <fileset dir="${reglib.src.dir}" excludes="${excludes}" includes="${includes}">
149.1153 + <fileset dir="${reglib.src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
149.1154 <filename name="**/*.java"/>
149.1155 </fileset>
149.1156 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
149.1157 + <include name="**/*.java"/>
149.1158 + <exclude name="*.java"/>
149.1159 + </fileset>
149.1160 + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
149.1161 </javadoc>
149.1162 + <copy todir="${dist.javadoc.dir}">
149.1163 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
149.1164 + <filename name="**/doc-files/**"/>
149.1165 + </fileset>
149.1166 + <fileset dir="${reglib.src.dir}" excludes="${excludes}" includes="${includes}">
149.1167 + <filename name="**/doc-files/**"/>
149.1168 + </fileset>
149.1169 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
149.1170 + <include name="**/doc-files/**"/>
149.1171 + </fileset>
149.1172 + </copy>
149.1173 </target>
149.1174 <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
149.1175 <nbbrowse file="${dist.javadoc.dir}/index.html"/>
149.1176 @@ -506,7 +1265,7 @@
149.1177 <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
149.1178 <!--
149.1179 =========================
149.1180 - JUNIT COMPILATION SECTION
149.1181 + TEST COMPILATION SECTION
149.1182 =========================
149.1183 -->
149.1184 <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
149.1185 @@ -519,8 +1278,8 @@
149.1186 <target if="do.depend.true" name="-compile-test-depend">
149.1187 <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
149.1188 </target>
149.1189 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
149.1190 - <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
149.1191 + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
149.1192 + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
149.1193 <copy todir="${build.test.classes.dir}">
149.1194 <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
149.1195 </copy>
149.1196 @@ -534,10 +1293,10 @@
149.1197 <!-- Empty placeholder for easier customization. -->
149.1198 <!-- You can override this target in the ../build.xml file. -->
149.1199 </target>
149.1200 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
149.1201 + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
149.1202 <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
149.1203 <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
149.1204 - <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
149.1205 + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
149.1206 <copy todir="${build.test.classes.dir}">
149.1207 <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
149.1208 </copy>
149.1209 @@ -549,17 +1308,17 @@
149.1210 <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
149.1211 <!--
149.1212 =======================
149.1213 - JUNIT EXECUTION SECTION
149.1214 + TEST EXECUTION SECTION
149.1215 =======================
149.1216 -->
149.1217 <target depends="init" if="have.tests" name="-pre-test-run">
149.1218 <mkdir dir="${build.test.results.dir}"/>
149.1219 </target>
149.1220 <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
149.1221 - <j2seproject3:junit testincludes="**/*Test.java"/>
149.1222 + <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/>
149.1223 </target>
149.1224 <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
149.1225 - <fail if="tests.failed">Some tests failed; see details above.</fail>
149.1226 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
149.1227 </target>
149.1228 <target depends="init" if="have.tests" name="test-report"/>
149.1229 <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
149.1230 @@ -569,39 +1328,40 @@
149.1231 </target>
149.1232 <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
149.1233 <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
149.1234 - <j2seproject3:junit excludes="" includes="${test.includes}"/>
149.1235 + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
149.1236 </target>
149.1237 <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
149.1238 - <fail if="tests.failed">Some tests failed; see details above.</fail>
149.1239 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
149.1240 </target>
149.1241 - <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
149.1242 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
149.1243 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
149.1244 + <fail unless="test.class">Must select some files in the IDE or set test.class</fail>
149.1245 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
149.1246 + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
149.1247 + </target>
149.1248 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
149.1249 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
149.1250 + </target>
149.1251 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
149.1252 <!--
149.1253 =======================
149.1254 - JUNIT DEBUGGING SECTION
149.1255 + TEST DEBUGGING SECTION
149.1256 =======================
149.1257 -->
149.1258 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
149.1259 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
149.1260 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
149.1261 - <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
149.1262 - <delete file="${test.report.file}"/>
149.1263 - <mkdir dir="${build.test.results.dir}"/>
149.1264 - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
149.1265 - <customize>
149.1266 - <syspropertyset>
149.1267 - <propertyref prefix="test-sys-prop."/>
149.1268 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
149.1269 - </syspropertyset>
149.1270 - <arg value="${test.class}"/>
149.1271 - <arg value="showoutput=true"/>
149.1272 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
149.1273 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
149.1274 - </customize>
149.1275 - </j2seproject3:debug>
149.1276 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
149.1277 + </target>
149.1278 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
149.1279 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
149.1280 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
149.1281 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
149.1282 </target>
149.1283 <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
149.1284 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
149.1285 </target>
149.1286 - <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
149.1287 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
149.1288 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
149.1289 <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
149.1290 <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
149.1291 </target>
149.1292 @@ -638,17 +1398,64 @@
149.1293 CLEANUP SECTION
149.1294 ===============
149.1295 -->
149.1296 - <target depends="init" name="deps-clean" unless="no.deps">
149.1297 - <ant antfile="${project.NBI_Engine}/build.xml" inheritall="false" target="clean"/>
149.1298 - <ant antfile="${project.org_netbeans_modules_reglib}/build.xml" inheritall="false" target="clean"/>
149.1299 + <target name="-deps-clean-init" unless="built-clean.properties">
149.1300 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
149.1301 + <delete file="${built-clean.properties}" quiet="true"/>
149.1302 + </target>
149.1303 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
149.1304 + <echo level="warn" message="Cycle detected: Sun Studio Installer Engine was already built"/>
149.1305 + </target>
149.1306 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
149.1307 + <mkdir dir="${build.dir}"/>
149.1308 + <touch file="${built-clean.properties}" verbose="false"/>
149.1309 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
149.1310 + <antcall target="-warn-already-built-clean"/>
149.1311 + <propertyfile file="${built-clean.properties}">
149.1312 + <entry key="${basedir}" value=""/>
149.1313 + </propertyfile>
149.1314 + <antcall target="-maybe-call-dep">
149.1315 + <param name="call.built.properties" value="${built-clean.properties}"/>
149.1316 + <param location="${project.NBI_Engine}" name="call.subproject"/>
149.1317 + <param location="${project.NBI_Engine}/build.xml" name="call.script"/>
149.1318 + <param name="call.target" value="clean"/>
149.1319 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
149.1320 + <param name="transfer.not.archive.disabled" value="true"/>
149.1321 + </antcall>
149.1322 + <antcall target="-maybe-call-dep">
149.1323 + <param name="call.built.properties" value="${built-clean.properties}"/>
149.1324 + <param location="${project.org_netbeans_modules_reglib}" name="call.subproject"/>
149.1325 + <param location="${project.org_netbeans_modules_reglib}/build.xml" name="call.script"/>
149.1326 + <param name="call.target" value="clean"/>
149.1327 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
149.1328 + <param name="transfer.not.archive.disabled" value="true"/>
149.1329 + </antcall>
149.1330 </target>
149.1331 <target depends="init" name="-do-clean">
149.1332 <delete dir="${build.dir}"/>
149.1333 - <delete dir="${dist.dir}"/>
149.1334 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
149.1335 </target>
149.1336 <target name="-post-clean">
149.1337 <!-- Empty placeholder for easier customization. -->
149.1338 <!-- You can override this target in the ../build.xml file. -->
149.1339 </target>
149.1340 <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
149.1341 + <target name="-check-call-dep">
149.1342 + <property file="${call.built.properties}" prefix="already.built."/>
149.1343 + <condition property="should.call.dep">
149.1344 + <and>
149.1345 + <not>
149.1346 + <isset property="already.built.${call.subproject}"/>
149.1347 + </not>
149.1348 + <available file="${call.script}"/>
149.1349 + </and>
149.1350 + </condition>
149.1351 + </target>
149.1352 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
149.1353 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
149.1354 + <propertyset>
149.1355 + <propertyref prefix="transfer."/>
149.1356 + <mapper from="transfer.*" to="*" type="glob"/>
149.1357 + </propertyset>
149.1358 + </ant>
149.1359 + </target>
149.1360 </project>
150.1 --- a/ssinstaller/engine/nbproject/genfiles.properties Sun Jun 25 18:17:37 2017 +0200
150.2 +++ b/ssinstaller/engine/nbproject/genfiles.properties Sun Jun 25 18:25:05 2017 +0200
150.3 @@ -4,5 +4,5 @@
150.4 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
150.5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
150.6 nbproject/build-impl.xml.data.CRC32=5ec25142
150.7 -nbproject/build-impl.xml.script.CRC32=c8bb3874
150.8 -nbproject/build-impl.xml.stylesheet.CRC32=61b4e419
150.9 +nbproject/build-impl.xml.script.CRC32=e32f5d42
150.10 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
151.1 --- a/ssinstaller/engine/nbproject/project.properties Sun Jun 25 18:17:37 2017 +0200
151.2 +++ b/ssinstaller/engine/nbproject/project.properties Sun Jun 25 18:25:05 2017 +0200
151.3 @@ -41,6 +41,7 @@
151.4 # This directory is removed when the project is cleaned:
151.5 build.dir=build
151.6 build.generated.dir=${build.dir}/generated
151.7 +build.generated.sources.dir=${build.dir}/generated-sources
151.8 # Only compile against the classpath explicitly listed here:
151.9 build.sysclasspath=ignore
151.10 build.test.classes.dir=${build.dir}/test/classes