Removing obsolette files in sandbox
authorJan Lahoda <jlahoda@netbeans.org>
Sun, 08 Jan 2017 20:10:28 +0100
changeset 103144e9c0d31754
parent 1030 fdec87296dbe
child 1032 2a4a93551a0f
Removing obsolette files in sandbox
sandbox/attributed-index-web/API.java
sandbox/attributed-index-web/Progress.java
sandbox/attributed-index-web/StandaloneFinder.java
sandbox/attributed-index-web/UI.java
sandbox/attributed-index-web/ui-apply.html
sandbox/attributed-index-web/ui-cat.html
sandbox/attributed-index-web/ui-findType.html
sandbox/attributed-index-web/ui-search.html
sandbox/attributed-index-web/ui-snippet.html
sandbox/java.hints/build.sh
sandbox/java.hints/build.xml
sandbox/java.hints/hintsimpl/build.xml
sandbox/java.hints/hintsimpl/manifest.mf
sandbox/java.hints/hintsimpl/nbproject/build-impl.xml
sandbox/java.hints/hintsimpl/nbproject/genfiles.properties
sandbox/java.hints/hintsimpl/nbproject/project.properties
sandbox/java.hints/hintsimpl/nbproject/project.xml
sandbox/java.hints/hintsimpl/nbproject/suite.properties
sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties
sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/GlobalyUnused.java
sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/NonPrivateMakeFinal.java
sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoring.java
sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoringAction.java
sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoringPlugin.java
sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoringUI.java
sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/RefactoringPluginFactoryImpl.java
sandbox/java.hints/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/GlobalyUnusedNGTest.java
sandbox/java.hints/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/NonPrivateMakeFinalNGTest.java
sandbox/java.hints/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/borrowed/RefactoringTestBase.java
sandbox/java.hints/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoringPluginTest.java
sandbox/java.hints/java.hints.test/apichanges.xml
sandbox/java.hints/java.hints.test/arch.xml
sandbox/java.hints/java.hints.test/build.xml
sandbox/java.hints/java.hints.test/manifest.mf
sandbox/java.hints/java.hints.test/nbproject/build-impl.xml
sandbox/java.hints/java.hints.test/nbproject/genfiles.properties
sandbox/java.hints/java.hints.test/nbproject/org-netbeans-modules-java-hints-test.sig
sandbox/java.hints/java.hints.test/nbproject/project.properties
sandbox/java.hints/java.hints.test/nbproject/project.xml
sandbox/java.hints/java.hints.test/nbproject/suite.properties
sandbox/java.hints/java.hints.test/src/org/netbeans/modules/java/hints/test/Bundle.properties
sandbox/java.hints/java.hints.test/src/org/netbeans/modules/java/hints/test/Utilities.java
sandbox/java.hints/java.hints.test/src/org/netbeans/modules/java/hints/test/api/HintTest.java
sandbox/java.hints/java.hints.test/src/org/netbeans/modules/parsing/impl/indexing/MimeTypes.java
sandbox/java.hints/java.hints.test/test/unit/src/org/netbeans/modules/java/hints/test/api/HintTestTest.java
sandbox/java.hints/nbproject/build-impl.xml
sandbox/java.hints/nbproject/genfiles.properties
sandbox/java.hints/nbproject/platform.properties
sandbox/java.hints/nbproject/platform.xml
sandbox/java.hints/nbproject/project.properties
sandbox/java.hints/nbproject/project.xml
sandbox/java.hints/spi.java.hints/apichanges.xml
sandbox/java.hints/spi.java.hints/arch.xml
sandbox/java.hints/spi.java.hints/build.xml
sandbox/java.hints/spi.java.hints/manifest.mf
sandbox/java.hints/spi.java.hints/nbproject/build-impl.xml
sandbox/java.hints/spi.java.hints/nbproject/genfiles.properties
sandbox/java.hints/spi.java.hints/nbproject/org-netbeans-spi-java-hints.sig
sandbox/java.hints/spi.java.hints/nbproject/project.properties
sandbox/java.hints/spi.java.hints/nbproject/project.xml
sandbox/java.hints/spi.java.hints/nbproject/suite.properties
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/jackpot/spi/Bundle.properties
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/jackpot/spi/HintsRunner.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/jackpot/spi/PatternConvertor.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/jackpot/spi/ProjectDependencyUpgrader.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/code/CodeHintProviderImpl.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/code/FSWrapper.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/code/ReflectiveCustomizerProvider.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/ClassPathBasedHintProvider.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/ElementBasedHintProvider.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/HintDescription.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/HintDescriptionFactory.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/HintMetadata.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/HintProvider.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/PositionRefresherHelper.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/Trigger.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Bundle.properties
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Hacks.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JackpotTrees.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JavaFixImpl.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JavaHintsPositionRefresher.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/MessageImpl.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/RulesManager.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/RulesManagerImpl.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/SPIAccessor.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/SyntheticFix.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchSearch.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchUtilities.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/ProgressHandleWrapper.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/Scopes.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/hints/GlobalProcessingContext.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/hints/HintsInvoker.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/hints/HintsTask.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/ipi/upgrade/ProjectDependencyUpgrader.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/options/HintsSettings.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/BulkSearch.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/CopyFinderBasedBulkSearch.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/NFA.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/NFABasedBulkSearch.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/PatternCompiler.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/processor/Bundle.properties
sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/processor/JavaHintsAnnotationProcessor.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/BooleanOption.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/Bundle.properties
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/ConstraintVariableType.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/CustomizerProvider.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/Decision.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/ErrorDescriptionFactory.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/Hint.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/HintContext.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/HintSeverity.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/IntegerOption.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFix.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFixUtilities.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/MatcherUtilities.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/TriggerDecision.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/TriggerPattern.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/TriggerPatterns.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/TriggerTreeKind.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/UseOptions.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/support/FixFactory.java
sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/support/TransformationSupport.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/providers/code/CodeHintProviderImplTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/providers/code/FSWrapperTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/providers/code/TestAnnotations.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/TestBase.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/TestCompilerSettings.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/TestUtilities.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/UtilitiesTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchSearchTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchUtilitiesTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/batch/ProgressHandleWrapperTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/batch/TestUtils.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/hints/HintsInvokerTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/BulkSearchTestPerformer.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/CopyFinderBasedBulkSearchTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/NFABasedBulkSearchTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/PatternCompilerTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/PatternCompilerUtilities.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/processor/JavaHintsAnnotationProcessorTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/JavaFixUtilitiesTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/MatcherUtilitiesTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/TestUtils.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/matching/CopyFinderTest.java
sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/support/FixFactoryTest.java
sandbox/nb-scripts/jackpot-to-nb
sandbox/nb-scripts/nb-jackpot-lib
sandbox/nb-scripts/nb-to-jackpot
sandbox/nb-scripts/nb-to-jackpot.mapping
sandbox/old-modules/api/build.xml
sandbox/old-modules/api/manifest.mf
sandbox/old-modules/api/nbproject/build-impl.xml
sandbox/old-modules/api/nbproject/genfiles.properties
sandbox/old-modules/api/nbproject/project.properties
sandbox/old-modules/api/nbproject/project.xml
sandbox/old-modules/api/nbproject/suite.properties
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/Bundle.properties
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/Example.java
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/ExamplesList.form
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/ExamplesList.java
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/LoadExamples.java
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/double-checked-locking.example
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/examples.list
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/lambda-candidate.example
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/new-string.example
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/hints/ExplicitFindDuplicates.java
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/Bundle.properties
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/examples_icon.png
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/layer.xml
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/recent_icon.png
sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/spi/Hacks.java
sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/TestBase.java
sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/LoadExamplesTest.java
sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/test-example1.example
sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/test-examples.list
sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/hints/ExplicitFindDuplicatesTest.java
sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/pm/BulkSearchPerformance.java
sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/pm/IndexBulkTest.java
sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/spi/refactoring/JackpotBasedRefactoringTestBase.java
sandbox/old-modules/bridges/refactoring/build.xml
sandbox/old-modules/bridges/refactoring/manifest.mf
sandbox/old-modules/bridges/refactoring/nbproject/build-impl.xml
sandbox/old-modules/bridges/refactoring/nbproject/genfiles.properties
sandbox/old-modules/bridges/refactoring/nbproject/project.properties
sandbox/old-modules/bridges/refactoring/nbproject/project.xml
sandbox/old-modules/bridges/refactoring/nbproject/suite.properties
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/Bundle.properties
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/ExtraData.java
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/GenerateScriptPanel.form
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/GenerateScriptPanel.java
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringActionsProviderExt.java
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringElementImpl.java
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringPluginFactoryImpl.java
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringPluginImpl.java
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringWrapper.java
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/ScriptGenerator.java
sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/layer.xml
sandbox/old-modules/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/RefactoringTestBase.java
sandbox/old-modules/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringPluginImplTest.java
sandbox/old-modules/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/ScriptGeneratorTest.java
sandbox/old-modules/help/build.xml
sandbox/old-modules/help/jackpot30-help.tex
sandbox/old-modules/help/jackpot30-helpset.xml
sandbox/old-modules/help/manifest.mf
sandbox/old-modules/help/nbproject-help.tex/build-settings.properties
sandbox/old-modules/help/nbproject/build-impl.xml
sandbox/old-modules/help/nbproject/genfiles.properties
sandbox/old-modules/help/nbproject/project.properties
sandbox/old-modules/help/nbproject/project.xml
sandbox/old-modules/help/nbproject/suite.properties
sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/Bundle.properties
sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/CreateMap.java
sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/jackpot30-helpset.xml
sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/layer.xml
sandbox/old-modules/hintsimpl/build.xml
sandbox/old-modules/hintsimpl/manifest.mf
sandbox/old-modules/hintsimpl/nbproject/build-impl.xml
sandbox/old-modules/hintsimpl/nbproject/genfiles.properties
sandbox/old-modules/hintsimpl/nbproject/project.properties
sandbox/old-modules/hintsimpl/nbproject/project.xml
sandbox/old-modules/hintsimpl/nbproject/suite.properties
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/abstract-document.hint
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/assert2if.hint
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/double-checked-locking.hint
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/AddConditionals.hint
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/EnhancedFor.hint
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/Bundle.properties
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/SafeConvertToSwitchString.java
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/java.util.Objects.hint
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/jdk7.upgrade
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/layer.xml
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/sync-on-non-final.hint
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/variable-decl-assignment.hint
sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/wrong-string-comparison.hint
sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/HintsTest.java
sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/abstract-document.test
sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/double-checked-locking.test
sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/AddConditionals.test
sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/EnhancedFor.test
sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/java.util.Objects.test
sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/wrong-string-comparison.test
sandbox/old-modules/kit/build.xml
sandbox/old-modules/kit/manifest.mf
sandbox/old-modules/kit/nbproject/build-impl.xml
sandbox/old-modules/kit/nbproject/genfiles.properties
sandbox/old-modules/kit/nbproject/project.properties
sandbox/old-modules/kit/nbproject/project.xml
sandbox/old-modules/kit/nbproject/suite.properties
sandbox/old-modules/kit/src/org/netbeans/modules/jackpot30/kit/Bundle.properties
sandbox/old-modules/overlays/netbeans
sandbox/old-modules/server/do-indexing
sandbox/old-modules/server/indexer/build.xml
sandbox/old-modules/server/indexer/manifest.mf
sandbox/old-modules/server/indexer/nbproject/build-impl.xml
sandbox/old-modules/server/indexer/nbproject/genfiles.properties
sandbox/old-modules/server/indexer/nbproject/project.properties
sandbox/old-modules/server/indexer/nbproject/project.xml
sandbox/old-modules/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/Index.java
sandbox/old-modules/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/StandaloneFinder.java
sandbox/old-modules/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/StandaloneIndexer.java
sandbox/old-modules/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/IndexTest.java
sandbox/old-modules/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/LargeScaleTester.java
sandbox/old-modules/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/StandaloneFinderTest.java
sandbox/old-modules/server/web.api/build.xml
sandbox/old-modules/server/web.api/manifest.mf
sandbox/old-modules/server/web.api/nbproject/build-impl.xml
sandbox/old-modules/server/web.api/nbproject/genfiles.properties
sandbox/old-modules/server/web.api/nbproject/project.properties
sandbox/old-modules/server/web.api/nbproject/project.xml
sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/API.java
sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/Main.java
sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/UI.java
sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-cat.html
sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-search.html
sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-snippet.html
sandbox/old-modules/server/web.api/test/org/netbeans/modules/jackpot30/server/webapi/APITest.java
sandbox/old-modules/transformer/build.xml
sandbox/old-modules/transformer/manifest.mf
sandbox/old-modules/transformer/nbproject/build-impl.xml
sandbox/old-modules/transformer/nbproject/genfiles.properties
sandbox/old-modules/transformer/nbproject/project.properties
sandbox/old-modules/transformer/nbproject/project.xml
sandbox/old-modules/transformer/nbproject/suite.properties
sandbox/old-modules/transformer/release/libs/annotations.jar
sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/Annotations.java
sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/TransformationHintProviderImpl.java
sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/Utilities.java
sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/resources/Bundle.properties
sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/resources/layer.xml
sandbox/old-modules/transformer/test/unit/src/org/netbeans/modules/jackpot30/transformers/TransformationHintProviderImplTest.java
     1.1 --- a/sandbox/attributed-index-web/API.java	Sun Jan 08 20:10:08 2017 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,572 +0,0 @@
     1.4 -/*
     1.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     1.6 - *
     1.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
     1.8 - *
     1.9 - * The contents of this file are subject to the terms of either the GNU
    1.10 - * General Public License Version 2 only ("GPL") or the Common
    1.11 - * Development and Distribution License("CDDL") (collectively, the
    1.12 - * "License"). You may not use this file except in compliance with the
    1.13 - * License. You can obtain a copy of the License at
    1.14 - * http://www.netbeans.org/cddl-gplv2.html
    1.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    1.16 - * specific language governing permissions and limitations under the
    1.17 - * License.  When distributing the software, include this License Header
    1.18 - * Notice in each file and include the License file at
    1.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    1.20 - * particular file as subject to the "Classpath" exception as provided
    1.21 - * by Sun in the GPL Version 2 section of the License file that
    1.22 - * accompanied this code. If applicable, add the following below the
    1.23 - * License Header, with the fields enclosed by brackets [] replaced by
    1.24 - * your own identifying information:
    1.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    1.26 - *
    1.27 - * If you wish your version of this file to be governed by only the CDDL
    1.28 - * or only the GPL Version 2, indicate your decision by adding
    1.29 - * "[Contributor] elects to include this software in this distribution
    1.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    1.31 - * single choice of license, a recipient has the option to distribute
    1.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    1.33 - * to extend the choice of license to its licensees as provided above.
    1.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    1.35 - * Version 2 license, then the option applies only if the new code is
    1.36 - * made subject to such option by the copyright holder.
    1.37 - *
    1.38 - * Contributor(s):
    1.39 - *
    1.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
    1.41 - */
    1.42 -
    1.43 -package org.netbeans.modules.jackpot30.backend.impl.api;
    1.44 -
    1.45 -import java.io.IOException;
    1.46 -import java.io.OutputStream;
    1.47 -import java.io.OutputStreamWriter;
    1.48 -import java.io.Writer;
    1.49 -import java.lang.reflect.Method;
    1.50 -import java.lang.reflect.Modifier;
    1.51 -import java.util.ArrayList;
    1.52 -import java.util.Arrays;
    1.53 -import java.util.Collection;
    1.54 -import java.util.Collections;
    1.55 -import java.util.EnumSet;
    1.56 -import java.util.HashMap;
    1.57 -import java.util.HashSet;
    1.58 -import java.util.LinkedHashMap;
    1.59 -import java.util.LinkedList;
    1.60 -import java.util.List;
    1.61 -import java.util.Map;
    1.62 -import java.util.Map.Entry;
    1.63 -import java.util.Set;
    1.64 -import java.util.concurrent.atomic.AtomicBoolean;
    1.65 -import java.util.concurrent.atomic.AtomicLong;
    1.66 -import javax.lang.model.element.TypeElement;
    1.67 -import javax.tools.Diagnostic;
    1.68 -import javax.tools.JavaFileObject;
    1.69 -import javax.ws.rs.DefaultValue;
    1.70 -import javax.ws.rs.GET;
    1.71 -import javax.ws.rs.Path;
    1.72 -import javax.ws.rs.Produces;
    1.73 -import javax.ws.rs.QueryParam;
    1.74 -import javax.ws.rs.WebApplicationException;
    1.75 -import javax.ws.rs.core.StreamingOutput;
    1.76 -import org.codeviation.pojson.Pojson;
    1.77 -import org.netbeans.api.java.classpath.ClassPath;
    1.78 -import org.netbeans.api.java.source.ClassIndex.NameKind;
    1.79 -import org.netbeans.api.java.source.ClassIndex.SearchScope;
    1.80 -import org.netbeans.api.java.source.ClasspathInfo;
    1.81 -import org.netbeans.api.java.source.CompilationController;
    1.82 -import org.netbeans.api.java.source.ElementHandle;
    1.83 -import org.netbeans.api.java.source.ModificationResult;
    1.84 -import org.netbeans.modules.jackpot30.backend.impl.CategoryStorage;
    1.85 -import org.netbeans.modules.jackpot30.impl.examples.Example;
    1.86 -import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
    1.87 -import org.netbeans.modules.jackpot30.impl.examples.LoadExamples;
    1.88 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
    1.89 -import org.netbeans.modules.jackpot30.impl.indexing.Index;
    1.90 -import org.netbeans.modules.jackpot30.spi.PatternConvertor;
    1.91 -import org.netbeans.modules.java.hints.jackpot.impl.MessageImpl;
    1.92 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchSearch;
    1.93 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchSearch.BatchResult;
    1.94 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchSearch.Resource;
    1.95 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchUtilities;
    1.96 -import org.netbeans.modules.java.hints.jackpot.impl.batch.ProgressHandleWrapper;
    1.97 -import org.netbeans.modules.java.hints.jackpot.impl.batch.Scopes;
    1.98 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
    1.99 -import org.netbeans.modules.java.source.usages.ClassIndexManager;
   1.100 -import org.netbeans.modules.jumpto.type.GoToTypeAction;
   1.101 -import org.netbeans.spi.editor.hints.ErrorDescription;
   1.102 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
   1.103 -import org.openide.filesystems.FileObject;
   1.104 -import org.openide.filesystems.FileUtil;
   1.105 -import org.openide.util.Exceptions;
   1.106 -
   1.107 -/**
   1.108 - *
   1.109 - * @author lahvac
   1.110 - */
   1.111 -@Path("/index")
   1.112 -public class API {
   1.113 -
   1.114 -    @GET
   1.115 -    @Path("/find")
   1.116 -    @Produces("text/plain")
   1.117 -    //TODO: parameter for "verified"?
   1.118 -    public String find(@QueryParam("path") String segment, @QueryParam("pattern") String pattern, @QueryParam("asynchronous") @DefaultValue(value="false") boolean asynchronous) throws IOException {
   1.119 -        assert !asynchronous;
   1.120 -
   1.121 -        Iterable<? extends HintDescription> hints = PatternConvertor.create(pattern);
   1.122 -        Set<FileObject> srcRoots = CategoryStorage.getCategoryContent(segment);
   1.123 -        final FileObject deepestCommonParent = deepestCommonParent(srcRoots);
   1.124 -        BatchResult batchResult = BatchSearch.findOccurrences(hints, Scopes.specifiedFoldersScope(srcRoots.toArray(new FileObject[0])));
   1.125 -        final StringBuilder result = new StringBuilder();
   1.126 -
   1.127 -        BatchSearch.getVerifiedSpans(batchResult, new ProgressHandleWrapper(1), new BatchSearch.VerifiedSpansCallBack() {
   1.128 -            @Override public void groupStarted() {}
   1.129 -            @Override public boolean spansVerified(CompilationController wc, Resource r, Collection<? extends ErrorDescription> hints) throws Exception {
   1.130 -                if (!hints.isEmpty()) {
   1.131 -                    result.append(FileUtil.getRelativePath(deepestCommonParent, r.getResolvedFile()));
   1.132 -                    result.append("\n");
   1.133 -                }
   1.134 -                return true;
   1.135 -            }
   1.136 -            @Override public void groupFinished() {}
   1.137 -            @Override public void cannotVerifySpan(Resource r) { /*TODO: warn user?*/ }
   1.138 -        }, true, new LinkedList<MessageImpl>()); //TODO: show the messages to the user?
   1.139 -
   1.140 -        return result.toString();
   1.141 -    }
   1.142 -
   1.143 -    @GET
   1.144 -    @Path("/findWithSpans")
   1.145 -    @Produces("text/plain")
   1.146 -    //TODO: parameter for "verified"?
   1.147 -    public String findWithSpans(@QueryParam("path") String segment, @QueryParam("pattern") String pattern, @QueryParam("asynchronous") @DefaultValue(value="false") boolean asynchronous) throws IOException {
   1.148 -        assert !asynchronous;
   1.149 -
   1.150 -        Iterable<? extends HintDescription> hints = PatternConvertor.create(pattern);
   1.151 -        Set<FileObject> srcRoots = CategoryStorage.getCategoryContent(segment);
   1.152 -        final FileObject deepestCommonParent = deepestCommonParent(srcRoots);
   1.153 -        BatchResult batchResult = BatchSearch.findOccurrences(hints, Scopes.specifiedFoldersScope(srcRoots.toArray(new FileObject[0])));
   1.154 -        final Map<String, int[][]> result = new HashMap<String, int[][]>();
   1.155 -
   1.156 -        BatchSearch.getVerifiedSpans(batchResult, new ProgressHandleWrapper(1), new BatchSearch.VerifiedSpansCallBack() {
   1.157 -            @Override public void groupStarted() {}
   1.158 -            @Override public boolean spansVerified(CompilationController wc, Resource r, Collection<? extends ErrorDescription> hints) throws Exception {
   1.159 -                if (!hints.isEmpty()) {
   1.160 -                    int[][] spans = new int[hints.size()][];
   1.161 -                    int i = 0;
   1.162 -
   1.163 -                    for (ErrorDescription ed : hints) {
   1.164 -                        spans[i++] = new int[] {
   1.165 -                            ed.getRange().getBegin().getOffset(),
   1.166 -                            ed.getRange().getEnd().getOffset()
   1.167 -                        };
   1.168 -                    }
   1.169 -
   1.170 -                    result.put(FileUtil.getRelativePath(deepestCommonParent, r.getResolvedFile()), spans);
   1.171 -                }
   1.172 -                return true;
   1.173 -            }
   1.174 -            @Override public void groupFinished() {}
   1.175 -            @Override public void cannotVerifySpan(Resource r) { /*TODO: warn user?*/ }
   1.176 -        }, true, new LinkedList<MessageImpl>()); //TODO: show the messages to the user?
   1.177 -
   1.178 -        return Pojson.save(result);
   1.179 -    }
   1.180 -
   1.181 -//    @GET
   1.182 -//    @Path("/findCategorize")
   1.183 -//    @Produces("text/plain")
   1.184 -//    public String findCategorize(@QueryParam("path") final String segment, @QueryParam("pattern") final String pattern, @QueryParam("asynchronous") @DefaultValue(value="false") boolean asynchronous) throws IOException {
   1.185 -//        assert asynchronous;
   1.186 -//
   1.187 -//        long id = this.id.getAndIncrement();
   1.188 -//        final ProgressImpl progress = new ProgressImpl();
   1.189 -//
   1.190 -//        workInProgress.put(id, progress);
   1.191 -//
   1.192 -//        new Thread(new Runnable() {
   1.193 -//            public void run() {
   1.194 -//                try {
   1.195 -//                    File sourceRoot = Cache.sourceRootForKey(segment);
   1.196 -//                    Index idx = FileBasedIndex.get(sourceRoot.toURI().toURL());
   1.197 -//                    new SortedQuery().query(idx, pattern, progress);
   1.198 -//                } catch (IOException ex) {
   1.199 -//                    ex.printStackTrace();
   1.200 -//                    progress.finish();
   1.201 -//                }
   1.202 -//            }
   1.203 -//        }).start();
   1.204 -//
   1.205 -//        return Long.toString(id);
   1.206 -//    }
   1.207 -
   1.208 -    @GET
   1.209 -    @Path("/findSpans")
   1.210 -    @Produces("text/plain")
   1.211 -    public String findSpans(@QueryParam("path") String segment, @QueryParam("relativePath") String relativePath, @QueryParam("pattern") String pattern) throws IOException {
   1.212 -        Iterable<? extends HintDescription> hints = PatternConvertor.create(pattern);
   1.213 -        Set<FileObject> srcRoots = CategoryStorage.getCategoryContent(segment);
   1.214 -        FileObject deepestCommonParent = deepestCommonParent(srcRoots);
   1.215 -        BatchResult batchResult = BatchSearch.findOccurrences(hints, Scopes.specifiedFoldersScope(deepestCommonParent.getFileObject(relativePath)));
   1.216 -        final StringBuilder result = new StringBuilder();
   1.217 -
   1.218 -        BatchSearch.getVerifiedSpans(batchResult, new ProgressHandleWrapper(1), new BatchSearch.VerifiedSpansCallBack() {
   1.219 -            @Override public void groupStarted() {}
   1.220 -            @Override public boolean spansVerified(CompilationController wc, Resource r, Collection<? extends ErrorDescription> hints) throws Exception {
   1.221 -                for (ErrorDescription ed : hints) {
   1.222 -                    result.append(ed.getRange().getBegin().getOffset());
   1.223 -                    result.append(":");
   1.224 -                    result.append(ed.getRange().getEnd().getOffset());
   1.225 -                    result.append(":");
   1.226 -                }
   1.227 -                return true;
   1.228 -            }
   1.229 -            @Override public void groupFinished() {}
   1.230 -            @Override public void cannotVerifySpan(Resource r) { /*TODO: warn user?*/ }
   1.231 -        }, true, new LinkedList<MessageImpl>()); //TODO: show the messages to the user?
   1.232 -
   1.233 -        if (result.length() > 0) {
   1.234 -            result.delete(result.length() - 1, result.length());
   1.235 -        }
   1.236 -        return result.toString();
   1.237 -    }
   1.238 -
   1.239 -    @GET
   1.240 -    @Path("/list")
   1.241 -    @Produces("text/plain")
   1.242 -    public String list() throws IOException {
   1.243 -        StringBuilder sb = new StringBuilder();
   1.244 -
   1.245 -        for (Entry<String, String> e : CategoryStorage.listCategoriesWithNames().entrySet()) {
   1.246 -            sb.append(e.getKey());
   1.247 -            sb.append(":");
   1.248 -            sb.append(e.getValue());
   1.249 -            sb.append("\n");
   1.250 -        }
   1.251 -
   1.252 -        return sb.toString();
   1.253 -    }
   1.254 -
   1.255 -    @GET
   1.256 -    @Path("/cat")
   1.257 -    @Produces("text/plain")
   1.258 -    public String cat(@QueryParam("path") String segment, @QueryParam("relative") String relative) throws IOException {
   1.259 -        Set<FileObject> srcRoots = CategoryStorage.getCategoryContent(segment);
   1.260 -        FileObject deepestCommonParent = deepestCommonParent(srcRoots);
   1.261 -        FileObject file = deepestCommonParent.getFileObject(relative);
   1.262 -        ClassPath cp = ClassPathSupport.createClassPath(srcRoots.toArray(new FileObject[0]));
   1.263 -        FileObject root = cp.findOwnerRoot(file);
   1.264 -        String path = cp.getResourceName(file);
   1.265 -        Index index = FileBasedIndex.get(root.getURL());
   1.266 -
   1.267 -        if (index == null) {
   1.268 -            throw new IOException("No index");
   1.269 -        }
   1.270 -
   1.271 -        CharSequence source = index.getSourceCode(path);
   1.272 -
   1.273 -        if (source == null) {
   1.274 -            throw new IOException("Source code not found");
   1.275 -        }
   1.276 -        
   1.277 -        return source.toString().replaceAll("\r\n", "\n");
   1.278 -    }
   1.279 -
   1.280 -    @GET
   1.281 -    @Path("/apply")
   1.282 -    @Produces("text/diff")
   1.283 -    //TODO: parameter for "verified"?
   1.284 -    public StreamingOutput apply(@QueryParam("path") String segment, @QueryParam("pattern") String pattern, @QueryParam("asynchronous") @DefaultValue(value="false") boolean asynchronous) throws IOException {
   1.285 -        assert !asynchronous;
   1.286 -
   1.287 -        Iterable<? extends HintDescription> hints = PatternConvertor.create(pattern);
   1.288 -        Set<FileObject> srcRoots = CategoryStorage.getCategoryContent(segment);
   1.289 -        final FileObject deepestCommonParent = deepestCommonParent(srcRoots);
   1.290 -        BatchResult batchResult = BatchSearch.findOccurrences(hints, Scopes.specifiedFoldersScope(srcRoots.toArray(new FileObject[0])));
   1.291 -        final Collection<ModificationResult> modifications = BatchUtilities.applyFixes(batchResult, new ProgressHandleWrapper(1), new AtomicBoolean(), new LinkedList<MessageImpl>());
   1.292 -
   1.293 -        return new StreamingOutput() {
   1.294 -            @Override public void write(OutputStream output) throws IOException, WebApplicationException {
   1.295 -                Writer w = new OutputStreamWriter(output, "UTF-8");
   1.296 -
   1.297 -                try {
   1.298 -                    for (ModificationResult modResult : modifications) {
   1.299 -                        org.netbeans.modules.jackpot30.impl.batch.BatchUtilities.exportDiff(modResult, deepestCommonParent, w);
   1.300 -                    }
   1.301 -                } finally {
   1.302 -                    try {
   1.303 -                        w.close();
   1.304 -                    } catch (IOException ex) {
   1.305 -                        Exceptions.printStackTrace(ex);
   1.306 -                    }
   1.307 -                }
   1.308 -            }
   1.309 -        };
   1.310 -    }
   1.311 -
   1.312 -//    @GET
   1.313 -//    @Path("/info")
   1.314 -//    @Produces("text/plain")
   1.315 -//    public String info(@QueryParam("path") String segment) throws IOException {
   1.316 -//        URL sourceRoot = Cache.sourceRootForKey(segment).toURI().toURL();
   1.317 -//        Index index = FileBasedIndex.get(sourceRoot);
   1.318 -//
   1.319 -//        if (index == null) {
   1.320 -//            throw new IOException("No index");
   1.321 -//        }
   1.322 -//
   1.323 -//        return Pojson.save(index.getIndexInfo());
   1.324 -//    }
   1.325 -
   1.326 -    @GET
   1.327 -    @Path("/examples")
   1.328 -    @Produces("text/plain")
   1.329 -    public String examples() throws IOException {
   1.330 -        List<Map<String, String>> examples = new LinkedList<Map<String, String>>();
   1.331 -
   1.332 -        for (Example ex : LoadExamples.loadExamples()) {
   1.333 -            if (ex.getOptions().contains(Option.VERIFY) || ex.getOptions().contains(Option.FIX)) continue;
   1.334 -            Map<String, String> desc = new HashMap<String, String>();
   1.335 -
   1.336 -            desc.put("displayName", ex.getDisplayName());
   1.337 -            desc.put("pattern", ex.getCode());
   1.338 -
   1.339 -            examples.add(desc);
   1.340 -        }
   1.341 -
   1.342 -        return Pojson.save(examples);
   1.343 -    }
   1.344 -
   1.345 -    @GET
   1.346 -    @Path("/errors")
   1.347 -    @Produces("text/plain")
   1.348 -    public String errors(@QueryParam("pattern") String pattern) throws IOException {
   1.349 -        StringBuilder sb = new StringBuilder();
   1.350 -
   1.351 -        for (Diagnostic<? extends JavaFileObject> d : StandaloneFinder.parseAndReportErrors(pattern)) {
   1.352 -            sb.append(d.getMessage(null));
   1.353 -            sb.append("\n");
   1.354 -        }
   1.355 -
   1.356 -        return sb.toString();
   1.357 -    }
   1.358 -
   1.359 -    @GET
   1.360 -    @Path("/findDuplicates")
   1.361 -    @Produces("text/plain")
   1.362 -    public String findDuplicates(@QueryParam("path") String segment, @QueryParam("hashes") String hashes) throws IOException {
   1.363 -        Map<String, Map<String, Collection<String>>> hash2Segment2Contains = new HashMap<String, Map<String, Collection<String>>>();
   1.364 -        Collection<String> segments = new LinkedList<String>();
   1.365 -
   1.366 -        if (segment != null) segments.add(segment);
   1.367 -        else {
   1.368 -            segments.addAll(CategoryStorage.listCategoriesWithNames().keySet());
   1.369 -        }
   1.370 -
   1.371 -        Iterable<? extends String> hashesList = Arrays.asList(Pojson.load(String[].class, hashes));
   1.372 -
   1.373 -        for (String seg : segments) {
   1.374 -            Set<FileObject> srcRoots = CategoryStorage.getCategoryContent(seg);
   1.375 -            final FileObject deepestCommonParent = deepestCommonParent(srcRoots);
   1.376 -
   1.377 -            for (FileObject root : srcRoots) {
   1.378 -                Map<String, Collection<? extends String>> found = StandaloneFinder.containsHash(FileUtil.toFile(root), hashesList);
   1.379 -
   1.380 -                for (Entry<String, Collection<? extends String>> e : found.entrySet()) {
   1.381 -                    Map<String, Collection<String>> perRoot = hash2Segment2Contains.get(e.getKey());
   1.382 -
   1.383 -                    if (perRoot == null) {
   1.384 -                        hash2Segment2Contains.put(e.getKey(), perRoot = new HashMap<String, Collection<String>>());
   1.385 -                    }
   1.386 -
   1.387 -                    Collection<String> rel = perRoot.get(seg);
   1.388 -
   1.389 -                    if (rel == null) {
   1.390 -                        perRoot.put(seg, rel = new ArrayList<String>(e.getValue().size()));
   1.391 -                    }
   1.392 -
   1.393 -                    for (String r : e.getValue()) {
   1.394 -                        rel.add(FileUtil.getRelativePath(deepestCommonParent, root.getFileObject(r)));
   1.395 -                    }
   1.396 -                }
   1.397 -            }
   1.398 -        }
   1.399 -
   1.400 -        return Pojson.save(hash2Segment2Contains);
   1.401 -    }
   1.402 -
   1.403 -    @GET
   1.404 -    @Path("/checkProgress")
   1.405 -    @Produces("text/plain")
   1.406 -    public String checkProgress(@QueryParam("id") long id) throws IOException {
   1.407 -        ProgressImpl progress = workInProgress.get(id);
   1.408 -        Map<String, Object> result;
   1.409 -
   1.410 -        if (progress == null) {
   1.411 -            result = new HashMap<String, Object>();
   1.412 -            result.put("total", 0);
   1.413 -            result.put("workDone", 0);
   1.414 -            result.put("finished", true);
   1.415 -            result.put("result", Collections.<String>emptyList());
   1.416 -        } else {
   1.417 -            result = progress.progressPacket();
   1.418 -        }
   1.419 -
   1.420 -        if (result.get("finished") == Boolean.TRUE) {
   1.421 -            workInProgress.remove(id);
   1.422 -        }
   1.423 -
   1.424 -        return Pojson.save(result);
   1.425 -    }
   1.426 -
   1.427 -    @GET
   1.428 -    @Path("/cancelProgress")
   1.429 -    @Produces("text/plain")
   1.430 -    public String cancelProgress(@QueryParam("id") long id) throws IOException {
   1.431 -        ProgressImpl progress = workInProgress.get(id);
   1.432 -
   1.433 -        if (progress != null) {
   1.434 -            progress.cancel.set(true);
   1.435 -        }
   1.436 -
   1.437 -        return "done";
   1.438 -    }
   1.439 -
   1.440 -    @GET
   1.441 -    @Path("/capabilities")
   1.442 -    @Produces("text/plain")
   1.443 -    public String capabilities() throws IOException {
   1.444 -        Map<String, Object> result = new HashMap<String, Object>();
   1.445 -        List<String> methods = new ArrayList<String>(API.class.getDeclaredMethods().length);
   1.446 -
   1.447 -        for (Method m : API.class.getDeclaredMethods()) {
   1.448 -            if (m.isAnnotationPresent(GET.class) && (m.getModifiers() & Modifier.PUBLIC) != 0) {
   1.449 -                methods.add(m.getName());
   1.450 -            }
   1.451 -        }
   1.452 -
   1.453 -        result.put("methods", methods);
   1.454 -        result.put("attributed", true);
   1.455 -
   1.456 -        return Pojson.save(result);
   1.457 -    }
   1.458 -
   1.459 -    @GET
   1.460 -    @Path("/findType")
   1.461 -    @Produces("text/plain")
   1.462 -    public String findType(@QueryParam("path") String segment, @QueryParam("prefix") String prefix, @QueryParam("casesensitive") @DefaultValue("false") boolean casesensitive, @QueryParam("asynchronous") @DefaultValue(value="false") boolean asynchronous) throws IOException {
   1.463 -        assert !asynchronous;
   1.464 -
   1.465 -        //copied (and converted to NameKind) from jumpto's GoToTypeAction:
   1.466 -        boolean exact = prefix.endsWith(" "); // NOI18N
   1.467 -
   1.468 -        prefix = prefix.trim();
   1.469 -
   1.470 -        if ( prefix.length() == 0) {
   1.471 -            return "";
   1.472 -        }
   1.473 -
   1.474 -        NameKind nameKind;
   1.475 -        int wildcard = GoToTypeAction.containsWildCard(prefix);
   1.476 -
   1.477 -        if (exact) {
   1.478 -            //nameKind = panel.isCaseSensitive() ? SearchType.EXACT_NAME : SearchType.CASE_INSENSITIVE_EXACT_NAME;
   1.479 -            nameKind = NameKind.SIMPLE_NAME;
   1.480 -        }
   1.481 -        else if ((GoToTypeAction.isAllUpper(prefix) && prefix.length() > 1) || GoToTypeAction.isCamelCase(prefix)) {
   1.482 -            nameKind = NameKind.CAMEL_CASE;
   1.483 -        }
   1.484 -        else if (wildcard != -1) {
   1.485 -            nameKind = casesensitive ? NameKind.REGEXP : NameKind.CASE_INSENSITIVE_REGEXP;
   1.486 -        }
   1.487 -        else {
   1.488 -            nameKind = casesensitive ? NameKind.PREFIX : NameKind.CASE_INSENSITIVE_PREFIX;
   1.489 -        }
   1.490 -
   1.491 -        Map<String, List<String>> result = new LinkedHashMap<String, List<String>>();
   1.492 -        Set<FileObject> srcRoots = CategoryStorage.getCategoryContent(segment);
   1.493 -        FileObject deepestCommonParent = deepestCommonParent(srcRoots);
   1.494 -
   1.495 -        for (FileObject srcRoot : srcRoots) {
   1.496 -            String rootId = FileUtil.getRelativePath(deepestCommonParent, srcRoot);
   1.497 -            List<String> currentResult = new ArrayList<String>();
   1.498 -
   1.499 -            result.put(rootId, currentResult);
   1.500 -
   1.501 -            ClassIndexManager.getDefault().createUsagesQuery(srcRoot.getURL(), true);
   1.502 -            ClasspathInfo cpInfo = ClasspathInfo.create(ClassPath.EMPTY, ClassPath.EMPTY, ClassPathSupport.createClassPath(srcRoot));
   1.503 -            Set<ElementHandle<TypeElement>> names = new HashSet<ElementHandle<TypeElement>>(cpInfo.getClassIndex().getDeclaredTypes(prefix, nameKind, EnumSet.of(SearchScope.SOURCE)));
   1.504 -
   1.505 -            if (nameKind == NameKind.CAMEL_CASE) {
   1.506 -                names.addAll(cpInfo.getClassIndex().getDeclaredTypes(prefix, NameKind.CASE_INSENSITIVE_PREFIX, EnumSet.of(SearchScope.SOURCE)));
   1.507 -            }
   1.508 -
   1.509 -            for (ElementHandle<TypeElement> d : names) {
   1.510 -                currentResult.add(d.getBinaryName());
   1.511 -            }
   1.512 -        }
   1.513 -
   1.514 -        return Pojson.save(result);
   1.515 -    }
   1.516 -
   1.517 -    //XXX: not really correct, a base directory(-ies?) should be set in the category!
   1.518 -    private static FileObject deepestCommonParent(Set<FileObject> roots) {
   1.519 -        FileObject result = null;
   1.520 -
   1.521 -        for (FileObject r : roots) {
   1.522 -            if (result == null) {
   1.523 -                result = r;
   1.524 -            } else {
   1.525 -                while (!FileUtil.isParentOf(result, r)) {
   1.526 -                    result = result.getParent();
   1.527 -                }
   1.528 -            }
   1.529 -        }
   1.530 -
   1.531 -        return result;
   1.532 -    }
   1.533 -
   1.534 -    private final static AtomicLong id = new AtomicLong();
   1.535 -    private final static Map<Long, ProgressImpl> workInProgress = new HashMap<Long, ProgressImpl>();//XXX: should be cleared eventually even if not read
   1.536 -
   1.537 -    private static final class ProgressImpl implements Progress {
   1.538 -        private int total = -1;
   1.539 -        private int workDone = 0;
   1.540 -        private boolean finished;
   1.541 -        private final List<String> result = new ArrayList<String>();
   1.542 -        private final AtomicBoolean cancel = new AtomicBoolean();
   1.543 -        public synchronized void setTotalWork(int total) {
   1.544 -            this.total = total;
   1.545 -        }
   1.546 -        public synchronized void progress(int totalDone) {
   1.547 -            workDone = totalDone;
   1.548 -        }
   1.549 -        public synchronized void updateProgress(int updateDone) {
   1.550 -            workDone += updateDone;
   1.551 -        }
   1.552 -        public synchronized void addResultPart(String part) {
   1.553 -            result.add(part);
   1.554 -        }
   1.555 -        public synchronized void finish() {
   1.556 -            finished = true;
   1.557 -        }
   1.558 -        public synchronized boolean isCancelled() {
   1.559 -            return cancel.get();
   1.560 -        }
   1.561 -        synchronized Map<String, Object> progressPacket() {
   1.562 -            Map<String, Object> result = new HashMap<String, Object>();
   1.563 -
   1.564 -            result.put("total", total);
   1.565 -            result.put("workDone", workDone);
   1.566 -            result.put("finished", finished);
   1.567 -            result.put("result", new ArrayList<String>(this.result));
   1.568 -
   1.569 -            this.result.clear();
   1.570 -
   1.571 -            return result;
   1.572 -        }
   1.573 -    }
   1.574 -
   1.575 -}
     2.1 --- a/sandbox/attributed-index-web/Progress.java	Sun Jan 08 20:10:08 2017 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,60 +0,0 @@
     2.4 -/*
     2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     2.6 - *
     2.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
     2.8 - *
     2.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    2.10 - * Other names may be trademarks of their respective owners.
    2.11 - *
    2.12 - * The contents of this file are subject to the terms of either the GNU
    2.13 - * General Public License Version 2 only ("GPL") or the Common
    2.14 - * Development and Distribution License("CDDL") (collectively, the
    2.15 - * "License"). You may not use this file except in compliance with the
    2.16 - * License. You can obtain a copy of the License at
    2.17 - * http://www.netbeans.org/cddl-gplv2.html
    2.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    2.19 - * specific language governing permissions and limitations under the
    2.20 - * License.  When distributing the software, include this License Header
    2.21 - * Notice in each file and include the License file at
    2.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    2.23 - * particular file as subject to the "Classpath" exception as provided
    2.24 - * by Oracle in the GPL Version 2 section of the License file that
    2.25 - * accompanied this code. If applicable, add the following below the
    2.26 - * License Header, with the fields enclosed by brackets [] replaced by
    2.27 - * your own identifying information:
    2.28 - * "Portions Copyrighted [year] [name of copyright owner]"
    2.29 - *
    2.30 - * If you wish your version of this file to be governed by only the CDDL
    2.31 - * or only the GPL Version 2, indicate your decision by adding
    2.32 - * "[Contributor] elects to include this software in this distribution
    2.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    2.34 - * single choice of license, a recipient has the option to distribute
    2.35 - * your version of this file under either the CDDL, the GPL Version 2 or
    2.36 - * to extend the choice of license to its licensees as provided above.
    2.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    2.38 - * Version 2 license, then the option applies only if the new code is
    2.39 - * made subject to such option by the copyright holder.
    2.40 - *
    2.41 - * Contributor(s):
    2.42 - *
    2.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
    2.44 - */
    2.45 -
    2.46 -package org.netbeans.modules.jackpot30.backend.impl.api;
    2.47 -
    2.48 -/**
    2.49 - *
    2.50 - * @author lahvac
    2.51 - */
    2.52 -public interface Progress {
    2.53 -
    2.54 -    public void setTotalWork(int total);
    2.55 -    public void progress(int totalDone);
    2.56 -    public void updateProgress(int updateDone);
    2.57 -    public void addResultPart(String part);
    2.58 -    public void finish();
    2.59 -    
    2.60 -    public boolean isCancelled();
    2.61 -
    2.62 -
    2.63 -}
     3.1 --- a/sandbox/attributed-index-web/StandaloneFinder.java	Sun Jan 08 20:10:08 2017 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,213 +0,0 @@
     3.4 -/*
     3.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     3.6 - *
     3.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
     3.8 - *
     3.9 - * The contents of this file are subject to the terms of either the GNU
    3.10 - * General Public License Version 2 only ("GPL") or the Common
    3.11 - * Development and Distribution License("CDDL") (collectively, the
    3.12 - * "License"). You may not use this file except in compliance with the
    3.13 - * License. You can obtain a copy of the License at
    3.14 - * http://www.netbeans.org/cddl-gplv2.html
    3.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    3.16 - * specific language governing permissions and limitations under the
    3.17 - * License.  When distributing the software, include this License Header
    3.18 - * Notice in each file and include the License file at
    3.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    3.20 - * particular file as subject to the "Classpath" exception as provided
    3.21 - * by Sun in the GPL Version 2 section of the License file that
    3.22 - * accompanied this code. If applicable, add the following below the
    3.23 - * License Header, with the fields enclosed by brackets [] replaced by
    3.24 - * your own identifying information:
    3.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    3.26 - *
    3.27 - * If you wish your version of this file to be governed by only the CDDL
    3.28 - * or only the GPL Version 2, indicate your decision by adding
    3.29 - * "[Contributor] elects to include this software in this distribution
    3.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    3.31 - * single choice of license, a recipient has the option to distribute
    3.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    3.33 - * to extend the choice of license to its licensees as provided above.
    3.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    3.35 - * Version 2 license, then the option applies only if the new code is
    3.36 - * made subject to such option by the copyright holder.
    3.37 - *
    3.38 - * Contributor(s):
    3.39 - *
    3.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
    3.41 - */
    3.42 -
    3.43 -package org.netbeans.modules.jackpot30.backend.impl.api;
    3.44 -
    3.45 -import com.sun.source.tree.CompilationUnitTree;
    3.46 -import com.sun.source.tree.Tree;
    3.47 -import com.sun.source.util.TreePath;
    3.48 -import com.sun.source.util.Trees;
    3.49 -import com.sun.tools.javac.api.JavacTaskImpl;
    3.50 -import java.io.File;
    3.51 -import java.io.IOException;
    3.52 -import java.net.URI;
    3.53 -import java.net.URL;
    3.54 -import java.util.Arrays;
    3.55 -import java.util.BitSet;
    3.56 -import java.util.Collection;
    3.57 -import java.util.Collections;
    3.58 -import java.util.HashMap;
    3.59 -import java.util.LinkedList;
    3.60 -import java.util.Map;
    3.61 -import javax.tools.Diagnostic;
    3.62 -import javax.tools.JavaCompiler;
    3.63 -import javax.tools.JavaFileObject;
    3.64 -import javax.tools.SimpleJavaFileObject;
    3.65 -import javax.tools.ToolProvider;
    3.66 -import org.apache.lucene.document.Document;
    3.67 -import org.apache.lucene.index.IndexReader;
    3.68 -import org.apache.lucene.index.Term;
    3.69 -import org.apache.lucene.search.Collector;
    3.70 -import org.apache.lucene.search.IndexSearcher;
    3.71 -import org.apache.lucene.search.Query;
    3.72 -import org.apache.lucene.search.Searcher;
    3.73 -import org.apache.lucene.search.TermQuery;
    3.74 -import org.apache.lucene.store.FSDirectory;
    3.75 -import org.netbeans.modules.jackpot30.impl.duplicates.indexing.DuplicatesIndex;
    3.76 -import org.netbeans.modules.jackpot30.impl.indexing.AbstractLuceneIndex.BitSetCollector;
    3.77 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
    3.78 -import org.netbeans.modules.jackpot30.spi.PatternConvertor;
    3.79 -import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
    3.80 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
    3.81 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
    3.82 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
    3.83 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.AdditionalQueryConstraints;
    3.84 -import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
    3.85 -import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
    3.86 -import org.netbeans.modules.parsing.impl.indexing.SPIAccessor;
    3.87 -import org.openide.filesystems.FileObject;
    3.88 -import org.openide.filesystems.FileUtil;
    3.89 -
    3.90 -/**
    3.91 - *
    3.92 - * @author lahvac
    3.93 - */
    3.94 -public class StandaloneFinder {
    3.95 -
    3.96 -    public static Collection<? extends String> findCandidates(File sourceRoot, String pattern) throws IOException {
    3.97 -        BulkPattern bulkPattern = preparePattern(pattern, null);
    3.98 -        
    3.99 -        return FileBasedIndex.get(sourceRoot.toURI().toURL()).findCandidates(bulkPattern);
   3.100 -    }
   3.101 -
   3.102 -    public static int[] findCandidateOccurrenceSpans(File sourceRoot, String relativePath, String pattern) throws IOException {
   3.103 -        BulkPattern bulkPattern = preparePattern(pattern, null);
   3.104 -        CharSequence source = FileBasedIndex.get(sourceRoot.toURI().toURL()).getSourceCode(relativePath).toString().replaceAll("\r\n", "\n");
   3.105 -        JavacTaskImpl jti = prepareJavacTaskImpl();
   3.106 -        CompilationUnitTree cut = jti.parse(new JFOImpl(source)).iterator().next();
   3.107 -        Collection<TreePath> paths = new LinkedList<TreePath>();
   3.108 -        
   3.109 -        for (Collection<TreePath> c : BulkSearch.getDefault().match(null, new TreePath(cut), bulkPattern).values()) {
   3.110 -            paths.addAll(c);
   3.111 -        }
   3.112 -
   3.113 -        Trees t = Trees.instance(jti);
   3.114 -        int[] result = new int[2 * paths.size()];
   3.115 -        int i = 0;
   3.116 -
   3.117 -        for (TreePath tp : paths) {
   3.118 -            result[i++] = (int) t.getSourcePositions().getStartPosition(cut, tp.getLeaf());
   3.119 -            result[i++] = (int) t.getSourcePositions().getEndPosition(cut, tp.getLeaf());
   3.120 -        }
   3.121 -
   3.122 -        return result;
   3.123 -    }
   3.124 -
   3.125 -    public static Collection<Diagnostic<? extends JavaFileObject>> parseAndReportErrors(String pattern) {
   3.126 -        Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
   3.127 -
   3.128 -        preparePattern(pattern, errors);
   3.129 -
   3.130 -        return errors;
   3.131 -    }
   3.132 -
   3.133 -    private static File getIndex(URL url) throws IOException {
   3.134 -        FileObject indexBaseFolder = CacheFolder.getDataFolder(url);
   3.135 -        String path = SPIAccessor.getInstance().getIndexerPath(DuplicatesIndex.NAME, DuplicatesIndex.VERSION);
   3.136 -        FileObject indexFolder = FileUtil.createFolder(indexBaseFolder, path);
   3.137 -        return FileUtil.toFile(indexFolder);
   3.138 -    }
   3.139 -
   3.140 -    public static Map<String, Collection<? extends String>> containsHash(File sourceRoot, Iterable<? extends String> hashes) throws IOException {
   3.141 -        File cacheRoot = getIndex(sourceRoot.toURI().toURL());
   3.142 -        File dir = new File(cacheRoot, "fulltext");
   3.143 -
   3.144 -        if (dir.listFiles() != null && dir.listFiles().length > 0) {
   3.145 -            IndexReader reader = IndexReader.open(FSDirectory.open(dir), true);
   3.146 -            Map<String, Collection<? extends String>> result = new HashMap<String, Collection<? extends String>>();
   3.147 -
   3.148 -            for (String hash : hashes) {
   3.149 -                Collection<String> found = new LinkedList<String>();
   3.150 -                Query query = new TermQuery(new Term("generalized", hash));
   3.151 -                Searcher s = new IndexSearcher(reader);
   3.152 -                BitSet matchingDocuments = new BitSet(reader.maxDoc());
   3.153 -                Collector c = new BitSetCollector(matchingDocuments);
   3.154 -
   3.155 -                s.search(query, c);
   3.156 -
   3.157 -                for (int docNum = matchingDocuments.nextSetBit(0); docNum >= 0; docNum = matchingDocuments.nextSetBit(docNum + 1)) {
   3.158 -                    final Document doc = reader.document(docNum);
   3.159 -
   3.160 -                    found.add(doc.getField("path").stringValue());
   3.161 -                }
   3.162 -
   3.163 -                result.put(hash, found);
   3.164 -            }
   3.165 -            
   3.166 -            return result;
   3.167 -        }
   3.168 -
   3.169 -        return Collections.emptyMap();
   3.170 -    }
   3.171 -    
   3.172 -    private static BulkPattern preparePattern(String pattern, Collection<Diagnostic<? extends JavaFileObject>> errors) {
   3.173 -        return preparePattern(PatternConvertor.create(pattern), errors);
   3.174 -    }
   3.175 -
   3.176 -    //XXX: copied from BatchSearch, may be possible to merge once CompilationInfo is accessible in server mode
   3.177 -    private static BulkPattern preparePattern(final Iterable<? extends HintDescription> patterns, Collection<Diagnostic<? extends JavaFileObject>> errors) {
   3.178 -        JavacTaskImpl javac = prepareJavacTaskImpl();
   3.179 -        Collection<String> code = new LinkedList<String>();
   3.180 -        Collection<Tree> trees = new LinkedList<Tree>();
   3.181 -        Collection<AdditionalQueryConstraints> additionalConstraints = new LinkedList<AdditionalQueryConstraints>();
   3.182 -
   3.183 -        for (HintDescription pattern : patterns) {
   3.184 -            String textPattern = ((PatternDescription) pattern.getTrigger()).getPattern();
   3.185 -
   3.186 -            code.add(textPattern);
   3.187 -            trees.add(Utilities.parseAndAttribute(javac, textPattern, errors));
   3.188 -            additionalConstraints.add(pattern.getAdditionalConstraints());
   3.189 -        }
   3.190 -
   3.191 -        return BulkSearch.getDefault().create(code, trees, additionalConstraints);
   3.192 -    }
   3.193 -
   3.194 -    private static JavacTaskImpl prepareJavacTaskImpl() {
   3.195 -        final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
   3.196 -        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
   3.197 -
   3.198 -        assert tool != null;
   3.199 -
   3.200 -        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, Arrays.asList("-bootclasspath",  bootPath, "-Xjcov"), null, Collections.<JavaFileObject>emptyList());
   3.201 -        
   3.202 -        return ct;
   3.203 -    }
   3.204 -
   3.205 -    private static final class JFOImpl extends SimpleJavaFileObject {
   3.206 -        private final CharSequence code;
   3.207 -        public JFOImpl(CharSequence code) {
   3.208 -            super(URI.create(""), Kind.SOURCE);
   3.209 -            this.code = code;
   3.210 -        }
   3.211 -        @Override
   3.212 -        public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
   3.213 -            return code;
   3.214 -        }
   3.215 -    }
   3.216 -}
     4.1 --- a/sandbox/attributed-index-web/UI.java	Sun Jan 08 20:10:08 2017 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,423 +0,0 @@
     4.4 -/*
     4.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     4.6 - *
     4.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
     4.8 - *
     4.9 - * The contents of this file are subject to the terms of either the GNU
    4.10 - * General Public License Version 2 only ("GPL") or the Common
    4.11 - * Development and Distribution License("CDDL") (collectively, the
    4.12 - * "License"). You may not use this file except in compliance with the
    4.13 - * License. You can obtain a copy of the License at
    4.14 - * http://www.netbeans.org/cddl-gplv2.html
    4.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    4.16 - * specific language governing permissions and limitations under the
    4.17 - * License.  When distributing the software, include this License Header
    4.18 - * Notice in each file and include the License file at
    4.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    4.20 - * particular file as subject to the "Classpath" exception as provided
    4.21 - * by Sun in the GPL Version 2 section of the License file that
    4.22 - * accompanied this code. If applicable, add the following below the
    4.23 - * License Header, with the fields enclosed by brackets [] replaced by
    4.24 - * your own identifying information:
    4.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    4.26 - *
    4.27 - * If you wish your version of this file to be governed by only the CDDL
    4.28 - * or only the GPL Version 2, indicate your decision by adding
    4.29 - * "[Contributor] elects to include this software in this distribution
    4.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    4.31 - * single choice of license, a recipient has the option to distribute
    4.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    4.33 - * to extend the choice of license to its licensees as provided above.
    4.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    4.35 - * Version 2 license, then the option applies only if the new code is
    4.36 - * made subject to such option by the copyright holder.
    4.37 - *
    4.38 - * Contributor(s):
    4.39 - *
    4.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
    4.41 - */
    4.42 -
    4.43 -package org.netbeans.modules.jackpot30.backend.impl.ui;
    4.44 -
    4.45 -import java.util.Comparator;
    4.46 -import javax.ws.rs.core.Response;
    4.47 -import java.util.LinkedHashMap;
    4.48 -import java.util.Map.Entry;
    4.49 -import freemarker.cache.TemplateLoader;
    4.50 -import freemarker.template.Configuration;
    4.51 -import freemarker.template.Template;
    4.52 -import freemarker.template.TemplateException;
    4.53 -import java.io.IOException;
    4.54 -import java.io.InputStream;
    4.55 -import java.io.InputStreamReader;
    4.56 -import java.io.Reader;
    4.57 -import java.io.StringWriter;
    4.58 -import java.net.URI;
    4.59 -import java.net.URISyntaxException;
    4.60 -import java.util.ArrayList;
    4.61 -import java.util.Collections;
    4.62 -import java.util.HashMap;
    4.63 -import java.util.LinkedList;
    4.64 -import java.util.List;
    4.65 -import java.util.Map;
    4.66 -import javax.ws.rs.DefaultValue;
    4.67 -import javax.ws.rs.GET;
    4.68 -import javax.ws.rs.Path;
    4.69 -import javax.ws.rs.Produces;
    4.70 -import javax.ws.rs.QueryParam;
    4.71 -import org.codeviation.pojson.Pojson;
    4.72 -import org.netbeans.modules.jackpot30.impl.WebUtilities;
    4.73 -import static org.netbeans.modules.jackpot30.impl.WebUtilities.escapeForQuery;
    4.74 -
    4.75 -/**
    4.76 - *
    4.77 - * @author lahvac
    4.78 - */
    4.79 -@Path("/index/ui")
    4.80 -public class UI {
    4.81 -
    4.82 -    @GET
    4.83 -    @Path("/search")
    4.84 -    @Produces("text/html")
    4.85 -    public String search(@QueryParam("path") String path, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
    4.86 -        Map<String, Object> configurationData = new HashMap<String, Object>();
    4.87 -
    4.88 -        configurationData.put("paths", list());
    4.89 -        configurationData.put("selectedPath", path);
    4.90 -        configurationData.put("pattern", pattern);
    4.91 -        configurationData.put("patternEscaped", escapeForQuery(pattern));
    4.92 -        configurationData.put("examples", loadExamples());
    4.93 -
    4.94 -        if (pattern != null && path != null) {
    4.95 -            URI u = new URI("http://localhost:9998/index/find?path=" + escapeForQuery(path) + "&pattern=" + escapeForQuery(pattern));
    4.96 -            List<Map<String, Object>> results = new LinkedList<Map<String, Object>>();
    4.97 -            long queryTime = System.currentTimeMillis();
    4.98 -            List<String> candidates = new ArrayList<String>(WebUtilities.requestStringArrayResponse(u));
    4.99 -
   4.100 -            queryTime = System.currentTimeMillis() - queryTime;
   4.101 -
   4.102 -            Collections.sort(candidates);
   4.103 -
   4.104 -            for (String c : candidates) {
   4.105 -                Map<String, Object> found = new HashMap<String, Object>(3);
   4.106 -
   4.107 -                found.put("relativePath", c);
   4.108 -
   4.109 -                results.add(found);
   4.110 -            }
   4.111 -
   4.112 -            configurationData.put("results", results);
   4.113 -
   4.114 -            Map<String, Object> statistics = new HashMap<String, Object>();
   4.115 -
   4.116 -            statistics.put("files", candidates.size());
   4.117 -            statistics.put("queryTime", queryTime);
   4.118 -
   4.119 -            configurationData.put("statistics", statistics);
   4.120 -        }
   4.121 -
   4.122 -        return processTemplate("ui-search.html", configurationData);
   4.123 -    }
   4.124 -
   4.125 -//    @GET
   4.126 -//    @Path("/searchCategorized")
   4.127 -//    @Produces("text/html")
   4.128 -//    public String searchCategorized(@QueryParam("path") String path, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
   4.129 -//        Map<String, Object> configurationData = new HashMap<String, Object>();
   4.130 -//
   4.131 -//        configurationData.put("paths", list());
   4.132 -//        configurationData.put("selectedPath", path);
   4.133 -//        configurationData.put("pattern", pattern);
   4.134 -//        configurationData.put("patternEscaped", escapeForQuery(pattern));
   4.135 -//        configurationData.put("examples", loadExamples());
   4.136 -//
   4.137 -//        if (pattern != null && path != null) {
   4.138 -//            Result queryResult = new DoQuery().doQuery(path, pattern, new Cancel() {
   4.139 -//                                                           public boolean isCancelled() {
   4.140 -//                                                               return false;
   4.141 -//                                                           }
   4.142 -//                                                       });
   4.143 -//
   4.144 -//            configurationData.put("result", queryResult.result);
   4.145 -//        }
   4.146 -//
   4.147 -//        return processTemplate("ui-search-categorized.html", configurationData);
   4.148 -//    }
   4.149 -
   4.150 -    @GET
   4.151 -    @Path("/show")
   4.152 -    @Produces("text/html")
   4.153 -    public String show(@QueryParam("path") String path, @QueryParam("relative") String relativePath, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
   4.154 -        Map<String, Object> configurationData = new HashMap<String, Object>();
   4.155 -        List<Map<String, String>> occurrences = new LinkedList<Map<String, String>>();
   4.156 -
   4.157 -        configurationData.put("occurrences", occurrences);
   4.158 -
   4.159 -        URI codeURL = new URI("http://localhost:9998/index/cat?path=" + escapeForQuery(path) + "&relative=" + escapeForQuery(relativePath));
   4.160 -        String code = WebUtilities.requestStringResponse(codeURL);
   4.161 -
   4.162 -        if (pattern != null) {
   4.163 -            URI spansURL = new URI("http://localhost:9998/index/findSpans?path=" + escapeForQuery(path) + "&relativePath=" + escapeForQuery(relativePath) + "&pattern=" + escapeForQuery(pattern));
   4.164 -            int currentCodePos = 0;
   4.165 -            for (int[] span : parseSpans(WebUtilities.requestStringResponse(spansURL))) { //XXX: sorted!
   4.166 -                Map<String, String> occ = new HashMap<String, String>();
   4.167 -                occ.put("prefix", WebUtilities.escapeForHTMLElement(code.substring(currentCodePos, span[0])));
   4.168 -                occ.put("occurrence", WebUtilities.escapeForHTMLElement(code.substring(span[0], span[1])));
   4.169 -                occurrences.add(occ);
   4.170 -                currentCodePos = span[1];
   4.171 -            }
   4.172 -
   4.173 -            configurationData.put("suffix", WebUtilities.escapeForHTMLElement(code.substring(currentCodePos, code.length())));
   4.174 -        } else {
   4.175 -            configurationData.put("suffix", WebUtilities.escapeForHTMLElement(code));
   4.176 -        }
   4.177 -
   4.178 -        return processTemplate("ui-cat.html", configurationData);
   4.179 -    }
   4.180 -    
   4.181 -    @GET
   4.182 -    @Path("/snippet")
   4.183 -    @Produces("text/html")
   4.184 -    public String snippet(@QueryParam("path") String path, @QueryParam("relative") String relativePath, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
   4.185 -        List<Map<String, String>> snippets = new LinkedList<Map<String, String>>();
   4.186 -
   4.187 -        URI codeURL = new URI("http://localhost:9998/index/cat?path=" + escapeForQuery(path) + "&relative=" + escapeForQuery(relativePath));
   4.188 -        String code = WebUtilities.requestStringResponse(codeURL);
   4.189 -        URI spansURL = new URI("http://localhost:9998/index/findSpans?path=" + escapeForQuery(path) + "&relativePath=" + escapeForQuery(relativePath) + "&pattern=" + escapeForQuery(pattern));
   4.190 -
   4.191 -        for (int[] span : parseSpans(WebUtilities.requestStringResponse(spansURL))) {
   4.192 -            snippets.add(prepareSnippet(code, span));
   4.193 -        }
   4.194 -
   4.195 -        return processTemplate("ui-snippet.html", Collections.<String, Object>singletonMap("snippets", snippets));
   4.196 -    }
   4.197 -
   4.198 -    @GET
   4.199 -    @Path("/apply")
   4.200 -    @Produces("text/html")
   4.201 -    public Response apply(@QueryParam("path") String path, @QueryParam("pattern") String pattern, @QueryParam("preview") @DefaultValue("") String preview, @QueryParam("download") @DefaultValue("") String download) throws URISyntaxException, IOException, TemplateException {
   4.202 -        if (!download.isEmpty()) {
   4.203 -            if (pattern != null && path != null) {
   4.204 -                URI u = new URI("http://localhost:9998/index/apply?path=" + escapeForQuery(path) + "&pattern=" + escapeForQuery(pattern));
   4.205 -
   4.206 -                return Response.temporaryRedirect(u).header("meta", "Content-Disposition: download; filename=\"patch.diff\"").build();
   4.207 -            }
   4.208 -        }
   4.209 -
   4.210 -        Map<String, Object> configurationData = new HashMap<String, Object>();
   4.211 -
   4.212 -        configurationData.put("paths", list());
   4.213 -        configurationData.put("selectedPath", path);
   4.214 -        configurationData.put("pattern", pattern);
   4.215 -        configurationData.put("patternEscaped", escapeForQuery(pattern));
   4.216 -        configurationData.put("examples", loadExamples());
   4.217 -
   4.218 -        if (pattern != null && path != null) {
   4.219 -            URI u = new URI("http://localhost:9998/index/apply?path=" + escapeForQuery(path) + "&pattern=" + escapeForQuery(pattern));
   4.220 -            long queryTime = System.currentTimeMillis();
   4.221 -            String diff = WebUtilities.requestStringResponse(u);
   4.222 -
   4.223 -            queryTime = System.currentTimeMillis() - queryTime;
   4.224 -
   4.225 -            configurationData.put("diff", diff);
   4.226 -
   4.227 -            StringBuilder sb = new StringBuilder();
   4.228 -
   4.229 -            for (String l : diff.split("\n")) {
   4.230 -                sb.append("<span");
   4.231 -
   4.232 -                for (Entry<String, String> e : prefix2SpanName.entrySet()) {
   4.233 -                    if (l.startsWith(e.getKey())) {
   4.234 -                        sb.append(" class='" + e.getValue() + "'");
   4.235 -                        break;
   4.236 -                    }
   4.237 -                }
   4.238 -
   4.239 -                sb.append(">");
   4.240 -                sb.append(l);
   4.241 -                sb.append("</span>\n");
   4.242 -            }
   4.243 -
   4.244 -            configurationData.put("result", sb.toString());
   4.245 -        }
   4.246 -
   4.247 -        return Response.ok(processTemplate("ui-apply.html", configurationData), "text/html").build();
   4.248 -    }
   4.249 -
   4.250 -    @GET
   4.251 -    @Path("/searchType")
   4.252 -    @Produces("text/html")
   4.253 -    public String searchType(@QueryParam("path") String path, @QueryParam("prefix") String prefix) throws URISyntaxException, IOException, TemplateException {
   4.254 -        Map<String, Object> configurationData = new HashMap<String, Object>();
   4.255 -
   4.256 -        configurationData.put("paths", list());
   4.257 -        configurationData.put("selectedPath", path);
   4.258 -        configurationData.put("prefix", prefix);
   4.259 -
   4.260 -        if (prefix != null && path != null) {
   4.261 -            URI u = new URI("http://localhost:9998/index/findType?path=" + escapeForQuery(path) + "&prefix=" + escapeForQuery(prefix));
   4.262 -            long queryTime = System.currentTimeMillis();
   4.263 -            @SuppressWarnings("unchecked") //XXX: should not trust something got from the network!
   4.264 -            Map<String, List<String>> types = Pojson.load(LinkedHashMap.class, u);
   4.265 -            List<Map<String, Object>> results = new LinkedList<Map<String, Object>>();
   4.266 -
   4.267 -            queryTime = System.currentTimeMillis() - queryTime;
   4.268 -
   4.269 -            for (Entry<String, List<String>> e : types.entrySet()) {
   4.270 -                for (String fqn : e.getValue()) {
   4.271 -                    Map<String, Object> found = new HashMap<String, Object>(3);
   4.272 -
   4.273 -                    found.put("fqn", fqn);
   4.274 -
   4.275 -                    if (fqn.contains("$")) {
   4.276 -                        fqn = fqn.substring(0, fqn.indexOf("$"));
   4.277 -                    }
   4.278 -
   4.279 -                    found.put("relativePath", e.getKey() + "/" + fqn.replace('.', '/') + ".java");
   4.280 -
   4.281 -                    results.add(found);
   4.282 -                }
   4.283 -            }
   4.284 -
   4.285 -            Collections.sort(results, new Comparator<Map<String, Object>>() {
   4.286 -                @Override public int compare(Map<String, Object> o1, Map<String, Object> o2) {
   4.287 -                    return ((String) o1.get("fqn")).compareTo((String) o2.get("fqn"));
   4.288 -                }
   4.289 -            });
   4.290 -            
   4.291 -            configurationData.put("results", results);
   4.292 -
   4.293 -            Map<String, Object> statistics = new HashMap<String, Object>();
   4.294 -
   4.295 -            statistics.put("queryTime", queryTime);
   4.296 -
   4.297 -            configurationData.put("statistics", statistics);
   4.298 -        }
   4.299 -
   4.300 -        return processTemplate("ui-findType.html", configurationData);
   4.301 -    }
   4.302 -
   4.303 -    private static final Map<String, String> prefix2SpanName = new LinkedHashMap<String, String>();
   4.304 -
   4.305 -    static {
   4.306 -        prefix2SpanName.put("-", "diff-removed");
   4.307 -        prefix2SpanName.put("+", "diff-added");
   4.308 -        prefix2SpanName.put("@@", "diff-hunk");
   4.309 -        prefix2SpanName.put("Index:", "diff-index");
   4.310 -    }
   4.311 -
   4.312 -    private static List<Map<String, String>> list() throws URISyntaxException {
   4.313 -        List<Map<String, String>> result = new LinkedList<Map<String, String>>();
   4.314 -
   4.315 -        for (String enc : WebUtilities.requestStringArrayResponse(new URI("http://localhost:9998/index/list"))) {
   4.316 -            Map<String, String> rootDesc = new HashMap<String, String>();
   4.317 -            String[] col = enc.split(":", 2);
   4.318 -
   4.319 -            rootDesc.put("segment", col[0]);
   4.320 -            rootDesc.put("displayName", col[1]);
   4.321 -            result.add(rootDesc);
   4.322 -        }
   4.323 -
   4.324 -        return result;
   4.325 -    }
   4.326 -    
   4.327 -    private static Iterable<int[]> parseSpans(String from) {
   4.328 -        if (from.isEmpty()) {
   4.329 -            return Collections.emptyList();
   4.330 -        }
   4.331 -        String[] split = from.split(":");
   4.332 -        List<int[]> result = new LinkedList<int[]>();
   4.333 -
   4.334 -        for (int i = 0; i < split.length; i += 2) {
   4.335 -            result.add(new int[] {
   4.336 -                Integer.parseInt(split[i + 0].trim()),
   4.337 -                Integer.parseInt(split[i + 1].trim())
   4.338 -            });
   4.339 -        }
   4.340 -
   4.341 -        return result;
   4.342 -    }
   4.343 -
   4.344 -    private static final int DESIRED_CONTEXT = 2;
   4.345 -
   4.346 -    private static Map<String, String> prepareSnippet(String code, int[] span) {
   4.347 -        int grandStart = span[0];
   4.348 -        int firstLineStart = grandStart = lineStart(code, grandStart);
   4.349 -
   4.350 -        while (grandStart > 0 && contextLength(code.substring(grandStart, firstLineStart)) < DESIRED_CONTEXT)
   4.351 -            grandStart = lineStart(code, grandStart - 1);
   4.352 -
   4.353 -        int grandEnd = span[1];
   4.354 -        int firstLineEnd = grandEnd = lineEnd(code, grandEnd);
   4.355 -        
   4.356 -        while (grandEnd < code.length() - 1 && contextLength(code.substring(firstLineEnd, grandEnd)) < DESIRED_CONTEXT)
   4.357 -            grandEnd = lineEnd(code, grandEnd + 1);
   4.358 -
   4.359 -        Map<String, String> result = new HashMap<String, String>();
   4.360 -        
   4.361 -        result.put("prefix", WebUtilities.escapeForHTMLElement(code.substring(grandStart, span[0])));
   4.362 -        result.put("occurrence", WebUtilities.escapeForHTMLElement(code.substring(span[0], span[1])));
   4.363 -        result.put("suffix", WebUtilities.escapeForHTMLElement(code.substring(span[1], grandEnd)));
   4.364 -
   4.365 -        return result;
   4.366 -    }
   4.367 -
   4.368 -    private static int lineStart(String code, int o) {
   4.369 -        while (o > 0 && code.charAt(o) != '\n') {
   4.370 -            o--;
   4.371 -        }
   4.372 -
   4.373 -        return o;
   4.374 -    }
   4.375 -
   4.376 -    private static int lineEnd(String code, int o) {
   4.377 -        while (o < code.length() - 1 && code.charAt(o) != '\n') {
   4.378 -            o++;
   4.379 -        }
   4.380 -
   4.381 -        return o;
   4.382 -    }
   4.383 -
   4.384 -    private static int contextLength(String in) {
   4.385 -        return in.replaceAll("\n[ \t]*\n", "\n").trim().split("\n").length;
   4.386 -    }
   4.387 -
   4.388 -    @SuppressWarnings("unchecked")
   4.389 -    private List<Map<String, String>> loadExamples() throws IOException, URISyntaxException {
   4.390 -        return Pojson.load(LinkedList.class, new URI("http://localhost:9998/index/examples"));
   4.391 -    }
   4.392 -
   4.393 -    private static String processTemplate(String template, Map<String, Object> configurationData) throws TemplateException, IOException {
   4.394 -        Configuration conf = new Configuration();
   4.395 -
   4.396 -        conf.setTemplateLoader(new TemplateLoaderImpl());
   4.397 -
   4.398 -        Template templ = conf.getTemplate(template);
   4.399 -        StringWriter out = new StringWriter();
   4.400 -
   4.401 -        templ.process(configurationData, out);
   4.402 -
   4.403 -        return out.toString();
   4.404 -    }
   4.405 -
   4.406 -    private static final class TemplateLoaderImpl implements TemplateLoader {
   4.407 -
   4.408 -        public Object findTemplateSource(String name) throws IOException {
   4.409 -            return TemplateLoaderImpl.class.getResourceAsStream(name);
   4.410 -        }
   4.411 -
   4.412 -        public long getLastModified(Object templateSource) {
   4.413 -            return 0L;
   4.414 -        }
   4.415 -
   4.416 -        public Reader getReader(Object templateSource, String encoding) throws IOException {
   4.417 -            InputStream in = (InputStream) templateSource;
   4.418 -
   4.419 -            return new InputStreamReader(in);
   4.420 -        }
   4.421 -
   4.422 -        public void closeTemplateSource(Object templateSource) throws IOException {
   4.423 -        }
   4.424 -    }
   4.425 -
   4.426 -}
     5.1 --- a/sandbox/attributed-index-web/ui-apply.html	Sun Jan 08 20:10:08 2017 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,68 +0,0 @@
     5.4 -<html>
     5.5 -<head>
     5.6 -    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
     5.7 -<#if results??>
     5.8 -    <script type="text/javascript">
     5.9 -        $(document).ready(function() {
    5.10 -            $('#list').find('dd').hide().end().find('dt').click(function() {
    5.11 -                current_dd=$(this).next();
    5.12 -                //XXX: will do the AJAX call for both show and hide!
    5.13 -                $.get("snippet?path=${selectedPath}&relative=" + current_dd.attr("id") + "&pattern=${patternEscaped}",function(data) {
    5.14 -                    current_dd.html(data).slideToggle();
    5.15 -                })
    5.16 -            });
    5.17 -        });
    5.18 -    </script>
    5.19 -</#if>
    5.20 -    <style type="text/css">
    5.21 -        .occurrence {background: #DDDD00;}
    5.22 -        .diff-removed {color: #FF0000;}
    5.23 -        .diff-added {color: #00FF00;}
    5.24 -        .diff-index {color: #0000FF;}
    5.25 -        .diff-hunk {color: #FF00FF;}
    5.26 -    </style>
    5.27 -</head>
    5.28 -<body>
    5.29 -<form method="get">
    5.30 -
    5.31 -<label for="path">Project:</label>
    5.32 -<select size="1" name="path">");
    5.33 -    <#list paths as path>
    5.34 -        <option <#if selectedPath?? && path.segment == selectedPath>selected</#if> value="${path.segment}">
    5.35 -            ${path.displayName}
    5.36 -        </option>
    5.37 -    </#list>
    5.38 -</select>
    5.39 -<br>
    5.40 -<label for="pattern">Pattern:</label><br>
    5.41 -<textarea rows="10" cols="40" name="pattern">
    5.42 -<#if pattern??>
    5.43 -${pattern}
    5.44 -</#if>
    5.45 -</textarea><br>
    5.46 -<input type="submit" name="preview" value="Show diff preview"/><input type="submit" name="download" value="Download diff"/>
    5.47 -</form>
    5.48 -
    5.49 -<div class="examples">
    5.50 -<#if examples??>
    5.51 -    Examples:
    5.52 -    <dl id="examples-list">
    5.53 -        <#list examples as example>
    5.54 -            <dt>${example.displayName}</dt>
    5.55 -            <dd><pre>${example.pattern}</pre>
    5.56 -            </dd>
    5.57 -        </#list>
    5.58 -    </dl>
    5.59 -</#if>
    5.60 -</div>
    5.61 -
    5.62 -<#if result??>
    5.63 -    Diff for rule: ${pattern}
    5.64 -<pre>${result}</pre>
    5.65 -</#if>
    5.66 -
    5.67 -<#if statistics??>
    5.68 -     Query time: ${statistics.queryTime}ms, matching files: ${statistics.files}.
    5.69 -</#if>
    5.70 -</body>
    5.71 -</html>
     6.1 --- a/sandbox/attributed-index-web/ui-cat.html	Sun Jan 08 20:10:08 2017 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,10 +0,0 @@
     6.4 -<html>
     6.5 -<head>
     6.6 -    <style type="text/css">
     6.7 -        .occurrence {BACKGROUND: #DDDD00;}
     6.8 -    </style>
     6.9 -</head>
    6.10 -<body>
    6.11 -<pre><#list occurrences as occurrence>${occurrence.prefix}<span class="occurrence">${occurrence.occurrence}</span></#list>${suffix}</pre>
    6.12 -</body>
    6.13 -</html>
     7.1 --- a/sandbox/attributed-index-web/ui-findType.html	Sun Jan 08 20:10:08 2017 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,28 +0,0 @@
     7.4 -<html>
     7.5 -<head>
     7.6 -    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
     7.7 -</head>
     7.8 -<body>
     7.9 -<form method="get">
    7.10 -<label for="path">Project:</label>
    7.11 -<select size="1" name="path">");
    7.12 -    <#list paths as path>
    7.13 -        <option <#if selectedPath?? && path.segment == selectedPath>selected</#if> value="${path.segment}">
    7.14 -            ${path.displayName}
    7.15 -        </option>
    7.16 -    </#list>
    7.17 -</select>
    7.18 -<br>
    7.19 -<label for="prefix">Type Name:</label><input type="text" name="prefix"<#if prefix??>value="${prefix}"</#if>/><br>
    7.20 -<input type="submit" name="Find Candidates"/>
    7.21 -</form>
    7.22 -
    7.23 -<#if results??>
    7.24 -    Found types:<br>
    7.25 -    <#list results as result>
    7.26 -        <a href="/index/ui/show?path=${selectedPath}&relative=${result.relativePath}">${result.fqn}</a><br>
    7.27 -    </#list>
    7.28 -</#if>
    7.29 -
    7.30 -</body>
    7.31 -</html>
     8.1 --- a/sandbox/attributed-index-web/ui-search.html	Sun Jan 08 20:10:08 2017 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,70 +0,0 @@
     8.4 -<html>
     8.5 -<head>
     8.6 -    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
     8.7 -<#if results??>
     8.8 -    <script type="text/javascript">
     8.9 -        $(document).ready(function() {
    8.10 -            $('#list').find('dd').hide().end().find('dt').click(function() {
    8.11 -                current_dd=$(this).next();
    8.12 -                //XXX: will do the AJAX call for both show and hide!
    8.13 -                $.get("snippet?path=${selectedPath}&relative=" + current_dd.attr("id") + "&pattern=${patternEscaped}",function(data) {
    8.14 -                    current_dd.html(data).slideToggle();
    8.15 -                })
    8.16 -            });
    8.17 -        });
    8.18 -    </script>
    8.19 -</#if>
    8.20 -    <style type="text/css">
    8.21 -        .occurrence {BACKGROUND: #DDDD00;}
    8.22 -    </style>
    8.23 -</head>
    8.24 -<body>
    8.25 -<form method="get">
    8.26 -
    8.27 -<label for="path">Project:</label>
    8.28 -<select size="1" name="path">");
    8.29 -    <#list paths as path>
    8.30 -        <option <#if selectedPath?? && path.segment == selectedPath>selected</#if> value="${path.segment}">
    8.31 -            ${path.displayName}
    8.32 -        </option>
    8.33 -    </#list>
    8.34 -</select>
    8.35 -<br>
    8.36 -<label for="pattern">Pattern:</label><br>
    8.37 -<textarea rows="10" cols="40" name="pattern">
    8.38 -<#if pattern??>
    8.39 -${pattern}
    8.40 -</#if>
    8.41 -</textarea><br>
    8.42 -<input type="submit" name="Find Candidates"/>
    8.43 -</form>
    8.44 -
    8.45 -<div class="examples">
    8.46 -<#if examples??>
    8.47 -    Examples:
    8.48 -    <dl id="examples-list">
    8.49 -        <#list examples as example>
    8.50 -            <dt>${example.displayName}</dt>
    8.51 -            <dd><pre>${example.pattern}</pre>
    8.52 -            </dd>
    8.53 -        </#list>
    8.54 -    </dl>
    8.55 -</#if>
    8.56 -</div>
    8.57 -
    8.58 -<#if results??>
    8.59 -    Found candidates for pattern: ${pattern}
    8.60 -    <dl id="list">
    8.61 -        <#list results as result>
    8.62 -            <dt>${result.relativePath}<a href="/index/ui/show?path=${selectedPath}&relative=${result.relativePath}&pattern=${patternEscaped}">show</a></dt>
    8.63 -            <dd id="${result.relativePath}">
    8.64 -            </dd>
    8.65 -        </#list>
    8.66 -    </dl>
    8.67 -</#if>
    8.68 -
    8.69 -<#if statistics??>
    8.70 -     Query time: ${statistics.queryTime}ms, matching files: ${statistics.files}.
    8.71 -</#if>
    8.72 -</body>
    8.73 -</html>
     9.1 --- a/sandbox/attributed-index-web/ui-snippet.html	Sun Jan 08 20:10:08 2017 +0100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,7 +0,0 @@
     9.4 -<#if snippets??>
     9.5 -    <#list snippets as snippet>
     9.6 -        <pre>${snippet.prefix}<span class="occurrence">${snippet.occurrence}</span>${snippet.suffix}</pre><br>
     9.7 -    </#list>
     9.8 -<#else>
     9.9 -    No occurrences.
    9.10 -</#if>
    10.1 --- a/sandbox/java.hints/build.sh	Sun Jan 08 20:10:08 2017 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,3 +0,0 @@
    10.4 -#!/bin/bash
    10.5 -ant "$@" clean && ant "$@" nbms && ant "$@" test || exit 1
    10.6 -
    11.1 --- a/sandbox/java.hints/build.xml	Sun Jan 08 20:10:08 2017 +0100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,51 +0,0 @@
    11.4 -<?xml version="1.0" encoding="UTF-8"?>
    11.5 -<!--
    11.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    11.7 -
    11.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    11.9 -
   11.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   11.11 -Other names may be trademarks of their respective owners.
   11.12 -
   11.13 -The contents of this file are subject to the terms of either the GNU
   11.14 -General Public License Version 2 only ("GPL") or the Common
   11.15 -Development and Distribution License("CDDL") (collectively, the
   11.16 -"License"). You may not use this file except in compliance with the
   11.17 -License. You can obtain a copy of the License at
   11.18 -http://www.netbeans.org/cddl-gplv2.html
   11.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   11.20 -specific language governing permissions and limitations under the
   11.21 -License.  When distributing the software, include this License Header
   11.22 -Notice in each file and include the License file at
   11.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   11.24 -particular file as subject to the "Classpath" exception as provided
   11.25 -by Oracle in the GPL Version 2 section of the License file that
   11.26 -accompanied this code. If applicable, add the following below the
   11.27 -License Header, with the fields enclosed by brackets [] replaced by
   11.28 -your own identifying information:
   11.29 -"Portions Copyrighted [year] [name of copyright owner]"
   11.30 -
   11.31 -Contributor(s):
   11.32 -
   11.33 -The Original Software is NetBeans. The Initial Developer of the Original
   11.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   11.35 -Microsystems, Inc. All Rights Reserved.
   11.36 -
   11.37 -If you wish your version of this file to be governed by only the CDDL
   11.38 -or only the GPL Version 2, indicate your decision by adding
   11.39 -"[Contributor] elects to include this software in this distribution
   11.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   11.41 -single choice of license, a recipient has the option to distribute
   11.42 -your version of this file under either the CDDL, the GPL Version 2 or
   11.43 -to extend the choice of license to its licensees as provided above.
   11.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   11.45 -Version 2 license, then the option applies only if the new code is
   11.46 -made subject to such option by the copyright holder.
   11.47 --->
   11.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
   11.49 -<!-- for some information on what you could do (e.g. targets to override). -->
   11.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
   11.51 -<project name="java.hints" basedir=".">
   11.52 -    <description>Builds the module suite java.hints.</description>
   11.53 -    <import file="nbproject/build-impl.xml"/>
   11.54 -</project>
    12.1 --- a/sandbox/java.hints/hintsimpl/build.xml	Sun Jan 08 20:10:08 2017 +0100
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,51 +0,0 @@
    12.4 -<?xml version="1.0" encoding="UTF-8"?>
    12.5 -<!--
    12.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    12.7 -
    12.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    12.9 -
   12.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   12.11 -Other names may be trademarks of their respective owners.
   12.12 -
   12.13 -The contents of this file are subject to the terms of either the GNU
   12.14 -General Public License Version 2 only ("GPL") or the Common
   12.15 -Development and Distribution License("CDDL") (collectively, the
   12.16 -"License"). You may not use this file except in compliance with the
   12.17 -License. You can obtain a copy of the License at
   12.18 -http://www.netbeans.org/cddl-gplv2.html
   12.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   12.20 -specific language governing permissions and limitations under the
   12.21 -License.  When distributing the software, include this License Header
   12.22 -Notice in each file and include the License file at
   12.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   12.24 -particular file as subject to the "Classpath" exception as provided
   12.25 -by Oracle in the GPL Version 2 section of the License file that
   12.26 -accompanied this code. If applicable, add the following below the
   12.27 -License Header, with the fields enclosed by brackets [] replaced by
   12.28 -your own identifying information:
   12.29 -"Portions Copyrighted [year] [name of copyright owner]"
   12.30 -
   12.31 -Contributor(s):
   12.32 -
   12.33 -The Original Software is NetBeans. The Initial Developer of the Original
   12.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   12.35 -Microsystems, Inc. All Rights Reserved.
   12.36 -
   12.37 -If you wish your version of this file to be governed by only the CDDL
   12.38 -or only the GPL Version 2, indicate your decision by adding
   12.39 -"[Contributor] elects to include this software in this distribution
   12.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   12.41 -single choice of license, a recipient has the option to distribute
   12.42 -your version of this file under either the CDDL, the GPL Version 2 or
   12.43 -to extend the choice of license to its licensees as provided above.
   12.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   12.45 -Version 2 license, then the option applies only if the new code is
   12.46 -made subject to such option by the copyright holder.
   12.47 --->
   12.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
   12.49 -<!-- for some information on what you could do (e.g. targets to override). -->
   12.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
   12.51 -<project name="org.netbeans.modules.jackpot30.hintsimpl" default="netbeans" basedir=".">
   12.52 -    <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.hintsimpl.</description>
   12.53 -    <import file="nbproject/build-impl.xml"/>
   12.54 -</project>
    13.1 --- a/sandbox/java.hints/hintsimpl/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,5 +0,0 @@
    13.4 -Manifest-Version: 1.0
    13.5 -OpenIDE-Module: org.netbeans.modules.jackpot30.hintsimpl
    13.6 -OpenIDE-Module-Implementation-Version: 1
    13.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties
    13.8 -
    14.1 --- a/sandbox/java.hints/hintsimpl/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,88 +0,0 @@
    14.4 -<?xml version="1.0" encoding="UTF-8"?>
    14.5 -<!--
    14.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    14.7 -
    14.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    14.9 -
   14.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   14.11 -Other names may be trademarks of their respective owners.
   14.12 -
   14.13 -The contents of this file are subject to the terms of either the GNU
   14.14 -General Public License Version 2 only ("GPL") or the Common
   14.15 -Development and Distribution License("CDDL") (collectively, the
   14.16 -"License"). You may not use this file except in compliance with the
   14.17 -License. You can obtain a copy of the License at
   14.18 -http://www.netbeans.org/cddl-gplv2.html
   14.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   14.20 -specific language governing permissions and limitations under the
   14.21 -License.  When distributing the software, include this License Header
   14.22 -Notice in each file and include the License file at
   14.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   14.24 -particular file as subject to the "Classpath" exception as provided
   14.25 -by Oracle in the GPL Version 2 section of the License file that
   14.26 -accompanied this code. If applicable, add the following below the
   14.27 -License Header, with the fields enclosed by brackets [] replaced by
   14.28 -your own identifying information:
   14.29 -"Portions Copyrighted [year] [name of copyright owner]"
   14.30 -
   14.31 -Contributor(s):
   14.32 -
   14.33 -The Original Software is NetBeans. The Initial Developer of the Original
   14.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   14.35 -Microsystems, Inc. All Rights Reserved.
   14.36 -
   14.37 -If you wish your version of this file to be governed by only the CDDL
   14.38 -or only the GPL Version 2, indicate your decision by adding
   14.39 -"[Contributor] elects to include this software in this distribution
   14.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   14.41 -single choice of license, a recipient has the option to distribute
   14.42 -your version of this file under either the CDDL, the GPL Version 2 or
   14.43 -to extend the choice of license to its licensees as provided above.
   14.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   14.45 -Version 2 license, then the option applies only if the new code is
   14.46 -made subject to such option by the copyright holder.
   14.47 --->
   14.48 -<!--
   14.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
   14.50 -***         EDIT ../build.xml INSTEAD         ***
   14.51 --->
   14.52 -<project name="org.netbeans.modules.jackpot30.hintsimpl-impl" basedir="..">
   14.53 -    <fail message="Please build using Ant 1.7.1 or higher.">
   14.54 -        <condition>
   14.55 -            <not>
   14.56 -                <antversion atleast="1.7.1"/>
   14.57 -            </not>
   14.58 -        </condition>
   14.59 -    </fail>
   14.60 -    <property file="nbproject/private/suite-private.properties"/>
   14.61 -    <property file="nbproject/suite.properties"/>
   14.62 -    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
   14.63 -    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
   14.64 -    <property file="${suite.dir}/nbproject/platform.properties"/>
   14.65 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
   14.66 -        <attribute name="name"/>
   14.67 -        <attribute name="value"/>
   14.68 -        <sequential>
   14.69 -            <property name="@{name}" value="${@{value}}"/>
   14.70 -        </sequential>
   14.71 -    </macrodef>
   14.72 -    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
   14.73 -        <attribute name="property"/>
   14.74 -        <attribute name="value"/>
   14.75 -        <sequential>
   14.76 -            <property name="@{property}" value="@{value}"/>
   14.77 -        </sequential>
   14.78 -    </macrodef>
   14.79 -    <property file="${user.properties.file}"/>
   14.80 -    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
   14.81 -    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
   14.82 -    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
   14.83 -    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
   14.84 -        <condition>
   14.85 -            <not>
   14.86 -                <contains string="${cluster.path.evaluated}" substring="platform"/>
   14.87 -            </not>
   14.88 -        </condition>
   14.89 -    </fail>
   14.90 -    <import file="${harness.dir}/build.xml"/>
   14.91 -</project>
    15.1 --- a/sandbox/java.hints/hintsimpl/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,49 +0,0 @@
    15.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    15.5 -#
    15.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    15.7 -#
    15.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    15.9 -# Other names may be trademarks of their respective owners.
   15.10 -#
   15.11 -# The contents of this file are subject to the terms of either the GNU
   15.12 -# General Public License Version 2 only ("GPL") or the Common
   15.13 -# Development and Distribution License("CDDL") (collectively, the
   15.14 -# "License"). You may not use this file except in compliance with the
   15.15 -# License. You can obtain a copy of the License at
   15.16 -# http://www.netbeans.org/cddl-gplv2.html
   15.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   15.18 -# specific language governing permissions and limitations under the
   15.19 -# License.  When distributing the software, include this License Header
   15.20 -# Notice in each file and include the License file at
   15.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   15.22 -# particular file as subject to the "Classpath" exception as provided
   15.23 -# by Oracle in the GPL Version 2 section of the License file that
   15.24 -# accompanied this code. If applicable, add the following below the
   15.25 -# License Header, with the fields enclosed by brackets [] replaced by
   15.26 -# your own identifying information:
   15.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   15.28 -#
   15.29 -# Contributor(s):
   15.30 -#
   15.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   15.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   15.33 -# Microsystems, Inc. All Rights Reserved.
   15.34 -#
   15.35 -# If you wish your version of this file to be governed by only the CDDL
   15.36 -# or only the GPL Version 2, indicate your decision by adding
   15.37 -# "[Contributor] elects to include this software in this distribution
   15.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   15.39 -# single choice of license, a recipient has the option to distribute
   15.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   15.41 -# to extend the choice of license to its licensees as provided above.
   15.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   15.43 -# Version 2 license, then the option applies only if the new code is
   15.44 -# made subject to such option by the copyright holder.
   15.45 -build.xml.data.CRC32=52580c5f
   15.46 -build.xml.script.CRC32=ef577a91
   15.47 -build.xml.stylesheet.CRC32=a56c6a5b@2.70
   15.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   15.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   15.50 -nbproject/build-impl.xml.data.CRC32=52580c5f
   15.51 -nbproject/build-impl.xml.script.CRC32=9204f652
   15.52 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.70
    16.1 --- a/sandbox/java.hints/hintsimpl/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,46 +0,0 @@
    16.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    16.5 -#
    16.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    16.7 -#
    16.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    16.9 -# Other names may be trademarks of their respective owners.
   16.10 -#
   16.11 -# The contents of this file are subject to the terms of either the GNU
   16.12 -# General Public License Version 2 only ("GPL") or the Common
   16.13 -# Development and Distribution License("CDDL") (collectively, the
   16.14 -# "License"). You may not use this file except in compliance with the
   16.15 -# License. You can obtain a copy of the License at
   16.16 -# http://www.netbeans.org/cddl-gplv2.html
   16.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   16.18 -# specific language governing permissions and limitations under the
   16.19 -# License.  When distributing the software, include this License Header
   16.20 -# Notice in each file and include the License file at
   16.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   16.22 -# particular file as subject to the "Classpath" exception as provided
   16.23 -# by Oracle in the GPL Version 2 section of the License file that
   16.24 -# accompanied this code. If applicable, add the following below the
   16.25 -# License Header, with the fields enclosed by brackets [] replaced by
   16.26 -# your own identifying information:
   16.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   16.28 -#
   16.29 -# Contributor(s):
   16.30 -#
   16.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   16.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   16.33 -# Microsystems, Inc. All Rights Reserved.
   16.34 -#
   16.35 -# If you wish your version of this file to be governed by only the CDDL
   16.36 -# or only the GPL Version 2, indicate your decision by adding
   16.37 -# "[Contributor] elects to include this software in this distribution
   16.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   16.39 -# single choice of license, a recipient has the option to distribute
   16.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   16.41 -# to extend the choice of license to its licensees as provided above.
   16.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   16.43 -# Version 2 license, then the option applies only if the new code is
   16.44 -# made subject to such option by the copyright holder.
   16.45 -javac.source=1.7
   16.46 -javac.compilerargs=-Xlint -Xlint:-serial
   16.47 -requires.nb.javac=true
   16.48 -spec.version.base=1.0
   16.49 -test.runner=junit
    17.1 --- a/sandbox/java.hints/hintsimpl/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,275 +0,0 @@
    17.4 -<?xml version="1.0" encoding="UTF-8"?>
    17.5 -<!--
    17.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    17.7 -
    17.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    17.9 -
   17.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   17.11 -Other names may be trademarks of their respective owners.
   17.12 -
   17.13 -The contents of this file are subject to the terms of either the GNU
   17.14 -General Public License Version 2 only ("GPL") or the Common
   17.15 -Development and Distribution License("CDDL") (collectively, the
   17.16 -"License"). You may not use this file except in compliance with the
   17.17 -License. You can obtain a copy of the License at
   17.18 -http://www.netbeans.org/cddl-gplv2.html
   17.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   17.20 -specific language governing permissions and limitations under the
   17.21 -License.  When distributing the software, include this License Header
   17.22 -Notice in each file and include the License file at
   17.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   17.24 -particular file as subject to the "Classpath" exception as provided
   17.25 -by Oracle in the GPL Version 2 section of the License file that
   17.26 -accompanied this code. If applicable, add the following below the
   17.27 -License Header, with the fields enclosed by brackets [] replaced by
   17.28 -your own identifying information:
   17.29 -"Portions Copyrighted [year] [name of copyright owner]"
   17.30 -
   17.31 -Contributor(s):
   17.32 -
   17.33 -The Original Software is NetBeans. The Initial Developer of the Original
   17.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   17.35 -Microsystems, Inc. All Rights Reserved.
   17.36 -
   17.37 -If you wish your version of this file to be governed by only the CDDL
   17.38 -or only the GPL Version 2, indicate your decision by adding
   17.39 -"[Contributor] elects to include this software in this distribution
   17.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   17.41 -single choice of license, a recipient has the option to distribute
   17.42 -your version of this file under either the CDDL, the GPL Version 2 or
   17.43 -to extend the choice of license to its licensees as provided above.
   17.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   17.45 -Version 2 license, then the option applies only if the new code is
   17.46 -made subject to such option by the copyright holder.
   17.47 --->
   17.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
   17.49 -    <type>org.netbeans.modules.apisupport.project</type>
   17.50 -    <configuration>
   17.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
   17.52 -            <code-name-base>org.netbeans.modules.jackpot30.hintsimpl</code-name-base>
   17.53 -            <suite-component/>
   17.54 -            <module-dependencies>
   17.55 -                <dependency>
   17.56 -                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
   17.57 -                    <build-prerequisite/>
   17.58 -                    <compile-dependency/>
   17.59 -                    <run-dependency>
   17.60 -                        <release-version>1</release-version>
   17.61 -                        <specification-version>1.20</specification-version>
   17.62 -                    </run-dependency>
   17.63 -                </dependency>
   17.64 -                <dependency>
   17.65 -                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
   17.66 -                    <build-prerequisite/>
   17.67 -                    <compile-dependency/>
   17.68 -                    <run-dependency>
   17.69 -                        <release-version>1</release-version>
   17.70 -                        <specification-version>1.39</specification-version>
   17.71 -                    </run-dependency>
   17.72 -                </dependency>
   17.73 -                <dependency>
   17.74 -                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
   17.75 -                    <build-prerequisite/>
   17.76 -                    <compile-dependency/>
   17.77 -                    <run-dependency>
   17.78 -                        <specification-version>8.4.0.3</specification-version>
   17.79 -                    </run-dependency>
   17.80 -                </dependency>
   17.81 -                <dependency>
   17.82 -                    <code-name-base>org.netbeans.modules.java.hints</code-name-base>
   17.83 -                    <build-prerequisite/>
   17.84 -                    <compile-dependency/>
   17.85 -                    <run-dependency>
   17.86 -                        <release-version>1</release-version>
   17.87 -                        <implementation-version/>
   17.88 -                    </run-dependency>
   17.89 -                </dependency>
   17.90 -                <dependency>
   17.91 -                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
   17.92 -                    <build-prerequisite/>
   17.93 -                    <compile-dependency/>
   17.94 -                    <run-dependency>
   17.95 -                        <specification-version>0.124.0.24.1.23.6</specification-version>
   17.96 -                    </run-dependency>
   17.97 -                </dependency>
   17.98 -                <dependency>
   17.99 -                    <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
  17.100 -                    <build-prerequisite/>
  17.101 -                    <compile-dependency/>
  17.102 -                    <run-dependency>
  17.103 -                        <specification-version>2.4.1.2.25.8.1</specification-version>
  17.104 -                    </run-dependency>
  17.105 -                </dependency>
  17.106 -                <dependency>
  17.107 -                    <code-name-base>org.netbeans.modules.java.sourceui</code-name-base>
  17.108 -                    <build-prerequisite/>
  17.109 -                    <compile-dependency/>
  17.110 -                    <run-dependency>
  17.111 -                        <release-version>1</release-version>
  17.112 -                        <specification-version>1.33.0.1.25</specification-version>
  17.113 -                    </run-dependency>
  17.114 -                </dependency>
  17.115 -                <dependency>
  17.116 -                    <code-name-base>org.netbeans.modules.queries</code-name-base>
  17.117 -                    <build-prerequisite/>
  17.118 -                    <compile-dependency/>
  17.119 -                    <run-dependency>
  17.120 -                        <release-version>1</release-version>
  17.121 -                        <specification-version>1.36</specification-version>
  17.122 -                    </run-dependency>
  17.123 -                </dependency>
  17.124 -                <dependency>
  17.125 -                    <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
  17.126 -                    <build-prerequisite/>
  17.127 -                    <compile-dependency/>
  17.128 -                    <run-dependency>
  17.129 -                        <specification-version>1.37.0.1</specification-version>
  17.130 -                    </run-dependency>
  17.131 -                </dependency>
  17.132 -                <dependency>
  17.133 -                    <code-name-base>org.netbeans.modules.refactoring.java</code-name-base>
  17.134 -                    <build-prerequisite/>
  17.135 -                    <compile-dependency/>
  17.136 -                    <run-dependency>
  17.137 -                        <release-version>1</release-version>
  17.138 -                        <implementation-version/>
  17.139 -                    </run-dependency>
  17.140 -                </dependency>
  17.141 -                <dependency>
  17.142 -                    <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
  17.143 -                    <build-prerequisite/>
  17.144 -                    <compile-dependency/>
  17.145 -                    <run-dependency>
  17.146 -                        <release-version>0</release-version>
  17.147 -                        <specification-version>1.31.0.7.42</specification-version>
  17.148 -                    </run-dependency>
  17.149 -                </dependency>
  17.150 -                <dependency>
  17.151 -                    <code-name-base>org.netbeans.spi.java.hints</code-name-base>
  17.152 -                    <build-prerequisite/>
  17.153 -                    <compile-dependency/>
  17.154 -                    <run-dependency>
  17.155 -                        <specification-version>2.0</specification-version>
  17.156 -                    </run-dependency>
  17.157 -                </dependency>
  17.158 -                <dependency>
  17.159 -                    <code-name-base>org.openide.awt</code-name-base>
  17.160 -                    <build-prerequisite/>
  17.161 -                    <compile-dependency/>
  17.162 -                    <run-dependency>
  17.163 -                        <specification-version>7.59</specification-version>
  17.164 -                    </run-dependency>
  17.165 -                </dependency>
  17.166 -                <dependency>
  17.167 -                    <code-name-base>org.openide.filesystems</code-name-base>
  17.168 -                    <build-prerequisite/>
  17.169 -                    <compile-dependency/>
  17.170 -                    <run-dependency>
  17.171 -                        <specification-version>8.8</specification-version>
  17.172 -                    </run-dependency>
  17.173 -                </dependency>
  17.174 -                <dependency>
  17.175 -                    <code-name-base>org.openide.loaders</code-name-base>
  17.176 -                    <build-prerequisite/>
  17.177 -                    <compile-dependency/>
  17.178 -                    <run-dependency>
  17.179 -                        <specification-version>7.50</specification-version>
  17.180 -                    </run-dependency>
  17.181 -                </dependency>
  17.182 -                <dependency>
  17.183 -                    <code-name-base>org.openide.nodes</code-name-base>
  17.184 -                    <build-prerequisite/>
  17.185 -                    <compile-dependency/>
  17.186 -                    <run-dependency>
  17.187 -                        <specification-version>7.36</specification-version>
  17.188 -                    </run-dependency>
  17.189 -                </dependency>
  17.190 -                <dependency>
  17.191 -                    <code-name-base>org.openide.text</code-name-base>
  17.192 -                    <build-prerequisite/>
  17.193 -                    <compile-dependency/>
  17.194 -                    <run-dependency>
  17.195 -                        <specification-version>6.57</specification-version>
  17.196 -                    </run-dependency>
  17.197 -                </dependency>
  17.198 -                <dependency>
  17.199 -                    <code-name-base>org.openide.util</code-name-base>
  17.200 -                    <build-prerequisite/>
  17.201 -                    <compile-dependency/>
  17.202 -                    <run-dependency>
  17.203 -                        <specification-version>8.32</specification-version>
  17.204 -                    </run-dependency>
  17.205 -                </dependency>
  17.206 -                <dependency>
  17.207 -                    <code-name-base>org.openide.util.lookup</code-name-base>
  17.208 -                    <build-prerequisite/>
  17.209 -                    <compile-dependency/>
  17.210 -                    <run-dependency>
  17.211 -                        <specification-version>8.22</specification-version>
  17.212 -                    </run-dependency>
  17.213 -                </dependency>
  17.214 -                <dependency>
  17.215 -                    <code-name-base>org.openide.util.ui</code-name-base>
  17.216 -                    <build-prerequisite/>
  17.217 -                    <compile-dependency/>
  17.218 -                    <run-dependency>
  17.219 -                        <specification-version>9.3</specification-version>
  17.220 -                    </run-dependency>
  17.221 -                </dependency>
  17.222 -                <dependency>
  17.223 -                    <code-name-base>org.openide.windows</code-name-base>
  17.224 -                    <build-prerequisite/>
  17.225 -                    <compile-dependency/>
  17.226 -                    <run-dependency>
  17.227 -                        <specification-version>6.64</specification-version>
  17.228 -                    </run-dependency>
  17.229 -                </dependency>
  17.230 -            </module-dependencies>
  17.231 -            <test-dependencies>
  17.232 -                <test-type>
  17.233 -                    <name>unit</name>
  17.234 -                    <test-dependency>
  17.235 -                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
  17.236 -                        <compile-dependency/>
  17.237 -                    </test-dependency>
  17.238 -                    <test-dependency>
  17.239 -                        <code-name-base>org.netbeans.libs.testng</code-name-base>
  17.240 -                        <compile-dependency/>
  17.241 -                    </test-dependency>
  17.242 -                    <test-dependency>
  17.243 -                        <code-name-base>org.netbeans.modules.editor.mimelookup.impl</code-name-base>
  17.244 -                        <compile-dependency/>
  17.245 -                    </test-dependency>
  17.246 -                    <test-dependency>
  17.247 -                        <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
  17.248 -                        <compile-dependency/>
  17.249 -                    </test-dependency>
  17.250 -                    <test-dependency>
  17.251 -                        <code-name-base>org.netbeans.modules.java.editor</code-name-base>
  17.252 -                        <recursive/>
  17.253 -                        <compile-dependency/>
  17.254 -                    </test-dependency>
  17.255 -                    <test-dependency>
  17.256 -                        <code-name-base>org.netbeans.modules.java.hints.test</code-name-base>
  17.257 -                        <recursive/>
  17.258 -                        <compile-dependency/>
  17.259 -                    </test-dependency>
  17.260 -                    <test-dependency>
  17.261 -                        <code-name-base>org.netbeans.modules.parsing.nb</code-name-base>
  17.262 -                        <compile-dependency/>
  17.263 -                    </test-dependency>
  17.264 -                    <test-dependency>
  17.265 -                        <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
  17.266 -                        <compile-dependency/>
  17.267 -                    </test-dependency>
  17.268 -                    <test-dependency>
  17.269 -                        <code-name-base>org.netbeans.spi.java.hints</code-name-base>
  17.270 -                        <compile-dependency/>
  17.271 -                        <test/>
  17.272 -                    </test-dependency>
  17.273 -                </test-type>
  17.274 -            </test-dependencies>
  17.275 -            <public-packages/>
  17.276 -        </data>
  17.277 -    </configuration>
  17.278 -</project>
    18.1 --- a/sandbox/java.hints/hintsimpl/nbproject/suite.properties	Sun Jan 08 20:10:08 2017 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,42 +0,0 @@
    18.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    18.5 -#
    18.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    18.7 -#
    18.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    18.9 -# Other names may be trademarks of their respective owners.
   18.10 -#
   18.11 -# The contents of this file are subject to the terms of either the GNU
   18.12 -# General Public License Version 2 only ("GPL") or the Common
   18.13 -# Development and Distribution License("CDDL") (collectively, the
   18.14 -# "License"). You may not use this file except in compliance with the
   18.15 -# License. You can obtain a copy of the License at
   18.16 -# http://www.netbeans.org/cddl-gplv2.html
   18.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   18.18 -# specific language governing permissions and limitations under the
   18.19 -# License.  When distributing the software, include this License Header
   18.20 -# Notice in each file and include the License file at
   18.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   18.22 -# particular file as subject to the "Classpath" exception as provided
   18.23 -# by Oracle in the GPL Version 2 section of the License file that
   18.24 -# accompanied this code. If applicable, add the following below the
   18.25 -# License Header, with the fields enclosed by brackets [] replaced by
   18.26 -# your own identifying information:
   18.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   18.28 -#
   18.29 -# Contributor(s):
   18.30 -#
   18.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   18.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   18.33 -# Microsystems, Inc. All Rights Reserved.
   18.34 -#
   18.35 -# If you wish your version of this file to be governed by only the CDDL
   18.36 -# or only the GPL Version 2, indicate your decision by adding
   18.37 -# "[Contributor] elects to include this software in this distribution
   18.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   18.39 -# single choice of license, a recipient has the option to distribute
   18.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   18.41 -# to extend the choice of license to its licensees as provided above.
   18.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   18.43 -# Version 2 license, then the option applies only if the new code is
   18.44 -# made subject to such option by the copyright holder.
   18.45 -suite.dir=${basedir}/..
    19.1 --- a/sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,42 +0,0 @@
    19.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    19.5 -#
    19.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    19.7 -#
    19.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    19.9 -# Other names may be trademarks of their respective owners.
   19.10 -#
   19.11 -# The contents of this file are subject to the terms of either the GNU
   19.12 -# General Public License Version 2 only ("GPL") or the Common
   19.13 -# Development and Distribution License("CDDL") (collectively, the
   19.14 -# "License"). You may not use this file except in compliance with the
   19.15 -# License. You can obtain a copy of the License at
   19.16 -# http://www.netbeans.org/cddl-gplv2.html
   19.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   19.18 -# specific language governing permissions and limitations under the
   19.19 -# License.  When distributing the software, include this License Header
   19.20 -# Notice in each file and include the License file at
   19.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   19.22 -# particular file as subject to the "Classpath" exception as provided
   19.23 -# by Oracle in the GPL Version 2 section of the License file that
   19.24 -# accompanied this code. If applicable, add the following below the
   19.25 -# License Header, with the fields enclosed by brackets [] replaced by
   19.26 -# your own identifying information:
   19.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   19.28 -#
   19.29 -# Contributor(s):
   19.30 -#
   19.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   19.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   19.33 -# Microsystems, Inc. All Rights Reserved.
   19.34 -#
   19.35 -# If you wish your version of this file to be governed by only the CDDL
   19.36 -# or only the GPL Version 2, indicate your decision by adding
   19.37 -# "[Contributor] elects to include this software in this distribution
   19.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   19.39 -# single choice of license, a recipient has the option to distribute
   19.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   19.41 -# to extend the choice of license to its licensees as provided above.
   19.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   19.43 -# Version 2 license, then the option applies only if the new code is
   19.44 -# made subject to such option by the copyright holder.
   19.45 -OpenIDE-Module-Name=Jackpot 3.0 Experimental Hints Impl
    20.1 --- a/sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/GlobalyUnused.java	Sun Jan 08 20:10:08 2017 +0100
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,120 +0,0 @@
    20.4 -/*
    20.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    20.6 - *
    20.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    20.8 - *
    20.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   20.10 - * Other names may be trademarks of their respective owners.
   20.11 - *
   20.12 - * The contents of this file are subject to the terms of either the GNU
   20.13 - * General Public License Version 2 only ("GPL") or the Common
   20.14 - * Development and Distribution License("CDDL") (collectively, the
   20.15 - * "License"). You may not use this file except in compliance with the
   20.16 - * License. You can obtain a copy of the License at
   20.17 - * http://www.netbeans.org/cddl-gplv2.html
   20.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   20.19 - * specific language governing permissions and limitations under the
   20.20 - * License.  When distributing the software, include this License Header
   20.21 - * Notice in each file and include the License file at
   20.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   20.23 - * particular file as subject to the "Classpath" exception as provided
   20.24 - * by Oracle in the GPL Version 2 section of the License file that
   20.25 - * accompanied this code. If applicable, add the following below the
   20.26 - * License Header, with the fields enclosed by brackets [] replaced by
   20.27 - * your own identifying information:
   20.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   20.29 - *
   20.30 - * If you wish your version of this file to be governed by only the CDDL
   20.31 - * or only the GPL Version 2, indicate your decision by adding
   20.32 - * "[Contributor] elects to include this software in this distribution
   20.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   20.34 - * single choice of license, a recipient has the option to distribute
   20.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   20.36 - * to extend the choice of license to its licensees as provided above.
   20.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   20.38 - * Version 2 license, then the option applies only if the new code is
   20.39 - * made subject to such option by the copyright holder.
   20.40 - *
   20.41 - * Contributor(s):
   20.42 - *
   20.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   20.44 - */
   20.45 -package org.netbeans.modules.jackpot30.hintsimpl;
   20.46 -
   20.47 -import com.sun.source.tree.Tree.Kind;
   20.48 -import javax.lang.model.element.Element;
   20.49 -import javax.lang.model.element.ElementKind;
   20.50 -import javax.lang.model.type.TypeKind;
   20.51 -import org.netbeans.api.java.source.TreePathHandle;
   20.52 -import org.netbeans.spi.editor.hints.ErrorDescription;
   20.53 -import org.netbeans.spi.java.hints.Decision;
   20.54 -import org.netbeans.spi.java.hints.Decision.Factory;
   20.55 -import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
   20.56 -import org.netbeans.spi.java.hints.Hint;
   20.57 -import org.netbeans.spi.java.hints.HintContext;
   20.58 -import org.netbeans.spi.java.hints.TriggerDecision;
   20.59 -import org.netbeans.spi.java.hints.TriggerTreeKind;
   20.60 -
   20.61 -/**
   20.62 - *
   20.63 - * @author lahvac
   20.64 - */
   20.65 -@Hint(displayName="Unused", description="Unused", category="general")
   20.66 -public class GlobalyUnused {
   20.67 -    
   20.68 -    @TriggerTreeKind({Kind.IDENTIFIER, Kind.MEMBER_SELECT})
   20.69 -    public static ErrorDescription usage(HintContext ctx) {
   20.70 -        DecisionImpl d = decisionOrNull(ctx);
   20.71 -        
   20.72 -        if (d != null) {
   20.73 -            System.err.println("recording usage");
   20.74 -            d.recordLocalFact(ctx.getInfo(), null);
   20.75 -        }
   20.76 -        
   20.77 -        return null;
   20.78 -    }
   20.79 -    
   20.80 -    @TriggerTreeKind({Kind.CLASS})
   20.81 -    public static ErrorDescription declaration(HintContext ctx) {
   20.82 -        decisionOrNull(ctx);
   20.83 -        return null;
   20.84 -    }
   20.85 -    
   20.86 -    @TriggerDecision(DecisionImpl.class)
   20.87 -    public static ErrorDescription produceWarning(HintContext ctx) {
   20.88 -        if (((DecisionImpl) ctx.decision).getCurrentResult() != Boolean.TRUE) {
   20.89 -            return ErrorDescriptionFactory.forName(ctx, ctx.getPath(), "Unused");
   20.90 -        }
   20.91 -        
   20.92 -        return null;
   20.93 -    }
   20.94 -    
   20.95 -    private static DecisionImpl decisionOrNull(HintContext ctx) {
   20.96 -        Element el = ctx.getInfo().getTrees().getElement(ctx.getPath());
   20.97 -        
   20.98 -        if (el == null || (el.asType() != null && el.asType().getKind() == TypeKind.ERROR) || el.getKind() != ElementKind.CLASS) return null;
   20.99 -        
  20.100 -        TreePathHandle h = TreePathHandle.create(el, ctx.getInfo());
  20.101 -        
  20.102 -        System.err.println("decision for: " + el);
  20.103 -        return ctx.findDecision(h, new Factory<Void, Boolean, DecisionImpl>(DecisionImpl.class) {
  20.104 -            @Override
  20.105 -            public DecisionImpl create(TreePathHandle handle) {
  20.106 -                return new DecisionImpl(handle);
  20.107 -            }
  20.108 -        });
  20.109 -    }
  20.110 -    
  20.111 -    private static final class DecisionImpl extends Decision<Void, Boolean> {
  20.112 -
  20.113 -        public DecisionImpl(TreePathHandle root) {
  20.114 -            super(root);
  20.115 -        }
  20.116 -
  20.117 -        @Override
  20.118 -        protected Boolean makeDecision(Iterable<? extends Void> input) {
  20.119 -            return input.iterator().hasNext();
  20.120 -        }
  20.121 -        
  20.122 -    }
  20.123 -}
    21.1 --- a/sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/NonPrivateMakeFinal.java	Sun Jan 08 20:10:08 2017 +0100
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,152 +0,0 @@
    21.4 -/*
    21.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    21.6 - *
    21.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    21.8 - *
    21.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   21.10 - * Other names may be trademarks of their respective owners.
   21.11 - *
   21.12 - * The contents of this file are subject to the terms of either the GNU
   21.13 - * General Public License Version 2 only ("GPL") or the Common
   21.14 - * Development and Distribution License("CDDL") (collectively, the
   21.15 - * "License"). You may not use this file except in compliance with the
   21.16 - * License. You can obtain a copy of the License at
   21.17 - * http://www.netbeans.org/cddl-gplv2.html
   21.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   21.19 - * specific language governing permissions and limitations under the
   21.20 - * License.  When distributing the software, include this License Header
   21.21 - * Notice in each file and include the License file at
   21.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   21.23 - * particular file as subject to the "Classpath" exception as provided
   21.24 - * by Oracle in the GPL Version 2 section of the License file that
   21.25 - * accompanied this code. If applicable, add the following below the
   21.26 - * License Header, with the fields enclosed by brackets [] replaced by
   21.27 - * your own identifying information:
   21.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   21.29 - *
   21.30 - * If you wish your version of this file to be governed by only the CDDL
   21.31 - * or only the GPL Version 2, indicate your decision by adding
   21.32 - * "[Contributor] elects to include this software in this distribution
   21.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   21.34 - * single choice of license, a recipient has the option to distribute
   21.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   21.36 - * to extend the choice of license to its licensees as provided above.
   21.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   21.38 - * Version 2 license, then the option applies only if the new code is
   21.39 - * made subject to such option by the copyright holder.
   21.40 - *
   21.41 - * Contributor(s):
   21.42 - *
   21.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   21.44 - */
   21.45 -package org.netbeans.modules.jackpot30.hintsimpl;
   21.46 -
   21.47 -import com.sun.source.tree.Tree.Kind;
   21.48 -import com.sun.source.tree.VariableTree;
   21.49 -import com.sun.source.util.TreePath;
   21.50 -import java.util.EnumSet;
   21.51 -import javax.lang.model.element.Element;
   21.52 -import javax.lang.model.element.ElementKind;
   21.53 -import javax.lang.model.element.Modifier;
   21.54 -import javax.lang.model.element.VariableElement;
   21.55 -import org.netbeans.api.annotations.common.NonNull;
   21.56 -import org.netbeans.api.java.source.TreePathHandle;
   21.57 -import org.netbeans.modules.java.hints.introduce.Flow;
   21.58 -import org.netbeans.modules.java.hints.introduce.Flow.FlowResult;
   21.59 -import org.netbeans.spi.editor.hints.ErrorDescription;
   21.60 -import org.netbeans.spi.editor.hints.Fix;
   21.61 -import org.netbeans.spi.java.hints.Decision;
   21.62 -import org.netbeans.spi.java.hints.Decision.Factory;
   21.63 -import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
   21.64 -import org.netbeans.spi.java.hints.Hint;
   21.65 -import org.netbeans.spi.java.hints.HintContext;
   21.66 -import org.netbeans.spi.java.hints.TriggerDecision;
   21.67 -import org.netbeans.spi.java.hints.TriggerPattern;
   21.68 -import org.netbeans.spi.java.hints.TriggerTreeKind;
   21.69 -import org.netbeans.spi.java.hints.support.FixFactory;
   21.70 -import org.openide.util.NbBundle.Messages;
   21.71 -
   21.72 -/**
   21.73 - *
   21.74 - * @author lahvac
   21.75 - */
   21.76 -@Hint(displayName="Non Private Make Final", description="Non Private Make Final", category="general")
   21.77 -public class NonPrivateMakeFinal {
   21.78 -
   21.79 -    @TriggerPattern("$variable = $value")
   21.80 -    public static ErrorDescription write(HintContext ctx) {
   21.81 -        Element field = ctx.getInfo().getTrees().getElement(ctx.getVariables().get("$variable"));
   21.82 -
   21.83 -        if (field == null || field.getKind() != ElementKind.FIELD) {
   21.84 -            //unknown, or not a field, ignore.
   21.85 -            return null;
   21.86 -        }
   21.87 -
   21.88 -        if (ctx.getInfo().getTopLevelElements().contains(ctx.getInfo().getElementUtilities().outermostTypeElement(field))) {
   21.89 -            //field in current CU, ignore (will be handled by local flow)
   21.90 -            return null;
   21.91 -        }
   21.92 -
   21.93 -        decision(ctx, (VariableElement) field).recordLocalFact(ctx.getInfo(), false);
   21.94 -        
   21.95 -        return null;
   21.96 -    }
   21.97 -    
   21.98 -    @TriggerTreeKind({Kind.VARIABLE})
   21.99 -    public static ErrorDescription declaration(HintContext ctx) {
  21.100 -        Element ve = ctx.getInfo().getTrees().getElement(ctx.getPath());
  21.101 -
  21.102 -        if (ve == null || ve.getKind() != ElementKind.FIELD || ve.getModifiers().contains(Modifier.FINAL) || /*TODO: the point of volatile?*/ve.getModifiers().contains(Modifier.VOLATILE)) return null;
  21.103 -
  21.104 -        //handle all fields, even the private ones, which are handled by the standard hints.
  21.105 -        
  21.106 -        FlowResult flow = Flow.assignmentsForUse(ctx);
  21.107 -
  21.108 -        if (flow == null || ctx.isCanceled()) return null;
  21.109 -
  21.110 -        DecisionImpl decision = decision(ctx, (VariableElement) ve);
  21.111 -
  21.112 -        decision.recordLocalFact(ctx.getInfo(), flow.getFinalCandidates().contains((VariableElement) ve));
  21.113 -
  21.114 -        return null;
  21.115 -    }
  21.116 -    
  21.117 -    @TriggerDecision(DecisionImpl.class)
  21.118 -    @Messages("FIX_CanBeFinal={0} can be final")
  21.119 -    public static ErrorDescription produceWarning(HintContext ctx) {
  21.120 -        if (((DecisionImpl) ctx.decision).getCurrentResult() == Boolean.TRUE) {
  21.121 -            VariableTree vt = (VariableTree) ctx.getPath().getLeaf();
  21.122 -            Fix fix = FixFactory.addModifiersFix(ctx.getInfo(), new TreePath(ctx.getPath(), vt.getModifiers()), EnumSet.of(Modifier.FINAL), Bundle.FIX_CanBeFinal(vt.getName().toString()));
  21.123 -            return ErrorDescriptionFactory.forName(ctx, ctx.getPath(), "Can be final", fix);
  21.124 -        }
  21.125 -        
  21.126 -        return null;
  21.127 -    }
  21.128 -    
  21.129 -    private static @NonNull DecisionImpl decision(HintContext ctx, @NonNull VariableElement field) {
  21.130 -        TreePathHandle h = TreePathHandle.create(field, ctx.getInfo());
  21.131 -        
  21.132 -        return ctx.findDecision(h, new Factory<Boolean, Boolean, DecisionImpl>(DecisionImpl.class) {
  21.133 -            @Override
  21.134 -            public DecisionImpl create(TreePathHandle handle) {
  21.135 -                return new DecisionImpl(handle);
  21.136 -            }
  21.137 -        });
  21.138 -    }
  21.139 -    
  21.140 -    private static final class DecisionImpl extends Decision<Boolean, Boolean> {
  21.141 -
  21.142 -        public DecisionImpl(TreePathHandle root) {
  21.143 -            super(root);
  21.144 -        }
  21.145 -
  21.146 -        @Override
  21.147 -        protected Boolean makeDecision(Iterable<? extends Boolean> input) {
  21.148 -            for (Boolean b : input) {
  21.149 -                if (b == null || !b) return false;
  21.150 -            }
  21.151 -            return true;
  21.152 -        }
  21.153 -        
  21.154 -    }
  21.155 -}
    22.1 --- a/sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoring.java	Sun Jan 08 20:10:08 2017 +0100
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,58 +0,0 @@
    22.4 -/*
    22.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    22.6 - *
    22.7 - * Copyright 2013 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):
   22.42 - *
   22.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   22.44 - */
   22.45 -package org.netbeans.modules.jackpot30.hintsimpl.duplicates;
   22.46 -
   22.47 -import org.netbeans.api.java.source.TreePathHandle;
   22.48 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
   22.49 -import org.openide.util.lookup.Lookups;
   22.50 -
   22.51 -/**
   22.52 - *
   22.53 - * @author lahvac
   22.54 - */
   22.55 -public class DuplicateMethodRefactoring extends AbstractRefactoring {
   22.56 -
   22.57 -    public DuplicateMethodRefactoring(TreePathHandle source) {
   22.58 -        super(Lookups.singleton(source));
   22.59 -    }
   22.60 -
   22.61 -}
    23.1 --- a/sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoringAction.java	Sun Jan 08 20:10:08 2017 +0100
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,84 +0,0 @@
    23.4 -/*
    23.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    23.6 - *
    23.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    23.8 - *
    23.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   23.10 - * Other names may be trademarks of their respective owners.
   23.11 - *
   23.12 - * The contents of this file are subject to the terms of either the GNU
   23.13 - * General Public License Version 2 only ("GPL") or the Common
   23.14 - * Development and Distribution License("CDDL") (collectively, the
   23.15 - * "License"). You may not use this file except in compliance with the
   23.16 - * License. You can obtain a copy of the License at
   23.17 - * http://www.netbeans.org/cddl-gplv2.html
   23.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   23.19 - * specific language governing permissions and limitations under the
   23.20 - * License.  When distributing the software, include this License Header
   23.21 - * Notice in each file and include the License file at
   23.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   23.23 - * particular file as subject to the "Classpath" exception as provided
   23.24 - * by Oracle in the GPL Version 2 section of the License file that
   23.25 - * accompanied this code. If applicable, add the following below the
   23.26 - * License Header, with the fields enclosed by brackets [] replaced by
   23.27 - * your own identifying information:
   23.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   23.29 - *
   23.30 - * If you wish your version of this file to be governed by only the CDDL
   23.31 - * or only the GPL Version 2, indicate your decision by adding
   23.32 - * "[Contributor] elects to include this software in this distribution
   23.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   23.34 - * single choice of license, a recipient has the option to distribute
   23.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   23.36 - * to extend the choice of license to its licensees as provided above.
   23.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   23.38 - * Version 2 license, then the option applies only if the new code is
   23.39 - * made subject to such option by the copyright holder.
   23.40 - *
   23.41 - * Contributor(s):
   23.42 - *
   23.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   23.44 - */
   23.45 -package org.netbeans.modules.jackpot30.hintsimpl.duplicates;
   23.46 -
   23.47 -import com.sun.source.tree.Tree.Kind;
   23.48 -import java.awt.event.ActionEvent;
   23.49 -import java.awt.event.ActionListener;
   23.50 -import org.netbeans.api.fileinfo.NonRecursiveFolder;
   23.51 -import org.netbeans.api.java.source.CompilationInfo;
   23.52 -import org.netbeans.api.java.source.TreePathHandle;
   23.53 -import org.netbeans.api.java.source.ui.ScanDialog;
   23.54 -import org.netbeans.modules.refactoring.java.ui.ContextAnalyzer;
   23.55 -import org.netbeans.modules.refactoring.java.ui.JavaRefactoringUIFactory;
   23.56 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
   23.57 -import org.openide.awt.ActionID;
   23.58 -import org.openide.awt.ActionReference;
   23.59 -import org.openide.awt.ActionRegistration;
   23.60 -import org.openide.filesystems.FileObject;
   23.61 -import org.openide.util.NbBundle.Messages;
   23.62 -import org.openide.util.Utilities;
   23.63 -
   23.64 -@ActionID(
   23.65 -        category = "Refactoring",
   23.66 -        id = "org.netbeans.modules.jackpot30.hintsimpl.duplicates.DuplicateMethodRefactoringAction")
   23.67 -@ActionRegistration(
   23.68 -        displayName = "#CTL_DuplicateMethodRefactoringAction")
   23.69 -@ActionReference(path = "Menu/Refactoring", position = 1120)
   23.70 -@Messages("CTL_DuplicateMethodRefactoringAction=Find and Replace Duplicates...")
   23.71 -public final class DuplicateMethodRefactoringAction implements ActionListener {
   23.72 -
   23.73 -    @Override
   23.74 -    public void actionPerformed(ActionEvent e) {
   23.75 -        Runnable task = ContextAnalyzer.createTask(Utilities.actionsGlobalContext()/*!!!*/, new JavaRefactoringUIFactory() {
   23.76 -            @Override public RefactoringUI create(CompilationInfo info, TreePathHandle[] handles, FileObject[] files, NonRecursiveFolder[] packages) {
   23.77 -                //todo: more precise verification of refactoring feasibility:
   23.78 -                return handles.length == 1 && handles[0].getKind() == Kind.METHOD ? new DuplicateMethodRefactoringUI(handles[0]) : null;
   23.79 -            }
   23.80 -        });
   23.81 -        ScanDialog.runWhenScanFinished(task, "Find&Replace Duplicates");
   23.82 -    }
   23.83 -
   23.84 -    public boolean isEnabled() {
   23.85 -        return ContextAnalyzer.canRefactorSingle(Utilities.actionsGlobalContext()/*!!!*/, true, true);
   23.86 -    }
   23.87 -}
    24.1 --- a/sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoringPlugin.java	Sun Jan 08 20:10:08 2017 +0100
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,183 +0,0 @@
    24.4 -/*
    24.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    24.6 - *
    24.7 - * Copyright 2013 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):
   24.42 - *
   24.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   24.44 - */
   24.45 -package org.netbeans.modules.jackpot30.hintsimpl.duplicates;
   24.46 -
   24.47 -import com.sun.source.tree.BlockTree;
   24.48 -import com.sun.source.tree.ExpressionTree;
   24.49 -import com.sun.source.tree.MethodInvocationTree;
   24.50 -import com.sun.source.tree.MethodTree;
   24.51 -import com.sun.source.tree.StatementTree;
   24.52 -import com.sun.source.util.TreePath;
   24.53 -import java.net.URL;
   24.54 -import java.util.ArrayList;
   24.55 -import java.util.Collection;
   24.56 -import java.util.Collections;
   24.57 -import java.util.Enumeration;
   24.58 -import java.util.HashSet;
   24.59 -import java.util.List;
   24.60 -import java.util.Set;
   24.61 -import javax.lang.model.element.Element;
   24.62 -import javax.lang.model.element.ExecutableElement;
   24.63 -import javax.lang.model.element.VariableElement;
   24.64 -import org.netbeans.api.java.source.CancellableTask;
   24.65 -import org.netbeans.api.java.source.ClasspathInfo;
   24.66 -import org.netbeans.api.java.source.ClasspathInfo.PathKind;
   24.67 -import org.netbeans.api.java.source.JavaSource;
   24.68 -import org.netbeans.api.java.source.SourceUtils;
   24.69 -import org.netbeans.api.java.source.TreeMaker;
   24.70 -import org.netbeans.api.java.source.TreePathHandle;
   24.71 -import org.netbeans.api.java.source.WorkingCopy;
   24.72 -import org.netbeans.api.java.source.matching.Matcher;
   24.73 -import org.netbeans.api.java.source.matching.Occurrence;
   24.74 -import org.netbeans.api.java.source.matching.Pattern;
   24.75 -import org.netbeans.modules.refactoring.api.Problem;
   24.76 -import org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin;
   24.77 -import org.netbeans.modules.refactoring.spi.RefactoringElementsBag;
   24.78 -import org.openide.filesystems.FileObject;
   24.79 -import org.openide.filesystems.FileUtil;
   24.80 -import org.openide.filesystems.URLMapper;
   24.81 -
   24.82 -/**
   24.83 - *
   24.84 - * @author lahvac
   24.85 - */
   24.86 -public class DuplicateMethodRefactoringPlugin extends JavaRefactoringPlugin {
   24.87 -    private final DuplicateMethodRefactoring refactoring;
   24.88 -
   24.89 -    DuplicateMethodRefactoringPlugin(DuplicateMethodRefactoring refactoring) {
   24.90 -        this.refactoring = refactoring;
   24.91 -    }
   24.92 -
   24.93 -    @Override
   24.94 -    public Problem preCheck() {
   24.95 -        return null;
   24.96 -    }
   24.97 -
   24.98 -    @Override
   24.99 -    public Problem checkParameters() {
  24.100 -        return null;
  24.101 -    }
  24.102 -
  24.103 -    @Override
  24.104 -    public Problem fastCheckParameters() {
  24.105 -        return null;
  24.106 -    }
  24.107 -
  24.108 -    @Override
  24.109 -    public void cancelRequest() {
  24.110 -    }
  24.111 -
  24.112 -    @Override
  24.113 -    public Problem prepare(RefactoringElementsBag refactoringElements) {
  24.114 -        final TreePathHandle source = refactoring.getRefactoringSource().lookup(TreePathHandle.class);
  24.115 -        Set<URL> dependent = new HashSet<>();
  24.116 -
  24.117 -        for (FileObject root : ClasspathInfo.create(source.getFileObject()).getClassPath(PathKind.SOURCE).getRoots()) {
  24.118 -            dependent.add(root.toURL());
  24.119 -            dependent.addAll(SourceUtils.getDependentRoots(root.toURL()));
  24.120 -        }
  24.121 -
  24.122 -        Set<FileObject> files = new HashSet<>();
  24.123 -
  24.124 -        for (URL root : dependent) {
  24.125 -            FileObject rootFO = URLMapper.findFileObject(root);
  24.126 -
  24.127 -            if (rootFO == null) continue;
  24.128 -
  24.129 -            for (Enumeration<? extends FileObject> en = rootFO.getChildren(true); en.hasMoreElements(); ){
  24.130 -                FileObject file = en.nextElement();
  24.131 -
  24.132 -                if (file.isData() && "text/x-java".equals(FileUtil.getMIMEType(file, "text/x-java"))) {
  24.133 -                    files.add(file);
  24.134 -                }
  24.135 -            }
  24.136 -        }
  24.137 -
  24.138 -        return createAndAddElements(files, new CancellableTask<WorkingCopy>() {
  24.139 -            @Override public void cancel() {
  24.140 -                //TODO - is used? if yes, implement.
  24.141 -            }
  24.142 -            @Override public void run(WorkingCopy parameter) throws Exception {
  24.143 -                if (parameter.toPhase(org.netbeans.api.java.source.JavaSource.Phase.RESOLVED).compareTo(org.netbeans.api.java.source.JavaSource.Phase.RESOLVED) < 0) {
  24.144 -                    return ;
  24.145 -                }
  24.146 -
  24.147 -                Element methodElement = source.getElementHandle().resolve(parameter);
  24.148 -                TreePath method = parameter.getTrees().getPath(methodElement);
  24.149 -
  24.150 -                if (method == null) {
  24.151 -                    //nothing to do
  24.152 -                    //TODO: create a problem
  24.153 -                    return ;
  24.154 -                }
  24.155 -
  24.156 -                BlockTree content = ((MethodTree) method.getLeaf()).getBody();
  24.157 -                TreePath bodyPath = new TreePath(method, content);
  24.158 -                List<TreePath> statements = new ArrayList<>();
  24.159 -
  24.160 -                for (StatementTree st : content.getStatements()) {
  24.161 -                    statements.add(new TreePath(bodyPath, st));
  24.162 -                }
  24.163 -
  24.164 -                List<? extends VariableElement> formalParameters = ((ExecutableElement) methodElement).getParameters();
  24.165 -                Pattern pattern = Pattern.createPatternWithRemappableVariables(statements, formalParameters, true);
  24.166 -                Collection<? extends Occurrence> found = Matcher.create(parameter).setCancel(cancelRequested).setSearchRoot(new TreePath(parameter.getCompilationUnit())).match(pattern);
  24.167 -                TreeMaker make = parameter.getTreeMaker();
  24.168 -
  24.169 -                for (Occurrence occ : found) {
  24.170 -                    List<ExpressionTree> newParams = new ArrayList<>();
  24.171 -                    for (VariableElement p : formalParameters) {
  24.172 -                        newParams.add((ExpressionTree) occ.getVariablesRemapToTrees().get(p).getLeaf());
  24.173 -                    }
  24.174 -                    MethodInvocationTree newCall = make.MethodInvocation(Collections.<ExpressionTree>emptyList(), make.QualIdent(methodElement), newParams);
  24.175 -                    parameter.rewrite(occ.getOccurrenceRoot().getLeaf(), make.ExpressionStatement(newCall));
  24.176 -                }
  24.177 -            }
  24.178 -        }, refactoringElements, refactoring);
  24.179 -    }
  24.180 -
  24.181 -    @Override
  24.182 -    protected JavaSource getJavaSource(Phase p) {
  24.183 -        return null;
  24.184 -    }
  24.185 -
  24.186 -}
    25.1 --- a/sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoringUI.java	Sun Jan 08 20:10:08 2017 +0100
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,108 +0,0 @@
    25.4 -/*
    25.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    25.6 - *
    25.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    25.8 - *
    25.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   25.10 - * Other names may be trademarks of their respective owners.
   25.11 - *
   25.12 - * The contents of this file are subject to the terms of either the GNU
   25.13 - * General Public License Version 2 only ("GPL") or the Common
   25.14 - * Development and Distribution License("CDDL") (collectively, the
   25.15 - * "License"). You may not use this file except in compliance with the
   25.16 - * License. You can obtain a copy of the License at
   25.17 - * http://www.netbeans.org/cddl-gplv2.html
   25.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   25.19 - * specific language governing permissions and limitations under the
   25.20 - * License.  When distributing the software, include this License Header
   25.21 - * Notice in each file and include the License file at
   25.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   25.23 - * particular file as subject to the "Classpath" exception as provided
   25.24 - * by Oracle in the GPL Version 2 section of the License file that
   25.25 - * accompanied this code. If applicable, add the following below the
   25.26 - * License Header, with the fields enclosed by brackets [] replaced by
   25.27 - * your own identifying information:
   25.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   25.29 - *
   25.30 - * If you wish your version of this file to be governed by only the CDDL
   25.31 - * or only the GPL Version 2, indicate your decision by adding
   25.32 - * "[Contributor] elects to include this software in this distribution
   25.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   25.34 - * single choice of license, a recipient has the option to distribute
   25.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   25.36 - * to extend the choice of license to its licensees as provided above.
   25.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   25.38 - * Version 2 license, then the option applies only if the new code is
   25.39 - * made subject to such option by the copyright holder.
   25.40 - *
   25.41 - * Contributor(s):
   25.42 - *
   25.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   25.44 - */
   25.45 -package org.netbeans.modules.jackpot30.hintsimpl.duplicates;
   25.46 -
   25.47 -import javax.swing.event.ChangeListener;
   25.48 -import org.netbeans.api.java.source.TreePathHandle;
   25.49 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
   25.50 -import org.netbeans.modules.refactoring.api.Problem;
   25.51 -import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
   25.52 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
   25.53 -import org.openide.util.HelpCtx;
   25.54 -
   25.55 -/**
   25.56 - *
   25.57 - * @author lahvac
   25.58 - */
   25.59 -public class DuplicateMethodRefactoringUI implements RefactoringUI {
   25.60 -    private final TreePathHandle treePathHandle;
   25.61 -
   25.62 -    DuplicateMethodRefactoringUI(TreePathHandle treePathHandle) {
   25.63 -        this.treePathHandle = treePathHandle;
   25.64 -    }
   25.65 -
   25.66 -    @Override
   25.67 -    public String getName() {
   25.68 -        return "Duplicate Method Refactoring";
   25.69 -    }
   25.70 -
   25.71 -    @Override
   25.72 -    public String getDescription() {
   25.73 -        return "Duplicate Method Refactoring";
   25.74 -    }
   25.75 -
   25.76 -    @Override
   25.77 -    public boolean isQuery() {
   25.78 -        return false;
   25.79 -    }
   25.80 -
   25.81 -    @Override
   25.82 -    public CustomRefactoringPanel getPanel(ChangeListener parent) {
   25.83 -        return null;
   25.84 -    }
   25.85 -
   25.86 -    @Override
   25.87 -    public Problem setParameters() {
   25.88 -        return null;
   25.89 -    }
   25.90 -
   25.91 -    @Override
   25.92 -    public Problem checkParameters() {
   25.93 -        return null;
   25.94 -    }
   25.95 -
   25.96 -    @Override
   25.97 -    public boolean hasParameters() {
   25.98 -        return false;
   25.99 -    }
  25.100 -
  25.101 -    @Override
  25.102 -    public AbstractRefactoring getRefactoring() {
  25.103 -        return new DuplicateMethodRefactoring(treePathHandle);
  25.104 -    }
  25.105 -
  25.106 -    @Override
  25.107 -    public HelpCtx getHelpCtx() {
  25.108 -        return HelpCtx.DEFAULT_HELP;
  25.109 -    }
  25.110 -
  25.111 -}
    26.1 --- a/sandbox/java.hints/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/RefactoringPluginFactoryImpl.java	Sun Jan 08 20:10:08 2017 +0100
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,62 +0,0 @@
    26.4 -/*
    26.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    26.6 - *
    26.7 - * Copyright 2008-2010 Sun Microsystems, Inc. All rights reserved.
    26.8 - *
    26.9 - * The contents of this file are subject to the terms of either the GNU
   26.10 - * General Public License Version 2 only ("GPL") or the Common
   26.11 - * Development and Distribution License("CDDL") (collectively, the
   26.12 - * "License"). You may not use this file except in compliance with the
   26.13 - * License. You can obtain a copy of the License at
   26.14 - * http://www.netbeans.org/cddl-gplv2.html
   26.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   26.16 - * specific language governing permissions and limitations under the
   26.17 - * License.  When distributing the software, include this License Header
   26.18 - * Notice in each file and include the License file at
   26.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   26.20 - * particular file as subject to the "Classpath" exception as provided
   26.21 - * by Sun in the GPL Version 2 section of the License file that
   26.22 - * accompanied this code. If applicable, add the following below the
   26.23 - * License Header, with the fields enclosed by brackets [] replaced by
   26.24 - * your own identifying information:
   26.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   26.26 - *
   26.27 - * If you wish your version of this file to be governed by only the CDDL
   26.28 - * or only the GPL Version 2, indicate your decision by adding
   26.29 - * "[Contributor] elects to include this software in this distribution
   26.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   26.31 - * single choice of license, a recipient has the option to distribute
   26.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   26.33 - * to extend the choice of license to its licensees as provided above.
   26.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   26.35 - * Version 2 license, then the option applies only if the new code is
   26.36 - * made subject to such option by the copyright holder.
   26.37 - *
   26.38 - * Contributor(s):
   26.39 - *
   26.40 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
   26.41 - */
   26.42 -
   26.43 -package org.netbeans.modules.jackpot30.hintsimpl.duplicates;
   26.44 -
   26.45 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
   26.46 -import org.netbeans.modules.refactoring.spi.RefactoringPlugin;
   26.47 -import org.netbeans.modules.refactoring.spi.RefactoringPluginFactory;
   26.48 -import org.openide.util.lookup.ServiceProvider;
   26.49 -
   26.50 -/**
   26.51 - *
   26.52 - * @author Jan Lahoda
   26.53 - */
   26.54 -@ServiceProvider(service=RefactoringPluginFactory.class)
   26.55 -public class RefactoringPluginFactoryImpl implements RefactoringPluginFactory {
   26.56 -
   26.57 -    public RefactoringPlugin createInstance(AbstractRefactoring refactoring) {
   26.58 -        if (refactoring instanceof DuplicateMethodRefactoring) {
   26.59 -            return new DuplicateMethodRefactoringPlugin((DuplicateMethodRefactoring) refactoring);
   26.60 -        }
   26.61 -
   26.62 -        return null;
   26.63 -    }
   26.64 -
   26.65 -}
    27.1 --- a/sandbox/java.hints/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/GlobalyUnusedNGTest.java	Sun Jan 08 20:10:08 2017 +0100
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,84 +0,0 @@
    27.4 -/*
    27.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    27.6 - *
    27.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    27.8 - *
    27.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   27.10 - * Other names may be trademarks of their respective owners.
   27.11 - *
   27.12 - * The contents of this file are subject to the terms of either the GNU
   27.13 - * General Public License Version 2 only ("GPL") or the Common
   27.14 - * Development and Distribution License("CDDL") (collectively, the
   27.15 - * "License"). You may not use this file except in compliance with the
   27.16 - * License. You can obtain a copy of the License at
   27.17 - * http://www.netbeans.org/cddl-gplv2.html
   27.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   27.19 - * specific language governing permissions and limitations under the
   27.20 - * License.  When distributing the software, include this License Header
   27.21 - * Notice in each file and include the License file at
   27.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   27.23 - * particular file as subject to the "Classpath" exception as provided
   27.24 - * by Oracle in the GPL Version 2 section of the License file that
   27.25 - * accompanied this code. If applicable, add the following below the
   27.26 - * License Header, with the fields enclosed by brackets [] replaced by
   27.27 - * your own identifying information:
   27.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   27.29 - *
   27.30 - * If you wish your version of this file to be governed by only the CDDL
   27.31 - * or only the GPL Version 2, indicate your decision by adding
   27.32 - * "[Contributor] elects to include this software in this distribution
   27.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   27.34 - * single choice of license, a recipient has the option to distribute
   27.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   27.36 - * to extend the choice of license to its licensees as provided above.
   27.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   27.38 - * Version 2 license, then the option applies only if the new code is
   27.39 - * made subject to such option by the copyright holder.
   27.40 - *
   27.41 - * Contributor(s):
   27.42 - *
   27.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   27.44 - */
   27.45 -package org.netbeans.modules.jackpot30.hintsimpl;
   27.46 -
   27.47 -import org.junit.Test;
   27.48 -import org.netbeans.modules.java.hints.test.api.HintTest;
   27.49 -
   27.50 -/**
   27.51 - *
   27.52 - * @author lahvac
   27.53 - */
   27.54 -public class GlobalyUnusedNGTest {
   27.55 -
   27.56 -    @Test
   27.57 -    public void testUsed1() throws Exception {
   27.58 -        HintTest.create()
   27.59 -                .input("test/Test1.java",
   27.60 -                       "package test;\n" +
   27.61 -                       "public class Test1 {\n" +
   27.62 -                       "    private final Test2 test2 = null;\n" +
   27.63 -                       "}\n")
   27.64 -                .input("test/Test2.java",
   27.65 -                       "package test;\n" +
   27.66 -                       "public class Test2 {\n" +
   27.67 -                       "    private final Test1 test1 = null;\n" +
   27.68 -                       "}\n")
   27.69 -                .runGlobal(GlobalyUnused.class)
   27.70 -                .assertWarnings();
   27.71 -    }
   27.72 -    
   27.73 -    @Test
   27.74 -    public void testUnused() throws Exception {
   27.75 -        HintTest.create()
   27.76 -                .input("test/Test1.java",
   27.77 -                       "package test;\n" +
   27.78 -                       "public class Test1 { }\n")
   27.79 -                .input("test/Test2.java",
   27.80 -                       "package test;\n" +
   27.81 -                       "public class Test2 {\n" +
   27.82 -                       "}\n")
   27.83 -                .runGlobal(GlobalyUnused.class)
   27.84 -                .assertWarnings("1:13-1:18:verifier:Unused", "1:13-1:18:verifier:Unused");
   27.85 -    }
   27.86 -
   27.87 -}
    28.1 --- a/sandbox/java.hints/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/NonPrivateMakeFinalNGTest.java	Sun Jan 08 20:10:08 2017 +0100
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,90 +0,0 @@
    28.4 -/*
    28.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    28.6 - *
    28.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    28.8 - *
    28.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   28.10 - * Other names may be trademarks of their respective owners.
   28.11 - *
   28.12 - * The contents of this file are subject to the terms of either the GNU
   28.13 - * General Public License Version 2 only ("GPL") or the Common
   28.14 - * Development and Distribution License("CDDL") (collectively, the
   28.15 - * "License"). You may not use this file except in compliance with the
   28.16 - * License. You can obtain a copy of the License at
   28.17 - * http://www.netbeans.org/cddl-gplv2.html
   28.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   28.19 - * specific language governing permissions and limitations under the
   28.20 - * License.  When distributing the software, include this License Header
   28.21 - * Notice in each file and include the License file at
   28.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   28.23 - * particular file as subject to the "Classpath" exception as provided
   28.24 - * by Oracle in the GPL Version 2 section of the License file that
   28.25 - * accompanied this code. If applicable, add the following below the
   28.26 - * License Header, with the fields enclosed by brackets [] replaced by
   28.27 - * your own identifying information:
   28.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   28.29 - *
   28.30 - * If you wish your version of this file to be governed by only the CDDL
   28.31 - * or only the GPL Version 2, indicate your decision by adding
   28.32 - * "[Contributor] elects to include this software in this distribution
   28.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   28.34 - * single choice of license, a recipient has the option to distribute
   28.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   28.36 - * to extend the choice of license to its licensees as provided above.
   28.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   28.38 - * Version 2 license, then the option applies only if the new code is
   28.39 - * made subject to such option by the copyright holder.
   28.40 - *
   28.41 - * Contributor(s):
   28.42 - *
   28.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   28.44 - */
   28.45 -package org.netbeans.modules.jackpot30.hintsimpl;
   28.46 -
   28.47 -import org.junit.Test;
   28.48 -import org.netbeans.modules.java.hints.test.api.HintTest;
   28.49 -
   28.50 -/**
   28.51 - *
   28.52 - * @author lahvac
   28.53 - */
   28.54 -public class NonPrivateMakeFinalNGTest {
   28.55 -
   28.56 -    @Test
   28.57 -    public void testNotFinal() throws Exception {
   28.58 -        HintTest.create()
   28.59 -                .input("test/Test1.java",
   28.60 -                       "package test;\n" +
   28.61 -                       "public class Test1 {\n" +
   28.62 -                       "    public String str = \"\";\n" +
   28.63 -                       "}\n")
   28.64 -                .input("test/Test2.java",
   28.65 -                       "package test;\n" +
   28.66 -                       "public class Test2 {\n" +
   28.67 -                       "    {\n" +
   28.68 -                       "        new Test1().str = null;\n" +
   28.69 -                       "    }\n" +
   28.70 -                       "}\n")
   28.71 -                .runGlobal(NonPrivateMakeFinal.class)
   28.72 -                .assertWarnings();
   28.73 -    }
   28.74 -
   28.75 -    @Test
   28.76 -    public void testFinal() throws Exception {
   28.77 -        HintTest.create()
   28.78 -                .input("test/Test1.java",
   28.79 -                       "package test;\n" +
   28.80 -                       "public class Test1 {\n" +
   28.81 -                       "    public String str = \"\";\n" +
   28.82 -                       "}\n")
   28.83 -                .input("test/Test2.java",
   28.84 -                       "package test;\n" +
   28.85 -                       "public class Test2 {\n" +
   28.86 -                       "    {\n" +
   28.87 -                       "        System.err.println(new Test1().str);\n" +
   28.88 -                       "    }\n" +
   28.89 -                       "}\n")
   28.90 -                .runGlobal(NonPrivateMakeFinal.class)
   28.91 -                .assertWarnings("2:18-2:21:verifier:Can be final");
   28.92 -    }
   28.93 -}
    29.1 --- a/sandbox/java.hints/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/borrowed/RefactoringTestBase.java	Sun Jan 08 20:10:08 2017 +0100
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,387 +0,0 @@
    29.4 -/*
    29.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    29.6 - *
    29.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
    29.8 - *
    29.9 - * The contents of this file are subject to the terms of either the GNU
   29.10 - * General Public License Version 2 only ("GPL") or the Common
   29.11 - * Development and Distribution License("CDDL") (collectively, the
   29.12 - * "License"). You may not use this file except in compliance with the
   29.13 - * License. You can obtain a copy of the License at
   29.14 - * http://www.netbeans.org/cddl-gplv2.html
   29.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   29.16 - * specific language governing permissions and limitations under the
   29.17 - * License.  When distributing the software, include this License Header
   29.18 - * Notice in each file and include the License file at
   29.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   29.20 - * particular file as subject to the "Classpath" exception as provided
   29.21 - * by Sun in the GPL Version 2 section of the License file that
   29.22 - * accompanied this code. If applicable, add the following below the
   29.23 - * License Header, with the fields enclosed by brackets [] replaced by
   29.24 - * your own identifying information:
   29.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   29.26 - *
   29.27 - * If you wish your version of this file to be governed by only the CDDL
   29.28 - * or only the GPL Version 2, indicate your decision by adding
   29.29 - * "[Contributor] elects to include this software in this distribution
   29.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   29.31 - * single choice of license, a recipient has the option to distribute
   29.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   29.33 - * to extend the choice of license to its licensees as provided above.
   29.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   29.35 - * Version 2 license, then the option applies only if the new code is
   29.36 - * made subject to such option by the copyright holder.
   29.37 - *
   29.38 - * Contributor(s):
   29.39 - *
   29.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
   29.41 - */
   29.42 -package org.netbeans.modules.jackpot30.hintsimpl.borrowed;
   29.43 -
   29.44 -import java.io.EOFException;
   29.45 -import java.io.FileInputStream;
   29.46 -import java.io.IOException;
   29.47 -import java.nio.charset.Charset;
   29.48 -import java.util.Arrays;
   29.49 -import java.util.Collections;
   29.50 -import java.util.HashMap;
   29.51 -import java.util.HashSet;
   29.52 -import java.util.Iterator;
   29.53 -import java.util.LinkedList;
   29.54 -import java.util.List;
   29.55 -import java.util.Map;
   29.56 -import java.util.logging.Level;
   29.57 -import java.util.logging.Logger;
   29.58 -import javax.swing.event.ChangeListener;
   29.59 -import org.netbeans.api.editor.mimelookup.MimePath;
   29.60 -import org.netbeans.api.java.classpath.ClassPath;
   29.61 -import org.netbeans.api.java.classpath.GlobalPathRegistry;
   29.62 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
   29.63 -import org.netbeans.api.java.source.TestUtilities;
   29.64 -import org.netbeans.api.java.source.TreeUtilities;
   29.65 -import org.netbeans.api.project.Project;
   29.66 -import org.netbeans.api.project.ProjectManager;
   29.67 -import org.netbeans.api.project.SourceGroup;
   29.68 -import org.netbeans.api.project.Sources;
   29.69 -import org.netbeans.core.startup.Main;
   29.70 -import org.netbeans.junit.NbTestCase;
   29.71 -import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
   29.72 -import org.netbeans.modules.parsing.api.indexing.IndexingManager;
   29.73 -import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
   29.74 -import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
   29.75 -import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
   29.76 -import org.netbeans.modules.refactoring.api.Problem;
   29.77 -import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
   29.78 -import org.netbeans.spi.gototest.TestLocator;
   29.79 -import org.netbeans.spi.gototest.TestLocator.FileType;
   29.80 -import org.netbeans.spi.gototest.TestLocator.LocationListener;
   29.81 -import org.netbeans.spi.gototest.TestLocator.LocationResult;
   29.82 -import org.netbeans.spi.java.classpath.ClassPathProvider;
   29.83 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
   29.84 -import org.netbeans.spi.project.ProjectFactory;
   29.85 -import org.netbeans.spi.project.ProjectState;
   29.86 -import org.netbeans.spi.project.support.GenericSources;
   29.87 -import org.openide.filesystems.FileObject;
   29.88 -import org.openide.filesystems.FileUtil;
   29.89 -import org.openide.util.Lookup;
   29.90 -import org.openide.util.NbBundle;
   29.91 -import org.openide.util.lookup.Lookups;
   29.92 -import org.openide.util.lookup.ServiceProvider;
   29.93 -
   29.94 -public class RefactoringTestBase extends NbTestCase {
   29.95 -    // Turning off annoying info messages from treeutilities
   29.96 -    private static final Logger TREEUTILITIESLOGGER = Logger.getLogger(TreeUtilities.class.getName());
   29.97 -
   29.98 -    public RefactoringTestBase(String name) {
   29.99 -        super(name);
  29.100 -    }
  29.101 -
  29.102 -    protected static void writeFilesAndWaitForScan(FileObject sourceRoot, File... files) throws Exception {
  29.103 -        for (FileObject c : sourceRoot.getChildren()) {
  29.104 -            c.delete();
  29.105 -        }
  29.106 -
  29.107 -        for (File f : files) {
  29.108 -            FileObject fo = FileUtil.createData(sourceRoot, f.filename);
  29.109 -            TestUtilities.copyStringToFile(fo, f.content);
  29.110 -        }
  29.111 -
  29.112 -        IndexingManager.getDefault().refreshIndexAndWait(sourceRoot.toURL(), null, true);
  29.113 -    }
  29.114 -
  29.115 -    protected void verifyContent(FileObject sourceRoot, File... files) throws Exception {
  29.116 -        List<FileObject> todo = new LinkedList<FileObject>();
  29.117 -
  29.118 -        todo.add(sourceRoot);
  29.119 -
  29.120 -        Map<String, String> content = new HashMap<String, String>();
  29.121 -
  29.122 -        FileUtil.refreshFor(FileUtil.toFile(sourceRoot));
  29.123 -
  29.124 -        while (!todo.isEmpty()) {
  29.125 -            FileObject file = todo.remove(0);
  29.126 -
  29.127 -            if (file.isData()) {
  29.128 -                content.put(FileUtil.getRelativePath(sourceRoot, file), copyFileToString(FileUtil.toFile(file)));
  29.129 -            } else {
  29.130 -                todo.addAll(Arrays.asList(file.getChildren()));
  29.131 -            }
  29.132 -        }
  29.133 -
  29.134 -        for (File f : files) {
  29.135 -            String fileContent = content.remove(f.filename);
  29.136 -
  29.137 -            assertNotNull(f);
  29.138 -            assertNotNull(f.content);
  29.139 -            assertNotNull("Cannot find " + f.filename + " in map " + content, fileContent);
  29.140 -            assertEquals(getName() ,f.content.replaceAll("[ \t\r\n\n]+", " "), fileContent.replaceAll("[ \t\r\n\n]+", " "));
  29.141 -        }
  29.142 -
  29.143 -        assertTrue(content.toString(), content.isEmpty());
  29.144 -    }
  29.145 -    
  29.146 -    /**
  29.147 -     * Returns a string which contains the contents of a file.
  29.148 -     *
  29.149 -     * @param f the file to be read
  29.150 -     * @return the contents of the file(s).
  29.151 -     */
  29.152 -    private static String copyFileToString(java.io.File f) throws java.io.IOException {
  29.153 -        int s = (int) f.length();
  29.154 -        byte[] data = new byte[s];
  29.155 -        int len = new FileInputStream(f).read(data);
  29.156 -        if (len != s) {
  29.157 -            throw new EOFException("truncated file");
  29.158 -        }
  29.159 -        return new String(data, Charset.forName("UTF8"));
  29.160 -    }
  29.161 -
  29.162 -    protected static void addAllProblems(List<Problem> problems, Problem head) {
  29.163 -        while (head != null) {
  29.164 -            problems.add(head);
  29.165 -            head = head.getNext();
  29.166 -        }
  29.167 -    }
  29.168 -
  29.169 -    protected static void assertProblems(Iterable<? extends Problem> golden, Iterable<? extends Problem> real) {
  29.170 -        Iterator<? extends Problem> g = golden.iterator();
  29.171 -        Iterator<? extends Problem> r = real.iterator();
  29.172 -
  29.173 -        while (g.hasNext() && r.hasNext()) {
  29.174 -            Problem gp = g.next();
  29.175 -            Problem rp = r.next();
  29.176 -
  29.177 -            assertEquals(gp.isFatal(), rp.isFatal());
  29.178 -            assertEquals(gp.getMessage(), rp.getMessage());
  29.179 -        }
  29.180 -        boolean goldenHasNext = g.hasNext();
  29.181 -        boolean realHasNext = r.hasNext();
  29.182 -
  29.183 -        assertFalse(goldenHasNext?"Expected: " + g.next().getMessage():"", goldenHasNext);
  29.184 -        assertFalse(realHasNext?"Unexpected: " + r.next().getMessage():"", realHasNext);
  29.185 -    }
  29.186 -
  29.187 -    static {
  29.188 -        NbBundle.setBranding("test");
  29.189 -    }
  29.190 -
  29.191 -    protected static final class File {
  29.192 -        public final String filename;
  29.193 -        public final String content;
  29.194 -
  29.195 -        public File(String filename, String content) {
  29.196 -            this.filename = filename;
  29.197 -            this.content = content;
  29.198 -        }
  29.199 -    }
  29.200 -
  29.201 -    protected FileObject src;
  29.202 -    protected FileObject test;
  29.203 -    protected Project prj;
  29.204 -    private ClassPath sourcePath;
  29.205 -
  29.206 -    @Override
  29.207 -    protected void setUp() throws Exception {
  29.208 -        System.setProperty("org.netbeans.modules.java.source.usages.SourceAnalyser.fullIndex", "true");
  29.209 -        TREEUTILITIESLOGGER.setLevel(Level.SEVERE);
  29.210 -        MimeTypes.setAllMimeTypes(new HashSet<String>());
  29.211 -        SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/openide/loaders/layer.xml",
  29.212 -                    "org/netbeans/modules/java/source/resources/layer.xml",
  29.213 -                    "org/netbeans/modules/java/editor/resources/layer.xml",
  29.214 -            /*"org/netbeans/modules/refactoring/java/test/resources/layer.xml", */"META-INF/generated-layer.xml"}, new Object[] {
  29.215 -                    new ClassPathProvider() {
  29.216 -                        @Override
  29.217 -                        public ClassPath findClassPath(FileObject file, String type) {
  29.218 -                    if (sourcePath != null && sourcePath.contains(file)){
  29.219 -                                if (ClassPath.BOOT.equals(type)) {
  29.220 -                                    return ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path"));
  29.221 -                                }
  29.222 -                                if (ClassPath.COMPILE.equals(type)) {
  29.223 -                                    return ClassPathSupport.createClassPath(new FileObject[0]);
  29.224 -                                }
  29.225 -                                if (ClassPath.SOURCE.equals(type)) {
  29.226 -                                    return sourcePath;
  29.227 -                                }
  29.228 -                            }
  29.229 -
  29.230 -                            return null;
  29.231 -                        }
  29.232 -                    },
  29.233 -                    new ProjectFactory() {
  29.234 -                        @Override
  29.235 -                        public boolean isProject(FileObject projectDirectory) {
  29.236 -                            return src != null && src.getParent() == projectDirectory;
  29.237 -                        }
  29.238 -                        @Override
  29.239 -                        public Project loadProject(final FileObject projectDirectory, ProjectState state) throws IOException {
  29.240 -                if (!isProject(projectDirectory)) {
  29.241 -                    return null;
  29.242 -                }
  29.243 -                            return new Project() {
  29.244 -                                @Override
  29.245 -                                public FileObject getProjectDirectory() {
  29.246 -                                    return projectDirectory;
  29.247 -                                }
  29.248 -                                @Override
  29.249 -                                public Lookup getLookup() {
  29.250 -                                    final Project p = this;
  29.251 -                                    return Lookups.singleton(new Sources() {
  29.252 -
  29.253 -                                        @Override
  29.254 -                                        public SourceGroup[] getSourceGroups(String type) {
  29.255 -                                return new SourceGroup[] {GenericSources.group(p, src.getParent(), "source", "Java Sources", null, null),
  29.256 -                                                        GenericSources.group(p, test, "testsources", "Test Sources", null, null)};
  29.257 -                                        }
  29.258 -
  29.259 -                                        @Override
  29.260 -                                        public void addChangeListener(ChangeListener listener) {
  29.261 -                                        }
  29.262 -
  29.263 -                                        @Override
  29.264 -                                        public void removeChangeListener(ChangeListener listener) {
  29.265 -                                        }
  29.266 -                                    });
  29.267 -                                }
  29.268 -                            };
  29.269 -                        }
  29.270 -                        @Override
  29.271 -            public void saveProject(Project project) throws IOException, ClassCastException {}
  29.272 -                    },
  29.273 -                    new TestLocator() {
  29.274 -
  29.275 -                        @Override
  29.276 -                        public boolean appliesTo(FileObject fo) {
  29.277 -                            return true;
  29.278 -                        }
  29.279 -
  29.280 -                        @Override
  29.281 -                        public boolean asynchronous() {
  29.282 -                            return false;
  29.283 -                        }
  29.284 -
  29.285 -                        @Override
  29.286 -                        public LocationResult findOpposite(FileObject fo, int caretOffset) {
  29.287 -                            ClassPath srcCp;
  29.288 -
  29.289 -                            if ((srcCp = ClassPath.getClassPath(fo, ClassPath.SOURCE)) == null) {
  29.290 -                                return new LocationResult("File not found"); //NOI18N
  29.291 -                            }
  29.292 -
  29.293 -                            String baseResName = srcCp.getResourceName(fo, '/', false);
  29.294 -                            String testResName = getTestResName(baseResName, fo.getExt());
  29.295 -                            assert testResName != null;
  29.296 -                            FileObject fileObject = test.getFileObject(testResName);
  29.297 -                if(fileObject != null) {
  29.298 -                                return new LocationResult(fileObject, -1);
  29.299 -                            }
  29.300 -
  29.301 -                            return new LocationResult("File not found"); //NOI18N
  29.302 -                        }
  29.303 -
  29.304 -                        @Override
  29.305 -                        public void findOpposite(FileObject fo, int caretOffset, LocationListener callback) {
  29.306 -                            throw new UnsupportedOperationException("This should not be called on synchronous locators.");
  29.307 -                        }
  29.308 -
  29.309 -                        @Override
  29.310 -                        public FileType getFileType(FileObject fo) {
  29.311 -                if(FileUtil.isParentOf(test, fo)) {
  29.312 -                                return FileType.TEST;
  29.313 -                } else if(FileUtil.isParentOf(src, fo)) {
  29.314 -                                return FileType.TESTED;
  29.315 -                            }
  29.316 -                            return FileType.NEITHER;
  29.317 -                        }
  29.318 -
  29.319 -                        private String getTestResName(String baseResName, String ext) {
  29.320 -                StringBuilder buf
  29.321 -                        = new StringBuilder(baseResName.length() + ext.length() + 10);
  29.322 -                            buf.append(baseResName).append("Test");                         //NOI18N
  29.323 -                            if (ext.length() != 0) {
  29.324 -                                buf.append('.').append(ext);
  29.325 -                            }
  29.326 -                            return buf.toString();
  29.327 -                        }
  29.328 -                    }});
  29.329 -        Main.initializeURLFactory();
  29.330 -        org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
  29.331 -        prepareTest();
  29.332 -        org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj = ProjectManager.getDefault().findProject(src.getParent())}, false);
  29.333 -        MimeTypes.setAllMimeTypes(Collections.singleton("text/x-java"));
  29.334 -        sourcePath = ClassPathSupport.createClassPath(src, test);
  29.335 -        GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {sourcePath});
  29.336 -        RepositoryUpdater.getDefault().start(true);
  29.337 -        super.setUp();
  29.338 -        FileUtil.createData(FileUtil.getConfigRoot(), "Templates/Classes/Empty.java");
  29.339 -        System.setProperty("org.netbeans.modules.parsing.impl.Source.excludedTasks", ".*");
  29.340 -    }
  29.341 -
  29.342 -    @Override
  29.343 -    protected void tearDown() throws Exception {
  29.344 -        super.tearDown();
  29.345 -        GlobalPathRegistry.getDefault().unregister(ClassPath.SOURCE, new ClassPath[] {sourcePath});
  29.346 -        org.netbeans.api.project.ui.OpenProjects.getDefault().close(new Project[] {prj});
  29.347 -        prj = null;
  29.348 -    }
  29.349 -
  29.350 -    private void prepareTest() throws Exception {
  29.351 -        FileObject workdir = SourceUtilsTestUtil.makeScratchDir(this);
  29.352 -
  29.353 -        FileObject projectFolder = FileUtil.createFolder(workdir, "testProject");
  29.354 -        src = FileUtil.createFolder(projectFolder, "src");
  29.355 -        test = FileUtil.createFolder(projectFolder, "test");
  29.356 -
  29.357 -        FileObject cache = FileUtil.createFolder(workdir, "cache");
  29.358 -
  29.359 -        CacheFolder.setCacheFolder(cache);
  29.360 -    }
  29.361 -
  29.362 -    @ServiceProvider(service=MimeDataProvider.class)
  29.363 -    public static final class MimeDataProviderImpl implements MimeDataProvider {
  29.364 -
  29.365 -        private static final Lookup L = Lookups.singleton(new JavaCustomIndexer.Factory());
  29.366 -
  29.367 -        @Override
  29.368 -        public Lookup getLookup(MimePath mimePath) {
  29.369 -            if ("text/x-java".equals(mimePath.getPath())) {
  29.370 -                return L;
  29.371 -            }
  29.372 -
  29.373 -            return null;
  29.374 -        }
  29.375 -        
  29.376 -    }
  29.377 -
  29.378 -    protected static boolean problemIsFatal(List<Problem> problems) {
  29.379 -        for (Problem problem : problems) {
  29.380 -            Problem next = problem;
  29.381 -            do {
  29.382 -                if (next.isFatal()) {
  29.383 -                    return true;
  29.384 -                }
  29.385 -                next = next.getNext();
  29.386 -            } while (next != null);
  29.387 -        }
  29.388 -        return false;
  29.389 -    }
  29.390 -}
  29.391 \ No newline at end of file
    30.1 --- a/sandbox/java.hints/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/duplicates/DuplicateMethodRefactoringPluginTest.java	Sun Jan 08 20:10:08 2017 +0100
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,165 +0,0 @@
    30.4 -/*
    30.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    30.6 - *
    30.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    30.8 - *
    30.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   30.10 - * Other names may be trademarks of their respective owners.
   30.11 - *
   30.12 - * The contents of this file are subject to the terms of either the GNU
   30.13 - * General Public License Version 2 only ("GPL") or the Common
   30.14 - * Development and Distribution License("CDDL") (collectively, the
   30.15 - * "License"). You may not use this file except in compliance with the
   30.16 - * License. You can obtain a copy of the License at
   30.17 - * http://www.netbeans.org/cddl-gplv2.html
   30.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   30.19 - * specific language governing permissions and limitations under the
   30.20 - * License.  When distributing the software, include this License Header
   30.21 - * Notice in each file and include the License file at
   30.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   30.23 - * particular file as subject to the "Classpath" exception as provided
   30.24 - * by Oracle in the GPL Version 2 section of the License file that
   30.25 - * accompanied this code. If applicable, add the following below the
   30.26 - * License Header, with the fields enclosed by brackets [] replaced by
   30.27 - * your own identifying information:
   30.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   30.29 - *
   30.30 - * If you wish your version of this file to be governed by only the CDDL
   30.31 - * or only the GPL Version 2, indicate your decision by adding
   30.32 - * "[Contributor] elects to include this software in this distribution
   30.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   30.34 - * single choice of license, a recipient has the option to distribute
   30.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   30.36 - * to extend the choice of license to its licensees as provided above.
   30.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   30.38 - * Version 2 license, then the option applies only if the new code is
   30.39 - * made subject to such option by the copyright holder.
   30.40 - *
   30.41 - * Contributor(s):
   30.42 - *
   30.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   30.44 - */
   30.45 -package org.netbeans.modules.jackpot30.hintsimpl.duplicates;
   30.46 -
   30.47 -import java.util.Arrays;
   30.48 -import java.util.LinkedList;
   30.49 -import java.util.List;
   30.50 -import javax.lang.model.element.ExecutableElement;
   30.51 -import javax.lang.model.util.ElementFilter;
   30.52 -import org.netbeans.api.java.source.CompilationController;
   30.53 -import org.netbeans.api.java.source.JavaSource;
   30.54 -import org.netbeans.api.java.source.Task;
   30.55 -import org.netbeans.api.java.source.TreePathHandle;
   30.56 -import org.netbeans.modules.jackpot30.hintsimpl.borrowed.RefactoringTestBase;
   30.57 -import org.netbeans.modules.refactoring.api.Problem;
   30.58 -import org.netbeans.modules.refactoring.api.RefactoringSession;
   30.59 -
   30.60 -/**
   30.61 - *
   30.62 - * @author lahvac
   30.63 - */
   30.64 -public class DuplicateMethodRefactoringPluginTest extends RefactoringTestBase {
   30.65 -
   30.66 -    public DuplicateMethodRefactoringPluginTest(String name) {
   30.67 -        super(name);
   30.68 -    }
   30.69 -
   30.70 -    public void testSimple() throws Exception {
   30.71 -        writeFilesAndWaitForScan(src,
   30.72 -                                 new File("test/Test.java",
   30.73 -                                          "package test;\n" +
   30.74 -                                          "public class Test {\n" +
   30.75 -                                          "    public static void toCall() {\n" +
   30.76 -                                          "        System.err.println(1);\n" +
   30.77 -                                          "    }\n" +
   30.78 -                                          "    public static void test1() {\n" +
   30.79 -                                          "        System.err.println(1);\n" +
   30.80 -                                          "    }\n" +
   30.81 -                                          "    public static void test2() {\n" +
   30.82 -                                          "        System.out.println(1);\n" +
   30.83 -                                          "    }\n" +
   30.84 -                                          "    public static void test3() {\n" +
   30.85 -                                          "        System.err.println(2);\n" +
   30.86 -                                          "    }\n" +
   30.87 -                                          "}\n"));
   30.88 -        performDuplicateMethod("toCall");
   30.89 -        verifyContent(src,
   30.90 -                      new File("test/Test.java",
   30.91 -                               "package test;\n" +
   30.92 -                               "public class Test {\n" +
   30.93 -                               "    public static void toCall() {\n" +
   30.94 -                               "        System.err.println(1);\n" +
   30.95 -                               "    }\n" +
   30.96 -                               "    public static void test1() {\n" +
   30.97 -                               "        toCall();\n" +
   30.98 -                               "    }\n" +
   30.99 -                               "    public static void test2() {\n" +
  30.100 -                               "        System.out.println(1);\n" +
  30.101 -                               "    }\n" +
  30.102 -                               "    public static void test3() {\n" +
  30.103 -                               "        System.err.println(2);\n" +
  30.104 -                               "    }\n" +
  30.105 -                               "}\n"));
  30.106 -    }
  30.107 -
  30.108 -    public void testParams() throws Exception {
  30.109 -        writeFilesAndWaitForScan(src,
  30.110 -                                 new File("test/Test.java",
  30.111 -                                          "package test;\n" +
  30.112 -                                          "public class Test {\n" +
  30.113 -                                          "    public static void toCall(int i) {\n" +
  30.114 -                                          "        System.err.println(i);\n" +
  30.115 -                                          "    }\n" +
  30.116 -                                          "    public static void test1(int j) {\n" +
  30.117 -                                          "        System.err.println(1 + j);\n" +
  30.118 -                                          "    }\n" +
  30.119 -                                          "    public static void test3() {\n" +
  30.120 -                                          "        System.err.println(2);\n" +
  30.121 -                                          "    }\n" +
  30.122 -                                          "}\n"));
  30.123 -        performDuplicateMethod("toCall");
  30.124 -        verifyContent(src,
  30.125 -                      new File("test/Test.java",
  30.126 -                               "package test;\n" +
  30.127 -                               "public class Test {\n" +
  30.128 -                               "    public static void toCall(int i) {\n" +
  30.129 -                               "        System.err.println(i);\n" +
  30.130 -                               "    }\n" +
  30.131 -                               "    public static void test1(int j) {\n" +
  30.132 -                               "        toCall(1 + j);\n" +
  30.133 -                               "    }\n" +
  30.134 -                               "    public static void test3() {\n" +
  30.135 -                               "        toCall(2);\n" +
  30.136 -                               "    }\n" +
  30.137 -                               "}\n"));
  30.138 -    }
  30.139 -
  30.140 -    private void performDuplicateMethod(final String methodName, Problem... expectedProblems) throws Exception {
  30.141 -        final DuplicateMethodRefactoring[] r = new DuplicateMethodRefactoring[1];
  30.142 -
  30.143 -        JavaSource.forFileObject(src.getFileObject("test/Test.java")).runUserActionTask(new Task<CompilationController>() {
  30.144 -            @Override public void run(CompilationController javac) throws Exception {
  30.145 -                javac.toPhase(JavaSource.Phase.RESOLVED);
  30.146 -
  30.147 -                for (ExecutableElement method : ElementFilter.methodsIn(javac.getTopLevelElements().get(0).getEnclosedElements())) {
  30.148 -                    if (method.getSimpleName().contentEquals(methodName)) {
  30.149 -                        r[0] = new DuplicateMethodRefactoring(TreePathHandle.create(javac.getTrees().getPath(method), javac));
  30.150 -                    }
  30.151 -                }
  30.152 -            }
  30.153 -        }, true);
  30.154 -
  30.155 -        RefactoringSession rs = RefactoringSession.create("Session");
  30.156 -        List<Problem> problems = new LinkedList<Problem>();
  30.157 -
  30.158 -        addAllProblems(problems, r[0].preCheck());
  30.159 -        if (!problemIsFatal(problems)) {
  30.160 -            addAllProblems(problems, r[0].prepare(rs));
  30.161 -        }
  30.162 -        if (!problemIsFatal(problems)) {
  30.163 -            addAllProblems(problems, rs.doRefactoring(true));
  30.164 -        }
  30.165 -
  30.166 -        assertProblems(Arrays.asList(expectedProblems), problems);
  30.167 -    }
  30.168 -}
    31.1 --- a/sandbox/java.hints/java.hints.test/apichanges.xml	Sun Jan 08 20:10:08 2017 +0100
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,181 +0,0 @@
    31.4 -<?xml version="1.0" encoding="UTF-8"?>
    31.5 -<!-- Search for CHANGEME in this document when copying and using it: -->
    31.6 -<!--
    31.7 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    31.8 -
    31.9 -Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
   31.10 -
   31.11 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   31.12 -Other names may be trademarks of their respective owners.
   31.13 -
   31.14 -The contents of this file are subject to the terms of either the GNU
   31.15 -General Public License Version 2 only ("GPL") or the Common
   31.16 -Development and Distribution License("CDDL") (collectively, the
   31.17 -"License"). You may not use this file except in compliance with the
   31.18 -License. You can obtain a copy of the License at
   31.19 -http://www.netbeans.org/cddl-gplv2.html
   31.20 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   31.21 -specific language governing permissions and limitations under the
   31.22 -License.  When distributing the software, include this License Header
   31.23 -Notice in each file and include the License file at
   31.24 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   31.25 -particular file as subject to the "Classpath" exception as provided
   31.26 -by Oracle in the GPL Version 2 section of the License file that
   31.27 -accompanied this code. If applicable, add the following below the
   31.28 -License Header, with the fields enclosed by brackets [] replaced by
   31.29 -your own identifying information:
   31.30 -"Portions Copyrighted [year] [name of copyright owner]"
   31.31 -
   31.32 -Contributor(s):
   31.33 -
   31.34 -The Original Software is NetBeans. The Initial Developer of the Original
   31.35 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun
   31.36 -Microsystems, Inc. All Rights Reserved.
   31.37 -
   31.38 -If you wish your version of this file to be governed by only the CDDL
   31.39 -or only the GPL Version 2, indicate your decision by adding
   31.40 -"[Contributor] elects to include this software in this distribution
   31.41 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   31.42 -single choice of license, a recipient has the option to distribute
   31.43 -your version of this file under either the CDDL, the GPL Version 2 or
   31.44 -to extend the choice of license to its licensees as provided above.
   31.45 -However, if you add GPL Version 2 code and therefore, elected the GPL
   31.46 -Version 2 license, then the option applies only if the new code is
   31.47 -made subject to such option by the copyright holder.
   31.48 --->
   31.49 -<?xml-stylesheet type="text/xml" href="../nbbuild/javadoctools/apichanges.xsl"?>
   31.50 -<!DOCTYPE apichanges PUBLIC "-//NetBeans//DTD API changes list 1.0//EN" "../nbbuild/javadoctools/apichanges.dtd">
   31.51 -
   31.52 -<!--
   31.53 -
   31.54 -INFO FOR PEOPLE ADDING CHANGES:
   31.55 -
   31.56 -Check the DTD (apichanges.dtd) for details on the syntax. You do not
   31.57 -need to regenerate the HTML, as this is part of Javadoc generation; just
   31.58 -change the XML. Rough syntax of a change (several parts optional):
   31.59 -
   31.60 -<change>
   31.61 -    <api name="compiler"/>
   31.62 -    <summary>Some brief description here, can use <b>XHTML</b></summary>
   31.63 -    <version major="1" minor="99"/>
   31.64 -    <date day="13" month="6" year="2001"/>
   31.65 -    <author login="jrhacker"/>
   31.66 -    <compatibility addition="yes"/>
   31.67 -    <description>
   31.68 -        The main description of the change here.
   31.69 -        Again can use full <b>XHTML</b> as needed.
   31.70 -    </description>
   31.71 -    <class package="org.openide.compiler" name="DoWhatIWantCompiler"/>
   31.72 -    <issue number="14309"/>
   31.73 -</change>
   31.74 -
   31.75 -Also permitted elements: <package>, <branch>. <version> is API spec
   31.76 -version, recommended for all new changes. <compatibility> should say
   31.77 -if things were added/modified/deprecated/etc. and give all information
   31.78 -related to upgrading old code. List affected top-level classes and
   31.79 -link to issue numbers if applicable. See the DTD for more details.
   31.80 -
   31.81 -Changes need not be in any particular order, they are sorted in various
   31.82 -ways by the stylesheet anyway.
   31.83 -
   31.84 -Dates are assumed to mean "on the trunk". If you *also* make the same
   31.85 -change on a stabilization branch, use the <branch> tag to indicate this
   31.86 -and explain why the change was made on a branch in the <description>.
   31.87 -
   31.88 -Please only change this file on the trunk! Rather: you can change it
   31.89 -on branches if you want, but these changes will be ignored; only the
   31.90 -trunk version of this file is important.
   31.91 -
   31.92 -Deprecations do not count as incompatible, assuming that code using the
   31.93 -deprecated calls continues to see their documented behavior. But do
   31.94 -specify deprecation="yes" in <compatibility>.
   31.95 -
   31.96 -This file is not a replacement for Javadoc: it is intended to list changes,
   31.97 -not describe the complete current behavior, for which ordinary documentation
   31.98 -is the proper place.
   31.99 -
  31.100 --->
  31.101 -
  31.102 -<apichanges>
  31.103 -
  31.104 -    <!-- First, a list of API names you may use: -->
  31.105 -    <apidefs>
  31.106 -        <apidef name="JavaHintsTest">Java Hints Test API</apidef>
  31.107 -    </apidefs>
  31.108 -
  31.109 -    <!-- ACTUAL CHANGES BEGIN HERE: -->
  31.110 -
  31.111 -    <changes>
  31.112 -        <change id="HintTest-singleHint">
  31.113 -            <api name="JavaHintsTest"/>
  31.114 -            <summary>Allowed to check a single hint</summary>
  31.115 -            <version major="1" minor="9"/>
  31.116 -            <date day="3" month="4" year="2013"/>
  31.117 -            <author login="sdedic"/>
  31.118 -            <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible"/>
  31.119 -            <description>
  31.120 -                New method <code>run(Class, String)</code> was added so that hint with a specific ID can be run, if the
  31.121 -                class contains multiple hint implementations.
  31.122 -            </description>
  31.123 -            <class name="HintTest" package="org.netbeans.modules.java.hints.test.api"/>
  31.124 -            <issue number="227962"/>
  31.125 -        </change>
  31.126 -        <change id="HintTest-ensureJavaFixes">
  31.127 -             <api name="JavaHintsTest"/>
  31.128 -             <summary>Added assertFixes method to HintWarning</summary>
  31.129 -             <version major="1" minor="8"/>
  31.130 -             <date day="22" month="3" year="2013"/>
  31.131 -             <author login="jlahoda"/>
  31.132 -             <compatibility addition="no" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="incompatible" source="compatible"/>
  31.133 -             <description>
  31.134 -                 <code>HintTest.HintWarning.applyFix</code> now enforces constraints for Inspect&amp;Transform. Unless a hint
  31.135 -                 is marked as <code>Options.QUERY</code>, <code>Options.NO_BULK</code> or <code>Kind.ACTION</code>,
  31.136 -                 the <code>Fix</code> that is being applied is tested to be <code>JavaFix</code> and repeatable,
  31.137 -                 which are the requirements of Inspect&amp;Transform.
  31.138 -             </description>
  31.139 -             <class name="HintTest" package="org.netbeans.modules.java.hints.test.api"/>
  31.140 -             <issue number="227271"/>
  31.141 -        </change>
  31.142 -        
  31.143 -        <change id="HintWarning-assertFixes">
  31.144 -             <api name="JavaHintsTest"/>
  31.145 -             <summary>Added assertFixes method to HintWarning</summary>
  31.146 -             <version major="1" minor="1"/>
  31.147 -             <date day="30" month="3" year="2012"/>
  31.148 -             <author login="jlahoda"/>
  31.149 -             <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible"/>
  31.150 -             <description>
  31.151 -                 Added assertFixes method to HintWarning
  31.152 -             </description>
  31.153 -             <class name="HintTest" package="org.netbeans.modules.java.hints.test.api"/>
  31.154 -             <issue number="209828"/>
  31.155 -        </change>
  31.156 -
  31.157 -    </changes>
  31.158 -
  31.159 -    <!-- Now the surrounding HTML text and document structure: -->
  31.160 -
  31.161 -    <htmlcontents>
  31.162 -<!-- Generated from apichanges.xml -->
  31.163 -    <head>
  31.164 -      <title>Change History for the Editor Hints SPI</title>
  31.165 -      <link rel="stylesheet" href="prose.css" type="text/css"/>
  31.166 -    </head>
  31.167 -    <body>
  31.168 -
  31.169 -<p class="overviewlink"><a href="@TOP@/overview-summary.html">Overview</a></p>
  31.170 -
  31.171 -<h1>Introduction</h1>
  31.172 -
  31.173 -<p>This document lists changes made to the <a href="@TOP@/overview-summary.html">Editor Hints SPI</a>.</p>
  31.174 -
  31.175 -<!-- The actual lists of changes, as summaries and details: -->
  31.176 -      <hr/>
  31.177 -      <standard-changelists module-code-name="org.netbeans.spi.editor.hints/0"/>
  31.178 -
  31.179 -      <hr/><p>@FOOTER@</p>
  31.180 -
  31.181 -    </body>
  31.182 -  </htmlcontents>
  31.183 -
  31.184 -</apichanges>
    32.1 --- a/sandbox/java.hints/java.hints.test/arch.xml	Sun Jan 08 20:10:08 2017 +0100
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,1121 +0,0 @@
    32.4 -<?xml version="1.0" encoding="UTF-8"?>
    32.5 -<!--
    32.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    32.7 -
    32.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    32.9 -
   32.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   32.11 -Other names may be trademarks of their respective owners.
   32.12 -
   32.13 -The contents of this file are subject to the terms of either the GNU
   32.14 -General Public License Version 2 only ("GPL") or the Common
   32.15 -Development and Distribution License("CDDL") (collectively, the
   32.16 -"License"). You may not use this file except in compliance with the
   32.17 -License. You can obtain a copy of the License at
   32.18 -http://www.netbeans.org/cddl-gplv2.html
   32.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   32.20 -specific language governing permissions and limitations under the
   32.21 -License.  When distributing the software, include this License Header
   32.22 -Notice in each file and include the License file at
   32.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   32.24 -particular file as subject to the "Classpath" exception as provided
   32.25 -by Oracle in the GPL Version 2 section of the License file that
   32.26 -accompanied this code. If applicable, add the following below the
   32.27 -License Header, with the fields enclosed by brackets [] replaced by
   32.28 -your own identifying information:
   32.29 -"Portions Copyrighted [year] [name of copyright owner]"
   32.30 -
   32.31 -Contributor(s):
   32.32 -
   32.33 -The Original Software is NetBeans. The Initial Developer of the Original
   32.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   32.35 -Microsystems, Inc. All Rights Reserved.
   32.36 -
   32.37 -If you wish your version of this file to be governed by only the CDDL
   32.38 -or only the GPL Version 2, indicate your decision by adding
   32.39 -"[Contributor] elects to include this software in this distribution
   32.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   32.41 -single choice of license, a recipient has the option to distribute
   32.42 -your version of this file under either the CDDL, the GPL Version 2 or
   32.43 -to extend the choice of license to its licensees as provided above.
   32.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   32.45 -Version 2 license, then the option applies only if the new code is
   32.46 -made subject to such option by the copyright holder.
   32.47 --->
   32.48 -<!DOCTYPE api-answers PUBLIC "-//NetBeans//DTD Arch Answers//EN" "../nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd" [
   32.49 -  <!ENTITY api-questions SYSTEM "../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml">
   32.50 -]>
   32.51 -
   32.52 -<api-answers
   32.53 -  question-version="1.29"
   32.54 -  author="yourname@netbeans.org"
   32.55 ->
   32.56 -
   32.57 -  &api-questions;
   32.58 -
   32.59 -
   32.60 -<!--
   32.61 -        <question id="arch-overall" when="init">
   32.62 -            Describe the overall architecture. 
   32.63 -            <hint>
   32.64 -            What will be API for 
   32.65 -            <a href="http://wiki.netbeans.org/API_Design#Separate_API_for_clients_from_support_API">
   32.66 -                clients and what support API</a>? 
   32.67 -            What parts will be pluggable?
   32.68 -            How will plug-ins be registered? Please use <code>&lt;api type="export"/&gt;</code>
   32.69 -            to describe your general APIs and specify their
   32.70 -            <a href="http://wiki.netbeans.org/API_Stability#Private">
   32.71 -            stability categories</a>.
   32.72 -            If possible please provide simple diagrams.
   32.73 -            </hint>
   32.74 -        </question>
   32.75 --->
   32.76 - <answer id="arch-overall">
   32.77 -  <p>
   32.78 -   <api type="export" category="devel" group="java" name="java.hints.test">
   32.79 -       API to create tests for the custom Java hints.
   32.80 -   </api>
   32.81 -  </p>
   32.82 - </answer>
   32.83 -
   32.84 -
   32.85 -
   32.86 -<!--
   32.87 -        <question id="arch-quality" when="init">
   32.88 -            How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a>
   32.89 -            of your code be tested and 
   32.90 -            how are future regressions going to be prevented?
   32.91 -            <hint>
   32.92 -            What kind of testing do
   32.93 -            you want to use? How much functionality, in which areas,
   32.94 -            should be covered by the tests? How you find out that your
   32.95 -            project was successful?
   32.96 -            </hint>
   32.97 -        </question>
   32.98 --->
   32.99 - <answer id="arch-quality">
  32.100 -  <p>
  32.101 -   XXX no answer for arch-quality
  32.102 -  </p>
  32.103 - </answer>
  32.104 -
  32.105 -
  32.106 -
  32.107 -<!--
  32.108 -        <question id="arch-time" when="init">
  32.109 -            What are the time estimates of the work?
  32.110 -            <hint>
  32.111 -            Please express your estimates of how long the design, implementation,
  32.112 -            stabilization are likely to last. How many people will be needed to
  32.113 -            implement this and what is the expected milestone by which the work should be 
  32.114 -            ready?
  32.115 -            </hint>
  32.116 -        </question>
  32.117 --->
  32.118 - <answer id="arch-time">
  32.119 -  <p>
  32.120 -   XXX no answer for arch-time
  32.121 -  </p>
  32.122 - </answer>
  32.123 -
  32.124 -
  32.125 -
  32.126 -<!--
  32.127 -        <question id="arch-usecases" when="init">
  32.128 -            <hint>
  32.129 -                Content of this answer will be displayed as part of page at
  32.130 -                http://www.netbeans.org/download/dev/javadoc/usecases.html 
  32.131 -                You can use tags &lt;usecase name="name&gt; regular html description &lt;/usecase&gt;
  32.132 -                and if you want to use an URL you can prefix if with @TOP@ to begin
  32.133 -                at the root of your javadoc
  32.134 -            </hint>
  32.135 -        
  32.136 -            Describe the main <a href="http://wiki.netbeans.org/API_Design#The_Importance_of_Being_Use_Case_Oriented">
  32.137 -            use cases</a> of the new API. Who will use it under
  32.138 -            what circumstances? What kind of code would typically need to be written
  32.139 -            to use the module?
  32.140 -        </question>
  32.141 --->
  32.142 - <answer id="arch-usecases">
  32.143 -  <p>
  32.144 -   XXX no answer for arch-usecases
  32.145 -  </p>
  32.146 - </answer>
  32.147 -
  32.148 -
  32.149 -
  32.150 -<!--
  32.151 -        <question id="arch-what" when="init">
  32.152 -            What is this project good for?
  32.153 -            <hint>
  32.154 -            Please provide here a few lines describing the project, 
  32.155 -            what problem it should solve, provide links to documentation, 
  32.156 -            specifications, etc.
  32.157 -            </hint>
  32.158 -        </question>
  32.159 --->
  32.160 - <answer id="arch-what">
  32.161 -  <p>
  32.162 -   XXX no answer for arch-what
  32.163 -  </p>
  32.164 - </answer>
  32.165 -
  32.166 -
  32.167 -
  32.168 -<!--
  32.169 -        <question id="arch-where" when="impl">
  32.170 -            Where one can find sources for your module?
  32.171 -            <hint>
  32.172 -                Please provide link to the Hg web client at
  32.173 -                http://hg.netbeans.org/
  32.174 -                or just use tag defaultanswer generate='here'
  32.175 -            </hint>
  32.176 -        </question>
  32.177 --->
  32.178 - <answer id="arch-where">
  32.179 -  <defaultanswer generate='here' />
  32.180 - </answer>
  32.181 -
  32.182 -
  32.183 -
  32.184 -<!--
  32.185 -        <question id="compat-deprecation" when="init">
  32.186 -            How the introduction of your project influences functionality
  32.187 -            provided by previous version of the product?
  32.188 -            <hint>
  32.189 -            If you are planning to deprecate/remove/change any existing APIs,
  32.190 -            list them here accompanied with the reason explaining why you
  32.191 -            are doing so.
  32.192 -            </hint>
  32.193 -        </question>
  32.194 --->
  32.195 - <answer id="compat-deprecation">
  32.196 -  <p>
  32.197 -   XXX no answer for compat-deprecation
  32.198 -  </p>
  32.199 - </answer>
  32.200 -
  32.201 -
  32.202 -
  32.203 -<!--
  32.204 -        <question id="compat-i18n" when="impl">
  32.205 -            Is your module correctly internationalized?
  32.206 -            <hint>
  32.207 -            Correct internationalization means that it obeys instructions 
  32.208 -            at <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html">
  32.209 -            NetBeans I18N pages</a>.
  32.210 -            </hint>
  32.211 -        </question>
  32.212 --->
  32.213 - <answer id="compat-i18n">
  32.214 -  <p>
  32.215 -   XXX no answer for compat-i18n
  32.216 -  </p>
  32.217 - </answer>
  32.218 -
  32.219 -
  32.220 -
  32.221 -<!--
  32.222 -        <question id="compat-standards" when="init">
  32.223 -            Does the module implement or define any standards? Is the 
  32.224 -            implementation exact or does it deviate somehow?
  32.225 -        </question>
  32.226 --->
  32.227 - <answer id="compat-standards">
  32.228 -  <p>
  32.229 -   XXX no answer for compat-standards
  32.230 -  </p>
  32.231 - </answer>
  32.232 -
  32.233 -
  32.234 -
  32.235 -<!--
  32.236 -        <question id="compat-version" when="impl">
  32.237 -            Can your module coexist with earlier and future
  32.238 -            versions of itself? Can you correctly read all old settings? Will future
  32.239 -            versions be able to read your current settings? Can you read
  32.240 -            or politely ignore settings stored by a future version?
  32.241 -            
  32.242 -            <hint>
  32.243 -            Very helpful for reading settings is to store version number
  32.244 -            there, so future versions can decide whether how to read/convert
  32.245 -            the settings and older versions can ignore the new ones.
  32.246 -            </hint>
  32.247 -        </question>
  32.248 --->
  32.249 - <answer id="compat-version">
  32.250 -  <p>
  32.251 -   XXX no answer for compat-version
  32.252 -  </p>
  32.253 - </answer>
  32.254 -
  32.255 -
  32.256 -
  32.257 -<!--
  32.258 -        <question id="dep-jre" when="final">
  32.259 -            Which version of JRE do you need (1.2, 1.3, 1.4, etc.)?
  32.260 -            <hint>
  32.261 -            It is expected that if your module runs on 1.x that it will run 
  32.262 -            on 1.x+1 if no, state that please. Also describe here cases where
  32.263 -            you run different code on different versions of JRE and why.
  32.264 -            </hint>
  32.265 -        </question>
  32.266 --->
  32.267 - <answer id="dep-jre">
  32.268 -  <p>
  32.269 -   XXX no answer for dep-jre
  32.270 -  </p>
  32.271 - </answer>
  32.272 -
  32.273 -
  32.274 -
  32.275 -<!--
  32.276 -        <question id="dep-jrejdk" when="final">
  32.277 -            Do you require the JDK or is the JRE enough?
  32.278 -        </question>
  32.279 --->
  32.280 - <answer id="dep-jrejdk">
  32.281 -  <p>
  32.282 -   XXX no answer for dep-jrejdk
  32.283 -  </p>
  32.284 - </answer>
  32.285 -
  32.286 -
  32.287 -
  32.288 -<!--
  32.289 -        <question id="dep-nb" when="init">
  32.290 -            What other NetBeans projects and modules does this one depend on?
  32.291 -            <hint>
  32.292 -            Depending on other NetBeans projects influnces the ability of
  32.293 -            users of your work to customize their own branded version of
  32.294 -            NetBeans by enabling and disabling some modules. Too
  32.295 -            much dependencies restrict this kind of customization. If that
  32.296 -            is your case, then you may want to split your functionality into
  32.297 -            pieces of autoload, eager and regular modules which can be
  32.298 -            enabled independently. Usually the answer to this question
  32.299 -            is generated from your <code>project.xml</code> file, but
  32.300 -            if it is not guessed correctly, you can suppress it by
  32.301 -            specifying &lt;defaultanswer generate="none"/&gt; and
  32.302 -            write here your own. Please describe such projects as imported APIs using
  32.303 -            the <code>&lt;api name="identification" type="import or export" category="stable" url="where is the description" /&gt;</code>.
  32.304 -            By doing this information gets listed in the summary page of your
  32.305 -            javadoc.
  32.306 -            </hint>
  32.307 -        </question>
  32.308 --->
  32.309 - <answer id="dep-nb">
  32.310 -  <defaultanswer generate='here' />
  32.311 - </answer>
  32.312 -
  32.313 -
  32.314 -
  32.315 -<!--
  32.316 -        <question id="dep-non-nb" when="init">
  32.317 -            What other projects outside NetBeans does this one depend on?
  32.318 -            
  32.319 -            <hint>
  32.320 -            Depending on 3rd party libraries is always problematic,
  32.321 -            especially if they are not open source, as that complicates
  32.322 -            the licensing scheme of NetBeans. Please enumerate your
  32.323 -            external dependencies here, so it is correctly understood since
  32.324 -            the begining what are the legal implications of your project.
  32.325 -            Also please note that
  32.326 -            some non-NetBeans projects are packaged as NetBeans modules
  32.327 -            (see <a href="http://libs.netbeans.org/">libraries</a>) and
  32.328 -            it is preferred to use this approach when more modules may
  32.329 -            depend and share such third-party libraries.
  32.330 -            </hint>
  32.331 -        </question>
  32.332 --->
  32.333 - <answer id="dep-non-nb">
  32.334 -  <p>
  32.335 -   XXX no answer for dep-non-nb
  32.336 -  </p>
  32.337 - </answer>
  32.338 -
  32.339 -
  32.340 -
  32.341 -<!--
  32.342 -        <question id="dep-platform" when="init">
  32.343 -            On which platforms does your module run? Does it run in the same
  32.344 -            way on each?
  32.345 -            <hint>
  32.346 -            If you plan any dependency on OS or any usage of native code,
  32.347 -            please describe why you are doing so and describe how you envision
  32.348 -            to enforce the portability of your code.
  32.349 -            Please note that there is a support for <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#how-os-specific">OS conditionally
  32.350 -            enabled modules</a> which together with autoload/eager modules
  32.351 -            can allow you to enable to provide the best OS aware support
  32.352 -            on certain OSes while providing compatibility bridge on the not
  32.353 -            supported ones.
  32.354 -            Also please list the supported
  32.355 -            OSes/HW platforms and mentioned the lovest version of JDK required
  32.356 -            for your project to run on. Also state whether JRE is enough or
  32.357 -            you really need JDK.
  32.358 -            </hint>
  32.359 -        </question>
  32.360 --->
  32.361 - <answer id="dep-platform">
  32.362 -  <p>
  32.363 -   XXX no answer for dep-platform
  32.364 -  </p>
  32.365 - </answer>
  32.366 -
  32.367 -
  32.368 -
  32.369 -<!--
  32.370 -        <question id="deploy-dependencies" when="final">
  32.371 -            What do other modules need to do to declare a dependency on this one,
  32.372 -            in addition to or instead of the normal module dependency declaration
  32.373 -            (e.g. tokens to require)?
  32.374 -            <hint>
  32.375 -                Provide a sample of the actual lines you would add to a module manifest
  32.376 -                to declare a dependency, for example OpenIDE-Module-Requires: some.token.
  32.377 -                If other modules should not depend on this module, or should just use a
  32.378 -                simple regular module dependency, you can just answer "nothing". If you
  32.379 -                intentionally expose a semistable API to clients using implementation
  32.380 -                dependencies, you should mention that here (but there is no need to give
  32.381 -                an example of usage).
  32.382 -            </hint>
  32.383 -        </question>
  32.384 --->
  32.385 - <answer id="deploy-dependencies">
  32.386 -  <p>
  32.387 -   XXX no answer for deploy-dependencies
  32.388 -  </p>
  32.389 - </answer>
  32.390 -
  32.391 -
  32.392 -
  32.393 -<!--
  32.394 -        <question id="deploy-jar" when="impl">
  32.395 -            Do you deploy just module JAR file(s) or other files as well?
  32.396 -            <hint>
  32.397 -            Usually a module consist of one JAR file (perhaps with Class-Path
  32.398 -            extensions) and also a configuration file that enables it. If you
  32.399 -            have any other files, use
  32.400 -            &lt;api group="java.io.File" name="yourname" type="export" category="friend"&gt;...&lt;/api&gt;
  32.401 -            to define the location, name and stability of your files (of course
  32.402 -            changing "yourname" and "friend" to suit your needs).
  32.403 -            
  32.404 -            If it uses more than one JAR, describe where they are located, how
  32.405 -            they refer to each other. 
  32.406 -            If it consist of module JAR(s) and other files, please describe
  32.407 -            what is their purpose, why other files are necessary. Please 
  32.408 -            make sure that installation/uninstallation leaves the system 
  32.409 -            in state as it was before installation.
  32.410 -            </hint>
  32.411 -        </question>
  32.412 --->
  32.413 - <answer id="deploy-jar">
  32.414 -  <p>
  32.415 -   XXX no answer for deploy-jar
  32.416 -  </p>
  32.417 - </answer>
  32.418 -
  32.419 -
  32.420 -
  32.421 -<!--
  32.422 -        <question id="deploy-nbm" when="impl">
  32.423 -            Can you deploy an NBM via the Update Center?
  32.424 -            <hint>
  32.425 -            If not why?
  32.426 -            </hint>
  32.427 -        </question>
  32.428 --->
  32.429 - <answer id="deploy-nbm">
  32.430 -  <p>
  32.431 -   XXX no answer for deploy-nbm
  32.432 -  </p>
  32.433 - </answer>
  32.434 -
  32.435 -
  32.436 -
  32.437 -<!--
  32.438 -        <question id="deploy-packages" when="init">
  32.439 -            Are packages of your module made inaccessible by not declaring them
  32.440 -            public?
  32.441 -            
  32.442 -            <hint>
  32.443 -            By default NetBeans build harness treats all packages are private.
  32.444 -            If you export some of them - either as public or friend packages,
  32.445 -            you should have a reason. If the reason is described elsewhere
  32.446 -            in this document, you can ignore this question.
  32.447 -            </hint>
  32.448 -        </question>
  32.449 --->
  32.450 - <answer id="deploy-packages">
  32.451 -  <p>
  32.452 -   XXX no answer for deploy-packages
  32.453 -  </p>
  32.454 - </answer>
  32.455 -
  32.456 -
  32.457 -
  32.458 -<!--
  32.459 -        <question id="deploy-shared" when="final">
  32.460 -            Do you need to be installed in the shared location only, or in the user directory only,
  32.461 -            or can your module be installed anywhere?
  32.462 -            <hint>
  32.463 -            Installation location shall not matter, if it does explain why.
  32.464 -            Consider also whether <code>InstalledFileLocator</code> can help.
  32.465 -            </hint>
  32.466 -        </question>
  32.467 --->
  32.468 - <answer id="deploy-shared">
  32.469 -  <p>
  32.470 -   XXX no answer for deploy-shared
  32.471 -  </p>
  32.472 - </answer>
  32.473 -
  32.474 -
  32.475 -
  32.476 -<!--
  32.477 -        <question id="exec-ant-tasks" when="impl">
  32.478 -            Do you define or register any ant tasks that other can use?
  32.479 -            
  32.480 -            <hint>
  32.481 -            If you provide an ant task that users can use, you need to be very
  32.482 -            careful about its syntax and behaviour, as it most likely forms an
  32.483 -	          API for end users and as there is a lot of end users, their reaction
  32.484 -            when such API gets broken can be pretty strong.
  32.485 -            </hint>
  32.486 -        </question>
  32.487 --->
  32.488 - <answer id="exec-ant-tasks">
  32.489 -  <p>
  32.490 -   XXX no answer for exec-ant-tasks
  32.491 -  </p>
  32.492 - </answer>
  32.493 -
  32.494 -
  32.495 -
  32.496 -<!--
  32.497 -        <question id="exec-classloader" when="impl">
  32.498 -            Does your code create its own class loader(s)?
  32.499 -            <hint>
  32.500 -            A bit unusual. Please explain why and what for.
  32.501 -            </hint>
  32.502 -        </question>
  32.503 --->
  32.504 - <answer id="exec-classloader">
  32.505 -  <p>
  32.506 -   XXX no answer for exec-classloader
  32.507 -  </p>
  32.508 - </answer>
  32.509 -
  32.510 -
  32.511 -
  32.512 -<!--
  32.513 -        <question id="exec-component" when="impl">
  32.514 -            Is execution of your code influenced by any (string) property
  32.515 -            of any of your components?
  32.516 -            
  32.517 -            <hint>
  32.518 -            Often <code>JComponent.getClientProperty</code>, <code>Action.getValue</code>
  32.519 -            or <code>PropertyDescriptor.getValue</code>, etc. are used to influence
  32.520 -            a behavior of some code. This of course forms an interface that should
  32.521 -            be documented. Also if one depends on some interface that an object
  32.522 -            implements (<code>component instanceof Runnable</code>) that forms an
  32.523 -            API as well.
  32.524 -            </hint>
  32.525 -        </question>
  32.526 --->
  32.527 - <answer id="exec-component">
  32.528 -  <p>
  32.529 -   XXX no answer for exec-component
  32.530 -  </p>
  32.531 - </answer>
  32.532 -
  32.533 -
  32.534 -
  32.535 -<!--
  32.536 -        <question id="exec-introspection" when="impl">
  32.537 -            Does your module use any kind of runtime type information (<code>instanceof</code>,
  32.538 -            work with <code>java.lang.Class</code>, etc.)?
  32.539 -            <hint>
  32.540 -            Check for cases when you have an object of type A and you also
  32.541 -            expect it to (possibly) be of type B and do some special action. That
  32.542 -            should be documented. The same applies on operations in meta-level
  32.543 -            (Class.isInstance(...), Class.isAssignableFrom(...), etc.).
  32.544 -            </hint>
  32.545 -        </question>
  32.546 --->
  32.547 - <answer id="exec-introspection">
  32.548 -  <p>
  32.549 -   XXX no answer for exec-introspection
  32.550 -  </p>
  32.551 - </answer>
  32.552 -
  32.553 -
  32.554 -
  32.555 -<!--
  32.556 -        <question id="exec-privateaccess" when="final">
  32.557 -            Are you aware of any other parts of the system calling some of 
  32.558 -            your methods by reflection?
  32.559 -            <hint>
  32.560 -            If so, describe the "contract" as an API. Likely private or friend one, but
  32.561 -            still API and consider rewrite of it.
  32.562 -            </hint>
  32.563 -        </question>
  32.564 --->
  32.565 - <answer id="exec-privateaccess">
  32.566 -  <p>
  32.567 -   XXX no answer for exec-privateaccess
  32.568 -  </p>
  32.569 - </answer>
  32.570 -
  32.571 -
  32.572 -
  32.573 -<!--
  32.574 -        <question id="exec-process" when="impl">
  32.575 -            Do you execute an external process from your module? How do you ensure
  32.576 -            that the result is the same on different platforms? Do you parse output?
  32.577 -            Do you depend on result code?
  32.578 -            <hint>
  32.579 -            If you feed an input, parse the output please declare that as an API.
  32.580 -            </hint>
  32.581 -        </question>
  32.582 --->
  32.583 - <answer id="exec-process">
  32.584 -  <p>
  32.585 -   XXX no answer for exec-process
  32.586 -  </p>
  32.587 - </answer>
  32.588 -
  32.589 -
  32.590 -
  32.591 -<!--
  32.592 -        <question id="exec-property" when="impl">
  32.593 -            Is execution of your code influenced by any environment or
  32.594 -            Java system (<code>System.getProperty</code>) property?
  32.595 -            On a similar note, is there something interesting that you
  32.596 -            pass to <code>java.util.logging.Logger</code>? Or do you observe
  32.597 -            what others log?
  32.598 -            <hint>
  32.599 -            If there is a property that can change the behavior of your 
  32.600 -            code, somebody will likely use it. You should describe what it does 
  32.601 -            and the <a href="http://wiki.netbeans.org/API_Stability">stability category</a>
  32.602 -            of this API. You may use
  32.603 -            <pre>
  32.604 -                &lt;api type="export" group="property" name="id" category="private" url="http://..."&gt;
  32.605 -                    description of the property, where it is used, what it influence, etc.
  32.606 -                &lt;/api&gt;            
  32.607 -            </pre>
  32.608 -            </hint>
  32.609 -        </question>
  32.610 --->
  32.611 - <answer id="exec-property">
  32.612 -  <p>
  32.613 -   XXX no answer for exec-property
  32.614 -  </p>
  32.615 - </answer>
  32.616 -
  32.617 -
  32.618 -
  32.619 -<!--
  32.620 -        <question id="exec-reflection" when="impl">
  32.621 -            Does your code use Java Reflection to execute other code?
  32.622 -            <hint>
  32.623 -            This usually indicates a missing or insufficient API in the other
  32.624 -            part of the system. If the other side is not aware of your dependency
  32.625 -            this contract can be easily broken.
  32.626 -            </hint>
  32.627 -        </question>
  32.628 --->
  32.629 - <answer id="exec-reflection">
  32.630 -  <p>
  32.631 -   XXX no answer for exec-reflection
  32.632 -  </p>
  32.633 - </answer>
  32.634 -
  32.635 -
  32.636 -
  32.637 -<!--
  32.638 -        <question id="exec-threading" when="init">
  32.639 -            What threading models, if any, does your module adhere to? How the
  32.640 -            project behaves with respect to threading?
  32.641 -            <hint>
  32.642 -                Is your API threadsafe? Can it be accessed from any threads or
  32.643 -                just from some dedicated ones? Any special relation to AWT and
  32.644 -                its Event Dispatch thread? Also
  32.645 -                if your module calls foreign APIs which have a specific threading model,
  32.646 -                indicate how you comply with the requirements for multithreaded access
  32.647 -                (synchronization, mutexes, etc.) applicable to those APIs.
  32.648 -                If your module defines any APIs, or has complex internal structures
  32.649 -                that might be used from multiple threads, declare how you protect
  32.650 -                data against concurrent access, race conditions, deadlocks, etc.,
  32.651 -                and whether such rules are enforced by runtime warnings, errors, assertions, etc.
  32.652 -                Examples: a class might be non-thread-safe (like Java Collections); might
  32.653 -                be fully thread-safe (internal locking); might require access through a mutex
  32.654 -                (and may or may not automatically acquire that mutex on behalf of a client method);
  32.655 -                might be able to run only in the event queue; etc.
  32.656 -                Also describe when any events are fired: synchronously, asynchronously, etc.
  32.657 -                Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations">Threading Recommendations</a> (in progress)
  32.658 -            </hint>
  32.659 -        </question>
  32.660 --->
  32.661 - <answer id="exec-threading">
  32.662 -  <p>
  32.663 -   XXX no answer for exec-threading
  32.664 -  </p>
  32.665 - </answer>
  32.666 -
  32.667 -
  32.668 -
  32.669 -<!--
  32.670 -        <question id="format-clipboard" when="impl">
  32.671 -            Which data flavors (if any) does your code read from or insert to
  32.672 -            the clipboard (by access to clipboard on means calling methods on <code>java.awt.datatransfer.Transferable</code>?
  32.673 -            
  32.674 -            <hint>
  32.675 -            Often Node's deal with clipboard by usage of <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
  32.676 -            Check your code for overriding these methods.
  32.677 -            </hint>
  32.678 -        </question>
  32.679 --->
  32.680 - <answer id="format-clipboard">
  32.681 -  <p>
  32.682 -   XXX no answer for format-clipboard
  32.683 -  </p>
  32.684 - </answer>
  32.685 -
  32.686 -
  32.687 -
  32.688 -<!--
  32.689 -        <question id="format-dnd" when="impl">
  32.690 -            Which protocols (if any) does your code understand during Drag &amp; Drop?
  32.691 -            <hint>
  32.692 -            Often Node's deal with clipboard by usage of <code>Node.drag, Node.getDropType</code>. 
  32.693 -            Check your code for overriding these methods. Btw. if they are not overridden, they
  32.694 -            by default delegate to <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
  32.695 -            </hint>
  32.696 -        </question>
  32.697 --->
  32.698 - <answer id="format-dnd">
  32.699 -  <p>
  32.700 -   XXX no answer for format-dnd
  32.701 -  </p>
  32.702 - </answer>
  32.703 -
  32.704 -
  32.705 -
  32.706 -<!--
  32.707 -        <question id="format-types" when="impl">
  32.708 -            Which protocols and file formats (if any) does your module read or write on disk,
  32.709 -            or transmit or receive over the network? Do you generate an ant build script?
  32.710 -            Can it be edited and modified? 
  32.711 -            
  32.712 -            <hint>
  32.713 -            <p>
  32.714 -            Files can be read and written by other programs, modules and users. If they influence
  32.715 -            your behaviour, make sure you either document the format or claim that it is a private
  32.716 -            api (using the &lt;api&gt; tag). 
  32.717 -            </p>
  32.718 -            
  32.719 -            <p>
  32.720 -            If you generate an ant build file, this is very likely going to be seen by end users and
  32.721 -            they will be attempted to edit it. You should be ready for that and provide here a link
  32.722 -            to documentation that you have for such purposes and also describe how you are going to
  32.723 -            understand such files during next release, when you (very likely) slightly change the 
  32.724 -            format.
  32.725 -            </p>
  32.726 -            </hint>
  32.727 -        </question>
  32.728 --->
  32.729 - <answer id="format-types">
  32.730 -  <p>
  32.731 -   XXX no answer for format-types
  32.732 -  </p>
  32.733 - </answer>
  32.734 -
  32.735 -
  32.736 -
  32.737 -<!--
  32.738 -        <question id="lookup-lookup" when="init">
  32.739 -            Does your module use <code>org.openide.util.Lookup</code>
  32.740 -            or any similar technology to find any components to communicate with? Which ones?
  32.741 -            
  32.742 -            <hint>
  32.743 -            NetBeans is build around a generic registry of services called
  32.744 -            lookup. It is preferable to use it for registration and discovery
  32.745 -            if possible. See
  32.746 -            <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/lookup/doc-files/index.html">
  32.747 -            The Solution to Comunication Between Components
  32.748 -            </a>. If you do not plan to use lookup and insist usage
  32.749 -            of other solution, then please describe why it is not working for
  32.750 -            you.
  32.751 -            <br/>
  32.752 -            When filling the final version of your arch document, please
  32.753 -            describe the interfaces you are searching for, where 
  32.754 -            are defined, whether you are searching for just one or more of them,
  32.755 -            if the order is important, etc. Also classify the stability of such
  32.756 -            API contract. Use &lt;api group=&amp;lookup&amp; /&gt; tag, so
  32.757 -            your information gets listed in the summary page of your javadoc.
  32.758 -            </hint>
  32.759 -        </question>
  32.760 --->
  32.761 - <answer id="lookup-lookup">
  32.762 -  <p>
  32.763 -   XXX no answer for lookup-lookup
  32.764 -  </p>
  32.765 - </answer>
  32.766 -
  32.767 -
  32.768 -
  32.769 -<!--
  32.770 -        <question id="lookup-register" when="final">
  32.771 -            Do you register anything into lookup for other code to find?
  32.772 -            <hint>
  32.773 -            Do you register using layer file or using a declarative annotation such as <code>@ServiceProvider</code>?
  32.774 -            Who is supposed to find your component?
  32.775 -            </hint>
  32.776 -        </question>
  32.777 --->
  32.778 - <answer id="lookup-register">
  32.779 -  <p>
  32.780 -   XXX no answer for lookup-register
  32.781 -  </p>
  32.782 - </answer>
  32.783 -
  32.784 -
  32.785 -
  32.786 -<!--
  32.787 -        <question id="lookup-remove" when="final">
  32.788 -            Do you remove entries of other modules from lookup?
  32.789 -            <hint>
  32.790 -            Why? Of course, that is possible, but it can be dangerous. Is the module
  32.791 -            your are masking resource from aware of what you are doing?
  32.792 -            </hint>
  32.793 -        </question>
  32.794 --->
  32.795 - <answer id="lookup-remove">
  32.796 -  <p>
  32.797 -   XXX no answer for lookup-remove
  32.798 -  </p>
  32.799 - </answer>
  32.800 -
  32.801 -
  32.802 -
  32.803 -<!--
  32.804 -        <question id="perf-exit" when="final">
  32.805 -            Does your module run any code on exit?
  32.806 -        </question>
  32.807 --->
  32.808 - <answer id="perf-exit">
  32.809 -  <p>
  32.810 -   XXX no answer for perf-exit
  32.811 -  </p>
  32.812 - </answer>
  32.813 -
  32.814 -
  32.815 -
  32.816 -<!--
  32.817 -        <question id="perf-huge_dialogs" when="final">
  32.818 -            Does your module contain any dialogs or wizards with a large number of
  32.819 -            GUI controls such as combo boxes, lists, trees, or text areas?
  32.820 -        </question>
  32.821 --->
  32.822 - <answer id="perf-huge_dialogs">
  32.823 -  <p>
  32.824 -   XXX no answer for perf-huge_dialogs
  32.825 -  </p>
  32.826 - </answer>
  32.827 -
  32.828 -
  32.829 -
  32.830 -<!--
  32.831 -        <question id="perf-limit" when="init">
  32.832 -            Are there any hard-coded or practical limits in the number or size of
  32.833 -            elements your code can handle?
  32.834 -            <hint>
  32.835 -                Most of algorithms have increasing memory and speed complexity
  32.836 -                with respect to size of data they operate on. What is the critical
  32.837 -                part of your project that can be seen as a bottleneck with
  32.838 -                respect to speed or required memory? What are the practical
  32.839 -                sizes of data you tested your project with? What is your estimate
  32.840 -                of potential size of data that would cause visible performance
  32.841 -                problems? Is there some kind of check to detect such situation
  32.842 -                and prevent "hard" crashes - for example the CloneableEditorSupport
  32.843 -                checks for size of a file to be opened in editor
  32.844 -                and if it is larger than 1Mb it shows a dialog giving the
  32.845 -                user the right to decide - e.g. to cancel or commit suicide.
  32.846 -            </hint>
  32.847 -        </question>
  32.848 --->
  32.849 - <answer id="perf-limit">
  32.850 -  <p>
  32.851 -   XXX no answer for perf-limit
  32.852 -  </p>
  32.853 - </answer>
  32.854 -
  32.855 -
  32.856 -
  32.857 -<!--
  32.858 -        <question id="perf-mem" when="final">
  32.859 -            How much memory does your component consume? Estimate
  32.860 -            with a relation to the number of windows, etc.
  32.861 -        </question>
  32.862 --->
  32.863 - <answer id="perf-mem">
  32.864 -  <p>
  32.865 -   XXX no answer for perf-mem
  32.866 -  </p>
  32.867 - </answer>
  32.868 -
  32.869 -
  32.870 -
  32.871 -<!--
  32.872 -        <question id="perf-menus" when="final">
  32.873 -            Does your module use dynamically updated context menus, or
  32.874 -            context-sensitive actions with complicated and slow enablement logic?
  32.875 -            <hint>
  32.876 -                If you do a lot of tricks when adding actions to regular or context menus, you can significantly
  32.877 -                slow down display of the menu, even when the user is not using your action. Pay attention to
  32.878 -                actions you add to the main menu bar, and to context menus of foreign nodes or components. If
  32.879 -                the action is conditionally enabled, or changes its display dynamically, you need to check the
  32.880 -                impact on performance. In some cases it may be more appropriate to make a simple action that is
  32.881 -                always enabled but does more detailed checks in a dialog if it is actually run.
  32.882 -            </hint>
  32.883 -        </question>
  32.884 --->
  32.885 - <answer id="perf-menus">
  32.886 -  <p>
  32.887 -   XXX no answer for perf-menus
  32.888 -  </p>
  32.889 - </answer>
  32.890 -
  32.891 -
  32.892 -
  32.893 -<!--
  32.894 -        <question id="perf-progress" when="final">
  32.895 -            Does your module execute any long-running tasks?
  32.896 -            
  32.897 -            <hint>Long running tasks should never block 
  32.898 -            AWT thread as it badly hurts the UI
  32.899 -            <a href="http://performance.netbeans.org/responsiveness/issues.html">
  32.900 -            responsiveness</a>.
  32.901 -            Tasks like connecting over
  32.902 -            network, computing huge amount of data, compilation
  32.903 -            be done asynchronously (for example
  32.904 -            using <code>RequestProcessor</code>), definitively it should 
  32.905 -            not block AWT thread.
  32.906 -            </hint>
  32.907 -        </question>
  32.908 --->
  32.909 - <answer id="perf-progress">
  32.910 -  <p>
  32.911 -   XXX no answer for perf-progress
  32.912 -  </p>
  32.913 - </answer>
  32.914 -
  32.915 -
  32.916 -
  32.917 -<!--
  32.918 -        <question id="perf-scale" when="init">
  32.919 -            Which external criteria influence the performance of your
  32.920 -            program (size of file in editor, number of files in menu, 
  32.921 -            in source directory, etc.) and how well your code scales?
  32.922 -            <hint>
  32.923 -            Please include some estimates, there are other more detailed 
  32.924 -            questions to answer in later phases of implementation. 
  32.925 -            </hint>
  32.926 -        </question>
  32.927 --->
  32.928 - <answer id="perf-scale">
  32.929 -  <p>
  32.930 -   XXX no answer for perf-scale
  32.931 -  </p>
  32.932 - </answer>
  32.933 -
  32.934 -
  32.935 -
  32.936 -<!--
  32.937 -        <question id="perf-spi" when="init">
  32.938 -            How the performance of the plugged in code will be enforced?
  32.939 -            <hint>
  32.940 -            If you allow foreign code to be plugged into your own module, how
  32.941 -            do you enforce that it will behave correctly and quickly and will not
  32.942 -            negatively influence the performance of your own module?
  32.943 -            </hint>
  32.944 -        </question>
  32.945 --->
  32.946 - <answer id="perf-spi">
  32.947 -  <p>
  32.948 -   XXX no answer for perf-spi
  32.949 -  </p>
  32.950 - </answer>
  32.951 -
  32.952 -
  32.953 -
  32.954 -<!--
  32.955 -        <question id="perf-startup" when="final">
  32.956 -            Does your module run any code on startup?
  32.957 -        </question>
  32.958 --->
  32.959 - <answer id="perf-startup">
  32.960 -  <p>
  32.961 -   XXX no answer for perf-startup
  32.962 -  </p>
  32.963 - </answer>
  32.964 -
  32.965 -
  32.966 -
  32.967 -<!--
  32.968 -        <question id="perf-wakeup" when="final">
  32.969 -            Does any piece of your code wake up periodically and do something
  32.970 -            even when the system is otherwise idle (no user interaction)?
  32.971 -        </question>
  32.972 --->
  32.973 - <answer id="perf-wakeup">
  32.974 -  <p>
  32.975 -   XXX no answer for perf-wakeup
  32.976 -  </p>
  32.977 - </answer>
  32.978 -
  32.979 -
  32.980 -
  32.981 -<!--
  32.982 -        <question id="resources-file" when="final">
  32.983 -            Does your module use <code>java.io.File</code> directly?
  32.984 -            
  32.985 -            <hint>
  32.986 -            NetBeans provide a logical wrapper over plain files called 
  32.987 -            <code>org.openide.filesystems.FileObject</code> that
  32.988 -            provides uniform access to such resources and is the preferred
  32.989 -            way that should be used. But of course there can be situations when
  32.990 -            this is not suitable.
  32.991 -            </hint>
  32.992 -        </question>
  32.993 --->
  32.994 - <answer id="resources-file">
  32.995 -  <p>
  32.996 -   XXX no answer for resources-file
  32.997 -  </p>
  32.998 - </answer>
  32.999 -
 32.1000 -
 32.1001 -
 32.1002 -<!--
 32.1003 -        <question id="resources-layer" when="final">
 32.1004 -            Does your module provide own layer? Does it create any files or
 32.1005 -            folders in it? What it is trying to communicate by that and with which 
 32.1006 -            components?
 32.1007 -            
 32.1008 -            <hint>
 32.1009 -            NetBeans allows automatic and declarative installation of resources 
 32.1010 -            by module layers. Module register files into appropriate places
 32.1011 -            and other components use that information to perform their task
 32.1012 -            (build menu, toolbar, window layout, list of templates, set of
 32.1013 -            options, etc.). 
 32.1014 -            </hint>
 32.1015 -        </question>
 32.1016 --->
 32.1017 - <answer id="resources-layer">
 32.1018 -  <p>
 32.1019 -   XXX no answer for resources-layer
 32.1020 -  </p>
 32.1021 - </answer>
 32.1022 -
 32.1023 -
 32.1024 -
 32.1025 -<!--
 32.1026 -        <question id="resources-mask" when="final">
 32.1027 -            Does your module mask/hide/override any resources provided by other modules in
 32.1028 -            their layers?
 32.1029 -            
 32.1030 -            <hint>
 32.1031 -            If you mask a file provided by another module, you probably depend
 32.1032 -            on that and do not want the other module to (for example) change
 32.1033 -            the file's name. That module shall thus make that file available as an API
 32.1034 -            of some stability category.
 32.1035 -            </hint>
 32.1036 -        </question>
 32.1037 --->
 32.1038 - <answer id="resources-mask">
 32.1039 -  <p>
 32.1040 -   XXX no answer for resources-mask
 32.1041 -  </p>
 32.1042 - </answer>
 32.1043 -
 32.1044 -
 32.1045 -
 32.1046 -<!--
 32.1047 -        <question id="resources-preferences" when="final">
 32.1048 -            Does your module uses preferences via Preferences API? Does your module use NbPreferences or
 32.1049 -            or regular JDK Preferences ? Does it read, write or both ? 
 32.1050 -            Does it share preferences with other modules ? If so, then why ?
 32.1051 -            <hint>
 32.1052 -                You may use
 32.1053 -                    &lt;api type="export" group="preferences"
 32.1054 -                    name="preference node name" category="private"&gt;
 32.1055 -                    description of individual keys, where it is used, what it
 32.1056 -                    influences, whether the module reads/write it, etc.
 32.1057 -                    &lt;/api&gt;
 32.1058 -                Due to XML ID restrictions, rather than /org/netbeans/modules/foo give the "name" as org.netbeans.modules.foo.
 32.1059 -                Note that if you use NbPreferences this name will then be the same as the code name base of the module.
 32.1060 -            </hint>
 32.1061 -        </question>
 32.1062 --->
 32.1063 - <answer id="resources-preferences">
 32.1064 -  <p>
 32.1065 -   XXX no answer for resources-preferences
 32.1066 -  </p>
 32.1067 - </answer>
 32.1068 -
 32.1069 -
 32.1070 -
 32.1071 -<!--
 32.1072 -        <question id="resources-read" when="final">
 32.1073 -            Does your module read any resources from layers? For what purpose?
 32.1074 -            
 32.1075 -            <hint>
 32.1076 -            As this is some kind of intermodule dependency, it is a kind of API.
 32.1077 -            Please describe it and classify according to 
 32.1078 -            <a href="http://wiki.netbeans.org/API_Design#What_is_an_API.3F">
 32.1079 -            common stability categories</a>.
 32.1080 -            </hint>
 32.1081 -        </question>
 32.1082 --->
 32.1083 - <answer id="resources-read">
 32.1084 -  <p>
 32.1085 -   XXX no answer for resources-read
 32.1086 -  </p>
 32.1087 - </answer>
 32.1088 -
 32.1089 -
 32.1090 -
 32.1091 -<!--
 32.1092 -        <question id="security-grant" when="final">
 32.1093 -            Does your code grant additional rights to some other code?
 32.1094 -            <hint>Avoid using a class loader that adds extra
 32.1095 -            permissions to loaded code unless really necessary.
 32.1096 -            Also note that your API implementation
 32.1097 -            can also expose unneeded permissions to enemy code by
 32.1098 -            calling AccessController.doPrivileged().</hint>
 32.1099 -        </question>
 32.1100 --->
 32.1101 - <answer id="security-grant">
 32.1102 -  <p>
 32.1103 -   XXX no answer for security-grant
 32.1104 -  </p>
 32.1105 - </answer>
 32.1106 -
 32.1107 -
 32.1108 -
 32.1109 -<!--
 32.1110 -        <question id="security-policy" when="final">
 32.1111 -            Does your functionality require modifications to the standard policy file?
 32.1112 -            <hint>Your code might pass control to third-party code not
 32.1113 -            coming from trusted domains. This could be code downloaded over the
 32.1114 -            network or code coming from libraries that are not bundled
 32.1115 -            with NetBeans. Which permissions need to be granted to which domains?</hint>
 32.1116 -        </question>
 32.1117 --->
 32.1118 - <answer id="security-policy">
 32.1119 -  <p>
 32.1120 -   XXX no answer for security-policy
 32.1121 -  </p>
 32.1122 - </answer>
 32.1123 -
 32.1124 -</api-answers>
    33.1 --- a/sandbox/java.hints/java.hints.test/build.xml	Sun Jan 08 20:10:08 2017 +0100
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,51 +0,0 @@
    33.4 -<?xml version="1.0" encoding="UTF-8"?>
    33.5 -<!--
    33.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    33.7 -
    33.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    33.9 -
   33.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   33.11 -Other names may be trademarks of their respective owners.
   33.12 -
   33.13 -The contents of this file are subject to the terms of either the GNU
   33.14 -General Public License Version 2 only ("GPL") or the Common
   33.15 -Development and Distribution License("CDDL") (collectively, the
   33.16 -"License"). You may not use this file except in compliance with the
   33.17 -License. You can obtain a copy of the License at
   33.18 -http://www.netbeans.org/cddl-gplv2.html
   33.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   33.20 -specific language governing permissions and limitations under the
   33.21 -License.  When distributing the software, include this License Header
   33.22 -Notice in each file and include the License file at
   33.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   33.24 -particular file as subject to the "Classpath" exception as provided
   33.25 -by Oracle in the GPL Version 2 section of the License file that
   33.26 -accompanied this code. If applicable, add the following below the
   33.27 -License Header, with the fields enclosed by brackets [] replaced by
   33.28 -your own identifying information:
   33.29 -"Portions Copyrighted [year] [name of copyright owner]"
   33.30 -
   33.31 -Contributor(s):
   33.32 -
   33.33 -The Original Software is NetBeans. The Initial Developer of the Original
   33.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   33.35 -Microsystems, Inc. All Rights Reserved.
   33.36 -
   33.37 -If you wish your version of this file to be governed by only the CDDL
   33.38 -or only the GPL Version 2, indicate your decision by adding
   33.39 -"[Contributor] elects to include this software in this distribution
   33.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   33.41 -single choice of license, a recipient has the option to distribute
   33.42 -your version of this file under either the CDDL, the GPL Version 2 or
   33.43 -to extend the choice of license to its licensees as provided above.
   33.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   33.45 -Version 2 license, then the option applies only if the new code is
   33.46 -made subject to such option by the copyright holder.
   33.47 --->
   33.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
   33.49 -<!-- for some information on what you could do (e.g. targets to override). -->
   33.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
   33.51 -<project name="org.netbeans.modules.java.hints.test" default="netbeans" basedir=".">
   33.52 -    <description>Builds, tests, and runs the project org.netbeans.modules.java.hints.test.</description>
   33.53 -    <import file="nbproject/build-impl.xml"/>
   33.54 -</project>
    34.1 --- a/sandbox/java.hints/java.hints.test/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,5 +0,0 @@
    34.4 -Manifest-Version: 1.0
    34.5 -OpenIDE-Module: org.netbeans.modules.java.hints.test/1
    34.6 -OpenIDE-Module-Implementation-Version: 1
    34.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/hints/test/Bundle.properties
    34.8 -
    35.1 --- a/sandbox/java.hints/java.hints.test/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,88 +0,0 @@
    35.4 -<?xml version="1.0" encoding="UTF-8"?>
    35.5 -<!--
    35.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    35.7 -
    35.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    35.9 -
   35.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   35.11 -Other names may be trademarks of their respective owners.
   35.12 -
   35.13 -The contents of this file are subject to the terms of either the GNU
   35.14 -General Public License Version 2 only ("GPL") or the Common
   35.15 -Development and Distribution License("CDDL") (collectively, the
   35.16 -"License"). You may not use this file except in compliance with the
   35.17 -License. You can obtain a copy of the License at
   35.18 -http://www.netbeans.org/cddl-gplv2.html
   35.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   35.20 -specific language governing permissions and limitations under the
   35.21 -License.  When distributing the software, include this License Header
   35.22 -Notice in each file and include the License file at
   35.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   35.24 -particular file as subject to the "Classpath" exception as provided
   35.25 -by Oracle in the GPL Version 2 section of the License file that
   35.26 -accompanied this code. If applicable, add the following below the
   35.27 -License Header, with the fields enclosed by brackets [] replaced by
   35.28 -your own identifying information:
   35.29 -"Portions Copyrighted [year] [name of copyright owner]"
   35.30 -
   35.31 -Contributor(s):
   35.32 -
   35.33 -The Original Software is NetBeans. The Initial Developer of the Original
   35.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   35.35 -Microsystems, Inc. All Rights Reserved.
   35.36 -
   35.37 -If you wish your version of this file to be governed by only the CDDL
   35.38 -or only the GPL Version 2, indicate your decision by adding
   35.39 -"[Contributor] elects to include this software in this distribution
   35.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   35.41 -single choice of license, a recipient has the option to distribute
   35.42 -your version of this file under either the CDDL, the GPL Version 2 or
   35.43 -to extend the choice of license to its licensees as provided above.
   35.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   35.45 -Version 2 license, then the option applies only if the new code is
   35.46 -made subject to such option by the copyright holder.
   35.47 --->
   35.48 -<!--
   35.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
   35.50 -***         EDIT ../build.xml INSTEAD         ***
   35.51 --->
   35.52 -<project name="org.netbeans.modules.java.hints.test-impl" basedir="..">
   35.53 -    <fail message="Please build using Ant 1.7.1 or higher.">
   35.54 -        <condition>
   35.55 -            <not>
   35.56 -                <antversion atleast="1.7.1"/>
   35.57 -            </not>
   35.58 -        </condition>
   35.59 -    </fail>
   35.60 -    <property file="nbproject/private/suite-private.properties"/>
   35.61 -    <property file="nbproject/suite.properties"/>
   35.62 -    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
   35.63 -    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
   35.64 -    <property file="${suite.dir}/nbproject/platform.properties"/>
   35.65 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
   35.66 -        <attribute name="name"/>
   35.67 -        <attribute name="value"/>
   35.68 -        <sequential>
   35.69 -            <property name="@{name}" value="${@{value}}"/>
   35.70 -        </sequential>
   35.71 -    </macrodef>
   35.72 -    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
   35.73 -        <attribute name="property"/>
   35.74 -        <attribute name="value"/>
   35.75 -        <sequential>
   35.76 -            <property name="@{property}" value="@{value}"/>
   35.77 -        </sequential>
   35.78 -    </macrodef>
   35.79 -    <property file="${user.properties.file}"/>
   35.80 -    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
   35.81 -    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
   35.82 -    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
   35.83 -    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
   35.84 -        <condition>
   35.85 -            <not>
   35.86 -                <contains string="${cluster.path.evaluated}" substring="platform"/>
   35.87 -            </not>
   35.88 -        </condition>
   35.89 -    </fail>
   35.90 -    <import file="${harness.dir}/build.xml"/>
   35.91 -</project>
    36.1 --- a/sandbox/java.hints/java.hints.test/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,49 +0,0 @@
    36.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    36.5 -#
    36.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    36.7 -#
    36.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    36.9 -# Other names may be trademarks of their respective owners.
   36.10 -#
   36.11 -# The contents of this file are subject to the terms of either the GNU
   36.12 -# General Public License Version 2 only ("GPL") or the Common
   36.13 -# Development and Distribution License("CDDL") (collectively, the
   36.14 -# "License"). You may not use this file except in compliance with the
   36.15 -# License. You can obtain a copy of the License at
   36.16 -# http://www.netbeans.org/cddl-gplv2.html
   36.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   36.18 -# specific language governing permissions and limitations under the
   36.19 -# License.  When distributing the software, include this License Header
   36.20 -# Notice in each file and include the License file at
   36.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   36.22 -# particular file as subject to the "Classpath" exception as provided
   36.23 -# by Oracle in the GPL Version 2 section of the License file that
   36.24 -# accompanied this code. If applicable, add the following below the
   36.25 -# License Header, with the fields enclosed by brackets [] replaced by
   36.26 -# your own identifying information:
   36.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   36.28 -#
   36.29 -# Contributor(s):
   36.30 -#
   36.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   36.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   36.33 -# Microsystems, Inc. All Rights Reserved.
   36.34 -#
   36.35 -# If you wish your version of this file to be governed by only the CDDL
   36.36 -# or only the GPL Version 2, indicate your decision by adding
   36.37 -# "[Contributor] elects to include this software in this distribution
   36.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   36.39 -# single choice of license, a recipient has the option to distribute
   36.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   36.41 -# to extend the choice of license to its licensees as provided above.
   36.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   36.43 -# Version 2 license, then the option applies only if the new code is
   36.44 -# made subject to such option by the copyright holder.
   36.45 -build.xml.data.CRC32=bdfc486d
   36.46 -build.xml.script.CRC32=fb578ef0
   36.47 -build.xml.stylesheet.CRC32=a56c6a5b@2.70
   36.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   36.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   36.50 -nbproject/build-impl.xml.data.CRC32=bdfc486d
   36.51 -nbproject/build-impl.xml.script.CRC32=c676886e
   36.52 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.70
    37.1 --- a/sandbox/java.hints/java.hints.test/nbproject/org-netbeans-modules-java-hints-test.sig	Sun Jan 08 20:10:08 2017 +0100
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,67 +0,0 @@
    37.4 -#Signature file v4.1
    37.5 -#Version 1.6.1
    37.6 -
    37.7 -CLSS public java.lang.Object
    37.8 -cons public init()
    37.9 -meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
   37.10 -meth protected void finalize() throws java.lang.Throwable
   37.11 -meth public boolean equals(java.lang.Object)
   37.12 -meth public final java.lang.Class<?> getClass()
   37.13 -meth public final void notify()
   37.14 -meth public final void notifyAll()
   37.15 -meth public final void wait() throws java.lang.InterruptedException
   37.16 -meth public final void wait(long) throws java.lang.InterruptedException
   37.17 -meth public final void wait(long,int) throws java.lang.InterruptedException
   37.18 -meth public int hashCode()
   37.19 -meth public java.lang.String toString()
   37.20 -
   37.21 -CLSS public org.netbeans.modules.java.hints.test.api.HintTest
   37.22 -innr public final AppliedFix
   37.23 -innr public final HintOutput
   37.24 -innr public final HintWarning
   37.25 -meth public !varargs org.netbeans.modules.java.hints.test.api.HintTest classpath(java.net.URL[])
   37.26 -meth public org.netbeans.modules.java.hints.test.api.HintTest input(java.lang.String) throws java.lang.Exception
   37.27 -meth public org.netbeans.modules.java.hints.test.api.HintTest input(java.lang.String,boolean) throws java.lang.Exception
   37.28 -meth public org.netbeans.modules.java.hints.test.api.HintTest input(java.lang.String,java.lang.String) throws java.lang.Exception
   37.29 -meth public org.netbeans.modules.java.hints.test.api.HintTest input(java.lang.String,java.lang.String,boolean) throws java.lang.Exception
   37.30 -meth public org.netbeans.modules.java.hints.test.api.HintTest preference(java.lang.String,boolean)
   37.31 -meth public org.netbeans.modules.java.hints.test.api.HintTest preference(java.lang.String,int)
   37.32 -meth public org.netbeans.modules.java.hints.test.api.HintTest preference(java.lang.String,java.lang.String)
   37.33 -meth public org.netbeans.modules.java.hints.test.api.HintTest setCaretMarker(char)
   37.34 -meth public org.netbeans.modules.java.hints.test.api.HintTest sourceLevel(java.lang.String)
   37.35 -meth public org.netbeans.modules.java.hints.test.api.HintTest$HintOutput run(java.lang.Class<?>) throws java.lang.Exception
   37.36 -meth public static org.netbeans.modules.java.hints.test.api.HintTest create() throws java.lang.Exception
   37.37 -supr java.lang.Object
   37.38 -hfds DEBUGGING_HELPER,ERRORS_COMPARATOR,INDEXING_LOGGER,JUNIT_PROPERTIES_FILENAME,JUNIT_PROPERTIES_LOCATION_PROPERTY,NBJUNIT_WORKDIR,bootClassPath,buildRoot,cache,caret,caretMarker,checkCompilable,compileClassPath,log,sourceLevel,sourcePath,sourceRoot,testFile,testPreferences,usedPaths,workDir
   37.39 -hcls DeadlockTask,TempPreferences,TestProxyClassPathProvider,TestSourceForBinaryQuery,TestSourceLevelQueryImplementation
   37.40 -
   37.41 -CLSS public final org.netbeans.modules.java.hints.test.api.HintTest$AppliedFix
   37.42 - outer org.netbeans.modules.java.hints.test.api.HintTest
   37.43 -cons public init(org.netbeans.modules.java.hints.test.api.HintTest)
   37.44 -meth public java.lang.String getOutput() throws java.lang.Exception
   37.45 -meth public java.lang.String getOutput(java.lang.String) throws java.lang.Exception
   37.46 -meth public org.netbeans.modules.java.hints.test.api.HintTest$AppliedFix assertCompilable() throws java.lang.Exception
   37.47 -meth public org.netbeans.modules.java.hints.test.api.HintTest$AppliedFix assertCompilable(java.lang.String) throws java.lang.Exception
   37.48 -meth public org.netbeans.modules.java.hints.test.api.HintTest$AppliedFix assertOutput(java.lang.String) throws java.lang.Exception
   37.49 -meth public org.netbeans.modules.java.hints.test.api.HintTest$AppliedFix assertOutput(java.lang.String,java.lang.String) throws java.lang.Exception
   37.50 -meth public org.netbeans.modules.java.hints.test.api.HintTest$AppliedFix assertVerbatimOutput(java.lang.String) throws java.lang.Exception
   37.51 -meth public org.netbeans.modules.java.hints.test.api.HintTest$AppliedFix assertVerbatimOutput(java.lang.String,java.lang.String) throws java.lang.Exception
   37.52 -supr java.lang.Object
   37.53 -
   37.54 -CLSS public final org.netbeans.modules.java.hints.test.api.HintTest$HintOutput
   37.55 - outer org.netbeans.modules.java.hints.test.api.HintTest
   37.56 -meth public !varargs org.netbeans.modules.java.hints.test.api.HintTest$HintOutput assertContainsWarnings(java.lang.String[])
   37.57 -meth public !varargs org.netbeans.modules.java.hints.test.api.HintTest$HintOutput assertNotContainsWarnings(java.lang.String[])
   37.58 -meth public !varargs org.netbeans.modules.java.hints.test.api.HintTest$HintOutput assertWarnings(java.lang.String[])
   37.59 -meth public org.netbeans.modules.java.hints.test.api.HintTest$HintWarning findWarning(java.lang.String)
   37.60 -supr java.lang.Object
   37.61 -hfds errors
   37.62 -
   37.63 -CLSS public final org.netbeans.modules.java.hints.test.api.HintTest$HintWarning
   37.64 - outer org.netbeans.modules.java.hints.test.api.HintTest
   37.65 -meth public !varargs org.netbeans.modules.java.hints.test.api.HintTest$HintWarning assertFixes(java.lang.String[]) throws java.lang.Exception
   37.66 -meth public org.netbeans.modules.java.hints.test.api.HintTest$AppliedFix applyFix() throws java.lang.Exception
   37.67 -meth public org.netbeans.modules.java.hints.test.api.HintTest$AppliedFix applyFix(java.lang.String) throws java.lang.Exception
   37.68 -supr java.lang.Object
   37.69 -hfds warning
   37.70 -
    38.1 --- a/sandbox/java.hints/java.hints.test/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,49 +0,0 @@
    38.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    38.5 -#
    38.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    38.7 -#
    38.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    38.9 -# Other names may be trademarks of their respective owners.
   38.10 -#
   38.11 -# The contents of this file are subject to the terms of either the GNU
   38.12 -# General Public License Version 2 only ("GPL") or the Common
   38.13 -# Development and Distribution License("CDDL") (collectively, the
   38.14 -# "License"). You may not use this file except in compliance with the
   38.15 -# License. You can obtain a copy of the License at
   38.16 -# http://www.netbeans.org/cddl-gplv2.html
   38.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   38.18 -# specific language governing permissions and limitations under the
   38.19 -# License.  When distributing the software, include this License Header
   38.20 -# Notice in each file and include the License file at
   38.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   38.22 -# particular file as subject to the "Classpath" exception as provided
   38.23 -# by Oracle in the GPL Version 2 section of the License file that
   38.24 -# accompanied this code. If applicable, add the following below the
   38.25 -# License Header, with the fields enclosed by brackets [] replaced by
   38.26 -# your own identifying information:
   38.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   38.28 -#
   38.29 -# Contributor(s):
   38.30 -#
   38.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   38.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   38.33 -# Microsystems, Inc. All Rights Reserved.
   38.34 -#
   38.35 -# If you wish your version of this file to be governed by only the CDDL
   38.36 -# or only the GPL Version 2, indicate your decision by adding
   38.37 -# "[Contributor] elects to include this software in this distribution
   38.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   38.39 -# single choice of license, a recipient has the option to distribute
   38.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   38.41 -# to extend the choice of license to its licensees as provided above.
   38.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   38.43 -# Version 2 license, then the option applies only if the new code is
   38.44 -# made subject to such option by the copyright holder.
   38.45 -is.autoload=true
   38.46 -javac.source=1.7
   38.47 -javac.compilerargs=-Xlint -Xlint:-serial
   38.48 -spec.version.base=2.0.0
   38.49 -javadoc.arch=${basedir}/arch.xml
   38.50 -javadoc.apichanges=${basedir}/apichanges.xml
   38.51 -requires.nb.javac=true
   38.52 -spec.version.base.fatal.warning=false
    39.1 --- a/sandbox/java.hints/java.hints.test/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,319 +0,0 @@
    39.4 -<?xml version="1.0" encoding="UTF-8"?>
    39.5 -<!--
    39.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    39.7 -
    39.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    39.9 -
   39.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   39.11 -Other names may be trademarks of their respective owners.
   39.12 -
   39.13 -The contents of this file are subject to the terms of either the GNU
   39.14 -General Public License Version 2 only ("GPL") or the Common
   39.15 -Development and Distribution License("CDDL") (collectively, the
   39.16 -"License"). You may not use this file except in compliance with the
   39.17 -License. You can obtain a copy of the License at
   39.18 -http://www.netbeans.org/cddl-gplv2.html
   39.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   39.20 -specific language governing permissions and limitations under the
   39.21 -License.  When distributing the software, include this License Header
   39.22 -Notice in each file and include the License file at
   39.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   39.24 -particular file as subject to the "Classpath" exception as provided
   39.25 -by Oracle in the GPL Version 2 section of the License file that
   39.26 -accompanied this code. If applicable, add the following below the
   39.27 -License Header, with the fields enclosed by brackets [] replaced by
   39.28 -your own identifying information:
   39.29 -"Portions Copyrighted [year] [name of copyright owner]"
   39.30 -
   39.31 -Contributor(s):
   39.32 -
   39.33 -The Original Software is NetBeans. The Initial Developer of the Original
   39.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   39.35 -Microsystems, Inc. All Rights Reserved.
   39.36 -
   39.37 -If you wish your version of this file to be governed by only the CDDL
   39.38 -or only the GPL Version 2, indicate your decision by adding
   39.39 -"[Contributor] elects to include this software in this distribution
   39.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   39.41 -single choice of license, a recipient has the option to distribute
   39.42 -your version of this file under either the CDDL, the GPL Version 2 or
   39.43 -to extend the choice of license to its licensees as provided above.
   39.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   39.45 -Version 2 license, then the option applies only if the new code is
   39.46 -made subject to such option by the copyright holder.
   39.47 --->
   39.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
   39.49 -    <type>org.netbeans.modules.apisupport.project</type>
   39.50 -    <configuration>
   39.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
   39.52 -            <code-name-base>org.netbeans.modules.java.hints.test</code-name-base>
   39.53 -            <suite-component/>
   39.54 -            <module-dependencies>
   39.55 -                <dependency>
   39.56 -                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
   39.57 -                    <build-prerequisite/>
   39.58 -                    <compile-dependency/>
   39.59 -                    <run-dependency>
   39.60 -                        <release-version>1</release-version>
   39.61 -                        <specification-version>1.13</specification-version>
   39.62 -                    </run-dependency>
   39.63 -                </dependency>
   39.64 -                <dependency>
   39.65 -                    <code-name-base>org.netbeans.api.java</code-name-base>
   39.66 -                    <build-prerequisite/>
   39.67 -                    <compile-dependency/>
   39.68 -                    <run-dependency>
   39.69 -                        <release-version>1</release-version>
   39.70 -                        <specification-version>1.37</specification-version>
   39.71 -                    </run-dependency>
   39.72 -                </dependency>
   39.73 -                <dependency>
   39.74 -                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
   39.75 -                    <build-prerequisite/>
   39.76 -                    <compile-dependency/>
   39.77 -                    <run-dependency>
   39.78 -                        <release-version>1</release-version>
   39.79 -                        <specification-version>1.32</specification-version>
   39.80 -                    </run-dependency>
   39.81 -                </dependency>
   39.82 -                <dependency>
   39.83 -                    <code-name-base>org.netbeans.api.progress</code-name-base>
   39.84 -                    <build-prerequisite/>
   39.85 -                    <compile-dependency/>
   39.86 -                    <run-dependency>
   39.87 -                        <release-version>1</release-version>
   39.88 -                        <specification-version>1.33</specification-version>
   39.89 -                    </run-dependency>
   39.90 -                </dependency>
   39.91 -                <dependency>
   39.92 -                    <code-name-base>org.netbeans.core.startup</code-name-base>
   39.93 -                    <build-prerequisite/>
   39.94 -                    <compile-dependency/>
   39.95 -                    <run-dependency>
   39.96 -                        <release-version>1</release-version>
   39.97 -                        <specification-version>1.41</specification-version>
   39.98 -                    </run-dependency>
   39.99 -                </dependency>
  39.100 -                <dependency>
  39.101 -                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
  39.102 -                    <build-prerequisite/>
  39.103 -                    <compile-dependency/>
  39.104 -                    <run-dependency>
  39.105 -                        <specification-version>7.9</specification-version>
  39.106 -                    </run-dependency>
  39.107 -                </dependency>
  39.108 -                <dependency>
  39.109 -                    <code-name-base>org.netbeans.libs.junit4</code-name-base>
  39.110 -                    <build-prerequisite/>
  39.111 -                    <compile-dependency/>
  39.112 -                    <run-dependency>
  39.113 -                        <specification-version>1.13</specification-version>
  39.114 -                    </run-dependency>
  39.115 -                </dependency>
  39.116 -                <dependency>
  39.117 -                    <code-name-base>org.netbeans.modules.code.analysis</code-name-base>
  39.118 -                    <build-prerequisite/>
  39.119 -                    <compile-dependency/>
  39.120 -                    <run-dependency>
  39.121 -                        <release-version>0</release-version>
  39.122 -                        <implementation-version/>
  39.123 -                    </run-dependency>
  39.124 -                </dependency>
  39.125 -                <dependency>
  39.126 -                    <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
  39.127 -                    <build-prerequisite/>
  39.128 -                    <compile-dependency/>
  39.129 -                    <run-dependency>
  39.130 -                        <release-version>1</release-version>
  39.131 -                        <specification-version>1.25</specification-version>
  39.132 -                    </run-dependency>
  39.133 -                </dependency>
  39.134 -                <dependency>
  39.135 -                    <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
  39.136 -                    <build-prerequisite/>
  39.137 -                    <compile-dependency/>
  39.138 -                    <run-dependency>
  39.139 -                        <release-version>1</release-version>
  39.140 -                        <specification-version>1.17</specification-version>
  39.141 -                    </run-dependency>
  39.142 -                </dependency>
  39.143 -                <dependency>
  39.144 -                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
  39.145 -                    <build-prerequisite/>
  39.146 -                    <compile-dependency/>
  39.147 -                    <run-dependency>
  39.148 -                        <implementation-version/>
  39.149 -                    </run-dependency>
  39.150 -                </dependency>
  39.151 -                <dependency>
  39.152 -                    <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
  39.153 -                    <build-prerequisite/>
  39.154 -                    <compile-dependency/>
  39.155 -                    <run-dependency>
  39.156 -                        <implementation-version/>
  39.157 -                    </run-dependency>
  39.158 -                </dependency>
  39.159 -                <dependency>
  39.160 -                    <code-name-base>org.netbeans.modules.lexer</code-name-base>
  39.161 -                    <build-prerequisite/>
  39.162 -                    <compile-dependency/>
  39.163 -                    <run-dependency>
  39.164 -                        <release-version>2</release-version>
  39.165 -                        <specification-version>1.43</specification-version>
  39.166 -                    </run-dependency>
  39.167 -                </dependency>
  39.168 -                <dependency>
  39.169 -                    <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
  39.170 -                    <build-prerequisite/>
  39.171 -                    <compile-dependency/>
  39.172 -                    <run-dependency>
  39.173 -                        <release-version>1</release-version>
  39.174 -                        <specification-version>1.74</specification-version>
  39.175 -                    </run-dependency>
  39.176 -                </dependency>
  39.177 -                <dependency>
  39.178 -                    <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
  39.179 -                    <build-prerequisite/>
  39.180 -                    <compile-dependency/>
  39.181 -                    <run-dependency>
  39.182 -                        <release-version>1</release-version>
  39.183 -                        <implementation-version/>
  39.184 -                    </run-dependency>
  39.185 -                </dependency>
  39.186 -                <dependency>
  39.187 -                    <code-name-base>org.netbeans.modules.parsing.indexing</code-name-base>
  39.188 -                    <build-prerequisite/>
  39.189 -                    <compile-dependency/>
  39.190 -                    <run-dependency>
  39.191 -                        <implementation-version/>
  39.192 -                    </run-dependency>
  39.193 -                </dependency>
  39.194 -                <dependency>
  39.195 -                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
  39.196 -                    <build-prerequisite/>
  39.197 -                    <compile-dependency/>
  39.198 -                    <run-dependency>
  39.199 -                        <release-version>1</release-version>
  39.200 -                        <specification-version>1.41</specification-version>
  39.201 -                    </run-dependency>
  39.202 -                </dependency>
  39.203 -                <dependency>
  39.204 -                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
  39.205 -                    <build-prerequisite/>
  39.206 -                    <compile-dependency/>
  39.207 -                    <run-dependency>
  39.208 -                        <release-version>1</release-version>
  39.209 -                        <specification-version>1.54</specification-version>
  39.210 -                    </run-dependency>
  39.211 -                </dependency>
  39.212 -                <dependency>
  39.213 -                    <code-name-base>org.netbeans.modules.projectuiapi.base</code-name-base>
  39.214 -                    <build-prerequisite/>
  39.215 -                    <compile-dependency/>
  39.216 -                    <run-dependency>
  39.217 -                        <release-version>1</release-version>
  39.218 -                        <specification-version>1.79.0.9</specification-version>
  39.219 -                    </run-dependency>
  39.220 -                </dependency>
  39.221 -                <dependency>
  39.222 -                    <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
  39.223 -                    <build-prerequisite/>
  39.224 -                    <compile-dependency/>
  39.225 -                    <run-dependency>
  39.226 -                        <specification-version>1.34</specification-version>
  39.227 -                    </run-dependency>
  39.228 -                </dependency>
  39.229 -                <dependency>
  39.230 -                    <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
  39.231 -                    <build-prerequisite/>
  39.232 -                    <compile-dependency/>
  39.233 -                    <run-dependency>
  39.234 -                        <release-version>0-1</release-version>
  39.235 -                        <specification-version>1.22</specification-version>
  39.236 -                    </run-dependency>
  39.237 -                </dependency>
  39.238 -                <dependency>
  39.239 -                    <code-name-base>org.netbeans.spi.java.hints</code-name-base>
  39.240 -                    <build-prerequisite/>
  39.241 -                    <compile-dependency/>
  39.242 -                    <run-dependency>
  39.243 -                        <implementation-version/>
  39.244 -                    </run-dependency>
  39.245 -                </dependency>
  39.246 -                <dependency>
  39.247 -                    <code-name-base>org.openide.filesystems</code-name-base>
  39.248 -                    <build-prerequisite/>
  39.249 -                    <compile-dependency/>
  39.250 -                    <run-dependency>
  39.251 -                        <specification-version>7.55</specification-version>
  39.252 -                    </run-dependency>
  39.253 -                </dependency>
  39.254 -                <dependency>
  39.255 -                    <code-name-base>org.openide.loaders</code-name-base>
  39.256 -                    <build-prerequisite/>
  39.257 -                    <compile-dependency/>
  39.258 -                    <run-dependency>
  39.259 -                        <specification-version>7.33</specification-version>
  39.260 -                    </run-dependency>
  39.261 -                </dependency>
  39.262 -                <dependency>
  39.263 -                    <code-name-base>org.openide.nodes</code-name-base>
  39.264 -                    <build-prerequisite/>
  39.265 -                    <compile-dependency/>
  39.266 -                    <run-dependency>
  39.267 -                        <specification-version>7.26</specification-version>
  39.268 -                    </run-dependency>
  39.269 -                </dependency>
  39.270 -                <dependency>
  39.271 -                    <code-name-base>org.openide.text</code-name-base>
  39.272 -                    <build-prerequisite/>
  39.273 -                    <compile-dependency/>
  39.274 -                    <run-dependency>
  39.275 -                        <specification-version>6.44</specification-version>
  39.276 -                    </run-dependency>
  39.277 -                </dependency>
  39.278 -                <dependency>
  39.279 -                    <code-name-base>org.openide.util</code-name-base>
  39.280 -                    <build-prerequisite/>
  39.281 -                    <compile-dependency/>
  39.282 -                    <run-dependency>
  39.283 -                        <specification-version>8.20</specification-version>
  39.284 -                    </run-dependency>
  39.285 -                </dependency>
  39.286 -                <dependency>
  39.287 -                    <code-name-base>org.openide.util.lookup</code-name-base>
  39.288 -                    <build-prerequisite/>
  39.289 -                    <compile-dependency/>
  39.290 -                    <run-dependency>
  39.291 -                        <specification-version>8.12</specification-version>
  39.292 -                    </run-dependency>
  39.293 -                </dependency>
  39.294 -                <dependency>
  39.295 -                    <code-name-base>org.openide.util.ui</code-name-base>
  39.296 -                    <build-prerequisite/>
  39.297 -                    <compile-dependency/>
  39.298 -                    <run-dependency>
  39.299 -                        <specification-version>9.3</specification-version>
  39.300 -                    </run-dependency>
  39.301 -                </dependency>
  39.302 -            </module-dependencies>
  39.303 -            <test-dependencies>
  39.304 -                <test-type>
  39.305 -                    <name>unit</name>
  39.306 -                    <test-dependency>
  39.307 -                        <code-name-base>org.netbeans.modules.parsing.nb</code-name-base>
  39.308 -                        <recursive/>
  39.309 -                        <compile-dependency/>
  39.310 -                    </test-dependency>
  39.311 -                    <test-dependency>
  39.312 -                        <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
  39.313 -                        <compile-dependency/>
  39.314 -                    </test-dependency>
  39.315 -                </test-type>
  39.316 -            </test-dependencies>
  39.317 -            <public-packages>
  39.318 -                <package>org.netbeans.modules.java.hints.test.api</package>
  39.319 -            </public-packages>
  39.320 -        </data>
  39.321 -    </configuration>
  39.322 -</project>
    40.1 --- a/sandbox/java.hints/java.hints.test/nbproject/suite.properties	Sun Jan 08 20:10:08 2017 +0100
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,42 +0,0 @@
    40.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    40.5 -#
    40.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    40.7 -#
    40.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    40.9 -# Other names may be trademarks of their respective owners.
   40.10 -#
   40.11 -# The contents of this file are subject to the terms of either the GNU
   40.12 -# General Public License Version 2 only ("GPL") or the Common
   40.13 -# Development and Distribution License("CDDL") (collectively, the
   40.14 -# "License"). You may not use this file except in compliance with the
   40.15 -# License. You can obtain a copy of the License at
   40.16 -# http://www.netbeans.org/cddl-gplv2.html
   40.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   40.18 -# specific language governing permissions and limitations under the
   40.19 -# License.  When distributing the software, include this License Header
   40.20 -# Notice in each file and include the License file at
   40.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   40.22 -# particular file as subject to the "Classpath" exception as provided
   40.23 -# by Oracle in the GPL Version 2 section of the License file that
   40.24 -# accompanied this code. If applicable, add the following below the
   40.25 -# License Header, with the fields enclosed by brackets [] replaced by
   40.26 -# your own identifying information:
   40.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   40.28 -#
   40.29 -# Contributor(s):
   40.30 -#
   40.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   40.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   40.33 -# Microsystems, Inc. All Rights Reserved.
   40.34 -#
   40.35 -# If you wish your version of this file to be governed by only the CDDL
   40.36 -# or only the GPL Version 2, indicate your decision by adding
   40.37 -# "[Contributor] elects to include this software in this distribution
   40.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   40.39 -# single choice of license, a recipient has the option to distribute
   40.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   40.41 -# to extend the choice of license to its licensees as provided above.
   40.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   40.43 -# Version 2 license, then the option applies only if the new code is
   40.44 -# made subject to such option by the copyright holder.
   40.45 -suite.dir=${basedir}/..
    41.1 --- a/sandbox/java.hints/java.hints.test/src/org/netbeans/modules/java/hints/test/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,42 +0,0 @@
    41.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    41.5 -#
    41.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    41.7 -#
    41.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    41.9 -# Other names may be trademarks of their respective owners.
   41.10 -#
   41.11 -# The contents of this file are subject to the terms of either the GNU
   41.12 -# General Public License Version 2 only ("GPL") or the Common
   41.13 -# Development and Distribution License("CDDL") (collectively, the
   41.14 -# "License"). You may not use this file except in compliance with the
   41.15 -# License. You can obtain a copy of the License at
   41.16 -# http://www.netbeans.org/cddl-gplv2.html
   41.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   41.18 -# specific language governing permissions and limitations under the
   41.19 -# License.  When distributing the software, include this License Header
   41.20 -# Notice in each file and include the License file at
   41.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   41.22 -# particular file as subject to the "Classpath" exception as provided
   41.23 -# by Oracle in the GPL Version 2 section of the License file that
   41.24 -# accompanied this code. If applicable, add the following below the
   41.25 -# License Header, with the fields enclosed by brackets [] replaced by
   41.26 -# your own identifying information:
   41.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   41.28 -#
   41.29 -# Contributor(s):
   41.30 -#
   41.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   41.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   41.33 -# Microsystems, Inc. All Rights Reserved.
   41.34 -#
   41.35 -# If you wish your version of this file to be governed by only the CDDL
   41.36 -# or only the GPL Version 2, indicate your decision by adding
   41.37 -# "[Contributor] elects to include this software in this distribution
   41.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   41.39 -# single choice of license, a recipient has the option to distribute
   41.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   41.41 -# to extend the choice of license to its licensees as provided above.
   41.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   41.43 -# Version 2 license, then the option applies only if the new code is
   41.44 -# made subject to such option by the copyright holder.
   41.45 -OpenIDE-Module-Name=Java Hints Test API
    42.1 --- a/sandbox/java.hints/java.hints.test/src/org/netbeans/modules/java/hints/test/Utilities.java	Sun Jan 08 20:10:08 2017 +0100
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,104 +0,0 @@
    42.4 -/*
    42.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    42.6 - *
    42.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
    42.8 - *
    42.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   42.10 - * Other names may be trademarks of their respective owners.
   42.11 - *
   42.12 - * The contents of this file are subject to the terms of either the GNU
   42.13 - * General Public License Version 2 only ("GPL") or the Common
   42.14 - * Development and Distribution License("CDDL") (collectively, the
   42.15 - * "License"). You may not use this file except in compliance with the
   42.16 - * License. You can obtain a copy of the License at
   42.17 - * http://www.netbeans.org/cddl-gplv2.html
   42.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   42.19 - * specific language governing permissions and limitations under the
   42.20 - * License.  When distributing the software, include this License Header
   42.21 - * Notice in each file and include the License file at
   42.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   42.23 - * particular file as subject to the "Classpath" exception as provided
   42.24 - * by Oracle in the GPL Version 2 section of the License file that
   42.25 - * accompanied this code. If applicable, add the following below the
   42.26 - * License Header, with the fields enclosed by brackets [] replaced by
   42.27 - * your own identifying information:
   42.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   42.29 - *
   42.30 - * If you wish your version of this file to be governed by only the CDDL
   42.31 - * or only the GPL Version 2, indicate your decision by adding
   42.32 - * "[Contributor] elects to include this software in this distribution
   42.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   42.34 - * single choice of license, a recipient has the option to distribute
   42.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   42.36 - * to extend the choice of license to its licensees as provided above.
   42.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   42.38 - * Version 2 license, then the option applies only if the new code is
   42.39 - * made subject to such option by the copyright holder.
   42.40 - *
   42.41 - * Contributor(s):
   42.42 - *
   42.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
   42.44 - */
   42.45 -package org.netbeans.modules.java.hints.test;
   42.46 -
   42.47 -import org.netbeans.api.editor.mimelookup.MimePath;
   42.48 -import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
   42.49 -import org.netbeans.modules.java.source.parsing.JavacParser;
   42.50 -import org.netbeans.modules.java.source.parsing.JavacParserFactory;
   42.51 -import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
   42.52 -import org.openide.filesystems.FileObject;
   42.53 -import org.openide.filesystems.MIMEResolver;
   42.54 -import org.openide.util.Lookup;
   42.55 -import org.openide.util.lookup.Lookups;
   42.56 -import org.openide.util.lookup.ProxyLookup;
   42.57 -import org.openide.util.lookup.ServiceProvider;
   42.58 -
   42.59 -/**
   42.60 - *
   42.61 - * @author lahvac
   42.62 - */
   42.63 -public class Utilities {
   42.64 -
   42.65 -    @ServiceProvider(service = Lookup.class)
   42.66 -    public static final class TestLookup extends ProxyLookup {
   42.67 -
   42.68 -        public void setLookupsImpl(Lookup... lookups) {
   42.69 -            setLookups(lookups);
   42.70 -        }
   42.71 -
   42.72 -    }
   42.73 -
   42.74 -    @ServiceProvider(service=MimeDataProvider.class)
   42.75 -    public static final class JavacParserProvider implements MimeDataProvider {
   42.76 -
   42.77 -        private Lookup javaLookup = Lookups.fixed(new JavacParserFactory(), new JavaCustomIndexer.Factory());
   42.78 -
   42.79 -        public Lookup getLookup(MimePath mimePath) {
   42.80 -            if (mimePath.getPath().endsWith(JavacParser.MIME_TYPE)) {
   42.81 -                return javaLookup;
   42.82 -            }
   42.83 -
   42.84 -            return Lookup.EMPTY;
   42.85 -        }
   42.86 -
   42.87 -    }
   42.88 -
   42.89 -    @ServiceProvider(service=MIMEResolver.class)
   42.90 -    public static final class JavaMimeResolver extends MIMEResolver {
   42.91 -
   42.92 -        public JavaMimeResolver() {
   42.93 -            super(JavacParser.MIME_TYPE);
   42.94 -        }
   42.95 -
   42.96 -        @Override
   42.97 -        public String findMIMEType(FileObject fo) {
   42.98 -            if ("java".equals(fo.getExt())) {
   42.99 -                return JavacParser.MIME_TYPE;
  42.100 -            }
  42.101 -
  42.102 -            return null;
  42.103 -        }
  42.104 -
  42.105 -    }
  42.106 -
  42.107 -}
    43.1 --- a/sandbox/java.hints/java.hints.test/src/org/netbeans/modules/java/hints/test/api/HintTest.java	Sun Jan 08 20:10:08 2017 +0100
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,1427 +0,0 @@
    43.4 -/*
    43.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    43.6 - *
    43.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
    43.8 - *
    43.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   43.10 - * Other names may be trademarks of their respective owners.
   43.11 - *
   43.12 - * The contents of this file are subject to the terms of either the GNU
   43.13 - * General Public License Version 2 only ("GPL") or the Common
   43.14 - * Development and Distribution License("CDDL") (collectively, the
   43.15 - * "License"). You may not use this file except in compliance with the
   43.16 - * License. You can obtain a copy of the License at
   43.17 - * http://www.netbeans.org/cddl-gplv2.html
   43.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   43.19 - * specific language governing permissions and limitations under the
   43.20 - * License.  When distributing the software, include this License Header
   43.21 - * Notice in each file and include the License file at
   43.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   43.23 - * particular file as subject to the "Classpath" exception as provided
   43.24 - * by Oracle in the GPL Version 2 section of the License file that
   43.25 - * accompanied this code. If applicable, add the following below the
   43.26 - * License Header, with the fields enclosed by brackets [] replaced by
   43.27 - * your own identifying information:
   43.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   43.29 - *
   43.30 - * If you wish your version of this file to be governed by only the CDDL
   43.31 - * or only the GPL Version 2, indicate your decision by adding
   43.32 - * "[Contributor] elects to include this software in this distribution
   43.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   43.34 - * single choice of license, a recipient has the option to distribute
   43.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   43.36 - * to extend the choice of license to its licensees as provided above.
   43.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   43.38 - * Version 2 license, then the option applies only if the new code is
   43.39 - * made subject to such option by the copyright holder.
   43.40 - *
   43.41 - * Contributor(s):
   43.42 - *
   43.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
   43.44 - */
   43.45 -package org.netbeans.modules.java.hints.test.api;
   43.46 -
   43.47 -import com.sun.source.tree.CompilationUnitTree;
   43.48 -import com.sun.source.util.TreePath;
   43.49 -import java.io.File;
   43.50 -import java.io.FileInputStream;
   43.51 -import java.io.IOException;
   43.52 -import java.io.OutputStream;
   43.53 -import java.lang.ref.Reference;
   43.54 -import java.lang.ref.WeakReference;
   43.55 -import java.net.URL;
   43.56 -import java.util.ArrayList;
   43.57 -import java.util.Arrays;
   43.58 -import java.util.Collection;
   43.59 -import java.util.Collections;
   43.60 -import java.util.Comparator;
   43.61 -import java.util.Enumeration;
   43.62 -import java.util.HashMap;
   43.63 -import java.util.HashSet;
   43.64 -import java.util.IdentityHashMap;
   43.65 -import java.util.LinkedList;
   43.66 -import java.util.List;
   43.67 -import java.util.Map;
   43.68 -import java.util.Map.Entry;
   43.69 -import java.util.Properties;
   43.70 -import java.util.Set;
   43.71 -import java.util.concurrent.atomic.AtomicBoolean;
   43.72 -import java.util.logging.Handler;
   43.73 -import java.util.logging.Level;
   43.74 -import java.util.logging.LogRecord;
   43.75 -import java.util.logging.Logger;
   43.76 -import java.util.prefs.AbstractPreferences;
   43.77 -import java.util.prefs.BackingStoreException;
   43.78 -import java.util.prefs.Preferences;
   43.79 -import java.util.regex.Pattern;
   43.80 -import javax.swing.event.ChangeListener;
   43.81 -import javax.swing.text.Document;
   43.82 -import javax.tools.Diagnostic;
   43.83 -import junit.framework.Assert;
   43.84 -import static junit.framework.Assert.assertEquals;
   43.85 -import static junit.framework.Assert.assertFalse;
   43.86 -import static junit.framework.Assert.assertNotNull;
   43.87 -import static junit.framework.Assert.assertNotSame;
   43.88 -import static junit.framework.Assert.assertTrue;
   43.89 -
   43.90 -import org.netbeans.api.editor.mimelookup.MimeLookup;
   43.91 -import org.netbeans.api.java.classpath.ClassPath;
   43.92 -import org.netbeans.api.java.lexer.JavaTokenId;
   43.93 -import org.netbeans.api.java.queries.SourceForBinaryQuery;
   43.94 -import org.netbeans.api.java.source.ClasspathInfo;
   43.95 -import org.netbeans.api.java.source.CompilationController;
   43.96 -import org.netbeans.api.java.source.CompilationInfo;
   43.97 -import org.netbeans.api.java.source.JavaSource;
   43.98 -import org.netbeans.api.java.source.JavaSource.Phase;
   43.99 -import org.netbeans.api.java.source.ModificationResult;
  43.100 -import org.netbeans.api.java.source.ModificationResult.Difference;
  43.101 -import org.netbeans.api.java.source.Task;
  43.102 -import org.netbeans.api.java.source.WorkingCopy;
  43.103 -import org.netbeans.api.lexer.Language;
  43.104 -import org.netbeans.api.project.ui.*;
  43.105 -import org.netbeans.core.startup.Main;
  43.106 -import org.netbeans.junit.NbTestCase;
  43.107 -import org.netbeans.modules.java.JavaDataLoader;
  43.108 -import org.netbeans.modules.java.hints.providers.code.CodeHintProviderImpl;
  43.109 -import org.netbeans.modules.java.hints.providers.code.FSWrapper;
  43.110 -import org.netbeans.modules.java.hints.providers.code.FSWrapper.ClassWrapper;
  43.111 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
  43.112 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.Worker;
  43.113 -import org.netbeans.modules.java.hints.providers.spi.HintDescriptionFactory;
  43.114 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
  43.115 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata.Options;
  43.116 -import org.netbeans.modules.java.hints.spiimpl.JavaFixImpl;
  43.117 -import org.netbeans.modules.java.hints.spiimpl.JavaFixImpl.Accessor;
  43.118 -import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
  43.119 -import org.netbeans.modules.java.hints.spiimpl.SyntheticFix;
  43.120 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch;
  43.121 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.BatchResult;
  43.122 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Folder;
  43.123 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Resource;
  43.124 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Scope;
  43.125 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.VerifiedSpansCallBack;
  43.126 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchUtilities;
  43.127 -import org.netbeans.modules.java.hints.spiimpl.batch.ProgressHandleWrapper;
  43.128 -import org.netbeans.modules.java.hints.spiimpl.batch.Scopes;
  43.129 -import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker;
  43.130 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
  43.131 -import org.netbeans.modules.java.hints.test.Utilities.TestLookup;
  43.132 -import org.netbeans.modules.java.source.JavaSourceAccessor;
  43.133 -import org.netbeans.modules.java.source.TreeLoader;
  43.134 -import org.netbeans.modules.parsing.api.indexing.IndexingManager;
  43.135 -import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
  43.136 -import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
  43.137 -import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation;
  43.138 -import org.netbeans.spi.editor.hints.ErrorDescription;
  43.139 -import org.netbeans.spi.editor.hints.Fix;
  43.140 -import org.netbeans.spi.editor.hints.Severity;
  43.141 -import org.netbeans.spi.java.classpath.ClassPathProvider;
  43.142 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
  43.143 -import org.netbeans.spi.java.hints.Hint.Kind;
  43.144 -import org.netbeans.spi.java.hints.HintContext;
  43.145 -import org.netbeans.spi.java.hints.JavaFix;
  43.146 -import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation;
  43.147 -import org.netbeans.spi.java.queries.SourceLevelQueryImplementation;
  43.148 -import org.openide.LifecycleManager;
  43.149 -import org.openide.cookies.EditorCookie;
  43.150 -import org.openide.filesystems.FileObject;
  43.151 -import org.openide.filesystems.FileStateInvalidException;
  43.152 -import org.openide.filesystems.FileSystem;
  43.153 -import org.openide.filesystems.FileUtil;
  43.154 -import org.openide.filesystems.MultiFileSystem;
  43.155 -import org.openide.filesystems.Repository;
  43.156 -import org.openide.filesystems.URLMapper;
  43.157 -import org.openide.filesystems.XMLFileSystem;
  43.158 -import org.openide.loaders.DataObject;
  43.159 -import org.openide.loaders.DataObjectNotFoundException;
  43.160 -import org.openide.util.Exceptions;
  43.161 -import org.openide.util.Lookup;
  43.162 -import org.openide.util.NbBundle;
  43.163 -import org.openide.util.lookup.Lookups;
  43.164 -
  43.165 -/**A support class for writing a test for a Java Hint. A test verifying that correct
  43.166 - * warnings are produced should look like:
  43.167 - * <pre>
  43.168 - * HintTest.create()
  43.169 - *         .input("&lt;input Java source code>")
  43.170 - *         .run(&lt;class containg the hint>)
  43.171 - *         .assertWarnings("&lt;required warning(s)>");
  43.172 - * </pre>
  43.173 - *
  43.174 - * Note: when verifying that no warnings are produced in a particular situation,
  43.175 - * do not pass any warnings to the {@code assertWarnings} method.
  43.176 - *
  43.177 - * A test verifying that a hint's transformation is correct:
  43.178 - * <pre>
  43.179 - * HintTest.create()
  43.180 - *         .input("&lt;input Java source code>")
  43.181 - *         .run(&lt;class containg the hint>)
  43.182 - *         .findWarning("&lt;a warning produce by the hint>")
  43.183 - *         .applyFix() //fill apply the only fix in the given ErrorDescription
  43.184 - *         .assertCompilable()
  43.185 - *         .assertOutput("&lt;output Java source code>");
  43.186 - * </pre>
  43.187 - *
  43.188 - * All the tests run under the {@code test} branding, which allows to specify test values
  43.189 - * for bundle keys for warning and fix in {@code Bundle_test.properties}, to isolate the
  43.190 - * test from changes in the production {@code Bundle.properties}.
  43.191 - *
  43.192 - * @author lahvac
  43.193 - */
  43.194 -public class HintTest {
  43.195 -
  43.196 -    private static final Logger INDEXING_LOGGER = /* RepositoryUpdater.UI_LOGGER */ Logger.getLogger("org.netbeans.ui.indexing");
  43.197 -    static {
  43.198 -        INDEXING_LOGGER.setLevel(Level.WARNING);
  43.199 -    }
  43.200 -
  43.201 -    private final File workDir;
  43.202 -    private final FileObject sourceRoot;
  43.203 -    private final FileObject buildRoot;
  43.204 -    private final FileObject cache;
  43.205 -    private final Preferences testPreferences;
  43.206 -    private final HintsSettings hintSettings;
  43.207 -    private final List<FileObject> checkCompilable = new ArrayList<FileObject>();
  43.208 -    private final List<FileObject> testFiles = new ArrayList<FileObject>();
  43.209 -    private String sourceLevel = "1.5";
  43.210 -    private Character caretMarker;
  43.211 -    private FileObject testFile;
  43.212 -    private int caret = -1;
  43.213 -    private ClassPath sourcePath;
  43.214 -    private ClassPath compileClassPath = ClassPathSupport.createClassPath(new URL[0]);
  43.215 -
  43.216 -    private HintTest() throws Exception {
  43.217 -        List<URL> layers = new LinkedList<URL>();
  43.218 -
  43.219 -        for (String layer : new String[] {"META-INF/generated-layer.xml"}) {
  43.220 -            boolean found = false;
  43.221 -
  43.222 -            for (Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources(layer); en.hasMoreElements(); ) {
  43.223 -                found = true;
  43.224 -                layers.add(en.nextElement());
  43.225 -            }
  43.226 -
  43.227 -            Assert.assertTrue(layer, found);
  43.228 -        }
  43.229 -
  43.230 -        XMLFileSystem xmlFS = new XMLFileSystem();
  43.231 -        xmlFS.setXmlUrls(layers.toArray(new URL[0]));
  43.232 -
  43.233 -        FileSystem system = new MultiFileSystem(new FileSystem[] {FileUtil.createMemoryFileSystem(), xmlFS});
  43.234 -
  43.235 -        Repository repository = new Repository(system);
  43.236 -
  43.237 -        assertEquals(Lookup.getDefault().getClass().getCanonicalName(), TestLookup.class, Lookup.getDefault().getClass());
  43.238 -
  43.239 -        ((TestLookup) Lookup.getDefault()).setLookupsImpl(
  43.240 -            Lookups.fixed(repository,
  43.241 -                          new TestProxyClassPathProvider(),
  43.242 -                          new TestSourceForBinaryQuery(),
  43.243 -                          new TestSourceLevelQueryImplementation(),
  43.244 -                          JavaDataLoader.findObject(JavaDataLoader.class, true)),
  43.245 -            Lookups.metaInfServices(HintTest.class.getClassLoader()),
  43.246 -            Lookups.singleton(HintTest.class.getClassLoader())
  43.247 -        );
  43.248 -
  43.249 -        Set<String> amt = MimeTypes.getAllMimeTypes();
  43.250 -        if (amt == null) {
  43.251 -            amt = new HashSet<String>();
  43.252 -        } else {
  43.253 -            amt = new HashSet<String>(amt);
  43.254 -        }
  43.255 -        amt.add("text/x-java");
  43.256 -        MimeTypes.setAllMimeTypes(amt);
  43.257 -        org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
  43.258 -
  43.259 -        TreeLoader.DISABLE_CONFINEMENT_TEST = true;
  43.260 -        testPreferences = new TempPreferences();
  43.261 -        hintSettings = new HintsSettings() {
  43.262 -            @Override public boolean isEnabled(HintMetadata hint) {
  43.263 -                return true;
  43.264 -            }
  43.265 -            @Override public void setEnabled(HintMetadata hint, boolean value) {
  43.266 -                throw new UnsupportedOperationException("Not supported.");
  43.267 -            }
  43.268 -            @Override public Preferences getHintPreferences(HintMetadata hint) {
  43.269 -                return testPreferences;
  43.270 -            }
  43.271 -            @Override public Severity getSeverity(HintMetadata hint) {
  43.272 -                return hint.severity;
  43.273 -            }
  43.274 -            @Override public void setSeverity(HintMetadata hint, Severity severity) {
  43.275 -                throw new UnsupportedOperationException("Not supported.");
  43.276 -            }
  43.277 -        };
  43.278 -
  43.279 -        workDir = getWorkDir();
  43.280 -        deleteSubFiles(workDir);
  43.281 -        FileUtil.refreshFor(workDir);
  43.282 -
  43.283 -        FileObject wd = FileUtil.toFileObject(workDir);
  43.284 -        
  43.285 -        assertNotNull(wd);
  43.286 -
  43.287 -        sourceRoot = FileUtil.createFolder(wd, "src");
  43.288 -        buildRoot = FileUtil.createFolder(wd, "build");
  43.289 -        cache = FileUtil.createFolder(wd, "cache");
  43.290 -
  43.291 -        CacheFolder.setCacheFolder(cache);
  43.292 -
  43.293 -        NbBundle.setBranding("test");
  43.294 -
  43.295 -        sourcePath = ClassPathSupport.createClassPath(sourceRoot);
  43.296 -        
  43.297 -        Main.initializeURLFactory();
  43.298 -    }
  43.299 -
  43.300 -    /**Bootstraps the test framework.
  43.301 -     *
  43.302 -     * @return the test framework - call more methods on it to set-up a test, then call {@code run} method and assert results.
  43.303 -     */
  43.304 -    public static HintTest create() throws Exception {
  43.305 -        return new HintTest();
  43.306 -    }
  43.307 -
  43.308 -    /**A character to use as a marker of a caret in the input code. The caret position
  43.309 -     * during the run method will be set to the position of this character in the first input file.
  43.310 -     *
  43.311 -     * @param c a caret marker
  43.312 -     * @return itself
  43.313 -     */
  43.314 -    public HintTest setCaretMarker(char c) {
  43.315 -        this.caretMarker = c;
  43.316 -        return this;
  43.317 -    }
  43.318 -
  43.319 -    /**Use the specified {@link java.net.URL}s as compile classpath while parsing
  43.320 -     * the Java input. The {@link java.net.URL}s need to be "folder" {@link java.net.URL}s,
  43.321 -     * ready to be passed to {@link ClassPathSupport#createClassPath(java.net.URL[]) }.
  43.322 -     *
  43.323 -     * @param entries that should become roots of the compile classpath
  43.324 -     * @return itself
  43.325 -     * @see FileUtil#urlForArchiveOrDir(java.io.File)
  43.326 -     * @see FileUtil#getArchiveRoot(java.net.URL)
  43.327 -     */
  43.328 -    public HintTest classpath(URL... entries) {
  43.329 -        compileClassPath = ClassPathSupport.createClassPath(entries);
  43.330 -        return this;
  43.331 -    }
  43.332 -
  43.333 -    /**Create a test file. Equivalent to calling {@code input("test/Test.java", code, true)}.
  43.334 -     *
  43.335 -     * @param code the content of the newly created test file
  43.336 -     * @return itself
  43.337 -     */
  43.338 -    public HintTest input(String code) throws Exception {
  43.339 -        return input("test/Test.java", code, true);
  43.340 -    }
  43.341 -
  43.342 -    /**Create a test file. Equivalent to calling {@code input("test/Test.java", code, compilable)}.
  43.343 -     *
  43.344 -     * @param code the content of the newly created test file
  43.345 -     * @param compilable if true, it will be verified that the file does not contain
  43.346 -     *                   compilation errors before the hint is run on it
  43.347 -     * @return itself
  43.348 -     */
  43.349 -    public HintTest input(String code, boolean compilable) throws Exception {
  43.350 -        return input("test/Test.java", code, compilable);
  43.351 -    }
  43.352 -
  43.353 -    /**Create a test file. Equivalent to calling {@code input(fileName, code, true)}.
  43.354 -     *
  43.355 -     * @param fileName a relative file name of the newly created file from a (automatically created) source root
  43.356 -     * @param code the content of the newly created test file
  43.357 -     * @return itself
  43.358 -     */
  43.359 -    public HintTest input(String fileName, String code) throws Exception {
  43.360 -        return input(fileName, code, true);
  43.361 -    }
  43.362 -    
  43.363 -    /**Create a test file. Any number of files can be created for one test, but the hint
  43.364 -     * will be run only on the first one.
  43.365 -     *
  43.366 -     * @param fileName a relative file name of the newly created file from a (automatically created) source root
  43.367 -     * @param code the content of the newly created test file
  43.368 -     * @param compilable if true, it will be verified that the file does not contain
  43.369 -     *                   compilation errors before the hint is run on it
  43.370 -     * @return itself
  43.371 -     */
  43.372 -    public HintTest input(String fileName, String code, boolean compilable) throws Exception {
  43.373 -        int caret = -1;
  43.374 -
  43.375 -        if (caretMarker != null && testFile == null) {
  43.376 -            caret = code.indexOf(caretMarker);
  43.377 -
  43.378 -            assertNotSame("A caret location must be specified", -1, caret);
  43.379 -
  43.380 -            code = code.substring(0, caret) + code.substring(caret + 1);
  43.381 -        }
  43.382 -
  43.383 -        FileObject file = FileUtil.createData(sourceRoot, fileName);
  43.384 -
  43.385 -        copyStringToFile(file, code);
  43.386 -
  43.387 -        if (compilable) {
  43.388 -            checkCompilable.add(file);
  43.389 -        }
  43.390 -
  43.391 -        if (testFile == null) {
  43.392 -            testFile = file;
  43.393 -            this.caret = caret;
  43.394 -        }
  43.395 -        
  43.396 -        testFiles.add(file);
  43.397 -        
  43.398 -        return this;
  43.399 -    }
  43.400 -
  43.401 -    private void ensureCompilable(FileObject file) throws IOException, AssertionError, IllegalArgumentException {
  43.402 -        CompilationInfo info = parse(file);
  43.403 -
  43.404 -        assertNotNull(info);
  43.405 -
  43.406 -        for (Diagnostic d : info.getDiagnostics()) {
  43.407 -            if (d.getKind() == Diagnostic.Kind.ERROR)
  43.408 -                throw new AssertionError(d.getLineNumber() + ":" + d.getColumnNumber() + " " + d.getMessage(null));
  43.409 -        }
  43.410 -    }
  43.411 -
  43.412 -    /**Sets a source level for all Java files used in this test.
  43.413 -     *
  43.414 -     * @param sourceLevel the source level to use while parsing Java files
  43.415 -     * @return itself
  43.416 -     */
  43.417 -    public HintTest sourceLevel(String sourceLevel) {
  43.418 -        this.sourceLevel = sourceLevel;
  43.419 -        return this;
  43.420 -    }
  43.421 -
  43.422 -    /**Sets a preference that will be visible to the hint.
  43.423 -     *
  43.424 -     * @param preferencesKey a key for the preferences
  43.425 -     * @param value the value to set
  43.426 -     * @return itself
  43.427 -     */
  43.428 -    public HintTest preference(String preferencesKey, String value) {
  43.429 -        this.testPreferences.put(preferencesKey, value);
  43.430 -        return this;
  43.431 -    }
  43.432 -
  43.433 -    /**Sets a preference that will be visible to the hint.
  43.434 -     *
  43.435 -     * @param preferencesKey a key for the preferences
  43.436 -     * @param value the value to set
  43.437 -     * @return itself
  43.438 -     */
  43.439 -    public HintTest preference(String preferencesKey, int value) {
  43.440 -        this.testPreferences.putInt(preferencesKey, value);
  43.441 -        return this;
  43.442 -    }
  43.443 -
  43.444 -    /**Sets a preference that will be visible to the hint.
  43.445 -     *
  43.446 -     * @param preferencesKey a key for the preferences
  43.447 -     * @param value the value to set
  43.448 -     * @return itself
  43.449 -     */
  43.450 -    public HintTest preference(String preferencesKey, boolean value) {
  43.451 -        this.testPreferences.putBoolean(preferencesKey, value);
  43.452 -        return this;
  43.453 -    }
  43.454 -    
  43.455 -    /**Runs the given hint(s) on the first file written by a {@code input} method.
  43.456 -     *
  43.457 -     * @param hint all hints in this class will be run on the file
  43.458 -     * @return a wrapper over the hint output that allows verifying results of the hint
  43.459 -     */
  43.460 -    public HintOutput run(Class<?> hint) throws Exception {
  43.461 -        return run(hint, null);
  43.462 -    }
  43.463 -
  43.464 -    /**Runs the given hint(s) on the first file written by a {@code input} method.
  43.465 -     * Runs only hints with the specified {@code hintCode}. Null hintCode includes
  43.466 -     * all hints from the class
  43.467 -     *
  43.468 -     * @param hint all hints in this class will be run on the file
  43.469 -     * @param hintCode if not {@code null}, only hints with the same id will be run
  43.470 -     * @return a wrapper over the hint output that allows verifying results of the hint
  43.471 -     */
  43.472 -    public HintOutput run(Class<?> hint, String hintCode) throws Exception {
  43.473 -        return runImpl(hint, hintCode, new HintComputer() {
  43.474 -            @Override public Collection<ErrorDescription> computeHints(List<HintDescription> total) throws Exception {
  43.475 -                CompilationInfo info = parse(testFile);
  43.476 -
  43.477 -                assertNotNull(info);
  43.478 -
  43.479 -                List<ErrorDescription> result = new ArrayList<ErrorDescription>();
  43.480 -
  43.481 -                Map<HintDescription, List<ErrorDescription>> errors = computeErrors(info, total, new AtomicBoolean());
  43.482 -
  43.483 -                for (Entry<HintDescription, List<ErrorDescription>> e : errors.entrySet()) {
  43.484 -                    result.addAll(e.getValue());
  43.485 -                }
  43.486 -
  43.487 -                Reference<CompilationInfo> infoRef = new WeakReference<CompilationInfo>(info);
  43.488 -                Reference<CompilationUnitTree> cut = new WeakReference<CompilationUnitTree>(info.getCompilationUnit());
  43.489 -
  43.490 -                info = null;
  43.491 -
  43.492 -                DEBUGGING_HELPER.add(result);
  43.493 -                NbTestCase.assertGC("noone holds CompilationInfo", infoRef);
  43.494 -                NbTestCase.assertGC("noone holds javac", cut);
  43.495 -                DEBUGGING_HELPER.remove(result);
  43.496 -
  43.497 -                return result;
  43.498 -            }
  43.499 -        });
  43.500 -    }
  43.501 -
  43.502 -    private HintOutput runImpl(Class<?> hint, String hintCode, HintComputer doComputeErrors) throws Exception {
  43.503 -        IndexingManager.getDefault().refreshIndexAndWait(sourceRoot.toURL(), null);
  43.504 -        
  43.505 -        for (FileObject file : checkCompilable) {
  43.506 -            ensureCompilable(file);
  43.507 -        }
  43.508 -        
  43.509 -        Map<HintMetadata, Collection<HintDescription>> hints = new HashMap<HintMetadata, Collection<HintDescription>>();
  43.510 -        List<ClassWrapper> found = new ArrayList<ClassWrapper>();
  43.511 -
  43.512 -        for (ClassWrapper w : FSWrapper.listClasses()) {
  43.513 -            if (hint.getCanonicalName().equals(w.getName().replace('$', '.'))) {
  43.514 -                found.add(w);
  43.515 -            }
  43.516 -        }
  43.517 -
  43.518 -        assertFalse(found.isEmpty());
  43.519 -
  43.520 -        for (ClassWrapper w : found) {
  43.521 -            CodeHintProviderImpl.processClass(w, hints);
  43.522 -        }
  43.523 -
  43.524 -        List<HintDescription> total = new LinkedList<HintDescription>();
  43.525 -        final Set<ErrorDescription> requiresJavaFix = Collections.newSetFromMap(new IdentityHashMap<ErrorDescription, Boolean>());
  43.526 -
  43.527 -        for (final Entry<HintMetadata, Collection<HintDescription>> e : hints.entrySet()) {
  43.528 -            if (null != hintCode && !e.getKey().id.equals(hintCode)) {
  43.529 -                continue;
  43.530 -            }
  43.531 -            if (   e.getKey().options.contains(Options.NO_BATCH)
  43.532 -                || e.getKey().options.contains(Options.QUERY)
  43.533 -                || e.getKey().kind == Kind.ACTION) {
  43.534 -                total.addAll(e.getValue());
  43.535 -                continue;
  43.536 -            }
  43.537 -            for (final HintDescription hd : e.getValue()) {
  43.538 -                total.add(HintDescriptionFactory.create()
  43.539 -                                               .setTrigger(hd.getTrigger())
  43.540 -                                               .setMetadata(e.getKey())
  43.541 -                                               .setAdditionalConstraints(hd.getAdditionalConstraints())
  43.542 -                                               .addOptions(hd.getOptions().toArray(new Options[0]))
  43.543 -                                               .setWorker(new Worker() {
  43.544 -                                                    @Override public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
  43.545 -                                                        Collection<? extends ErrorDescription> errors = hd.getWorker().createErrors(ctx);
  43.546 - 
  43.547 -                                                        if (errors != null) {
  43.548 -                                                            for (ErrorDescription ed : errors) {
  43.549 -                                                                requiresJavaFix.add(ed);
  43.550 -                                                            }
  43.551 -                                                        }
  43.552 -                                                        
  43.553 -                                                        return errors;
  43.554 -                                                     }
  43.555 -                                                })
  43.556 -                                              .produce());
  43.557 -            }
  43.558 -        }
  43.559 -        
  43.560 -        Handler h = new Handler() {
  43.561 -            @Override public void publish(LogRecord record) {
  43.562 -                if (   record.getLevel().intValue() >= Level.WARNING.intValue()
  43.563 -                    && record.getThrown() != null) {
  43.564 -                    throw new IllegalStateException(record.getThrown());
  43.565 -                }
  43.566 -            }
  43.567 -            @Override public void flush() { }
  43.568 -            @Override public void close() throws SecurityException { }
  43.569 -        };
  43.570 -
  43.571 -        Logger log = Logger.getLogger(Exceptions.class.getName());
  43.572 -        log.addHandler(h);
  43.573 -        List<ErrorDescription> result = new ArrayList<ErrorDescription>(doComputeErrors.computeHints(total));
  43.574 -        log.removeHandler(h);
  43.575 -
  43.576 -        Collections.sort(result, ERRORS_COMPARATOR);
  43.577 -        
  43.578 -        return new HintOutput(result, requiresJavaFix);
  43.579 -    }
  43.580 -
  43.581 -    private interface HintComputer {
  43.582 -        public Collection<ErrorDescription> computeHints(List<HintDescription> total) throws Exception;
  43.583 -    }
  43.584 -    
  43.585 -    public HintOutput runGlobal(Class<?> hint) throws Exception {
  43.586 -        return runImpl(hint, null, new HintComputer() {
  43.587 -            @Override public Collection<ErrorDescription> computeHints(List<HintDescription> total) throws Exception {
  43.588 -                final List<ErrorDescription> result = new ArrayList<ErrorDescription>();
  43.589 -                Scope s = Scopes.specifiedFoldersScope(Folder.convert(sourceRoot));
  43.590 -                BatchResult batchResult = BatchSearch.findOccurrences(total, s);
  43.591 -                BatchSearch.getVerifiedSpans(batchResult, new ProgressHandleWrapper(1, 1), new VerifiedSpansCallBack() {
  43.592 -                    @Override public void groupStarted() { }
  43.593 -                    @Override public boolean spansVerified(CompilationController wc, Resource r, Collection<? extends ErrorDescription> hints) throws Exception {
  43.594 -                        result.addAll(hints);
  43.595 -                        return true;
  43.596 -                    }
  43.597 -                    @Override public void groupFinished() { }
  43.598 -                    @Override public void cannotVerifySpan(Resource r) { }
  43.599 -                }, false, new ArrayList<MessageImpl>(), new AtomicBoolean());
  43.600 -
  43.601 -                return result;
  43.602 -            }
  43.603 -        });
  43.604 -    }
  43.605 -    
  43.606 -    //must keep the error descriptions (and their Fixes through them) in a field
  43.607 -    //so that assertGC is able to provide a useful trace of references:
  43.608 -    private static Set<List<ErrorDescription>> DEBUGGING_HELPER = Collections.newSetFromMap(new IdentityHashMap<List<ErrorDescription>, Boolean>());
  43.609 -
  43.610 -    private CompilationInfo parse(FileObject file) throws DataObjectNotFoundException, IllegalArgumentException, IOException {
  43.611 -        DataObject od = DataObject.find(file);
  43.612 -        EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
  43.613 -
  43.614 -        assertNotNull(ec);
  43.615 -
  43.616 -        Document doc = ec.openDocument();
  43.617 -
  43.618 -        doc.putProperty(Language.class, JavaTokenId.language());
  43.619 -        doc.putProperty("mimeType", "text/x-java");
  43.620 -
  43.621 -        JavaSource js = JavaSource.create(ClasspathInfo.create(file), file);
  43.622 -
  43.623 -        assertNotNull("found JavaSource for " + file, js);
  43.624 -
  43.625 -        final DeadlockTask bt = new DeadlockTask(Phase.RESOLVED);
  43.626 -
  43.627 -        js.runUserActionTask(bt, true);
  43.628 -        
  43.629 -        return bt.info;
  43.630 -    }
  43.631 -
  43.632 -    private Map<HintDescription, List<ErrorDescription>> computeErrors(CompilationInfo info, Iterable<? extends HintDescription> hints, AtomicBoolean cancel) {
  43.633 -        return new HintsInvoker(hintSettings, caret, cancel).computeHints(info, new TreePath(info.getCompilationUnit()), hints, new LinkedList<MessageImpl>());
  43.634 -    }
  43.635 -
  43.636 -    FileObject getSourceRoot() {
  43.637 -        return sourceRoot;
  43.638 -    }
  43.639 -
  43.640 -    private static class TempPreferences extends AbstractPreferences {
  43.641 -
  43.642 -        /*private*/Properties properties;
  43.643 -
  43.644 -        private TempPreferences() {
  43.645 -            super(null, "");
  43.646 -        }
  43.647 -
  43.648 -        private  TempPreferences(TempPreferences parent, String name)  {
  43.649 -            super(parent, name);
  43.650 -            newNode = true;
  43.651 -        }
  43.652 -
  43.653 -        protected final String getSpi(String key) {
  43.654 -            return properties().getProperty(key);
  43.655 -        }
  43.656 -
  43.657 -        protected final String[] childrenNamesSpi() throws BackingStoreException {
  43.658 -            return new String[0];
  43.659 -        }
  43.660 -
  43.661 -        protected final String[] keysSpi() throws BackingStoreException {
  43.662 -            return properties().keySet().toArray(new String[0]);
  43.663 -        }
  43.664 -
  43.665 -        protected final void putSpi(String key, String value) {
  43.666 -            properties().put(key,value);
  43.667 -        }
  43.668 -
  43.669 -        protected final void removeSpi(String key) {
  43.670 -            properties().remove(key);
  43.671 -        }
  43.672 -
  43.673 -        protected final void removeNodeSpi() throws BackingStoreException {}
  43.674 -        protected  void flushSpi() throws BackingStoreException {}
  43.675 -        protected void syncSpi() throws BackingStoreException {
  43.676 -            properties().clear();
  43.677 -        }
  43.678 -
  43.679 -        @Override
  43.680 -        public void put(String key, String value) {
  43.681 -            try {
  43.682 -                super.put(key, value);
  43.683 -            } catch (IllegalArgumentException iae) {
  43.684 -                if (iae.getMessage().contains("too long")) {
  43.685 -                    // Not for us!
  43.686 -                    putSpi(key, value);
  43.687 -                } else {
  43.688 -                    throw iae;
  43.689 -                }
  43.690 -            }
  43.691 -        }
  43.692 -
  43.693 -        Properties properties()  {
  43.694 -            if (properties == null) {
  43.695 -                properties = new Properties();
  43.696 -            }
  43.697 -            return properties;
  43.698 -        }
  43.699 -
  43.700 -        protected AbstractPreferences childSpi(String name) {
  43.701 -            return new TempPreferences(this, name);
  43.702 -        }
  43.703 -    }
  43.704 -
  43.705 -    private class TestSourceForBinaryQuery implements SourceForBinaryQueryImplementation {
  43.706 -
  43.707 -        public SourceForBinaryQuery.Result findSourceRoots(URL binaryRoot) {
  43.708 -            FileObject f = URLMapper.findFileObject(binaryRoot);
  43.709 -
  43.710 -            if (buildRoot.equals(f)) {
  43.711 -                return new SourceForBinaryQuery.Result() {
  43.712 -                    public FileObject[] getRoots() {
  43.713 -                        return new FileObject[] {
  43.714 -                            sourceRoot,
  43.715 -                        };
  43.716 -                    }
  43.717 -
  43.718 -                    public void addChangeListener(ChangeListener l) {
  43.719 -                    }
  43.720 -
  43.721 -                    public void removeChangeListener(ChangeListener l) {
  43.722 -                    }
  43.723 -                };
  43.724 -            }
  43.725 -
  43.726 -            return null;
  43.727 -        }
  43.728 -
  43.729 -    }
  43.730 -
  43.731 -    private static List<URL> bootClassPath;
  43.732 -
  43.733 -    private static Logger log = Logger.getLogger(HintTest.class.getName());
  43.734 -
  43.735 -    private static synchronized List<URL> getBootClassPath() {
  43.736 -        if (bootClassPath == null) {
  43.737 -            try {
  43.738 -                String cp = System.getProperty("sun.boot.class.path");
  43.739 -                List<URL> urls = new ArrayList<URL>();
  43.740 -                String[] paths = cp.split(Pattern.quote(System.getProperty("path.separator")));
  43.741 -
  43.742 -                for (String path : paths) {
  43.743 -                    File f = new File(path);
  43.744 -
  43.745 -                    if (!f.canRead())
  43.746 -                        continue;
  43.747 -
  43.748 -                    FileObject fo = FileUtil.toFileObject(f);
  43.749 -
  43.750 -                    if (FileUtil.isArchiveFile(fo)) {
  43.751 -                        fo = FileUtil.getArchiveRoot(fo);
  43.752 -                    }
  43.753 -
  43.754 -                    if (fo != null) {
  43.755 -                        urls.add(fo.getURL());
  43.756 -                    }
  43.757 -                }
  43.758 -
  43.759 -                bootClassPath = urls;
  43.760 -            } catch (FileStateInvalidException e) {
  43.761 -                if (log.isLoggable(Level.SEVERE))
  43.762 -                    log.log(Level.SEVERE, e.getMessage(), e);
  43.763 -            }
  43.764 -        }
  43.765 -
  43.766 -        return bootClassPath;
  43.767 -    }
  43.768 -    
  43.769 -    private class TestProxyClassPathProvider implements ClassPathProvider {
  43.770 -
  43.771 -        public ClassPath findClassPath(FileObject file, String type) {
  43.772 -            try {
  43.773 -            if (ClassPath.BOOT == type) {
  43.774 -                // XXX simpler to use JavaPlatformManager.getDefault().getDefaultPlatform().getBootstrapLibraries()
  43.775 -                return ClassPathSupport.createClassPath(getBootClassPath().toArray(new URL[0]));
  43.776 -            }
  43.777 -
  43.778 -            if (ClassPath.SOURCE == type) {
  43.779 -                return sourcePath;
  43.780 -            }
  43.781 -
  43.782 -            if (ClassPath.COMPILE == type) {
  43.783 -                return compileClassPath;
  43.784 -            }
  43.785 -
  43.786 -            if (ClassPath.EXECUTE == type) {
  43.787 -                return ClassPathSupport.createClassPath(new FileObject[] {
  43.788 -                    buildRoot
  43.789 -                });
  43.790 -            }
  43.791 -            } catch (Exception e) {
  43.792 -                e.printStackTrace();
  43.793 -            }
  43.794 -            return null;
  43.795 -        }
  43.796 -
  43.797 -    }
  43.798 -
  43.799 -    private class TestSourceLevelQueryImplementation implements SourceLevelQueryImplementation {
  43.800 -
  43.801 -        public String getSourceLevel(FileObject javaFile) {
  43.802 -            return sourceLevel;
  43.803 -        }
  43.804 -
  43.805 -    }
  43.806 -
  43.807 -
  43.808 -    private static class DeadlockTask implements Task<CompilationController> {
  43.809 -
  43.810 -        private final Phase phase;
  43.811 -        private CompilationInfo info;
  43.812 -
  43.813 -        public DeadlockTask(Phase phase) {
  43.814 -            assert phase != null;
  43.815 -            this.phase = phase;
  43.816 -        }
  43.817 -
  43.818 -        public void run( CompilationController info ) {
  43.819 -            try {
  43.820 -                info.toPhase(this.phase);
  43.821 -                this.info = info;
  43.822 -            } catch (IOException ioe) {
  43.823 -                if (log.isLoggable(Level.SEVERE))
  43.824 -                    log.log(Level.SEVERE, ioe.getMessage(), ioe);
  43.825 -            }
  43.826 -        }
  43.827 -
  43.828 -    }
  43.829 -
  43.830 -    /**Encapsulated the output of the hint.
  43.831 -     */
  43.832 -    public final class HintOutput {
  43.833 -        
  43.834 -        private final List<ErrorDescription> errors;
  43.835 -        private final Set<ErrorDescription> requiresJavaFix;
  43.836 -
  43.837 -        private HintOutput(List<ErrorDescription> errors, Set<ErrorDescription> requiresJavaFix) {
  43.838 -            this.errors = errors;
  43.839 -            this.requiresJavaFix = requiresJavaFix;
  43.840 -
  43.841 -        }
  43.842 -
  43.843 -        /**Assert that the hint(s) produced the given warnings. The provided strings
  43.844 -         * should match {@code toString()} results of {@link ErrorDescription}s produced
  43.845 -         * by the hint(s).
  43.846 -         *
  43.847 -         * @param warnings expected {@code toString()} results of {@link ErrorDescription}s produced
  43.848 -         *                 by the hint
  43.849 -         * @return itself
  43.850 -         * @throws AssertionError if the given warnings do not match the actual warnings
  43.851 -         */
  43.852 -        public HintOutput assertWarnings(String... warnings) {
  43.853 -            assertEquals("The warnings provided by the hint do not match expected warnings.", Arrays.toString(warnings), errors.toString());
  43.854 -
  43.855 -            return this;
  43.856 -        }
  43.857 -
  43.858 -        /**Assert that the hint(s) produced warnings include the given warnings. The provided strings
  43.859 -         * should match {@code toString()} results of {@link ErrorDescription}s produced
  43.860 -         * by the hint(s).
  43.861 -         *
  43.862 -         * @param warnings expected {@code toString()} results of {@link ErrorDescription}s produced
  43.863 -         *                 by the hint
  43.864 -         * @return itself
  43.865 -         * @throws AssertionError if the given warnings do not match the actual warnings
  43.866 -         */
  43.867 -        public HintOutput assertContainsWarnings(String... warnings) {
  43.868 -            Set<String> goldenSet = new HashSet<String>(Arrays.asList(warnings));
  43.869 -            List<String> errorsNames = new LinkedList<String>();
  43.870 -
  43.871 -            for (ErrorDescription d : errors) {
  43.872 -                goldenSet.remove(d.toString());
  43.873 -                errorsNames.add(d.toString());
  43.874 -            }
  43.875 -            
  43.876 -            assertTrue("The warnings provided by the hint do not contain expected warnings. Provided warnings: " + errorsNames.toString(), goldenSet.isEmpty());
  43.877 -
  43.878 -            return this;
  43.879 -        }
  43.880 -
  43.881 -        /**Assert that the hint(s) produced warnings do not include the given warnings. The provided strings
  43.882 -         * should match {@code toString()} results of {@link ErrorDescription}s produced
  43.883 -         * by the hint(s).
  43.884 -         *
  43.885 -         * @param warnings expected {@code toString()} results of {@link ErrorDescription}s produced
  43.886 -         *                 by the hint
  43.887 -         * @return itself
  43.888 -         * @throws AssertionError if the given warnings do not match the actual warnings
  43.889 -         */
  43.890 -        public HintOutput assertNotContainsWarnings(String... warnings) {
  43.891 -            Set<String> goldenSet = new HashSet<String>(Arrays.asList(warnings));
  43.892 -            List<String> errorsNames = new LinkedList<String>();
  43.893 -
  43.894 -            boolean fail = false;
  43.895 -            for (ErrorDescription d : errors) {
  43.896 -                if (goldenSet.remove(d.getDescription()))
  43.897 -                    fail = true;
  43.898 -                errorsNames.add(d.toString());
  43.899 -            }
  43.900 -            
  43.901 -            assertFalse("The warnings provided by the hint do not exclude expected warnings. Provided warnings: " + errorsNames.toString(), fail);
  43.902 -
  43.903 -            return this;
  43.904 -        }
  43.905 -        
  43.906 -        /**Find a specific warning.
  43.907 -         *
  43.908 -         * @param warning the warning to find - must be equivalent to {@code toString()}
  43.909 -         *                results of the {@link ErrorDescription}.
  43.910 -         * @return a wrapper about the given specific warnings
  43.911 -         * @throws AssertionError if the given warning cannot be found
  43.912 -         */
  43.913 -        public HintWarning findWarning(String warning) {
  43.914 -            ErrorDescription toFix = null;
  43.915 -
  43.916 -            for (ErrorDescription d : errors) {
  43.917 -                if (warning.equals(d.toString())) {
  43.918 -                    toFix = d;
  43.919 -                    break;
  43.920 -                }
  43.921 -            }
  43.922 -
  43.923 -            assertNotNull("Warning: \"" + warning + "\" not found. All ErrorDescriptions: " + errors.toString(), toFix);
  43.924 -
  43.925 -            return new HintWarning(toFix, requiresJavaFix.contains(toFix));
  43.926 -        }
  43.927 -    }
  43.928 -
  43.929 -    /**A wrapper over a single warning.
  43.930 -     */
  43.931 -    public final class HintWarning {
  43.932 -        private final ErrorDescription warning;
  43.933 -        private final boolean requiresJavaFix;
  43.934 -        HintWarning(ErrorDescription warning, boolean requiresJavaFix) {
  43.935 -            this.warning = warning;
  43.936 -            this.requiresJavaFix = requiresJavaFix;
  43.937 -        }
  43.938 -        /**Applies the only fix of the current warning. Fails if the given warning
  43.939 -         * does not have exactly one fix.
  43.940 -         *
  43.941 -         * Note this is a destructive operation - the {@link #run(java.lang.Class)} or {@link #applyFix}
  43.942 -         * cannot be run in the future on any object that follows the chain from the same invocation of {@link #create()}.
  43.943 -         *
  43.944 -         * @return a wrapper over resulting source code
  43.945 -         * @throws AssertionError if there is not one fix for the given {@link ErrorDescription}
  43.946 -         */
  43.947 -        public AppliedFix applyFix() throws Exception {
  43.948 -            return applyFix(true);
  43.949 -        }
  43.950 -
  43.951 -        AppliedFix applyFix(boolean saveAll) throws Exception {
  43.952 -            assertTrue("Must be computed", warning.getFixes().isComputed());
  43.953 -
  43.954 -            List<Fix> fixes = warning.getFixes().getFixes();
  43.955 -
  43.956 -            assertEquals(1, fixes.size());
  43.957 -
  43.958 -            doApplyFix(fixes.get(0));
  43.959 -
  43.960 -            if (saveAll)
  43.961 -                LifecycleManager.getDefault().saveAll();
  43.962 -            
  43.963 -            return new AppliedFix();
  43.964 -        }
  43.965 -        /**Applies the specified fix of the current warning.
  43.966 -         *
  43.967 -         * Note this is a destructive operation - the {@link #run(java.lang.Class)} or {@link #applyFix}
  43.968 -         * cannot be run in the future on any object that follows the chain from the same invocation of {@link #create()}.
  43.969 -         *
  43.970 -         * @param fix {@link Fix#getText() } result of the required fix
  43.971 -         * @return a wrapper over resulting source code
  43.972 -         * @throws AssertionError if the fix cannot be found
  43.973 -         */
  43.974 -        public AppliedFix applyFix(String fix) throws Exception {
  43.975 -            assertTrue("Must be computed", warning.getFixes().isComputed());
  43.976 -
  43.977 -            List<Fix> fixes = warning.getFixes().getFixes();
  43.978 -            List<String> fixNames = new LinkedList<String>();
  43.979 -            Fix toApply = null;
  43.980 -
  43.981 -            for (Fix f : fixes) {
  43.982 -                if (fix.equals(f.getText())) {
  43.983 -                    toApply = f;
  43.984 -                }
  43.985 -
  43.986 -                fixNames.add(f.getText());
  43.987 -            }
  43.988 -
  43.989 -            assertNotNull("Cannot find fix to invoke: " + fixNames.toString(), toApply);
  43.990 -
  43.991 -            doApplyFix(toApply);
  43.992 -            
  43.993 -            LifecycleManager.getDefault().saveAll();
  43.994 -
  43.995 -            return new AppliedFix();
  43.996 -        }
  43.997 -        private void doApplyFix(Fix f) throws Exception {
  43.998 -            Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
  43.999 -            preferences.putBoolean("importInnerClasses", true);
 43.1000 -            try {
 43.1001 -                if (requiresJavaFix) {
 43.1002 -                    assertTrue("The fix must be a JavaFix", f instanceof JavaFixImpl);
 43.1003 -                    
 43.1004 -                    ModificationResult result1 = runJavaFix(((JavaFixImpl) f).jf);
 43.1005 -                    ModificationResult result2 = runJavaFix(((JavaFixImpl) f).jf);
 43.1006 -                    
 43.1007 -                    //ensure the results are the same:
 43.1008 -                    assertEquals("The fix must be repeatable", result1.getModifiedFileObjects(), result2.getModifiedFileObjects());
 43.1009 -                    
 43.1010 -                    for (FileObject file : result1.getModifiedFileObjects()) {
 43.1011 -                        assertEquals("The fix must be repeatable", result1.getResultingSource(file), result2.getResultingSource(file));
 43.1012 -                    }
 43.1013 -                    
 43.1014 -                    result1.commit();
 43.1015 -                } else {
 43.1016 -                    f.implement();
 43.1017 -                }
 43.1018 -            } finally {
 43.1019 -                preferences.remove("importInnerClasses");
 43.1020 -            }
 43.1021 -        }
 43.1022 -        private ModificationResult runJavaFix(final JavaFix jf) throws IOException {
 43.1023 -            FileObject file = Accessor.INSTANCE.getFile(jf);
 43.1024 -            JavaSource js = JavaSource.forFileObject(file);
 43.1025 -            final Map<FileObject, List<Difference>> changes = new HashMap<FileObject, List<Difference>>();
 43.1026 -
 43.1027 -            ModificationResult mr = js.runModificationTask(new Task<WorkingCopy>() {
 43.1028 -                public void run(WorkingCopy wc) throws Exception {
 43.1029 -                    if (wc.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) {
 43.1030 -                        return;
 43.1031 -                    }
 43.1032 -
 43.1033 -                    Map<FileObject, byte[]> resourceContentChanges = new HashMap<FileObject, byte[]>();
 43.1034 -                    Accessor.INSTANCE.process(jf, wc, true, resourceContentChanges, /*Ignored for now:*/new ArrayList<RefactoringElementImplementation>());
 43.1035 -                    BatchUtilities.addResourceContentChanges(resourceContentChanges, changes);
 43.1036 -                    
 43.1037 -                }
 43.1038 -            });
 43.1039 -            
 43.1040 -            changes.putAll(JavaSourceAccessor.getINSTANCE().getDiffsFromModificationResult(mr));
 43.1041 -            
 43.1042 -            return JavaSourceAccessor.getINSTANCE().createModificationResult(changes, Collections.<Object, int[]>emptyMap());
 43.1043 -        }
 43.1044 -        /**Verifies that the current warning provides the given fixes.
 43.1045 -         *
 43.1046 -         * @param fixes the {@link Fix#getText() } of the expected fixes
 43.1047 -         * @return itself
 43.1048 -         * @throws AssertionError if the expected fixes do not match the provided fixes
 43.1049 -         * @since 1.1
 43.1050 -         */
 43.1051 -        public HintWarning assertFixes(String... expectedFixes) throws Exception {
 43.1052 -            assertTrue("Must be computed", warning.getFixes().isComputed());
 43.1053 -
 43.1054 -            List<String> fixNames = new LinkedList<String>();
 43.1055 -
 43.1056 -            for (Fix f : warning.getFixes().getFixes()) {
 43.1057 -                if (f instanceof SyntheticFix) continue;
 43.1058 -                fixNames.add(f.getText());
 43.1059 -            }
 43.1060 -
 43.1061 -            assertEquals("Fixes for the current warning do not match the expected fixes. All fixes: " + fixNames.toString(), Arrays.asList(expectedFixes), fixNames);
 43.1062 -
 43.1063 -            return this;
 43.1064 -        }
 43.1065 -    }
 43.1066 -
 43.1067 -    /**A wrapper over result after applying a fix.
 43.1068 -     */
 43.1069 -    public final class AppliedFix {
 43.1070 -        /**Require that the result is compilable. Equivalent to {@code assertCompilable("test/Test.java")}
 43.1071 -         *
 43.1072 -         * @return the wrapper itself
 43.1073 -         * @throws AssertionError if the result is not compilable
 43.1074 -         */
 43.1075 -        public AppliedFix assertCompilable() throws Exception {
 43.1076 -            return assertCompilable("test/Test.java");
 43.1077 -        }
 43.1078 -        /**Require that the given resulting file is compilable.
 43.1079 -         *
 43.1080 -         * @param fileName the name of the file that should be verified
 43.1081 -         * @return the wrapper itself
 43.1082 -         * @throws AssertionError if the result is not compilable
 43.1083 -         */
 43.1084 -        public AppliedFix assertCompilable(String fileName) throws Exception {
 43.1085 -            FileObject toCheck = sourceRoot.getFileObject(fileName);
 43.1086 -
 43.1087 -            assertNotNull(toCheck);
 43.1088 -
 43.1089 -            ensureCompilable(toCheck);
 43.1090 -            return this;
 43.1091 -        }
 43.1092 -        /**Verify the content of the resulting file. Equivalent to {@code assertOutput("test/Test.java")}.
 43.1093 -         *
 43.1094 -         * This method will "normalize" whitespaces in the file: generally, all
 43.1095 -         * whitespaces are reduced to a single space both in the given code and
 43.1096 -         * the code read from the file, before the comparison.
 43.1097 -         *
 43.1098 -         * @param code expected content of the resulting file.
 43.1099 -         * @return the wrapper itself
 43.1100 -         * @throws AssertionError if the file does not have the correct content
 43.1101 -         */
 43.1102 -        public AppliedFix assertOutput(String code) throws Exception {
 43.1103 -            return assertOutput("test/Test.java", code);
 43.1104 -        }
 43.1105 -        /**Verify the content of the given resulting file.
 43.1106 -         *
 43.1107 -         * This method will "normalize" whitespaces in the file: generally, all
 43.1108 -         * whitespaces are reduced to a single space both in the given code and
 43.1109 -         * the code read from the file, before the comparison.
 43.1110 -         *
 43.1111 -         * @param fileName the name of the file that should be verified
 43.1112 -         * @param code expected content of the resulting file.
 43.1113 -         * @return the wrapper itself
 43.1114 -         * @throws AssertionError if the file does not have the correct content
 43.1115 -         */
 43.1116 -        public AppliedFix assertOutput(String fileName, String code) throws Exception {
 43.1117 -            FileObject toCheck = sourceRoot.getFileObject(fileName);
 43.1118 -
 43.1119 -            assertNotNull("Required file: " + fileName + " not found", toCheck);
 43.1120 -
 43.1121 -            DataObject toCheckDO = DataObject.find(toCheck);
 43.1122 -            EditorCookie ec = toCheckDO.getLookup().lookup(EditorCookie.class);
 43.1123 -            Document toCheckDocument = ec.openDocument();
 43.1124 -
 43.1125 -            String realCode = toCheckDocument.getText(0, toCheckDocument.getLength());
 43.1126 -
 43.1127 -            //ignore whitespaces:
 43.1128 -            realCode = reduceWhitespaces(realCode);
 43.1129 -
 43.1130 -            assertEquals("The output code does not match the expected code.", reduceWhitespaces(code), realCode);
 43.1131 -
 43.1132 -            return this;
 43.1133 -        }
 43.1134 -        
 43.1135 -        private String reduceWhitespaces(String str) {
 43.1136 -            StringBuilder result = new StringBuilder();
 43.1137 -            int i = 0;
 43.1138 -            boolean wasWhitespace = false;
 43.1139 -            
 43.1140 -            while (i < str.length()) {
 43.1141 -                int codePoint = str.codePointAt(i);
 43.1142 -                
 43.1143 -                if (Character.isWhitespace(codePoint)) {
 43.1144 -                    if (!wasWhitespace) {
 43.1145 -                        result.append(" ");
 43.1146 -                        wasWhitespace = true;
 43.1147 -                    }
 43.1148 -                } else {
 43.1149 -                    result.appendCodePoint(codePoint);
 43.1150 -                    wasWhitespace = false;
 43.1151 -                }
 43.1152 -                i += Character.charCount(codePoint);
 43.1153 -            }
 43.1154 -            
 43.1155 -            return result.toString();
 43.1156 -        }
 43.1157 -        
 43.1158 -        /**Verify the content of the resulting file. Equivalent to {@code assertVerbatimOutput("test/Test.java")}.
 43.1159 -         *
 43.1160 -         * This method will compare the content of the file exactly with the provided
 43.1161 -         * code.
 43.1162 -         *
 43.1163 -         * @param fileName the name of the file that should be verified
 43.1164 -         * @param code expected content of the resulting file.
 43.1165 -         * @return the wrapper itself
 43.1166 -         * @throws AssertionError if the result is not compilable
 43.1167 -         */
 43.1168 -        public AppliedFix assertVerbatimOutput(String code) throws Exception {
 43.1169 -            return assertVerbatimOutput("test/Test.java", code);
 43.1170 -        }
 43.1171 -        /**Verify the content of the given resulting file.
 43.1172 -         *
 43.1173 -         * This method will compare the content of the file exactly with the provided
 43.1174 -         * code.
 43.1175 -         *
 43.1176 -         * @param fileName the name of the file that should be verified
 43.1177 -         * @param code expected content of the resulting file.
 43.1178 -         * @return the wrapper itself
 43.1179 -         * @throws AssertionError if the result is not compilable
 43.1180 -         */
 43.1181 -        public AppliedFix assertVerbatimOutput(String fileName, String code) throws Exception {
 43.1182 -            FileObject toCheck = sourceRoot.getFileObject(fileName);
 43.1183 -
 43.1184 -            assertNotNull(toCheck);
 43.1185 -
 43.1186 -            DataObject toCheckDO = DataObject.find(toCheck);
 43.1187 -            EditorCookie ec = toCheckDO.getLookup().lookup(EditorCookie.class);
 43.1188 -            Document toCheckDocument = ec.openDocument();
 43.1189 -
 43.1190 -            String realCode = toCheckDocument.getText(0, toCheckDocument.getLength());
 43.1191 -
 43.1192 -            assertEquals("The output code does not match the expected code.", code, realCode);
 43.1193 -
 43.1194 -            return this;
 43.1195 -        }
 43.1196 -
 43.1197 -        /**Return code after the fix has been applied.
 43.1198 -         *
 43.1199 -         * @return the code after the fix has been applied
 43.1200 -         */
 43.1201 -        public String getOutput() throws Exception {
 43.1202 -            return getOutput("test/Test.java");
 43.1203 -        }
 43.1204 -
 43.1205 -        /**Return code after the fix has been applied.
 43.1206 -         *
 43.1207 -         * @param fileName file for which the code should be returned
 43.1208 -         * @return the code after the fix has been applied
 43.1209 -         */
 43.1210 -        public String getOutput(String fileName) throws Exception {
 43.1211 -            FileObject toCheck = sourceRoot.getFileObject(fileName);
 43.1212 -
 43.1213 -            assertNotNull(toCheck);
 43.1214 -
 43.1215 -            DataObject toCheckDO = DataObject.find(toCheck);
 43.1216 -            EditorCookie ec = toCheckDO.getLookup().lookup(EditorCookie.class);
 43.1217 -            Document toCheckDocument = ec.openDocument();
 43.1218 -
 43.1219 -            return toCheckDocument.getText(0, toCheckDocument.getLength());
 43.1220 -        }
 43.1221 -    }
 43.1222 -
 43.1223 -    private static final Comparator<ErrorDescription> ERRORS_COMPARATOR = new Comparator<ErrorDescription> () {
 43.1224 -
 43.1225 -        public int compare (ErrorDescription e1, ErrorDescription e2) {
 43.1226 -            return e1.getRange ().getBegin ().getOffset () - e2.getRange ().getBegin ().getOffset ();
 43.1227 -        }
 43.1228 -    };
 43.1229 -
 43.1230 -    static {
 43.1231 -        System.setProperty("org.openide.util.Lookup", TestLookup.class.getName());
 43.1232 -        Assert.assertEquals(TestLookup.class, Lookup.getDefault().getClass());
 43.1233 -    }
 43.1234 -
 43.1235 -    //workdir computation (copied from NbTestCase):
 43.1236 -    private static File getWorkDir() throws IOException {
 43.1237 -        // now we have path, so if not available, create workdir
 43.1238 -        File workdir = FileUtil.normalizeFile(new File(getWorkDirPath()));
 43.1239 -        if (workdir.exists()) {
 43.1240 -            if (!workdir.isDirectory()) {
 43.1241 -                // work dir exists, but is not directory - this should not happen
 43.1242 -                // trow exception
 43.1243 -                throw new IOException("workdir exists, but is not a directory, workdir = " + workdir);
 43.1244 -            } else {
 43.1245 -                // everything looks correctly, return the path
 43.1246 -                return workdir;
 43.1247 -            }
 43.1248 -        } else {
 43.1249 -            // we need to create it
 43.1250 -            boolean result = workdir.mkdirs();
 43.1251 -            if (result == false) {
 43.1252 -                // mkdirs() failed - throw an exception
 43.1253 -                throw new IOException("workdir creation failed: " + workdir);
 43.1254 -            } else {
 43.1255 -                // everything looks ok - return path
 43.1256 -                return workdir;
 43.1257 -            }
 43.1258 -        }
 43.1259 -    }
 43.1260 -
 43.1261 -    private static String getWorkDirPath() {
 43.1262 -        StackTraceElement caller = null;
 43.1263 -        boolean seenItself = false;
 43.1264 -        
 43.1265 -        for (StackTraceElement e : new Exception().getStackTrace()) {
 43.1266 -            if (HintTest.class.getName().equals(e.getClassName())) seenItself = true;
 43.1267 -            if (seenItself && !HintTest.class.getName().equals(e.getClassName())) {
 43.1268 -                caller = e;
 43.1269 -                break;
 43.1270 -            }
 43.1271 -        }
 43.1272 -        
 43.1273 -        String name = caller != null ? caller.getMethodName() : "unknownTest";
 43.1274 -        // start - PerformanceTestCase overrides getName() method and then
 43.1275 -        // name can contain illegal characters
 43.1276 -        String osName = System.getProperty("os.name");
 43.1277 -        if (osName != null && osName.startsWith("Windows")) {
 43.1278 -            char ntfsIllegal[] ={'"','/','\\','?','<','>','|',':'};
 43.1279 -            for (int i=0; i<ntfsIllegal.length; i++) {
 43.1280 -                name = name.replace(ntfsIllegal[i], '~');
 43.1281 -            }
 43.1282 -        }
 43.1283 -        // end
 43.1284 -        
 43.1285 -        final String workDirPath = getWorkDirPathFromManager();
 43.1286 -        
 43.1287 -        // #94319 - shorten workdir path if the following is too long
 43.1288 -        // "Manager.getWorkDirPath()+File.separator+getClass().getName()+File.separator+name"
 43.1289 -        int len1 = workDirPath.length();
 43.1290 -        String clazz = caller != null ? caller.getClassName() : "unknown.Class";
 43.1291 -        int len2 = clazz.length();
 43.1292 -        int len3 = name.length();
 43.1293 -        
 43.1294 -        int tooLong = Integer.getInteger("nbjunit.too.long", 100);
 43.1295 -        if (len1 + len2 + len3 > tooLong) {
 43.1296 -            clazz = abbrevDots(clazz);
 43.1297 -            len2 = clazz.length();
 43.1298 -        }
 43.1299 -
 43.1300 -        if (len1 + len2 + len3 > tooLong) {
 43.1301 -            name = abbrevCapitals(name);
 43.1302 -        }
 43.1303 -        
 43.1304 -        String p = workDirPath + File.separator + clazz + File.separator + name;
 43.1305 -        String realP;
 43.1306 -        
 43.1307 -        for (int i = 0; ; i++) {
 43.1308 -            realP = i == 0 ? p : p + "-" + i;
 43.1309 -            if (usedPaths.add(realP)) {
 43.1310 -                break;
 43.1311 -            }
 43.1312 -        }
 43.1313 -        
 43.1314 -        return realP;
 43.1315 -    }
 43.1316 -
 43.1317 -    private static Set<String> usedPaths = new HashSet<String>();
 43.1318 -    
 43.1319 -    private static String abbrevDots(String dotted) {
 43.1320 -        StringBuilder sb = new StringBuilder();
 43.1321 -        String sep = "";
 43.1322 -        for (String item : dotted.split("\\.")) {
 43.1323 -            sb.append(sep);
 43.1324 -            sb.append(item.charAt(0));
 43.1325 -            sep = ".";
 43.1326 -        }
 43.1327 -        return sb.toString();
 43.1328 -    }
 43.1329 -
 43.1330 -    private static String abbrevCapitals(String name) {
 43.1331 -        if (name.startsWith("test")) {
 43.1332 -            name = name.substring(4);
 43.1333 -        }
 43.1334 -        StringBuilder sb = new StringBuilder();
 43.1335 -        for (int i = 0; i < name.length(); i++) {
 43.1336 -            if (Character.isUpperCase(name.charAt(i))) {
 43.1337 -                sb.append(Character.toLowerCase(name.charAt(i)));
 43.1338 -            }
 43.1339 -        }
 43.1340 -        return sb.toString();
 43.1341 -    }
 43.1342 -
 43.1343 -    private static final String JUNIT_PROPERTIES_FILENAME = "junit.properties";
 43.1344 -    private static final String JUNIT_PROPERTIES_LOCATION_PROPERTY = "junit.properties.file";
 43.1345 -    private static final String NBJUNIT_WORKDIR = "nbjunit.workdir";
 43.1346 -    
 43.1347 -    private static String getWorkDirPathFromManager() {
 43.1348 -        String path = System.getProperty(NBJUNIT_WORKDIR);
 43.1349 -                
 43.1350 -        if (path == null) {            
 43.1351 -            // try to get property from user's settings
 43.1352 -            path = readProperties().getProperty(NBJUNIT_WORKDIR);
 43.1353 -        }
 43.1354 -        if (path != null) {
 43.1355 -            path = path.replace('/', File.separatorChar);
 43.1356 -        } else {
 43.1357 -            // Fallback value, guaranteed to be defined.
 43.1358 -            path = System.getProperty("java.io.tmpdir") + File.separatorChar + "tests-" + System.getProperty("user.name");
 43.1359 -        }
 43.1360 -        return path;
 43.1361 -    }
 43.1362 -
 43.1363 -    private static Properties readProperties() {
 43.1364 -        Properties result = new Properties();
 43.1365 -        try {
 43.1366 -            File propFile = getPreferencesFile();
 43.1367 -            FileInputStream is = new FileInputStream(propFile);
 43.1368 -            try {
 43.1369 -                result.load(is);
 43.1370 -            } finally {
 43.1371 -                is.close();
 43.1372 -            }
 43.1373 -        }  catch (IOException e) {
 43.1374 -        }
 43.1375 -        
 43.1376 -        return result;
 43.1377 -    }
 43.1378 -
 43.1379 -    private static File getPreferencesFile() {
 43.1380 -        String junitPropertiesLocation = System.getProperty(JUNIT_PROPERTIES_LOCATION_PROPERTY);
 43.1381 -        if (junitPropertiesLocation != null) {
 43.1382 -            File propertyFile = new File(junitPropertiesLocation);
 43.1383 -            if (propertyFile.exists()) {
 43.1384 -                return propertyFile;
 43.1385 -            }
 43.1386 -        }
 43.1387 -        // property file was not found - lets fall back to defaults
 43.1388 -        String home= System.getProperty("user.home");
 43.1389 -        return new File(home, JUNIT_PROPERTIES_FILENAME);
 43.1390 -    }
 43.1391 -
 43.1392 -    // private method for deleting a file/directory (and all its subdirectories/files)
 43.1393 -    private static void deleteFile(File file) throws IOException {
 43.1394 -        if (file.isDirectory() && file.equals(file.getCanonicalFile())) {
 43.1395 -            // file is a directory - delete sub files first
 43.1396 -            File files[] = file.listFiles();
 43.1397 -            for (int i = 0; i < files.length; i++) {
 43.1398 -                deleteFile(files[i]);
 43.1399 -            }
 43.1400 -            
 43.1401 -        }
 43.1402 -        // file is a File :-)
 43.1403 -        boolean result = file.delete();
 43.1404 -        if (result == false ) {
 43.1405 -            // a problem has appeared
 43.1406 -            throw new IOException("Cannot delete file, file = "+file.getPath());
 43.1407 -        }
 43.1408 -    }
 43.1409 -    
 43.1410 -    // private method for deleting every subfiles/subdirectories of a file object
 43.1411 -    private static void deleteSubFiles(File file) throws IOException {
 43.1412 -        File files[] = file.getCanonicalFile().listFiles();
 43.1413 -        if (files != null) {
 43.1414 -            for (File f : files) {
 43.1415 -                deleteFile(f);
 43.1416 -            }
 43.1417 -        } else {
 43.1418 -            // probably do nothing - file is not a directory
 43.1419 -        }
 43.1420 -    }
 43.1421 -
 43.1422 -    private static FileObject copyStringToFile (FileObject f, String content) throws Exception {
 43.1423 -        OutputStream os = f.getOutputStream();
 43.1424 -        os.write(content.getBytes("UTF-8"));
 43.1425 -        os.close ();
 43.1426 -
 43.1427 -        return f;
 43.1428 -    }
 43.1429 -
 43.1430 -}
    44.1 --- a/sandbox/java.hints/java.hints.test/src/org/netbeans/modules/parsing/impl/indexing/MimeTypes.java	Sun Jan 08 20:10:08 2017 +0100
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,66 +0,0 @@
    44.4 -/*
    44.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    44.6 - *
    44.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    44.8 - *
    44.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   44.10 - * Other names may be trademarks of their respective owners.
   44.11 - *
   44.12 - * The contents of this file are subject to the terms of either the GNU
   44.13 - * General Public License Version 2 only ("GPL") or the Common
   44.14 - * Development and Distribution License("CDDL") (collectively, the
   44.15 - * "License"). You may not use this file except in compliance with the
   44.16 - * License. You can obtain a copy of the License at
   44.17 - * http://www.netbeans.org/cddl-gplv2.html
   44.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   44.19 - * specific language governing permissions and limitations under the
   44.20 - * License.  When distributing the software, include this License Header
   44.21 - * Notice in each file and include the License file at
   44.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   44.23 - * particular file as subject to the "Classpath" exception as provided
   44.24 - * by Oracle in the GPL Version 2 section of the License file that
   44.25 - * accompanied this code. If applicable, add the following below the
   44.26 - * License Header, with the fields enclosed by brackets [] replaced by
   44.27 - * your own identifying information:
   44.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   44.29 - *
   44.30 - * If you wish your version of this file to be governed by only the CDDL
   44.31 - * or only the GPL Version 2, indicate your decision by adding
   44.32 - * "[Contributor] elects to include this software in this distribution
   44.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   44.34 - * single choice of license, a recipient has the option to distribute
   44.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   44.36 - * to extend the choice of license to its licensees as provided above.
   44.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   44.38 - * Version 2 license, then the option applies only if the new code is
   44.39 - * made subject to such option by the copyright holder.
   44.40 - *
   44.41 - * Contributor(s):
   44.42 - *
   44.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
   44.44 - */
   44.45 -package org.netbeans.modules.parsing.impl.indexing;
   44.46 -
   44.47 -import java.util.Set;
   44.48 -import org.netbeans.api.annotations.common.CheckForNull;
   44.49 -import org.netbeans.api.annotations.common.NonNull;
   44.50 -import org.openide.util.Parameters;
   44.51 -
   44.52 -/**Not an API!
   44.53 - *
   44.54 - * @author Tomas Zezula
   44.55 - */
   44.56 -public class MimeTypes {
   44.57 -
   44.58 -    private MimeTypes() {}
   44.59 -
   44.60 -    public static void setAllMimeTypes(@NonNull final Set<String> allMimeTypes) {
   44.61 -        Parameters.notNull("allMimeTypes", allMimeTypes);   //NOI18N
   44.62 -        Util.allMimeTypes = allMimeTypes;
   44.63 -    }
   44.64 -
   44.65 -    @CheckForNull
   44.66 -    public static Set<String> getAllMimeTypes() {
   44.67 -        return Util.allMimeTypes;
   44.68 -    }
   44.69 -}
    45.1 --- a/sandbox/java.hints/java.hints.test/test/unit/src/org/netbeans/modules/java/hints/test/api/HintTestTest.java	Sun Jan 08 20:10:08 2017 +0100
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,336 +0,0 @@
    45.4 -/*
    45.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    45.6 - *
    45.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
    45.8 - *
    45.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   45.10 - * Other names may be trademarks of their respective owners.
   45.11 - *
   45.12 - * The contents of this file are subject to the terms of either the GNU
   45.13 - * General Public License Version 2 only ("GPL") or the Common
   45.14 - * Development and Distribution License("CDDL") (collectively, the
   45.15 - * "License"). You may not use this file except in compliance with the
   45.16 - * License. You can obtain a copy of the License at
   45.17 - * http://www.netbeans.org/cddl-gplv2.html
   45.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   45.19 - * specific language governing permissions and limitations under the
   45.20 - * License.  When distributing the software, include this License Header
   45.21 - * Notice in each file and include the License file at
   45.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   45.23 - * particular file as subject to the "Classpath" exception as provided
   45.24 - * by Oracle in the GPL Version 2 section of the License file that
   45.25 - * accompanied this code. If applicable, add the following below the
   45.26 - * License Header, with the fields enclosed by brackets [] replaced by
   45.27 - * your own identifying information:
   45.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   45.29 - *
   45.30 - * If you wish your version of this file to be governed by only the CDDL
   45.31 - * or only the GPL Version 2, indicate your decision by adding
   45.32 - * "[Contributor] elects to include this software in this distribution
   45.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   45.34 - * single choice of license, a recipient has the option to distribute
   45.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   45.36 - * to extend the choice of license to its licensees as provided above.
   45.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   45.38 - * Version 2 license, then the option applies only if the new code is
   45.39 - * made subject to such option by the copyright holder.
   45.40 - *
   45.41 - * Contributor(s):
   45.42 - *
   45.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
   45.44 - */
   45.45 -package org.netbeans.modules.java.hints.test.api;
   45.46 -
   45.47 -import com.sun.source.tree.Tree.Kind;
   45.48 -import com.sun.source.util.TreePath;
   45.49 -import java.io.ByteArrayOutputStream;
   45.50 -import java.io.InputStreamReader;
   45.51 -import java.io.OutputStream;
   45.52 -import java.io.OutputStreamWriter;
   45.53 -import java.io.Reader;
   45.54 -import java.io.Writer;
   45.55 -import javax.swing.text.Document;
   45.56 -import org.junit.Assert;
   45.57 -import org.junit.Test;
   45.58 -import org.netbeans.api.java.source.ClasspathInfo.PathKind;
   45.59 -import org.netbeans.api.java.source.CompilationInfo;
   45.60 -import org.netbeans.api.java.source.JavaSource;
   45.61 -import org.netbeans.spi.editor.hints.ChangeInfo;
   45.62 -import org.netbeans.spi.editor.hints.ErrorDescription;
   45.63 -import org.netbeans.spi.editor.hints.Fix;
   45.64 -import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
   45.65 -import org.netbeans.spi.java.hints.Hint;
   45.66 -import org.netbeans.spi.java.hints.HintContext;
   45.67 -import org.netbeans.spi.java.hints.JavaFix;
   45.68 -import org.netbeans.spi.java.hints.JavaFix.TransformationContext;
   45.69 -import org.netbeans.spi.java.hints.TriggerTreeKind;
   45.70 -import org.openide.LifecycleManager;
   45.71 -import org.openide.cookies.EditorCookie;
   45.72 -import org.openide.filesystems.FileObject;
   45.73 -import org.openide.filesystems.FileUtil;
   45.74 -import org.openide.loaders.DataObject;
   45.75 -
   45.76 -/**
   45.77 - *
   45.78 - * @author lahvac
   45.79 - */
   45.80 -public class HintTestTest {
   45.81 -
   45.82 -    public HintTestTest() {
   45.83 -    }
   45.84 -
   45.85 -    @Test
   45.86 -    public void testNonJavaChanges() throws Exception {
   45.87 -        HintTest.create()
   45.88 -                .input("package test;\n" +
   45.89 -                       "public class Test { }\n")
   45.90 -                .input("test/test.txt", "1\n2\n", false)
   45.91 -                .run(NonJavaChanges.class)
   45.92 -                .findWarning("1:13-1:17:verifier:Test")
   45.93 -                .applyFix()
   45.94 -                .assertVerbatimOutput("test/test.txt", "2\n3\n");
   45.95 -    }
   45.96 -
   45.97 -    @Test
   45.98 -    public void test220070() throws Exception {
   45.99 -        HintTest.create()
  45.100 -                .input("package test;\n" +
  45.101 -                       "public class Test { }\n")
  45.102 -                .input("test/test.txt", "1\n2\n", false)
  45.103 -                .run(NonJavaChanges.class)
  45.104 -                .findWarning("1:13-1:17:verifier:Test")
  45.105 -                .applyFix()
  45.106 -                .assertOutput("test/test.txt", "2\r3\r");
  45.107 -    }
  45.108 -    
  45.109 -    @Test
  45.110 -    public void testNonJavaChangesOpenedInEditor() throws Exception {
  45.111 -        try {
  45.112 -            HintTest ht = HintTest.create()
  45.113 -                                  .input("package test;\n" +
  45.114 -                                         "public class Test { }\n")
  45.115 -                                  .input("test/test.txt", "1\n2\n", false);
  45.116 -            FileObject resource = ht.getSourceRoot().getFileObject("test/test.txt");
  45.117 -            DataObject od = DataObject.find(resource);
  45.118 -            EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
  45.119 -            Document doc = ec.openDocument();
  45.120 -            doc.remove(0, doc.getLength());
  45.121 -            doc.insertString(0, "5\n6\n", null);
  45.122 -            ht.run(NonJavaChanges.class)
  45.123 -              .findWarning("1:13-1:17:verifier:Test")
  45.124 -              .applyFix(false)
  45.125 -              .assertVerbatimOutput("test/test.txt", "6\n7\n");
  45.126 -            Assert.assertEquals("1\n2\n", resource.asText("UTF-8"));
  45.127 -            Assert.assertEquals("6\n7\n", doc.getText(0, doc.getLength()));
  45.128 -        } finally {
  45.129 -            LifecycleManager.getDefault().saveAll();
  45.130 -        }
  45.131 -    }
  45.132 -
  45.133 -    @Hint(displayName="testingNonJavaChanges", description="testingNonJavaChanges", category="test")
  45.134 -    public static final class NonJavaChanges {
  45.135 -        @TriggerTreeKind(Kind.CLASS)
  45.136 -        public static ErrorDescription hint(HintContext ctx) {
  45.137 -            return ErrorDescriptionFactory.forName(ctx, ctx.getPath(), "Test", new TestingNonJavaChangesFix(ctx.getInfo(), ctx.getPath()).toEditorFix());
  45.138 -        }
  45.139 -    }
  45.140 -
  45.141 -    private static final class TestingNonJavaChangesFix extends JavaFix {
  45.142 -
  45.143 -        public TestingNonJavaChangesFix(CompilationInfo info, TreePath tp) {
  45.144 -            super(info, tp);
  45.145 -        }
  45.146 -
  45.147 -        @Override protected String getText() {
  45.148 -            return "Test";
  45.149 -        }
  45.150 -
  45.151 -        @Override protected void performRewrite(TransformationContext ctx) {
  45.152 -            try {
  45.153 -                FileObject resource = ctx.getWorkingCopy().getFileObject().getParent().getFileObject("test.txt");
  45.154 -                Assert.assertNotNull(resource);
  45.155 -                Reader r = new InputStreamReader(ctx.getResourceContent(resource), "UTF-8");
  45.156 -                ByteArrayOutputStream outData = new ByteArrayOutputStream();
  45.157 -                Writer w = new OutputStreamWriter(outData, "UTF-8");
  45.158 -                int read;
  45.159 -
  45.160 -                while ((read = r.read()) != -1) {
  45.161 -                    if (read != '\n') read++;
  45.162 -                    w.write(read);
  45.163 -                }
  45.164 -
  45.165 -                r.close();
  45.166 -                w.close();
  45.167 -
  45.168 -                OutputStream out = ctx.getResourceOutput(resource);
  45.169 -
  45.170 -                out.write(outData.toByteArray());
  45.171 -
  45.172 -                out.close();
  45.173 -            } catch (Exception ex) {
  45.174 -                throw new IllegalStateException(ex);
  45.175 -            }
  45.176 -        }
  45.177 -
  45.178 -    }
  45.179 -
  45.180 -    @Test
  45.181 -    public void testMeaningfullSourcePath() throws Exception {
  45.182 -        HintTest.create()
  45.183 -                .input("package test;\n" +
  45.184 -                       "public class Test { }\n")
  45.185 -                .run(MeaningfullSourcePath.class)
  45.186 -                .assertWarnings();
  45.187 -    }
  45.188 -
  45.189 -    @Hint(displayName="meaningfullSourcePath", description="meaningfullSourcePath", category="test")
  45.190 -    public static final class MeaningfullSourcePath {
  45.191 -        @TriggerTreeKind(Kind.CLASS)
  45.192 -        public static ErrorDescription hint(HintContext ctx) {
  45.193 -            if (ctx.getInfo().getClasspathInfo().getClassPath(PathKind.SOURCE).findOwnerRoot(ctx.getInfo().getFileObject()) == null) {
  45.194 -                return ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), "Broken Source Path");
  45.195 -            }
  45.196 -
  45.197 -            return null;
  45.198 -        }
  45.199 -    }
  45.200 -
  45.201 -    @Test
  45.202 -    public void testCompilationClassPath() throws Exception {
  45.203 -        HintTest.create()
  45.204 -                .input("package test;\n" +
  45.205 -                       "public class Test { }\n")
  45.206 -                .classpath(FileUtil.getArchiveRoot(JavaSource.class.getProtectionDomain().getCodeSource().getLocation()))
  45.207 -                .run(CompilationClassPath.class)
  45.208 -                .assertWarnings();
  45.209 -    }
  45.210 -
  45.211 -    @Hint(displayName="compilationClassPath", description="compilationClassPath", category="test")
  45.212 -    public static final class CompilationClassPath {
  45.213 -        @TriggerTreeKind(Kind.CLASS)
  45.214 -        public static ErrorDescription hint(HintContext ctx) {
  45.215 -            FileObject clazz = ctx.getInfo().getClasspathInfo().getClassPath(PathKind.COMPILE).findResource("org/netbeans/api/java/source/JavaSource.class");
  45.216 -
  45.217 -            if (clazz == null) {
  45.218 -                return ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), "Broken Compilation ClassPath");
  45.219 -            }
  45.220 -
  45.221 -            return null;
  45.222 -        }
  45.223 -    }
  45.224 -
  45.225 -    @Test
  45.226 -    public void testHintThrowsException() throws Exception {
  45.227 -        HintTest ht = HintTest.create()
  45.228 -                              .input("package test;\n" +
  45.229 -                                     "public class Test { }\n");
  45.230 -        try {
  45.231 -            ht.run(HintThrowsException.class);
  45.232 -            Assert.fail("No exception thrown");
  45.233 -        } catch (Exception ex) {
  45.234 -            //ok
  45.235 -            Assert.assertEquals(IllegalStateException.class, ex.getClass());
  45.236 -            Assert.assertNotNull(ex.getCause());
  45.237 -            Assert.assertEquals(NullPointerException.class, ex.getCause().getClass());
  45.238 -            Assert.assertEquals("a", ex.getCause().getMessage());
  45.239 -        }
  45.240 -    }
  45.241 -    
  45.242 -    @Hint(displayName="hintThrowsException", description="hintThrowsException", category="test")
  45.243 -    public static final class HintThrowsException {
  45.244 -        @TriggerTreeKind(Kind.CLASS)
  45.245 -        public static ErrorDescription hint(HintContext ctx) {
  45.246 -            throw new NullPointerException("a");
  45.247 -        }
  45.248 -    }
  45.249 -
  45.250 -    @Test
  45.251 -    public void testNonJavaFix() throws Exception {
  45.252 -        HintTest ht = HintTest.create()
  45.253 -                              .input("package test;\n" +
  45.254 -                                     "public class Test { }\n");
  45.255 -        try {
  45.256 -            ht.run(NonJavaFix.class)
  45.257 -              .findWarning("1:0-1:21:verifier:Test")
  45.258 -              .applyFix();
  45.259 -            Assert.fail("No exception thrown");
  45.260 -        } catch (AssertionError ae) {
  45.261 -            //ok
  45.262 -            Assert.assertEquals("The fix must be a JavaFix", ae.getMessage());
  45.263 -        }
  45.264 -    }
  45.265 -    
  45.266 -    @Hint(displayName="nonJavaFix", description="nonJavaFix", category="test")
  45.267 -    public static final class NonJavaFix {
  45.268 -        @TriggerTreeKind(Kind.CLASS)
  45.269 -        public static ErrorDescription hint(HintContext ctx) {
  45.270 -            return ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), "Test", new Fix() {
  45.271 -                @Override public String getText() {
  45.272 -                    return "Fix";
  45.273 -                }
  45.274 -                @Override public ChangeInfo implement() throws Exception {
  45.275 -                    return null;
  45.276 -                }
  45.277 -            });
  45.278 -        }
  45.279 -    }
  45.280 -    
  45.281 -    @Test
  45.282 -    public void testNotRepeatableJavaFix() throws Exception {
  45.283 -        HintTest ht = HintTest.create()
  45.284 -                              .input("package test;\n" +
  45.285 -                                     "public class Test { }\n");
  45.286 -        try {
  45.287 -            ht.run(NotRepeatableJavaFix.class)
  45.288 -              .findWarning("1:0-1:21:verifier:Test")
  45.289 -              .applyFix();
  45.290 -            Assert.fail("No exception thrown");
  45.291 -        } catch (AssertionError ae) {
  45.292 -            //ok
  45.293 -            Assert.assertTrue(ae.getMessage().startsWith("The fix must be repeatable"));
  45.294 -        }
  45.295 -    }
  45.296 -    
  45.297 -    @Hint(displayName="notRepeatableJavaFix", description="notRepeatableJavaFix", category="test")
  45.298 -    public static final class NotRepeatableJavaFix {
  45.299 -        @TriggerTreeKind(Kind.CLASS)
  45.300 -        public static ErrorDescription hint(HintContext ctx) {
  45.301 -            Fix f = new JavaFix(ctx.getInfo(), ctx.getPath()) {
  45.302 -                private boolean wasRun;
  45.303 -                @Override protected String getText() {
  45.304 -                    return "Fix";
  45.305 -                }
  45.306 -                @Override protected void performRewrite(TransformationContext ctx) throws Exception {
  45.307 -                    if (wasRun) return ;
  45.308 -                    ctx.getWorkingCopy().rewrite(ctx.getPath().getLeaf(), ctx.getWorkingCopy().getTreeMaker().setLabel(ctx.getPath().getLeaf(), "Nue"));
  45.309 -                    wasRun = true;
  45.310 -                }
  45.311 -            }.toEditorFix();
  45.312 -            return ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), "Test", f);
  45.313 -        }
  45.314 -    }
  45.315 -
  45.316 -    public void testSourcePathReady() throws Exception {
  45.317 -        HintTest.create()
  45.318 -                .input("test/Test1.java",
  45.319 -                       "package test;\n" +
  45.320 -                       "public class Test1 {\n" +
  45.321 -                       "    private final Test2 test2 = null;\n" +
  45.322 -                       "}\n")
  45.323 -                .input("test/Test2.java",
  45.324 -                       "package test;\n" +
  45.325 -                       "public class Test2 {\n" +
  45.326 -                       "    private final Test1 test1 = null;\n" +
  45.327 -                       "}\n")
  45.328 -                .runGlobal(NoOp.class)
  45.329 -                .assertWarnings();
  45.330 -    }
  45.331 -
  45.332 -    @Hint(displayName="noOp", description="noOp", category="test")
  45.333 -    public static final class NoOp {
  45.334 -        @TriggerTreeKind(Kind.CLASS)
  45.335 -        public static ErrorDescription hint(HintContext ctx) {
  45.336 -            return null;
  45.337 -        }
  45.338 -    }
  45.339 -}
    46.1 --- a/sandbox/java.hints/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,93 +0,0 @@
    46.4 -<?xml version="1.0" encoding="UTF-8"?>
    46.5 -<!--
    46.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    46.7 -
    46.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    46.9 -
   46.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   46.11 -Other names may be trademarks of their respective owners.
   46.12 -
   46.13 -The contents of this file are subject to the terms of either the GNU
   46.14 -General Public License Version 2 only ("GPL") or the Common
   46.15 -Development and Distribution License("CDDL") (collectively, the
   46.16 -"License"). You may not use this file except in compliance with the
   46.17 -License. You can obtain a copy of the License at
   46.18 -http://www.netbeans.org/cddl-gplv2.html
   46.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   46.20 -specific language governing permissions and limitations under the
   46.21 -License.  When distributing the software, include this License Header
   46.22 -Notice in each file and include the License file at
   46.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   46.24 -particular file as subject to the "Classpath" exception as provided
   46.25 -by Oracle in the GPL Version 2 section of the License file that
   46.26 -accompanied this code. If applicable, add the following below the
   46.27 -License Header, with the fields enclosed by brackets [] replaced by
   46.28 -your own identifying information:
   46.29 -"Portions Copyrighted [year] [name of copyright owner]"
   46.30 -
   46.31 -Contributor(s):
   46.32 -
   46.33 -The Original Software is NetBeans. The Initial Developer of the Original
   46.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   46.35 -Microsystems, Inc. All Rights Reserved.
   46.36 -
   46.37 -If you wish your version of this file to be governed by only the CDDL
   46.38 -or only the GPL Version 2, indicate your decision by adding
   46.39 -"[Contributor] elects to include this software in this distribution
   46.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   46.41 -single choice of license, a recipient has the option to distribute
   46.42 -your version of this file under either the CDDL, the GPL Version 2 or
   46.43 -to extend the choice of license to its licensees as provided above.
   46.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   46.45 -Version 2 license, then the option applies only if the new code is
   46.46 -made subject to such option by the copyright holder.
   46.47 --->
   46.48 -<!--
   46.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
   46.50 -***         EDIT ../build.xml INSTEAD         ***
   46.51 --->
   46.52 -<project name="java.hints-impl" basedir=".." xmlns:sproject="http://www.netbeans.org/ns/nb-module-suite-project/1">
   46.53 -    <fail message="Please build using Ant 1.7.1 or higher.">
   46.54 -        <condition>
   46.55 -            <not>
   46.56 -                <antversion atleast="1.7.1"/>
   46.57 -            </not>
   46.58 -        </condition>
   46.59 -    </fail>
   46.60 -    <property file="nbproject/private/platform-private.properties"/>
   46.61 -    <property file="nbproject/platform.properties"/>
   46.62 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-suite-project/1">
   46.63 -        <attribute name="name"/>
   46.64 -        <attribute name="value"/>
   46.65 -        <sequential>
   46.66 -            <property name="@{name}" value="${@{value}}"/>
   46.67 -        </sequential>
   46.68 -    </macrodef>
   46.69 -    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-suite-project/1">
   46.70 -        <attribute name="property"/>
   46.71 -        <attribute name="value"/>
   46.72 -        <sequential>
   46.73 -            <property name="@{property}" value="@{value}"/>
   46.74 -        </sequential>
   46.75 -    </macrodef>
   46.76 -    <property file="${user.properties.file}"/>
   46.77 -    <sproject:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir"/>
   46.78 -    <sproject:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir"/>
   46.79 -    <sproject:evalprops property="cluster.path.evaluated" value="${cluster.path}"/>
   46.80 -    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
   46.81 -        <condition>
   46.82 -            <not>
   46.83 -                <contains string="${cluster.path.evaluated}" substring="platform"/>
   46.84 -            </not>
   46.85 -        </condition>
   46.86 -    </fail>
   46.87 -    <ant antfile="nbproject/platform.xml"/>
   46.88 -    <fail message="Cannot find NetBeans build harness. ${line.separator}Check that nbplatform.${nbplatform.active}.netbeans.dest.dir and nbplatform.${nbplatform.active}.harness.dir are defined. ${line.separator}On a developer machine these are normally defined in ${user.properties.file}=${netbeans.user}/build.properties ${line.separator}but for automated builds you should pass these properties to Ant explicitly. ${line.separator}You may instead download the harness and platform: -Dbootstrap.url=.../tasks.jar -Dautoupdate.catalog.url=.../updates.xml">
   46.89 -        <condition>
   46.90 -            <not>
   46.91 -                <available file="${harness.dir}/suite.xml"/>
   46.92 -            </not>
   46.93 -        </condition>
   46.94 -    </fail>
   46.95 -    <import file="${harness.dir}/suite.xml"/>
   46.96 -</project>
    47.1 --- a/sandbox/java.hints/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,52 +0,0 @@
    47.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    47.5 -#
    47.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    47.7 -#
    47.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    47.9 -# Other names may be trademarks of their respective owners.
   47.10 -#
   47.11 -# The contents of this file are subject to the terms of either the GNU
   47.12 -# General Public License Version 2 only ("GPL") or the Common
   47.13 -# Development and Distribution License("CDDL") (collectively, the
   47.14 -# "License"). You may not use this file except in compliance with the
   47.15 -# License. You can obtain a copy of the License at
   47.16 -# http://www.netbeans.org/cddl-gplv2.html
   47.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   47.18 -# specific language governing permissions and limitations under the
   47.19 -# License.  When distributing the software, include this License Header
   47.20 -# Notice in each file and include the License file at
   47.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   47.22 -# particular file as subject to the "Classpath" exception as provided
   47.23 -# by Oracle in the GPL Version 2 section of the License file that
   47.24 -# accompanied this code. If applicable, add the following below the
   47.25 -# License Header, with the fields enclosed by brackets [] replaced by
   47.26 -# your own identifying information:
   47.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   47.28 -#
   47.29 -# Contributor(s):
   47.30 -#
   47.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   47.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   47.33 -# Microsystems, Inc. All Rights Reserved.
   47.34 -#
   47.35 -# If you wish your version of this file to be governed by only the CDDL
   47.36 -# or only the GPL Version 2, indicate your decision by adding
   47.37 -# "[Contributor] elects to include this software in this distribution
   47.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   47.39 -# single choice of license, a recipient has the option to distribute
   47.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   47.41 -# to extend the choice of license to its licensees as provided above.
   47.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   47.43 -# Version 2 license, then the option applies only if the new code is
   47.44 -# made subject to such option by the copyright holder.
   47.45 -build.xml.data.CRC32=85cca5f7
   47.46 -build.xml.script.CRC32=25a1521a
   47.47 -build.xml.stylesheet.CRC32=eaf9f76a@2.58
   47.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   47.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   47.50 -nbproject/build-impl.xml.data.CRC32=85cca5f7
   47.51 -nbproject/build-impl.xml.script.CRC32=82e0fe0b
   47.52 -nbproject/build-impl.xml.stylesheet.CRC32=0f381476@2.58
   47.53 -nbproject/platform.xml.data.CRC32=85cca5f7
   47.54 -nbproject/platform.xml.script.CRC32=6dcbd131
   47.55 -nbproject/platform.xml.stylesheet.CRC32=4e1f53d4@2.70
    48.1 --- a/sandbox/java.hints/nbproject/platform.properties	Sun Jan 08 20:10:08 2017 +0100
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,60 +0,0 @@
    48.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    48.5 -#
    48.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    48.7 -#
    48.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    48.9 -# Other names may be trademarks of their respective owners.
   48.10 -#
   48.11 -# The contents of this file are subject to the terms of either the GNU
   48.12 -# General Public License Version 2 only ("GPL") or the Common
   48.13 -# Development and Distribution License("CDDL") (collectively, the
   48.14 -# "License"). You may not use this file except in compliance with the
   48.15 -# License. You can obtain a copy of the License at
   48.16 -# http://www.netbeans.org/cddl-gplv2.html
   48.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   48.18 -# specific language governing permissions and limitations under the
   48.19 -# License.  When distributing the software, include this License Header
   48.20 -# Notice in each file and include the License file at
   48.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   48.22 -# particular file as subject to the "Classpath" exception as provided
   48.23 -# by Oracle in the GPL Version 2 section of the License file that
   48.24 -# accompanied this code. If applicable, add the following below the
   48.25 -# License Header, with the fields enclosed by brackets [] replaced by
   48.26 -# your own identifying information:
   48.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   48.28 -#
   48.29 -# Contributor(s):
   48.30 -#
   48.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   48.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   48.33 -# Microsystems, Inc. All Rights Reserved.
   48.34 -#
   48.35 -# If you wish your version of this file to be governed by only the CDDL
   48.36 -# or only the GPL Version 2, indicate your decision by adding
   48.37 -# "[Contributor] elects to include this software in this distribution
   48.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   48.39 -# single choice of license, a recipient has the option to distribute
   48.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   48.41 -# to extend the choice of license to its licensees as provided above.
   48.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   48.43 -# Version 2 license, then the option applies only if the new code is
   48.44 -# made subject to such option by the copyright holder.
   48.45 -cluster.path=\
   48.46 -    ${nbplatform.active.dir}/apisupport:\
   48.47 -    ${nbplatform.active.dir}/cnd:\
   48.48 -    ${nbplatform.active.dir}/dlight:\
   48.49 -    ${nbplatform.active.dir}/enterprise:\
   48.50 -    ${nbplatform.active.dir}/extide:\
   48.51 -    ${nbplatform.active.dir}/extra:\
   48.52 -    ${nbplatform.active.dir}/harness:\
   48.53 -    ${nbplatform.active.dir}/ide:\
   48.54 -    ${nbplatform.active.dir}/java:\
   48.55 -    ${nbplatform.active.dir}/nb:\
   48.56 -    ${nbplatform.active.dir}/platform:\
   48.57 -    ${nbplatform.active.dir}/profiler:\
   48.58 -    ${nbplatform.active.dir}/webcommon:\
   48.59 -    ${nbplatform.active.dir}/websvccommon:\
   48.60 -    ../remoting/common/build/cluster
   48.61 -extcluster.../remoting/common/build/cluster.javadoc=
   48.62 -extcluster.../remoting/common/build/cluster.sources=
   48.63 -nbplatform.active=default
    49.1 --- a/sandbox/java.hints/nbproject/platform.xml	Sun Jan 08 20:10:08 2017 +0100
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,77 +0,0 @@
    49.4 -<?xml version="1.0" encoding="UTF-8"?>
    49.5 -<!--
    49.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    49.7 -
    49.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    49.9 -
   49.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   49.11 -Other names may be trademarks of their respective owners.
   49.12 -
   49.13 -The contents of this file are subject to the terms of either the GNU
   49.14 -General Public License Version 2 only ("GPL") or the Common
   49.15 -Development and Distribution License("CDDL") (collectively, the
   49.16 -"License"). You may not use this file except in compliance with the
   49.17 -License. You can obtain a copy of the License at
   49.18 -http://www.netbeans.org/cddl-gplv2.html
   49.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   49.20 -specific language governing permissions and limitations under the
   49.21 -License.  When distributing the software, include this License Header
   49.22 -Notice in each file and include the License file at
   49.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   49.24 -particular file as subject to the "Classpath" exception as provided
   49.25 -by Oracle in the GPL Version 2 section of the License file that
   49.26 -accompanied this code. If applicable, add the following below the
   49.27 -License Header, with the fields enclosed by brackets [] replaced by
   49.28 -your own identifying information:
   49.29 -"Portions Copyrighted [year] [name of copyright owner]"
   49.30 -
   49.31 -Contributor(s):
   49.32 -
   49.33 -The Original Software is NetBeans. The Initial Developer of the Original
   49.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   49.35 -Microsystems, Inc. All Rights Reserved.
   49.36 -
   49.37 -If you wish your version of this file to be governed by only the CDDL
   49.38 -or only the GPL Version 2, indicate your decision by adding
   49.39 -"[Contributor] elects to include this software in this distribution
   49.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   49.41 -single choice of license, a recipient has the option to distribute
   49.42 -your version of this file under either the CDDL, the GPL Version 2 or
   49.43 -to extend the choice of license to its licensees as provided above.
   49.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   49.45 -Version 2 license, then the option applies only if the new code is
   49.46 -made subject to such option by the copyright holder.
   49.47 --->
   49.48 -<project name="platform" default="download" basedir="..">
   49.49 -    <condition property="download.required">
   49.50 -        <and>
   49.51 -            <not>
   49.52 -                <available file="${harness.dir}/suite.xml"/>
   49.53 -            </not>
   49.54 -            <isset property="bootstrap.url"/>
   49.55 -            <isset property="autoupdate.catalog.url"/>
   49.56 -        </and>
   49.57 -    </condition>
   49.58 -    <target name="download" if="download.required">
   49.59 -        <mkdir dir="${harness.dir}"/>
   49.60 -        <pathconvert pathsep="|" property="download.clusters">
   49.61 -            <mapper type="flatten"/>
   49.62 -            <path path="${cluster.path}"/>
   49.63 -        </pathconvert>
   49.64 -        <property name="disabled.modules" value=""/>
   49.65 -        <pathconvert property="module.includes" pathsep="">
   49.66 -            <mapper type="glob" from="${basedir}${file.separator}*" to="(?!^\Q*\E$)"/>
   49.67 -            <path>
   49.68 -                <filelist files="${disabled.modules}" dir="."/>
   49.69 -            </path>
   49.70 -        </pathconvert>
   49.71 -        <echo message="Downloading clusters ${download.clusters}"/>
   49.72 -        <property name="tasks.jar" location="${java.io.tmpdir}/tasks.jar"/>
   49.73 -        <get src="${bootstrap.url}" dest="${tasks.jar}" usetimestamp="true" verbose="true"/>
   49.74 -        <taskdef name="autoupdate" classname="org.netbeans.nbbuild.AutoUpdate" classpath="${tasks.jar}"/>
   49.75 -        <autoupdate installdir="${nbplatform.active.dir}" updatecenter="${autoupdate.catalog.url}">
   49.76 -            <modules includes="${module.includes}.*" clusters="${download.clusters}"/>
   49.77 -            <modules includes="org[.]netbeans[.]modules[.]apisupport[.]harness" clusters="harness"/>
   49.78 -        </autoupdate>
   49.79 -    </target>
   49.80 -</project>
    50.1 --- a/sandbox/java.hints/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,48 +0,0 @@
    50.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    50.5 -#
    50.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    50.7 -#
    50.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    50.9 -# Other names may be trademarks of their respective owners.
   50.10 -#
   50.11 -# The contents of this file are subject to the terms of either the GNU
   50.12 -# General Public License Version 2 only ("GPL") or the Common
   50.13 -# Development and Distribution License("CDDL") (collectively, the
   50.14 -# "License"). You may not use this file except in compliance with the
   50.15 -# License. You can obtain a copy of the License at
   50.16 -# http://www.netbeans.org/cddl-gplv2.html
   50.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   50.18 -# specific language governing permissions and limitations under the
   50.19 -# License.  When distributing the software, include this License Header
   50.20 -# Notice in each file and include the License file at
   50.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   50.22 -# particular file as subject to the "Classpath" exception as provided
   50.23 -# by Oracle in the GPL Version 2 section of the License file that
   50.24 -# accompanied this code. If applicable, add the following below the
   50.25 -# License Header, with the fields enclosed by brackets [] replaced by
   50.26 -# your own identifying information:
   50.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   50.28 -#
   50.29 -# Contributor(s):
   50.30 -#
   50.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   50.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   50.33 -# Microsystems, Inc. All Rights Reserved.
   50.34 -#
   50.35 -# If you wish your version of this file to be governed by only the CDDL
   50.36 -# or only the GPL Version 2, indicate your decision by adding
   50.37 -# "[Contributor] elects to include this software in this distribution
   50.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   50.39 -# single choice of license, a recipient has the option to distribute
   50.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   50.41 -# to extend the choice of license to its licensees as provided above.
   50.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   50.43 -# Version 2 license, then the option applies only if the new code is
   50.44 -# made subject to such option by the copyright holder.
   50.45 -modules=\
   50.46 -    ${project.org.netbeans.spi.java.hints}:\
   50.47 -    ${project.org.netbeans.modules.java.hints.test}:\
   50.48 -    ${project.org.netbeans.modules.jackpot30.hintsimpl}
   50.49 -project.org.netbeans.modules.jackpot30.hintsimpl=hintsimpl
   50.50 -project.org.netbeans.modules.java.hints.test=java.hints.test
   50.51 -project.org.netbeans.spi.java.hints=spi.java.hints
    51.1 --- a/sandbox/java.hints/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,52 +0,0 @@
    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 2009-2017 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 -Contributor(s):
   51.32 -
   51.33 -The Original Software is NetBeans. The Initial Developer of the Original
   51.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   51.35 -Microsystems, Inc. All Rights Reserved.
   51.36 -
   51.37 -If you wish your version of this file to be governed by only the CDDL
   51.38 -or only the GPL Version 2, indicate your decision by adding
   51.39 -"[Contributor] elects to include this software in this distribution
   51.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   51.41 -single choice of license, a recipient has the option to distribute
   51.42 -your version of this file under either the CDDL, the GPL Version 2 or
   51.43 -to extend the choice of license to its licensees as provided above.
   51.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   51.45 -Version 2 license, then the option applies only if the new code is
   51.46 -made subject to such option by the copyright holder.
   51.47 --->
   51.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
   51.49 -    <type>org.netbeans.modules.apisupport.project.suite</type>
   51.50 -    <configuration>
   51.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-suite-project/1">
   51.52 -            <name>java.hints</name>
   51.53 -        </data>
   51.54 -    </configuration>
   51.55 -</project>
    52.1 --- a/sandbox/java.hints/spi.java.hints/apichanges.xml	Sun Jan 08 20:10:08 2017 +0100
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,139 +0,0 @@
    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 2012 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 -Portions Copyrighted 2012 Sun Microsystems, Inc.
   52.45 --->
   52.46 -<!DOCTYPE apichanges PUBLIC "-//NetBeans//DTD API changes list 1.0//EN" "../nbbuild/javadoctools/apichanges.dtd">
   52.47 -<apichanges>
   52.48 -    <apidefs>
   52.49 -        <apidef name="JavaHintsSPI">Java Hints SPI</apidef>
   52.50 -    </apidefs>
   52.51 -    <changes>
   52.52 -        <change id="ProjectHintsJava">
   52.53 -            <api name="JavaHintsSPI"/>
   52.54 -            <summary>Defining system filesystem folder for per-project Java hints customizers</summary>
   52.55 -            <version major="1" minor="16"/>
   52.56 -            <date day="24" month="4" year="2013"/>
   52.57 -            <author login="jlahoda"/>
   52.58 -            <compatibility addition="yes"/>
   52.59 -            <description>
   52.60 -                <p>
   52.61 -                    Defining <code>Project/hints/java-based</code> folder, where provider for
   52.62 -                    hints customizers for Java-based projects should be stored.
   52.63 -                </p>    
   52.64 -            </description>
   52.65 -<!--            <issue number="227959"/>-->
   52.66 -        </change>
   52.67 -        <change id="IntegerOption">
   52.68 -            <api name="JavaHintsSPI"/>
   52.69 -            <summary>Added support for integer options. Hints can be declared to appear only in inspect &amp; transform</summary>
   52.70 -            <version major="1" minor="14"/>
   52.71 -            <date day="3" month="4" year="2013"/>
   52.72 -            <author login="sdedic"/>
   52.73 -            <compatibility addition="yes"/>
   52.74 -            <description>
   52.75 -                <p>
   52.76 -                    Added declarative support for integer options. <code>@IntegerOption</code> can
   52.77 -                    be used with option name field, similar to <code>@BooleanOption</code>.
   52.78 -                </p>    
   52.79 -                <p>
   52.80 -                    An option was added to <code>Hint.Options</code>, so that hint can declare
   52.81 -                    to be only shown in Inspect &amp; transform dialog. Useful for computation-intensive
   52.82 -                    hints, which should only run on demand.
   52.83 -                </p>    
   52.84 -            </description>
   52.85 -            <class package="org.netbeans.spi.java.hints" name="IntegerOption"/>
   52.86 -            <class package="org.netbeans.spi.java.hints" name="Hint"/>
   52.87 -            <issue number="227822"/>
   52.88 -            <issue number="227959"/>
   52.89 -        </change>
   52.90 -        <change id="ErrorDescriptionFactory.forSpan">
   52.91 -            <api name="JavaHintsSPI"/>
   52.92 -            <summary>Introducing ErrorDescriptionFactory.forSpan.</summary>
   52.93 -            <version major="1" minor="9"/>
   52.94 -            <date day="19" month="12" year="2012"/>
   52.95 -            <author login="jlahoda"/>
   52.96 -            <compatibility addition="yes"/>
   52.97 -            <description>
   52.98 -                <p>
   52.99 -                    Added ErrorDescriptionFactory.forSpan to create the correct
  52.100 -                    Java-enhanced ErrorDescription from a span.
  52.101 -                </p>    
  52.102 -            </description>
  52.103 -            <class package="org.netbeans.spi.java.hints" name="ErrorDescriptionFactory"/>
  52.104 -            <issue number="223723"/>
  52.105 -        </change>
  52.106 -        <change id="TransformationSupport">
  52.107 -            <api name="JavaHintsSPI"/>
  52.108 -            <summary>Added support for using jackpot patterns from other modules (e.g. refactoring).</summary>
  52.109 -            <version major="1" minor="1"/>
  52.110 -            <date day="29" month="3" year="2012"/>
  52.111 -            <author login="jbecicka"/>
  52.112 -            <compatibility addition="yes"/>
  52.113 -            <description>
  52.114 -                <p>
  52.115 -                    Added support for using jackpot patterns from other modules (e.g. refactoring).
  52.116 -                </p>    
  52.117 -            </description>
  52.118 -            <class package="org.netbeans.spi.java.hints.support" name="TransformationSupport"/>
  52.119 -            <issue number="210262"/>
  52.120 -        </change>
  52.121 -    </changes>
  52.122 -    <htmlcontents>
  52.123 -        <head>
  52.124 -            <title>Change History for the Java Hints SPI</title>
  52.125 -            <link rel="stylesheet" href="prose.css" type="text/css"/>
  52.126 -        </head>
  52.127 -        <body>
  52.128 -            <p class="overviewlink">
  52.129 -                <a href="overview-summary.html">Overview</a>
  52.130 -            </p>
  52.131 -            <h1>Introduction</h1>
  52.132 -            <p>This document lists changes made to the Java Hints SPI.</p>
  52.133 -            
  52.134 -            <!-- The actual lists of changes, as summaries and details: -->
  52.135 -            <hr/>
  52.136 -            <standard-changelists module-code-name="$codebase"/>
  52.137 -            
  52.138 -            <hr/>
  52.139 -            <p>@FOOTER@</p>
  52.140 -        </body>
  52.141 -    </htmlcontents>
  52.142 -</apichanges>
    53.1 --- a/sandbox/java.hints/spi.java.hints/arch.xml	Sun Jan 08 20:10:08 2017 +0100
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,1158 +0,0 @@
    53.4 -<?xml version="1.0" encoding="UTF-8"?>
    53.5 -<!--
    53.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    53.7 -
    53.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    53.9 -
   53.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   53.11 -Other names may be trademarks of their respective owners.
   53.12 -
   53.13 -The contents of this file are subject to the terms of either the GNU
   53.14 -General Public License Version 2 only ("GPL") or the Common
   53.15 -Development and Distribution License("CDDL") (collectively, the
   53.16 -"License"). You may not use this file except in compliance with the
   53.17 -License. You can obtain a copy of the License at
   53.18 -http://www.netbeans.org/cddl-gplv2.html
   53.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   53.20 -specific language governing permissions and limitations under the
   53.21 -License.  When distributing the software, include this License Header
   53.22 -Notice in each file and include the License file at
   53.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   53.24 -particular file as subject to the "Classpath" exception as provided
   53.25 -by Oracle in the GPL Version 2 section of the License file that
   53.26 -accompanied this code. If applicable, add the following below the
   53.27 -License Header, with the fields enclosed by brackets [] replaced by
   53.28 -your own identifying information:
   53.29 -"Portions Copyrighted [year] [name of copyright owner]"
   53.30 -
   53.31 -Contributor(s):
   53.32 -
   53.33 -The Original Software is NetBeans. The Initial Developer of the Original
   53.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   53.35 -Microsystems, Inc. All Rights Reserved.
   53.36 -
   53.37 -If you wish your version of this file to be governed by only the CDDL
   53.38 -or only the GPL Version 2, indicate your decision by adding
   53.39 -"[Contributor] elects to include this software in this distribution
   53.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   53.41 -single choice of license, a recipient has the option to distribute
   53.42 -your version of this file under either the CDDL, the GPL Version 2 or
   53.43 -to extend the choice of license to its licensees as provided above.
   53.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   53.45 -Version 2 license, then the option applies only if the new code is
   53.46 -made subject to such option by the copyright holder.
   53.47 --->
   53.48 -<!DOCTYPE api-answers PUBLIC "-//NetBeans//DTD Arch Answers//EN" "../nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd" [
   53.49 -  <!ENTITY api-questions SYSTEM "../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml">
   53.50 -]>
   53.51 -
   53.52 -<api-answers
   53.53 -  question-version="1.29"
   53.54 -  author="jlahoda@netbeans.org"
   53.55 ->
   53.56 -
   53.57 -  &api-questions;
   53.58 -
   53.59 -
   53.60 -<!--
   53.61 -        <question id="arch-overall" when="init">
   53.62 -            Describe the overall architecture. 
   53.63 -            <hint>
   53.64 -            What will be API for 
   53.65 -            <a href="http://openide.netbeans.org/tutorial/api-design.html#design.apiandspi">
   53.66 -                clients and what support API</a>? 
   53.67 -            What parts will be pluggable?
   53.68 -            How will plug-ins be registered? Please use <code>&lt;api type="export"/&gt;</code>
   53.69 -            to describe your general APIs and specify their
   53.70 -            <a href="http://openide.netbeans.org/tutorial/api-design.html#category-private">
   53.71 -            stability categories</a>.
   53.72 -            If possible please provide simple diagrams.
   53.73 -            </hint>
   53.74 -        </question>
   53.75 --->
   53.76 - <answer id="arch-overall">
   53.77 -  <p>
   53.78 -   <api type="export" category="devel" group="java" name="spi.java.hints">
   53.79 -       SPI to create custom Java hints, including code smell warnings, productivity tips, etc.
   53.80 -       Please see the Use Cases section for a guide on how to use this SPI.
   53.81 -   </api>
   53.82 -  </p>
   53.83 - </answer>
   53.84 -
   53.85 -
   53.86 -
   53.87 -<!--
   53.88 -        <question id="arch-quality" when="init">
   53.89 -            How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a>
   53.90 -            of your code be tested and 
   53.91 -            how are future regressions going to be prevented?
   53.92 -            <hint>
   53.93 -            What kind of testing do
   53.94 -            you want to use? How much functionality, in which areas,
   53.95 -            should be covered by the tests? How you find out that your
   53.96 -            project was successful?
   53.97 -            </hint>
   53.98 -        </question>
   53.99 --->
  53.100 - <answer id="arch-quality">
  53.101 -  <p>
  53.102 -   XXX no answer for arch-quality
  53.103 -  </p>
  53.104 - </answer>
  53.105 -
  53.106 -
  53.107 -
  53.108 -<!--
  53.109 -        <question id="arch-time" when="init">
  53.110 -            What are the time estimates of the work?
  53.111 -            <hint>
  53.112 -            Please express your estimates of how long the design, implementation,
  53.113 -            stabilization are likely to last. How many people will be needed to
  53.114 -            implement this and what is the expected milestone by which the work should be 
  53.115 -            ready?
  53.116 -            </hint>
  53.117 -        </question>
  53.118 --->
  53.119 - <answer id="arch-time">
  53.120 -  <p>
  53.121 -   XXX no answer for arch-time
  53.122 -  </p>
  53.123 - </answer>
  53.124 -
  53.125 -
  53.126 -
  53.127 -<!--
  53.128 -        <question id="arch-usecases" when="init">
  53.129 -            <hint>
  53.130 -                Content of this answer will be displayed as part of page at
  53.131 -                http://www.netbeans.org/download/dev/javadoc/usecases.html 
  53.132 -                You can use tags &lt;usecase name="name&gt; regular html description &lt;/usecase&gt;
  53.133 -                and if you want to use an URL you can prefix if with @TOP@ to begin
  53.134 -                at the root of your javadoc
  53.135 -            </hint>
  53.136 -        
  53.137 -            Describe the main <a href="http://openide.netbeans.org/tutorial/api-design.html#usecase">
  53.138 -            use cases</a> of the new API. Who will use it under
  53.139 -            what circumstances? What kind of code would typically need to be written
  53.140 -            to use the module?
  53.141 -        </question>
  53.142 --->
  53.143 - <answer id="arch-usecases">
  53.144 -  <p>
  53.145 -   <usecase id="creating" name="Creating a new Java Hint">
  53.146 -       Simple way to create a new Java hint is as follows:
  53.147 -       <ul>
  53.148 -           <li>Create a new class, annotate it with the <a href="@TOP@/org/netbeans/spi/java/hints/Hint.html">@Hint</a>
  53.149 -           annotation to it.</li>
  53.150 -           <li>Create a <code>public static ErrorDescription hint(HintContext ctx) {}</code> method in the
  53.151 -           class. Annotate the method either with the <a href="@TOP@/org/netbeans/spi/java/hints/TriggerPattern.html">@TriggerPattern</a>
  53.152 -           annotation (strongly recommended), or with the <a href="@TOP@/org/netbeans/spi/java/hints/TriggerTreeKind.html">@TriggerTreeKind</a>.
  53.153 -           This method will be called when for parts of the code that match the given pattern, of for trees of the specified kinds.</li>
  53.154 -           <li>Perform whatever checks necessary to find out whether a warning should be produced at the given place, and produce the ErrorDescription if needed.</li>
  53.155 -       </ul>
  53.156 -       <br/>
  53.157 -       Tips:
  53.158 -       <ul>
  53.159 -           <li>Always use the java.hints' <a href="@TOP@/org/netbeans/spi/java/hints/ErrorDescriptionFactory.html">ErrorDescriptionFactory</a> to produce the resulting ErrorDescription.</li>
  53.160 -           <li>Never try to produce a custom suppress warnings "fix". Specify suppress warnings keys in the @Hint annotation.</li>
  53.161 -           <li>If an automated transformation is to be prodived from your hint, subclass <a href="@TOP@/org/netbeans/spi/java/hints/JavaFix.html">JavaFix</a> and
  53.162 -               use its <code>toEditorFix()</code> method to get the <code>Fix</code>, if the transformation is going to be used inside Inspect&amp;Transform.
  53.163 -           </li>
  53.164 -           <li>The name of the method is arbitrary, one hint can consist of more that one "triggered" method.</li>
  53.165 -       </ul>
  53.166 -   </usecase>
  53.167 -   <usecase id="no-class" name="Creating a new Java Hint Without a Class">
  53.168 -       For simple hints, it is possible to annotate the hint method with the <a href="@TOP@/org/netbeans/spi/java/hints/Hint.html">@Hint</a> annotation.
  53.169 -       The hint then consists of this sole method. Any number of such hints may be created in a single class.
  53.170 -   </usecase>
  53.171 -   <usecase id="testing" name="Creating a Tests for the Newly Created Java Hint">
  53.172 -       Creating automated tests for the hints is simple: create a test class, and use
  53.173 -       <a href="@TOP@/../org-netbeans-modules-java-hints-test/org/netbeans/modules/java/hints/test/api/HintTest.html">HintTest</a>
  53.174 -       to setup the test, run the hint and verify that its outcomes are correct.
  53.175 -       The tests automatically run with <code>test</code> branding, so create <code>Bundle_test.properties</code>, and add
  53.176 -       bundle keys into it for ErrorDescription and Fix display names, to isolate the test from changes in the production
  53.177 -       <code>Bundle.properties</code>.
  53.178 -   </usecase>
  53.179 -   <usecase id="adding-options" name="Adding options to a Java Hint">
  53.180 -       To add a simple boolean option to your hint, use <a href="@TOP@/org/netbeans/spi/java/hints/BooleanOption.html">@BooleanOption</a>.
  53.181 -   </usecase>
  53.182 -  </p>
  53.183 - </answer>
  53.184 -
  53.185 -
  53.186 -
  53.187 -<!--
  53.188 -        <question id="arch-what" when="init">
  53.189 -            What is this project good for?
  53.190 -            <hint>
  53.191 -            Please provide here a few lines describing the project, 
  53.192 -            what problem it should solve, provide links to documentation, 
  53.193 -            specifications, etc.
  53.194 -            </hint>
  53.195 -        </question>
  53.196 --->
  53.197 - <answer id="arch-what">
  53.198 -  <p>
  53.199 -   XXX no answer for arch-what
  53.200 -  </p>
  53.201 - </answer>
  53.202 -
  53.203 -
  53.204 -
  53.205 -<!--
  53.206 -        <question id="arch-where" when="impl">
  53.207 -            Where one can find sources for your module?
  53.208 -            <hint>
  53.209 -                Please provide link to the Hg web client at
  53.210 -                http://hg.netbeans.org/
  53.211 -                or just use tag defaultanswer generate='here'
  53.212 -            </hint>
  53.213 -        </question>
  53.214 --->
  53.215 - <answer id="arch-where">
  53.216 -  <defaultanswer generate='here' />
  53.217 - </answer>
  53.218 -
  53.219 -
  53.220 -
  53.221 -<!--
  53.222 -        <question id="compat-deprecation" when="init">
  53.223 -            How the introduction of your project influences functionality
  53.224 -            provided by previous version of the product?
  53.225 -            <hint>
  53.226 -            If you are planning to deprecate/remove/change any existing APIs,
  53.227 -            list them here accompanied with the reason explaining why you
  53.228 -            are doing so.
  53.229 -            </hint>
  53.230 -        </question>
  53.231 --->
  53.232 - <answer id="compat-deprecation">
  53.233 -  <p>
  53.234 -   XXX no answer for compat-deprecation
  53.235 -  </p>
  53.236 - </answer>
  53.237 -
  53.238 -
  53.239 -
  53.240 -<!--
  53.241 -        <question id="compat-i18n" when="impl">
  53.242 -            Is your module correctly internationalized?
  53.243 -            <hint>
  53.244 -            Correct internationalization means that it obeys instructions 
  53.245 -            at <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html">
  53.246 -            NetBeans I18N pages</a>.
  53.247 -            </hint>
  53.248 -        </question>
  53.249 --->
  53.250 - <answer id="compat-i18n">
  53.251 -  <p>
  53.252 -   XXX no answer for compat-i18n
  53.253 -  </p>
  53.254 - </answer>
  53.255 -
  53.256 -
  53.257 -
  53.258 -<!--
  53.259 -        <question id="compat-standards" when="init">
  53.260 -            Does the module implement or define any standards? Is the 
  53.261 -            implementation exact or does it deviate somehow?
  53.262 -        </question>
  53.263 --->
  53.264 - <answer id="compat-standards">
  53.265 -  <p>
  53.266 -   XXX no answer for compat-standards
  53.267 -  </p>
  53.268 - </answer>
  53.269 -
  53.270 -
  53.271 -
  53.272 -<!--
  53.273 -        <question id="compat-version" when="impl">
  53.274 -            Can your module coexist with earlier and future
  53.275 -            versions of itself? Can you correctly read all old settings? Will future
  53.276 -            versions be able to read your current settings? Can you read
  53.277 -            or politely ignore settings stored by a future version?
  53.278 -            
  53.279 -            <hint>
  53.280 -            Very helpful for reading settings is to store version number
  53.281 -            there, so future versions can decide whether how to read/convert
  53.282 -            the settings and older versions can ignore the new ones.
  53.283 -            </hint>
  53.284 -        </question>
  53.285 --->
  53.286 - <answer id="compat-version">
  53.287 -  <p>
  53.288 -   XXX no answer for compat-version
  53.289 -  </p>
  53.290 - </answer>
  53.291 -
  53.292 -
  53.293 -
  53.294 -<!--
  53.295 -        <question id="dep-jre" when="final">
  53.296 -            Which version of JRE do you need (1.2, 1.3, 1.4, etc.)?
  53.297 -            <hint>
  53.298 -            It is expected that if your module runs on 1.x that it will run 
  53.299 -            on 1.x+1 if no, state that please. Also describe here cases where
  53.300 -            you run different code on different versions of JRE and why.
  53.301 -            </hint>
  53.302 -        </question>
  53.303 --->
  53.304 - <answer id="dep-jre">
  53.305 -  <p>
  53.306 -   XXX no answer for dep-jre
  53.307 -  </p>
  53.308 - </answer>
  53.309 -
  53.310 -
  53.311 -
  53.312 -<!--
  53.313 -        <question id="dep-jrejdk" when="final">
  53.314 -            Do you require the JDK or is the JRE enough?
  53.315 -        </question>
  53.316 --->
  53.317 - <answer id="dep-jrejdk">
  53.318 -  <p>
  53.319 -   XXX no answer for dep-jrejdk
  53.320 -  </p>
  53.321 - </answer>
  53.322 -
  53.323 -
  53.324 -
  53.325 -<!--
  53.326 -        <question id="dep-nb" when="init">
  53.327 -            What other NetBeans projects and modules does this one depend on?
  53.328 -            <hint>
  53.329 -            Depending on other NetBeans projects influnces the ability of
  53.330 -            users of your work to customize their own branded version of
  53.331 -            NetBeans by enabling and disabling some modules. Too
  53.332 -            much dependencies restrict this kind of customization. If that
  53.333 -            is your case, then you may want to split your functionality into
  53.334 -            pieces of autoload, eager and regular modules which can be
  53.335 -            enabled independently. Usually the answer to this question
  53.336 -            is generated from your <code>project.xml</code> file, but
  53.337 -            if it is not guessed correctly, you can suppress it by
  53.338 -            specifying &lt;defaultanswer generate="none"/&gt; and
  53.339 -            write here your own. Please describe such projects as imported APIs using
  53.340 -            the <code>&lt;api name="identification" type="import or export" category="stable" url="where is the description" /&gt;</code>.
  53.341 -            By doing this information gets listed in the summary page of your
  53.342 -            javadoc.
  53.343 -            </hint>
  53.344 -        </question>
  53.345 --->
  53.346 - <answer id="dep-nb">
  53.347 -  <defaultanswer generate='here' />
  53.348 - </answer>
  53.349 -
  53.350 -
  53.351 -
  53.352 -<!--
  53.353 -        <question id="dep-non-nb" when="init">
  53.354 -            What other projects outside NetBeans does this one depend on?
  53.355 -            
  53.356 -            <hint>
  53.357 -            Depending on 3rd party libraries is always problematic,
  53.358 -            especially if they are not open source, as that complicates
  53.359 -            the licensing scheme of NetBeans. Please enumerate your
  53.360 -            external dependencies here, so it is correctly understood since
  53.361 -            the begining what are the legal implications of your project.
  53.362 -            Also please note that
  53.363 -            some non-NetBeans projects are packaged as NetBeans modules
  53.364 -            (see <a href="http://libs.netbeans.org/">libraries</a>) and
  53.365 -            it is preferred to use this approach when more modules may
  53.366 -            depend and share such third-party libraries.
  53.367 -            </hint>
  53.368 -        </question>
  53.369 --->
  53.370 - <answer id="dep-non-nb">
  53.371 -  <p>
  53.372 -   XXX no answer for dep-non-nb
  53.373 -  </p>
  53.374 - </answer>
  53.375 -
  53.376 -
  53.377 -
  53.378 -<!--
  53.379 -        <question id="dep-platform" when="init">
  53.380 -            On which platforms does your module run? Does it run in the same
  53.381 -            way on each?
  53.382 -            <hint>
  53.383 -            If you plan any dependency on OS or any usage of native code,
  53.384 -            please describe why you are doing so and describe how you envision
  53.385 -            to enforce the portability of your code.
  53.386 -            Please note that there is a support for <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#how-os-specific">OS conditionally
  53.387 -            enabled modules</a> which together with autoload/eager modules
  53.388 -            can allow you to enable to provide the best OS aware support
  53.389 -            on certain OSes while providing compatibility bridge on the not
  53.390 -            supported ones.
  53.391 -            Also please list the supported
  53.392 -            OSes/HW platforms and mentioned the lovest version of JDK required
  53.393 -            for your project to run on. Also state whether JRE is enough or
  53.394 -            you really need JDK.
  53.395 -            </hint>
  53.396 -        </question>
  53.397 --->
  53.398 - <answer id="dep-platform">
  53.399 -  <p>
  53.400 -   XXX no answer for dep-platform
  53.401 -  </p>
  53.402 - </answer>
  53.403 -
  53.404 -
  53.405 -
  53.406 -<!--
  53.407 -        <question id="deploy-dependencies" when="final">
  53.408 -            What do other modules need to do to declare a dependency on this one,
  53.409 -            in addition to or instead of the normal module dependency declaration
  53.410 -            (e.g. tokens to require)?
  53.411 -            <hint>
  53.412 -                Provide a sample of the actual lines you would add to a module manifest
  53.413 -                to declare a dependency, for example OpenIDE-Module-Requires: some.token.
  53.414 -                If other modules should not depend on this module, or should just use a
  53.415 -                simple regular module dependency, you can just answer "nothing". If you
  53.416 -                intentionally expose a semistable API to clients using implementation
  53.417 -                dependencies, you should mention that here (but there is no need to give
  53.418 -                an example of usage).
  53.419 -            </hint>
  53.420 -        </question>
  53.421 --->
  53.422 - <answer id="deploy-dependencies">
  53.423 -  <p>
  53.424 -   XXX no answer for deploy-dependencies
  53.425 -  </p>
  53.426 - </answer>
  53.427 -
  53.428 -
  53.429 -
  53.430 -<!--
  53.431 -        <question id="deploy-jar" when="impl">
  53.432 -            Do you deploy just module JAR file(s) or other files as well?
  53.433 -            <hint>
  53.434 -            Usually a module consist of one JAR file (perhaps with Class-Path
  53.435 -            extensions) and also a configuration file that enables it. If you
  53.436 -            have any other files, use
  53.437 -            &lt;api group="java.io.File" name="yourname" type="export" category="friend"&gt;...&lt;/api&gt;
  53.438 -            to define the location, name and stability of your files (of course
  53.439 -            changing "yourname" and "friend" to suit your needs).
  53.440 -            
  53.441 -            If it uses more than one JAR, describe where they are located, how
  53.442 -            they refer to each other. 
  53.443 -            If it consist of module JAR(s) and other files, please describe
  53.444 -            what is their purpose, why other files are necessary. Please 
  53.445 -            make sure that installation/uninstallation leaves the system 
  53.446 -            in state as it was before installation.
  53.447 -            </hint>
  53.448 -        </question>
  53.449 --->
  53.450 - <answer id="deploy-jar">
  53.451 -  <p>
  53.452 -   XXX no answer for deploy-jar
  53.453 -  </p>
  53.454 - </answer>
  53.455 -
  53.456 -
  53.457 -
  53.458 -<!--
  53.459 -        <question id="deploy-nbm" when="impl">
  53.460 -            Can you deploy an NBM via the Update Center?
  53.461 -            <hint>
  53.462 -            If not why?
  53.463 -            </hint>
  53.464 -        </question>
  53.465 --->
  53.466 - <answer id="deploy-nbm">
  53.467 -  <p>
  53.468 -   XXX no answer for deploy-nbm
  53.469 -  </p>
  53.470 - </answer>
  53.471 -
  53.472 -
  53.473 -
  53.474 -<!--
  53.475 -        <question id="deploy-packages" when="init">
  53.476 -            Are packages of your module made inaccessible by not declaring them
  53.477 -            public?
  53.478 -            
  53.479 -            <hint>
  53.480 -            By default NetBeans build harness treats all packages are private.
  53.481 -            If you export some of them - either as public or friend packages,
  53.482 -            you should have a reason. If the reason is described elsewhere
  53.483 -            in this document, you can ignore this question.
  53.484 -            </hint>
  53.485 -        </question>
  53.486 --->
  53.487 - <answer id="deploy-packages">
  53.488 -  <p>
  53.489 -   XXX no answer for deploy-packages
  53.490 -  </p>
  53.491 - </answer>
  53.492 -
  53.493 -
  53.494 -
  53.495 -<!--
  53.496 -        <question id="deploy-shared" when="final">
  53.497 -            Do you need to be installed in the shared location only, or in the user directory only,
  53.498 -            or can your module be installed anywhere?
  53.499 -            <hint>
  53.500 -            Installation location shall not matter, if it does explain why.
  53.501 -            Consider also whether <code>InstalledFileLocator</code> can help.
  53.502 -            </hint>
  53.503 -        </question>
  53.504 --->
  53.505 - <answer id="deploy-shared">
  53.506 -  <p>
  53.507 -   XXX no answer for deploy-shared
  53.508 -  </p>
  53.509 - </answer>
  53.510 -
  53.511 -
  53.512 -
  53.513 -<!--
  53.514 -        <question id="exec-ant-tasks" when="impl">
  53.515 -            Do you define or register any ant tasks that other can use?
  53.516 -            
  53.517 -            <hint>
  53.518 -            If you provide an ant task that users can use, you need to be very
  53.519 -            careful about its syntax and behaviour, as it most likely forms an
  53.520 -	          API for end users and as there is a lot of end users, their reaction
  53.521 -            when such API gets broken can be pretty strong.
  53.522 -            </hint>
  53.523 -        </question>
  53.524 --->
  53.525 - <answer id="exec-ant-tasks">
  53.526 -  <p>
  53.527 -   XXX no answer for exec-ant-tasks
  53.528 -  </p>
  53.529 - </answer>
  53.530 -
  53.531 -
  53.532 -
  53.533 -<!--
  53.534 -        <question id="exec-classloader" when="impl">
  53.535 -            Does your code create its own class loader(s)?
  53.536 -            <hint>
  53.537 -            A bit unusual. Please explain why and what for.
  53.538 -            </hint>
  53.539 -        </question>
  53.540 --->
  53.541 - <answer id="exec-classloader">
  53.542 -  <p>
  53.543 -   XXX no answer for exec-classloader
  53.544 -  </p>
  53.545 - </answer>
  53.546 -
  53.547 -
  53.548 -
  53.549 -<!--
  53.550 -        <question id="exec-component" when="impl">
  53.551 -            Is execution of your code influenced by any (string) property
  53.552 -            of any of your components?
  53.553 -            
  53.554 -            <hint>
  53.555 -            Often <code>JComponent.getClientProperty</code>, <code>Action.getValue</code>
  53.556 -            or <code>PropertyDescriptor.getValue</code>, etc. are used to influence
  53.557 -            a behavior of some code. This of course forms an interface that should
  53.558 -            be documented. Also if one depends on some interface that an object
  53.559 -            implements (<code>component instanceof Runnable</code>) that forms an
  53.560 -            API as well.
  53.561 -            </hint>
  53.562 -        </question>
  53.563 --->
  53.564 - <answer id="exec-component">
  53.565 -  <p>
  53.566 -   XXX no answer for exec-component
  53.567 -  </p>
  53.568 - </answer>
  53.569 -
  53.570 -
  53.571 -
  53.572 -<!--
  53.573 -        <question id="exec-introspection" when="impl">
  53.574 -            Does your module use any kind of runtime type information (<code>instanceof</code>,
  53.575 -            work with <code>java.lang.Class</code>, etc.)?
  53.576 -            <hint>
  53.577 -            Check for cases when you have an object of type A and you also
  53.578 -            expect it to (possibly) be of type B and do some special action. That
  53.579 -            should be documented. The same applies on operations in meta-level
  53.580 -            (Class.isInstance(...), Class.isAssignableFrom(...), etc.).
  53.581 -            </hint>
  53.582 -        </question>
  53.583 --->
  53.584 - <answer id="exec-introspection">
  53.585 -  <p>
  53.586 -   XXX no answer for exec-introspection
  53.587 -  </p>
  53.588 - </answer>
  53.589 -
  53.590 -
  53.591 -
  53.592 -<!--
  53.593 -        <question id="exec-privateaccess" when="final">
  53.594 -            Are you aware of any other parts of the system calling some of 
  53.595 -            your methods by reflection?
  53.596 -            <hint>
  53.597 -            If so, describe the "contract" as an API. Likely private or friend one, but
  53.598 -            still API and consider rewrite of it.
  53.599 -            </hint>
  53.600 -        </question>
  53.601 --->
  53.602 - <answer id="exec-privateaccess">
  53.603 -  <p>
  53.604 -   XXX no answer for exec-privateaccess
  53.605 -  </p>
  53.606 - </answer>
  53.607 -
  53.608 -
  53.609 -
  53.610 -<!--
  53.611 -        <question id="exec-process" when="impl">
  53.612 -            Do you execute an external process from your module? How do you ensure
  53.613 -            that the result is the same on different platforms? Do you parse output?
  53.614 -            Do you depend on result code?
  53.615 -            <hint>
  53.616 -            If you feed an input, parse the output please declare that as an API.
  53.617 -            </hint>
  53.618 -        </question>
  53.619 --->
  53.620 - <answer id="exec-process">
  53.621 -  <p>
  53.622 -   XXX no answer for exec-process
  53.623 -  </p>
  53.624 - </answer>
  53.625 -
  53.626 -
  53.627 -
  53.628 -<!--
  53.629 -        <question id="exec-property" when="impl">
  53.630 -            Is execution of your code influenced by any environment or
  53.631 -            Java system (<code>System.getProperty</code>) property?
  53.632 -            On a similar note, is there something interesting that you
  53.633 -            pass to <code>java.util.logging.Logger</code>? Or do you observe
  53.634 -            what others log?
  53.635 -            <hint>
  53.636 -            If there is a property that can change the behavior of your 
  53.637 -            code, somebody will likely use it. You should describe what it does 
  53.638 -            and the <a href="http://openide.netbeans.org/tutorial/api-design.html#life">stability category</a>
  53.639 -            of this API. You may use
  53.640 -            <pre>
  53.641 -                &lt;api type="export" group="property" name="id" category="private" url="http://..."&gt;
  53.642 -                    description of the property, where it is used, what it influence, etc.
  53.643 -                &lt;/api&gt;            
  53.644 -            </pre>
  53.645 -            </hint>
  53.646 -        </question>
  53.647 --->
  53.648 - <answer id="exec-property">
  53.649 -  <p>
  53.650 -   XXX no answer for exec-property
  53.651 -  </p>
  53.652 - </answer>
  53.653 -
  53.654 -
  53.655 -
  53.656 -<!--
  53.657 -        <question id="exec-reflection" when="impl">
  53.658 -            Does your code use Java Reflection to execute other code?
  53.659 -            <hint>
  53.660 -            This usually indicates a missing or insufficient API in the other
  53.661 -            part of the system. If the other side is not aware of your dependency
  53.662 -            this contract can be easily broken.
  53.663 -            </hint>
  53.664 -        </question>
  53.665 --->
  53.666 - <answer id="exec-reflection">
  53.667 -  <p>
  53.668 -   XXX no answer for exec-reflection
  53.669 -  </p>
  53.670 - </answer>
  53.671 -
  53.672 -
  53.673 -
  53.674 -<!--
  53.675 -        <question id="exec-threading" when="init">
  53.676 -            What threading models, if any, does your module adhere to? How the
  53.677 -            project behaves with respect to threading?
  53.678 -            <hint>
  53.679 -                Is your API threadsafe? Can it be accessed from any threads or
  53.680 -                just from some dedicated ones? Any special relation to AWT and
  53.681 -                its Event Dispatch thread? Also
  53.682 -                if your module calls foreign APIs which have a specific threading model,
  53.683 -                indicate how you comply with the requirements for multithreaded access
  53.684 -                (synchronization, mutexes, etc.) applicable to those APIs.
  53.685 -                If your module defines any APIs, or has complex internal structures
  53.686 -                that might be used from multiple threads, declare how you protect
  53.687 -                data against concurrent access, race conditions, deadlocks, etc.,
  53.688 -                and whether such rules are enforced by runtime warnings, errors, assertions, etc.
  53.689 -                Examples: a class might be non-thread-safe (like Java Collections); might
  53.690 -                be fully thread-safe (internal locking); might require access through a mutex
  53.691 -                (and may or may not automatically acquire that mutex on behalf of a client method);
  53.692 -                might be able to run only in the event queue; etc.
  53.693 -                Also describe when any events are fired: synchronously, asynchronously, etc.
  53.694 -                Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations">Threading Recommendations</a> (in progress)
  53.695 -            </hint>
  53.696 -        </question>
  53.697 --->
  53.698 - <answer id="exec-threading">
  53.699 -  <p>
  53.700 -   XXX no answer for exec-threading
  53.701 -  </p>
  53.702 - </answer>
  53.703 -
  53.704 -
  53.705 -
  53.706 -<!--
  53.707 -        <question id="format-clipboard" when="impl">
  53.708 -            Which data flavors (if any) does your code read from or insert to
  53.709 -            the clipboard (by access to clipboard on means calling methods on <code>java.awt.datatransfer.Transferable</code>?
  53.710 -            
  53.711 -            <hint>
  53.712 -            Often Node's deal with clipboard by usage of <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
  53.713 -            Check your code for overriding these methods.
  53.714 -            </hint>
  53.715 -        </question>
  53.716 --->
  53.717 - <answer id="format-clipboard">
  53.718 -  <p>
  53.719 -   XXX no answer for format-clipboard
  53.720 -  </p>
  53.721 - </answer>
  53.722 -
  53.723 -
  53.724 -
  53.725 -<!--
  53.726 -        <question id="format-dnd" when="impl">
  53.727 -            Which protocols (if any) does your code understand during Drag &amp; Drop?
  53.728 -            <hint>
  53.729 -            Often Node's deal with clipboard by usage of <code>Node.drag, Node.getDropType</code>. 
  53.730 -            Check your code for overriding these methods. Btw. if they are not overridden, they
  53.731 -            by default delegate to <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
  53.732 -            </hint>
  53.733 -        </question>
  53.734 --->
  53.735 - <answer id="format-dnd">
  53.736 -  <p>
  53.737 -   XXX no answer for format-dnd
  53.738 -  </p>
  53.739 - </answer>
  53.740 -
  53.741 -
  53.742 -
  53.743 -<!--
  53.744 -        <question id="format-types" when="impl">
  53.745 -            Which protocols and file formats (if any) does your module read or write on disk,
  53.746 -            or transmit or receive over the network? Do you generate an ant build script?
  53.747 -            Can it be edited and modified? 
  53.748 -            
  53.749 -            <hint>
  53.750 -            <p>
  53.751 -            Files can be read and written by other programs, modules and users. If they influence
  53.752 -            your behaviour, make sure you either document the format or claim that it is a private
  53.753 -            api (using the &lt;api&gt; tag). 
  53.754 -            </p>
  53.755 -            
  53.756 -            <p>
  53.757 -            If you generate an ant build file, this is very likely going to be seen by end users and
  53.758 -            they will be attempted to edit it. You should be ready for that and provide here a link
  53.759 -            to documentation that you have for such purposes and also describe how you are going to
  53.760 -            understand such files during next release, when you (very likely) slightly change the 
  53.761 -            format.
  53.762 -            </p>
  53.763 -            </hint>
  53.764 -        </question>
  53.765 --->
  53.766 - <answer id="format-types">
  53.767 -  <p>
  53.768 -   XXX no answer for format-types
  53.769 -  </p>
  53.770 - </answer>
  53.771 -
  53.772 -
  53.773 -
  53.774 -<!--
  53.775 -        <question id="lookup-lookup" when="init">
  53.776 -            Does your module use <code>org.openide.util.Lookup</code>
  53.777 -            or any similar technology to find any components to communicate with? Which ones?
  53.778 -            
  53.779 -            <hint>
  53.780 -            NetBeans is build around a generic registry of services called
  53.781 -            lookup. It is preferable to use it for registration and discovery
  53.782 -            if possible. See
  53.783 -            <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/lookup/doc-files/index.html">
  53.784 -            The Solution to Comunication Between Components
  53.785 -            </a>. If you do not plan to use lookup and insist usage
  53.786 -            of other solution, then please describe why it is not working for
  53.787 -            you.
  53.788 -            <br/>
  53.789 -            When filling the final version of your arch document, please
  53.790 -            describe the interfaces you are searching for, where 
  53.791 -            are defined, whether you are searching for just one or more of them,
  53.792 -            if the order is important, etc. Also classify the stability of such
  53.793 -            API contract. Use &lt;api group=&amp;lookup&amp; /&gt; tag, so
  53.794 -            your information gets listed in the summary page of your javadoc.
  53.795 -            </hint>
  53.796 -        </question>
  53.797 --->
  53.798 - <answer id="lookup-lookup">
  53.799 -  <p>
  53.800 -   XXX no answer for lookup-lookup
  53.801 -  </p>
  53.802 - </answer>
  53.803 -
  53.804 -
  53.805 -
  53.806 -<!--
  53.807 -        <question id="lookup-register" when="final">
  53.808 -            Do you register anything into lookup for other code to find?
  53.809 -            <hint>
  53.810 -            Do you register using layer file or using a declarative annotation such as <code>@ServiceProvider</code>?
  53.811 -            Who is supposed to find your component?
  53.812 -            </hint>
  53.813 -        </question>
  53.814 --->
  53.815 - <answer id="lookup-register">
  53.816 -  <p>
  53.817 -   XXX no answer for lookup-register
  53.818 -  </p>
  53.819 - </answer>
  53.820 -
  53.821 -
  53.822 -
  53.823 -<!--
  53.824 -        <question id="lookup-remove" when="final">
  53.825 -            Do you remove entries of other modules from lookup?
  53.826 -            <hint>
  53.827 -            Why? Of course, that is possible, but it can be dangerous. Is the module
  53.828 -            your are masking resource from aware of what you are doing?
  53.829 -            </hint>
  53.830 -        </question>
  53.831 --->
  53.832 - <answer id="lookup-remove">
  53.833 -  <p>
  53.834 -   XXX no answer for lookup-remove
  53.835 -  </p>
  53.836 - </answer>
  53.837 -
  53.838 -
  53.839 -
  53.840 -<!--
  53.841 -        <question id="perf-exit" when="final">
  53.842 -            Does your module run any code on exit?
  53.843 -        </question>
  53.844 --->
  53.845 - <answer id="perf-exit">
  53.846 -  <p>
  53.847 -   XXX no answer for perf-exit
  53.848 -  </p>
  53.849 - </answer>
  53.850 -
  53.851 -
  53.852 -
  53.853 -<!--
  53.854 -        <question id="perf-huge_dialogs" when="final">
  53.855 -            Does your module contain any dialogs or wizards with a large number of
  53.856 -            GUI controls such as combo boxes, lists, trees, or text areas?
  53.857 -        </question>
  53.858 --->
  53.859 - <answer id="perf-huge_dialogs">
  53.860 -  <p>
  53.861 -   XXX no answer for perf-huge_dialogs
  53.862 -  </p>
  53.863 - </answer>
  53.864 -
  53.865 -
  53.866 -
  53.867 -<!--
  53.868 -        <question id="perf-limit" when="init">
  53.869 -            Are there any hard-coded or practical limits in the number or size of
  53.870 -            elements your code can handle?
  53.871 -            <hint>
  53.872 -                Most of algorithms have increasing memory and speed complexity
  53.873 -                with respect to size of data they operate on. What is the critical
  53.874 -                part of your project that can be seen as a bottleneck with
  53.875 -                respect to speed or required memory? What are the practical
  53.876 -                sizes of data you tested your project with? What is your estimate
  53.877 -                of potential size of data that would cause visible performance
  53.878 -                problems? Is there some kind of check to detect such situation
  53.879 -                and prevent "hard" crashes - for example the CloneableEditorSupport
  53.880 -                checks for size of a file to be opened in editor
  53.881 -                and if it is larger than 1Mb it shows a dialog giving the
  53.882 -                user the right to decide - e.g. to cancel or commit suicide.
  53.883 -            </hint>
  53.884 -        </question>
  53.885 --->
  53.886 - <answer id="perf-limit">
  53.887 -  <p>
  53.888 -   XXX no answer for perf-limit
  53.889 -  </p>
  53.890 - </answer>
  53.891 -
  53.892 -
  53.893 -
  53.894 -<!--
  53.895 -        <question id="perf-mem" when="final">
  53.896 -            How much memory does your component consume? Estimate
  53.897 -            with a relation to the number of windows, etc.
  53.898 -        </question>
  53.899 --->
  53.900 - <answer id="perf-mem">
  53.901 -  <p>
  53.902 -   XXX no answer for perf-mem
  53.903 -  </p>
  53.904 - </answer>
  53.905 -
  53.906 -
  53.907 -
  53.908 -<!--
  53.909 -        <question id="perf-menus" when="final">
  53.910 -            Does your module use dynamically updated context menus, or
  53.911 -            context-sensitive actions with complicated and slow enablement logic?
  53.912 -            <hint>
  53.913 -                If you do a lot of tricks when adding actions to regular or context menus, you can significantly
  53.914 -                slow down display of the menu, even when the user is not using your action. Pay attention to
  53.915 -                actions you add to the main menu bar, and to context menus of foreign nodes or components. If
  53.916 -                the action is conditionally enabled, or changes its display dynamically, you need to check the
  53.917 -                impact on performance. In some cases it may be more appropriate to make a simple action that is
  53.918 -                always enabled but does more detailed checks in a dialog if it is actually run.
  53.919 -            </hint>
  53.920 -        </question>
  53.921 --->
  53.922 - <answer id="perf-menus">
  53.923 -  <p>
  53.924 -   XXX no answer for perf-menus
  53.925 -  </p>
  53.926 - </answer>
  53.927 -
  53.928 -
  53.929 -
  53.930 -<!--
  53.931 -        <question id="perf-progress" when="final">
  53.932 -            Does your module execute any long-running tasks?
  53.933 -            
  53.934 -            <hint>Long running tasks should never block 
  53.935 -            AWT thread as it badly hurts the UI
  53.936 -            <a href="http://performance.netbeans.org/responsiveness/issues.html">
  53.937 -            responsiveness</a>.
  53.938 -            Tasks like connecting over
  53.939 -            network, computing huge amount of data, compilation
  53.940 -            be done asynchronously (for example
  53.941 -            using <code>RequestProcessor</code>), definitively it should 
  53.942 -            not block AWT thread.
  53.943 -            </hint>
  53.944 -        </question>
  53.945 --->
  53.946 - <answer id="perf-progress">
  53.947 -  <p>
  53.948 -   XXX no answer for perf-progress
  53.949 -  </p>
  53.950 - </answer>
  53.951 -
  53.952 -
  53.953 -
  53.954 -<!--
  53.955 -        <question id="perf-scale" when="init">
  53.956 -            Which external criteria influence the performance of your
  53.957 -            program (size of file in editor, number of files in menu, 
  53.958 -            in source directory, etc.) and how well your code scales?
  53.959 -            <hint>
  53.960 -            Please include some estimates, there are other more detailed 
  53.961 -            questions to answer in later phases of implementation. 
  53.962 -            </hint>
  53.963 -        </question>
  53.964 --->
  53.965 - <answer id="perf-scale">
  53.966 -  <p>
  53.967 -   XXX no answer for perf-scale
  53.968 -  </p>
  53.969 - </answer>
  53.970 -
  53.971 -
  53.972 -
  53.973 -<!--
  53.974 -        <question id="perf-spi" when="init">
  53.975 -            How the performance of the plugged in code will be enforced?
  53.976 -            <hint>
  53.977 -            If you allow foreign code to be plugged into your own module, how
  53.978 -            do you enforce that it will behave correctly and quickly and will not
  53.979 -            negatively influence the performance of your own module?
  53.980 -            </hint>
  53.981 -        </question>
  53.982 --->
  53.983 - <answer id="perf-spi">
  53.984 -  <p>
  53.985 -   XXX no answer for perf-spi
  53.986 -  </p>
  53.987 - </answer>
  53.988 -
  53.989 -
  53.990 -
  53.991 -<!--
  53.992 -        <question id="perf-startup" when="final">
  53.993 -            Does your module run any code on startup?
  53.994 -        </question>
  53.995 --->
  53.996 - <answer id="perf-startup">
  53.997 -  <p>
  53.998 -   XXX no answer for perf-startup
  53.999 -  </p>
 53.1000 - </answer>
 53.1001 -
 53.1002 -
 53.1003 -
 53.1004 -<!--
 53.1005 -        <question id="perf-wakeup" when="final">
 53.1006 -            Does any piece of your code wake up periodically and do something
 53.1007 -            even when the system is otherwise idle (no user interaction)?
 53.1008 -        </question>
 53.1009 --->
 53.1010 - <answer id="perf-wakeup">
 53.1011 -  <p>
 53.1012 -   XXX no answer for perf-wakeup
 53.1013 -  </p>
 53.1014 - </answer>
 53.1015 -
 53.1016 -
 53.1017 -
 53.1018 -<!--
 53.1019 -        <question id="resources-file" when="final">
 53.1020 -            Does your module use <code>java.io.File</code> directly?
 53.1021 -            
 53.1022 -            <hint>
 53.1023 -            NetBeans provide a logical wrapper over plain files called 
 53.1024 -            <code>org.openide.filesystems.FileObject</code> that
 53.1025 -            provides uniform access to such resources and is the preferred
 53.1026 -            way that should be used. But of course there can be situations when
 53.1027 -            this is not suitable.
 53.1028 -            </hint>
 53.1029 -        </question>
 53.1030 --->
 53.1031 - <answer id="resources-file">
 53.1032 -  <p>
 53.1033 -   XXX no answer for resources-file
 53.1034 -  </p>
 53.1035 - </answer>
 53.1036 -
 53.1037 -
 53.1038 -
 53.1039 -<!--
 53.1040 -        <question id="resources-layer" when="final">
 53.1041 -            Does your module provide own layer? Does it create any files or
 53.1042 -            folders in it? What it is trying to communicate by that and with which 
 53.1043 -            components?
 53.1044 -            
 53.1045 -            <hint>
 53.1046 -            NetBeans allows automatic and declarative installation of resources 
 53.1047 -            by module layers. Module register files into appropriate places
 53.1048 -            and other components use that information to perform their task
 53.1049 -            (build menu, toolbar, window layout, list of templates, set of
 53.1050 -            options, etc.). 
 53.1051 -            </hint>
 53.1052 -        </question>
 53.1053 --->
 53.1054 - <answer id="resources-layer">
 53.1055 -  <p>
 53.1056 -   XXX no answer for resources-layer
 53.1057 -  </p>
 53.1058 - </answer>
 53.1059 -
 53.1060 -
 53.1061 -
 53.1062 -<!--
 53.1063 -        <question id="resources-mask" when="final">
 53.1064 -            Does your module mask/hide/override any resources provided by other modules in
 53.1065 -            their layers?
 53.1066 -            
 53.1067 -            <hint>
 53.1068 -            If you mask a file provided by another module, you probably depend
 53.1069 -            on that and do not want the other module to (for example) change
 53.1070 -            the file's name. That module shall thus make that file available as an API
 53.1071 -            of some stability category.
 53.1072 -            </hint>
 53.1073 -        </question>
 53.1074 --->
 53.1075 - <answer id="resources-mask">
 53.1076 -  <p>
 53.1077 -   XXX no answer for resources-mask
 53.1078 -  </p>
 53.1079 - </answer>
 53.1080 -
 53.1081 -
 53.1082 -
 53.1083 -<!--
 53.1084 -        <question id="resources-preferences" when="final">
 53.1085 -            Does your module uses preferences via Preferences API? Does your module use NbPreferences or
 53.1086 -            or regular JDK Preferences ? Does it read, write or both ? 
 53.1087 -            Does it share preferences with other modules ? If so, then why ?
 53.1088 -            <hint>
 53.1089 -                You may use
 53.1090 -                    &lt;api type="export" group="preferences"
 53.1091 -                    name="preference node name" category="private"&gt;
 53.1092 -                    description of individual keys, where it is used, what it
 53.1093 -                    influences, whether the module reads/write it, etc.
 53.1094 -                    &lt;/api&gt;
 53.1095 -                Due to XML ID restrictions, rather than /org/netbeans/modules/foo give the "name" as org.netbeans.modules.foo.
 53.1096 -                Note that if you use NbPreferences this name will then be the same as the code name base of the module.
 53.1097 -            </hint>
 53.1098 -        </question>
 53.1099 --->
 53.1100 - <answer id="resources-preferences">
 53.1101 -  <p>
 53.1102 -   XXX no answer for resources-preferences
 53.1103 -  </p>
 53.1104 - </answer>
 53.1105 -
 53.1106 -
 53.1107 -
 53.1108 -<!--
 53.1109 -        <question id="resources-read" when="final">
 53.1110 -            Does your module read any resources from layers? For what purpose?
 53.1111 -            
 53.1112 -            <hint>
 53.1113 -            As this is some kind of intermodule dependency, it is a kind of API.
 53.1114 -            Please describe it and classify according to 
 53.1115 -            <a href="http://openide.netbeans.org/tutorial/api-design.html#categories">
 53.1116 -            common stability categories</a>.
 53.1117 -            </hint>
 53.1118 -        </question>
 53.1119 --->
 53.1120 - <answer id="resources-read">
 53.1121 -  <p>
 53.1122 -   XXX no answer for resources-read
 53.1123 -  </p>
 53.1124 - </answer>
 53.1125 -
 53.1126 -
 53.1127 -
 53.1128 -<!--
 53.1129 -        <question id="security-grant" when="final">
 53.1130 -            Does your code grant additional rights to some other code?
 53.1131 -            <hint>Avoid using a class loader that adds extra
 53.1132 -            permissions to loaded code unless really necessary.
 53.1133 -            Also note that your API implementation
 53.1134 -            can also expose unneeded permissions to enemy code by
 53.1135 -            calling AccessController.doPrivileged().</hint>
 53.1136 -        </question>
 53.1137 --->
 53.1138 - <answer id="security-grant">
 53.1139 -  <p>
 53.1140 -   XXX no answer for security-grant
 53.1141 -  </p>
 53.1142 - </answer>
 53.1143 -
 53.1144 -
 53.1145 -
 53.1146 -<!--
 53.1147 -        <question id="security-policy" when="final">
 53.1148 -            Does your functionality require modifications to the standard policy file?
 53.1149 -            <hint>Your code might pass control to third-party code not
 53.1150 -            coming from trusted domains. This could be code downloaded over the
 53.1151 -            network or code coming from libraries that are not bundled
 53.1152 -            with NetBeans. Which permissions need to be granted to which domains?</hint>
 53.1153 -        </question>
 53.1154 --->
 53.1155 - <answer id="security-policy">
 53.1156 -  <p>
 53.1157 -   XXX no answer for security-policy
 53.1158 -  </p>
 53.1159 - </answer>
 53.1160 -
 53.1161 -</api-answers>
    54.1 --- a/sandbox/java.hints/spi.java.hints/build.xml	Sun Jan 08 20:10:08 2017 +0100
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,51 +0,0 @@
    54.4 -<?xml version="1.0" encoding="UTF-8"?>
    54.5 -<!--
    54.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    54.7 -
    54.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    54.9 -
   54.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   54.11 -Other names may be trademarks of their respective owners.
   54.12 -
   54.13 -The contents of this file are subject to the terms of either the GNU
   54.14 -General Public License Version 2 only ("GPL") or the Common
   54.15 -Development and Distribution License("CDDL") (collectively, the
   54.16 -"License"). You may not use this file except in compliance with the
   54.17 -License. You can obtain a copy of the License at
   54.18 -http://www.netbeans.org/cddl-gplv2.html
   54.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   54.20 -specific language governing permissions and limitations under the
   54.21 -License.  When distributing the software, include this License Header
   54.22 -Notice in each file and include the License file at
   54.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   54.24 -particular file as subject to the "Classpath" exception as provided
   54.25 -by Oracle in the GPL Version 2 section of the License file that
   54.26 -accompanied this code. If applicable, add the following below the
   54.27 -License Header, with the fields enclosed by brackets [] replaced by
   54.28 -your own identifying information:
   54.29 -"Portions Copyrighted [year] [name of copyright owner]"
   54.30 -
   54.31 -Contributor(s):
   54.32 -
   54.33 -The Original Software is NetBeans. The Initial Developer of the Original
   54.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   54.35 -Microsystems, Inc. All Rights Reserved.
   54.36 -
   54.37 -If you wish your version of this file to be governed by only the CDDL
   54.38 -or only the GPL Version 2, indicate your decision by adding
   54.39 -"[Contributor] elects to include this software in this distribution
   54.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   54.41 -single choice of license, a recipient has the option to distribute
   54.42 -your version of this file under either the CDDL, the GPL Version 2 or
   54.43 -to extend the choice of license to its licensees as provided above.
   54.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   54.45 -Version 2 license, then the option applies only if the new code is
   54.46 -made subject to such option by the copyright holder.
   54.47 --->
   54.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
   54.49 -<!-- for some information on what you could do (e.g. targets to override). -->
   54.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
   54.51 -<project name="org.netbeans.spi.java.hints" default="netbeans" basedir=".">
   54.52 -    <description>Builds, tests, and runs the project org.netbeans.spi.java.hints.</description>
   54.53 -    <import file="nbproject/build-impl.xml"/>
   54.54 -</project>
    55.1 --- a/sandbox/java.hints/spi.java.hints/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,5 +0,0 @@
    55.4 -Manifest-Version: 1.0
    55.5 -OpenIDE-Module: org.netbeans.spi.java.hints
    55.6 -OpenIDE-Module-Implementation-Version: 11
    55.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/hints/spiimpl/Bundle.properties
    55.8 -
    56.1 --- a/sandbox/java.hints/spi.java.hints/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
    56.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.3 @@ -1,88 +0,0 @@
    56.4 -<?xml version="1.0" encoding="UTF-8"?>
    56.5 -<!--
    56.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    56.7 -
    56.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    56.9 -
   56.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   56.11 -Other names may be trademarks of their respective owners.
   56.12 -
   56.13 -The contents of this file are subject to the terms of either the GNU
   56.14 -General Public License Version 2 only ("GPL") or the Common
   56.15 -Development and Distribution License("CDDL") (collectively, the
   56.16 -"License"). You may not use this file except in compliance with the
   56.17 -License. You can obtain a copy of the License at
   56.18 -http://www.netbeans.org/cddl-gplv2.html
   56.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   56.20 -specific language governing permissions and limitations under the
   56.21 -License.  When distributing the software, include this License Header
   56.22 -Notice in each file and include the License file at
   56.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   56.24 -particular file as subject to the "Classpath" exception as provided
   56.25 -by Oracle in the GPL Version 2 section of the License file that
   56.26 -accompanied this code. If applicable, add the following below the
   56.27 -License Header, with the fields enclosed by brackets [] replaced by
   56.28 -your own identifying information:
   56.29 -"Portions Copyrighted [year] [name of copyright owner]"
   56.30 -
   56.31 -Contributor(s):
   56.32 -
   56.33 -The Original Software is NetBeans. The Initial Developer of the Original
   56.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   56.35 -Microsystems, Inc. All Rights Reserved.
   56.36 -
   56.37 -If you wish your version of this file to be governed by only the CDDL
   56.38 -or only the GPL Version 2, indicate your decision by adding
   56.39 -"[Contributor] elects to include this software in this distribution
   56.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   56.41 -single choice of license, a recipient has the option to distribute
   56.42 -your version of this file under either the CDDL, the GPL Version 2 or
   56.43 -to extend the choice of license to its licensees as provided above.
   56.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   56.45 -Version 2 license, then the option applies only if the new code is
   56.46 -made subject to such option by the copyright holder.
   56.47 --->
   56.48 -<!--
   56.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
   56.50 -***         EDIT ../build.xml INSTEAD         ***
   56.51 --->
   56.52 -<project name="org.netbeans.spi.java.hints-impl" basedir="..">
   56.53 -    <fail message="Please build using Ant 1.7.1 or higher.">
   56.54 -        <condition>
   56.55 -            <not>
   56.56 -                <antversion atleast="1.7.1"/>
   56.57 -            </not>
   56.58 -        </condition>
   56.59 -    </fail>
   56.60 -    <property file="nbproject/private/suite-private.properties"/>
   56.61 -    <property file="nbproject/suite.properties"/>
   56.62 -    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
   56.63 -    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
   56.64 -    <property file="${suite.dir}/nbproject/platform.properties"/>
   56.65 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
   56.66 -        <attribute name="name"/>
   56.67 -        <attribute name="value"/>
   56.68 -        <sequential>
   56.69 -            <property name="@{name}" value="${@{value}}"/>
   56.70 -        </sequential>
   56.71 -    </macrodef>
   56.72 -    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
   56.73 -        <attribute name="property"/>
   56.74 -        <attribute name="value"/>
   56.75 -        <sequential>
   56.76 -            <property name="@{property}" value="@{value}"/>
   56.77 -        </sequential>
   56.78 -    </macrodef>
   56.79 -    <property file="${user.properties.file}"/>
   56.80 -    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
   56.81 -    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
   56.82 -    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
   56.83 -    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
   56.84 -        <condition>
   56.85 -            <not>
   56.86 -                <contains string="${cluster.path.evaluated}" substring="platform"/>
   56.87 -            </not>
   56.88 -        </condition>
   56.89 -    </fail>
   56.90 -    <import file="${harness.dir}/build.xml"/>
   56.91 -</project>
    57.1 --- a/sandbox/java.hints/spi.java.hints/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
    57.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.3 @@ -1,49 +0,0 @@
    57.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    57.5 -#
    57.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    57.7 -#
    57.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    57.9 -# Other names may be trademarks of their respective owners.
   57.10 -#
   57.11 -# The contents of this file are subject to the terms of either the GNU
   57.12 -# General Public License Version 2 only ("GPL") or the Common
   57.13 -# Development and Distribution License("CDDL") (collectively, the
   57.14 -# "License"). You may not use this file except in compliance with the
   57.15 -# License. You can obtain a copy of the License at
   57.16 -# http://www.netbeans.org/cddl-gplv2.html
   57.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   57.18 -# specific language governing permissions and limitations under the
   57.19 -# License.  When distributing the software, include this License Header
   57.20 -# Notice in each file and include the License file at
   57.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   57.22 -# particular file as subject to the "Classpath" exception as provided
   57.23 -# by Oracle in the GPL Version 2 section of the License file that
   57.24 -# accompanied this code. If applicable, add the following below the
   57.25 -# License Header, with the fields enclosed by brackets [] replaced by
   57.26 -# your own identifying information:
   57.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   57.28 -#
   57.29 -# Contributor(s):
   57.30 -#
   57.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   57.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   57.33 -# Microsystems, Inc. All Rights Reserved.
   57.34 -#
   57.35 -# If you wish your version of this file to be governed by only the CDDL
   57.36 -# or only the GPL Version 2, indicate your decision by adding
   57.37 -# "[Contributor] elects to include this software in this distribution
   57.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   57.39 -# single choice of license, a recipient has the option to distribute
   57.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   57.41 -# to extend the choice of license to its licensees as provided above.
   57.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   57.43 -# Version 2 license, then the option applies only if the new code is
   57.44 -# made subject to such option by the copyright holder.
   57.45 -build.xml.data.CRC32=1b4fb019
   57.46 -build.xml.script.CRC32=caab83d9
   57.47 -build.xml.stylesheet.CRC32=a56c6a5b@2.70
   57.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   57.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   57.50 -nbproject/build-impl.xml.data.CRC32=1b4fb019
   57.51 -nbproject/build-impl.xml.script.CRC32=7438bc77
   57.52 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.70
    58.1 --- a/sandbox/java.hints/spi.java.hints/nbproject/org-netbeans-spi-java-hints.sig	Sun Jan 08 20:10:08 2017 +0100
    58.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.3 @@ -1,276 +0,0 @@
    58.4 -#Signature file v4.1
    58.5 -#Version 1.10.1
    58.6 -
    58.7 -CLSS public abstract interface java.io.Serializable
    58.8 -
    58.9 -CLSS public abstract interface java.lang.Comparable<%0 extends java.lang.Object>
   58.10 -meth public abstract int compareTo({java.lang.Comparable%0})
   58.11 -
   58.12 -CLSS public abstract java.lang.Enum<%0 extends java.lang.Enum<{java.lang.Enum%0}>>
   58.13 -cons protected init(java.lang.String,int)
   58.14 -intf java.io.Serializable
   58.15 -intf java.lang.Comparable<{java.lang.Enum%0}>
   58.16 -meth protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException
   58.17 -meth protected final void finalize()
   58.18 -meth public final boolean equals(java.lang.Object)
   58.19 -meth public final int compareTo({java.lang.Enum%0})
   58.20 -meth public final int hashCode()
   58.21 -meth public final int ordinal()
   58.22 -meth public final java.lang.Class<{java.lang.Enum%0}> getDeclaringClass()
   58.23 -meth public final java.lang.String name()
   58.24 -meth public java.lang.String toString()
   58.25 -meth public static <%0 extends java.lang.Enum<{%%0}>> {%%0} valueOf(java.lang.Class<{%%0}>,java.lang.String)
   58.26 -supr java.lang.Object
   58.27 -hfds name,ordinal
   58.28 -
   58.29 -CLSS public java.lang.Object
   58.30 -cons public init()
   58.31 -meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
   58.32 -meth protected void finalize() throws java.lang.Throwable
   58.33 -meth public boolean equals(java.lang.Object)
   58.34 -meth public final java.lang.Class<?> getClass()
   58.35 -meth public final void notify()
   58.36 -meth public final void notifyAll()
   58.37 -meth public final void wait() throws java.lang.InterruptedException
   58.38 -meth public final void wait(long) throws java.lang.InterruptedException
   58.39 -meth public final void wait(long,int) throws java.lang.InterruptedException
   58.40 -meth public int hashCode()
   58.41 -meth public java.lang.String toString()
   58.42 -
   58.43 -CLSS public abstract interface java.lang.annotation.Annotation
   58.44 -meth public abstract boolean equals(java.lang.Object)
   58.45 -meth public abstract int hashCode()
   58.46 -meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
   58.47 -meth public abstract java.lang.String toString()
   58.48 -
   58.49 -CLSS public abstract interface !annotation java.lang.annotation.Documented
   58.50 - anno 0 java.lang.annotation.Documented()
   58.51 - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
   58.52 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
   58.53 -intf java.lang.annotation.Annotation
   58.54 -
   58.55 -CLSS public abstract interface !annotation java.lang.annotation.Retention
   58.56 - anno 0 java.lang.annotation.Documented()
   58.57 - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
   58.58 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
   58.59 -intf java.lang.annotation.Annotation
   58.60 -meth public abstract java.lang.annotation.RetentionPolicy value()
   58.61 -
   58.62 -CLSS public abstract interface !annotation java.lang.annotation.Target
   58.63 - anno 0 java.lang.annotation.Documented()
   58.64 - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
   58.65 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
   58.66 -intf java.lang.annotation.Annotation
   58.67 -meth public abstract java.lang.annotation.ElementType[] value()
   58.68 -
   58.69 -CLSS public abstract interface !annotation org.netbeans.spi.java.hints.BooleanOption
   58.70 - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE)
   58.71 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[FIELD])
   58.72 -intf java.lang.annotation.Annotation
   58.73 -meth public abstract boolean defaultValue()
   58.74 -meth public abstract java.lang.String displayName()
   58.75 -meth public abstract java.lang.String tooltip()
   58.76 -
   58.77 -CLSS public abstract interface !annotation org.netbeans.spi.java.hints.ConstraintVariableType
   58.78 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[])
   58.79 -intf java.lang.annotation.Annotation
   58.80 -meth public abstract java.lang.String type()
   58.81 -meth public abstract java.lang.String variable()
   58.82 -
   58.83 -CLSS public abstract interface org.netbeans.spi.java.hints.CustomizerProvider
   58.84 -meth public abstract javax.swing.JComponent getCustomizer(java.util.prefs.Preferences)
   58.85 - anno 0 org.netbeans.api.annotations.common.NonNull()
   58.86 - anno 1 org.netbeans.api.annotations.common.NonNull()
   58.87 -
   58.88 -CLSS public org.netbeans.spi.java.hints.ErrorDescriptionFactory
   58.89 -meth public !varargs static org.netbeans.spi.editor.hints.ErrorDescription forName(org.netbeans.spi.java.hints.HintContext,com.sun.source.tree.Tree,java.lang.String,org.netbeans.spi.editor.hints.Fix[])
   58.90 -meth public !varargs static org.netbeans.spi.editor.hints.ErrorDescription forName(org.netbeans.spi.java.hints.HintContext,com.sun.source.util.TreePath,java.lang.String,org.netbeans.spi.editor.hints.Fix[])
   58.91 -meth public !varargs static org.netbeans.spi.editor.hints.ErrorDescription forSpan(org.netbeans.spi.java.hints.HintContext,int,int,java.lang.String,org.netbeans.spi.editor.hints.Fix[])
   58.92 -meth public !varargs static org.netbeans.spi.editor.hints.ErrorDescription forTree(org.netbeans.spi.java.hints.HintContext,com.sun.source.tree.Tree,java.lang.String,org.netbeans.spi.editor.hints.Fix[])
   58.93 -meth public !varargs static org.netbeans.spi.editor.hints.ErrorDescription forTree(org.netbeans.spi.java.hints.HintContext,com.sun.source.util.TreePath,java.lang.String,org.netbeans.spi.editor.hints.Fix[])
   58.94 -supr java.lang.Object
   58.95 -hfds DECLARATION
   58.96 -hcls DisableConfigure,FixImpl,InspectFix,TopLevelConfigureFix
   58.97 -
   58.98 -CLSS public abstract interface !annotation org.netbeans.spi.java.hints.Hint
   58.99 - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE)
  58.100 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE, METHOD])
  58.101 -innr public final static !enum Kind
  58.102 -innr public final static !enum Options
  58.103 -intf java.lang.annotation.Annotation
  58.104 -meth public abstract !hasdefault boolean enabled()
  58.105 -meth public abstract !hasdefault java.lang.Class<? extends org.netbeans.spi.java.hints.CustomizerProvider> customizerProvider()
  58.106 -meth public abstract !hasdefault java.lang.String id()
  58.107 -meth public abstract !hasdefault java.lang.String[] suppressWarnings()
  58.108 -meth public abstract !hasdefault org.netbeans.spi.editor.hints.Severity severity()
  58.109 -meth public abstract !hasdefault org.netbeans.spi.java.hints.Hint$Kind hintKind()
  58.110 -meth public abstract !hasdefault org.netbeans.spi.java.hints.Hint$Options[] options()
  58.111 -meth public abstract java.lang.String category()
  58.112 -meth public abstract java.lang.String description()
  58.113 -meth public abstract java.lang.String displayName()
  58.114 -
  58.115 -CLSS public final static !enum org.netbeans.spi.java.hints.Hint$Kind
  58.116 - outer org.netbeans.spi.java.hints.Hint
  58.117 -fld public final static org.netbeans.spi.java.hints.Hint$Kind ACTION
  58.118 -fld public final static org.netbeans.spi.java.hints.Hint$Kind INSPECTION
  58.119 -meth public static org.netbeans.spi.java.hints.Hint$Kind valueOf(java.lang.String)
  58.120 -meth public static org.netbeans.spi.java.hints.Hint$Kind[] values()
  58.121 -supr java.lang.Enum<org.netbeans.spi.java.hints.Hint$Kind>
  58.122 -
  58.123 -CLSS public final static !enum org.netbeans.spi.java.hints.Hint$Options
  58.124 - outer org.netbeans.spi.java.hints.Hint
  58.125 -fld public final static org.netbeans.spi.java.hints.Hint$Options NO_BATCH
  58.126 -fld public final static org.netbeans.spi.java.hints.Hint$Options QUERY
  58.127 -meth public static org.netbeans.spi.java.hints.Hint$Options valueOf(java.lang.String)
  58.128 -meth public static org.netbeans.spi.java.hints.Hint$Options[] values()
  58.129 -supr java.lang.Enum<org.netbeans.spi.java.hints.Hint$Options>
  58.130 -
  58.131 -CLSS public org.netbeans.spi.java.hints.HintContext
  58.132 -innr public final static !enum MessageKind
  58.133 -meth public boolean isBulkMode()
  58.134 -meth public boolean isCanceled()
  58.135 -meth public com.sun.source.util.TreePath getPath()
  58.136 -meth public int getCaretLocation()
  58.137 -meth public java.util.Map<java.lang.String,com.sun.source.util.TreePath> getVariables()
  58.138 -meth public java.util.Map<java.lang.String,java.lang.String> getVariableNames()
  58.139 -meth public java.util.Map<java.lang.String,java.util.Collection<? extends com.sun.source.util.TreePath>> getMultiVariables()
  58.140 -meth public java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror> getConstraints()
  58.141 -meth public java.util.prefs.Preferences getPreferences()
  58.142 -meth public org.netbeans.api.java.source.CompilationInfo getInfo()
  58.143 -meth public org.netbeans.spi.editor.hints.Severity getSeverity()
  58.144 -meth public void reportMessage(org.netbeans.spi.java.hints.HintContext$MessageKind,java.lang.String)
  58.145 -supr java.lang.Object
  58.146 -hfds bulkMode,cancel,caret,constraints,info,messages,metadata,multiVariables,path,preferences,severity,variableNames,variables
  58.147 -
  58.148 -CLSS public final static !enum org.netbeans.spi.java.hints.HintContext$MessageKind
  58.149 - outer org.netbeans.spi.java.hints.HintContext
  58.150 -fld public final static org.netbeans.spi.java.hints.HintContext$MessageKind ERROR
  58.151 -fld public final static org.netbeans.spi.java.hints.HintContext$MessageKind WARNING
  58.152 -meth public static org.netbeans.spi.java.hints.HintContext$MessageKind valueOf(java.lang.String)
  58.153 -meth public static org.netbeans.spi.java.hints.HintContext$MessageKind[] values()
  58.154 -supr java.lang.Enum<org.netbeans.spi.java.hints.HintContext$MessageKind>
  58.155 -
  58.156 -CLSS public final !enum org.netbeans.spi.java.hints.HintSeverity
  58.157 -fld public final static org.netbeans.spi.java.hints.HintSeverity CURRENT_LINE_WARNING
  58.158 -fld public final static org.netbeans.spi.java.hints.HintSeverity ERROR
  58.159 -fld public final static org.netbeans.spi.java.hints.HintSeverity WARNING
  58.160 -meth public org.netbeans.spi.editor.hints.Severity toEditorSeverity()
  58.161 -meth public static org.netbeans.spi.java.hints.HintSeverity valueOf(java.lang.String)
  58.162 -meth public static org.netbeans.spi.java.hints.HintSeverity[] values()
  58.163 -supr java.lang.Enum<org.netbeans.spi.java.hints.HintSeverity>
  58.164 -
  58.165 -CLSS public abstract org.netbeans.spi.java.hints.JavaFix
  58.166 -cons protected init(org.netbeans.api.java.source.CompilationInfo,com.sun.source.util.TreePath)
  58.167 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.168 - anno 2 org.netbeans.api.annotations.common.NonNull()
  58.169 -cons protected init(org.netbeans.api.java.source.TreePathHandle)
  58.170 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.171 -innr public final static TransformationContext
  58.172 -meth protected abstract java.lang.String getText()
  58.173 - anno 0 org.netbeans.api.annotations.common.NonNull()
  58.174 -meth protected abstract void performRewrite(org.netbeans.spi.java.hints.JavaFix$TransformationContext) throws java.lang.Exception
  58.175 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.176 -meth public final org.netbeans.spi.editor.hints.Fix toEditorFix()
  58.177 -supr java.lang.Object
  58.178 -hfds LOG,handle,options
  58.179 -
  58.180 -CLSS public final static org.netbeans.spi.java.hints.JavaFix$TransformationContext
  58.181 - outer org.netbeans.spi.java.hints.JavaFix
  58.182 -meth public com.sun.source.util.TreePath getPath()
  58.183 - anno 0 org.netbeans.api.annotations.common.NonNull()
  58.184 -meth public java.io.InputStream getResourceContent(org.openide.filesystems.FileObject) throws java.io.IOException
  58.185 - anno 0 org.netbeans.api.annotations.common.NonNull()
  58.186 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.187 -meth public java.io.OutputStream getResourceOutput(org.openide.filesystems.FileObject) throws java.io.IOException
  58.188 - anno 0 org.netbeans.api.annotations.common.NonNull()
  58.189 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.190 -meth public org.netbeans.api.java.source.WorkingCopy getWorkingCopy()
  58.191 - anno 0 org.netbeans.api.annotations.common.NonNull()
  58.192 -supr java.lang.Object
  58.193 -hfds canShowUI,fileChanges,path,resourceContentChanges,workingCopy
  58.194 -
  58.195 -CLSS public org.netbeans.spi.java.hints.JavaFixUtilities
  58.196 -cons public init()
  58.197 -meth public static boolean requiresParenthesis(com.sun.source.tree.Tree,com.sun.source.tree.Tree,com.sun.source.tree.Tree)
  58.198 -meth public static org.netbeans.spi.editor.hints.Fix removeFromParent(org.netbeans.spi.java.hints.HintContext,java.lang.String,com.sun.source.util.TreePath)
  58.199 -meth public static org.netbeans.spi.editor.hints.Fix rewriteFix(org.netbeans.spi.java.hints.HintContext,java.lang.String,com.sun.source.util.TreePath,java.lang.String)
  58.200 -supr java.lang.Object
  58.201 -hfds NUMBER_LITERAL_KINDS,OPERATOR_PRIORITIES,SPEC_VERSION
  58.202 -hcls JavaFixRealImpl,MoveFile,RemoveFromParent,ReplaceParameters
  58.203 -
  58.204 -CLSS public org.netbeans.spi.java.hints.MatcherUtilities
  58.205 -cons public init()
  58.206 -meth public static boolean matches(org.netbeans.spi.java.hints.HintContext,com.sun.source.util.TreePath,java.lang.String)
  58.207 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.208 - anno 2 org.netbeans.api.annotations.common.NonNull()
  58.209 - anno 3 org.netbeans.api.annotations.common.NonNull()
  58.210 -meth public static boolean matches(org.netbeans.spi.java.hints.HintContext,com.sun.source.util.TreePath,java.lang.String,boolean)
  58.211 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.212 - anno 2 org.netbeans.api.annotations.common.NonNull()
  58.213 - anno 3 org.netbeans.api.annotations.common.NonNull()
  58.214 -meth public static boolean matches(org.netbeans.spi.java.hints.HintContext,com.sun.source.util.TreePath,java.lang.String,java.util.Map<java.lang.String,com.sun.source.util.TreePath>,java.util.Map<java.lang.String,java.util.Collection<? extends com.sun.source.util.TreePath>>,java.util.Map<java.lang.String,java.lang.String>)
  58.215 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.216 - anno 2 org.netbeans.api.annotations.common.NonNull()
  58.217 - anno 3 org.netbeans.api.annotations.common.NonNull()
  58.218 -meth public static boolean matches(org.netbeans.spi.java.hints.HintContext,java.util.Collection<? extends com.sun.source.util.TreePath>,java.lang.String,java.util.Map<java.lang.String,com.sun.source.util.TreePath>,java.util.Map<java.lang.String,java.util.Collection<? extends com.sun.source.util.TreePath>>,java.util.Map<java.lang.String,java.lang.String>)
  58.219 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.220 - anno 2 org.netbeans.api.annotations.common.NonNull()
  58.221 - anno 3 org.netbeans.api.annotations.common.NonNull()
  58.222 -supr java.lang.Object
  58.223 -
  58.224 -CLSS public abstract interface !annotation org.netbeans.spi.java.hints.TriggerPattern
  58.225 - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE)
  58.226 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
  58.227 -intf java.lang.annotation.Annotation
  58.228 -meth public abstract !hasdefault org.netbeans.spi.java.hints.ConstraintVariableType[] constraints()
  58.229 -meth public abstract java.lang.String value()
  58.230 -
  58.231 -CLSS public abstract interface !annotation org.netbeans.spi.java.hints.TriggerPatterns
  58.232 - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE)
  58.233 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
  58.234 -intf java.lang.annotation.Annotation
  58.235 -meth public abstract org.netbeans.spi.java.hints.TriggerPattern[] value()
  58.236 -
  58.237 -CLSS public abstract interface !annotation org.netbeans.spi.java.hints.TriggerTreeKind
  58.238 - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE)
  58.239 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
  58.240 -intf java.lang.annotation.Annotation
  58.241 -meth public abstract com.sun.source.tree.Tree$Kind[] value()
  58.242 -
  58.243 -CLSS public abstract interface !annotation org.netbeans.spi.java.hints.UseOptions
  58.244 - anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE)
  58.245 - anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
  58.246 -intf java.lang.annotation.Annotation
  58.247 -meth public abstract java.lang.String[] value()
  58.248 -
  58.249 -CLSS public final org.netbeans.spi.java.hints.support.FixFactory
  58.250 -meth public final static org.netbeans.spi.editor.hints.Fix addModifiersFix(org.netbeans.api.java.source.CompilationInfo,com.sun.source.util.TreePath,java.util.Set<javax.lang.model.element.Modifier>,java.lang.String)
  58.251 -meth public final static org.netbeans.spi.editor.hints.Fix changeModifiersFix(org.netbeans.api.java.source.CompilationInfo,com.sun.source.util.TreePath,java.util.Set<javax.lang.model.element.Modifier>,java.util.Set<javax.lang.model.element.Modifier>,java.lang.String)
  58.252 -meth public final static org.netbeans.spi.editor.hints.Fix removeModifiersFix(org.netbeans.api.java.source.CompilationInfo,com.sun.source.util.TreePath,java.util.Set<javax.lang.model.element.Modifier>,java.lang.String)
  58.253 -supr java.lang.Object
  58.254 -hcls ChangeModifiersFixImpl
  58.255 -
  58.256 -CLSS public final org.netbeans.spi.java.hints.support.TransformationSupport
  58.257 -innr public abstract interface static Transformer
  58.258 -meth public java.util.Collection<? extends org.netbeans.api.java.source.ModificationResult> processAllProjects()
  58.259 - anno 0 org.netbeans.api.annotations.common.NonNull()
  58.260 -meth public org.netbeans.spi.java.hints.support.TransformationSupport setCancel(java.util.concurrent.atomic.AtomicBoolean)
  58.261 - anno 0 org.netbeans.api.annotations.common.NonNull()
  58.262 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.263 -meth public static org.netbeans.spi.java.hints.support.TransformationSupport create(java.lang.String)
  58.264 - anno 0 org.netbeans.api.annotations.common.NonNull()
  58.265 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.266 -meth public static org.netbeans.spi.java.hints.support.TransformationSupport create(java.lang.String,org.netbeans.spi.java.hints.support.TransformationSupport$Transformer)
  58.267 - anno 0 org.netbeans.api.annotations.common.NonNull()
  58.268 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.269 - anno 2 org.netbeans.api.annotations.common.NonNull()
  58.270 -meth public void transformTreePath(org.netbeans.api.java.source.WorkingCopy,com.sun.source.util.TreePath)
  58.271 - anno 1 org.netbeans.api.annotations.common.NonNull()
  58.272 - anno 2 org.netbeans.api.annotations.common.NonNull()
  58.273 -supr java.lang.Object
  58.274 -hfds cancel,jackpotPattern,transformer
  58.275 -
  58.276 -CLSS public abstract interface static org.netbeans.spi.java.hints.support.TransformationSupport$Transformer
  58.277 - outer org.netbeans.spi.java.hints.support.TransformationSupport
  58.278 -meth public abstract void transform(org.netbeans.api.java.source.WorkingCopy,org.netbeans.api.java.source.matching.Occurrence)
  58.279 -
    59.1 --- a/sandbox/java.hints/spi.java.hints/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
    59.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.3 @@ -1,48 +0,0 @@
    59.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    59.5 -#
    59.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    59.7 -#
    59.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    59.9 -# Other names may be trademarks of their respective owners.
   59.10 -#
   59.11 -# The contents of this file are subject to the terms of either the GNU
   59.12 -# General Public License Version 2 only ("GPL") or the Common
   59.13 -# Development and Distribution License("CDDL") (collectively, the
   59.14 -# "License"). You may not use this file except in compliance with the
   59.15 -# License. You can obtain a copy of the License at
   59.16 -# http://www.netbeans.org/cddl-gplv2.html
   59.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   59.18 -# specific language governing permissions and limitations under the
   59.19 -# License.  When distributing the software, include this License Header
   59.20 -# Notice in each file and include the License file at
   59.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   59.22 -# particular file as subject to the "Classpath" exception as provided
   59.23 -# by Oracle in the GPL Version 2 section of the License file that
   59.24 -# accompanied this code. If applicable, add the following below the
   59.25 -# License Header, with the fields enclosed by brackets [] replaced by
   59.26 -# your own identifying information:
   59.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   59.28 -#
   59.29 -# Contributor(s):
   59.30 -#
   59.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   59.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   59.33 -# Microsystems, Inc. All Rights Reserved.
   59.34 -#
   59.35 -# If you wish your version of this file to be governed by only the CDDL
   59.36 -# or only the GPL Version 2, indicate your decision by adding
   59.37 -# "[Contributor] elects to include this software in this distribution
   59.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   59.39 -# single choice of license, a recipient has the option to distribute
   59.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   59.41 -# to extend the choice of license to its licensees as provided above.
   59.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   59.43 -# Version 2 license, then the option applies only if the new code is
   59.44 -# made subject to such option by the copyright holder.
   59.45 -is.autoload=true
   59.46 -javac.source=1.7
   59.47 -javac.compilerargs=-Xlint -Xlint:-serial
   59.48 -spec.version.base=2.0.0
   59.49 -requires.nb.javac=true
   59.50 -javadoc.arch=${basedir}/arch.xml
   59.51 -javadoc.apichanges=${basedir}/apichanges.xml
    60.1 --- a/sandbox/java.hints/spi.java.hints/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
    60.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.3 @@ -1,523 +0,0 @@
    60.4 -<?xml version="1.0" encoding="UTF-8"?>
    60.5 -<!--
    60.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    60.7 -
    60.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    60.9 -
   60.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   60.11 -Other names may be trademarks of their respective owners.
   60.12 -
   60.13 -The contents of this file are subject to the terms of either the GNU
   60.14 -General Public License Version 2 only ("GPL") or the Common
   60.15 -Development and Distribution License("CDDL") (collectively, the
   60.16 -"License"). You may not use this file except in compliance with the
   60.17 -License. You can obtain a copy of the License at
   60.18 -http://www.netbeans.org/cddl-gplv2.html
   60.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   60.20 -specific language governing permissions and limitations under the
   60.21 -License.  When distributing the software, include this License Header
   60.22 -Notice in each file and include the License file at
   60.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   60.24 -particular file as subject to the "Classpath" exception as provided
   60.25 -by Oracle in the GPL Version 2 section of the License file that
   60.26 -accompanied this code. If applicable, add the following below the
   60.27 -License Header, with the fields enclosed by brackets [] replaced by
   60.28 -your own identifying information:
   60.29 -"Portions Copyrighted [year] [name of copyright owner]"
   60.30 -
   60.31 -Contributor(s):
   60.32 -
   60.33 -The Original Software is NetBeans. The Initial Developer of the Original
   60.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   60.35 -Microsystems, Inc. All Rights Reserved.
   60.36 -
   60.37 -If you wish your version of this file to be governed by only the CDDL
   60.38 -or only the GPL Version 2, indicate your decision by adding
   60.39 -"[Contributor] elects to include this software in this distribution
   60.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   60.41 -single choice of license, a recipient has the option to distribute
   60.42 -your version of this file under either the CDDL, the GPL Version 2 or
   60.43 -to extend the choice of license to its licensees as provided above.
   60.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
   60.45 -Version 2 license, then the option applies only if the new code is
   60.46 -made subject to such option by the copyright holder.
   60.47 --->
   60.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
   60.49 -    <type>org.netbeans.modules.apisupport.project</type>
   60.50 -    <configuration>
   60.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
   60.52 -            <code-name-base>org.netbeans.spi.java.hints</code-name-base>
   60.53 -            <suite-component/>
   60.54 -            <module-dependencies>
   60.55 -                <dependency>
   60.56 -                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
   60.57 -                    <build-prerequisite/>
   60.58 -                    <compile-dependency/>
   60.59 -                    <run-dependency>
   60.60 -                        <release-version>1</release-version>
   60.61 -                        <specification-version>1.4</specification-version>
   60.62 -                    </run-dependency>
   60.63 -                </dependency>
   60.64 -                <dependency>
   60.65 -                    <code-name-base>org.netbeans.api.java</code-name-base>
   60.66 -                    <build-prerequisite/>
   60.67 -                    <compile-dependency/>
   60.68 -                    <run-dependency>
   60.69 -                        <release-version>1</release-version>
   60.70 -                        <specification-version>1.18</specification-version>
   60.71 -                    </run-dependency>
   60.72 -                </dependency>
   60.73 -                <dependency>
   60.74 -                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
   60.75 -                    <build-prerequisite/>
   60.76 -                    <compile-dependency/>
   60.77 -                    <run-dependency>
   60.78 -                        <release-version>1</release-version>
   60.79 -                        <specification-version>1.24</specification-version>
   60.80 -                    </run-dependency>
   60.81 -                </dependency>
   60.82 -                <dependency>
   60.83 -                    <code-name-base>org.netbeans.api.progress</code-name-base>
   60.84 -                    <build-prerequisite/>
   60.85 -                    <compile-dependency/>
   60.86 -                    <run-dependency>
   60.87 -                        <release-version>1</release-version>
   60.88 -                        <specification-version>1.16</specification-version>
   60.89 -                    </run-dependency>
   60.90 -                </dependency>
   60.91 -                <dependency>
   60.92 -                    <code-name-base>org.netbeans.api.progress.nb</code-name-base>
   60.93 -                    <build-prerequisite/>
   60.94 -                    <compile-dependency/>
   60.95 -                    <run-dependency>
   60.96 -                        <specification-version>1.45</specification-version>
   60.97 -                    </run-dependency>
   60.98 -                </dependency>
   60.99 -                <dependency>
  60.100 -                    <code-name-base>org.netbeans.lib.nbjavac</code-name-base>
  60.101 -                    <build-prerequisite/>
  60.102 -                    <compile-dependency/>
  60.103 -                    <run-dependency>
  60.104 -                        <implementation-version/>
  60.105 -                    </run-dependency>
  60.106 -                </dependency>
  60.107 -                <dependency>
  60.108 -                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
  60.109 -                    <build-prerequisite/>
  60.110 -                    <compile-dependency/>
  60.111 -                    <run-dependency>
  60.112 -                        <specification-version>8.0</specification-version>
  60.113 -                    </run-dependency>
  60.114 -                </dependency>
  60.115 -                <dependency>
  60.116 -                    <code-name-base>org.netbeans.libs.javacimpl</code-name-base>
  60.117 -                    <build-prerequisite/>
  60.118 -                    <compile-dependency/>
  60.119 -                    <run-dependency>
  60.120 -                        <release-version>1</release-version>
  60.121 -                        <implementation-version/>
  60.122 -                    </run-dependency>
  60.123 -                </dependency>
  60.124 -                <dependency>
  60.125 -                    <code-name-base>org.netbeans.libs.lucene</code-name-base>
  60.126 -                    <build-prerequisite/>
  60.127 -                    <compile-dependency/>
  60.128 -                    <run-dependency>
  60.129 -                        <release-version>3</release-version>
  60.130 -                        <specification-version>3.0</specification-version>
  60.131 -                    </run-dependency>
  60.132 -                </dependency>
  60.133 -                <dependency>
  60.134 -                    <code-name-base>org.netbeans.modules.code.analysis</code-name-base>
  60.135 -                    <build-prerequisite/>
  60.136 -                    <compile-dependency/>
  60.137 -                    <run-dependency>
  60.138 -                        <release-version>0</release-version>
  60.139 -                        <specification-version>1.8</specification-version>
  60.140 -                    </run-dependency>
  60.141 -                </dependency>
  60.142 -                <dependency>
  60.143 -                    <code-name-base>org.netbeans.modules.editor</code-name-base>
  60.144 -                    <build-prerequisite/>
  60.145 -                    <compile-dependency/>
  60.146 -                    <run-dependency>
  60.147 -                        <release-version>3</release-version>
  60.148 -                        <specification-version>1.53</specification-version>
  60.149 -                    </run-dependency>
  60.150 -                </dependency>
  60.151 -                <dependency>
  60.152 -                    <code-name-base>org.netbeans.modules.editor.errorstripe.api</code-name-base>
  60.153 -                    <build-prerequisite/>
  60.154 -                    <compile-dependency/>
  60.155 -                    <run-dependency>
  60.156 -                        <release-version>1</release-version>
  60.157 -                        <specification-version>2.3</specification-version>
  60.158 -                    </run-dependency>
  60.159 -                </dependency>
  60.160 -                <dependency>
  60.161 -                    <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
  60.162 -                    <build-prerequisite/>
  60.163 -                    <compile-dependency/>
  60.164 -                    <run-dependency>
  60.165 -                        <release-version>3</release-version>
  60.166 -                        <specification-version>3.1</specification-version>
  60.167 -                    </run-dependency>
  60.168 -                </dependency>
  60.169 -                <dependency>
  60.170 -                    <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
  60.171 -                    <build-prerequisite/>
  60.172 -                    <compile-dependency/>
  60.173 -                    <run-dependency>
  60.174 -                        <release-version>1</release-version>
  60.175 -                        <specification-version>1.8</specification-version>
  60.176 -                    </run-dependency>
  60.177 -                </dependency>
  60.178 -                <dependency>
  60.179 -                    <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
  60.180 -                    <build-prerequisite/>
  60.181 -                    <compile-dependency/>
  60.182 -                    <run-dependency>
  60.183 -                        <release-version>1</release-version>
  60.184 -                        <specification-version>1.15</specification-version>
  60.185 -                    </run-dependency>
  60.186 -                </dependency>
  60.187 -                <dependency>
  60.188 -                    <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
  60.189 -                    <build-prerequisite/>
  60.190 -                    <compile-dependency/>
  60.191 -                    <run-dependency>
  60.192 -                        <release-version>1</release-version>
  60.193 -                        <specification-version>1.28</specification-version>
  60.194 -                    </run-dependency>
  60.195 -                </dependency>
  60.196 -                <dependency>
  60.197 -                    <code-name-base>org.netbeans.modules.editor.util</code-name-base>
  60.198 -                    <build-prerequisite/>
  60.199 -                    <compile-dependency/>
  60.200 -                    <run-dependency>
  60.201 -                        <release-version>1</release-version>
  60.202 -                        <specification-version>1.33</specification-version>
  60.203 -                    </run-dependency>
  60.204 -                </dependency>
  60.205 -                <dependency>
  60.206 -                    <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
  60.207 -                    <build-prerequisite/>
  60.208 -                    <compile-dependency/>
  60.209 -                    <run-dependency>
  60.210 -                        <release-version>1</release-version>
  60.211 -                        <specification-version>1.0</specification-version>
  60.212 -                    </run-dependency>
  60.213 -                </dependency>
  60.214 -                <dependency>
  60.215 -                    <code-name-base>org.netbeans.modules.java.platform</code-name-base>
  60.216 -                    <build-prerequisite/>
  60.217 -                    <compile-dependency/>
  60.218 -                    <run-dependency>
  60.219 -                        <release-version>1</release-version>
  60.220 -                        <specification-version>1.16</specification-version>
  60.221 -                    </run-dependency>
  60.222 -                </dependency>
  60.223 -                <dependency>
  60.224 -                    <code-name-base>org.netbeans.modules.java.project</code-name-base>
  60.225 -                    <build-prerequisite/>
  60.226 -                    <compile-dependency/>
  60.227 -                    <run-dependency>
  60.228 -                        <release-version>1</release-version>
  60.229 -                        <specification-version>1.41</specification-version>
  60.230 -                    </run-dependency>
  60.231 -                </dependency>
  60.232 -                <dependency>
  60.233 -                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
  60.234 -                    <build-prerequisite/>
  60.235 -                    <compile-dependency/>
  60.236 -                    <run-dependency>
  60.237 -                        <implementation-version/>
  60.238 -                    </run-dependency>
  60.239 -                </dependency>
  60.240 -                <dependency>
  60.241 -                    <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
  60.242 -                    <build-prerequisite/>
  60.243 -                    <compile-dependency/>
  60.244 -                    <run-dependency>
  60.245 -                        <implementation-version/>
  60.246 -                    </run-dependency>
  60.247 -                </dependency>
  60.248 -                <dependency>
  60.249 -                    <code-name-base>org.netbeans.modules.lexer</code-name-base>
  60.250 -                    <build-prerequisite/>
  60.251 -                    <compile-dependency/>
  60.252 -                    <run-dependency>
  60.253 -                        <release-version>2</release-version>
  60.254 -                        <specification-version>1.25</specification-version>
  60.255 -                    </run-dependency>
  60.256 -                </dependency>
  60.257 -                <dependency>
  60.258 -                    <code-name-base>org.netbeans.modules.options.api</code-name-base>
  60.259 -                    <build-prerequisite/>
  60.260 -                    <compile-dependency/>
  60.261 -                    <run-dependency>
  60.262 -                        <release-version>1</release-version>
  60.263 -                        <specification-version>1.5</specification-version>
  60.264 -                    </run-dependency>
  60.265 -                </dependency>
  60.266 -                <dependency>
  60.267 -                    <code-name-base>org.netbeans.modules.options.editor</code-name-base>
  60.268 -                    <build-prerequisite/>
  60.269 -                    <compile-dependency/>
  60.270 -                    <run-dependency>
  60.271 -                        <release-version>1</release-version>
  60.272 -                        <specification-version>1.28</specification-version>
  60.273 -                    </run-dependency>
  60.274 -                </dependency>
  60.275 -                <dependency>
  60.276 -                    <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
  60.277 -                    <build-prerequisite/>
  60.278 -                    <compile-dependency/>
  60.279 -                    <run-dependency>
  60.280 -                        <release-version>1</release-version>
  60.281 -                        <implementation-version/>
  60.282 -                    </run-dependency>
  60.283 -                </dependency>
  60.284 -                <dependency>
  60.285 -                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
  60.286 -                    <build-prerequisite/>
  60.287 -                    <compile-dependency/>
  60.288 -                    <run-dependency>
  60.289 -                        <release-version>1</release-version>
  60.290 -                        <specification-version>1.42</specification-version>
  60.291 -                    </run-dependency>
  60.292 -                </dependency>
  60.293 -                <dependency>
  60.294 -                    <code-name-base>org.netbeans.modules.queries</code-name-base>
  60.295 -                    <build-prerequisite/>
  60.296 -                    <compile-dependency/>
  60.297 -                    <run-dependency>
  60.298 -                        <release-version>1</release-version>
  60.299 -                        <specification-version>1.18</specification-version>
  60.300 -                    </run-dependency>
  60.301 -                </dependency>
  60.302 -                <dependency>
  60.303 -                    <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
  60.304 -                    <build-prerequisite/>
  60.305 -                    <compile-dependency/>
  60.306 -                    <run-dependency>
  60.307 -                        <specification-version>1.23</specification-version>
  60.308 -                    </run-dependency>
  60.309 -                </dependency>
  60.310 -                <dependency>
  60.311 -                    <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
  60.312 -                    <build-prerequisite/>
  60.313 -                    <compile-dependency/>
  60.314 -                    <run-dependency>
  60.315 -                        <release-version>0-1</release-version>
  60.316 -                        <specification-version>1.22</specification-version>
  60.317 -                    </run-dependency>
  60.318 -                </dependency>
  60.319 -                <dependency>
  60.320 -                    <code-name-base>org.openide.actions</code-name-base>
  60.321 -                    <build-prerequisite/>
  60.322 -                    <compile-dependency/>
  60.323 -                    <run-dependency>
  60.324 -                        <specification-version>6.15</specification-version>
  60.325 -                    </run-dependency>
  60.326 -                </dependency>
  60.327 -                <dependency>
  60.328 -                    <code-name-base>org.openide.awt</code-name-base>
  60.329 -                    <build-prerequisite/>
  60.330 -                    <compile-dependency/>
  60.331 -                    <run-dependency>
  60.332 -                        <specification-version>6.10</specification-version>
  60.333 -                    </run-dependency>
  60.334 -                </dependency>
  60.335 -                <dependency>
  60.336 -                    <code-name-base>org.openide.dialogs</code-name-base>
  60.337 -                    <build-prerequisite/>
  60.338 -                    <compile-dependency/>
  60.339 -                    <run-dependency>
  60.340 -                        <specification-version>7.0</specification-version>
  60.341 -                    </run-dependency>
  60.342 -                </dependency>
  60.343 -                <dependency>
  60.344 -                    <code-name-base>org.openide.explorer</code-name-base>
  60.345 -                    <build-prerequisite/>
  60.346 -                    <compile-dependency/>
  60.347 -                    <run-dependency>
  60.348 -                        <specification-version>6.22</specification-version>
  60.349 -                    </run-dependency>
  60.350 -                </dependency>
  60.351 -                <dependency>
  60.352 -                    <code-name-base>org.openide.filesystems</code-name-base>
  60.353 -                    <build-prerequisite/>
  60.354 -                    <compile-dependency/>
  60.355 -                    <run-dependency>
  60.356 -                        <specification-version>7.19</specification-version>
  60.357 -                    </run-dependency>
  60.358 -                </dependency>
  60.359 -                <dependency>
  60.360 -                    <code-name-base>org.openide.loaders</code-name-base>
  60.361 -                    <build-prerequisite/>
  60.362 -                    <compile-dependency/>
  60.363 -                    <run-dependency/>
  60.364 -                </dependency>
  60.365 -                <dependency>
  60.366 -                    <code-name-base>org.openide.modules</code-name-base>
  60.367 -                    <build-prerequisite/>
  60.368 -                    <compile-dependency/>
  60.369 -                    <run-dependency>
  60.370 -                        <specification-version>7.3</specification-version>
  60.371 -                    </run-dependency>
  60.372 -                </dependency>
  60.373 -                <dependency>
  60.374 -                    <code-name-base>org.openide.nodes</code-name-base>
  60.375 -                    <build-prerequisite/>
  60.376 -                    <compile-dependency/>
  60.377 -                    <run-dependency>
  60.378 -                        <specification-version>6.2</specification-version>
  60.379 -                    </run-dependency>
  60.380 -                </dependency>
  60.381 -                <dependency>
  60.382 -                    <code-name-base>org.openide.text</code-name-base>
  60.383 -                    <build-prerequisite/>
  60.384 -                    <compile-dependency/>
  60.385 -                    <run-dependency>
  60.386 -                        <specification-version>6.16</specification-version>
  60.387 -                    </run-dependency>
  60.388 -                </dependency>
  60.389 -                <dependency>
  60.390 -                    <code-name-base>org.openide.util</code-name-base>
  60.391 -                    <build-prerequisite/>
  60.392 -                    <compile-dependency/>
  60.393 -                    <run-dependency>
  60.394 -                        <specification-version>8.32</specification-version>
  60.395 -                    </run-dependency>
  60.396 -                </dependency>
  60.397 -                <dependency>
  60.398 -                    <code-name-base>org.openide.util.lookup</code-name-base>
  60.399 -                    <build-prerequisite/>
  60.400 -                    <compile-dependency/>
  60.401 -                    <run-dependency>
  60.402 -                        <specification-version>8.0</specification-version>
  60.403 -                    </run-dependency>
  60.404 -                </dependency>
  60.405 -                <dependency>
  60.406 -                    <code-name-base>org.openide.windows</code-name-base>
  60.407 -                    <build-prerequisite/>
  60.408 -                    <compile-dependency/>
  60.409 -                    <run-dependency>
  60.410 -                        <specification-version>6.16</specification-version>
  60.411 -                    </run-dependency>
  60.412 -                </dependency>
  60.413 -            </module-dependencies>
  60.414 -            <test-dependencies>
  60.415 -                <test-type>
  60.416 -                    <name>unit</name>
  60.417 -                    <test-dependency>
  60.418 -                        <code-name-base>org.netbeans.core</code-name-base>
  60.419 -                        <compile-dependency/>
  60.420 -                    </test-dependency>
  60.421 -                    <test-dependency>
  60.422 -                        <code-name-base>org.netbeans.insane</code-name-base>
  60.423 -                        <compile-dependency/>
  60.424 -                    </test-dependency>
  60.425 -                    <test-dependency>
  60.426 -                        <code-name-base>org.netbeans.libs.freemarker</code-name-base>
  60.427 -                        <recursive/>
  60.428 -                        <compile-dependency/>
  60.429 -                    </test-dependency>
  60.430 -                    <test-dependency>
  60.431 -                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
  60.432 -                        <compile-dependency/>
  60.433 -                    </test-dependency>
  60.434 -                    <test-dependency>
  60.435 -                        <code-name-base>org.netbeans.modules.classfile</code-name-base>
  60.436 -                    </test-dependency>
  60.437 -                    <test-dependency>
  60.438 -                        <code-name-base>org.netbeans.modules.defaults</code-name-base>
  60.439 -                    </test-dependency>
  60.440 -                    <test-dependency>
  60.441 -                        <code-name-base>org.netbeans.modules.editor</code-name-base>
  60.442 -                        <test/>
  60.443 -                    </test-dependency>
  60.444 -                    <test-dependency>
  60.445 -                        <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
  60.446 -                        <compile-dependency/>
  60.447 -                        <test/>
  60.448 -                    </test-dependency>
  60.449 -                    <test-dependency>
  60.450 -                        <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
  60.451 -                    </test-dependency>
  60.452 -                    <test-dependency>
  60.453 -                        <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base>
  60.454 -                    </test-dependency>
  60.455 -                    <test-dependency>
  60.456 -                        <code-name-base>org.netbeans.modules.editor.util</code-name-base>
  60.457 -                    </test-dependency>
  60.458 -                    <test-dependency>
  60.459 -                        <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
  60.460 -                        <compile-dependency/>
  60.461 -                    </test-dependency>
  60.462 -                    <test-dependency>
  60.463 -                        <code-name-base>org.netbeans.modules.java.editor</code-name-base>
  60.464 -                        <recursive/>
  60.465 -                        <compile-dependency/>
  60.466 -                    </test-dependency>
  60.467 -                    <test-dependency>
  60.468 -                        <code-name-base>org.netbeans.modules.java.hints</code-name-base>
  60.469 -                        <compile-dependency/>
  60.470 -                    </test-dependency>
  60.471 -                    <test-dependency>
  60.472 -                        <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base>
  60.473 -                        <compile-dependency/>
  60.474 -                    </test-dependency>
  60.475 -                    <test-dependency>
  60.476 -                        <code-name-base>org.netbeans.modules.java.source</code-name-base>
  60.477 -                        <compile-dependency/>
  60.478 -                        <test/>
  60.479 -                    </test-dependency>
  60.480 -                    <test-dependency>
  60.481 -                        <code-name-base>org.netbeans.modules.masterfs</code-name-base>
  60.482 -                    </test-dependency>
  60.483 -                    <test-dependency>
  60.484 -                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
  60.485 -                        <compile-dependency/>
  60.486 -                    </test-dependency>
  60.487 -                    <test-dependency>
  60.488 -                        <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
  60.489 -                        <compile-dependency/>
  60.490 -                        <test/>
  60.491 -                    </test-dependency>
  60.492 -                    <test-dependency>
  60.493 -                        <code-name-base>org.netbeans.modules.parsing.nb</code-name-base>
  60.494 -                        <compile-dependency/>
  60.495 -                    </test-dependency>
  60.496 -                    <test-dependency>
  60.497 -                        <code-name-base>org.netbeans.modules.progress.ui</code-name-base>
  60.498 -                    </test-dependency>
  60.499 -                    <test-dependency>
  60.500 -                        <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
  60.501 -                        <compile-dependency/>
  60.502 -                    </test-dependency>
  60.503 -                    <test-dependency>
  60.504 -                        <code-name-base>org.netbeans.modules.projectui</code-name-base>
  60.505 -                    </test-dependency>
  60.506 -                    <test-dependency>
  60.507 -                        <code-name-base>org.openide.util</code-name-base>
  60.508 -                        <compile-dependency/>
  60.509 -                        <test/>
  60.510 -                    </test-dependency>
  60.511 -                    <test-dependency>
  60.512 -                        <code-name-base>org.openide.util.lookup</code-name-base>
  60.513 -                        <compile-dependency/>
  60.514 -                        <test/>
  60.515 -                    </test-dependency>
  60.516 -                </test-type>
  60.517 -            </test-dependencies>
  60.518 -            <public-packages>
  60.519 -                <package>org.netbeans.spi.java.hints</package>
  60.520 -                <package>org.netbeans.spi.java.hints.annotations</package>
  60.521 -                <package>org.netbeans.spi.java.hints.matching</package>
  60.522 -                <package>org.netbeans.spi.java.hints.support</package>
  60.523 -            </public-packages>
  60.524 -        </data>
  60.525 -    </configuration>
  60.526 -</project>
    61.1 --- a/sandbox/java.hints/spi.java.hints/nbproject/suite.properties	Sun Jan 08 20:10:08 2017 +0100
    61.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.3 @@ -1,42 +0,0 @@
    61.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    61.5 -#
    61.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    61.7 -#
    61.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    61.9 -# Other names may be trademarks of their respective owners.
   61.10 -#
   61.11 -# The contents of this file are subject to the terms of either the GNU
   61.12 -# General Public License Version 2 only ("GPL") or the Common
   61.13 -# Development and Distribution License("CDDL") (collectively, the
   61.14 -# "License"). You may not use this file except in compliance with the
   61.15 -# License. You can obtain a copy of the License at
   61.16 -# http://www.netbeans.org/cddl-gplv2.html
   61.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   61.18 -# specific language governing permissions and limitations under the
   61.19 -# License.  When distributing the software, include this License Header
   61.20 -# Notice in each file and include the License file at
   61.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   61.22 -# particular file as subject to the "Classpath" exception as provided
   61.23 -# by Oracle in the GPL Version 2 section of the License file that
   61.24 -# accompanied this code. If applicable, add the following below the
   61.25 -# License Header, with the fields enclosed by brackets [] replaced by
   61.26 -# your own identifying information:
   61.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   61.28 -#
   61.29 -# Contributor(s):
   61.30 -#
   61.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   61.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   61.33 -# Microsystems, Inc. All Rights Reserved.
   61.34 -#
   61.35 -# If you wish your version of this file to be governed by only the CDDL
   61.36 -# or only the GPL Version 2, indicate your decision by adding
   61.37 -# "[Contributor] elects to include this software in this distribution
   61.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   61.39 -# single choice of license, a recipient has the option to distribute
   61.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   61.41 -# to extend the choice of license to its licensees as provided above.
   61.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   61.43 -# Version 2 license, then the option applies only if the new code is
   61.44 -# made subject to such option by the copyright holder.
   61.45 -suite.dir=${basedir}/..
    62.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/jackpot/spi/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
    62.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.3 @@ -1,42 +0,0 @@
    62.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    62.5 -#
    62.6 -# Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
    62.7 -#
    62.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    62.9 -# Other names may be trademarks of their respective owners.
   62.10 -#
   62.11 -# The contents of this file are subject to the terms of either the GNU
   62.12 -# General Public License Version 2 only ("GPL") or the Common
   62.13 -# Development and Distribution License("CDDL") (collectively, the
   62.14 -# "License"). You may not use this file except in compliance with the
   62.15 -# License. You can obtain a copy of the License at
   62.16 -# http://www.netbeans.org/cddl-gplv2.html
   62.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   62.18 -# specific language governing permissions and limitations under the
   62.19 -# License.  When distributing the software, include this License Header
   62.20 -# Notice in each file and include the License file at
   62.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   62.22 -# particular file as subject to the "Classpath" exception as provided
   62.23 -# by Oracle in the GPL Version 2 section of the License file that
   62.24 -# accompanied this code. If applicable, add the following below the
   62.25 -# License Header, with the fields enclosed by brackets [] replaced by
   62.26 -# your own identifying information:
   62.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   62.28 -#
   62.29 -# Contributor(s):
   62.30 -#
   62.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   62.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2008-2009 Sun
   62.33 -# Microsystems, Inc. All Rights Reserved.
   62.34 -#
   62.35 -# If you wish your version of this file to be governed by only the CDDL
   62.36 -# or only the GPL Version 2, indicate your decision by adding
   62.37 -# "[Contributor] elects to include this software in this distribution
   62.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   62.39 -# single choice of license, a recipient has the option to distribute
   62.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   62.41 -# to extend the choice of license to its licensees as provided above.
   62.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   62.43 -# Version 2 license, then the option applies only if the new code is
   62.44 -# made subject to such option by the copyright holder.
   62.45 -LBL_UpdateDependencyQuestion=Update dependency on module {0} to specification version {1}?
   62.46 \ No newline at end of file
    63.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/jackpot/spi/HintsRunner.java	Sun Jan 08 20:10:08 2017 +0100
    63.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.3 @@ -1,69 +0,0 @@
    63.4 -/*
    63.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    63.6 - *
    63.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
    63.8 - *
    63.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   63.10 - * Other names may be trademarks of their respective owners.
   63.11 - *
   63.12 - * The contents of this file are subject to the terms of either the GNU
   63.13 - * General Public License Version 2 only ("GPL") or the Common
   63.14 - * Development and Distribution License("CDDL") (collectively, the
   63.15 - * "License"). You may not use this file except in compliance with the
   63.16 - * License. You can obtain a copy of the License at
   63.17 - * http://www.netbeans.org/cddl-gplv2.html
   63.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   63.19 - * specific language governing permissions and limitations under the
   63.20 - * License.  When distributing the software, include this License Header
   63.21 - * Notice in each file and include the License file at
   63.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   63.23 - * particular file as subject to the "Classpath" exception as provided
   63.24 - * by Oracle in the GPL Version 2 section of the License file that
   63.25 - * accompanied this code. If applicable, add the following below the
   63.26 - * License Header, with the fields enclosed by brackets [] replaced by
   63.27 - * your own identifying information:
   63.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   63.29 - *
   63.30 - * If you wish your version of this file to be governed by only the CDDL
   63.31 - * or only the GPL Version 2, indicate your decision by adding
   63.32 - * "[Contributor] elects to include this software in this distribution
   63.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   63.34 - * single choice of license, a recipient has the option to distribute
   63.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   63.36 - * to extend the choice of license to its licensees as provided above.
   63.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   63.38 - * Version 2 license, then the option applies only if the new code is
   63.39 - * made subject to such option by the copyright holder.
   63.40 - *
   63.41 - * Contributor(s):
   63.42 - *
   63.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
   63.44 - */
   63.45 -
   63.46 -package org.netbeans.modules.java.hints.jackpot.spi;
   63.47 -
   63.48 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   63.49 -import com.sun.source.util.TreePath;
   63.50 -import java.util.LinkedList;
   63.51 -import java.util.List;
   63.52 -import java.util.Map;
   63.53 -import java.util.concurrent.atomic.AtomicBoolean;
   63.54 -import org.netbeans.api.annotations.common.CheckForNull;
   63.55 -import org.netbeans.api.java.source.CompilationInfo;
   63.56 -import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
   63.57 -import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker;
   63.58 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
   63.59 -import org.netbeans.spi.editor.hints.ErrorDescription;
   63.60 -
   63.61 -/**XXX: probably unused
   63.62 - *
   63.63 - * @author lahvac
   63.64 - */
   63.65 -public class HintsRunner {
   63.66 -
   63.67 -    @CheckForNull
   63.68 -    public static Map<HintDescription, List<ErrorDescription>> computeErrors(CompilationInfo info, Iterable<? extends HintDescription> hints, AtomicBoolean cancel) {
   63.69 -        return new HintsInvoker(HintsSettings.getSettingsFor(info.getFileObject()), cancel).computeHints(info, new TreePath(info.getCompilationUnit()), hints, new LinkedList<MessageImpl>());
   63.70 -    }
   63.71 -
   63.72 -}
    64.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/jackpot/spi/PatternConvertor.java	Sun Jan 08 20:10:08 2017 +0100
    64.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.3 @@ -1,113 +0,0 @@
    64.4 -/*
    64.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    64.6 - *
    64.7 - * Copyright 2009-2011 Sun Microsystems, Inc. All rights reserved.
    64.8 - *
    64.9 - * The contents of this file are subject to the terms of either the GNU
   64.10 - * General Public License Version 2 only ("GPL") or the Common
   64.11 - * Development and Distribution License("CDDL") (collectively, the
   64.12 - * "License"). You may not use this file except in compliance with the
   64.13 - * License. You can obtain a copy of the License at
   64.14 - * http://www.netbeans.org/cddl-gplv2.html
   64.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   64.16 - * specific language governing permissions and limitations under the
   64.17 - * License.  When distributing the software, include this License Header
   64.18 - * Notice in each file and include the License file at
   64.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   64.20 - * particular file as subject to the "Classpath" exception as provided
   64.21 - * by Sun in the GPL Version 2 section of the License file that
   64.22 - * accompanied this code. If applicable, add the following below the
   64.23 - * License Header, with the fields enclosed by brackets [] replaced by
   64.24 - * your own identifying information:
   64.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   64.26 - *
   64.27 - * If you wish your version of this file to be governed by only the CDDL
   64.28 - * or only the GPL Version 2, indicate your decision by adding
   64.29 - * "[Contributor] elects to include this software in this distribution
   64.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   64.31 - * single choice of license, a recipient has the option to distribute
   64.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   64.33 - * to extend the choice of license to its licensees as provided above.
   64.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   64.35 - * Version 2 license, then the option applies only if the new code is
   64.36 - * made subject to such option by the copyright holder.
   64.37 - *
   64.38 - * Contributor(s):
   64.39 - *
   64.40 - * Portions Copyrighted 2009-2011 Sun Microsystems, Inc.
   64.41 - */
   64.42 -
   64.43 -package org.netbeans.modules.java.hints.jackpot.spi;
   64.44 -
   64.45 -import org.netbeans.modules.java.hints.providers.spi.HintDescriptionFactory;
   64.46 -import org.netbeans.spi.java.hints.HintContext;
   64.47 -import java.util.ArrayList;
   64.48 -import java.util.Collection;
   64.49 -import java.util.Collections;
   64.50 -import org.netbeans.api.annotations.common.CheckForNull;
   64.51 -import org.netbeans.api.annotations.common.NonNull;
   64.52 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.Worker;
   64.53 -import org.netbeans.modules.java.hints.providers.spi.Trigger.PatternDescription;
   64.54 -import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
   64.55 -import org.netbeans.spi.editor.hints.ErrorDescription;
   64.56 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   64.57 -import org.openide.util.Lookup;
   64.58 -
   64.59 -/**XXX: big hack?
   64.60 - *
   64.61 - * @author lahvac
   64.62 - */
   64.63 -public abstract class PatternConvertor {
   64.64 -
   64.65 -    protected abstract @CheckForNull Iterable<? extends HintDescription> parseString(@NonNull String code);
   64.66 -
   64.67 -    public static @CheckForNull Iterable<? extends HintDescription> create(@NonNull String code) {
   64.68 -        Collection<String> patterns = new ArrayList<String>();
   64.69 -        
   64.70 -        //XXX:
   64.71 -        if (code.contains(";;")) {
   64.72 -            PatternConvertor c = Lookup.getDefault().lookup(PatternConvertor.class);
   64.73 -
   64.74 -            if (c != null) {
   64.75 -                return c.parseString(code);
   64.76 -            }
   64.77 -
   64.78 -            for (String s : code.split(";;")) {
   64.79 -                s = s.trim();
   64.80 -                if (s.isEmpty()) {
   64.81 -                    continue;
   64.82 -                }
   64.83 -                
   64.84 -                patterns.add(s);
   64.85 -            }
   64.86 -        } else {
   64.87 -            patterns.add(code);
   64.88 -        }
   64.89 -
   64.90 -        Collection<HintDescription> result = new ArrayList<HintDescription>(patterns.size());
   64.91 -
   64.92 -        for (String pattern : patterns) {
   64.93 -            PatternDescription pd = PatternDescription.create(pattern, Collections.<String, String>emptyMap());
   64.94 -
   64.95 -            HintDescription desc = HintDescriptionFactory.create()
   64.96 -    //                                                     .setDisplayName("Pattern Matches")
   64.97 -                                                         .setTrigger(pd)
   64.98 -                                                         .setWorker(new WorkerImpl())
   64.99 -                                                         .produce();
  64.100 -            
  64.101 -            result.add(desc);
  64.102 -        }
  64.103 -
  64.104 -        return result;
  64.105 -    }
  64.106 -
  64.107 -    private static final class WorkerImpl implements Worker {
  64.108 -
  64.109 -        public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
  64.110 -            ErrorDescription ed = ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), "Found pattern occurrence");
  64.111 -
  64.112 -            return Collections.singleton(ed);
  64.113 -        }
  64.114 -        
  64.115 -    }
  64.116 -}
    65.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/jackpot/spi/ProjectDependencyUpgrader.java	Sun Jan 08 20:10:08 2017 +0100
    65.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.3 @@ -1,64 +0,0 @@
    65.4 -/*
    65.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    65.6 - *
    65.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    65.8 - *
    65.9 - * The contents of this file are subject to the terms of either the GNU
   65.10 - * General Public License Version 2 only ("GPL") or the Common
   65.11 - * Development and Distribution License("CDDL") (collectively, the
   65.12 - * "License"). You may not use this file except in compliance with the
   65.13 - * License. You can obtain a copy of the License at
   65.14 - * http://www.netbeans.org/cddl-gplv2.html
   65.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   65.16 - * specific language governing permissions and limitations under the
   65.17 - * License.  When distributing the software, include this License Header
   65.18 - * Notice in each file and include the License file at
   65.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   65.20 - * particular file as subject to the "Classpath" exception as provided
   65.21 - * by Sun in the GPL Version 2 section of the License file that
   65.22 - * accompanied this code. If applicable, add the following below the
   65.23 - * License Header, with the fields enclosed by brackets [] replaced by
   65.24 - * your own identifying information:
   65.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   65.26 - *
   65.27 - * If you wish your version of this file to be governed by only the CDDL
   65.28 - * or only the GPL Version 2, indicate your decision by adding
   65.29 - * "[Contributor] elects to include this software in this distribution
   65.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   65.31 - * single choice of license, a recipient has the option to distribute
   65.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   65.33 - * to extend the choice of license to its licensees as provided above.
   65.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   65.35 - * Version 2 license, then the option applies only if the new code is
   65.36 - * made subject to such option by the copyright holder.
   65.37 - *
   65.38 - * Contributor(s):
   65.39 - *
   65.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
   65.41 - */
   65.42 -package org.netbeans.modules.java.hints.jackpot.spi;
   65.43 -
   65.44 -import org.netbeans.api.project.Project;
   65.45 -import org.openide.DialogDisplayer;
   65.46 -import org.openide.NotifyDescriptor;
   65.47 -import org.openide.filesystems.FileObject;
   65.48 -import org.openide.modules.SpecificationVersion;
   65.49 -
   65.50 -/**
   65.51 - *
   65.52 - * @author lahvac
   65.53 - */
   65.54 -public abstract class ProjectDependencyUpgrader {
   65.55 -
   65.56 -    public abstract boolean ensureDependency(Project p, FileObject dep, SpecificationVersion spec, boolean canShowUI);
   65.57 -    public abstract boolean ensureDependency(Project p, String specification, boolean b);
   65.58 -
   65.59 -    protected final boolean showDependencyUpgradeDialog(Project p, String dep, SpecificationVersion currentDependency, SpecificationVersion spec, boolean newDepenency, boolean canShowUI) {
   65.60 -        if (!canShowUI) return true;
   65.61 -        
   65.62 -        NotifyDescriptor nd = new NotifyDescriptor.Confirmation("New version: " + spec, "Update spec version.", NotifyDescriptor.YES_NO_OPTION);
   65.63 -
   65.64 -        return DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION;
   65.65 -    }
   65.66 -
   65.67 -}
    66.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/code/CodeHintProviderImpl.java	Sun Jan 08 20:10:08 2017 +0100
    66.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.3 @@ -1,475 +0,0 @@
    66.4 -/*
    66.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    66.6 - *
    66.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
    66.8 - *
    66.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   66.10 - * Other names may be trademarks of their respective owners.
   66.11 - *
   66.12 - * The contents of this file are subject to the terms of either the GNU
   66.13 - * General Public License Version 2 only ("GPL") or the Common
   66.14 - * Development and Distribution License("CDDL") (collectively, the
   66.15 - * "License"). You may not use this file except in compliance with the
   66.16 - * License. You can obtain a copy of the License at
   66.17 - * http://www.netbeans.org/cddl-gplv2.html
   66.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   66.19 - * specific language governing permissions and limitations under the
   66.20 - * License.  When distributing the software, include this License Header
   66.21 - * Notice in each file and include the License file at
   66.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   66.23 - * particular file as subject to the "Classpath" exception as provided
   66.24 - * by Oracle in the GPL Version 2 section of the License file that
   66.25 - * accompanied this code. If applicable, add the following below the
   66.26 - * License Header, with the fields enclosed by brackets [] replaced by
   66.27 - * your own identifying information:
   66.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   66.29 - *
   66.30 - * If you wish your version of this file to be governed by only the CDDL
   66.31 - * or only the GPL Version 2, indicate your decision by adding
   66.32 - * "[Contributor] elects to include this software in this distribution
   66.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   66.34 - * single choice of license, a recipient has the option to distribute
   66.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   66.36 - * to extend the choice of license to its licensees as provided above.
   66.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   66.38 - * Version 2 license, then the option applies only if the new code is
   66.39 - * made subject to such option by the copyright holder.
   66.40 - *
   66.41 - * Contributor(s):
   66.42 - *
   66.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
   66.44 - */
   66.45 -
   66.46 -package org.netbeans.modules.java.hints.providers.code;
   66.47 -
   66.48 -import com.sun.source.tree.Tree.Kind;
   66.49 -import java.lang.annotation.Annotation;
   66.50 -import java.lang.reflect.InvocationTargetException;
   66.51 -import java.lang.reflect.Method;
   66.52 -import java.util.ArrayList;
   66.53 -import java.util.Arrays;
   66.54 -import java.util.Collection;
   66.55 -import java.util.Collections;
   66.56 -import java.util.EnumSet;
   66.57 -import java.util.HashMap;
   66.58 -import java.util.HashSet;
   66.59 -import java.util.LinkedList;
   66.60 -import java.util.List;
   66.61 -import java.util.Map;
   66.62 -import java.util.Set;
   66.63 -import java.util.concurrent.atomic.AtomicReference;
   66.64 -import java.util.logging.Level;
   66.65 -import java.util.logging.Logger;
   66.66 -import java.util.prefs.Preferences;
   66.67 -import javax.swing.JComponent;
   66.68 -import javax.swing.JPanel;
   66.69 -import org.netbeans.modules.java.hints.providers.code.FSWrapper.ClassWrapper;
   66.70 -import org.netbeans.modules.java.hints.providers.code.FSWrapper.FieldWrapper;
   66.71 -import org.netbeans.modules.java.hints.providers.code.FSWrapper.MethodWrapper;
   66.72 -import org.netbeans.modules.java.hints.providers.code.ReflectiveCustomizerProvider.OptionDescriptor;
   66.73 -import org.netbeans.spi.java.hints.CustomizerProvider;
   66.74 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   66.75 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.Worker;
   66.76 -import org.netbeans.modules.java.hints.providers.spi.HintDescriptionFactory;
   66.77 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
   66.78 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata.Options;
   66.79 -import org.netbeans.modules.java.hints.providers.spi.HintProvider;
   66.80 -import org.netbeans.modules.java.hints.providers.spi.Trigger.DecisionTrigger;
   66.81 -import org.netbeans.modules.java.hints.providers.spi.Trigger.Kinds;
   66.82 -import org.netbeans.modules.java.hints.providers.spi.Trigger.PatternDescription;
   66.83 -import org.netbeans.spi.editor.hints.ErrorDescription;
   66.84 -import org.netbeans.spi.editor.hints.Severity;
   66.85 -import org.netbeans.spi.java.hints.BooleanOption;
   66.86 -import org.netbeans.spi.java.hints.ConstraintVariableType;
   66.87 -import org.netbeans.spi.java.hints.Hint;
   66.88 -import org.netbeans.spi.java.hints.IntegerOption;
   66.89 -import org.netbeans.spi.java.hints.TriggerDecision;
   66.90 -import org.netbeans.spi.java.hints.TriggerPattern;
   66.91 -import org.netbeans.spi.java.hints.TriggerPatterns;
   66.92 -import org.netbeans.spi.java.hints.TriggerTreeKind;
   66.93 -import org.netbeans.spi.java.hints.UseOptions;
   66.94 -import org.openide.util.Exceptions;
   66.95 -import org.openide.util.Lookup;
   66.96 -import org.openide.util.NbCollections;
   66.97 -import org.openide.util.lookup.ServiceProvider;
   66.98 -
   66.99 -/**
  66.100 - *
  66.101 - * @author lahvac
  66.102 - */
  66.103 -@ServiceProvider(service=HintProvider.class)
  66.104 -public class CodeHintProviderImpl implements HintProvider {
  66.105 -
  66.106 -    private static final Logger LOG = Logger.getLogger(WorkerImpl.class.getName());
  66.107 -    
  66.108 -    public Map<HintMetadata, ? extends Collection<? extends HintDescription>> computeHints() {
  66.109 -        return computeHints(findLoader(), "META-INF/nb-hints/hints");
  66.110 -    }
  66.111 -
  66.112 -    private Map<HintMetadata, ? extends Collection<? extends HintDescription>> computeHints(ClassLoader l, String path) {
  66.113 -        Map<HintMetadata, Collection<HintDescription>> result = new HashMap<HintMetadata, Collection<HintDescription>>();
  66.114 -        
  66.115 -        for (ClassWrapper c : FSWrapper.listClasses()) {
  66.116 -            try {
  66.117 -                processClass(c, result);
  66.118 -            } catch (ThreadDeath td) {
  66.119 -                throw td;
  66.120 -            } catch (Throwable t) {
  66.121 -                Exceptions.printStackTrace(t);
  66.122 -            }
  66.123 -        }
  66.124 -
  66.125 -        return result;
  66.126 -    }
  66.127 -
  66.128 -    static ClassLoader findLoader() {
  66.129 -        ClassLoader l = Lookup.getDefault().lookup(ClassLoader.class);
  66.130 -
  66.131 -        if (l == null) {
  66.132 -            return CodeHintProviderImpl.class.getClassLoader();
  66.133 -        }
  66.134 -
  66.135 -        return l;
  66.136 -    }
  66.137 -
  66.138 -    public static void processClass(ClassWrapper clazz, Map<HintMetadata, Collection<HintDescription>> result) throws SecurityException {
  66.139 -        Hint metadata = clazz.getAnnotation(Hint.class);
  66.140 -        HintMetadata hm;
  66.141 -        
  66.142 -        if (metadata != null) {
  66.143 -            String id = metadata.id();
  66.144 -
  66.145 -            if (id == null || id.length() == 0) {
  66.146 -                id = clazz.getName();
  66.147 -            }
  66.148 -            hm = fromAnnotation(id, clazz, null, metadata);
  66.149 -        } else {
  66.150 -            hm = null;
  66.151 -        }
  66.152 -        
  66.153 -        for (MethodWrapper m : clazz.getMethods()) {
  66.154 -            Hint localMetadataAnnotation = m.getAnnotation(Hint.class);
  66.155 -            HintMetadata localMetadata;
  66.156 -
  66.157 -            if (localMetadataAnnotation != null) {
  66.158 -                String localID = localMetadataAnnotation.id();
  66.159 -
  66.160 -                if (localID == null || localID.length() == 0) {
  66.161 -                    localID = clazz.getName() + "." + m.getName();
  66.162 -                }
  66.163 -
  66.164 -                localMetadata = fromAnnotation(localID, clazz, m, localMetadataAnnotation);
  66.165 -            } else {
  66.166 -                localMetadata = hm;
  66.167 -            }
  66.168 -
  66.169 -            if (localMetadata != null) {
  66.170 -                processMethod(result, m, localMetadata);
  66.171 -            }
  66.172 -        }
  66.173 -    }
  66.174 -
  66.175 -    private static HintMetadata fromAnnotation(String id, ClassWrapper clazz, MethodWrapper method, Hint metadata) {
  66.176 -        HintMetadata hm = HintMetadata.Builder.create(id)
  66.177 -                                              .setDescription(metadata.displayName(), metadata.description())
  66.178 -                                              .setCategory(metadata.category())
  66.179 -                                              .setEnabled(metadata.enabled())
  66.180 -                                              .setSeverity(metadata.severity())
  66.181 -                                              .setKind(metadata.hintKind())
  66.182 -                                              .setCustomizerProvider(createCustomizerProvider(clazz, method, id, metadata))
  66.183 -                                              .addSuppressWarnings(metadata.suppressWarnings())
  66.184 -                                              .addOptions(Options.fromHintOptions(metadata.options()).toArray(new Options[0]))
  66.185 -                                              .build();
  66.186 -        return hm;
  66.187 -    }
  66.188 -
  66.189 -    private static CustomizerProvider createCustomizerProvider(ClassWrapper clazz, MethodWrapper method, String id, Hint hint) {
  66.190 -        Class<? extends CustomizerProvider> customizerClass = hint.customizerProvider();
  66.191 -
  66.192 -        if (customizerClass != CustomizerProvider.class) {
  66.193 -            return new DelegatingCustomizerProvider(customizerClass);
  66.194 -        }
  66.195 -
  66.196 -        Set<String> allowedOptions = null;
  66.197 -
  66.198 -        if (method != null) {
  66.199 -            UseOptions useOptions = method.getAnnotation(UseOptions.class);
  66.200 -
  66.201 -            if (useOptions == null) return null;
  66.202 -
  66.203 -            allowedOptions = new HashSet<String>(Arrays.asList(useOptions.value()));
  66.204 -        }
  66.205 -
  66.206 -        List<OptionDescriptor> declarativeOptions = new ArrayList<OptionDescriptor>();
  66.207 -
  66.208 -        for (FieldWrapper fw : clazz.getFields()) {
  66.209 -            BooleanOption option = fw.getAnnotation(BooleanOption.class);
  66.210 -            IntegerOption iOption = fw.getAnnotation(IntegerOption.class);
  66.211 -            
  66.212 -            String key = fw.getConstantValue();
  66.213 -
  66.214 -            if (key == null) continue;
  66.215 -            if (allowedOptions != null && !allowedOptions.contains(key)) continue;
  66.216 -            
  66.217 -            Object defValue;
  66.218 -            String displayName;
  66.219 -            String tooltip;
  66.220 -            if (option != null) {
  66.221 -                defValue = option.defaultValue();
  66.222 -                displayName = option.displayName();
  66.223 -                tooltip = option.tooltip();
  66.224 -            } else if (iOption != null) {
  66.225 -                defValue = iOption.defaultValue();
  66.226 -                displayName = iOption.displayName();
  66.227 -                tooltip = iOption.tooltip();
  66.228 -            } else {
  66.229 -                return null;
  66.230 -            }
  66.231 -            
  66.232 -            declarativeOptions.add(
  66.233 -                new OptionDescriptor(
  66.234 -                    key, 
  66.235 -                    defValue,
  66.236 -                    displayName,
  66.237 -                    tooltip,
  66.238 -                    option != null ? option : iOption)
  66.239 -            );
  66.240 -        }
  66.241 -
  66.242 -        return !declarativeOptions.isEmpty() ? new ReflectiveCustomizerProvider(clazz.getName(), id, declarativeOptions) : null;
  66.243 -    }
  66.244 -    
  66.245 -    static void processMethod(Map<HintMetadata, Collection<HintDescription>> hints, MethodWrapper m, HintMetadata metadata) {
  66.246 -        //XXX: combinations of TriggerTreeKind and TriggerPattern?
  66.247 -        processTreeKindHint(hints, m, metadata);
  66.248 -        processPatternHint(hints, m, metadata);
  66.249 -        processDecisionHint(hints, m, metadata);
  66.250 -    }
  66.251 -    
  66.252 -    private static void processTreeKindHint(Map<HintMetadata, Collection<HintDescription>> hints, MethodWrapper m, HintMetadata metadata) {
  66.253 -        TriggerTreeKind kindTrigger = m.getAnnotation(TriggerTreeKind.class);
  66.254 -
  66.255 -        if (kindTrigger == null) {
  66.256 -            return ;
  66.257 -        }
  66.258 -
  66.259 -        Worker w = new WorkerImpl(m.getClazz().getName(), m.getName());
  66.260 -
  66.261 -        Set<Kind> kinds = EnumSet.noneOf(Kind.class);
  66.262 -        
  66.263 -        kinds.addAll(Arrays.asList(kindTrigger.value()));
  66.264 -
  66.265 -        addHint(hints, metadata, HintDescriptionFactory.create()
  66.266 -                                                       .setTrigger(new Kinds(kinds))
  66.267 -                                                       .setWorker(w)
  66.268 -                                                       .setMetadata(metadata)
  66.269 -                                                       .produce());
  66.270 -    }
  66.271 -    
  66.272 -    private static void processPatternHint(Map<HintMetadata, Collection<HintDescription>> hints, MethodWrapper m, HintMetadata metadata) {
  66.273 -        TriggerPattern patternTrigger = m.getAnnotation(TriggerPattern.class);
  66.274 -
  66.275 -        if (patternTrigger != null) {
  66.276 -            processPatternHint(hints, patternTrigger, m, metadata);
  66.277 -            return ;
  66.278 -        }
  66.279 -
  66.280 -        TriggerPatterns patternTriggers = m.getAnnotation(TriggerPatterns.class);
  66.281 -
  66.282 -        if (patternTriggers != null) {
  66.283 -            for (TriggerPattern pattern : patternTriggers.value()) {
  66.284 -                processPatternHint(hints, pattern, m, metadata);
  66.285 -            }
  66.286 -            return ;
  66.287 -        }
  66.288 -    }
  66.289 -
  66.290 -    private static void processPatternHint(Map<HintMetadata, Collection<HintDescription>> hints, TriggerPattern patternTrigger, MethodWrapper m, HintMetadata metadata) {
  66.291 -        String pattern = patternTrigger.value();
  66.292 -        Map<String, String> constraints = new HashMap<String, String>();
  66.293 -
  66.294 -        for (ConstraintVariableType c : patternTrigger.constraints()) {
  66.295 -            constraints.put(c.variable(), c.type());
  66.296 -        }
  66.297 -
  66.298 -        PatternDescription pd = PatternDescription.create(pattern, constraints);
  66.299 -
  66.300 -        addHint(hints, metadata, HintDescriptionFactory.create()
  66.301 -                                                       .setTrigger(pd)
  66.302 -                                                       .setWorker(new WorkerImpl(m.getClazz().getName(), m.getName()))
  66.303 -                                                       .setMetadata(metadata)
  66.304 -                                                       .produce());
  66.305 -    }
  66.306 -
  66.307 -    private static void processDecisionHint(Map<HintMetadata, Collection<HintDescription>> hints, MethodWrapper m, HintMetadata metadata) {
  66.308 -        TriggerDecision decisionTrigger = m.getAnnotation(TriggerDecision.class);
  66.309 -
  66.310 -        if (decisionTrigger == null) {
  66.311 -            return ;
  66.312 -        }
  66.313 -
  66.314 -        Worker w = new WorkerImpl(m.getClazz().getName(), m.getName());
  66.315 -
  66.316 -        addHint(hints, metadata, HintDescriptionFactory.create()
  66.317 -                                                       .setTrigger(new DecisionTrigger(decisionTrigger.value()))
  66.318 -                                                       .setWorker(w)
  66.319 -                                                       .setMetadata(metadata)
  66.320 -                                                       .produce());
  66.321 -    }
  66.322 -    
  66.323 -    private static void addHint(Map<HintMetadata, Collection<HintDescription>> hints, HintMetadata metadata, HintDescription hint) {
  66.324 -        Collection<HintDescription> list = hints.get(metadata);
  66.325 -
  66.326 -        if (list == null) {
  66.327 -            hints.put(metadata, list = new LinkedList<HintDescription>());
  66.328 -        }
  66.329 -
  66.330 -        list.add(hint);
  66.331 -    }
  66.332 -
  66.333 -    //accessed by tests:
  66.334 -    static final class WorkerImpl implements Worker {
  66.335 -
  66.336 -        private final String className;
  66.337 -        private final String methodName;
  66.338 -
  66.339 -        public WorkerImpl(String className, String methodName) {
  66.340 -            this.className = className;
  66.341 -            this.methodName = methodName;
  66.342 -        }
  66.343 -
  66.344 -        private final AtomicReference<Method> methodRef = new AtomicReference<Method>();
  66.345 -
  66.346 -        public Collection<? extends ErrorDescription> createErrors(org.netbeans.spi.java.hints.HintContext ctx) {
  66.347 -            try {
  66.348 -                Method method = methodRef.get();
  66.349 -
  66.350 -                if (method == null) {
  66.351 -                    methodRef.set(method = getMethod());
  66.352 -                }
  66.353 -                
  66.354 -                Object result = method.invoke(null, ctx);
  66.355 -
  66.356 -                if (result == null) {
  66.357 -                    return null;
  66.358 -                }
  66.359 -
  66.360 -                if (result instanceof Iterable) {
  66.361 -                    List<ErrorDescription> out = new LinkedList<ErrorDescription>();
  66.362 -
  66.363 -                    for (ErrorDescription ed : NbCollections.iterable(NbCollections.checkedIteratorByFilter(((Iterable) result).iterator(), ErrorDescription.class, false))) {
  66.364 -                        out.add(ed);
  66.365 -                    }
  66.366 -
  66.367 -                    return out;
  66.368 -                }
  66.369 -
  66.370 -                if (result instanceof ErrorDescription) {
  66.371 -                    return Collections.singletonList((ErrorDescription) result);
  66.372 -                }
  66.373 -
  66.374 -                //XXX: log if result was ignored...
  66.375 -            } catch (IllegalAccessException ex) {
  66.376 -                Exceptions.printStackTrace(ex);
  66.377 -            } catch (IllegalArgumentException ex) {
  66.378 -                Exceptions.printStackTrace(ex);
  66.379 -            } catch (ClassNotFoundException ex) {
  66.380 -                Exceptions.printStackTrace(ex);
  66.381 -            } catch (NoSuchMethodException ex) {
  66.382 -                Exceptions.printStackTrace(ex);
  66.383 -            } catch (InvocationTargetException ex) {
  66.384 -                LOG.log(Level.INFO, className + "." + methodName, ex);
  66.385 -                //so that the exceptions are categorized better:
  66.386 -                Exceptions.printStackTrace(ex.getCause());
  66.387 -            }
  66.388 -
  66.389 -            return null;
  66.390 -        }
  66.391 -
  66.392 -        //used by tests:
  66.393 -        Method getMethod() throws NoSuchMethodException, ClassNotFoundException {
  66.394 -            return FSWrapper.resolveMethod(className, methodName);
  66.395 -        }
  66.396 -
  66.397 -    }
  66.398 -
  66.399 -    private static final class EmptyHintMetadataDescription implements Hint {
  66.400 -
  66.401 -        public String id() {
  66.402 -            return "";
  66.403 -        }
  66.404 -
  66.405 -        public String category() {
  66.406 -            return "general";
  66.407 -        }
  66.408 -
  66.409 -        public boolean enabled() {
  66.410 -            return true;
  66.411 -        }
  66.412 -
  66.413 -        public Severity severity() {
  66.414 -            return Severity.VERIFIER;
  66.415 -        }
  66.416 -
  66.417 -        private static final String[] EMPTY_SW = new String[0];
  66.418 -        
  66.419 -        public String[] suppressWarnings() {
  66.420 -            return EMPTY_SW;
  66.421 -        }
  66.422 -
  66.423 -        public Class<? extends Annotation> annotationType() {
  66.424 -            return Hint.class;
  66.425 -        }
  66.426 -
  66.427 -        public Class<? extends CustomizerProvider> customizerProvider() {
  66.428 -            return CustomizerProvider.class;
  66.429 -        }
  66.430 -
  66.431 -        public Kind hintKind() {
  66.432 -            return Kind.INSPECTION;
  66.433 -        }
  66.434 -
  66.435 -        private static final Options[] EMPTY_OPTIONS = new Options[0];
  66.436 -
  66.437 -        public Options[] options() {
  66.438 -            return EMPTY_OPTIONS;
  66.439 -        }
  66.440 -
  66.441 -        @Override public String displayName() {
  66.442 -            return "";
  66.443 -        }
  66.444 -
  66.445 -        @Override public String description() {
  66.446 -            return "";
  66.447 -        }
  66.448 -
  66.449 -    }
  66.450 -
  66.451 -    private static final class DelegatingCustomizerProvider implements CustomizerProvider {
  66.452 -
  66.453 -        private final Class<? extends CustomizerProvider> component;
  66.454 -
  66.455 -        public DelegatingCustomizerProvider(Class<? extends CustomizerProvider> component) {
  66.456 -            this.component = component;
  66.457 -        }
  66.458 -
  66.459 -        @Override
  66.460 -        public JComponent getCustomizer(Preferences prefs) {
  66.461 -            try {
  66.462 -                return component.newInstance().getCustomizer(prefs);
  66.463 -            } catch (SecurityException ex) {
  66.464 -                Exceptions.printStackTrace(ex);
  66.465 -            } catch (InstantiationException ex) {
  66.466 -                Exceptions.printStackTrace(ex);
  66.467 -            } catch (IllegalAccessException ex) {
  66.468 -                Exceptions.printStackTrace(ex);
  66.469 -            } catch (IllegalArgumentException ex) {
  66.470 -                Exceptions.printStackTrace(ex);
  66.471 -            }
  66.472 -
  66.473 -            return new JPanel();
  66.474 -        }
  66.475 -
  66.476 -    }
  66.477 -
  66.478 -}
    67.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/code/FSWrapper.java	Sun Jan 08 20:10:08 2017 +0100
    67.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.3 @@ -1,319 +0,0 @@
    67.4 -/*
    67.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    67.6 - *
    67.7 - * Copyright 2010-2011 Oracle and/or its affiliates. All rights reserved.
    67.8 - *
    67.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   67.10 - * Other names may be trademarks of their respective owners.
   67.11 - *
   67.12 - * The contents of this file are subject to the terms of either the GNU
   67.13 - * General Public License Version 2 only ("GPL") or the Common
   67.14 - * Development and Distribution License("CDDL") (collectively, the
   67.15 - * "License"). You may not use this file except in compliance with the
   67.16 - * License. You can obtain a copy of the License at
   67.17 - * http://www.netbeans.org/cddl-gplv2.html
   67.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   67.19 - * specific language governing permissions and limitations under the
   67.20 - * License.  When distributing the software, include this License Header
   67.21 - * Notice in each file and include the License file at
   67.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   67.23 - * particular file as subject to the "Classpath" exception as provided
   67.24 - * by Oracle in the GPL Version 2 section of the License file that
   67.25 - * accompanied this code. If applicable, add the following below the
   67.26 - * License Header, with the fields enclosed by brackets [] replaced by
   67.27 - * your own identifying information:
   67.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   67.29 - *
   67.30 - * If you wish your version of this file to be governed by only the CDDL
   67.31 - * or only the GPL Version 2, indicate your decision by adding
   67.32 - * "[Contributor] elects to include this software in this distribution
   67.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   67.34 - * single choice of license, a recipient has the option to distribute
   67.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   67.36 - * to extend the choice of license to its licensees as provided above.
   67.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   67.38 - * Version 2 license, then the option applies only if the new code is
   67.39 - * made subject to such option by the copyright holder.
   67.40 - *
   67.41 - * Contributor(s):
   67.42 - *
   67.43 - * Portions Copyrighted 2010-2011 Sun Microsystems, Inc.
   67.44 - */
   67.45 -
   67.46 -package org.netbeans.modules.java.hints.providers.code;
   67.47 -
   67.48 -import java.lang.annotation.Annotation;
   67.49 -import java.lang.reflect.Array;
   67.50 -import java.lang.reflect.InvocationHandler;
   67.51 -import java.lang.reflect.Method;
   67.52 -import java.lang.reflect.Proxy;
   67.53 -import java.util.HashMap;
   67.54 -import java.util.LinkedList;
   67.55 -import java.util.List;
   67.56 -import java.util.Map;
   67.57 -import java.util.logging.Level;
   67.58 -import java.util.logging.Logger;
   67.59 -import org.netbeans.spi.java.hints.HintContext;
   67.60 -import org.openide.filesystems.FileObject;
   67.61 -import org.openide.filesystems.FileUtil;
   67.62 -import org.openide.util.Exceptions;
   67.63 -
   67.64 -/**
   67.65 - *
   67.66 - * @author lahvac
   67.67 - */
   67.68 -public class FSWrapper {
   67.69 -
   67.70 -    public static Iterable<? extends ClassWrapper> listClasses() {
   67.71 -        ClassLoader loader = FSWrapper.class.getClassLoader();
   67.72 -
   67.73 -        if (loader == null) {
   67.74 -            loader = ClassLoader.getSystemClassLoader();
   67.75 -        }
   67.76 -
   67.77 -        List<ClassWrapper> result = new LinkedList<ClassWrapper>();
   67.78 -        FileObject main = FileUtil.getConfigFile("org-netbeans-modules-java-hints/code-hints/");
   67.79 -
   67.80 -        if (main != null) {
   67.81 -            for (FileObject c : main.getChildren()) {
   67.82 -                result.add(new ClassWrapper(loader, c));
   67.83 -            }
   67.84 -        }
   67.85 -
   67.86 -        return result;
   67.87 -    }
   67.88 -
   67.89 -    public static Method resolveMethod(String className, String methodName) throws NoSuchMethodException, ClassNotFoundException {
   67.90 -        Class<?> clazz = CodeHintProviderImpl.findLoader().loadClass(className);
   67.91 -
   67.92 -        return clazz.getDeclaredMethod(methodName, HintContext.class);
   67.93 -    }
   67.94 -
   67.95 -    public static class AnnotatableWrapper {
   67.96 -        protected final ClassLoader loader;
   67.97 -        protected final FileObject folder;
   67.98 -        protected AnnotatableWrapper(ClassLoader loader, FileObject folder) {
   67.99 -            this.loader = loader;
  67.100 -            this.folder = folder;
  67.101 -        }
  67.102 -
  67.103 -        private final Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
  67.104 -
  67.105 -        public synchronized <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
  67.106 -            if (!this.annotations.containsKey(annotationClass)) {
  67.107 -                FileObject f = folder.getFileObject(annotationClass.getName().replace('.', '-') + ".annotation");
  67.108 -                T result = null;
  67.109 -
  67.110 -                if (f != null) {
  67.111 -                    try {
  67.112 -                        Annotation a = loadAnnotation(loader, f);
  67.113 -
  67.114 -                        result = annotationClass.cast(a);
  67.115 -                    } catch (ClassNotFoundException ex) {
  67.116 -                        Exceptions.printStackTrace(ex);
  67.117 -                    }
  67.118 -                }
  67.119 -
  67.120 -                this.annotations.put(annotationClass, result);
  67.121 -            }
  67.122 -
  67.123 -            return annotationClass.cast(this.annotations.get(annotationClass));
  67.124 -        }
  67.125 -    }
  67.126 -
  67.127 -    public static class ClassWrapper extends AnnotatableWrapper {
  67.128 -        private final String className;
  67.129 -        public ClassWrapper(ClassLoader loader, FileObject folder) {
  67.130 -            super(loader, folder);
  67.131 -            className = folder.getName().replace('-', '.');
  67.132 -        }
  67.133 -
  67.134 -        private Iterable<? extends MethodWrapper> methods;
  67.135 -
  67.136 -        public synchronized Iterable<? extends MethodWrapper> getMethods() {
  67.137 -            if (this.methods == null) {
  67.138 -                List<MethodWrapper> methods = new LinkedList<MethodWrapper>();
  67.139 -
  67.140 -                for (FileObject c : folder.getChildren()) {
  67.141 -                    if (c.getExt().equals("method")) {
  67.142 -                        methods.add(new MethodWrapper(loader, c, this));
  67.143 -                    }
  67.144 -                }
  67.145 -
  67.146 -                this.methods = methods;
  67.147 -            }
  67.148 -
  67.149 -            return this.methods;
  67.150 -        }
  67.151 -
  67.152 -        private Iterable<? extends FieldWrapper> fields;
  67.153 -
  67.154 -        public synchronized Iterable<? extends FieldWrapper> getFields() {
  67.155 -            if (this.fields == null) {
  67.156 -                List<FieldWrapper> fields = new LinkedList<FieldWrapper>();
  67.157 -
  67.158 -                for (FileObject c : folder.getChildren()) {
  67.159 -                    if (c.getExt().equals("field")) {
  67.160 -                        fields.add(new FieldWrapper(loader, c, this));
  67.161 -                    }
  67.162 -                }
  67.163 -
  67.164 -                this.fields = fields;
  67.165 -            }
  67.166 -
  67.167 -            return this.fields;
  67.168 -        }
  67.169 -
  67.170 -        public String getName() {
  67.171 -            return className;
  67.172 -        }
  67.173 -
  67.174 -        private Class<?> clazz;
  67.175 -        public synchronized Class<?> getDeclaredClass() {
  67.176 -            if (clazz != null) {
  67.177 -                return clazz;
  67.178 -            }
  67.179 -
  67.180 -            try {
  67.181 -                return this.clazz = loader.loadClass(className);
  67.182 -            } catch (ClassNotFoundException ex) {
  67.183 -                Exceptions.printStackTrace(ex);
  67.184 -            }
  67.185 -
  67.186 -            return null; //XXX
  67.187 -        }
  67.188 -    }
  67.189 -
  67.190 -    public static class MethodWrapper extends AnnotatableWrapper {
  67.191 -        private final ClassWrapper clazz;
  67.192 -        public MethodWrapper(ClassLoader loader, FileObject folder, ClassWrapper clazz) {
  67.193 -            super(loader, folder);
  67.194 -            this.clazz = clazz;
  67.195 -        }
  67.196 -
  67.197 -        ClassWrapper getClazz() {
  67.198 -            return clazz;
  67.199 -        }
  67.200 -        
  67.201 -        String getName() {
  67.202 -            return folder.getName();
  67.203 -        }
  67.204 -    }
  67.205 -
  67.206 -    public static class FieldWrapper extends AnnotatableWrapper {
  67.207 -        private final ClassWrapper clazz;
  67.208 -        public FieldWrapper(ClassLoader loader, FileObject folder, ClassWrapper clazz) {
  67.209 -            super(loader, folder);
  67.210 -            this.clazz = clazz;
  67.211 -        }
  67.212 -
  67.213 -        ClassWrapper getClazz() {
  67.214 -            return clazz;
  67.215 -        }
  67.216 -
  67.217 -        String getName() {
  67.218 -            return folder.getName();
  67.219 -        }
  67.220 -
  67.221 -        String getConstantValue() {
  67.222 -            Object constantValue = folder.getAttribute("constantValue");
  67.223 -
  67.224 -            if (constantValue instanceof String) {
  67.225 -                return (String) constantValue;
  67.226 -            }
  67.227 -
  67.228 -            return null;
  67.229 -        }
  67.230 -    }
  67.231 -
  67.232 -    private static final Object MARKER = new Object();
  67.233 -    
  67.234 -    private static Object computeAttributeValue(ClassLoader loader, FileObject folder, String attributeName, Class<?> returnType, Object defaulValue) throws ClassNotFoundException {
  67.235 -        Object result = folder.getAttribute(attributeName);
  67.236 -
  67.237 -        if (result == null) {
  67.238 -            FileObject embedded = folder.getFileObject(attributeName);
  67.239 -
  67.240 -            if (embedded == null) {
  67.241 -                result = defaulValue;
  67.242 -            } else {
  67.243 -                if (returnType.isArray()) {
  67.244 -                    List<Object> items = new LinkedList<Object>();
  67.245 -                    int c = 0;
  67.246 -
  67.247 -                    while (true) {
  67.248 -                        Object val = computeAttributeValue(loader, embedded, "item" + c, returnType.getComponentType(), MARKER);
  67.249 -
  67.250 -                        if (val == MARKER) {
  67.251 -                            break;
  67.252 -                        }
  67.253 -
  67.254 -                        items.add(val);
  67.255 -                        c++;
  67.256 -                    }
  67.257 -
  67.258 -                    Object res = Array.newInstance(returnType.getComponentType(), items.size());
  67.259 -                    int ci = 0;
  67.260 -
  67.261 -                    for (Object i : items) {
  67.262 -                        Array.set(res, ci++, i);
  67.263 -                    }
  67.264 -
  67.265 -                    result = res;
  67.266 -                } else if (returnType.isAnnotation()) {
  67.267 -                    result = loadAnnotation(loader, embedded.getChildren()[0]);
  67.268 -                }
  67.269 -            }
  67.270 -        } else {
  67.271 -            if (returnType.isEnum()) {
  67.272 -                String fqn = (String) result;
  67.273 -                int lastDot = fqn.lastIndexOf('.');
  67.274 -                Class<? extends Enum> enumClass = (Class<? extends Enum>) loader.loadClass(fqn.substring(0, lastDot));
  67.275 -
  67.276 -                result = Enum.valueOf(enumClass, fqn.substring(lastDot + 1));
  67.277 -            } else if (returnType == Class.class) {
  67.278 -                String fqn = (String) result;
  67.279 -
  67.280 -                try {
  67.281 -                    result = loader.loadClass(fqn);
  67.282 -                } catch (ClassNotFoundException ex) {
  67.283 -                    Logger.getLogger(FSWrapper.class.getName()).log(Level.FINE, null, ex);
  67.284 -                    result = CodeHintProviderImpl.findLoader().loadClass(fqn);
  67.285 -                }
  67.286 -            }
  67.287 -        }
  67.288 -
  67.289 -        return result;
  67.290 -    }
  67.291 -
  67.292 -    
  67.293 -    private static <T extends Annotation> T loadAnnotation(ClassLoader l, FileObject annotationFolder) throws ClassNotFoundException {
  67.294 -        Class<?> clazz = l.loadClass(annotationFolder.getName().replace('-', '.'));
  67.295 -
  67.296 -        return (T) Proxy.newProxyInstance(l, new Class[] {clazz}, new InvocationHandlerImpl(l, annotationFolder));
  67.297 -    }
  67.298 -    
  67.299 -    private static final class InvocationHandlerImpl implements InvocationHandler {
  67.300 -
  67.301 -        private final ClassLoader loader;
  67.302 -        private final FileObject folder;
  67.303 -        private final Map<String, Object> attributes = new HashMap<String, Object>();
  67.304 -
  67.305 -        public InvocationHandlerImpl(ClassLoader loader, FileObject folder) {
  67.306 -            this.loader = loader;
  67.307 -            this.folder = folder;
  67.308 -        }
  67.309 -
  67.310 -        public synchronized Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
  67.311 -            if (!attributes.containsKey(method.getName())) {
  67.312 -                Object result = computeAttributeValue(loader, folder, method.getName(), method.getReturnType(), method.getDefaultValue());
  67.313 -
  67.314 -                attributes.put(method.getName(), result);
  67.315 -            }
  67.316 -
  67.317 -            return attributes.get(method.getName());
  67.318 -        }
  67.319 -
  67.320 -    }
  67.321 -
  67.322 -}
    68.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/code/ReflectiveCustomizerProvider.java	Sun Jan 08 20:10:08 2017 +0100
    68.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.3 @@ -1,261 +0,0 @@
    68.4 -/*
    68.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    68.6 - *
    68.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
    68.8 - *
    68.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   68.10 - * Other names may be trademarks of their respective owners.
   68.11 - *
   68.12 - * The contents of this file are subject to the terms of either the GNU
   68.13 - * General Public License Version 2 only ("GPL") or the Common
   68.14 - * Development and Distribution License("CDDL") (collectively, the
   68.15 - * "License"). You may not use this file except in compliance with the
   68.16 - * License. You can obtain a copy of the License at
   68.17 - * http://www.netbeans.org/cddl-gplv2.html
   68.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   68.19 - * specific language governing permissions and limitations under the
   68.20 - * License.  When distributing the software, include this License Header
   68.21 - * Notice in each file and include the License file at
   68.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   68.23 - * particular file as subject to the "Classpath" exception as provided
   68.24 - * by Oracle in the GPL Version 2 section of the License file that
   68.25 - * accompanied this code. If applicable, add the following below the
   68.26 - * License Header, with the fields enclosed by brackets [] replaced by
   68.27 - * your own identifying information:
   68.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   68.29 - *
   68.30 - * If you wish your version of this file to be governed by only the CDDL
   68.31 - * or only the GPL Version 2, indicate your decision by adding
   68.32 - * "[Contributor] elects to include this software in this distribution
   68.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   68.34 - * single choice of license, a recipient has the option to distribute
   68.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   68.36 - * to extend the choice of license to its licensees as provided above.
   68.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   68.38 - * Version 2 license, then the option applies only if the new code is
   68.39 - * made subject to such option by the copyright holder.
   68.40 - *
   68.41 - * Contributor(s):
   68.42 - *
   68.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
   68.44 - */
   68.45 -package org.netbeans.modules.java.hints.providers.code;
   68.46 -
   68.47 -import java.awt.GridBagConstraints;
   68.48 -import java.awt.GridBagLayout;
   68.49 -import java.awt.Insets;
   68.50 -import java.awt.event.ActionEvent;
   68.51 -import java.awt.event.ActionListener;
   68.52 -import java.util.List;
   68.53 -import java.util.prefs.Preferences;
   68.54 -import javax.swing.JCheckBox;
   68.55 -import javax.swing.JComponent;
   68.56 -import javax.swing.JFormattedTextField;
   68.57 -import javax.swing.JLabel;
   68.58 -import javax.swing.JPanel;
   68.59 -import javax.swing.JSpinner;
   68.60 -import javax.swing.SpinnerNumberModel;
   68.61 -import javax.swing.event.ChangeEvent;
   68.62 -import javax.swing.event.ChangeListener;
   68.63 -import javax.swing.text.NumberFormatter;
   68.64 -import org.netbeans.spi.java.hints.BooleanOption;
   68.65 -import org.netbeans.spi.java.hints.CustomizerProvider;
   68.66 -import org.netbeans.spi.java.hints.IntegerOption;
   68.67 -import org.openide.util.Exceptions;
   68.68 -
   68.69 -/**
   68.70 - *
   68.71 - * @author lahvac
   68.72 - */
   68.73 -public class ReflectiveCustomizerProvider implements CustomizerProvider {
   68.74 -    private final String hintClassName;
   68.75 -    private final String hintId;
   68.76 -    private final List<OptionDescriptor> options;
   68.77 -
   68.78 -    public ReflectiveCustomizerProvider(String hintClassName, String hintId, List<OptionDescriptor> options) {
   68.79 -        this.hintClassName = hintClassName;
   68.80 -        this.hintId = hintId;
   68.81 -        this.options = options;
   68.82 -    }
   68.83 -
   68.84 -    @Override
   68.85 -    public JComponent getCustomizer(Preferences prefs) {
   68.86 -        return new CustomizerImpl(prefs, hintClassName, hintId, options);
   68.87 -    }
   68.88 -
   68.89 -    private static final class CustomizerImpl extends JPanel {
   68.90 -        private int row;
   68.91 -        
   68.92 -        public CustomizerImpl(Preferences prefs, String hintClassName, String hintId, List<OptionDescriptor> options) {
   68.93 -            try {
   68.94 -                setLayout(new GridBagLayout());
   68.95 -                row = 0;
   68.96 -                
   68.97 -                for (OptionDescriptor option : options) {
   68.98 -                    if (option.parameters instanceof IntegerOption) {
   68.99 -                        createIntegerOption(option, prefs);
  68.100 -                    }
  68.101 -                }
  68.102 -
  68.103 -                for (OptionDescriptor option : options) {
  68.104 -                    if (option.parameters instanceof BooleanOption) {
  68.105 -                        createBooleanOption(option, prefs);
  68.106 -                    }
  68.107 -                }
  68.108 -
  68.109 -                GridBagConstraints constraints = new GridBagConstraints();
  68.110 -
  68.111 -                constraints.anchor = GridBagConstraints.NORTHWEST;
  68.112 -                constraints.fill = GridBagConstraints.BOTH;
  68.113 -                constraints.gridheight = 1;
  68.114 -                constraints.gridwidth = GridBagConstraints.REMAINDER;
  68.115 -                constraints.gridx = 0;
  68.116 -                constraints.gridy = row++;
  68.117 -                constraints.weightx = 1;
  68.118 -                constraints.weighty = 1;
  68.119 -
  68.120 -                add(new JPanel(), constraints);
  68.121 -            } catch (IllegalArgumentException ex) {
  68.122 -                Exceptions.printStackTrace(ex);
  68.123 -            } catch (SecurityException ex) {
  68.124 -                Exceptions.printStackTrace(ex);
  68.125 -            }
  68.126 -        }
  68.127 -        
  68.128 -        private void createIntegerOption(OptionDescriptor option, Preferences prefs) {
  68.129 -            IntegerOption iopt = (IntegerOption)option.parameters;
  68.130 -            JLabel l = new JLabel();
  68.131 -            org.openide.awt.Mnemonics.setLocalizedText(l, option.displayName + ":");
  68.132 -            
  68.133 -            GridBagConstraints constraints = new GridBagConstraints();
  68.134 -            constraints.anchor = GridBagConstraints.WEST;
  68.135 -            constraints.fill = GridBagConstraints.NONE;
  68.136 -            constraints.gridheight = 1;
  68.137 -            constraints.gridwidth = 1;
  68.138 -            constraints.gridx = 0;
  68.139 -            constraints.gridy = row;
  68.140 -            constraints.weightx = 0;
  68.141 -            constraints.weighty = 0;
  68.142 -            constraints.insets = new Insets(0, 0, 0, 8);
  68.143 -            
  68.144 -            add(l, constraints);
  68.145 -            
  68.146 -            JComponent field;
  68.147 -            int val = prefs.getInt(option.preferencesKey, ((Integer)option.defaultValue).intValue());
  68.148 -            if (iopt.step() > 0) {
  68.149 -                val = Math.min(iopt.maxValue(), Math.max(iopt.minValue(), val));
  68.150 -                JSpinner spinner = new JSpinner(
  68.151 -                        new SpinnerNumberModel(val, iopt.minValue(), iopt.maxValue(), iopt.step()));
  68.152 -                spinner.addChangeListener(new ActionListenerImpl(option.preferencesKey, prefs));
  68.153 -                field = spinner;
  68.154 -            } else {
  68.155 -                NumberFormatter nf = new NumberFormatter();
  68.156 -                nf.setValueClass(Integer.class);
  68.157 -                nf.setMaximum(iopt.maxValue());
  68.158 -                nf.setMinimum(iopt.minValue());
  68.159 -                JFormattedTextField formatted = new JFormattedTextField(nf);
  68.160 -                field = formatted;
  68.161 -            }
  68.162 -            if (option.tooltip != null && !option.tooltip.isEmpty()) {
  68.163 -                field.setToolTipText(option.tooltip);
  68.164 -            }
  68.165 -            constraints = new GridBagConstraints();
  68.166 -            constraints.anchor = GridBagConstraints.WEST;
  68.167 -            constraints.fill = GridBagConstraints.HORIZONTAL;
  68.168 -            constraints.gridheight = 1;
  68.169 -            constraints.gridwidth = 1;
  68.170 -            constraints.gridx = 1;
  68.171 -            constraints.gridy = row;
  68.172 -            constraints.weightx = 0;
  68.173 -            constraints.weighty = 0;
  68.174 -            
  68.175 -            add(field, constraints);
  68.176 -
  68.177 -            constraints = new GridBagConstraints();
  68.178 -            constraints.anchor = GridBagConstraints.WEST;
  68.179 -            constraints.fill = GridBagConstraints.HORIZONTAL;
  68.180 -            constraints.gridheight = 1;
  68.181 -            constraints.gridwidth = GridBagConstraints.REMAINDER;
  68.182 -            constraints.gridx = 2;
  68.183 -            constraints.gridy = row++;
  68.184 -            constraints.weightx = 1;
  68.185 -            constraints.weighty = 0;
  68.186 -            
  68.187 -            add(new JPanel(), constraints);
  68.188 -        }
  68.189 -        
  68.190 -        private JComponent createBooleanOption(OptionDescriptor option, Preferences prefs)  {
  68.191 -            JCheckBox checkBox = new JCheckBox();
  68.192 -
  68.193 -            org.openide.awt.Mnemonics.setLocalizedText(checkBox, option.displayName);
  68.194 -            checkBox.setToolTipText(option.tooltip);
  68.195 -            checkBox.addActionListener(new ActionListenerImpl(option.preferencesKey, prefs));
  68.196 -
  68.197 -            checkBox.setSelected(prefs.getBoolean(option.preferencesKey, 
  68.198 -                    Boolean.TRUE == option.defaultValue));
  68.199 -            GridBagConstraints constraints = new GridBagConstraints();
  68.200 -
  68.201 -            constraints.anchor = GridBagConstraints.WEST;
  68.202 -            constraints.fill = GridBagConstraints.NONE;
  68.203 -            constraints.gridheight = 1;
  68.204 -            constraints.gridwidth = 2;
  68.205 -            constraints.gridx = 0;
  68.206 -            constraints.gridy = row++;
  68.207 -            constraints.weightx = 0;
  68.208 -            constraints.weighty = 0;
  68.209 -
  68.210 -            add(checkBox, constraints);
  68.211 -            return checkBox;
  68.212 -        }
  68.213 -                
  68.214 -        
  68.215 -        private static final class ActionListenerImpl implements ActionListener, ChangeListener {
  68.216 -            private final String key;
  68.217 -            private final Preferences prefs;
  68.218 -
  68.219 -            public ActionListenerImpl(String key, Preferences prefs) {
  68.220 -                this.key = key;
  68.221 -                this.prefs = prefs;
  68.222 -            }
  68.223 -
  68.224 -            @Override
  68.225 -            public void actionPerformed(ActionEvent e) {
  68.226 -                JCheckBox checkBox = ((JCheckBox)e.getSource());
  68.227 -                prefs.putBoolean(key, checkBox.isSelected());
  68.228 -            }
  68.229 -
  68.230 -            @Override
  68.231 -            public void stateChanged(ChangeEvent e) {
  68.232 -                Integer i = (Integer)((JSpinner)e.getSource()).getValue();
  68.233 -                prefs.putInt(key, i);
  68.234 -            }
  68.235 -
  68.236 -        }
  68.237 -        
  68.238 -    }
  68.239 -
  68.240 -    public static final class OptionDescriptor {
  68.241 -        public final String preferencesKey;
  68.242 -        public final Object defaultValue;
  68.243 -        public final String displayName;
  68.244 -        public final String tooltip;
  68.245 -        /**
  68.246 -         * The original Annotation object, type-specific parameters.
  68.247 -         */
  68.248 -        public final Object parameters;
  68.249 -
  68.250 -        public OptionDescriptor(
  68.251 -                String preferencesKey, 
  68.252 -                Object defaultValue, 
  68.253 -                String displayName, String tooltip, 
  68.254 -                Object parameters) {
  68.255 -            this.preferencesKey = preferencesKey;
  68.256 -            this.defaultValue = defaultValue;
  68.257 -            this.displayName = displayName;
  68.258 -            this.tooltip = tooltip;
  68.259 -            this.parameters = parameters;
  68.260 -        }
  68.261 -
  68.262 -    }
  68.263 -
  68.264 -}
    69.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/ClassPathBasedHintProvider.java	Sun Jan 08 20:10:08 2017 +0100
    69.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.3 @@ -1,57 +0,0 @@
    69.4 -/*
    69.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    69.6 - *
    69.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    69.8 - *
    69.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   69.10 - * Other names may be trademarks of their respective owners.
   69.11 - *
   69.12 - * The contents of this file are subject to the terms of either the GNU
   69.13 - * General Public License Version 2 only ("GPL") or the Common
   69.14 - * Development and Distribution License("CDDL") (collectively, the
   69.15 - * "License"). You may not use this file except in compliance with the
   69.16 - * License. You can obtain a copy of the License at
   69.17 - * http://www.netbeans.org/cddl-gplv2.html
   69.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   69.19 - * specific language governing permissions and limitations under the
   69.20 - * License.  When distributing the software, include this License Header
   69.21 - * Notice in each file and include the License file at
   69.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   69.23 - * particular file as subject to the "Classpath" exception as provided
   69.24 - * by Oracle in the GPL Version 2 section of the License file that
   69.25 - * accompanied this code. If applicable, add the following below the
   69.26 - * License Header, with the fields enclosed by brackets [] replaced by
   69.27 - * your own identifying information:
   69.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   69.29 - *
   69.30 - * If you wish your version of this file to be governed by only the CDDL
   69.31 - * or only the GPL Version 2, indicate your decision by adding
   69.32 - * "[Contributor] elects to include this software in this distribution
   69.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   69.34 - * single choice of license, a recipient has the option to distribute
   69.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   69.36 - * to extend the choice of license to its licensees as provided above.
   69.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   69.38 - * Version 2 license, then the option applies only if the new code is
   69.39 - * made subject to such option by the copyright holder.
   69.40 - *
   69.41 - * Contributor(s):
   69.42 - *
   69.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   69.44 - */
   69.45 -
   69.46 -package org.netbeans.modules.java.hints.providers.spi;
   69.47 -
   69.48 -import java.util.Collection;
   69.49 -import org.netbeans.api.java.classpath.ClassPath;
   69.50 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   69.51 -
   69.52 -/**
   69.53 - * XXX: this is another ugly hack!
   69.54 - * @author lahvac
   69.55 - */
   69.56 -public interface ClassPathBasedHintProvider {
   69.57 -
   69.58 -    public Collection<? extends HintDescription> computeHints(ClassPath cp);
   69.59 -
   69.60 -}
    70.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/ElementBasedHintProvider.java	Sun Jan 08 20:10:08 2017 +0100
    70.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.3 @@ -1,57 +0,0 @@
    70.4 -/*
    70.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    70.6 - *
    70.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    70.8 - *
    70.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   70.10 - * Other names may be trademarks of their respective owners.
   70.11 - *
   70.12 - * The contents of this file are subject to the terms of either the GNU
   70.13 - * General Public License Version 2 only ("GPL") or the Common
   70.14 - * Development and Distribution License("CDDL") (collectively, the
   70.15 - * "License"). You may not use this file except in compliance with the
   70.16 - * License. You can obtain a copy of the License at
   70.17 - * http://www.netbeans.org/cddl-gplv2.html
   70.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   70.19 - * specific language governing permissions and limitations under the
   70.20 - * License.  When distributing the software, include this License Header
   70.21 - * Notice in each file and include the License file at
   70.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   70.23 - * particular file as subject to the "Classpath" exception as provided
   70.24 - * by Oracle in the GPL Version 2 section of the License file that
   70.25 - * accompanied this code. If applicable, add the following below the
   70.26 - * License Header, with the fields enclosed by brackets [] replaced by
   70.27 - * your own identifying information:
   70.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   70.29 - *
   70.30 - * If you wish your version of this file to be governed by only the CDDL
   70.31 - * or only the GPL Version 2, indicate your decision by adding
   70.32 - * "[Contributor] elects to include this software in this distribution
   70.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   70.34 - * single choice of license, a recipient has the option to distribute
   70.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   70.36 - * to extend the choice of license to its licensees as provided above.
   70.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   70.38 - * Version 2 license, then the option applies only if the new code is
   70.39 - * made subject to such option by the copyright holder.
   70.40 - *
   70.41 - * Contributor(s):
   70.42 - *
   70.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   70.44 - */
   70.45 -
   70.46 -package org.netbeans.modules.java.hints.providers.spi;
   70.47 -
   70.48 -import java.util.Collection;
   70.49 -import org.netbeans.api.java.source.CompilationInfo;
   70.50 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   70.51 -
   70.52 -/**
   70.53 - * XXX: this is an ugly hack!
   70.54 - * @author lahvac
   70.55 - */
   70.56 -public interface ElementBasedHintProvider {
   70.57 -
   70.58 -    public Collection<? extends HintDescription> computeHints(CompilationInfo info);
   70.59 -
   70.60 -}
    71.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/HintDescription.java	Sun Jan 08 20:10:08 2017 +0100
    71.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.3 @@ -1,127 +0,0 @@
    71.4 -/*
    71.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    71.6 - *
    71.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
    71.8 - *
    71.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   71.10 - * Other names may be trademarks of their respective owners.
   71.11 - *
   71.12 - * The contents of this file are subject to the terms of either the GNU
   71.13 - * General Public License Version 2 only ("GPL") or the Common
   71.14 - * Development and Distribution License("CDDL") (collectively, the
   71.15 - * "License"). You may not use this file except in compliance with the
   71.16 - * License. You can obtain a copy of the License at
   71.17 - * http://www.netbeans.org/cddl-gplv2.html
   71.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   71.19 - * specific language governing permissions and limitations under the
   71.20 - * License.  When distributing the software, include this License Header
   71.21 - * Notice in each file and include the License file at
   71.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   71.23 - * particular file as subject to the "Classpath" exception as provided
   71.24 - * by Oracle in the GPL Version 2 section of the License file that
   71.25 - * accompanied this code. If applicable, add the following below the
   71.26 - * License Header, with the fields enclosed by brackets [] replaced by
   71.27 - * your own identifying information:
   71.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   71.29 - *
   71.30 - * If you wish your version of this file to be governed by only the CDDL
   71.31 - * or only the GPL Version 2, indicate your decision by adding
   71.32 - * "[Contributor] elects to include this software in this distribution
   71.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   71.34 - * single choice of license, a recipient has the option to distribute
   71.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   71.36 - * to extend the choice of license to its licensees as provided above.
   71.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   71.38 - * Version 2 license, then the option applies only if the new code is
   71.39 - * made subject to such option by the copyright holder.
   71.40 - *
   71.41 - * Contributor(s):
   71.42 - *
   71.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
   71.44 - */
   71.45 -
   71.46 -package org.netbeans.modules.java.hints.providers.spi;
   71.47 -
   71.48 -import java.util.Collection;
   71.49 -import java.util.Collections;
   71.50 -import java.util.HashSet;
   71.51 -import java.util.Set;
   71.52 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata.Options;
   71.53 -import org.netbeans.spi.editor.hints.ErrorDescription;
   71.54 -import org.netbeans.spi.java.hints.HintContext;
   71.55 -
   71.56 -/**
   71.57 - *
   71.58 - * @author Jan Lahoda
   71.59 - */
   71.60 -public final class HintDescription {
   71.61 -
   71.62 -    private final HintMetadata metadata;
   71.63 -    private final Trigger trigger;
   71.64 -    private final Worker worker;
   71.65 -    private final AdditionalQueryConstraints additionalConstraints;
   71.66 -    private final String hintText;
   71.67 -    private final Set<Options> options;
   71.68 -
   71.69 -    private HintDescription(HintMetadata metadata, Trigger trigger, Worker worker, AdditionalQueryConstraints additionalConstraints, String hintText, Set<Options> options) {
   71.70 -        this.metadata = metadata;
   71.71 -        this.trigger = trigger;
   71.72 -        this.worker = worker;
   71.73 -        this.additionalConstraints = additionalConstraints;
   71.74 -        this.hintText = hintText;
   71.75 -        this.options = options;
   71.76 -    }
   71.77 -
   71.78 -    static HintDescription create(HintMetadata metadata, Trigger trigger, Worker worker, AdditionalQueryConstraints additionalConstraints, String hintText, Set<Options> options) {
   71.79 -        return new HintDescription(metadata, trigger, worker, additionalConstraints, hintText, options);
   71.80 -    }
   71.81 -
   71.82 -    @Override
   71.83 -    public String toString() {
   71.84 -        return "[HintDescription:" + trigger + "]";
   71.85 -    }
   71.86 -
   71.87 -    public AdditionalQueryConstraints getAdditionalConstraints() {
   71.88 -        return additionalConstraints;
   71.89 -    }
   71.90 -
   71.91 -    public String getHintText() {
   71.92 -        return hintText;
   71.93 -    }
   71.94 -
   71.95 -    public HintMetadata getMetadata() {
   71.96 -        return metadata;
   71.97 -    }
   71.98 -
   71.99 -    public Trigger getTrigger() {
  71.100 -        return trigger;
  71.101 -    }
  71.102 -
  71.103 -    public Worker getWorker() {
  71.104 -        return worker;
  71.105 -    }
  71.106 -
  71.107 -    public Set<Options> getOptions() {
  71.108 -        return options;
  71.109 -    }
  71.110 -
  71.111 -    public static interface Worker {
  71.112 -
  71.113 -        public Collection<? extends ErrorDescription> createErrors(HintContext ctx);
  71.114 -
  71.115 -    }
  71.116 -
  71.117 -    public static final class AdditionalQueryConstraints {
  71.118 -        public final Set<String> requiredErasedTypes;
  71.119 -
  71.120 -        public AdditionalQueryConstraints(Set<String> requiredErasedTypes) {
  71.121 -            this.requiredErasedTypes = Collections.unmodifiableSet(new HashSet<String>(requiredErasedTypes));
  71.122 -        }
  71.123 -
  71.124 -        private static final AdditionalQueryConstraints EMPTY = new AdditionalQueryConstraints(Collections.<String>emptySet());
  71.125 -        public static AdditionalQueryConstraints empty() {
  71.126 -            return EMPTY;
  71.127 -        }
  71.128 -    }
  71.129 -
  71.130 -}
    72.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/HintDescriptionFactory.java	Sun Jan 08 20:10:08 2017 +0100
    72.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.3 @@ -1,127 +0,0 @@
    72.4 -/*
    72.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    72.6 - *
    72.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
    72.8 - *
    72.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   72.10 - * Other names may be trademarks of their respective owners.
   72.11 - *
   72.12 - * The contents of this file are subject to the terms of either the GNU
   72.13 - * General Public License Version 2 only ("GPL") or the Common
   72.14 - * Development and Distribution License("CDDL") (collectively, the
   72.15 - * "License"). You may not use this file except in compliance with the
   72.16 - * License. You can obtain a copy of the License at
   72.17 - * http://www.netbeans.org/cddl-gplv2.html
   72.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   72.19 - * specific language governing permissions and limitations under the
   72.20 - * License.  When distributing the software, include this License Header
   72.21 - * Notice in each file and include the License file at
   72.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   72.23 - * particular file as subject to the "Classpath" exception as provided
   72.24 - * by Oracle in the GPL Version 2 section of the License file that
   72.25 - * accompanied this code. If applicable, add the following below the
   72.26 - * License Header, with the fields enclosed by brackets [] replaced by
   72.27 - * your own identifying information:
   72.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   72.29 - *
   72.30 - * If you wish your version of this file to be governed by only the CDDL
   72.31 - * or only the GPL Version 2, indicate your decision by adding
   72.32 - * "[Contributor] elects to include this software in this distribution
   72.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   72.34 - * single choice of license, a recipient has the option to distribute
   72.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   72.36 - * to extend the choice of license to its licensees as provided above.
   72.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   72.38 - * Version 2 license, then the option applies only if the new code is
   72.39 - * made subject to such option by the copyright holder.
   72.40 - *
   72.41 - * Contributor(s):
   72.42 - *
   72.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
   72.44 - */
   72.45 -
   72.46 -package org.netbeans.modules.java.hints.providers.spi;
   72.47 -
   72.48 -import java.util.Arrays;
   72.49 -import java.util.Collections;
   72.50 -import java.util.EnumSet;
   72.51 -import java.util.Set;
   72.52 -import org.netbeans.api.annotations.common.NonNull;
   72.53 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.AdditionalQueryConstraints;
   72.54 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.Worker;
   72.55 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata.Options;
   72.56 -
   72.57 -/**
   72.58 - *
   72.59 - * @author lahvac
   72.60 - */
   72.61 -public class HintDescriptionFactory {
   72.62 -
   72.63 -    private       HintMetadata metadata;
   72.64 -    private       Trigger trigger;
   72.65 -    private       Worker worker;
   72.66 -    private       AdditionalQueryConstraints additionalConstraints;
   72.67 -    private       String hintText;
   72.68 -    private       Set<Options> options;
   72.69 -    private       boolean finished;
   72.70 -
   72.71 -    private HintDescriptionFactory() {
   72.72 -    }
   72.73 -
   72.74 -    public static HintDescriptionFactory create() {
   72.75 -        return new HintDescriptionFactory();
   72.76 -    }
   72.77 -
   72.78 -    /**TODO: move to create?
   72.79 -     *
   72.80 -     * @param metadata
   72.81 -     * @return
   72.82 -     */
   72.83 -    public HintDescriptionFactory setMetadata(HintMetadata metadata) {
   72.84 -        this.metadata = metadata;
   72.85 -        return this;
   72.86 -    }
   72.87 -
   72.88 -    public HintDescriptionFactory setTrigger(Trigger trigger) {
   72.89 -        if (this.trigger != null) {
   72.90 -            throw new IllegalStateException(this.trigger.toString());
   72.91 -        }
   72.92 -
   72.93 -        this.trigger = trigger;
   72.94 -        return this;
   72.95 -    }
   72.96 -
   72.97 -    public HintDescriptionFactory setWorker(Worker worker) {
   72.98 -        this.worker = worker;
   72.99 -        return this;
  72.100 -    }
  72.101 -
  72.102 -    public HintDescriptionFactory setAdditionalConstraints(AdditionalQueryConstraints additionalConstraints) {
  72.103 -        this.additionalConstraints = additionalConstraints;
  72.104 -        return this;
  72.105 -    }
  72.106 -
  72.107 -    public HintDescriptionFactory setHintText(@NonNull String hintText) {
  72.108 -        this.hintText = hintText;
  72.109 -        return this;
  72.110 -    }
  72.111 -
  72.112 -    public HintDescriptionFactory addOptions(Options... options) {
  72.113 -        if (this.options == null) {
  72.114 -            this.options = EnumSet.noneOf(Options.class);
  72.115 -        }
  72.116 -        this.options.addAll(Arrays.asList(options));
  72.117 -        return this;
  72.118 -    }
  72.119 -        
  72.120 -    public HintDescription produce() {
  72.121 -        if (metadata == null) {
  72.122 -            metadata = HintMetadata.Builder.create("no-id").addOptions(Options.NON_GUI).build();
  72.123 -        }
  72.124 -        if (this.additionalConstraints == null) {
  72.125 -            this.additionalConstraints = AdditionalQueryConstraints.empty();
  72.126 -        }
  72.127 -        return HintDescription.create(metadata, trigger, worker, additionalConstraints, hintText, options != null ? options : Collections.<Options>emptySet());
  72.128 -    }
  72.129 -    
  72.130 -}
    73.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/HintMetadata.java	Sun Jan 08 20:10:08 2017 +0100
    73.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.3 @@ -1,224 +0,0 @@
    73.4 -/*
    73.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    73.6 - *
    73.7 - * Copyright 2010 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 2010 Sun Microsystems, Inc.
   73.44 - */
   73.45 -
   73.46 -package org.netbeans.modules.java.hints.providers.spi;
   73.47 -
   73.48 -import java.util.ArrayList;
   73.49 -import java.util.Arrays;
   73.50 -import java.util.Collection;
   73.51 -import java.util.EnumSet;
   73.52 -import java.util.HashSet;
   73.53 -import java.util.MissingResourceException;
   73.54 -import java.util.ResourceBundle;
   73.55 -import java.util.Set;
   73.56 -import java.util.logging.Level;
   73.57 -import java.util.logging.Logger;
   73.58 -import org.netbeans.spi.editor.hints.Severity;
   73.59 -import org.netbeans.spi.java.hints.CustomizerProvider;
   73.60 -import org.netbeans.spi.java.hints.Hint;
   73.61 -import org.openide.util.NbBundle;
   73.62 -
   73.63 -/**
   73.64 - *
   73.65 - * @author lahvac
   73.66 - */
   73.67 -public class HintMetadata {
   73.68 -
   73.69 -    public final String id;
   73.70 -    public final String displayName;
   73.71 -    public final String description;
   73.72 -    public final String category;
   73.73 -    public final boolean enabled;
   73.74 -    public final Hint.Kind kind;
   73.75 -    public final Severity severity;
   73.76 -    public final Collection<? extends String> suppressWarnings;
   73.77 -    public final CustomizerProvider customizer;
   73.78 -    public final boolean showInTaskList = false;
   73.79 -    public final Set<Options> options;
   73.80 -
   73.81 -    HintMetadata(String id, String displayName, String description, String category, boolean enabled, Hint.Kind kind, Severity severity, Collection<? extends String> suppressWarnings, CustomizerProvider customizer, Set<Options> options) {
   73.82 -        this.id = id;
   73.83 -        this.displayName = displayName;
   73.84 -        this.description = description;
   73.85 -        this.category = category;
   73.86 -        this.enabled = enabled;
   73.87 -        this.kind = kind;
   73.88 -        this.severity = severity;
   73.89 -        this.suppressWarnings = suppressWarnings;
   73.90 -        this.customizer = customizer;
   73.91 -        this.options = options;
   73.92 -    }
   73.93 -
   73.94 -    @Override
   73.95 -    public String toString() {
   73.96 -        return this.displayName;
   73.97 -    }
   73.98 -
   73.99 -    private static String lookup(ResourceBundle bundle, String key, String def) {
  73.100 -        try {
  73.101 -            return bundle != null ? bundle.getString(key) : def;
  73.102 -        } catch (MissingResourceException mre) {
  73.103 -            Logger.getLogger(HintMetadata.class.getName()).log(Level.FINE, null, mre);
  73.104 -            return def;
  73.105 -        }
  73.106 -    }
  73.107 -
  73.108 -    public static final class Builder {
  73.109 -        private final String id;
  73.110 -        private String displayName;
  73.111 -        private String description;
  73.112 -        private String category;
  73.113 -        private boolean enabled;
  73.114 -        private Hint.Kind kind;
  73.115 -        private Severity severity;
  73.116 -        private final Collection<String> suppressWarnings = new ArrayList<String>();
  73.117 -        private CustomizerProvider customizer;
  73.118 -        private final Set<Options> options = EnumSet.noneOf(Options.class);
  73.119 -
  73.120 -        private Builder(String id) {
  73.121 -            this.id = id;
  73.122 -            this.displayName = "";
  73.123 -            this.description = "";
  73.124 -            this.category = "";
  73.125 -            this.enabled = true;
  73.126 -            this.kind = Hint.Kind.INSPECTION;
  73.127 -            this.severity = Severity.VERIFIER;
  73.128 -        }
  73.129 -
  73.130 -        public static Builder create(String id) {
  73.131 -            return new Builder(id);
  73.132 -        }
  73.133 -
  73.134 -        public Builder setDescription(String displayName, String description) {
  73.135 -            this.displayName = displayName;
  73.136 -            this.description = description;
  73.137 -            return this;
  73.138 -        }
  73.139 -
  73.140 -        public Builder setBundle(ResourceBundle bundle) {
  73.141 -            return setBundle(bundle, null, null);
  73.142 -        }
  73.143 -
  73.144 -        public Builder setBundle(ResourceBundle bundle, String fallbackDisplayName, String fallbackDescription) {
  73.145 -            if (fallbackDisplayName == null) fallbackDisplayName = "No Display Name";
  73.146 -            if (fallbackDescription == null) fallbackDescription = "No Description";
  73.147 -            
  73.148 -            this.displayName = lookup(bundle, "DN_" + id.replace('$', '.'), fallbackDisplayName);
  73.149 -            this.description = lookup(bundle, "DESC_" + id.replace('$', '.'), fallbackDescription);
  73.150 -            return this;
  73.151 -        }
  73.152 -
  73.153 -        public Builder setBundle(String bundleForFQN) {
  73.154 -            ResourceBundle bundle;
  73.155 -
  73.156 -            try {
  73.157 -                int lastDot = bundleForFQN.lastIndexOf('.');
  73.158 -
  73.159 -                assert lastDot >= 0;
  73.160 -
  73.161 -                bundle = NbBundle.getBundle(bundleForFQN.substring(0, lastDot + 1) + "Bundle");
  73.162 -            } catch (MissingResourceException mre) {
  73.163 -                Logger.getLogger(HintMetadata.class.getName()).log(Level.FINE, null, mre);
  73.164 -                bundle = null;
  73.165 -            }
  73.166 -            return setBundle(bundle);
  73.167 -        }
  73.168 -
  73.169 -        public Builder setCategory(String category) {
  73.170 -            this.category = category;
  73.171 -            return this;
  73.172 -        }
  73.173 -
  73.174 -        public Builder setEnabled(boolean enabled) {
  73.175 -            this.enabled = enabled;
  73.176 -            return this;
  73.177 -        }
  73.178 -
  73.179 -        public Builder setKind(Hint.Kind kind) {
  73.180 -            this.kind = kind;
  73.181 -            return this;
  73.182 -        }
  73.183 -
  73.184 -        public Builder setSeverity(Severity severity) {
  73.185 -            this.severity = severity;
  73.186 -            return this;
  73.187 -        }
  73.188 -
  73.189 -
  73.190 -        public Builder addSuppressWarnings(String... keys) {
  73.191 -            this.suppressWarnings.addAll(Arrays.asList(keys));
  73.192 -            return this;
  73.193 -        }
  73.194 -
  73.195 -        public Builder setCustomizerProvider(CustomizerProvider customizer) {
  73.196 -            this.customizer = customizer;
  73.197 -            return this;
  73.198 -        }
  73.199 -
  73.200 -        public Builder addOptions(Options... options) {
  73.201 -            this.options.addAll(Arrays.asList(options));
  73.202 -            return this;
  73.203 -        }
  73.204 -
  73.205 -        public HintMetadata build() {
  73.206 -            return new HintMetadata(id, displayName, description, category, enabled, kind, severity, suppressWarnings, customizer, options);
  73.207 -        }
  73.208 -
  73.209 -    }
  73.210 -
  73.211 -    public enum Options {
  73.212 -        NON_GUI,
  73.213 -        QUERY,
  73.214 -        NO_BATCH,
  73.215 -        HEAVY;
  73.216 -
  73.217 -        public static Set<Options> fromHintOptions(Hint.Options... options) {
  73.218 -            Set<Options> result = new HashSet<Options>();
  73.219 -
  73.220 -            for (Hint.Options opt : options) {
  73.221 -                result.add(valueOf(opt.name()));
  73.222 -            }
  73.223 -
  73.224 -            return result;
  73.225 -        }
  73.226 -    }
  73.227 -}
    74.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/HintProvider.java	Sun Jan 08 20:10:08 2017 +0100
    74.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.3 @@ -1,54 +0,0 @@
    74.4 -/*
    74.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    74.6 - *
    74.7 - * Copyright 2009-2010 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 2009-2010 Sun Microsystems, Inc.
   74.44 - */
   74.45 -
   74.46 -package org.netbeans.modules.java.hints.providers.spi;
   74.47 -
   74.48 -import java.util.Collection;
   74.49 -import java.util.Map;
   74.50 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   74.51 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
   74.52 -
   74.53 -public interface HintProvider {
   74.54 -
   74.55 -    public Map<HintMetadata, ? extends Collection<? extends HintDescription>> computeHints();
   74.56 -
   74.57 -}
    75.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/PositionRefresherHelper.java	Sun Jan 08 20:10:08 2017 +0100
    75.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.3 @@ -1,105 +0,0 @@
    75.4 -/*
    75.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    75.6 - *
    75.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
    75.8 - *
    75.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   75.10 - * Other names may be trademarks of their respective owners.
   75.11 - *
   75.12 - * The contents of this file are subject to the terms of either the GNU
   75.13 - * General Public License Version 2 only ("GPL") or the Common
   75.14 - * Development and Distribution License("CDDL") (collectively, the
   75.15 - * "License"). You may not use this file except in compliance with the
   75.16 - * License. You can obtain a copy of the License at
   75.17 - * http://www.netbeans.org/cddl-gplv2.html
   75.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   75.19 - * specific language governing permissions and limitations under the
   75.20 - * License.  When distributing the software, include this License Header
   75.21 - * Notice in each file and include the License file at
   75.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   75.23 - * particular file as subject to the "Classpath" exception as provided
   75.24 - * by Oracle in the GPL Version 2 section of the License file that
   75.25 - * accompanied this code. If applicable, add the following below the
   75.26 - * License Header, with the fields enclosed by brackets [] replaced by
   75.27 - * your own identifying information:
   75.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   75.29 - *
   75.30 - * If you wish your version of this file to be governed by only the CDDL
   75.31 - * or only the GPL Version 2, indicate your decision by adding
   75.32 - * "[Contributor] elects to include this software in this distribution
   75.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   75.34 - * single choice of license, a recipient has the option to distribute
   75.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   75.36 - * to extend the choice of license to its licensees as provided above.
   75.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   75.38 - * Version 2 license, then the option applies only if the new code is
   75.39 - * made subject to such option by the copyright holder.
   75.40 - *
   75.41 - * Contributor(s):
   75.42 - *
   75.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
   75.44 - */
   75.45 -package org.netbeans.modules.java.hints.providers.spi;
   75.46 -
   75.47 -import java.util.List;
   75.48 -import javax.swing.text.Document;
   75.49 -import org.netbeans.api.annotations.common.CheckForNull;
   75.50 -import org.netbeans.api.java.source.CompilationInfo;
   75.51 -import org.netbeans.lib.editor.util.swing.DocumentUtilities;
   75.52 -import org.netbeans.spi.editor.hints.Context;
   75.53 -import org.netbeans.spi.editor.hints.ErrorDescription;
   75.54 -import org.netbeans.modules.java.hints.providers.spi.PositionRefresherHelper.DocumentVersion;
   75.55 -
   75.56 -/**TODO: should be public?
   75.57 - *
   75.58 - * @author lahvac
   75.59 - */
   75.60 -public abstract class PositionRefresherHelper<V extends DocumentVersion> {
   75.61 -
   75.62 -    private final Object documentKey = new Object();
   75.63 -    private final String key;
   75.64 -
   75.65 -    protected PositionRefresherHelper(String key) {
   75.66 -        this.key = key;
   75.67 -    }
   75.68 -
   75.69 -    protected abstract boolean isUpToDate(Context context, Document doc, V oldVersion);
   75.70 -    /**XXX: should be protected*/public abstract @CheckForNull List<ErrorDescription> getErrorDescriptionsAt(CompilationInfo info, Context context, Document doc) throws Exception;
   75.71 -
   75.72 -    protected final void setVersion(Document doc, V version) {
   75.73 -        if (doc != null) {
   75.74 -            doc.putProperty(documentKey, version);
   75.75 -        }
   75.76 -    }
   75.77 -
   75.78 -    protected @CheckForNull V getUpToDateDocumentVersion(Context context, Document doc) {
   75.79 -        V oldVersion = (V) doc.getProperty(documentKey);
   75.80 -
   75.81 -        if (oldVersion == null) return null;
   75.82 -
   75.83 -        if (((DocumentVersion) oldVersion).version != DocumentUtilities.getDocumentVersion(doc)) return null;
   75.84 -        
   75.85 -        return oldVersion;
   75.86 -    }
   75.87 -    
   75.88 -    /**XXX*/ public boolean upToDateCheck(Context context, Document doc) {
   75.89 -        V oldVersion = getUpToDateDocumentVersion(context, doc);
   75.90 -
   75.91 -        if (oldVersion == null) return false;
   75.92 -
   75.93 -        return isUpToDate(context, doc, oldVersion);
   75.94 -    }
   75.95 -
   75.96 -    /**XXX*/ public String getKey() {
   75.97 -        return key;
   75.98 -    }
   75.99 -
  75.100 -    public static class DocumentVersion {
  75.101 -        private final long version;
  75.102 -
  75.103 -        public DocumentVersion(Document doc) {
  75.104 -            this.version = doc != null ? DocumentUtilities.getDocumentVersion(doc) : 0;
  75.105 -        }
  75.106 -
  75.107 -    }
  75.108 -}
    76.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/providers/spi/Trigger.java	Sun Jan 08 20:10:08 2017 +0100
    76.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.3 @@ -1,171 +0,0 @@
    76.4 -/*
    76.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    76.6 - *
    76.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    76.8 - *
    76.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   76.10 - * Other names may be trademarks of their respective owners.
   76.11 - *
   76.12 - * The contents of this file are subject to the terms of either the GNU
   76.13 - * General Public License Version 2 only ("GPL") or the Common
   76.14 - * Development and Distribution License("CDDL") (collectively, the
   76.15 - * "License"). You may not use this file except in compliance with the
   76.16 - * License. You can obtain a copy of the License at
   76.17 - * http://www.netbeans.org/cddl-gplv2.html
   76.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   76.19 - * specific language governing permissions and limitations under the
   76.20 - * License.  When distributing the software, include this License Header
   76.21 - * Notice in each file and include the License file at
   76.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   76.23 - * particular file as subject to the "Classpath" exception as provided
   76.24 - * by Oracle in the GPL Version 2 section of the License file that
   76.25 - * accompanied this code. If applicable, add the following below the
   76.26 - * License Header, with the fields enclosed by brackets [] replaced by
   76.27 - * your own identifying information:
   76.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   76.29 - *
   76.30 - * If you wish your version of this file to be governed by only the CDDL
   76.31 - * or only the GPL Version 2, indicate your decision by adding
   76.32 - * "[Contributor] elects to include this software in this distribution
   76.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   76.34 - * single choice of license, a recipient has the option to distribute
   76.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   76.36 - * to extend the choice of license to its licensees as provided above.
   76.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   76.38 - * Version 2 license, then the option applies only if the new code is
   76.39 - * made subject to such option by the copyright holder.
   76.40 - *
   76.41 - * Contributor(s):
   76.42 - *
   76.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
   76.44 - */
   76.45 -package org.netbeans.modules.java.hints.providers.spi;
   76.46 -
   76.47 -import com.sun.source.tree.Tree.Kind;
   76.48 -import java.util.Arrays;
   76.49 -import java.util.Map;
   76.50 -import java.util.Set;
   76.51 -import org.netbeans.api.java.source.matching.Pattern;
   76.52 -import org.netbeans.spi.java.hints.Decision;
   76.53 -import org.openide.util.Parameters;
   76.54 -
   76.55 -/**A base class for triggers.
   76.56 - *
   76.57 - * @author lahvac
   76.58 - */
   76.59 -public abstract class Trigger {
   76.60 -
   76.61 -    Trigger() {}
   76.62 -
   76.63 -    /**Invoke the given hint's worker on the specified {@link Tree.Kind}(s).
   76.64 -     *
   76.65 -     */
   76.66 -    public static final class Kinds extends Trigger {
   76.67 -        private final Set<Kind> kinds;
   76.68 -
   76.69 -        /**Create the trigger for the specified set of {@link Tree.Kind}s.
   76.70 -         *
   76.71 -         * @param kinds on which the hint's worker should be invoked.
   76.72 -         */
   76.73 -        public Kinds(Set<Kind> kinds) {
   76.74 -            this.kinds = kinds;
   76.75 -        }
   76.76 -
   76.77 -        public Iterable<? extends Kind> getKinds() {
   76.78 -            return kinds;
   76.79 -        }
   76.80 -
   76.81 -        @Override
   76.82 -        public String toString() {
   76.83 -            return kinds.toString();
   76.84 -        }
   76.85 -    }
   76.86 -
   76.87 -    /**Invoke the hint's worker on tree nodes that match the given pattern.
   76.88 -     *
   76.89 -     */
   76.90 -    public static final class PatternDescription extends Trigger {
   76.91 -
   76.92 -        private final String pattern;
   76.93 -        private final Map<String, String> constraints;
   76.94 -        private final Iterable<? extends String> imports;
   76.95 -
   76.96 -        private PatternDescription(String pattern, Map<String, String> constraints, String... imports) {
   76.97 -            this.pattern = pattern;
   76.98 -            this.constraints = constraints;
   76.99 -            this.imports = Arrays.asList(imports);
  76.100 -        }
  76.101 -
  76.102 -        /** Create the trigger to invoke the hint's worker on tree nodes that match the given pattern.
  76.103 -         *
  76.104 -         * @param pattern which will be interpreted as a pattern with free variables ({@link Pattern#createPatternWithFreeVariables(com.sun.source.util.TreePath, java.util.Map) }.
  76.105 -         * @param constraints are expected to be mapping from a free variable name to the expected type.
  76.106 -         * @param XXX: document the imports
  76.107 -         * @return the created trigger.
  76.108 -         */
  76.109 -        public static PatternDescription create(String pattern, Map<String, String> constraints, String... imports) {
  76.110 -            Parameters.notNull("pattern", pattern);
  76.111 -            Parameters.notNull("constraints", constraints);
  76.112 -            Parameters.notNull("imports", imports);
  76.113 -
  76.114 -            return new PatternDescription(pattern, constraints, imports);
  76.115 -        }
  76.116 -
  76.117 -        @Override
  76.118 -        public boolean equals(Object obj) {
  76.119 -            if (obj == null) {
  76.120 -                return false;
  76.121 -            }
  76.122 -            if (getClass() != obj.getClass()) {
  76.123 -                return false;
  76.124 -            }
  76.125 -            final PatternDescription other = (PatternDescription) obj;
  76.126 -            if ((this.pattern == null) ? (other.pattern != null) : !this.pattern.equals(other.pattern)) {
  76.127 -                return false;
  76.128 -            }
  76.129 -            if (this.constraints != other.constraints && (this.constraints == null || !this.constraints.equals(other.constraints))) {
  76.130 -                return false;
  76.131 -            }
  76.132 -            return true;
  76.133 -        }
  76.134 -
  76.135 -        @Override
  76.136 -        public int hashCode() {
  76.137 -            int hash = 7;
  76.138 -            hash = 71 * hash + (this.pattern != null ? this.pattern.hashCode() : 0);
  76.139 -            hash = 71 * hash + (this.constraints != null ? this.constraints.hashCode() : 0);
  76.140 -            return hash;
  76.141 -        }
  76.142 -
  76.143 -        public String getPattern() {
  76.144 -            return pattern;
  76.145 -        }
  76.146 -
  76.147 -        public Map<String, String> getConstraints() {
  76.148 -            return constraints;
  76.149 -        }
  76.150 -
  76.151 -        public Iterable<? extends String> getImports() {
  76.152 -            return imports;
  76.153 -        }
  76.154 -
  76.155 -        @Override
  76.156 -        public String toString() {
  76.157 -            return pattern;
  76.158 -        }
  76.159 -
  76.160 -    }
  76.161 -    
  76.162 -    public static final class DecisionTrigger extends Trigger {
  76.163 -        private final Class<? extends Decision> decisionClass;
  76.164 -
  76.165 -        public DecisionTrigger(Class<? extends Decision> decisionClass) {
  76.166 -            this.decisionClass = decisionClass;
  76.167 -        }
  76.168 -
  76.169 -        public Class<? extends Decision> getDecisionClass() {
  76.170 -            return decisionClass;
  76.171 -        }
  76.172 -    }
  76.173 -
  76.174 -}
    77.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,45 +0,0 @@
    77.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    77.5 -#
    77.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
    77.7 -#
    77.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    77.9 -# Other names may be trademarks of their respective owners.
   77.10 -#
   77.11 -# The contents of this file are subject to the terms of either the GNU
   77.12 -# General Public License Version 2 only ("GPL") or the Common
   77.13 -# Development and Distribution License("CDDL") (collectively, the
   77.14 -# "License"). You may not use this file except in compliance with the
   77.15 -# License. You can obtain a copy of the License at
   77.16 -# http://www.netbeans.org/cddl-gplv2.html
   77.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   77.18 -# specific language governing permissions and limitations under the
   77.19 -# License.  When distributing the software, include this License Header
   77.20 -# Notice in each file and include the License file at
   77.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   77.22 -# particular file as subject to the "Classpath" exception as provided
   77.23 -# by Oracle in the GPL Version 2 section of the License file that
   77.24 -# accompanied this code. If applicable, add the following below the
   77.25 -# License Header, with the fields enclosed by brackets [] replaced by
   77.26 -# your own identifying information:
   77.27 -# "Portions Copyrighted [year] [name of copyright owner]"
   77.28 -#
   77.29 -# Contributor(s):
   77.30 -#
   77.31 -# The Original Software is NetBeans. The Initial Developer of the Original
   77.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
   77.33 -# Microsystems, Inc. All Rights Reserved.
   77.34 -#
   77.35 -# If you wish your version of this file to be governed by only the CDDL
   77.36 -# or only the GPL Version 2, indicate your decision by adding
   77.37 -# "[Contributor] elects to include this software in this distribution
   77.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   77.39 -# single choice of license, a recipient has the option to distribute
   77.40 -# your version of this file under either the CDDL, the GPL Version 2 or
   77.41 -# to extend the choice of license to its licensees as provided above.
   77.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   77.43 -# Version 2 license, then the option applies only if the new code is
   77.44 -# made subject to such option by the copyright holder.
   77.45 -OpenIDE-Module-Name=Java Hints SPI
   77.46 -
   77.47 -#refresh hints
   77.48 -Refresh_hints=Refresh Hints
    78.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Hacks.java	Sun Jan 08 20:10:08 2017 +0100
    78.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.3 @@ -1,219 +0,0 @@
    78.4 -/*
    78.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    78.6 - *
    78.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    78.8 - *
    78.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   78.10 - * Other names may be trademarks of their respective owners.
   78.11 - *
   78.12 - * The contents of this file are subject to the terms of either the GNU
   78.13 - * General Public License Version 2 only ("GPL") or the Common
   78.14 - * Development and Distribution License("CDDL") (collectively, the
   78.15 - * "License"). You may not use this file except in compliance with the
   78.16 - * License. You can obtain a copy of the License at
   78.17 - * http://www.netbeans.org/cddl-gplv2.html
   78.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   78.19 - * specific language governing permissions and limitations under the
   78.20 - * License.  When distributing the software, include this License Header
   78.21 - * Notice in each file and include the License file at
   78.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   78.23 - * particular file as subject to the "Classpath" exception as provided
   78.24 - * by Oracle in the GPL Version 2 section of the License file that
   78.25 - * accompanied this code. If applicable, add the following below the
   78.26 - * License Header, with the fields enclosed by brackets [] replaced by
   78.27 - * your own identifying information:
   78.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   78.29 - *
   78.30 - * If you wish your version of this file to be governed by only the CDDL
   78.31 - * or only the GPL Version 2, indicate your decision by adding
   78.32 - * "[Contributor] elects to include this software in this distribution
   78.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   78.34 - * single choice of license, a recipient has the option to distribute
   78.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   78.36 - * to extend the choice of license to its licensees as provided above.
   78.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   78.38 - * Version 2 license, then the option applies only if the new code is
   78.39 - * made subject to such option by the copyright holder.
   78.40 - *
   78.41 - * Contributor(s):
   78.42 - *
   78.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   78.44 - */
   78.45 -
   78.46 -package org.netbeans.modules.java.hints.spiimpl;
   78.47 -
   78.48 -import com.sun.source.tree.BlockTree;
   78.49 -import com.sun.source.tree.CompilationUnitTree;
   78.50 -import com.sun.source.tree.MethodTree;
   78.51 -import com.sun.source.tree.Scope;
   78.52 -import com.sun.source.tree.Tree;
   78.53 -import com.sun.source.util.TreePath;
   78.54 -import com.sun.source.util.TreePathScanner;
   78.55 -import com.sun.tools.javac.api.JavacTaskImpl;
   78.56 -import com.sun.tools.javac.code.Symbol.ClassSymbol;
   78.57 -import com.sun.tools.javac.comp.AttrContext;
   78.58 -import com.sun.tools.javac.comp.Enter;
   78.59 -import com.sun.tools.javac.comp.Env;
   78.60 -import com.sun.tools.javac.main.JavaCompiler;
   78.61 -import com.sun.tools.javac.tree.JCTree;
   78.62 -import com.sun.tools.javac.tree.JCTree.JCErroneous;
   78.63 -import com.sun.tools.javac.util.Context;
   78.64 -import com.sun.tools.javac.util.Log;
   78.65 -import java.io.File;
   78.66 -import java.io.IOException;
   78.67 -import javax.lang.model.element.Element;
   78.68 -import javax.lang.model.element.TypeElement;
   78.69 -import javax.lang.model.element.VariableElement;
   78.70 -import javax.lang.model.type.TypeMirror;
   78.71 -import javax.tools.JavaFileObject;
   78.72 -import org.netbeans.api.annotations.common.CheckForNull;
   78.73 -import org.netbeans.api.annotations.common.NonNull;
   78.74 -import org.netbeans.api.java.source.CompilationInfo;
   78.75 -import org.netbeans.api.java.source.TreeUtilities;
   78.76 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
   78.77 -import org.netbeans.modules.java.source.JavaSourceAccessor;
   78.78 -import org.netbeans.modules.java.source.parsing.FileObjects;
   78.79 -import org.openide.util.Exceptions;
   78.80 -
   78.81 -/**
   78.82 - *
   78.83 - * @author lahvac
   78.84 - */
   78.85 -public class Hacks {
   78.86 -
   78.87 -    //XXX: copied from Utilities, for declarative hints, different import management:
   78.88 -    private static long inc;
   78.89 -
   78.90 -    public static Scope constructScope(CompilationInfo info, String... importedClasses) {
   78.91 -        StringBuilder clazz = new StringBuilder();
   78.92 -
   78.93 -        clazz.append("package $$;\n");
   78.94 -
   78.95 -        for (String i : importedClasses) {
   78.96 -            clazz.append("import ").append(i).append(";\n");
   78.97 -        }
   78.98 -
   78.99 -        clazz.append("public class $").append(inc++).append("{");
  78.100 -
  78.101 -        clazz.append("private void test() {\n");
  78.102 -        clazz.append("}\n");
  78.103 -        clazz.append("}\n");
  78.104 -
  78.105 -        JavacTaskImpl jti = JavaSourceAccessor.getINSTANCE().getJavacTask(info);
  78.106 -        Context context = jti.getContext();
  78.107 -
  78.108 -        JavaCompiler jc = JavaCompiler.instance(context);
  78.109 -        Log.instance(context).nerrors = 0;
  78.110 -
  78.111 -        JavaFileObject jfo = FileObjects.memoryFileObject("$$", "$", new File("/tmp/t.java").toURI(), System.currentTimeMillis(), clazz.toString());
  78.112 -        boolean oldSkipAPs = jc.skipAnnotationProcessing;
  78.113 -
  78.114 -        try {
  78.115 -            jc.skipAnnotationProcessing = true;
  78.116 -
  78.117 -            Iterable<? extends CompilationUnitTree> parsed = jti.parse(jfo);
  78.118 -            CompilationUnitTree cut = parsed.iterator().next();
  78.119 -
  78.120 -            jti.analyze(jti.enter(parsed));
  78.121 -
  78.122 -            return new ScannerImpl().scan(cut, info);
  78.123 -        } catch (IOException ex) {
  78.124 -            Exceptions.printStackTrace(ex);
  78.125 -            return null;
  78.126 -        } finally {
  78.127 -            jc.skipAnnotationProcessing = oldSkipAPs;
  78.128 -        }
  78.129 -    }
  78.130 -
  78.131 -    private static final class ScannerImpl extends TreePathScanner<Scope, CompilationInfo> {
  78.132 -
  78.133 -        @Override
  78.134 -        public Scope visitBlock(BlockTree node, CompilationInfo p) {
  78.135 -            return p.getTrees().getScope(getCurrentPath());
  78.136 -        }
  78.137 -
  78.138 -        @Override
  78.139 -        public Scope visitMethod(MethodTree node, CompilationInfo p) {
  78.140 -            if (node.getReturnType() == null) {
  78.141 -                return null;
  78.142 -            }
  78.143 -            return super.visitMethod(node, p);
  78.144 -        }
  78.145 -
  78.146 -        @Override
  78.147 -        public Scope reduce(Scope r1, Scope r2) {
  78.148 -            return r1 != null ? r1 : r2;
  78.149 -        }
  78.150 -
  78.151 -    }
  78.152 -
  78.153 -
  78.154 -    public static Tree createRenameTree(@NonNull Tree originalTree, @NonNull String newName) {
  78.155 -        return new RenameTree(originalTree, newName);
  78.156 -    }
  78.157 -
  78.158 -    public static final class RenameTree extends JCErroneous {
  78.159 -
  78.160 -        public final Tree originalTree;
  78.161 -        public final String newName;
  78.162 -
  78.163 -        public RenameTree(@NonNull Tree originalTree, @NonNull String newName) {
  78.164 -            super(com.sun.tools.javac.util.List.<JCTree>nil());
  78.165 -            this.originalTree = originalTree;
  78.166 -            this.newName = newName;
  78.167 -        }
  78.168 -
  78.169 -    }
  78.170 -
  78.171 -    public static @CheckForNull TypeMirror parseFQNType(@NonNull CompilationInfo info, @NonNull String spec) {
  78.172 -        if (spec.length() == 0) {
  78.173 -            return null;
  78.174 -        }
  78.175 -        
  78.176 -        TypeElement jlObject = info.getElements().getTypeElement("java.lang.Object");
  78.177 -        
  78.178 -        //XXX:
  78.179 -        TypeElement scope;
  78.180 -
  78.181 -        if (info.getTopLevelElements().isEmpty()) {
  78.182 -            scope = jlObject;
  78.183 -        } else {
  78.184 -            scope = info.getTopLevelElements().iterator().next();
  78.185 -        }
  78.186 -        //XXX end
  78.187 -        
  78.188 -        return info.getTreeUtilities().parseType(spec, /*XXX: jlObject*/scope);
  78.189 -    }
  78.190 -
  78.191 -    public static VariableElement attributeThis(CompilationInfo info, TreePath tp) {
  78.192 -        //XXX:
  78.193 -        while (tp != null) {
  78.194 -            if (TreeUtilities.CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
  78.195 -                Element currentElement = info.getTrees().getElement(tp);
  78.196 -
  78.197 -                if (currentElement == null || !(currentElement instanceof ClassSymbol)) return null;
  78.198 -
  78.199 -                Enter enter = Enter.instance(JavaSourceAccessor.getINSTANCE().getJavacTask(info).getContext());
  78.200 -                Env<AttrContext> env = enter.getEnv((ClassSymbol) currentElement);
  78.201 -
  78.202 -                if (env == null) return null;
  78.203 -
  78.204 -                for (Element el : env.info.getLocalElements()) {
  78.205 -                    if (el.getSimpleName().contentEquals("this")) {
  78.206 -                        return (VariableElement) el;
  78.207 -                    }
  78.208 -                }
  78.209 -
  78.210 -                return null;
  78.211 -            }
  78.212 -
  78.213 -            tp = tp.getParentPath();
  78.214 -        }
  78.215 -
  78.216 -        return null;
  78.217 -    }
  78.218 -    
  78.219 -    public static interface InspectAndTransformOpener {
  78.220 -        public void openIAT(HintMetadata hm);
  78.221 -    }
  78.222 -}
    79.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JackpotTrees.java	Sun Jan 08 20:10:08 2017 +0100
    79.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.3 @@ -1,246 +0,0 @@
    79.4 -/*
    79.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    79.6 - *
    79.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    79.8 - *
    79.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   79.10 - * Other names may be trademarks of their respective owners.
   79.11 - *
   79.12 - * The contents of this file are subject to the terms of either the GNU
   79.13 - * General Public License Version 2 only ("GPL") or the Common
   79.14 - * Development and Distribution License("CDDL") (collectively, the
   79.15 - * "License"). You may not use this file except in compliance with the
   79.16 - * License. You can obtain a copy of the License at
   79.17 - * http://www.netbeans.org/cddl-gplv2.html
   79.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   79.19 - * specific language governing permissions and limitations under the
   79.20 - * License.  When distributing the software, include this License Header
   79.21 - * Notice in each file and include the License file at
   79.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   79.23 - * particular file as subject to the "Classpath" exception as provided
   79.24 - * by Oracle in the GPL Version 2 section of the License file that
   79.25 - * accompanied this code. If applicable, add the following below the
   79.26 - * License Header, with the fields enclosed by brackets [] replaced by
   79.27 - * your own identifying information:
   79.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   79.29 - *
   79.30 - * If you wish your version of this file to be governed by only the CDDL
   79.31 - * or only the GPL Version 2, indicate your decision by adding
   79.32 - * "[Contributor] elects to include this software in this distribution
   79.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   79.34 - * single choice of license, a recipient has the option to distribute
   79.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   79.36 - * to extend the choice of license to its licensees as provided above.
   79.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   79.38 - * Version 2 license, then the option applies only if the new code is
   79.39 - * made subject to such option by the copyright holder.
   79.40 - *
   79.41 - * Contributor(s):
   79.42 - *
   79.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
   79.44 - */
   79.45 -
   79.46 -package org.netbeans.modules.java.hints.spiimpl;
   79.47 -
   79.48 -import com.sun.source.tree.IdentifierTree;
   79.49 -import com.sun.source.tree.TreeVisitor;
   79.50 -import com.sun.tools.javac.code.Symbol.VarSymbol;
   79.51 -import com.sun.tools.javac.code.Symtab;
   79.52 -import com.sun.tools.javac.tree.JCTree;
   79.53 -import com.sun.tools.javac.tree.JCTree.JCAnnotation;
   79.54 -import com.sun.tools.javac.tree.JCTree.JCBlock;
   79.55 -import com.sun.tools.javac.tree.JCTree.JCCase;
   79.56 -import com.sun.tools.javac.tree.JCTree.JCCatch;
   79.57 -import com.sun.tools.javac.tree.JCTree.JCModifiers;
   79.58 -import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
   79.59 -import com.sun.tools.javac.tree.TreeMaker;
   79.60 -import com.sun.tools.javac.util.Context;
   79.61 -import com.sun.tools.javac.util.List;
   79.62 -import com.sun.tools.javac.util.Name;
   79.63 -
   79.64 -
   79.65 -/**
   79.66 - *
   79.67 - * @author lahvac
   79.68 - */
   79.69 -public class JackpotTrees {
   79.70 -    public static class AnnotationWildcard extends JCAnnotation implements IdentifierTree {
   79.71 -
   79.72 -        private final Name ident;
   79.73 -        private final JCIdent jcIdent;
   79.74 -
   79.75 -        public AnnotationWildcard(Name ident, JCIdent jcIdent) {
   79.76 -            super(Tag.ANNOTATION, jcIdent, List.<JCExpression>nil());
   79.77 -            this.ident = ident;
   79.78 -            this.jcIdent = jcIdent;
   79.79 -        }
   79.80 -
   79.81 -        public Name getName() {
   79.82 -            return ident;
   79.83 -        }
   79.84 -
   79.85 -        @Override
   79.86 -        public Kind getKind() {
   79.87 -            return Kind.IDENTIFIER;
   79.88 -        }
   79.89 -
   79.90 -        @Override
   79.91 -        public void accept(Visitor v) {
   79.92 -            v.visitIdent(jcIdent);
   79.93 -        }
   79.94 -
   79.95 -        @Override
   79.96 -        public <R, D> R accept(TreeVisitor<R, D> v, D d) {
   79.97 -            return v.visitIdentifier(this, d);
   79.98 -        }
   79.99 -
  79.100 -        @Override
  79.101 -        public String toString() {
  79.102 -            return ident.toString();
  79.103 -        }
  79.104 -
  79.105 -    }
  79.106 -    
  79.107 -    public static class CatchWildcard extends JCCatch implements IdentifierTree {
  79.108 -
  79.109 -        private final Name ident;
  79.110 -        private final JCIdent jcIdent;
  79.111 -
  79.112 -        public CatchWildcard(Context ctx, Name ident, JCIdent jcIdent) {
  79.113 -            super(new FakeVariable(ctx, ident, jcIdent), TreeMaker.instance(ctx).Block(0, List.<JCStatement>nil()));
  79.114 -            this.ident = ident;
  79.115 -            this.jcIdent = jcIdent;
  79.116 -        }
  79.117 -
  79.118 -        public Name getName() {
  79.119 -            return ident;
  79.120 -        }
  79.121 -
  79.122 -        @Override
  79.123 -        public Kind getKind() {
  79.124 -            return Kind.IDENTIFIER;
  79.125 -        }
  79.126 -
  79.127 -        @Override
  79.128 -        public void accept(Visitor v) {
  79.129 -            v.visitIdent(jcIdent);
  79.130 -        }
  79.131 -
  79.132 -        @Override
  79.133 -        public <R, D> R accept(TreeVisitor<R, D> v, D d) {
  79.134 -            return v.visitIdentifier(this, d);
  79.135 -        }
  79.136 -
  79.137 -        @Override
  79.138 -        public String toString() {
  79.139 -            return "catch " + ident.toString();
  79.140 -        }
  79.141 -
  79.142 -    }
  79.143 -    
  79.144 -    public static class VariableWildcard extends FakeVariable implements IdentifierTree {
  79.145 -
  79.146 -        private final Name ident;
  79.147 -
  79.148 -        public VariableWildcard(Context ctx, Name ident, JCIdent jcIdent) {
  79.149 -            super(ctx, ident, jcIdent);
  79.150 -            this.ident = ident;
  79.151 -        }
  79.152 -
  79.153 -        public Name getName() {
  79.154 -            return ident;
  79.155 -        }
  79.156 -
  79.157 -        @Override
  79.158 -        public Kind getKind() {
  79.159 -            return Kind.IDENTIFIER;
  79.160 -        }
  79.161 -
  79.162 -        @Override
  79.163 -        public <R, D> R accept(TreeVisitor<R, D> v, D d) {
  79.164 -            return v.visitIdentifier(this, d);
  79.165 -        }
  79.166 -
  79.167 -        @Override
  79.168 -        public String toString() {
  79.169 -            return ident.toString();
  79.170 -        }
  79.171 -    }
  79.172 -
  79.173 -    private static class FakeVariable extends JCVariableDecl {
  79.174 -        
  79.175 -        private final JCIdent jcIdent;
  79.176 -
  79.177 -        public FakeVariable(Context ctx, Name ident, JCIdent jcIdent) {
  79.178 -            super(new FakeModifiers(), ident, createType(ctx), null, null);
  79.179 -            this.sym = new VarSymbol(0, name, type, Symtab.instance(ctx).errSymbol);
  79.180 -            this.type = vartype.type;
  79.181 -            this.jcIdent = jcIdent;
  79.182 -        }
  79.183 -
  79.184 -        private static JCErroneous createType(Context ctx) {
  79.185 -            JCErroneous err = new JCErroneous(List.<JCTree>nil()) {};
  79.186 -
  79.187 -            err.type = Symtab.instance(ctx).errType;
  79.188 -
  79.189 -            return err;
  79.190 -        }
  79.191 -
  79.192 -        @Override
  79.193 -        public void accept(Visitor v) {
  79.194 -            v.visitIdent(jcIdent);
  79.195 -        }
  79.196 -
  79.197 -    }
  79.198 -
  79.199 -    private static class FakeModifiers extends JCModifiers {
  79.200 -        public FakeModifiers() {
  79.201 -            super(0, List.<JCAnnotation>nil());
  79.202 -        }
  79.203 -    }
  79.204 -
  79.205 -    public static class CaseWildcard extends JCCase implements IdentifierTree {
  79.206 -
  79.207 -        private final Name ident;
  79.208 -        private final JCIdent jcIdent;
  79.209 -
  79.210 -        public CaseWildcard(Context ctx, Name ident, JCIdent jcIdent) {
  79.211 -            super(jcIdent, List.<JCStatement>nil());
  79.212 -            this.ident = ident;
  79.213 -            this.jcIdent = jcIdent;
  79.214 -        }
  79.215 -
  79.216 -        public Name getName() {
  79.217 -            return ident;
  79.218 -        }
  79.219 -
  79.220 -        @Override
  79.221 -        public Kind getKind() {
  79.222 -            return Kind.IDENTIFIER;
  79.223 -        }
  79.224 -
  79.225 -        @Override
  79.226 -        public void accept(Visitor v) {
  79.227 -            v.visitIdent(jcIdent);
  79.228 -        }
  79.229 -
  79.230 -        @Override
  79.231 -        public <R, D> R accept(TreeVisitor<R, D> v, D d) {
  79.232 -            return v.visitIdentifier(this, d);
  79.233 -        }
  79.234 -
  79.235 -        @Override
  79.236 -        public String toString() {
  79.237 -            return "case " + ident.toString();
  79.238 -        }
  79.239 -
  79.240 -    }
  79.241 -    
  79.242 -    public static class FakeBlock extends JCBlock {
  79.243 -
  79.244 -        public FakeBlock(long flags, List<JCStatement> stats) {
  79.245 -            super(flags, stats);
  79.246 -        }
  79.247 -        
  79.248 -    }
  79.249 -}
    80.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JavaFixImpl.java	Sun Jan 08 20:10:08 2017 +0100
    80.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.3 @@ -1,146 +0,0 @@
    80.4 -/*
    80.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    80.6 - *
    80.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
    80.8 - *
    80.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   80.10 - * Other names may be trademarks of their respective owners.
   80.11 - *
   80.12 - * The contents of this file are subject to the terms of either the GNU
   80.13 - * General Public License Version 2 only ("GPL") or the Common
   80.14 - * Development and Distribution License("CDDL") (collectively, the
   80.15 - * "License"). You may not use this file except in compliance with the
   80.16 - * License. You can obtain a copy of the License at
   80.17 - * http://www.netbeans.org/cddl-gplv2.html
   80.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   80.19 - * specific language governing permissions and limitations under the
   80.20 - * License.  When distributing the software, include this License Header
   80.21 - * Notice in each file and include the License file at
   80.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   80.23 - * particular file as subject to the "Classpath" exception as provided
   80.24 - * by Oracle in the GPL Version 2 section of the License file that
   80.25 - * accompanied this code. If applicable, add the following below the
   80.26 - * License Header, with the fields enclosed by brackets [] replaced by
   80.27 - * your own identifying information:
   80.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   80.29 - *
   80.30 - * If you wish your version of this file to be governed by only the CDDL
   80.31 - * or only the GPL Version 2, indicate your decision by adding
   80.32 - * "[Contributor] elects to include this software in this distribution
   80.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   80.34 - * single choice of license, a recipient has the option to distribute
   80.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   80.36 - * to extend the choice of license to its licensees as provided above.
   80.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   80.38 - * Version 2 license, then the option applies only if the new code is
   80.39 - * made subject to such option by the copyright holder.
   80.40 - *
   80.41 - * Contributor(s):
   80.42 - *
   80.43 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
   80.44 - */
   80.45 -
   80.46 -package org.netbeans.modules.java.hints.spiimpl;
   80.47 -
   80.48 -import com.sun.source.util.TreePath;
   80.49 -import java.util.ArrayList;
   80.50 -import java.util.Collection;
   80.51 -import java.util.Collections;
   80.52 -import java.util.HashMap;
   80.53 -import java.util.IdentityHashMap;
   80.54 -import java.util.List;
   80.55 -import java.util.Map;
   80.56 -import java.util.Set;
   80.57 -import javax.lang.model.type.TypeMirror;
   80.58 -import org.netbeans.api.java.source.CompilationInfo;
   80.59 -import org.netbeans.api.java.source.JavaSource;
   80.60 -import org.netbeans.api.java.source.JavaSource.Phase;
   80.61 -import org.netbeans.api.java.source.ModificationResult.Difference;
   80.62 -import org.netbeans.api.java.source.Task;
   80.63 -import org.netbeans.api.java.source.WorkingCopy;
   80.64 -import org.netbeans.api.project.Project;
   80.65 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchUtilities;
   80.66 -import org.netbeans.modules.java.source.JavaSourceAccessor;
   80.67 -import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation;
   80.68 -import org.netbeans.spi.editor.hints.ChangeInfo;
   80.69 -import org.netbeans.spi.editor.hints.Fix;
   80.70 -import org.netbeans.spi.java.hints.HintContext;
   80.71 -import org.netbeans.spi.java.hints.JavaFix;
   80.72 -import org.openide.filesystems.FileObject;
   80.73 -import org.openide.util.Exceptions;
   80.74 -
   80.75 -/**TODO: move to better package
   80.76 - *
   80.77 - * @author Jan Lahoda
   80.78 - */
   80.79 -public final class JavaFixImpl implements Fix {
   80.80 -
   80.81 -    public final JavaFix jf;
   80.82 -
   80.83 -    public JavaFixImpl(JavaFix jf) {
   80.84 -        this.jf = jf;
   80.85 -    }
   80.86 -
   80.87 -    public String getText() {
   80.88 -        return Accessor.INSTANCE.getText(jf);
   80.89 -    }
   80.90 -
   80.91 -    public ChangeInfo implement() throws Exception {
   80.92 -        FileObject file = Accessor.INSTANCE.getFile(jf);
   80.93 -        
   80.94 -        BatchUtilities.fixDependencies(file, Collections.singletonList(jf), new IdentityHashMap<Project, Set<String>>());
   80.95 -
   80.96 -        JavaSource js = JavaSource.forFileObject(file);
   80.97 -
   80.98 -        js.runModificationTask(new Task<WorkingCopy>() {
   80.99 -            public void run(WorkingCopy wc) throws Exception {
  80.100 -                if (wc.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) {
  80.101 -                    return;
  80.102 -                }
  80.103 -
  80.104 -                Map<FileObject, byte[]> resourceContentChanges = new HashMap<FileObject, byte[]>();
  80.105 -                Accessor.INSTANCE.process(jf, wc, true, resourceContentChanges, /*Ignored in editor:*/new ArrayList<RefactoringElementImplementation>());
  80.106 -                Map<FileObject, List<Difference>> resourceContentDiffs = new HashMap<FileObject, List<Difference>>();
  80.107 -                BatchUtilities.addResourceContentChanges(resourceContentChanges, resourceContentDiffs);
  80.108 -                JavaSourceAccessor.getINSTANCE().createModificationResult(resourceContentDiffs, Collections.<Object, int[]>emptyMap()).commit();
  80.109 -            }
  80.110 -        }).commit();
  80.111 -
  80.112 -        return null;
  80.113 -    }
  80.114 -
  80.115 -    @Override
  80.116 -    public boolean equals(Object obj) {
  80.117 -        if (obj instanceof JavaFixImpl) {
  80.118 -            return jf.equals(((JavaFixImpl)obj).jf);
  80.119 -        }
  80.120 -        return super.equals(obj);
  80.121 -    }
  80.122 -
  80.123 -    @Override
  80.124 -    public int hashCode() {
  80.125 -        return jf.hashCode();
  80.126 -    }
  80.127 -
  80.128 -    public static abstract class Accessor {
  80.129 -
  80.130 -        static {
  80.131 -            try {
  80.132 -                Class.forName(JavaFix.class.getCanonicalName(), true, JavaFix.class.getClassLoader());
  80.133 -            } catch (ClassNotFoundException ex) {
  80.134 -                Exceptions.printStackTrace(ex);
  80.135 -            }
  80.136 -        }
  80.137 -        
  80.138 -        public static Accessor INSTANCE;
  80.139 -
  80.140 -        public abstract String getText(JavaFix jf);
  80.141 -        public abstract ChangeInfo process(JavaFix jf, WorkingCopy wc, boolean canShowUI, Map<FileObject, byte[]> resourceContent, Collection<? super RefactoringElementImplementation> fileChanges) throws Exception;
  80.142 -        public abstract FileObject getFile(JavaFix jf);
  80.143 -        public abstract Map<String, String> getOptions(JavaFix jf);
  80.144 -        public abstract Fix rewriteFix(CompilationInfo info, String displayName, TreePath what, final String to, Map<String, TreePath> parameters, Map<String, Collection<? extends TreePath>> parametersMulti, final Map<String, String> parameterNames, Map<String, TypeMirror> constraints, Map<String, String> options, String... imports);
  80.145 -        public abstract Fix createSuppressWarningsFix(CompilationInfo compilationInfo, TreePath treePath, String... keys);
  80.146 -        public abstract List<Fix> createSuppressWarnings(CompilationInfo compilationInfo, TreePath treePath, String... keys);
  80.147 -        public abstract List<Fix> resolveDefaultFixes(HintContext ctx, Fix... provided);
  80.148 -    }
  80.149 -}
    81.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/JavaHintsPositionRefresher.java	Sun Jan 08 20:10:08 2017 +0100
    81.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.3 @@ -1,161 +0,0 @@
    81.4 -/*
    81.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    81.6 - *
    81.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
    81.8 - *
    81.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   81.10 - * Other names may be trademarks of their respective owners.
   81.11 - *
   81.12 - * The contents of this file are subject to the terms of either the GNU
   81.13 - * General Public License Version 2 only ("GPL") or the Common
   81.14 - * Development and Distribution License("CDDL") (collectively, the
   81.15 - * "License"). You may not use this file except in compliance with the
   81.16 - * License. You can obtain a copy of the License at
   81.17 - * http://www.netbeans.org/cddl-gplv2.html
   81.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   81.19 - * specific language governing permissions and limitations under the
   81.20 - * License.  When distributing the software, include this License Header
   81.21 - * Notice in each file and include the License file at
   81.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   81.23 - * particular file as subject to the "Classpath" exception as provided
   81.24 - * by Oracle in the GPL Version 2 section of the License file that
   81.25 - * accompanied this code. If applicable, add the following below the
   81.26 - * License Header, with the fields enclosed by brackets [] replaced by
   81.27 - * your own identifying information:
   81.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   81.29 - *
   81.30 - * If you wish your version of this file to be governed by only the CDDL
   81.31 - * or only the GPL Version 2, indicate your decision by adding
   81.32 - * "[Contributor] elects to include this software in this distribution
   81.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   81.34 - * single choice of license, a recipient has the option to distribute
   81.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   81.36 - * to extend the choice of license to its licensees as provided above.
   81.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   81.38 - * Version 2 license, then the option applies only if the new code is
   81.39 - * made subject to such option by the copyright holder.
   81.40 - *
   81.41 - * Contributor(s):
   81.42 - *
   81.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
   81.44 - */
   81.45 -
   81.46 -package org.netbeans.modules.java.hints.spiimpl;
   81.47 -
   81.48 -import java.io.IOException;
   81.49 -import java.util.ArrayList;
   81.50 -import java.util.Collections;
   81.51 -import java.util.HashMap;
   81.52 -import java.util.Iterator;
   81.53 -import java.util.List;
   81.54 -import java.util.Map;
   81.55 -import java.util.logging.Level;
   81.56 -import java.util.logging.Logger;
   81.57 -import javax.swing.text.Document;
   81.58 -import org.netbeans.api.editor.mimelookup.MimeLookup;
   81.59 -import org.netbeans.api.editor.mimelookup.MimeRegistration;
   81.60 -import org.netbeans.api.java.source.CompilationController;
   81.61 -import org.netbeans.api.java.source.JavaSource;
   81.62 -import org.netbeans.api.java.source.JavaSource.Phase;
   81.63 -import org.netbeans.api.java.source.Task;
   81.64 -import org.netbeans.api.progress.ProgressUtils;
   81.65 -import org.netbeans.spi.editor.hints.Context;
   81.66 -import org.netbeans.spi.editor.hints.ErrorDescription;
   81.67 -import org.netbeans.spi.editor.hints.PositionRefresher;
   81.68 -import org.netbeans.modules.java.hints.providers.spi.PositionRefresherHelper;
   81.69 -import org.openide.util.Exceptions;
   81.70 -import org.openide.util.NbBundle;
   81.71 -
   81.72 -/**
   81.73 - * Refreshes all Java Hints on current line upon Alt-Enter or mouseclick
   81.74 - * @author Max Sauer
   81.75 - */
   81.76 -@MimeRegistration(mimeType="text/x-java", service=PositionRefresher.class)
   81.77 -public class JavaHintsPositionRefresher implements PositionRefresher {
   81.78 -
   81.79 -    private static final Logger LOG = Logger.getLogger(JavaHintsPositionRefresher.class.getName());
   81.80 -
   81.81 -    @Override
   81.82 -    public Map<String, List<ErrorDescription>> getErrorDescriptionsAt(final Context context, final Document doc) {
   81.83 -        final List<PositionRefresherHelper> refreshers = new ArrayList<PositionRefresherHelper>(MimeLookup.getLookup("text/x-java").lookupAll(PositionRefresherHelper.class));
   81.84 -
   81.85 -        for (Iterator<PositionRefresherHelper> it = refreshers.iterator(); it.hasNext();) {
   81.86 -            PositionRefresherHelper h = it.next();
   81.87 -
   81.88 -            if (h.upToDateCheck(context, doc)) {
   81.89 -                LOG.log(Level.FINE, "Not computing warnings for {0}, results are up-to-date.", h.getKey());
   81.90 -                it.remove();
   81.91 -            } else {
   81.92 -                LOG.log(Level.FINE, "Will compute warnings for {0}, results not up-to-date.", h.getKey());
   81.93 -            }
   81.94 -        }
   81.95 -
   81.96 -        if (refreshers.isEmpty()) return Collections.emptyMap();
   81.97 -        
   81.98 -        final JavaSource js = JavaSource.forDocument(doc);
   81.99 -
  81.100 -        if (js == null) {
  81.101 -            LOG.log(Level.FINE, "No JavaSource associated to: {0}", new Object[] {doc, doc.getProperty(Document.StreamDescriptionProperty)});
  81.102 -            return Collections.emptyMap();
  81.103 -        }
  81.104 -
  81.105 -        final Map<String, List<ErrorDescription>> eds = new HashMap<String, List<ErrorDescription>>();
  81.106 -
  81.107 -        Runnable r = new Runnable() {
  81.108 -
  81.109 -            public void run() {
  81.110 -                try {
  81.111 -                    js.runUserActionTask(new RefreshTask(eds, refreshers, context, doc), true);
  81.112 -                } catch (IOException ex) {
  81.113 -                    Exceptions.printStackTrace(ex);
  81.114 -                }
  81.115 -            }
  81.116 -        };
  81.117 -        
  81.118 -        ProgressUtils.runOffEventDispatchThread(r, NbBundle.getMessage(JavaHintsPositionRefresher.class, "Refresh_hints"), context.getCancel(), false); // NOI18N
  81.119 -
  81.120 -        return eds;
  81.121 -    }
  81.122 -
  81.123 -
  81.124 -    private class RefreshTask implements Task<CompilationController> {
  81.125 -
  81.126 -        private final Map<String, List<ErrorDescription>> eds;
  81.127 -        private final List<PositionRefresherHelper> refreshers;
  81.128 -        private final Context ctx;
  81.129 -        private final Document doc;
  81.130 -
  81.131 -        public RefreshTask(Map<String, List<ErrorDescription>> eds, List<PositionRefresherHelper> refreshers, Context ctx, Document doc) {
  81.132 -            this.eds = eds;
  81.133 -            this.refreshers = refreshers;
  81.134 -            this.ctx = ctx;
  81.135 -            this.doc = doc;
  81.136 -        }
  81.137 -
  81.138 -        public void run(CompilationController controller) throws Exception {
  81.139 -            if (controller.toPhase(JavaSource.Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) {
  81.140 -                return ;
  81.141 -            }
  81.142 -
  81.143 -            Document doc = controller.getDocument();
  81.144 -
  81.145 -            if (doc == null) {
  81.146 -                return;
  81.147 -            }
  81.148 -
  81.149 -            for (PositionRefresherHelper h : refreshers) {
  81.150 -                if (ctx.isCanceled()) {
  81.151 -                    return;
  81.152 -                }
  81.153 -                
  81.154 -                List errors = h.getErrorDescriptionsAt(controller, ctx, doc);
  81.155 -                
  81.156 -                if (errors == null) continue;
  81.157 -                
  81.158 -                eds.put(h.getKey(), errors);
  81.159 -            }
  81.160 -        }
  81.161 -        
  81.162 -    }
  81.163 -
  81.164 -}
    82.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/MessageImpl.java	Sun Jan 08 20:10:08 2017 +0100
    82.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.3 @@ -1,61 +0,0 @@
    82.4 -/*
    82.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    82.6 - *
    82.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    82.8 - *
    82.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   82.10 - * Other names may be trademarks of their respective owners.
   82.11 - *
   82.12 - * The contents of this file are subject to the terms of either the GNU
   82.13 - * General Public License Version 2 only ("GPL") or the Common
   82.14 - * Development and Distribution License("CDDL") (collectively, the
   82.15 - * "License"). You may not use this file except in compliance with the
   82.16 - * License. You can obtain a copy of the License at
   82.17 - * http://www.netbeans.org/cddl-gplv2.html
   82.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   82.19 - * specific language governing permissions and limitations under the
   82.20 - * License.  When distributing the software, include this License Header
   82.21 - * Notice in each file and include the License file at
   82.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   82.23 - * particular file as subject to the "Classpath" exception as provided
   82.24 - * by Oracle in the GPL Version 2 section of the License file that
   82.25 - * accompanied this code. If applicable, add the following below the
   82.26 - * License Header, with the fields enclosed by brackets [] replaced by
   82.27 - * your own identifying information:
   82.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   82.29 - *
   82.30 - * If you wish your version of this file to be governed by only the CDDL
   82.31 - * or only the GPL Version 2, indicate your decision by adding
   82.32 - * "[Contributor] elects to include this software in this distribution
   82.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   82.34 - * single choice of license, a recipient has the option to distribute
   82.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   82.36 - * to extend the choice of license to its licensees as provided above.
   82.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   82.38 - * Version 2 license, then the option applies only if the new code is
   82.39 - * made subject to such option by the copyright holder.
   82.40 - *
   82.41 - * Contributor(s):
   82.42 - *
   82.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   82.44 - */
   82.45 -
   82.46 -package org.netbeans.modules.java.hints.spiimpl;
   82.47 -
   82.48 -import org.netbeans.spi.java.hints.HintContext.MessageKind;
   82.49 -
   82.50 -/**
   82.51 - *
   82.52 - * @author lahvacc
   82.53 - */
   82.54 -public class MessageImpl {
   82.55 -
   82.56 -    public final MessageKind kind;
   82.57 -    public final String text;
   82.58 -
   82.59 -    public MessageImpl(MessageKind kind, String text) {
   82.60 -        this.kind = kind;
   82.61 -        this.text = text;
   82.62 -    }
   82.63 -
   82.64 -}
    83.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/RulesManager.java	Sun Jan 08 20:10:08 2017 +0100
    83.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.3 @@ -1,68 +0,0 @@
    83.4 -/*
    83.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    83.6 - *
    83.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
    83.8 - *
    83.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   83.10 - * Other names may be trademarks of their respective owners.
   83.11 - *
   83.12 - * The contents of this file are subject to the terms of either the GNU
   83.13 - * General Public License Version 2 only ("GPL") or the Common
   83.14 - * Development and Distribution License("CDDL") (collectively, the
   83.15 - * "License"). You may not use this file except in compliance with the
   83.16 - * License. You can obtain a copy of the License at
   83.17 - * http://www.netbeans.org/cddl-gplv2.html
   83.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   83.19 - * specific language governing permissions and limitations under the
   83.20 - * License.  When distributing the software, include this License Header
   83.21 - * Notice in each file and include the License file at
   83.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   83.23 - * particular file as subject to the "Classpath" exception as provided
   83.24 - * by Oracle in the GPL Version 2 section of the License file that
   83.25 - * accompanied this code. If applicable, add the following below the
   83.26 - * License Header, with the fields enclosed by brackets [] replaced by
   83.27 - * your own identifying information:
   83.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   83.29 - *
   83.30 - * If you wish your version of this file to be governed by only the CDDL
   83.31 - * or only the GPL Version 2, indicate your decision by adding
   83.32 - * "[Contributor] elects to include this software in this distribution
   83.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   83.34 - * single choice of license, a recipient has the option to distribute
   83.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   83.36 - * to extend the choice of license to its licensees as provided above.
   83.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   83.38 - * Version 2 license, then the option applies only if the new code is
   83.39 - * made subject to such option by the copyright holder.
   83.40 - *
   83.41 - * Contributor(s):
   83.42 - *
   83.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
   83.44 - */
   83.45 -
   83.46 -package org.netbeans.modules.java.hints.spiimpl;
   83.47 -
   83.48 -import java.util.Collection;
   83.49 -import java.util.Map;
   83.50 -import java.util.concurrent.atomic.AtomicBoolean;
   83.51 -import org.netbeans.api.annotations.common.NullAllowed;
   83.52 -import org.netbeans.api.java.classpath.ClassPath;
   83.53 -import org.netbeans.api.java.source.CompilationInfo;
   83.54 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   83.55 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
   83.56 -import org.openide.util.Lookup;
   83.57 -
   83.58 -/**
   83.59 - *
   83.60 - * @author lahvac
   83.61 - */
   83.62 -public abstract class RulesManager {
   83.63 -
   83.64 -    public static RulesManager getInstance() {
   83.65 -        return Lookup.getDefault().lookup(RulesManager.class);
   83.66 -    }
   83.67 -
   83.68 -    public abstract Map<HintMetadata, ? extends Collection<? extends HintDescription>> readHints(@NullAllowed CompilationInfo info, @NullAllowed Collection<? extends ClassPath> from, @NullAllowed AtomicBoolean cancel);
   83.69 -    public abstract void reload(); //XXX
   83.70 -    
   83.71 -}
    84.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/RulesManagerImpl.java	Sun Jan 08 20:10:08 2017 +0100
    84.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.3 @@ -1,140 +0,0 @@
    84.4 -/*
    84.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    84.6 - *
    84.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
    84.8 - *
    84.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   84.10 - * Other names may be trademarks of their respective owners.
   84.11 - *
   84.12 - * The contents of this file are subject to the terms of either the GNU
   84.13 - * General Public License Version 2 only ("GPL") or the Common
   84.14 - * Development and Distribution License("CDDL") (collectively, the
   84.15 - * "License"). You may not use this file except in compliance with the
   84.16 - * License. You can obtain a copy of the License at
   84.17 - * http://www.netbeans.org/cddl-gplv2.html
   84.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   84.19 - * specific language governing permissions and limitations under the
   84.20 - * License.  When distributing the software, include this License Header
   84.21 - * Notice in each file and include the License file at
   84.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   84.23 - * particular file as subject to the "Classpath" exception as provided
   84.24 - * by Oracle in the GPL Version 2 section of the License file that
   84.25 - * accompanied this code. If applicable, add the following below the
   84.26 - * License Header, with the fields enclosed by brackets [] replaced by
   84.27 - * your own identifying information:
   84.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   84.29 - *
   84.30 - * If you wish your version of this file to be governed by only the CDDL
   84.31 - * or only the GPL Version 2, indicate your decision by adding
   84.32 - * "[Contributor] elects to include this software in this distribution
   84.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   84.34 - * single choice of license, a recipient has the option to distribute
   84.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   84.36 - * to extend the choice of license to its licensees as provided above.
   84.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   84.38 - * Version 2 license, then the option applies only if the new code is
   84.39 - * made subject to such option by the copyright holder.
   84.40 - *
   84.41 - * Contributor(s):
   84.42 - *
   84.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
   84.44 - */
   84.45 -
   84.46 -package org.netbeans.modules.java.hints.spiimpl;
   84.47 -
   84.48 -import java.util.ArrayList;
   84.49 -import java.util.Collection;
   84.50 -import java.util.Collections;
   84.51 -import java.util.HashMap;
   84.52 -import java.util.LinkedList;
   84.53 -import java.util.Map;
   84.54 -import java.util.Map.Entry;
   84.55 -import java.util.concurrent.atomic.AtomicBoolean;
   84.56 -import org.netbeans.api.java.classpath.ClassPath;
   84.57 -import org.netbeans.api.java.source.ClasspathInfo;
   84.58 -import org.netbeans.api.java.source.ClasspathInfo.PathKind;
   84.59 -import org.netbeans.api.java.source.CompilationInfo;
   84.60 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   84.61 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
   84.62 -import org.netbeans.modules.java.hints.providers.spi.ClassPathBasedHintProvider;
   84.63 -import org.netbeans.modules.java.hints.providers.spi.ElementBasedHintProvider;
   84.64 -import org.netbeans.modules.java.hints.providers.spi.HintProvider;
   84.65 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
   84.66 -import org.openide.util.Lookup;
   84.67 -import org.openide.util.lookup.ServiceProvider;
   84.68 -
   84.69 -/**
   84.70 - *
   84.71 - * @author lahvac
   84.72 - */
   84.73 -@ServiceProvider(service=RulesManager.class)
   84.74 -public class RulesManagerImpl extends RulesManager {
   84.75 -
   84.76 -    private final Map<HintMetadata, Collection<HintDescription>> globalHints = new HashMap<HintMetadata, Collection<HintDescription>>();
   84.77 -
   84.78 -    public RulesManagerImpl() {
   84.79 -        reload();
   84.80 -    }
   84.81 -    
   84.82 -    @Override
   84.83 -    public void reload() {
   84.84 -        globalHints.clear();
   84.85 -
   84.86 -        for (HintProvider p : Lookup.getDefault().lookupAll(HintProvider.class)) {
   84.87 -            Map<HintMetadata, ? extends Collection<? extends HintDescription>> pHints = p.computeHints();
   84.88 -
   84.89 -            if (pHints != null) {
   84.90 -                for (Entry<HintMetadata, ? extends Collection<? extends HintDescription>> e : pHints.entrySet()) {
   84.91 -                    globalHints.put(e.getKey(), new ArrayList<HintDescription>(e.getValue()));
   84.92 -                }
   84.93 -            }
   84.94 -        }
   84.95 -    }
   84.96 -
   84.97 -    @Override
   84.98 -    public Map<HintMetadata, ? extends Collection<? extends HintDescription>> readHints(CompilationInfo info, Collection<? extends ClassPath> from, AtomicBoolean cancel) {
   84.99 -        Map<HintMetadata, Collection<HintDescription>> result = new HashMap<HintMetadata, Collection<HintDescription>>(globalHints);
  84.100 -
  84.101 -        if (info != null) {
  84.102 -            for (ElementBasedHintProvider provider : Lookup.getDefault().lookupAll(ElementBasedHintProvider.class)) {
  84.103 -                sortByMetadata(provider.computeHints(info), result);
  84.104 -            }
  84.105 -        }
  84.106 -
  84.107 -        if (from == null) {
  84.108 -            if (info != null) {
  84.109 -                ClasspathInfo cpInfo = info.getClasspathInfo();
  84.110 -                LinkedList<ClassPath> cps = new LinkedList<ClassPath>();
  84.111 -
  84.112 -                cps.add(cpInfo.getClassPath(PathKind.BOOT));
  84.113 -                cps.add(cpInfo.getClassPath(PathKind.COMPILE));
  84.114 -                cps.add(cpInfo.getClassPath(PathKind.SOURCE));
  84.115 -
  84.116 -                from = cps;
  84.117 -            } else {
  84.118 -                from = Collections.emptyList();
  84.119 -            }
  84.120 -        }
  84.121 -
  84.122 -        ClassPath compound = ClassPathSupport.createProxyClassPath(from.toArray(new ClassPath[0]));
  84.123 -
  84.124 -        for (ClassPathBasedHintProvider p : Lookup.getDefault().lookupAll(ClassPathBasedHintProvider.class)) {
  84.125 -            sortByMetadata(p.computeHints(compound), result);
  84.126 -        }
  84.127 -
  84.128 -        return result;
  84.129 -    }
  84.130 -
  84.131 -    public static void sortByMetadata(Collection<? extends HintDescription> listedHints, Map<HintMetadata, Collection<HintDescription>> into) {
  84.132 -        for (HintDescription hd : listedHints) {
  84.133 -            Collection<HintDescription> h = into.get(hd.getMetadata());
  84.134 -
  84.135 -            if (h == null) {
  84.136 -                into.put(hd.getMetadata(), h = new ArrayList<HintDescription>());
  84.137 -            }
  84.138 -
  84.139 -            h.add(hd);
  84.140 -        }
  84.141 -    }
  84.142 -
  84.143 -}
    85.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/SPIAccessor.java	Sun Jan 08 20:10:08 2017 +0100
    85.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.3 @@ -1,86 +0,0 @@
    85.4 -/*
    85.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    85.6 - *
    85.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
    85.8 - *
    85.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   85.10 - * Other names may be trademarks of their respective owners.
   85.11 - *
   85.12 - * The contents of this file are subject to the terms of either the GNU
   85.13 - * General Public License Version 2 only ("GPL") or the Common
   85.14 - * Development and Distribution License("CDDL") (collectively, the
   85.15 - * "License"). You may not use this file except in compliance with the
   85.16 - * License. You can obtain a copy of the License at
   85.17 - * http://www.netbeans.org/cddl-gplv2.html
   85.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   85.19 - * specific language governing permissions and limitations under the
   85.20 - * License.  When distributing the software, include this License Header
   85.21 - * Notice in each file and include the License file at
   85.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   85.23 - * particular file as subject to the "Classpath" exception as provided
   85.24 - * by Oracle in the GPL Version 2 section of the License file that
   85.25 - * accompanied this code. If applicable, add the following below the
   85.26 - * License Header, with the fields enclosed by brackets [] replaced by
   85.27 - * your own identifying information:
   85.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   85.29 - *
   85.30 - * If you wish your version of this file to be governed by only the CDDL
   85.31 - * or only the GPL Version 2, indicate your decision by adding
   85.32 - * "[Contributor] elects to include this software in this distribution
   85.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   85.34 - * single choice of license, a recipient has the option to distribute
   85.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   85.36 - * to extend the choice of license to its licensees as provided above.
   85.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   85.38 - * Version 2 license, then the option applies only if the new code is
   85.39 - * made subject to such option by the copyright holder.
   85.40 - *
   85.41 - * Contributor(s):
   85.42 - *
   85.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
   85.44 - */
   85.45 -package org.netbeans.modules.java.hints.spiimpl;
   85.46 -
   85.47 -import com.sun.source.util.TreePath;
   85.48 -import java.util.Collection;
   85.49 -import java.util.Map;
   85.50 -import java.util.concurrent.atomic.AtomicBoolean;
   85.51 -import javax.lang.model.type.TypeMirror;
   85.52 -import org.netbeans.api.java.source.CompilationInfo;
   85.53 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
   85.54 -import org.netbeans.modules.java.hints.spiimpl.hints.GlobalProcessingContext;
   85.55 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
   85.56 -import org.netbeans.spi.java.hints.HintContext;
   85.57 -import org.openide.util.Exceptions;
   85.58 -
   85.59 -/**
   85.60 - *
   85.61 - * @author lahvac
   85.62 - */
   85.63 -public abstract class SPIAccessor {
   85.64 -
   85.65 -    private static volatile SPIAccessor accessor;
   85.66 -
   85.67 -    public static synchronized SPIAccessor getINSTANCE() {
   85.68 -        if (accessor == null) {
   85.69 -            try {
   85.70 -                Class.forName(HintContext.class.getName(), true, HintContext.class.getClassLoader());
   85.71 -                assert accessor != null;
   85.72 -            } catch (ClassNotFoundException e) {
   85.73 -                Exceptions.printStackTrace(e);
   85.74 -            }
   85.75 -        }
   85.76 -        return accessor;
   85.77 -    }
   85.78 -
   85.79 -    public static void setINSTANCE(SPIAccessor instance) {
   85.80 -        assert instance != null;
   85.81 -        accessor = instance;
   85.82 -    }
   85.83 -
   85.84 -    public abstract HintContext createHintContext(CompilationInfo info, HintsSettings settings, HintMetadata metadata, GlobalProcessingContext globalContext, TreePath path, Map<String, TreePath> variables, Map<String, Collection<? extends TreePath>> multiVariables, Map<String, String> variableNames, Map<String, TypeMirror> constraints, Collection<? super MessageImpl> problems, boolean bulkMode, AtomicBoolean cancel, int caret);
   85.85 -    public abstract HintContext createHintContext(CompilationInfo info, HintsSettings settings, HintMetadata metadata, GlobalProcessingContext globalContext, TreePath path, Map<String, TreePath> variables, Map<String, Collection<? extends TreePath>> multiVariables, Map<String, String> variableNames);
   85.86 -    public abstract HintMetadata getHintMetadata(HintContext ctx);
   85.87 -    public abstract HintsSettings getHintSettings(HintContext ctx);
   85.88 -
   85.89 -}
    86.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/SyntheticFix.java	Sun Jan 08 20:10:08 2017 +0100
    86.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.3 @@ -1,46 +0,0 @@
    86.4 -/*
    86.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    86.6 - *
    86.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    86.8 - *
    86.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   86.10 - * Other names may be trademarks of their respective owners.
   86.11 - *
   86.12 - * The contents of this file are subject to the terms of either the GNU
   86.13 - * General Public License Version 2 only ("GPL") or the Common Development and
   86.14 - * Distribution License("CDDL") (collectively, the "License"). You may not use
   86.15 - * this file except in compliance with the License. You can obtain a copy of
   86.16 - * the License at http://www.netbeans.org/cddl-gplv2.html or
   86.17 - * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
   86.18 - * governing permissions and limitations under the License. When distributing
   86.19 - * the software, include this License Header Notice in each file and include
   86.20 - * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
   86.21 - * particular file as subject to the "Classpath" exception as provided by
   86.22 - * Oracle in the GPL Version 2 section of the License file that accompanied
   86.23 - * this code. If applicable, add the following below the License Header, with
   86.24 - * the fields enclosed by brackets [] replaced by your own identifying
   86.25 - * information: "Portions Copyrighted [year] [name of copyright owner]"
   86.26 - *
   86.27 - * If you wish your version of this file to be governed by only the CDDL or
   86.28 - * only the GPL Version 2, indicate your decision by adding "[Contributor]
   86.29 - * elects to include this software in this distribution under the [CDDL or GPL
   86.30 - * Version 2] license." If you do not indicate a single choice of license, a
   86.31 - * recipient has the option to distribute your version of this file under
   86.32 - * either the CDDL, the GPL Version 2 or to extend the choice of license to its
   86.33 - * licensees as provided above. However, if you add GPL Version 2 code and
   86.34 - * therefore, elected the GPL Version 2 license, then the option applies only
   86.35 - * if the new code is made subject to such option by the copyright holder.
   86.36 - *
   86.37 - * Contributor(s):
   86.38 - *
   86.39 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
   86.40 - */
   86.41 -package org.netbeans.modules.java.hints.spiimpl;
   86.42 -
   86.43 -/**
   86.44 - *
   86.45 - * @author lahvac
   86.46 - */
   86.47 -public interface SyntheticFix {
   86.48 -
   86.49 -}
    87.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java	Sun Jan 08 20:10:08 2017 +0100
    87.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.3 @@ -1,1554 +0,0 @@
    87.4 -/*
    87.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    87.6 - *
    87.7 - * Copyright 2008-2010 Sun Microsystems, Inc. All rights reserved.
    87.8 - *
    87.9 - * The contents of this file are subject to the terms of either the GNU
   87.10 - * General Public License Version 2 only ("GPL") or the Common
   87.11 - * Development and Distribution License("CDDL") (collectively, the
   87.12 - * "License"). You may not use this file except in compliance with the
   87.13 - * License. You can obtain a copy of the License at
   87.14 - * http://www.netbeans.org/cddl-gplv2.html
   87.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   87.16 - * specific language governing permissions and limitations under the
   87.17 - * License.  When distributing the software, include this License Header
   87.18 - * Notice in each file and include the License file at
   87.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   87.20 - * particular file as subject to the "Classpath" exception as provided
   87.21 - * by Sun in the GPL Version 2 section of the License file that
   87.22 - * accompanied this code. If applicable, add the following below the
   87.23 - * License Header, with the fields enclosed by brackets [] replaced by
   87.24 - * your own identifying information:
   87.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   87.26 - *
   87.27 - * If you wish your version of this file to be governed by only the CDDL
   87.28 - * or only the GPL Version 2, indicate your decision by adding
   87.29 - * "[Contributor] elects to include this software in this distribution
   87.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   87.31 - * single choice of license, a recipient has the option to distribute
   87.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   87.33 - * to extend the choice of license to its licensees as provided above.
   87.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   87.35 - * Version 2 license, then the option applies only if the new code is
   87.36 - * made subject to such option by the copyright holder.
   87.37 - *
   87.38 - * Contributor(s):
   87.39 - *
   87.40 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
   87.41 - */
   87.42 -
   87.43 -package org.netbeans.modules.java.hints.spiimpl;
   87.44 -
   87.45 -import com.sun.source.tree.AnnotationTree;
   87.46 -import com.sun.source.tree.AssignmentTree;
   87.47 -import com.sun.source.tree.BlockTree;
   87.48 -import com.sun.source.tree.ClassTree;
   87.49 -import com.sun.source.tree.CompilationUnitTree;
   87.50 -import com.sun.source.tree.ExpressionStatementTree;
   87.51 -import com.sun.source.tree.ExpressionTree;
   87.52 -import com.sun.source.tree.IdentifierTree;
   87.53 -import com.sun.source.tree.ImportTree;
   87.54 -import com.sun.source.tree.LiteralTree;
   87.55 -import com.sun.source.tree.MemberSelectTree;
   87.56 -import com.sun.source.tree.MethodInvocationTree;
   87.57 -import com.sun.source.tree.MethodTree;
   87.58 -import com.sun.source.tree.ModifiersTree;
   87.59 -import com.sun.source.tree.NewArrayTree;
   87.60 -import com.sun.source.tree.NewClassTree;
   87.61 -import com.sun.source.tree.Scope;
   87.62 -import com.sun.source.tree.StatementTree;
   87.63 -import com.sun.source.tree.SwitchTree;
   87.64 -import com.sun.source.tree.Tree;
   87.65 -import com.sun.source.tree.Tree.Kind;
   87.66 -import com.sun.source.tree.TypeParameterTree;
   87.67 -import com.sun.source.tree.VariableTree;
   87.68 -import com.sun.source.util.SourcePositions;
   87.69 -import com.sun.source.util.TreePath;
   87.70 -import com.sun.source.util.TreePathScanner;
   87.71 -import com.sun.source.util.TreeScanner;
   87.72 -import com.sun.source.util.Trees;
   87.73 -import com.sun.tools.javac.api.JavacScope;
   87.74 -import com.sun.tools.javac.api.JavacTaskImpl;
   87.75 -import com.sun.tools.javac.api.JavacTrees;
   87.76 -import com.sun.tools.javac.code.Flags;
   87.77 -import com.sun.tools.javac.code.Symtab;
   87.78 -import com.sun.tools.javac.code.Type;
   87.79 -import com.sun.tools.javac.comp.Attr;
   87.80 -import com.sun.tools.javac.comp.AttrContext;
   87.81 -import com.sun.tools.javac.comp.Env;
   87.82 -import com.sun.tools.javac.comp.Todo;
   87.83 -import com.sun.tools.javac.main.JavaCompiler;
   87.84 -import com.sun.tools.javac.parser.JavacParser;
   87.85 -import com.sun.tools.javac.parser.Lexer;
   87.86 -import com.sun.tools.javac.parser.Parser;
   87.87 -import com.sun.tools.javac.parser.ParserFactory;
   87.88 -import com.sun.tools.javac.parser.Scanner;
   87.89 -import com.sun.tools.javac.parser.ScannerFactory;
   87.90 -import com.sun.tools.javac.parser.Tokens.Token;
   87.91 -import com.sun.tools.javac.parser.Tokens.TokenKind;
   87.92 -import com.sun.tools.javac.tree.JCTree;
   87.93 -import com.sun.tools.javac.tree.JCTree.JCCase;
   87.94 -import com.sun.tools.javac.tree.JCTree.JCCatch;
   87.95 -import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
   87.96 -import com.sun.tools.javac.tree.JCTree.JCExpression;
   87.97 -import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
   87.98 -import com.sun.tools.javac.tree.JCTree.JCIdent;
   87.99 -import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
  87.100 -import com.sun.tools.javac.tree.JCTree.JCModifiers;
  87.101 -import com.sun.tools.javac.tree.JCTree.JCStatement;
  87.102 -import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
  87.103 -import com.sun.tools.javac.util.Context;
  87.104 -import com.sun.tools.javac.util.JCDiagnostic;
  87.105 -import com.sun.tools.javac.util.ListBuffer;
  87.106 -import com.sun.tools.javac.util.Log;
  87.107 -import com.sun.tools.javac.util.Names;
  87.108 -import com.sun.tools.javadoc.Messager;
  87.109 -import java.io.File;
  87.110 -import java.io.IOException;
  87.111 -import java.net.URI;
  87.112 -import java.nio.CharBuffer;
  87.113 -import java.util.Arrays;
  87.114 -import java.util.Collection;
  87.115 -import java.util.Collections;
  87.116 -import java.util.EnumSet;
  87.117 -import java.util.HashMap;
  87.118 -import java.util.HashSet;
  87.119 -import java.util.Iterator;
  87.120 -import java.util.LinkedList;
  87.121 -import java.util.List;
  87.122 -import java.util.Locale;
  87.123 -import java.util.Map;
  87.124 -import java.util.Map.Entry;
  87.125 -import java.util.Set;
  87.126 -import java.util.concurrent.atomic.AtomicBoolean;
  87.127 -import javax.lang.model.element.AnnotationMirror;
  87.128 -import javax.lang.model.element.AnnotationValue;
  87.129 -import javax.lang.model.element.AnnotationValueVisitor;
  87.130 -import javax.lang.model.element.Element;
  87.131 -import javax.lang.model.element.ElementKind;
  87.132 -import javax.lang.model.element.ExecutableElement;
  87.133 -import javax.lang.model.element.Modifier;
  87.134 -import javax.lang.model.element.Name;
  87.135 -import javax.lang.model.element.TypeElement;
  87.136 -import javax.lang.model.element.VariableElement;
  87.137 -import javax.lang.model.type.TypeKind;
  87.138 -import javax.lang.model.type.TypeMirror;
  87.139 -import javax.lang.model.util.Elements;
  87.140 -import javax.tools.Diagnostic;
  87.141 -import javax.tools.JavaCompiler.CompilationTask;
  87.142 -import javax.tools.JavaFileObject;
  87.143 -import javax.tools.SimpleJavaFileObject;
  87.144 -import org.netbeans.api.annotations.common.CheckForNull;
  87.145 -import org.netbeans.api.annotations.common.NonNull;
  87.146 -import org.netbeans.api.java.classpath.ClassPath;
  87.147 -import org.netbeans.api.java.platform.JavaPlatform;
  87.148 -import org.netbeans.api.java.platform.JavaPlatformManager;
  87.149 -import org.netbeans.api.java.queries.SourceForBinaryQuery;
  87.150 -import org.netbeans.api.java.queries.SourceForBinaryQuery.Result2;
  87.151 -import org.netbeans.api.java.source.ClasspathInfo;
  87.152 -import org.netbeans.api.java.source.CompilationInfo;
  87.153 -import org.netbeans.api.java.source.CompilationInfo.CacheClearPolicy;
  87.154 -import org.netbeans.api.java.source.SourceUtils;
  87.155 -import org.netbeans.api.java.source.TreeMaker;
  87.156 -import org.netbeans.modules.java.hints.providers.spi.ClassPathBasedHintProvider;
  87.157 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
  87.158 -import org.netbeans.modules.java.hints.providers.spi.Trigger.PatternDescription;
  87.159 -import org.netbeans.modules.java.hints.spiimpl.JackpotTrees.CatchWildcard;
  87.160 -import org.netbeans.modules.java.hints.spiimpl.JackpotTrees.VariableWildcard;
  87.161 -import org.netbeans.modules.java.source.JavaSourceAccessor;
  87.162 -import org.netbeans.modules.java.source.builder.TreeFactory;
  87.163 -import org.netbeans.lib.nbjavac.services.CancelService;
  87.164 -import org.netbeans.lib.nbjavac.services.NBParserFactory.NBJavacParser;
  87.165 -import org.netbeans.lib.nbjavac.services.NBParserFactory;
  87.166 -import org.netbeans.lib.nbjavac.services.NBResolve;
  87.167 -import org.netbeans.modules.java.hints.spiimpl.JackpotTrees.AnnotationWildcard;
  87.168 -import org.netbeans.modules.java.hints.spiimpl.JackpotTrees.FakeBlock;
  87.169 -import org.netbeans.modules.java.source.parsing.FileObjects;
  87.170 -import org.netbeans.modules.java.source.pretty.ImportAnalysis2;
  87.171 -import org.netbeans.modules.java.source.transform.ImmutableTreeTranslator;
  87.172 -import org.netbeans.spi.editor.hints.Severity;
  87.173 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
  87.174 -import org.openide.filesystems.FileObject;
  87.175 -import org.openide.filesystems.FileUtil;
  87.176 -import org.openide.util.Lookup;
  87.177 -import org.openide.util.NbCollections;
  87.178 -import org.openide.util.lookup.ServiceProvider;
  87.179 -
  87.180 -/**
  87.181 - *
  87.182 - * @author Jan Lahoda
  87.183 - */
  87.184 -public class Utilities {
  87.185 -
  87.186 -    private Utilities() {}
  87.187 -    
  87.188 -    public static Set<Severity> disableErrors(FileObject file) {
  87.189 -        if (file.getAttribute(DISABLE_ERRORS) != null) {
  87.190 -            return EnumSet.allOf(Severity.class);
  87.191 -        }
  87.192 -        if (!file.canWrite() && FileUtil.getArchiveFile(file) != null) {
  87.193 -            return EnumSet.allOf(Severity.class);
  87.194 -        }
  87.195 -
  87.196 -        return EnumSet.noneOf(Severity.class);
  87.197 -    }
  87.198 -
  87.199 -    private static final String DISABLE_ERRORS = "disable-java-errors";
  87.200 -    
  87.201 -
  87.202 -    public static <E> Iterable<E> checkedIterableByFilter(final Iterable raw, final Class<E> type, final boolean strict) {
  87.203 -        return new Iterable<E>() {
  87.204 -            public Iterator<E> iterator() {
  87.205 -                return NbCollections.checkedIteratorByFilter(raw.iterator(), type, strict);
  87.206 -            }
  87.207 -        };
  87.208 -    }
  87.209 -    
  87.210 -//    public static AnnotationTree constructConstraint(WorkingCopy wc, String name, TypeMirror tm) {
  87.211 -//        TreeMaker make = wc.getTreeMaker();
  87.212 -//        ExpressionTree variable = prepareAssignment(make, "variable", make.Literal(name));
  87.213 -//        ExpressionTree type     = prepareAssignment(make, "type", make.MemberSelect((ExpressionTree) make.Type(wc.getTypes().erasure(tm)), "class"));
  87.214 -//        TypeElement constraint  = wc.getElements().getTypeElement(Annotations.CONSTRAINT.toFQN());
  87.215 -//
  87.216 -//        return make.Annotation(make.QualIdent(constraint), Arrays.asList(variable, type));
  87.217 -//    }
  87.218 -
  87.219 -    public static ExpressionTree prepareAssignment(TreeMaker make, String name, ExpressionTree value) {
  87.220 -        return make.Assignment(make.Identifier(name), value);
  87.221 -    }
  87.222 -
  87.223 -    public static ExpressionTree findValue(AnnotationTree m, String name) {
  87.224 -        for (ExpressionTree et : m.getArguments()) {
  87.225 -            if (et.getKind() == Kind.ASSIGNMENT) {
  87.226 -                AssignmentTree at = (AssignmentTree) et;
  87.227 -                String varName = ((IdentifierTree) at.getVariable()).getName().toString();
  87.228 -
  87.229 -                if (varName.equals(name)) {
  87.230 -                    return at.getExpression();
  87.231 -                }
  87.232 -            }
  87.233 -
  87.234 -            if (et instanceof LiteralTree/*XXX*/ && "value".equals(name)) {
  87.235 -                return et;
  87.236 -            }
  87.237 -        }
  87.238 -
  87.239 -        return null;
  87.240 -    }
  87.241 -
  87.242 -    public static List<AnnotationTree> findArrayValue(AnnotationTree at, String name) {
  87.243 -        ExpressionTree fixesArray = findValue(at, name);
  87.244 -        List<AnnotationTree> fixes = new LinkedList<AnnotationTree>();
  87.245 -
  87.246 -        if (fixesArray != null && fixesArray.getKind() == Kind.NEW_ARRAY) {
  87.247 -            NewArrayTree trees = (NewArrayTree) fixesArray;
  87.248 -
  87.249 -            for (ExpressionTree fix : trees.getInitializers()) {
  87.250 -                if (fix.getKind() == Kind.ANNOTATION) {
  87.251 -                    fixes.add((AnnotationTree) fix);
  87.252 -                }
  87.253 -            }
  87.254 -        }
  87.255 -
  87.256 -        if (fixesArray != null && fixesArray.getKind() == Kind.ANNOTATION) {
  87.257 -            fixes.add((AnnotationTree) fixesArray);
  87.258 -        }
  87.259 -        
  87.260 -        return fixes;
  87.261 -    }
  87.262 -
  87.263 -    public static boolean isPureMemberSelect(Tree mst, boolean allowVariables) {
  87.264 -        switch (mst.getKind()) {
  87.265 -            case IDENTIFIER: return allowVariables || ((IdentifierTree) mst).getName().charAt(0) != '$';
  87.266 -            case MEMBER_SELECT: return isPureMemberSelect(((MemberSelectTree) mst).getExpression(), allowVariables);
  87.267 -            default: return false;
  87.268 -        }
  87.269 -    }
  87.270 -
  87.271 -    public static Map<String, Collection<HintDescription>> sortOutHints(Iterable<? extends HintDescription> hints, Map<String, Collection<HintDescription>> output) {
  87.272 -        for (HintDescription d : hints) {
  87.273 -            Collection<HintDescription> h = output.get(d.getMetadata().displayName);
  87.274 -
  87.275 -            if (h == null) {
  87.276 -                output.put(d.getMetadata().displayName, h = new LinkedList<HintDescription>());
  87.277 -            }
  87.278 -
  87.279 -            h.add(d);
  87.280 -        }
  87.281 -
  87.282 -        return output;
  87.283 -    }
  87.284 -
  87.285 -    public static List<HintDescription> listAllHints(Set<ClassPath> cps) {
  87.286 -        List<HintDescription> result = new LinkedList<HintDescription>();
  87.287 -
  87.288 -        for (Collection<? extends HintDescription> hints : RulesManager.getInstance().readHints(null, cps, new AtomicBoolean()).values()) {
  87.289 -            for (HintDescription hd : hints) {
  87.290 -                if (!(hd.getTrigger() instanceof PatternDescription)) continue; //TODO: only pattern based hints are currently supported
  87.291 -                result.add(hd);
  87.292 -            }
  87.293 -        }
  87.294 -
  87.295 -        result.addAll(listClassPathHints(Collections.<ClassPath>emptySet(), cps));
  87.296 -
  87.297 -        return result;
  87.298 -    }
  87.299 -
  87.300 -    public static List<HintDescription> listClassPathHints(Set<ClassPath> sourceCPs, Set<ClassPath> binaryCPs) {
  87.301 -        List<HintDescription> result = new LinkedList<HintDescription>();
  87.302 -        Set<FileObject> roots = new HashSet<FileObject>();
  87.303 -
  87.304 -        for (ClassPath cp : binaryCPs) {
  87.305 -            for (FileObject r : cp.getRoots()) {
  87.306 -                Result2 src = SourceForBinaryQuery.findSourceRoots2(r.toURL());
  87.307 -
  87.308 -                if (src != null && src.preferSources()) {
  87.309 -                    roots.addAll(Arrays.asList(src.getRoots()));
  87.310 -                } else {
  87.311 -                    roots.add(r);
  87.312 -                }
  87.313 -            }
  87.314 -        }
  87.315 -
  87.316 -        Set<ClassPath> cps = new HashSet<ClassPath>(sourceCPs);
  87.317 -
  87.318 -        cps.add(ClassPathSupport.createClassPath(roots.toArray(new FileObject[0])));
  87.319 -
  87.320 -        ClassPath cp = ClassPathSupport.createProxyClassPath(cps.toArray(new ClassPath[0]));
  87.321 -
  87.322 -        for (ClassPathBasedHintProvider p : Lookup.getDefault().lookupAll(ClassPathBasedHintProvider.class)) {
  87.323 -            result.addAll(p.computeHints(cp));
  87.324 -        }
  87.325 -
  87.326 -        return result;
  87.327 -    }
  87.328 -    
  87.329 -    public static Tree parseAndAttribute(CompilationInfo info, String pattern, Scope scope) {
  87.330 -        return parseAndAttribute(info, pattern, scope, null);
  87.331 -    }
  87.332 -
  87.333 -    public static Tree parseAndAttribute(CompilationInfo info, String pattern, Scope scope, Collection<Diagnostic<? extends JavaFileObject>> errors) {
  87.334 -        return parseAndAttribute(info, JavaSourceAccessor.getINSTANCE().getJavacTask(info), pattern, scope, errors);
  87.335 -    }
  87.336 -
  87.337 -    public static Tree parseAndAttribute(CompilationInfo info, String pattern, Scope scope, SourcePositions[] sourcePositions, Collection<Diagnostic<? extends JavaFileObject>> errors) {
  87.338 -        return parseAndAttribute(info, JavaSourceAccessor.getINSTANCE().getJavacTask(info), pattern, scope, sourcePositions, errors);
  87.339 -    }
  87.340 -
  87.341 -    public static Tree parseAndAttribute(JavacTaskImpl jti, String pattern) {
  87.342 -        return parseAndAttribute(jti, pattern, null);
  87.343 -    }
  87.344 -
  87.345 -    public static Tree parseAndAttribute(JavacTaskImpl jti, String pattern, Collection<Diagnostic<? extends JavaFileObject>> errors) {
  87.346 -        return parseAndAttribute(null, jti, pattern, null, errors);
  87.347 -    }
  87.348 -
  87.349 -    public static Tree parseAndAttribute(JavacTaskImpl jti, String pattern, SourcePositions[] sourcePositions, Collection<Diagnostic<? extends JavaFileObject>> errors) {
  87.350 -        return parseAndAttribute(null, jti, pattern, null, sourcePositions, errors);
  87.351 -    }
  87.352 -
  87.353 -    private static Tree parseAndAttribute(CompilationInfo info, JavacTaskImpl jti, String pattern, Scope scope, Collection<Diagnostic<? extends JavaFileObject>> errors) {
  87.354 -        return parseAndAttribute(info, jti, pattern, scope, new SourcePositions[1], errors);
  87.355 -    }
  87.356 -
  87.357 -    private static Tree parseAndAttribute(CompilationInfo info, JavacTaskImpl jti, String pattern, Scope scope, SourcePositions[] sourcePositions, Collection<Diagnostic<? extends JavaFileObject>> errors) {
  87.358 -        Context c = jti.getContext();
  87.359 -        TreeFactory make = TreeFactory.instance(c);
  87.360 -        List<Diagnostic<? extends JavaFileObject>> patternTreeErrors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
  87.361 -        Tree toAttribute;
  87.362 -        Tree patternTree = toAttribute = !isStatement(pattern) ? parseExpression(c, pattern, true, sourcePositions, patternTreeErrors) : null;
  87.363 -        int offset = 0;
  87.364 -        boolean expression = true;
  87.365 -        boolean classMember = false;
  87.366 -
  87.367 -        if (pattern.startsWith("case ")) {//XXX: should be a lexer token
  87.368 -            List<Diagnostic<? extends JavaFileObject>> currentPatternTreeErrors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
  87.369 -            Tree switchTree = parseStatement(c, "switch ($$foo) {" + pattern + "}", sourcePositions, currentPatternTreeErrors);
  87.370 -
  87.371 -            offset = "switch ($$foo) {".length();
  87.372 -            patternTreeErrors = currentPatternTreeErrors;
  87.373 -            patternTree = toAttribute = ((SwitchTree) switchTree).getCases().get(0);
  87.374 -        }
  87.375 -
  87.376 -        if (patternTree == null || isErrorTree(patternTree)) {
  87.377 -            SourcePositions[] currentPatternTreePositions = new SourcePositions[1];
  87.378 -            List<Diagnostic<? extends JavaFileObject>> currentPatternTreeErrors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
  87.379 -            Tree currentPatternTree = parseStatement(c, "{" + pattern + "}", currentPatternTreePositions, currentPatternTreeErrors);
  87.380 -
  87.381 -            assert currentPatternTree.getKind() == Kind.BLOCK : currentPatternTree.getKind();
  87.382 -
  87.383 -            List<? extends StatementTree> statements = ((BlockTree) currentPatternTree).getStatements();
  87.384 -
  87.385 -            if (statements.size() == 1) {
  87.386 -                currentPatternTree = statements.get(0);
  87.387 -            } else {
  87.388 -                com.sun.tools.javac.util.List<JCStatement> newStatements = com.sun.tools.javac.util.List.<JCStatement>nil();
  87.389 -
  87.390 -                if (!statements.isEmpty() && !Utilities.isMultistatementWildcardTree(statements.get(0)))
  87.391 -                    newStatements = newStatements.append((JCStatement) make.ExpressionStatement(make.Identifier("$$1$")));
  87.392 -                for (StatementTree st : statements) {
  87.393 -                    newStatements = newStatements.append((JCStatement) st);
  87.394 -                }
  87.395 -                if (!statements.isEmpty() && !Utilities.isMultistatementWildcardTree(statements.get(statements.size() - 1)))
  87.396 -                    newStatements = newStatements.append((JCStatement) make.ExpressionStatement(make.Identifier("$$2$")));
  87.397 -
  87.398 -                currentPatternTree = new FakeBlock(0L, newStatements);
  87.399 -            }
  87.400 -
  87.401 -            if (!currentPatternTreeErrors.isEmpty() || containsError(currentPatternTree)) {
  87.402 -                //maybe a class member?
  87.403 -                SourcePositions[] classPatternTreePositions = new SourcePositions[1];
  87.404 -                List<Diagnostic<? extends JavaFileObject>> classPatternTreeErrors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
  87.405 -                Tree classPatternTree = parseExpression(c, "new Object() {" + pattern + "}", false, classPatternTreePositions, classPatternTreeErrors);
  87.406 -
  87.407 -                if (!containsError(classPatternTree)) {
  87.408 -                    sourcePositions[0] = classPatternTreePositions[0];
  87.409 -                    offset = "new Object() {".length();
  87.410 -                    patternTreeErrors = classPatternTreeErrors;
  87.411 -                    patternTree = toAttribute = classPatternTree;
  87.412 -                    classMember = true;
  87.413 -                } else {
  87.414 -                    offset = 1;
  87.415 -                    sourcePositions[0] = currentPatternTreePositions[0];
  87.416 -                    VariableTree var;
  87.417 -                    Names names = Names.instance(jti.getContext());
  87.418 -                    if (currentPatternTree.getKind() == Kind.VARIABLE && (var = ((VariableTree) currentPatternTree)).getType().getKind() == Kind.ERRONEOUS && var.getName() == names.error && var.getInitializer() == null && var.getModifiers().getAnnotations().size() == 1 && !containsError(var.getModifiers().getAnnotations().get(0))) {
  87.419 -                        patternTreeErrors = currentPatternTreeErrors; //TODO: the errors are incorrect
  87.420 -                        toAttribute = currentPatternTree;
  87.421 -                        patternTree = var.getModifiers().getAnnotations().get(0);
  87.422 -                    } else {
  87.423 -                        patternTreeErrors = currentPatternTreeErrors;
  87.424 -                        patternTree = toAttribute = currentPatternTree;
  87.425 -                    }
  87.426 -                }
  87.427 -            } else {
  87.428 -                sourcePositions[0] = currentPatternTreePositions[0];
  87.429 -                offset = 1;
  87.430 -                patternTreeErrors = currentPatternTreeErrors;
  87.431 -                patternTree = toAttribute = currentPatternTree;
  87.432 -            }
  87.433 -
  87.434 -            expression = false;
  87.435 -        }
  87.436 -
  87.437 -        if (scope != null) {
  87.438 -            TypeMirror type = attributeTree(jti, toAttribute, scope, patternTreeErrors);
  87.439 -
  87.440 -            if (isError(type) && expression) {
  87.441 -                //maybe type?
  87.442 -                if (Utilities.isPureMemberSelect(patternTree, false)) {
  87.443 -                    SourcePositions[] varPositions = new SourcePositions[1];
  87.444 -                    List<Diagnostic<? extends JavaFileObject>> varErrors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
  87.445 -                    Tree var = parseExpression(c, pattern + ".Class.class;", false, varPositions, varErrors);
  87.446 -
  87.447 -                    attributeTree(jti, var, scope, varErrors);
  87.448 -
  87.449 -                    ExpressionTree typeTree = ((MemberSelectTree) ((MemberSelectTree) var).getExpression()).getExpression();
  87.450 -                    final Symtab symtab = Symtab.instance(c);
  87.451 -                    final Elements el = jti.getElements();
  87.452 -                    final Trees trees = JavacTrees.instance(c);
  87.453 -                    CompilationUnitTree cut = ((JavacScope) scope).getEnv().toplevel;
  87.454 -                    final boolean[] found = new boolean[1];
  87.455 -
  87.456 -                    new TreePathScanner<Void, Void>() {
  87.457 -                        @Override public Void visitMemberSelect(MemberSelectTree node, Void p) {
  87.458 -                            Element currentElement = trees.getElement(getCurrentPath());
  87.459 -
  87.460 -                            if (!isError(currentElement)) {
  87.461 -                                if (currentElement.getKind() == ElementKind.PACKAGE && el.getPackageElement(node.toString()) == null) {
  87.462 -                                    ((JCFieldAccess) node).sym = symtab.errSymbol;
  87.463 -                                    ((JCFieldAccess) node).type = symtab.errType;
  87.464 -                                } else {
  87.465 -                                    found[0] = true;
  87.466 -                                    return null;
  87.467 -                                }
  87.468 -                            }
  87.469 -
  87.470 -                            return super.visitMemberSelect(node, p);
  87.471 -                        }
  87.472 -                        @Override public Void visitIdentifier(IdentifierTree node, Void p) {
  87.473 -                            Element currentElement = trees.getElement(getCurrentPath());
  87.474 -
  87.475 -                            if (!isError(currentElement)) {
  87.476 -                                if (currentElement.getKind() == ElementKind.PACKAGE && el.getPackageElement(node.toString()) == null) {
  87.477 -                                    ((JCIdent) node).sym = symtab.errSymbol;
  87.478 -                                    ((JCIdent) node).type = symtab.errType;
  87.479 -                                } else {
  87.480 -                                    found[0] = true;
  87.481 -                                    return null;
  87.482 -                                }
  87.483 -                            }
  87.484 -                            return super.visitIdentifier(node, p);
  87.485 -                        }
  87.486 -
  87.487 -                    }.scan(new TreePath(new TreePath(cut), typeTree), null);
  87.488 -
  87.489 -                    if (found[0]) {
  87.490 -                        sourcePositions[0] = varPositions[0];
  87.491 -                        offset = 0;
  87.492 -                        patternTreeErrors = varErrors;
  87.493 -                        patternTree = typeTree;
  87.494 -                    }
  87.495 -                }
  87.496 -            }
  87.497 -        }
  87.498 -
  87.499 -        if (classMember) {
  87.500 -            List<? extends Tree> members = ((NewClassTree) patternTree).getClassBody().getMembers();
  87.501 -            
  87.502 -            int syntheticOffset = !members.isEmpty() && members.get(0).getKind() == Kind.METHOD && (((JCMethodDecl) members.get(0)).mods.flags & Flags.GENERATEDCONSTR) != 0 ? 1 : 0;
  87.503 -
  87.504 -            if (members.size() > 1 + syntheticOffset) {
  87.505 -                ModifiersTree mt = make.Modifiers(EnumSet.noneOf(Modifier.class));
  87.506 -                List<Tree> newMembers = new LinkedList<Tree>();
  87.507 -
  87.508 -                newMembers.add(make.ExpressionStatement(make.Identifier("$$1$")));
  87.509 -                newMembers.addAll(members.subList(syntheticOffset, members.size()));
  87.510 -
  87.511 -                patternTree = make.Class(mt, "$", Collections.<TypeParameterTree>emptyList(), null, Collections.<Tree>emptyList(), newMembers);
  87.512 -            } else {
  87.513 -                patternTree = members.get(0 + syntheticOffset);
  87.514 -            }
  87.515 -        }
  87.516 -
  87.517 -        if (errors != null) {
  87.518 -            for (Diagnostic<? extends JavaFileObject> d : patternTreeErrors) {
  87.519 -                errors.add(new OffsetDiagnostic<JavaFileObject>(d, -offset));
  87.520 -            }
  87.521 -        }
  87.522 -
  87.523 -        sourcePositions[0] = new OffsetSourcePositions(sourcePositions[0], -offset);
  87.524 -        
  87.525 -        return patternTree;
  87.526 -    }
  87.527 -
  87.528 -    static boolean isError(Element el) {
  87.529 -        return (el == null || (el.getKind() == ElementKind.CLASS) && isError(((TypeElement) el).asType()));
  87.530 -    }
  87.531 -
  87.532 -    private static boolean isError(TypeMirror type) {
  87.533 -        return type == null || type.getKind() == TypeKind.ERROR;
  87.534 -    }
  87.535 -
  87.536 -    private static boolean isStatement(String pattern) {
  87.537 -        return pattern.trim().endsWith(";");
  87.538 -    }
  87.539 -
  87.540 -    private static boolean isErrorTree(Tree t) {
  87.541 -        return t.getKind() == Kind.ERRONEOUS || (t.getKind() == Kind.IDENTIFIER && ((IdentifierTree) t).getName().contentEquals("<error>")); //TODO: <error>...
  87.542 -    }
  87.543 -    
  87.544 -    private static boolean containsError(Tree t) {
  87.545 -        return new TreeScanner<Boolean, Void>() {
  87.546 -            @Override
  87.547 -            public Boolean scan(Tree node, Void p) {
  87.548 -                if (node != null && isErrorTree(node)) {
  87.549 -                    return true;
  87.550 -                }
  87.551 -                return super.scan(node, p) ==Boolean.TRUE;
  87.552 -            }
  87.553 -            @Override
  87.554 -            public Boolean reduce(Boolean r1, Boolean r2) {
  87.555 -                return r1 == Boolean.TRUE || r2 == Boolean.TRUE;
  87.556 -            }
  87.557 -        }.scan(t, null);
  87.558 -    }
  87.559 -
  87.560 -    private static JCStatement parseStatement(Context context, CharSequence stmt, SourcePositions[] pos, final List<Diagnostic<? extends JavaFileObject>> errors) {
  87.561 -        if (stmt == null || (pos != null && pos.length != 1))
  87.562 -            throw new IllegalArgumentException();
  87.563 -        JavaCompiler compiler = JavaCompiler.instance(context);
  87.564 -        JavaFileObject prev = compiler.log.useSource(new DummyJFO());
  87.565 -        Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(compiler.log) {
  87.566 -            @Override
  87.567 -            public void report(JCDiagnostic diag) {
  87.568 -                errors.add(diag);
  87.569 -            }            
  87.570 -        };
  87.571 -        try {
  87.572 -            CharBuffer buf = CharBuffer.wrap((stmt+"\u0000").toCharArray(), 0, stmt.length());
  87.573 -            ParserFactory factory = ParserFactory.instance(context);
  87.574 -            ScannerFactory scannerFactory = ScannerFactory.instance(context);
  87.575 -            Names names = Names.instance(context);
  87.576 -            Parser parser = new JackpotJavacParser(context, (NBParserFactory) factory, scannerFactory.newScanner(buf, false), false, false, CancelService.instance(context), names);
  87.577 -            if (parser instanceof JavacParser) {
  87.578 -                if (pos != null)
  87.579 -                    pos[0] = new ParserSourcePositions((JavacParser)parser);
  87.580 -                return parser.parseStatement();
  87.581 -            }
  87.582 -            return null;
  87.583 -        } finally {
  87.584 -            compiler.log.useSource(prev);
  87.585 -            compiler.log.popDiagnosticHandler(discardHandler);
  87.586 -        }
  87.587 -    }
  87.588 -
  87.589 -    private static JCExpression parseExpression(Context context, CharSequence expr, boolean onlyFullInput, SourcePositions[] pos, final List<Diagnostic<? extends JavaFileObject>> errors) {
  87.590 -        if (expr == null || (pos != null && pos.length != 1))
  87.591 -            throw new IllegalArgumentException();
  87.592 -        JavaCompiler compiler = JavaCompiler.instance(context);
  87.593 -        JavaFileObject prev = compiler.log.useSource(new DummyJFO());
  87.594 -        Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(compiler.log) {
  87.595 -            @Override
  87.596 -            public void report(JCDiagnostic diag) {
  87.597 -                errors.add(diag);
  87.598 -            }            
  87.599 -        };
  87.600 -        try {
  87.601 -            CharBuffer buf = CharBuffer.wrap((expr+"\u0000").toCharArray(), 0, expr.length());
  87.602 -            ParserFactory factory = ParserFactory.instance(context);
  87.603 -            ScannerFactory scannerFactory = ScannerFactory.instance(context);
  87.604 -            Names names = Names.instance(context);
  87.605 -            Scanner scanner = scannerFactory.newScanner(buf, false);
  87.606 -            Parser parser = new JackpotJavacParser(context, (NBParserFactory) factory, scanner, false, false, CancelService.instance(context), names);
  87.607 -            if (parser instanceof JavacParser) {
  87.608 -                if (pos != null)
  87.609 -                    pos[0] = new ParserSourcePositions((JavacParser)parser);
  87.610 -                JCExpression result = parser.parseExpression();
  87.611 -
  87.612 -                if (!onlyFullInput || scanner.token().kind == TokenKind.EOF) {
  87.613 -                    return result;
  87.614 -                }
  87.615 -            }
  87.616 -            return null;
  87.617 -        } finally {
  87.618 -            compiler.log.useSource(prev);
  87.619 -            compiler.log.popDiagnosticHandler(discardHandler);
  87.620 -        }
  87.621 -    }
  87.622 -
  87.623 -    private static TypeMirror attributeTree(JavacTaskImpl jti, Tree tree, Scope scope, final List<Diagnostic<? extends JavaFileObject>> errors) {
  87.624 -        Log log = Log.instance(jti.getContext());
  87.625 -        JavaFileObject prev = log.useSource(new DummyJFO());
  87.626 -        Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) {
  87.627 -            @Override
  87.628 -            public void report(JCDiagnostic diag) {
  87.629 -                errors.add(diag);
  87.630 -            }            
  87.631 -        };
  87.632 -        NBResolve resolve = NBResolve.instance(jti.getContext());
  87.633 -        resolve.disableAccessibilityChecks();
  87.634 -        try {
  87.635 -            Attr attr = Attr.instance(jti.getContext());
  87.636 -            Env<AttrContext> env = ((JavacScope) scope).getEnv();
  87.637 -            if (tree instanceof JCExpression)
  87.638 -                return attr.attribExpr((JCTree) tree,env, Type.noType);
  87.639 -            return attr.attribStat((JCTree) tree,env);
  87.640 -        } finally {
  87.641 -            log.useSource(prev);
  87.642 -            log.popDiagnosticHandler(discardHandler);
  87.643 -            resolve.restoreAccessbilityChecks();
  87.644 -        }
  87.645 -    }
  87.646 -
  87.647 -    public static @CheckForNull CharSequence getWildcardTreeName(@NonNull Tree t) {
  87.648 -        if (t.getKind() == Kind.EXPRESSION_STATEMENT && ((ExpressionStatementTree) t).getExpression().getKind() == Kind.IDENTIFIER) {
  87.649 -            IdentifierTree identTree = (IdentifierTree) ((ExpressionStatementTree) t).getExpression();
  87.650 -            
  87.651 -            return identTree.getName().toString();
  87.652 -        }
  87.653 -
  87.654 -        if (t.getKind() == Kind.IDENTIFIER) {
  87.655 -            IdentifierTree identTree = (IdentifierTree) t;
  87.656 -            String name = identTree.getName().toString();
  87.657 -
  87.658 -            if (name.startsWith("$")) {
  87.659 -                return name;
  87.660 -            }
  87.661 -        }
  87.662 -        
  87.663 -        if (t.getKind() == Kind.TYPE_PARAMETER) {
  87.664 -            String name = ((TypeParameterTree) t).getName().toString();
  87.665 -
  87.666 -            if (name.startsWith("$")) {
  87.667 -                return name;
  87.668 -            }
  87.669 -        }
  87.670 -
  87.671 -        return null;
  87.672 -    }
  87.673 -
  87.674 -    public static boolean isMultistatementWildcard(@NonNull CharSequence name) {
  87.675 -        return name.charAt(name.length() - 1) == '$';
  87.676 -    }
  87.677 -
  87.678 -    public static boolean isMultistatementWildcardTree(Tree tree) {
  87.679 -        CharSequence name = Utilities.getWildcardTreeName(tree);
  87.680 -
  87.681 -        return name != null && Utilities.isMultistatementWildcard(name);
  87.682 -    }
  87.683 -
  87.684 -    private static long inc;
  87.685 -
  87.686 -    public static Scope constructScope(CompilationInfo info, Map<String, TypeMirror> constraints) {
  87.687 -        return constructScope(info, constraints, Collections.<String>emptyList());
  87.688 -    }
  87.689 -
  87.690 -    public static Scope constructScope(CompilationInfo info, Map<String, TypeMirror> constraints, Iterable<? extends String> auxiliaryImports) {
  87.691 -        ScopeDescription desc = new ScopeDescription(constraints, auxiliaryImports);
  87.692 -        Scope result = (Scope) info.getCachedValue(desc);
  87.693 -
  87.694 -        if (result != null) return result;
  87.695 -        
  87.696 -        StringBuilder clazz = new StringBuilder();
  87.697 -
  87.698 -        clazz.append("package $;");
  87.699 -
  87.700 -        for (String i : auxiliaryImports) {
  87.701 -            clazz.append(i);
  87.702 -        }
  87.703 -
  87.704 -        long count = inc++;
  87.705 -
  87.706 -        clazz.append("public class $" + count + "{");
  87.707 -
  87.708 -        for (Entry<String, TypeMirror> e : constraints.entrySet()) {
  87.709 -            if (e.getValue() != null) {
  87.710 -                clazz.append("private ");
  87.711 -                clazz.append(e.getValue().toString()); //XXX
  87.712 -                clazz.append(" ");
  87.713 -                clazz.append(e.getKey());
  87.714 -                clazz.append(";\n");
  87.715 -            }
  87.716 -        }
  87.717 -
  87.718 -        clazz.append("private void test() {\n");
  87.719 -        clazz.append("}\n");
  87.720 -        clazz.append("}\n");
  87.721 -
  87.722 -        JavacTaskImpl jti = JavaSourceAccessor.getINSTANCE().getJavacTask(info);
  87.723 -        Context context = jti.getContext();
  87.724 -        JavaCompiler compiler = JavaCompiler.instance(context);
  87.725 -        Log log = Log.instance(context);
  87.726 -        NBResolve resolve = NBResolve.instance(context);
  87.727 -        Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(compiler.log);
  87.728 -
  87.729 -        JavaFileObject jfo = FileObjects.memoryFileObject("$", "$", new File("/tmp/$" + count + ".java").toURI(), System.currentTimeMillis(), clazz.toString());
  87.730 -
  87.731 -        boolean oldSkipAPs = compiler.skipAnnotationProcessing;
  87.732 -
  87.733 -        try {
  87.734 -            compiler.skipAnnotationProcessing = true;
  87.735 -            resolve.disableAccessibilityChecks();
  87.736 -            
  87.737 -            JCCompilationUnit cut = compiler.parse(jfo);
  87.738 -
  87.739 -            compiler.enterTrees(com.sun.tools.javac.util.List.of(cut));
  87.740 -
  87.741 -            Todo todo = compiler.todo;
  87.742 -            ListBuffer<Env<AttrContext>> defer = new ListBuffer<>();
  87.743 -            
  87.744 -            while (todo.peek() != null) {
  87.745 -                Env<AttrContext> env = todo.remove();
  87.746 -
  87.747 -                if (env.toplevel == cut)
  87.748 -                    compiler.attribute(env);
  87.749 -                else
  87.750 -                    defer = defer.append(env);
  87.751 -            }
  87.752 -
  87.753 -            todo.addAll(defer);
  87.754 -
  87.755 -            Scope res = new ScannerImpl().scan(cut, info);
  87.756 -
  87.757 -            info.putCachedValue(desc, res, CacheClearPolicy.ON_SIGNATURE_CHANGE);
  87.758 -
  87.759 -            return res;
  87.760 -        } finally {
  87.761 -            resolve.restoreAccessbilityChecks();
  87.762 -            log.popDiagnosticHandler(discardHandler);
  87.763 -            compiler.skipAnnotationProcessing = oldSkipAPs;
  87.764 -        }
  87.765 -    }
  87.766 -
  87.767 -    private static final class ScannerImpl extends TreePathScanner<Scope, CompilationInfo> {
  87.768 -
  87.769 -        @Override
  87.770 -        public Scope visitBlock(BlockTree node, CompilationInfo p) {
  87.771 -            return p.getTrees().getScope(getCurrentPath());
  87.772 -        }
  87.773 -
  87.774 -        @Override
  87.775 -        public Scope visitMethod(MethodTree node, CompilationInfo p) {
  87.776 -            if (node.getReturnType() == null) {
  87.777 -                return null;
  87.778 -            }
  87.779 -            return super.visitMethod(node, p);
  87.780 -        }
  87.781 -
  87.782 -        @Override
  87.783 -        public Scope reduce(Scope r1, Scope r2) {
  87.784 -            return r1 != null ? r1 : r2;
  87.785 -        }
  87.786 -
  87.787 -    }
  87.788 -
  87.789 -    private static final class ScopeDescription {
  87.790 -        private final Map<String, TypeMirror> constraints;
  87.791 -        private final Iterable<? extends String> auxiliaryImports;
  87.792 -
  87.793 -        public ScopeDescription(Map<String, TypeMirror> constraints, Iterable<? extends String> auxiliaryImports) {
  87.794 -            this.constraints = constraints;
  87.795 -            this.auxiliaryImports = auxiliaryImports;
  87.796 -        }
  87.797 -
  87.798 -        @Override
  87.799 -        public boolean equals(Object obj) {
  87.800 -            if (obj == null) {
  87.801 -                return false;
  87.802 -            }
  87.803 -            if (getClass() != obj.getClass()) {
  87.804 -                return false;
  87.805 -            }
  87.806 -            final ScopeDescription other = (ScopeDescription) obj;
  87.807 -            if (this.constraints != other.constraints && (this.constraints == null || !this.constraints.equals(other.constraints))) {
  87.808 -                return false;
  87.809 -            }
  87.810 -            if (this.auxiliaryImports != other.auxiliaryImports && (this.auxiliaryImports == null || !this.auxiliaryImports.equals(other.auxiliaryImports))) {
  87.811 -                return false;
  87.812 -            }
  87.813 -            return true;
  87.814 -        }
  87.815 -
  87.816 -        @Override
  87.817 -        public int hashCode() {
  87.818 -            int hash = 7;
  87.819 -            hash = 47 * hash + (this.constraints != null ? this.constraints.hashCode() : 0);
  87.820 -            hash = 47 * hash + (this.auxiliaryImports != null ? this.auxiliaryImports.hashCode() : 0);
  87.821 -            return hash;
  87.822 -        }
  87.823 -
  87.824 -    }
  87.825 -
  87.826 -//    private static Scope constructScope2(CompilationInfo info, Map<String, TypeMirror> constraints) {
  87.827 -//        JavacScope s = (JavacScope) info.getTrees().getScope(new TreePath(info.getCompilationUnit()));
  87.828 -//        Env<AttrContext> env = s.getEnv();
  87.829 -//
  87.830 -//        env = env.dup(env.tree);
  87.831 -//
  87.832 -//        env.info.
  87.833 -//    }
  87.834 -
  87.835 -    public static String toHumanReadableTime(double d) {
  87.836 -        StringBuilder result = new StringBuilder();
  87.837 -        long inSeconds = (long) (d / 1000);
  87.838 -        int seconds = (int) (inSeconds % 60);
  87.839 -        long inMinutes = inSeconds / 60;
  87.840 -        int minutes = (int) (inMinutes % 60);
  87.841 -        long inHours = inMinutes / 60;
  87.842 -
  87.843 -        if (inHours > 0) {
  87.844 -            result.append(inHours);
  87.845 -            result.append("h");
  87.846 -        }
  87.847 -
  87.848 -        if (minutes > 0) {
  87.849 -            result.append(minutes);
  87.850 -            result.append("m");
  87.851 -        }
  87.852 -        
  87.853 -        result.append(seconds);
  87.854 -        result.append("s");
  87.855 -
  87.856 -        return result.toString();
  87.857 -    }
  87.858 -
  87.859 -    public static ClasspathInfo createUniversalCPInfo() {
  87.860 -        return Lookup.getDefault().lookup(SPI.class).createUniversalCPInfo();
  87.861 -    }
  87.862 -
  87.863 -    @SuppressWarnings("deprecation")
  87.864 -    public static void waitScanFinished() throws InterruptedException {
  87.865 -        SourceUtils.waitScanFinished();
  87.866 -    }
  87.867 -
  87.868 -    public static Set<? extends String> findSuppressedWarnings(CompilationInfo info, TreePath path) {
  87.869 -        //TODO: cache?
  87.870 -        Set<String> keys = new HashSet<String>();
  87.871 -
  87.872 -        while (path != null) {
  87.873 -            Tree leaf = path.getLeaf();
  87.874 -
  87.875 -            switch (leaf.getKind()) {
  87.876 -                case METHOD:
  87.877 -                    handleSuppressWarnings(info, path, ((MethodTree) leaf).getModifiers(), keys);
  87.878 -                    break;
  87.879 -                case CLASS:
  87.880 -                    handleSuppressWarnings(info, path, ((ClassTree) leaf).getModifiers(), keys);
  87.881 -                    break;
  87.882 -                case VARIABLE:
  87.883 -                    handleSuppressWarnings(info, path, ((VariableTree) leaf).getModifiers(), keys);
  87.884 -                    break;
  87.885 -            }
  87.886 -
  87.887 -            path = path.getParentPath();
  87.888 -        }
  87.889 -
  87.890 -        return Collections.unmodifiableSet(keys);
  87.891 -    }
  87.892 -
  87.893 -    private static void handleSuppressWarnings(CompilationInfo info, TreePath path, ModifiersTree modifiers, final Set<String> keys) {
  87.894 -        Element el = info.getTrees().getElement(path);
  87.895 -
  87.896 -        if (el == null) {
  87.897 -            return ;
  87.898 -        }
  87.899 -
  87.900 -        for (AnnotationMirror am : el.getAnnotationMirrors()) {
  87.901 -            Name fqn = ((TypeElement) am.getAnnotationType().asElement()).getQualifiedName();
  87.902 -            
  87.903 -            if (!fqn.contentEquals("java.lang.SuppressWarnings")) {
  87.904 -                continue;
  87.905 -            }
  87.906 -
  87.907 -            for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e : am.getElementValues().entrySet()) {
  87.908 -                if (!e.getKey().getSimpleName().contentEquals("value"))
  87.909 -                    continue;
  87.910 -
  87.911 -                e.getValue().accept(new AnnotationValueVisitor<Void, Void>() {
  87.912 -                    public Void visit(AnnotationValue av, Void p) {
  87.913 -                        av.accept(this, p);
  87.914 -                        return null;
  87.915 -                    }
  87.916 -                    public Void visit(AnnotationValue av) {
  87.917 -                        av.accept(this, null);
  87.918 -                        return null;
  87.919 -                    }
  87.920 -                    public Void visitBoolean(boolean b, Void p) {
  87.921 -                        return null;
  87.922 -                    }
  87.923 -                    public Void visitByte(byte b, Void p) {
  87.924 -                        return null;
  87.925 -                    }
  87.926 -                    public Void visitChar(char c, Void p) {
  87.927 -                        return null;
  87.928 -                    }
  87.929 -                    public Void visitDouble(double d, Void p) {
  87.930 -                        return null;
  87.931 -                    }
  87.932 -                    public Void visitFloat(float f, Void p) {
  87.933 -                        return null;
  87.934 -                    }
  87.935 -                    public Void visitInt(int i, Void p) {
  87.936 -                        return null;
  87.937 -                    }
  87.938 -                    public Void visitLong(long i, Void p) {
  87.939 -                        return null;
  87.940 -                    }
  87.941 -                    public Void visitShort(short s, Void p) {
  87.942 -                        return null;
  87.943 -                    }
  87.944 -                    public Void visitString(String s, Void p) {
  87.945 -                        keys.add(s);
  87.946 -                        return null;
  87.947 -                    }
  87.948 -                    public Void visitType(TypeMirror t, Void p) {
  87.949 -                        return null;
  87.950 -                    }
  87.951 -                    public Void visitEnumConstant(VariableElement c, Void p) {
  87.952 -                        return null;
  87.953 -                    }
  87.954 -                    public Void visitAnnotation(AnnotationMirror a, Void p) {
  87.955 -                        return null;
  87.956 -                    }
  87.957 -                    public Void visitArray(List<? extends AnnotationValue> vals, Void p) {
  87.958 -                        for (AnnotationValue av : vals) {
  87.959 -                            av.accept(this, p);
  87.960 -                        }
  87.961 -                        return null;
  87.962 -                    }
  87.963 -                    public Void visitUnknown(AnnotationValue av, Void p) {
  87.964 -                        return null;
  87.965 -                    }
  87.966 -                }, null);
  87.967 -            }
  87.968 -        }
  87.969 -    }
  87.970 -
  87.971 -    public static Tree generalizePattern(CompilationInfo info, TreePath original) {
  87.972 -        return generalizePattern(JavaSourceAccessor.getINSTANCE().getJavacTask(info), original);
  87.973 -    }
  87.974 -
  87.975 -    public static Tree generalizePattern(CompilationTask task, TreePath original) {
  87.976 -        JavacTaskImpl jti = (JavacTaskImpl) task;
  87.977 -        com.sun.tools.javac.util.Context c = jti.getContext();
  87.978 -        TreeFactory make = TreeFactory.instance(c);
  87.979 -        Trees javacTrees = Trees.instance(task);
  87.980 -        GeneralizePattern gp = new GeneralizePattern(javacTrees, make);
  87.981 -
  87.982 -        gp.scan(original, null);
  87.983 -
  87.984 -        GeneralizePatternITT itt = new GeneralizePatternITT(gp.tree2Variable);
  87.985 -
  87.986 -        itt.attach(c, new NoImports(c), null);
  87.987 -
  87.988 -        return itt.translate(original.getLeaf());
  87.989 -    }
  87.990 -
  87.991 -    public static Tree generalizePattern(CompilationInfo info, TreePath original, int firstStatement, int lastStatement) {
  87.992 -        JavacTaskImpl jti = JavaSourceAccessor.getINSTANCE().getJavacTask(info);
  87.993 -        com.sun.tools.javac.util.Context c = jti.getContext();
  87.994 -        TreeFactory make = TreeFactory.instance(c);
  87.995 -        Tree translated = Utilities.generalizePattern(jti, original);
  87.996 -
  87.997 -        assert translated.getKind() == Kind.BLOCK;
  87.998 -
  87.999 -        List<StatementTree> newStatements = new LinkedList<StatementTree>();
 87.1000 -        BlockTree block = (BlockTree) translated;
 87.1001 -
 87.1002 -        if (firstStatement != lastStatement) {
 87.1003 -            newStatements.add(make.ExpressionStatement(make.Identifier("$s0$")));
 87.1004 -            newStatements.addAll(block.getStatements().subList(firstStatement, lastStatement + 1));
 87.1005 -            newStatements.add(make.ExpressionStatement(make.Identifier("$s1$")));
 87.1006 -
 87.1007 -            translated = make.Block(newStatements, block.isStatic());
 87.1008 -        } else {
 87.1009 -            translated = block.getStatements().get(firstStatement);
 87.1010 -        }
 87.1011 -
 87.1012 -        return translated;
 87.1013 -    }
 87.1014 -
 87.1015 -    public interface SPI {
 87.1016 -        public ClasspathInfo createUniversalCPInfo();
 87.1017 -    }
 87.1018 -
 87.1019 -    @ServiceProvider(service=SPI.class)
 87.1020 -    public static final class NbSPIImpl implements SPI {
 87.1021 -
 87.1022 -        public ClasspathInfo createUniversalCPInfo() {
 87.1023 -            JavaPlatform select = JavaPlatform.getDefault();
 87.1024 -
 87.1025 -            if (select.getSpecification().getVersion() != null) {
 87.1026 -                for (JavaPlatform p : JavaPlatformManager.getDefault().getInstalledPlatforms()) {
 87.1027 -                    if (!"j2se".equals(p.getSpecification().getName()) || p.getSpecification().getVersion() == null) continue;
 87.1028 -                    if (p.getSpecification().getVersion().compareTo(select.getSpecification().getVersion()) > 0) {
 87.1029 -                        select = p;
 87.1030 -                    }
 87.1031 -                }
 87.1032 -            }
 87.1033 -
 87.1034 -            return ClasspathInfo.create(select.getBootstrapLibraries(), ClassPath.EMPTY, ClassPath.EMPTY);
 87.1035 -        }
 87.1036 -
 87.1037 -    }
 87.1038 -    
 87.1039 -    private static final class GeneralizePattern extends TreePathScanner<Void, Void> {
 87.1040 -
 87.1041 -        public final Map<Tree, Tree> tree2Variable = new HashMap<Tree, Tree>();
 87.1042 -        private final Map<Element, String> element2Variable = new HashMap<Element, String>();
 87.1043 -        private final Trees javacTrees;
 87.1044 -        private final TreeFactory make;
 87.1045 -
 87.1046 -        private int currentVariableIndex = 0;
 87.1047 -
 87.1048 -        public GeneralizePattern(Trees javacTrees, TreeFactory make) {
 87.1049 -            this.javacTrees = javacTrees;
 87.1050 -            this.make = make;
 87.1051 -        }
 87.1052 -
 87.1053 -        private @NonNull String getVariable(@NonNull Element el) {
 87.1054 -            String var = element2Variable.get(el);
 87.1055 -
 87.1056 -            if (var == null) {
 87.1057 -                element2Variable.put(el, var = "$" + currentVariableIndex++);
 87.1058 -            }
 87.1059 -
 87.1060 -            return var;
 87.1061 -        }
 87.1062 -
 87.1063 -        private boolean shouldBeGeneralized(@NonNull Element el) {
 87.1064 -            if (el.getModifiers().contains(Modifier.PRIVATE)) {
 87.1065 -                return true;
 87.1066 -            }
 87.1067 -
 87.1068 -            switch (el.getKind()) {
 87.1069 -                case LOCAL_VARIABLE:
 87.1070 -                case EXCEPTION_PARAMETER:
 87.1071 -                case PARAMETER:
 87.1072 -                    return true;
 87.1073 -            }
 87.1074 -
 87.1075 -            return false;
 87.1076 -        }
 87.1077 -
 87.1078 -        @Override
 87.1079 -        public Void visitIdentifier(IdentifierTree node, Void p) {
 87.1080 -            Element e = javacTrees.getElement(getCurrentPath());
 87.1081 -
 87.1082 -            if (e != null && shouldBeGeneralized(e)) {
 87.1083 -                tree2Variable.put(node, make.Identifier(getVariable(e)));
 87.1084 -            }
 87.1085 -
 87.1086 -            return super.visitIdentifier(node, p);
 87.1087 -        }
 87.1088 -
 87.1089 -        @Override
 87.1090 -        public Void visitVariable(VariableTree node, Void p) {
 87.1091 -            Element e = javacTrees.getElement(getCurrentPath());
 87.1092 -
 87.1093 -            if (e != null && shouldBeGeneralized(e)) {
 87.1094 -                VariableTree nue = make.Variable(node.getModifiers(), getVariable(e), node.getType(), node.getInitializer());
 87.1095 -
 87.1096 -                tree2Variable.put(node, nue);
 87.1097 -            }
 87.1098 -
 87.1099 -            return super.visitVariable(node, p);
 87.1100 -        }
 87.1101 -
 87.1102 -        @Override
 87.1103 -        public Void visitNewClass(NewClassTree node, Void p) {
 87.1104 -            //XXX:
 87.1105 -            if (node.getEnclosingExpression() != null) {
 87.1106 -                tree2Variable.put(node, make.Identifier("$" + currentVariableIndex++));
 87.1107 -                return null;
 87.1108 -            }
 87.1109 -
 87.1110 -            NewClassTree nue = make.NewClass(node.getEnclosingExpression(), Collections.<ExpressionTree>singletonList(make.Identifier("$" + currentVariableIndex++ + "$")), make.Identifier("$" + currentVariableIndex++), Collections.<ExpressionTree>singletonList(make.Identifier("$" + currentVariableIndex++ + "$")), null);
 87.1111 -
 87.1112 -            tree2Variable.put(node, nue);
 87.1113 -
 87.1114 -            return null;
 87.1115 -        }
 87.1116 -
 87.1117 -    }
 87.1118 -
 87.1119 -    private static final class GeneralizePatternITT extends ImmutableTreeTranslator {
 87.1120 -
 87.1121 -        private final Map<Tree, Tree> tree2Variable;
 87.1122 -
 87.1123 -        public GeneralizePatternITT(Map<Tree, Tree> tree2Variable) {
 87.1124 -            super(null);
 87.1125 -            this.tree2Variable = tree2Variable;
 87.1126 -        }
 87.1127 -
 87.1128 -        @Override
 87.1129 -        public Tree translate(Tree tree) {
 87.1130 -            Tree var = tree2Variable.remove(tree);
 87.1131 -
 87.1132 -            if (var != null) {
 87.1133 -                return super.translate(var);
 87.1134 -            }
 87.1135 -
 87.1136 -            return super.translate(tree);
 87.1137 -        }
 87.1138 -
 87.1139 -    }
 87.1140 -
 87.1141 -    private static final class NoImports extends ImportAnalysis2 {
 87.1142 -
 87.1143 -        public NoImports(Context env) {
 87.1144 -            super(env);
 87.1145 -        }
 87.1146 -
 87.1147 -        @Override
 87.1148 -        public void classEntered(ClassTree clazz) {}
 87.1149 -
 87.1150 -        @Override
 87.1151 -        public void enterVisibleThroughClasses(ClassTree clazz) {}
 87.1152 -
 87.1153 -        @Override
 87.1154 -        public void classLeft() {}
 87.1155 -
 87.1156 -        @Override
 87.1157 -        public ExpressionTree resolveImport(MemberSelectTree orig, Element element) {
 87.1158 -            return orig;
 87.1159 -        }
 87.1160 -
 87.1161 -        @Override
 87.1162 -        public void setCompilationUnit(CompilationUnitTree cut) {}
 87.1163 -
 87.1164 -        @Override
 87.1165 -        public void setImports(List<? extends ImportTree> importsToAdd) {}
 87.1166 -
 87.1167 -        @Override
 87.1168 -        public Set<? extends Element> getImports() {
 87.1169 -            return Collections.emptySet();
 87.1170 -        }
 87.1171 -
 87.1172 -        @Override
 87.1173 -        public void setPackage(ExpressionTree packageNameTree) {}
 87.1174 -
 87.1175 -    }
 87.1176 -
 87.1177 -    public static long patternValue(Tree pattern) {
 87.1178 -        class VisitorImpl extends TreeScanner<Void, Void> {
 87.1179 -            private int value;
 87.1180 -            @Override
 87.1181 -            public Void scan(Tree node, Void p) {
 87.1182 -                if (node != null) value++;
 87.1183 -                return super.scan(node, p);
 87.1184 -            }
 87.1185 -            @Override
 87.1186 -            public Void visitIdentifier(IdentifierTree node, Void p) {
 87.1187 -                if (node.getName().toString().startsWith("$")) value--;
 87.1188 -                
 87.1189 -                return super.visitIdentifier(node, p);
 87.1190 -            }
 87.1191 -            @Override
 87.1192 -            public Void visitNewClass(NewClassTree node, Void p) {
 87.1193 -                return null;
 87.1194 -            }
 87.1195 -        }
 87.1196 -
 87.1197 -        VisitorImpl vi = new VisitorImpl();
 87.1198 -
 87.1199 -        vi.scan(pattern, null);
 87.1200 -
 87.1201 -        return vi.value;
 87.1202 -    }
 87.1203 -
 87.1204 -    public static boolean containsMultistatementTrees(List<? extends Tree> statements) {
 87.1205 -        for (Tree t : statements) {
 87.1206 -            if (Utilities.isMultistatementWildcardTree(t)) {
 87.1207 -                return true;
 87.1208 -            }
 87.1209 -        }
 87.1210 -
 87.1211 -        return false;
 87.1212 -    }
 87.1213 -
 87.1214 -    public static boolean isJavadocSupported(CompilationInfo info) {
 87.1215 -        Context c = JavaSourceAccessor.getINSTANCE().getJavacTask(info).getContext();
 87.1216 -
 87.1217 -        try {
 87.1218 -        return c.get(Log.logKey) instanceof Messager;
 87.1219 -        } catch (NoClassDefFoundError e) {
 87.1220 -            return false;
 87.1221 -        }
 87.1222 -    }
 87.1223 -
 87.1224 -    private static class JackpotJavacParser extends NBJavacParser {
 87.1225 -
 87.1226 -        private final Context ctx;
 87.1227 -        private final com.sun.tools.javac.util.Name dollar;
 87.1228 -        public JackpotJavacParser(Context ctx, NBParserFactory fac,
 87.1229 -                         Lexer S,
 87.1230 -                         boolean keepDocComments,
 87.1231 -                         boolean keepLineMap,
 87.1232 -                         CancelService cancelService,
 87.1233 -                         Names names) {
 87.1234 -            super(fac, S, keepDocComments, keepLineMap, true, cancelService);
 87.1235 -            this.ctx = ctx;
 87.1236 -            this.dollar = names.fromString("$");
 87.1237 -        }
 87.1238 -
 87.1239 -        @Override
 87.1240 -        protected JCModifiers modifiersOpt(JCModifiers partial) {
 87.1241 -            if (token.kind == TokenKind.IDENTIFIER) {
 87.1242 -                String ident = token.name().toString();
 87.1243 -
 87.1244 -                if (Utilities.isMultistatementWildcard(ident)) {
 87.1245 -                    com.sun.tools.javac.util.Name name = token.name();
 87.1246 -
 87.1247 -                    nextToken();
 87.1248 -                    
 87.1249 -                    JCModifiers result = super.modifiersOpt(partial);
 87.1250 -                    
 87.1251 -                    result.annotations = result.annotations.prepend(new AnnotationWildcard(name, F.Ident(name)));
 87.1252 -
 87.1253 -                    return result;
 87.1254 -                }
 87.1255 -            }
 87.1256 -
 87.1257 -            return super.modifiersOpt(partial);
 87.1258 -        }
 87.1259 -
 87.1260 -        @Override
 87.1261 -        public JCVariableDecl formalParameter(boolean lambdaParam) {
 87.1262 -            if (token.kind == TokenKind.IDENTIFIER) {
 87.1263 -                if (token.name().startsWith(dollar)) {
 87.1264 -                    com.sun.tools.javac.util.Name name = token.name();
 87.1265 -
 87.1266 -                    Token peeked = S.token(1);
 87.1267 -
 87.1268 -                    if (peeked.kind == TokenKind.COMMA || peeked.kind == TokenKind.RPAREN) {
 87.1269 -                        nextToken();
 87.1270 -                        return new VariableWildcard(ctx, name, F.Ident(name));
 87.1271 -                    }
 87.1272 -                }
 87.1273 -            }
 87.1274 -
 87.1275 -            return super.formalParameter(lambdaParam);
 87.1276 -        }
 87.1277 -
 87.1278 -        @Override
 87.1279 -        protected JCVariableDecl implicitParameter() {
 87.1280 -            if (token.kind == TokenKind.IDENTIFIER) {
 87.1281 -                if (token.name().startsWith(dollar)) {
 87.1282 -                    com.sun.tools.javac.util.Name name = token.name();
 87.1283 -
 87.1284 -                    Token peeked = S.token(1);
 87.1285 -
 87.1286 -                    if (peeked.kind == TokenKind.COMMA || peeked.kind == TokenKind.RPAREN) {
 87.1287 -                        nextToken();
 87.1288 -                        return new VariableWildcard(ctx, name, F.Ident(name));
 87.1289 -                    }
 87.1290 -                }
 87.1291 -            }
 87.1292 -
 87.1293 -            return super.implicitParameter();
 87.1294 -        }
 87.1295 -        
 87.1296 -        @Override
 87.1297 -        protected JCCatch catchClause() {
 87.1298 -            if (token.kind == TokenKind.CATCH) {
 87.1299 -                Token peeked = S.token(1);
 87.1300 -                
 87.1301 -                if (   peeked.kind == TokenKind.IDENTIFIER
 87.1302 -                    && Utilities.isMultistatementWildcard(peeked.name().toString())) {
 87.1303 -                    accept(TokenKind.CATCH);
 87.1304 -                    
 87.1305 -                    com.sun.tools.javac.util.Name name = token.name();
 87.1306 -
 87.1307 -                    accept(TokenKind.IDENTIFIER);
 87.1308 -
 87.1309 -                    return new CatchWildcard(ctx, name, F.Ident(name));
 87.1310 -                } else {
 87.1311 -                    nextToken();
 87.1312 -                }
 87.1313 -            }
 87.1314 -            return super.catchClause();
 87.1315 -        }
 87.1316 -
 87.1317 -        @Override
 87.1318 -        public com.sun.tools.javac.util.List<JCTree> classOrInterfaceBodyDeclaration(com.sun.tools.javac.util.Name className, boolean isInterface) {
 87.1319 -            if (token.kind == TokenKind.IDENTIFIER) {
 87.1320 -                if (token.name().startsWith(dollar)) {
 87.1321 -                    com.sun.tools.javac.util.Name name = token.name();
 87.1322 -
 87.1323 -                    Token peeked = S.token(1);
 87.1324 -
 87.1325 -                    if (peeked.kind == TokenKind.SEMI) {
 87.1326 -                        nextToken();
 87.1327 -                        nextToken();
 87.1328 -                        
 87.1329 -                        return com.sun.tools.javac.util.List.<JCTree>of(F.Ident(name));
 87.1330 -                    }
 87.1331 -                }
 87.1332 -            }
 87.1333 -            return super.classOrInterfaceBodyDeclaration(className, isInterface);
 87.1334 -        }
 87.1335 -        
 87.1336 -        @Override
 87.1337 -        protected JCExpression checkExprStat(JCExpression t) {
 87.1338 -            if (t.getTag() == JCTree.Tag.IDENT) {
 87.1339 -                if (((IdentifierTree) t).getName().toString().startsWith("$")) {
 87.1340 -                    return t;
 87.1341 -                }
 87.1342 -            }
 87.1343 -            return super.checkExprStat(t);
 87.1344 -        }
 87.1345 -
 87.1346 -        @Override
 87.1347 -        protected JCCase switchBlockStatementGroup() {
 87.1348 -            if (token.kind == TokenKind.CASE) {
 87.1349 -                Token peeked = S.token(1);
 87.1350 -
 87.1351 -                if (peeked.kind == TokenKind.IDENTIFIER) {
 87.1352 -                    String ident = peeked.name().toString();
 87.1353 -
 87.1354 -                    if (ident.startsWith("$") && ident.endsWith("$")) {
 87.1355 -                        nextToken();
 87.1356 -                        
 87.1357 -                        int pos = token.pos;
 87.1358 -                        com.sun.tools.javac.util.Name name = token.name();
 87.1359 -
 87.1360 -                        nextToken();
 87.1361 -
 87.1362 -                        if (token.kind == TokenKind.SEMI) {
 87.1363 -                            nextToken();
 87.1364 -                        }
 87.1365 -
 87.1366 -                        return new JackpotTrees.CaseWildcard(ctx, name, F.at(pos).Ident(name));
 87.1367 -                    }
 87.1368 -                }
 87.1369 -            }
 87.1370 -
 87.1371 -            return super.switchBlockStatementGroup();
 87.1372 -        }
 87.1373 -
 87.1374 -
 87.1375 -        @Override
 87.1376 -        protected JCTree resource() {
 87.1377 -            if (token.kind == TokenKind.IDENTIFIER && token.name().startsWith(dollar)) {
 87.1378 -                Token peeked = S.token(1);
 87.1379 -
 87.1380 -                if (peeked.kind == TokenKind.SEMI || peeked.kind == TokenKind.RPAREN) {
 87.1381 -                    int pos = token.pos;
 87.1382 -                    com.sun.tools.javac.util.Name name = token.name();
 87.1383 -
 87.1384 -                    nextToken();
 87.1385 -
 87.1386 -                    return F.at(pos).Ident(name);
 87.1387 -                }
 87.1388 -            }
 87.1389 -            return super.resource();
 87.1390 -        }
 87.1391 -
 87.1392 -    }
 87.1393 -
 87.1394 -    private static final class DummyJFO extends SimpleJavaFileObject {
 87.1395 -        private DummyJFO() {
 87.1396 -            super(URI.create("dummy.java"), JavaFileObject.Kind.SOURCE);
 87.1397 -        }
 87.1398 -        @Override
 87.1399 -        public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
 87.1400 -            return "";
 87.1401 -        }
 87.1402 -    };
 87.1403 -
 87.1404 -    /**
 87.1405 -     * Only for members (i.e. generated constructor):
 87.1406 -     */
 87.1407 -    public static List<? extends Tree> filterHidden(TreePath basePath, Iterable<? extends Tree> members) {
 87.1408 -        List<Tree> result = new LinkedList<Tree>();
 87.1409 -
 87.1410 -        for (Tree t : members) {
 87.1411 -            if (!isSynthetic(basePath != null ? basePath.getCompilationUnit() : null, t)) {
 87.1412 -                result.add(t);
 87.1413 -            }
 87.1414 -        }
 87.1415 -
 87.1416 -        return result;
 87.1417 -    }
 87.1418 -
 87.1419 -    private static boolean isSynthetic(CompilationUnitTree cut, Tree leaf) throws NullPointerException {
 87.1420 -        JCTree tree = (JCTree) leaf;
 87.1421 -
 87.1422 -        if (tree.pos == (-1))
 87.1423 -            return true;
 87.1424 -
 87.1425 -        if (leaf.getKind() == Kind.METHOD) {
 87.1426 -            //check for synthetic constructor:
 87.1427 -            return (((JCMethodDecl)leaf).mods.flags & Flags.GENERATEDCONSTR) != 0L;
 87.1428 -        }
 87.1429 -
 87.1430 -        //check for synthetic superconstructor call:
 87.1431 -        if (cut != null && leaf.getKind() == Kind.EXPRESSION_STATEMENT) {
 87.1432 -            ExpressionStatementTree est = (ExpressionStatementTree) leaf;
 87.1433 -
 87.1434 -            if (est.getExpression().getKind() == Kind.METHOD_INVOCATION) {
 87.1435 -                MethodInvocationTree mit = (MethodInvocationTree) est.getExpression();
 87.1436 -
 87.1437 -                if (mit.getMethodSelect().getKind() == Kind.IDENTIFIER) {
 87.1438 -                    IdentifierTree it = (IdentifierTree) mit.getMethodSelect();
 87.1439 -
 87.1440 -                    if ("super".equals(it.getName().toString())) {
 87.1441 -                        return ((JCCompilationUnit) cut).endPositions.getEndPos(tree) == (-1);
 87.1442 -                    }
 87.1443 -                }
 87.1444 -            }
 87.1445 -        }
 87.1446 -
 87.1447 -        return false;
 87.1448 -    }
 87.1449 -
 87.1450 -    public static boolean isFakeBlock(Tree t) {
 87.1451 -        return t instanceof FakeBlock;
 87.1452 -    }
 87.1453 -
 87.1454 -    public static boolean isFakeClass(Tree t) {
 87.1455 -        if (!(t instanceof ClassTree)) {
 87.1456 -            return false;
 87.1457 -        }
 87.1458 -
 87.1459 -        ClassTree ct = (ClassTree) t;
 87.1460 -
 87.1461 -        if (ct.getMembers().isEmpty()) {
 87.1462 -            return false;
 87.1463 -        }
 87.1464 -
 87.1465 -        CharSequence wildcardTreeName = Utilities.getWildcardTreeName(ct.getMembers().get(0));
 87.1466 -
 87.1467 -        if (wildcardTreeName == null) {
 87.1468 -            return false;
 87.1469 -        }
 87.1470 -
 87.1471 -        return wildcardTreeName.toString().startsWith("$$");
 87.1472 -    }
 87.1473 -
 87.1474 -    private static final class OffsetSourcePositions implements SourcePositions {
 87.1475 -
 87.1476 -        private final SourcePositions delegate;
 87.1477 -        private final long offset;
 87.1478 -
 87.1479 -        public OffsetSourcePositions(SourcePositions delegate, long offset) {
 87.1480 -            this.delegate = delegate;
 87.1481 -            this.offset = offset;
 87.1482 -        }
 87.1483 -
 87.1484 -        public long getStartPosition(CompilationUnitTree cut, Tree tree) {
 87.1485 -            return delegate.getStartPosition(cut, tree) + offset;
 87.1486 -        }
 87.1487 -
 87.1488 -        public long getEndPosition(CompilationUnitTree cut, Tree tree) {
 87.1489 -            return delegate.getEndPosition(cut, tree) + offset;
 87.1490 -        }
 87.1491 -
 87.1492 -    }
 87.1493 -
 87.1494 -    private static final class OffsetDiagnostic<S> implements Diagnostic<S> {
 87.1495 -        private final Diagnostic<? extends S> delegate;
 87.1496 -        private final long offset;
 87.1497 -
 87.1498 -        public OffsetDiagnostic(Diagnostic<? extends S> delegate, long offset) {
 87.1499 -            this.delegate = delegate;
 87.1500 -            this.offset = offset;
 87.1501 -        }
 87.1502 -
 87.1503 -        public Diagnostic.Kind getKind() {
 87.1504 -            return delegate.getKind();
 87.1505 -        }
 87.1506 -
 87.1507 -        public S getSource() {
 87.1508 -            return delegate.getSource();
 87.1509 -        }
 87.1510 -
 87.1511 -        public long getPosition() {
 87.1512 -            return delegate.getPosition() + offset;
 87.1513 -        }
 87.1514 -
 87.1515 -        public long getStartPosition() {
 87.1516 -            return delegate.getStartPosition() + offset;
 87.1517 -        }
 87.1518 -
 87.1519 -        public long getEndPosition() {
 87.1520 -            return delegate.getEndPosition() + offset;
 87.1521 -        }
 87.1522 -
 87.1523 -        public long getLineNumber() {
 87.1524 -            throw new UnsupportedOperationException("Not supported yet.");
 87.1525 -        }
 87.1526 -
 87.1527 -        public long getColumnNumber() {
 87.1528 -            throw new UnsupportedOperationException("Not supported yet.");
 87.1529 -        }
 87.1530 -
 87.1531 -        public String getCode() {
 87.1532 -            return delegate.getCode();
 87.1533 -        }
 87.1534 -
 87.1535 -        public String getMessage(Locale locale) {
 87.1536 -            return delegate.getMessage(locale);
 87.1537 -        }
 87.1538 -
 87.1539 -    }
 87.1540 -
 87.1541 -    private static class ParserSourcePositions implements SourcePositions {
 87.1542 -
 87.1543 -        private JavacParser parser;
 87.1544 -
 87.1545 -        private ParserSourcePositions(JavacParser parser) {
 87.1546 -            this.parser = parser;
 87.1547 -        }
 87.1548 -
 87.1549 -        public long getStartPosition(CompilationUnitTree file, Tree tree) {
 87.1550 -            return parser.getStartPos((JCTree)tree);
 87.1551 -        }
 87.1552 -
 87.1553 -        public long getEndPosition(CompilationUnitTree file, Tree tree) {
 87.1554 -            return parser.getEndPos((JCTree)tree);
 87.1555 -        }
 87.1556 -    }
 87.1557 -}
    88.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchSearch.java	Sun Jan 08 20:10:08 2017 +0100
    88.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.3 @@ -1,714 +0,0 @@
    88.4 -/*
    88.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    88.6 - *
    88.7 - * Copyright 2009-2011 Oracle and/or its affiliates. All rights reserved.
    88.8 - *
    88.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   88.10 - * Other names may be trademarks of their respective owners.
   88.11 - *
   88.12 - * The contents of this file are subject to the terms of either the GNU
   88.13 - * General Public License Version 2 only ("GPL") or the Common
   88.14 - * Development and Distribution License("CDDL") (collectively, the
   88.15 - * "License"). You may not use this file except in compliance with the
   88.16 - * License. You can obtain a copy of the License at
   88.17 - * http://www.netbeans.org/cddl-gplv2.html
   88.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   88.19 - * specific language governing permissions and limitations under the
   88.20 - * License.  When distributing the software, include this License Header
   88.21 - * Notice in each file and include the License file at
   88.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   88.23 - * particular file as subject to the "Classpath" exception as provided
   88.24 - * by Oracle in the GPL Version 2 section of the License file that
   88.25 - * accompanied this code. If applicable, add the following below the
   88.26 - * License Header, with the fields enclosed by brackets [] replaced by
   88.27 - * your own identifying information:
   88.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   88.29 - *
   88.30 - * If you wish your version of this file to be governed by only the CDDL
   88.31 - * or only the GPL Version 2, indicate your decision by adding
   88.32 - * "[Contributor] elects to include this software in this distribution
   88.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   88.34 - * single choice of license, a recipient has the option to distribute
   88.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   88.36 - * to extend the choice of license to its licensees as provided above.
   88.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   88.38 - * Version 2 license, then the option applies only if the new code is
   88.39 - * made subject to such option by the copyright holder.
   88.40 - *
   88.41 - * Contributor(s):
   88.42 - *
   88.43 - * Portions Copyrighted 2009-2011 Sun Microsystems, Inc.
   88.44 - */
   88.45 -package org.netbeans.modules.java.hints.spiimpl.batch;
   88.46 -
   88.47 -import org.netbeans.spi.java.hints.HintContext.MessageKind;
   88.48 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   88.49 -import com.sun.source.tree.Tree;
   88.50 -import com.sun.source.util.TreePath;
   88.51 -import java.io.IOException;
   88.52 -import java.io.OutputStreamWriter;
   88.53 -import java.io.Writer;
   88.54 -import java.nio.ByteBuffer;
   88.55 -import java.util.ArrayList;
   88.56 -import java.util.Collection;
   88.57 -import java.util.Collections;
   88.58 -import java.util.HashMap;
   88.59 -import java.util.HashSet;
   88.60 -import java.util.LinkedList;
   88.61 -import java.util.List;
   88.62 -import java.util.Map;
   88.63 -import java.util.Map.Entry;
   88.64 -import java.util.Set;
   88.65 -import java.util.concurrent.Callable;
   88.66 -import java.util.concurrent.atomic.AtomicBoolean;
   88.67 -import java.util.concurrent.atomic.AtomicInteger;
   88.68 -import java.util.concurrent.atomic.AtomicReference;
   88.69 -import java.util.logging.Level;
   88.70 -import java.util.logging.Logger;
   88.71 -import org.netbeans.api.annotations.common.NonNull;
   88.72 -import org.netbeans.api.annotations.common.NullAllowed;
   88.73 -import org.netbeans.api.fileinfo.NonRecursiveFolder;
   88.74 -import org.netbeans.api.java.classpath.ClassPath;
   88.75 -import org.netbeans.api.java.classpath.GlobalPathRegistry;
   88.76 -import org.netbeans.api.java.source.ClasspathInfo;
   88.77 -import org.netbeans.api.java.source.ClasspathInfo.PathKind;
   88.78 -import org.netbeans.api.java.source.CompilationController;
   88.79 -import org.netbeans.api.java.source.CompilationInfo;
   88.80 -import org.netbeans.api.java.source.JavaSource;
   88.81 -import org.netbeans.api.java.source.JavaSource.Phase;
   88.82 -import org.netbeans.api.java.source.Task;
   88.83 -import org.netbeans.api.queries.FileEncodingQuery;
   88.84 -import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
   88.85 -import org.netbeans.modules.java.hints.spiimpl.Utilities;
   88.86 -import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker;
   88.87 -import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch;
   88.88 -import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch.BulkPattern;
   88.89 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.AdditionalQueryConstraints;
   88.90 -import org.netbeans.modules.java.hints.providers.spi.Trigger.PatternDescription;
   88.91 -import org.netbeans.spi.editor.hints.ErrorDescription;
   88.92 -import org.netbeans.api.java.source.matching.Matcher;
   88.93 -import org.netbeans.api.java.source.matching.Pattern;
   88.94 -import org.netbeans.modules.java.hints.providers.spi.Trigger.DecisionTrigger;
   88.95 -import org.netbeans.modules.java.hints.spiimpl.SPIAccessor;
   88.96 -import org.netbeans.modules.java.hints.spiimpl.hints.GlobalProcessingContext;
   88.97 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
   88.98 -import org.netbeans.spi.java.hints.Decision;
   88.99 -import org.netbeans.spi.java.hints.HintContext;
  88.100 -import org.openide.filesystems.FileObject;
  88.101 -import org.openide.filesystems.FileUtil;
  88.102 -import org.openide.util.Exceptions;
  88.103 -
  88.104 -/**
  88.105 - *
  88.106 - * @author lahvac
  88.107 - */
  88.108 -public class BatchSearch {
  88.109 -
  88.110 -    private static final Logger LOG = Logger.getLogger(BatchSearch.class.getName());
  88.111 -
  88.112 -    public static BatchResult findOccurrences(Iterable<? extends HintDescription> patterns, Scope scope) {
  88.113 -        return findOccurrences(patterns, scope, new ProgressHandleWrapper(null), HintsSettings.getGlobalSettings());
  88.114 -    }
  88.115 -
  88.116 -    public static BatchResult findOccurrences(final Iterable<? extends HintDescription> patterns, final Scope scope, final ProgressHandleWrapper progress, @NullAllowed HintsSettings settingsProvider) {
  88.117 -        return findOccurrencesLocal(patterns, scope.getIndexMapper(patterns), scope.getTodo(), progress, settingsProvider);
  88.118 -    }
  88.119 -
  88.120 -    private static BatchResult findOccurrencesLocal(final Iterable<? extends HintDescription> patterns, final MapIndices indexMapper, final Collection<? extends Folder> todo, final ProgressHandleWrapper progress, final @NullAllowed HintsSettings settingsProvider) {
  88.121 -        final BatchResult[] result = new BatchResult[1];
  88.122 -
  88.123 -        try {
  88.124 -            JavaSource.create(Utilities.createUniversalCPInfo()).runUserActionTask(new Task<CompilationController>() {
  88.125 -                public void run(CompilationController parameter) throws Exception {
  88.126 -                    result[0] = findOccurrencesLocalImpl(parameter, patterns, indexMapper, todo, progress, settingsProvider);
  88.127 -                }
  88.128 -            }, true);
  88.129 -        } catch (IOException ex) {
  88.130 -            throw new IllegalStateException(ex);
  88.131 -        }
  88.132 -
  88.133 -        return result[0];
  88.134 -    }
  88.135 -    
  88.136 -    private static BatchResult findOccurrencesLocalImpl(final CompilationInfo info, final Iterable<? extends HintDescription> patterns, MapIndices indexMapper, Collection<? extends Folder> todo, ProgressHandleWrapper progress, HintsSettings settingsProvider) {
  88.137 -        boolean hasKindPatterns = false;
  88.138 -
  88.139 -        for (HintDescription pattern : patterns) {
  88.140 -            if (!(pattern.getTrigger() instanceof PatternDescription)) {
  88.141 -                hasKindPatterns = true;
  88.142 -                break;
  88.143 -            }
  88.144 -        }
  88.145 -
  88.146 -        final Callable<BulkPattern> bulkPattern = hasKindPatterns ? null : new Callable<BulkPattern>() {
  88.147 -            private final AtomicReference<BulkPattern> pattern = new AtomicReference<BulkPattern>();
  88.148 -            public BulkPattern call() {
  88.149 -                if (pattern.get() == null) {
  88.150 -                    pattern.set(preparePattern(patterns, info));
  88.151 -                }
  88.152 -
  88.153 -                return pattern.get();
  88.154 -            }
  88.155 -        };
  88.156 -        final Map<IndexEnquirer, Collection<? extends Resource>> result = new HashMap<IndexEnquirer, Collection<? extends Resource>>();
  88.157 -        final Collection<MessageImpl> problems = new LinkedList<MessageImpl>();
  88.158 -        ProgressHandleWrapper innerForAll = progress.startNextPartWithEmbedding(ProgressHandleWrapper.prepareParts(2 * todo.size()));
  88.159 -        
  88.160 -        for (final Folder src : todo) {
  88.161 -            LOG.log(Level.FINE, "Processing: {0}", FileUtil.getFileDisplayName(src.getFileObject()));
  88.162 -            
  88.163 -            IndexEnquirer indexEnquirer;// = indexMapper.findIndex(src.getFileObject(), innerForAll, src.isRecursive());
  88.164 -
  88.165 -//            if (indexEnquirer == null) {
  88.166 -                indexEnquirer = new FileSystemBasedIndexEnquirer(src.getFileObject(), src.isRecursive());
  88.167 -//            }
  88.168 -
  88.169 -            Collection<? extends Resource> occurrences = indexEnquirer.findResources(patterns, innerForAll, bulkPattern, problems, settingsProvider);
  88.170 -
  88.171 -            if (!occurrences.isEmpty()) {
  88.172 -                result.put(indexEnquirer, occurrences);
  88.173 -            }
  88.174 -
  88.175 -            innerForAll.tick();
  88.176 -        }
  88.177 -
  88.178 -        return new BatchResult(result, patterns, problems);
  88.179 -    }
  88.180 -
  88.181 -    private static BulkPattern preparePattern(final Iterable<? extends HintDescription> patterns, CompilationInfo info) {
  88.182 -        Collection<String> code = new LinkedList<String>();
  88.183 -        Collection<Tree> trees = new LinkedList<Tree>();
  88.184 -        Collection<AdditionalQueryConstraints> additionalConstraints = new LinkedList<AdditionalQueryConstraints>();
  88.185 -
  88.186 -        for (HintDescription pattern : patterns) {
  88.187 -            String textPattern = ((PatternDescription) pattern.getTrigger()).getPattern();
  88.188 -
  88.189 -            code.add(textPattern);
  88.190 -            trees.add(Utilities.parseAndAttribute(info, textPattern, null));
  88.191 -            additionalConstraints.add(pattern.getAdditionalConstraints());
  88.192 -        }
  88.193 -
  88.194 -        return BulkSearch.getDefault().create(code, trees, additionalConstraints, new AtomicBoolean());
  88.195 -    }
  88.196 -
  88.197 -    public static void getVerifiedSpans(BatchResult candidates, @NonNull ProgressHandleWrapper progress, final VerifiedSpansCallBack callback, final Collection<? super MessageImpl> problems, AtomicBoolean cancel) {
  88.198 -        getVerifiedSpans(candidates, progress, callback, false, problems, cancel);
  88.199 -    }
  88.200 -
  88.201 -    public static void getVerifiedSpans(BatchResult candidates, @NonNull ProgressHandleWrapper progress, final VerifiedSpansCallBack callback, boolean doNotRegisterClassPath, final Collection<? super MessageImpl> problems, AtomicBoolean cancel) {
  88.202 -        int[] parts = new int[candidates.projectId2Resources.size()];
  88.203 -        int   index = 0;
  88.204 -
  88.205 -        for (Entry<? extends IndexEnquirer, ? extends Collection<? extends Resource>> e : candidates.projectId2Resources.entrySet()) {
  88.206 -            parts[index++] = e.getValue().size();
  88.207 -        }
  88.208 -
  88.209 -        ProgressHandleWrapper inner = progress.startNextPartWithEmbedding(parts);
  88.210 -
  88.211 -        for (Entry<? extends IndexEnquirer, ? extends Collection<? extends Resource>> e : candidates.projectId2Resources.entrySet()) {
  88.212 -            if (cancel.get()) 
  88.213 -                return;
  88.214 -            inner.startNextPart(e.getValue().size());
  88.215 -
  88.216 -            e.getKey().validateResource(e.getValue(), inner, callback, doNotRegisterClassPath, problems, cancel);
  88.217 -        }
  88.218 -    }
  88.219 -
  88.220 -    private static void getLocalVerifiedSpans(Collection<? extends Resource> resources, @NonNull final ProgressHandleWrapper progress, final VerifiedSpansCallBack callback, boolean doNotRegisterClassPath, final Collection<? super MessageImpl> problems, final AtomicBoolean cancel) {
  88.221 -        Collection<FileObject> files = new LinkedList<FileObject>();
  88.222 -        final Map<FileObject, Resource> file2Resource = new HashMap<FileObject, Resource>();
  88.223 -
  88.224 -        for (Resource r : resources) {
  88.225 -            FileObject file = r.getResolvedFile();
  88.226 -
  88.227 -            if (file != null) {
  88.228 -                files.add(file);
  88.229 -                file2Resource.put(file, r);
  88.230 -            } else {
  88.231 -                callback.cannotVerifySpan(r);
  88.232 -                progress.tick();
  88.233 -            }
  88.234 -        }
  88.235 -
  88.236 -        Map<ClasspathInfo, Collection<FileObject>> cp2Files = BatchUtilities.sortFiles(files);
  88.237 -        ClassPath[] toRegister = null;
  88.238 -
  88.239 -        if (!doNotRegisterClassPath) {
  88.240 -            Set<ClassPath> toRegisterSet = new HashSet<ClassPath>();
  88.241 -
  88.242 -            for (ClasspathInfo cpInfo : cp2Files.keySet()) {
  88.243 -                toRegisterSet.add(cpInfo.getClassPath(PathKind.SOURCE));
  88.244 -            }
  88.245 -
  88.246 -            toRegister = !toRegisterSet.isEmpty() ? toRegisterSet.toArray(new ClassPath[0]) : null;
  88.247 -
  88.248 -            if (toRegister != null) {
  88.249 -                GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, toRegister);
  88.250 -                try {
  88.251 -                    Utilities.waitScanFinished();
  88.252 -                } catch (InterruptedException ex) {
  88.253 -                    Exceptions.printStackTrace(ex);
  88.254 -                }
  88.255 -            }
  88.256 -        }
  88.257 -
  88.258 -        callback.groupStarted();
  88.259 -
  88.260 -        try {
  88.261 -            final GlobalProcessingContext gpc = new GlobalProcessingContext();
  88.262 -            for (Entry<ClasspathInfo, Collection<FileObject>> e : cp2Files.entrySet()) {
  88.263 -                try {
  88.264 -                    List<FileObject> toProcess = new ArrayList<FileObject>(e.getValue());
  88.265 -                    final AtomicInteger currentPointer = new AtomicInteger();
  88.266 -
  88.267 -//                    for (FileObject f : toProcess) {
  88.268 -                    while (currentPointer.get() < toProcess.size()) {
  88.269 -                        if (cancel.get())
  88.270 -                            return;
  88.271 -                        final AtomicBoolean stop = new AtomicBoolean();
  88.272 -//                        JavaSource js = JavaSource.create(e.getKey(), f);
  88.273 -                        JavaSource js = JavaSource.create(e.getKey(), toProcess.subList(currentPointer.get(), toProcess.size()));
  88.274 -
  88.275 -                        js.runUserActionTask(new Task<CompilationController>() {
  88.276 -                            public void run(CompilationController parameter) throws Exception {
  88.277 -                                if (stop.get()) return;
  88.278 -                                if (cancel.get()) return;
  88.279 -
  88.280 -                                boolean cont = true;
  88.281 -
  88.282 -                                try {
  88.283 -                                    if (parameter.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0)
  88.284 -                                        return ;
  88.285 -
  88.286 -                                    progress.setMessage("processing: " + FileUtil.getFileDisplayName(parameter.getFileObject()));
  88.287 -                                    Resource r = file2Resource.get(parameter.getFileObject());
  88.288 -
  88.289 -                                    HintsSettings settings = r.settings;
  88.290 -                                    Iterable<? extends HintDescription> enabledHints;
  88.291 -                                    
  88.292 -                                    if (settings == null) {
  88.293 -                                        settings = HintsSettings.getSettingsFor(parameter.getFileObject());
  88.294 -                                        List<HintDescription> hintsCopy = new ArrayList<>();
  88.295 -                                        for (HintDescription hd : r.hints) {
  88.296 -                                            if (settings.isEnabled(hd.getMetadata())) {
  88.297 -                                                hintsCopy.add(hd);
  88.298 -                                            }
  88.299 -                                        }
  88.300 -                                        enabledHints = hintsCopy;
  88.301 -                                    } else {
  88.302 -                                        enabledHints = r.hints;
  88.303 -                                    }
  88.304 -                                    
  88.305 -                                    List<ErrorDescription> hints = new HintsInvoker(settings, gpc, new AtomicBoolean()).computeHints(parameter, r.hints, problems);
  88.306 -
  88.307 -                                    assert hints != null;
  88.308 -                                    
  88.309 -                                    cont = callback.spansVerified(parameter, r, hints);
  88.310 -                                } catch (ThreadDeath td) {
  88.311 -                                    throw td;
  88.312 -                                } catch (Throwable t) {
  88.313 -                                    LOG.log(Level.INFO, "Exception while performing batch processing in " + FileUtil.getFileDisplayName(parameter.getFileObject()), t);
  88.314 -                                    problems.add(new MessageImpl(MessageKind.WARNING, "An exception occurred while processing file: " + FileUtil.getFileDisplayName(parameter.getFileObject()) + " (" + t.getLocalizedMessage() + ")."));
  88.315 -                                }
  88.316 -                                
  88.317 -                                if (cont) {
  88.318 -                                    progress.tick();
  88.319 -                                    currentPointer.incrementAndGet();
  88.320 -                                } else {
  88.321 -                                    stop.set(true);
  88.322 -                                }
  88.323 -                            }
  88.324 -                        }, true);
  88.325 -                    }
  88.326 -                } catch (IOException ex) {
  88.327 -                    Exceptions.printStackTrace(ex);
  88.328 -                }
  88.329 -            }
  88.330 -            
  88.331 -            final Map<FileObject, List<Decision>> file2Decision = new HashMap<FileObject, List<Decision>>();
  88.332 -            for (List<Decision<?, ?>> decisions : gpc.decisions.values()) {
  88.333 -                for (Decision<?, ?> d : decisions) {
  88.334 -                    if (d.makeDecision()) {
  88.335 -                        List<Decision> fileDecisions = file2Decision.get(d.root.getFileObject());
  88.336 -                        
  88.337 -                        if (fileDecisions == null) {
  88.338 -                            file2Decision.put(d.root.getFileObject(), fileDecisions = new ArrayList<Decision>());
  88.339 -                        }
  88.340 -                        
  88.341 -                        fileDecisions.add(d);
  88.342 -                    }
  88.343 -                }
  88.344 -            }
  88.345 -
  88.346 -            Map<ClasspathInfo, Collection<FileObject>> cp2FilesAfterDecision = BatchUtilities.sortFiles(file2Decision.keySet());
  88.347 -            
  88.348 -            for (Entry<ClasspathInfo, Collection<FileObject>> e : cp2FilesAfterDecision.entrySet()) {
  88.349 -                JavaSource js = JavaSource.create(e.getKey(), e.getValue());
  88.350 -                
  88.351 -                try {
  88.352 -                    js.runUserActionTask(new Task<CompilationController>() {
  88.353 -                        @Override public void run(CompilationController parameter) throws Exception {
  88.354 -                            if (parameter.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0)
  88.355 -                                return ;
  88.356 -                            
  88.357 -                            Resource r = file2Resource.get(parameter.getFileObject());
  88.358 -
  88.359 -                            HintsSettings settings = r.settings;
  88.360 -
  88.361 -                            if (settings == null) {
  88.362 -                                settings = HintsSettings.getSettingsFor(parameter.getFileObject());
  88.363 -                            }
  88.364 -
  88.365 -                            for (Decision<?, ?> d : file2Decision.get(parameter.getFileObject())) {
  88.366 -                            for (HintDescription hd : r.hints) {
  88.367 -                                if (!(hd.getTrigger() instanceof DecisionTrigger)) continue;
  88.368 -                                if (r.settings == null && !settings.isEnabled(hd.getMetadata())) continue;
  88.369 -                                DecisionTrigger dt = (DecisionTrigger) hd.getTrigger();
  88.370 -                                if (dt.getDecisionClass() != d.getClass()) continue;
  88.371 -                                TreePath tp = d.root.resolve(parameter);
  88.372 -                                HintContext ctx = SPIAccessor.getINSTANCE().createHintContext(parameter, settings, hd.getMetadata(), new GlobalProcessingContext(), tp, Collections.<String, TreePath>emptyMap(), Collections.<String, Collection<? extends TreePath>>emptyMap(), Collections.<String, String>emptyMap());
  88.373 -                                ctx.decision = d;
  88.374 -                                Collection<? extends ErrorDescription> errors = hd.getWorker().createErrors(ctx);
  88.375 -                                
  88.376 -                                if (errors != null) {
  88.377 -                                    callback.spansVerified(parameter, file2Resource.get(parameter.getFileObject()), errors);
  88.378 -                                }
  88.379 -                            }
  88.380 -                            }
  88.381 -                        }
  88.382 -                    }, true);
  88.383 -                } catch (IOException ex) {
  88.384 -                    Exceptions.printStackTrace(ex);
  88.385 -                }
  88.386 -            }
  88.387 -        } finally {
  88.388 -            callback.groupFinished();
  88.389 -            
  88.390 -            if (toRegister != null) {
  88.391 -                GlobalPathRegistry.getDefault().unregister(ClassPath.SOURCE, toRegister);
  88.392 -            }
  88.393 -            progress.finish();
  88.394 -        }
  88.395 -    }
  88.396 -
  88.397 -    public interface VerifiedSpansCallBack {
  88.398 -        public void groupStarted();
  88.399 -        public boolean spansVerified(CompilationController wc, Resource r, Collection<? extends ErrorDescription> hints) throws Exception;
  88.400 -        public void groupFinished();
  88.401 -        public void cannotVerifySpan(Resource r);
  88.402 -    }
  88.403 -
  88.404 -    
  88.405 -    public static class Folder {
  88.406 -
  88.407 -        private FileObject file;
  88.408 -        private NonRecursiveFolder folder;
  88.409 -        
  88.410 -        public Folder(FileObject file) {
  88.411 -            this.file = file;
  88.412 -        }
  88.413 -        
  88.414 -        public Folder(NonRecursiveFolder folder) {
  88.415 -            this.folder = folder;
  88.416 -        }
  88.417 -        
  88.418 -        public FileObject getFileObject() {
  88.419 -            if (file!=null) {
  88.420 -                return file;
  88.421 -            }
  88.422 -            return folder.getFolder();
  88.423 -            
  88.424 -        }
  88.425 -        
  88.426 -        private boolean isRecursive() {
  88.427 -            if (file!=null) {
  88.428 -                return file.isFolder();
  88.429 -            }
  88.430 -            return false;
  88.431 -        }
  88.432 -
  88.433 -        public static Folder[] convert(FileObject... files) {
  88.434 -            Folder[] result = new Folder[files.length];
  88.435 -            for (int i=0;i<files.length;i++) {
  88.436 -                result[i] = new Folder(files[i]);
  88.437 -            }
  88.438 -            return result;
  88.439 -        }
  88.440 -
  88.441 -        public static Folder[] convert(Collection list) {
  88.442 -            Folder[] result = new Folder[list.size()];
  88.443 -            int i=0;
  88.444 -            for (Object item:list) {
  88.445 -                if (item instanceof FileObject)
  88.446 -                    result[i] = new Folder((FileObject) item);
  88.447 -                else 
  88.448 -                    result[i] = new Folder((NonRecursiveFolder) item);
  88.449 -                i++;
  88.450 -            }
  88.451 -            return result;
  88.452 -        }
  88.453 -
  88.454 -        @Override
  88.455 -        public String toString() {
  88.456 -            return !isRecursive()?"Non":"" + "Recursive file " + getFileObject().getPath();
  88.457 -        }
  88.458 -        
  88.459 -        
  88.460 -    }
  88.461 -    
  88.462 -    public abstract static class Scope {
  88.463 -
  88.464 -        public abstract String getDisplayName();
  88.465 -        public abstract Collection<? extends Folder> getTodo();
  88.466 -        public abstract MapIndices getIndexMapper(Iterable<? extends HintDescription> hints);
  88.467 -        
  88.468 -    }
  88.469 -    
  88.470 -    public static final class BatchResult {
  88.471 -        
  88.472 -        private final Map<? extends IndexEnquirer, ? extends Collection<? extends Resource>> projectId2Resources;
  88.473 -        private final Iterable<? extends HintDescription> patterns;
  88.474 -        public final Collection<? extends MessageImpl> problems;
  88.475 -        
  88.476 -        public BatchResult(Map<? extends IndexEnquirer, ? extends Collection<? extends Resource>> projectId2Resources, Iterable<? extends HintDescription> patterns, Collection<? extends MessageImpl> problems) {
  88.477 -            this.projectId2Resources = projectId2Resources;
  88.478 -            this.patterns = patterns;
  88.479 -            this.problems = problems;
  88.480 -        }
  88.481 -
  88.482 -        public Collection<? extends Collection<? extends Resource>> getResources() {
  88.483 -            return projectId2Resources.values();
  88.484 -        }
  88.485 -
  88.486 -        public Map<FileObject, Collection<? extends Resource>> getResourcesWithRoots() {
  88.487 -            Map<FileObject, Collection<? extends Resource>> result = new HashMap<FileObject, Collection<? extends Resource>>();
  88.488 -
  88.489 -            for (Entry<? extends IndexEnquirer, ? extends Collection<? extends Resource>> e : projectId2Resources.entrySet()) {
  88.490 -                result.put(e.getKey().src, e.getValue());
  88.491 -            }
  88.492 -
  88.493 -            return result;
  88.494 -        }
  88.495 -
  88.496 -        public Iterable<? extends HintDescription> getPatterns() {
  88.497 -            return patterns;
  88.498 -        }
  88.499 -    }
  88.500 -
  88.501 -    public static final class Resource {
  88.502 -        private final IndexEnquirer indexEnquirer;
  88.503 -        private final String relativePath;
  88.504 -        final Iterable<? extends HintDescription> hints;
  88.505 -        private final BulkPattern pattern;
  88.506 -        final HintsSettings settings;
  88.507 -
  88.508 -        public Resource(IndexEnquirer indexEnquirer, String relativePath, Iterable<? extends HintDescription> hints, BulkPattern pattern, HintsSettings settings) {
  88.509 -            this.indexEnquirer = indexEnquirer;
  88.510 -            this.relativePath = relativePath;
  88.511 -            this.hints = hints;
  88.512 -            this.pattern = pattern;
  88.513 -            this.settings = settings;
  88.514 -        }
  88.515 -
  88.516 -        public String getRelativePath() {
  88.517 -            return relativePath;
  88.518 -        }
  88.519 -        
  88.520 -        public Iterable<int[]> getCandidateSpans() {
  88.521 -            FileObject file = getResolvedFile();
  88.522 -            JavaSource js;
  88.523 -
  88.524 -            if (file != null) {
  88.525 -                js = JavaSource.forFileObject(file);
  88.526 -            } else {
  88.527 -                CharSequence text = getSourceCode();
  88.528 -
  88.529 -                if (text == null) {
  88.530 -                    return null;
  88.531 -                }
  88.532 -
  88.533 -                Writer out = null;
  88.534 -
  88.535 -                try {
  88.536 -                    file = FileUtil.createData(FileUtil.createMemoryFileSystem().getRoot(), relativePath);
  88.537 -                    out = new OutputStreamWriter(file.getOutputStream());
  88.538 -
  88.539 -                    out.write(text.toString());
  88.540 -                } catch (IOException ex) {
  88.541 -                    Exceptions.printStackTrace(ex);
  88.542 -                    return null;
  88.543 -                } finally {
  88.544 -                    if (out != null) {
  88.545 -                        try {
  88.546 -                            out.close();
  88.547 -                        } catch (IOException ex) {
  88.548 -                            Exceptions.printStackTrace(ex);
  88.549 -                        }
  88.550 -                    }
  88.551 -                }
  88.552 -
  88.553 -                js = JavaSource.create(Utilities.createUniversalCPInfo(), file);
  88.554 -            }
  88.555 -
  88.556 -            final List<int[]> span = new LinkedList<int[]>();
  88.557 -
  88.558 -            try {
  88.559 -                js.runUserActionTask(new Task<CompilationController>() {
  88.560 -                    public void run(CompilationController cc) throws Exception {
  88.561 -                        cc.toPhase(Phase.PARSED);
  88.562 -
  88.563 -                        span.addAll(doComputeSpans(cc));
  88.564 -                    }
  88.565 -                }, true);
  88.566 -            } catch (IOException ex) {
  88.567 -                Exceptions.printStackTrace(ex);
  88.568 -            }
  88.569 -
  88.570 -            return span;
  88.571 -        }
  88.572 -
  88.573 -        private Collection<int[]> doComputeSpans(CompilationInfo ci) {
  88.574 -            Collection<int[]> result = new LinkedList<int[]>();
  88.575 -            Map<String, Collection<TreePath>> found = BulkSearch.getDefault().match(ci, new AtomicBoolean(), new TreePath(ci.getCompilationUnit()), pattern);
  88.576 -            
  88.577 -            for (Entry<String, Collection<TreePath>> e : found.entrySet()) {
  88.578 -                Tree treePattern = Utilities.parseAndAttribute(ci, e.getKey(), null);
  88.579 -                
  88.580 -                for (TreePath tp : e.getValue()) {
  88.581 -                    //XXX: this pass will not be performed on the web!!!
  88.582 -                    if (   BulkSearch.getDefault().requiresLightweightVerification()
  88.583 -                        && !Matcher.create(ci).setCancel(new AtomicBoolean()).setSearchRoot(tp).setTreeTopSearch().setUntypedMatching().match(Pattern.createSimplePattern(new TreePath(new TreePath(ci.getCompilationUnit()), treePattern))).iterator().hasNext()) {
  88.584 -                        continue;
  88.585 -                    }
  88.586 -                    int[] span = new int[] {
  88.587 -                        (int) ci.getTrees().getSourcePositions().getStartPosition(ci.getCompilationUnit(), tp.getLeaf()),
  88.588 -                        (int) ci.getTrees().getSourcePositions().getEndPosition(ci.getCompilationUnit(), tp.getLeaf())
  88.589 -                    };
  88.590 -
  88.591 -                    result.add(span);
  88.592 -                }
  88.593 -            }
  88.594 -
  88.595 -            return result;
  88.596 -        }
  88.597 -        
  88.598 -        public FileObject getResolvedFile() {
  88.599 -            return indexEnquirer.src.getFileObject(relativePath);
  88.600 -        }
  88.601 -
  88.602 -        public String getDisplayName() {
  88.603 -            FileObject file = getResolvedFile();
  88.604 -
  88.605 -            if (file != null) {
  88.606 -                return FileUtil.getFileDisplayName(file);
  88.607 -            } else {
  88.608 -                return relativePath; //TODO:+container
  88.609 -            }
  88.610 -        }
  88.611 -        
  88.612 -        public CharSequence getSourceCode() {
  88.613 -            try {
  88.614 -                FileObject file = getResolvedFile();
  88.615 -                ByteBuffer bb = ByteBuffer.wrap(file.asBytes());
  88.616 -
  88.617 -                return FileEncodingQuery.getEncoding(file).decode(bb);
  88.618 -            } catch (IOException ex) {
  88.619 -                Exceptions.printStackTrace(ex);
  88.620 -                return null;
  88.621 -            }
  88.622 -        }
  88.623 -
  88.624 -        public FileObject getRoot() {
  88.625 -            return indexEnquirer.src;
  88.626 -        }
  88.627 -    }
  88.628 -
  88.629 -    public static interface MapIndices {
  88.630 -        public IndexEnquirer findIndex(FileObject root, ProgressHandleWrapper progress, boolean recursive);
  88.631 -    }
  88.632 -
  88.633 -    public static abstract class IndexEnquirer {
  88.634 -        final FileObject src;
  88.635 -        public IndexEnquirer(FileObject src) {
  88.636 -            this.src = src;
  88.637 -        }
  88.638 -        public abstract Collection<? extends Resource> findResources(Iterable<? extends HintDescription> hints, ProgressHandleWrapper progress, @NullAllowed Callable<BulkPattern> bulkPattern, Collection<? super MessageImpl> problems, HintsSettings settingsProvider);
  88.639 -        public abstract void validateResource(Collection<? extends Resource> resources, ProgressHandleWrapper progress, VerifiedSpansCallBack callback, boolean doNotRegisterClassPath, Collection<? super MessageImpl> problems, AtomicBoolean cancel);
  88.640 -//        public int[] getEstimatedSpan(Resource r);
  88.641 -    }
  88.642 -
  88.643 -    public static abstract class LocalIndexEnquirer extends IndexEnquirer {
  88.644 -        public LocalIndexEnquirer(FileObject src) {
  88.645 -            super(src);
  88.646 -        }
  88.647 -        public void validateResource(Collection<? extends Resource> resources, ProgressHandleWrapper progress, VerifiedSpansCallBack callback, boolean doNotRegisterClassPath, Collection<? super MessageImpl> problems, AtomicBoolean cancel) {
  88.648 -            getLocalVerifiedSpans(resources, progress, callback, doNotRegisterClassPath, problems, cancel);
  88.649 -        }
  88.650 -    }
  88.651 -
  88.652 -    public static final class FileSystemBasedIndexEnquirer extends LocalIndexEnquirer {
  88.653 -        private boolean recursive;
  88.654 -        public FileSystemBasedIndexEnquirer(FileObject src, boolean recursive) {
  88.655 -            super(src);
  88.656 -            this.recursive = recursive;
  88.657 -        }
  88.658 -        public Collection<? extends Resource> findResources(final Iterable<? extends HintDescription> hints, ProgressHandleWrapper progress, final @NullAllowed Callable<BulkPattern> bulkPattern, final Collection<? super MessageImpl> problems, final HintsSettings settingsProvider) {
  88.659 -            Collection<FileObject> files = new LinkedList<FileObject>();
  88.660 -
  88.661 -            final ProgressHandleWrapper innerProgress = progress.startNextPartWithEmbedding(30, 70);
  88.662 -
  88.663 -            BatchUtilities.recursive(src, src, files, innerProgress, 0, null, null, recursive);
  88.664 -
  88.665 -            LOG.log(Level.FINE, "files: {0}", files);
  88.666 -
  88.667 -            innerProgress.startNextPart(files.size());
  88.668 -
  88.669 -            final Collection<Resource> result = new ArrayList<Resource>();
  88.670 -
  88.671 -            if (!files.isEmpty()) {
  88.672 -                try {
  88.673 -                    if (bulkPattern != null) {
  88.674 -                        long start = System.currentTimeMillis();
  88.675 -
  88.676 -                        JavaSource.create(Utilities.createUniversalCPInfo(), files).runUserActionTask(new Task<CompilationController>() {
  88.677 -                            public void run(CompilationController cc) throws Exception {
  88.678 -                                if (cc.toPhase(Phase.PARSED).compareTo(Phase.PARSED) <0) {
  88.679 -                                    return ;
  88.680 -                                }
  88.681 -
  88.682 -                                try {
  88.683 -                                    boolean matches = BulkSearch.getDefault().matches(cc, new AtomicBoolean(), new TreePath(cc.getCompilationUnit()), bulkPattern.call());
  88.684 -
  88.685 -                                    if (matches) {
  88.686 -                                        result.add(new Resource(FileSystemBasedIndexEnquirer.this, FileUtil.getRelativePath(src, cc.getFileObject()), hints, bulkPattern.call(), settingsProvider));
  88.687 -                                    }
  88.688 -                                } catch (ThreadDeath td) {
  88.689 -                                    throw td;
  88.690 -                                } catch (Throwable t) {
  88.691 -                                    LOG.log(Level.INFO, "Exception while performing batch search in " + FileUtil.getFileDisplayName(cc.getFileObject()), t);
  88.692 -                                    problems.add(new MessageImpl(MessageKind.WARNING, "An exception occurred while testing file: " + FileUtil.getFileDisplayName(cc.getFileObject()) + " (" + t.getLocalizedMessage() + ")."));
  88.693 -                                }
  88.694 -
  88.695 -                                innerProgress.tick();
  88.696 -                            }
  88.697 -                        }, true);
  88.698 -
  88.699 -                        long end = System.currentTimeMillis();
  88.700 -
  88.701 -                        LOG.log(Level.FINE, "took: {0}, per file: {1}", new Object[]{end - start, (end - start) / files.size()});
  88.702 -                    } else {
  88.703 -                        for (FileObject file : files) {
  88.704 -                            result.add(new Resource(this, FileUtil.getRelativePath(src, file), hints, null, settingsProvider));
  88.705 -                        }
  88.706 -                    }
  88.707 -                } catch (IOException ex) {
  88.708 -                    Exceptions.printStackTrace(ex);
  88.709 -                }
  88.710 -            }
  88.711 -
  88.712 -            return result;
  88.713 -        }
  88.714 -
  88.715 -    }
  88.716 -
  88.717 -}
    89.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchUtilities.java	Sun Jan 08 20:10:08 2017 +0100
    89.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.3 @@ -1,586 +0,0 @@
    89.4 -/*
    89.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    89.6 - *
    89.7 - * Copyright 2009-2011 Oracle and/or its affiliates. All rights reserved.
    89.8 - *
    89.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   89.10 - * Other names may be trademarks of their respective owners.
   89.11 - *
   89.12 - * The contents of this file are subject to the terms of either the GNU
   89.13 - * General Public License Version 2 only ("GPL") or the Common
   89.14 - * Development and Distribution License("CDDL") (collectively, the
   89.15 - * "License"). You may not use this file except in compliance with the
   89.16 - * License. You can obtain a copy of the License at
   89.17 - * http://www.netbeans.org/cddl-gplv2.html
   89.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   89.19 - * specific language governing permissions and limitations under the
   89.20 - * License.  When distributing the software, include this License Header
   89.21 - * Notice in each file and include the License file at
   89.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   89.23 - * particular file as subject to the "Classpath" exception as provided
   89.24 - * by Oracle in the GPL Version 2 section of the License file that
   89.25 - * accompanied this code. If applicable, add the following below the
   89.26 - * License Header, with the fields enclosed by brackets [] replaced by
   89.27 - * your own identifying information:
   89.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   89.29 - *
   89.30 - * If you wish your version of this file to be governed by only the CDDL
   89.31 - * or only the GPL Version 2, indicate your decision by adding
   89.32 - * "[Contributor] elects to include this software in this distribution
   89.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   89.34 - * single choice of license, a recipient has the option to distribute
   89.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   89.36 - * to extend the choice of license to its licensees as provided above.
   89.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   89.38 - * Version 2 license, then the option applies only if the new code is
   89.39 - * made subject to such option by the copyright holder.
   89.40 - *
   89.41 - * Contributor(s):
   89.42 - *
   89.43 - * Portions Copyrighted 2009-2011 Sun Microsystems, Inc.
   89.44 - */
   89.45 -package org.netbeans.modules.java.hints.spiimpl.batch;
   89.46 -
   89.47 -import com.sun.tools.javac.api.JavacTaskImpl;
   89.48 -import com.sun.tools.javac.util.Log;
   89.49 -import java.io.IOException;
   89.50 -import java.lang.reflect.Constructor;
   89.51 -import java.lang.reflect.Method;
   89.52 -import java.nio.ByteBuffer;
   89.53 -import java.nio.charset.Charset;
   89.54 -import java.util.ArrayList;
   89.55 -import java.util.Collection;
   89.56 -import java.util.Collections;
   89.57 -import java.util.HashMap;
   89.58 -import java.util.HashSet;
   89.59 -import java.util.IdentityHashMap;
   89.60 -import java.util.Iterator;
   89.61 -import java.util.LinkedHashMap;
   89.62 -import java.util.LinkedHashSet;
   89.63 -import java.util.LinkedList;
   89.64 -import java.util.List;
   89.65 -import java.util.Map;
   89.66 -import java.util.Map.Entry;
   89.67 -import java.util.Properties;
   89.68 -import java.util.Set;
   89.69 -import java.util.concurrent.atomic.AtomicBoolean;
   89.70 -import java.util.logging.Level;
   89.71 -import java.util.logging.Logger;
   89.72 -import javax.swing.text.BadLocationException;
   89.73 -import javax.swing.text.Document;
   89.74 -import org.netbeans.api.annotations.common.CheckForNull;
   89.75 -import org.netbeans.api.annotations.common.NonNull;
   89.76 -import org.netbeans.api.java.classpath.ClassPath;
   89.77 -import org.netbeans.api.java.classpath.ClassPath.PathConversionMode;
   89.78 -import org.netbeans.api.java.platform.JavaPlatformManager;
   89.79 -import org.netbeans.api.java.source.ClasspathInfo;
   89.80 -import org.netbeans.api.java.source.CompilationController;
   89.81 -import org.netbeans.api.java.source.CompilationInfo;
   89.82 -import org.netbeans.api.java.source.JavaSource;
   89.83 -import org.netbeans.api.java.source.JavaSource.Phase;
   89.84 -import org.netbeans.api.java.source.ModificationResult;
   89.85 -import org.netbeans.api.java.source.ModificationResult.Difference;
   89.86 -import org.netbeans.api.java.source.Task;
   89.87 -import org.netbeans.api.java.source.WorkingCopy;
   89.88 -import org.netbeans.api.project.FileOwnerQuery;
   89.89 -import org.netbeans.api.project.Project;
   89.90 -import org.netbeans.api.project.ProjectUtils;
   89.91 -import org.netbeans.api.project.SourceGroup;
   89.92 -import org.netbeans.api.project.Sources;
   89.93 -import org.netbeans.api.queries.FileEncodingQuery;
   89.94 -import org.netbeans.api.queries.VisibilityQuery;
   89.95 -//import org.netbeans.modules.java.editor.semantic.SemanticHighlighter;
   89.96 -import org.netbeans.modules.java.hints.spiimpl.JavaFixImpl;
   89.97 -import org.netbeans.modules.java.hints.spiimpl.JavaFixImpl.Accessor;
   89.98 -import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
   89.99 -import org.netbeans.modules.java.hints.spiimpl.SyntheticFix;
  89.100 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.BatchResult;
  89.101 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Resource;
  89.102 -import org.netbeans.modules.java.hints.spiimpl.ipi.upgrade.ProjectDependencyUpgrader;
  89.103 -import org.netbeans.modules.java.source.JavaSourceAccessor;
  89.104 -import org.netbeans.modules.java.source.parsing.CompilationInfoImpl;
  89.105 -import org.netbeans.modules.java.source.save.DiffUtilities;
  89.106 -import org.netbeans.modules.java.source.save.ElementOverlay;
  89.107 -import org.netbeans.modules.parsing.api.Source;
  89.108 -import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation;
  89.109 -import org.netbeans.spi.editor.hints.ErrorDescription;
  89.110 -import org.netbeans.spi.editor.hints.Fix;
  89.111 -import org.netbeans.spi.java.hints.HintContext.MessageKind;
  89.112 -import org.netbeans.spi.java.hints.JavaFix;
  89.113 -import org.openide.cookies.EditorCookie;
  89.114 -import org.openide.filesystems.FileObject;
  89.115 -import org.openide.filesystems.FileUtil;
  89.116 -import org.openide.loaders.DataObject;
  89.117 -import org.openide.loaders.DataObjectNotFoundException;
  89.118 -import org.openide.util.Exceptions;
  89.119 -import org.openide.util.Lookup;
  89.120 -
  89.121 -/**
  89.122 - *
  89.123 - * @author Jan Lahoda
  89.124 - */
  89.125 -public class BatchUtilities {
  89.126 -
  89.127 -    private static final Logger LOG = Logger.getLogger(BatchUtilities.class.getName());
  89.128 -    
  89.129 -    public static Collection<ModificationResult> applyFixes(BatchResult candidates, @NonNull final ProgressHandleWrapper progress, AtomicBoolean cancel, final Collection<? super MessageImpl> problems) {
  89.130 -        return applyFixes(candidates, progress, cancel, new ArrayList<RefactoringElementImplementation>(), problems);
  89.131 -    }
  89.132 -    
  89.133 -    public static Collection<ModificationResult> applyFixes(BatchResult candidates, @NonNull final ProgressHandleWrapper progress, AtomicBoolean cancel, final Collection<? super RefactoringElementImplementation> fileChanges, final Collection<? super MessageImpl> problems) {
  89.134 -        return applyFixes(candidates, progress, cancel, fileChanges, null, problems);
  89.135 -    }
  89.136 -    
  89.137 -    public static Collection<ModificationResult> applyFixes(BatchResult candidates, @NonNull final ProgressHandleWrapper progress, AtomicBoolean cancel, final Collection<? super RefactoringElementImplementation> fileChanges, final Map<JavaFix, ModificationResult> changesPerFix, final Collection<? super MessageImpl> problems) {
  89.138 -        return applyFixes(candidates, progress, cancel, fileChanges, changesPerFix, false, problems);
  89.139 -    }
  89.140 -    
  89.141 -    public static Collection<ModificationResult> applyFixes(BatchResult candidates, @NonNull final ProgressHandleWrapper progress, AtomicBoolean cancel, final Collection<? super RefactoringElementImplementation> fileChanges, final Map<JavaFix, ModificationResult> changesPerFix, boolean doNotRegisterClassPath, final Collection<? super MessageImpl> problems) {
  89.142 -        final Map<Project, Set<String>> processedDependencyChanges = new IdentityHashMap<Project, Set<String>>();
  89.143 -        final Map<FileObject, List<ModificationResult.Difference>> result = new LinkedHashMap<FileObject, List<ModificationResult.Difference>>();
  89.144 -        final Map<FileObject, byte[]> resourceContentChanges = new HashMap<FileObject, byte[]>();
  89.145 -
  89.146 -        BatchSearch.VerifiedSpansCallBack callback = new BatchSearch.VerifiedSpansCallBack() {
  89.147 -            private ElementOverlay overlay;
  89.148 -            public void groupStarted() {
  89.149 -                overlay = ElementOverlay.getOrCreateOverlay();
  89.150 -            }
  89.151 -            public boolean spansVerified(CompilationController wc, Resource r, Collection<? extends ErrorDescription> hints) throws Exception {
  89.152 -                if (hints.isEmpty()) return true;
  89.153 -                
  89.154 -                Constructor<WorkingCopy> wcConstr = WorkingCopy.class.getDeclaredConstructor(CompilationInfoImpl.class, ElementOverlay.class);
  89.155 -                wcConstr.setAccessible(true);
  89.156 -
  89.157 -//                final WorkingCopy copy = new WorkingCopy(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(parameter), overlay);
  89.158 -                WorkingCopy copy = wcConstr.newInstance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(wc), overlay);
  89.159 -                Method setJavaSource = CompilationInfo.class.getDeclaredMethod("setJavaSource", JavaSource.class);
  89.160 -                setJavaSource.setAccessible(true);
  89.161 -
  89.162 -//                copy.setJavaSource(JavaSource.this);
  89.163 -                setJavaSource.invoke(copy, wc.getJavaSource());
  89.164 -
  89.165 -                copy.toPhase(Phase.RESOLVED);
  89.166 -                progress.tick();
  89.167 -                
  89.168 -                if (applyFixes(copy, processedDependencyChanges, hints, resourceContentChanges, fileChanges, changesPerFix, problems)) {
  89.169 -                    return false;
  89.170 -                }
  89.171 -
  89.172 -                final JavacTaskImpl jt = JavaSourceAccessor.getINSTANCE().getJavacTask(copy);
  89.173 -                Log.instance(jt.getContext()).nerrors = 0;
  89.174 -                Method getChanges = WorkingCopy.class.getDeclaredMethod("getChanges", Map.class);
  89.175 -                getChanges.setAccessible(true);
  89.176 -
  89.177 -                result.put(copy.getFileObject(), (List<ModificationResult.Difference>) getChanges.invoke(copy, new HashMap<Object, int[]>()));
  89.178 -
  89.179 -                if (LOG.isLoggable(Level.FINE)) {
  89.180 -                    LOG.log(Level.FINE, "fixes applied to: {0}", FileUtil.getFileDisplayName(wc.getFileObject()));
  89.181 -                }
  89.182 -
  89.183 -                return true;
  89.184 -            }
  89.185 -
  89.186 -            public void groupFinished() {
  89.187 -                overlay = null;
  89.188 -            }
  89.189 -
  89.190 -            public void cannotVerifySpan(Resource r) {
  89.191 -                problems.add(new MessageImpl(MessageKind.WARNING, "Cannot parse: " + r.getRelativePath()));
  89.192 -            }
  89.193 -        };
  89.194 -
  89.195 -        BatchSearch.getVerifiedSpans(candidates, progress, callback, doNotRegisterClassPath, problems, cancel);
  89.196 -        
  89.197 -        addResourceContentChanges(resourceContentChanges, result);
  89.198 -
  89.199 -        return Collections.singletonList(JavaSourceAccessor.getINSTANCE().createModificationResult(result, Collections.<Object, int[]>emptyMap()));
  89.200 -    }
  89.201 -
  89.202 -    public static void addResourceContentChanges(final Map<FileObject, byte[]> resourceContentChanges, final Map<FileObject, List<Difference>> result) {
  89.203 -        for (Entry<FileObject, byte[]> e : resourceContentChanges.entrySet()) {
  89.204 -            try {
  89.205 -                Charset encoding = FileEncodingQuery.getEncoding(e.getKey());
  89.206 -                final Document originalDocument = getDocument(e.getKey());
  89.207 -                final String[] origContent = new String[1];
  89.208 -                final Source[] s = new Source[1];
  89.209 -                if (originalDocument != null) {
  89.210 -                    originalDocument.render(new Runnable() {
  89.211 -                        @Override public void run() {
  89.212 -                            try {
  89.213 -                                origContent[0] = originalDocument.getText(0, originalDocument.getLength());
  89.214 -                                s[0] = Source.create(originalDocument);
  89.215 -                            } catch (BadLocationException ex) {
  89.216 -                                Exceptions.printStackTrace(ex);
  89.217 -                            }
  89.218 -                        }
  89.219 -                    });
  89.220 -                }
  89.221 -                
  89.222 -                if (origContent[0] == null) {
  89.223 -                    byte[] origBytes = e.getKey().asBytes();
  89.224 -                    origContent[0] = encoding.newDecoder().decode(ByteBuffer.wrap(origBytes)).toString();
  89.225 -                }
  89.226 -                String newContent  = encoding.newDecoder().decode(ByteBuffer.wrap(e.getValue())).toString();
  89.227 -
  89.228 -                result.put(e.getKey(), DiffUtilities.diff2ModificationResultDifference(e.getKey(), null, Collections.<Integer, String>emptyMap(), origContent[0], newContent, s[0]));
  89.229 -            } catch (BadLocationException ex) {
  89.230 -                Exceptions.printStackTrace(ex);
  89.231 -            } catch (IOException ex) {
  89.232 -                Exceptions.printStackTrace(ex);
  89.233 -            }
  89.234 -        }
  89.235 -    }
  89.236 -    
  89.237 -    public static @CheckForNull Document getDocument(@NonNull FileObject file) {
  89.238 -        try {
  89.239 -            DataObject od = DataObject.find(file);
  89.240 -            EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
  89.241 -
  89.242 -            if (ec == null) return null;
  89.243 -
  89.244 -            return ec.getDocument();
  89.245 -        } catch (DataObjectNotFoundException ex) {
  89.246 -            LOG.log(Level.FINE, null, ex);
  89.247 -            return null;
  89.248 -        }
  89.249 -    }
  89.250 -
  89.251 -    private static String positionToString(ErrorDescription ed) {
  89.252 -        try {
  89.253 -            return ed.getFile().getNameExt() + ":" + ed.getRange().getBegin().getLine();
  89.254 -        } catch (IOException ex) {
  89.255 -            LOG.log(Level.FINE, null, ex);
  89.256 -            return ed.getFile().getNameExt();
  89.257 -        }
  89.258 -    }
  89.259 -
  89.260 -//    public static void removeUnusedImports(Collection<? extends FileObject> files) throws IOException {
  89.261 -//        Map<ClasspathInfo, Collection<FileObject>> sortedFastFiles = sortFiles(files);
  89.262 -//
  89.263 -//        for (Entry<ClasspathInfo, Collection<FileObject>> e : sortedFastFiles.entrySet()) {
  89.264 -//            JavaSource.create(e.getKey(), e.getValue()).runModificationTask(new RemoveUnusedImports()).commit();
  89.265 -//        }
  89.266 -//    }
  89.267 -//
  89.268 -//    private static final class RemoveUnusedImports implements Task<WorkingCopy> {
  89.269 -//        public void run(WorkingCopy wc) throws IOException {
  89.270 -//            Document doc = wc.getSnapshot().getSource().getDocument(true);
  89.271 -//            
  89.272 -//            if (wc.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) {
  89.273 -//                return;
  89.274 -//            }
  89.275 -//
  89.276 -//            //compute imports to remove:
  89.277 -//            List<TreePathHandle> unusedImports = SemanticHighlighter.computeUnusedImports(wc);
  89.278 -//            CompilationUnitTree cut = wc.getCompilationUnit();
  89.279 -//            // make the changes to the source
  89.280 -//            for (TreePathHandle handle : unusedImports) {
  89.281 -//                TreePath path = handle.resolve(wc);
  89.282 -//                assert path != null;
  89.283 -//                cut = wc.getTreeMaker().removeCompUnitImport(cut,
  89.284 -//                        (ImportTree) path.getLeaf());
  89.285 -//            }
  89.286 -//
  89.287 -//            if (!unusedImports.isEmpty()) {
  89.288 -//                wc.rewrite(wc.getCompilationUnit(), cut);
  89.289 -//            }
  89.290 -//        }
  89.291 -//    }
  89.292 -
  89.293 -    public static boolean applyFixes(WorkingCopy copy, Map<Project, Set<String>> processedDependencyChanges, Collection<? extends ErrorDescription> hints, Map<FileObject, byte[]> resourceContentChanges, Collection<? super RefactoringElementImplementation> fileChanges, Collection<? super MessageImpl> problems) throws IllegalStateException, Exception {
  89.294 -        return applyFixes(copy, processedDependencyChanges, hints, resourceContentChanges, fileChanges, null, problems);
  89.295 -    }
  89.296 -    
  89.297 -    public static boolean applyFixes(WorkingCopy copy, Map<Project, Set<String>> processedDependencyChanges, Collection<? extends ErrorDescription> hints, Map<FileObject, byte[]> resourceContentChanges, Collection<? super RefactoringElementImplementation> fileChanges, Map<JavaFix, ModificationResult> changesPerFix, Collection<? super MessageImpl> problems) throws IllegalStateException, Exception {
  89.298 -        Set<JavaFix> fixes = new LinkedHashSet<JavaFix>();
  89.299 -        for (ErrorDescription ed : hints) {
  89.300 -            if (!ed.getFixes().isComputed()) {
  89.301 -                throw new IllegalStateException();//TODO: should be problem
  89.302 -            }
  89.303 -
  89.304 -            Fix toApply = null;
  89.305 -
  89.306 -            for (Fix f : ed.getFixes().getFixes()) {
  89.307 -                if (f instanceof SyntheticFix) continue;
  89.308 -                if (toApply == null) toApply = f;
  89.309 -                else problems.add(new MessageImpl(MessageKind.WARNING, "More than one fix for: " + ed.getDescription() + " at " + positionToString(ed) + ", only the first one will be used."));
  89.310 -            }
  89.311 -
  89.312 -            if (toApply == null) {
  89.313 -                //TODO: currently giving a warning so that the hints can be augmented with "Options.QUERY", but that should be removed
  89.314 -                //if a non-query hint cannot produce any fix, it is likely Ok - if not, the hint should produce a warning itself
  89.315 -                boolean doWarning = false;
  89.316 -                assert doWarning = true;
  89.317 -                if (doWarning) {
  89.318 -                    problems.add(new MessageImpl(MessageKind.WARNING, "No fix for: " + ed.getDescription() + " at " + positionToString(ed) + "."));
  89.319 -                }
  89.320 -                continue;
  89.321 -            }
  89.322 -
  89.323 -            if (!(toApply instanceof JavaFixImpl)) {
  89.324 -                throw new IllegalStateException(toApply.getClass().getName());//XXX: hints need to provide JavaFixes
  89.325 -            }
  89.326 -
  89.327 -
  89.328 -            fixes.add(((JavaFixImpl) toApply).jf);
  89.329 -        }
  89.330 -        if (fixDependencies(copy.getFileObject(), fixes, processedDependencyChanges)) {
  89.331 -            return true;
  89.332 -        }
  89.333 -        for (JavaFix f : fixes) {
  89.334 -//                    if (cancel.get()) return ;
  89.335 -
  89.336 -            JavaFixImpl.Accessor.INSTANCE.process(f, copy, false, resourceContentChanges, fileChanges);
  89.337 -            
  89.338 -            if (changesPerFix != null) {
  89.339 -                ElementOverlay overlay = ElementOverlay.getOrCreateOverlay(); //XXX: will use the incorrect overlay?
  89.340 -                Constructor<WorkingCopy> wcConstr = WorkingCopy.class.getDeclaredConstructor(CompilationInfoImpl.class, ElementOverlay.class);
  89.341 -                wcConstr.setAccessible(true);
  89.342 -
  89.343 -//                final WorkingCopy copy = new WorkingCopy(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(parameter), overlay);
  89.344 -                WorkingCopy perFixCopy = wcConstr.newInstance(JavaSourceAccessor.getINSTANCE().getCompilationInfoImpl(copy), overlay);
  89.345 -                Method setJavaSource = CompilationInfo.class.getDeclaredMethod("setJavaSource", JavaSource.class);
  89.346 -                setJavaSource.setAccessible(true);
  89.347 -
  89.348 -//                copy.setJavaSource(JavaSource.this);
  89.349 -                setJavaSource.invoke(perFixCopy, copy.getJavaSource());
  89.350 -
  89.351 -                perFixCopy.toPhase(Phase.RESOLVED);
  89.352 -                
  89.353 -                final Map<FileObject, byte[]> perFixResourceContentChanges = new HashMap<FileObject, byte[]>();
  89.354 -        
  89.355 -                JavaFixImpl.Accessor.INSTANCE.process(f, perFixCopy, false, perFixResourceContentChanges, new ArrayList<RefactoringElementImplementation>());
  89.356 -                
  89.357 -                final JavacTaskImpl jt = JavaSourceAccessor.getINSTANCE().getJavacTask(perFixCopy);
  89.358 -                Log.instance(jt.getContext()).nerrors = 0;
  89.359 -                Method getChanges = WorkingCopy.class.getDeclaredMethod("getChanges", Map.class);
  89.360 -                getChanges.setAccessible(true);
  89.361 -                
  89.362 -                Map<FileObject, List<Difference>> changes = new HashMap<FileObject, List<Difference>>();
  89.363 -                
  89.364 -                changes.put(perFixCopy.getFileObject(), (List<ModificationResult.Difference>) getChanges.invoke(perFixCopy, new HashMap<Object, int[]>()));
  89.365 -                
  89.366 -                addResourceContentChanges(resourceContentChanges, changes);
  89.367 -                
  89.368 -                for (Iterator<Entry<FileObject, List<Difference>>> it = changes.entrySet().iterator(); it.hasNext();) {
  89.369 -                    if (it.next().getValue().isEmpty()) it.remove();
  89.370 -                }
  89.371 -
  89.372 -                if (!changes.isEmpty()) {
  89.373 -                    ModificationResult perFixResult = JavaSourceAccessor.getINSTANCE().createModificationResult(changes, Collections.<Object, int[]>emptyMap());
  89.374 -
  89.375 -                    changesPerFix.put(f, perFixResult);
  89.376 -                }
  89.377 -            }
  89.378 -        }
  89.379 -        return false;
  89.380 -    }
  89.381 -    
  89.382 -    public static Collection<ModificationResult> applyFixes(final Map<FileObject, Collection<JavaFix>> toRun) {
  89.383 -        final Map<FileObject, List<ModificationResult.Difference>> result = new LinkedHashMap<FileObject, List<ModificationResult.Difference>>();
  89.384 -        final Map<FileObject, byte[]> resourceContentChanges = new HashMap<FileObject, byte[]>();
  89.385 -        Map<ClasspathInfo, Collection<FileObject>> cp2Files = BatchUtilities.sortFiles(toRun.keySet());
  89.386 -
  89.387 -        for (Entry<ClasspathInfo, Collection<FileObject>> e : cp2Files.entrySet()) {
  89.388 -            try {
  89.389 -                ModificationResult mr = JavaSource.create(e.getKey(), e.getValue()).runModificationTask(new Task<WorkingCopy>() {
  89.390 -                    @Override
  89.391 -                    public void run(WorkingCopy parameter) throws Exception {
  89.392 -                        if (parameter.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) return ;
  89.393 -
  89.394 -                        for (JavaFix jf : toRun.get(parameter.getFileObject())) {
  89.395 -                            JavaFixImpl.Accessor.INSTANCE.process(jf, parameter, false, resourceContentChanges, new ArrayList<RefactoringElementImplementation>());
  89.396 -                        }
  89.397 -                    }
  89.398 -                });
  89.399 -                
  89.400 -                result.putAll(JavaSourceAccessor.getINSTANCE().getDiffsFromModificationResult(mr));
  89.401 -            } catch (IOException ex) {
  89.402 -                Exceptions.printStackTrace(ex);
  89.403 -            }
  89.404 -        }
  89.405 -        
  89.406 -        addResourceContentChanges(resourceContentChanges, result);
  89.407 -        
  89.408 -        return Collections.singletonList(JavaSourceAccessor.getINSTANCE().createModificationResult(result, Collections.<Object, int[]>emptyMap()));
  89.409 -    }
  89.410 -
  89.411 -    public static Collection<FileObject> getSourceGroups(Iterable<? extends Project> prjs) {
  89.412 -        List<FileObject> result = new LinkedList<FileObject>();
  89.413 -        
  89.414 -        for (Project p : prjs) {
  89.415 -            Sources s = ProjectUtils.getSources(p);
  89.416 -
  89.417 -            for (SourceGroup sg : s.getSourceGroups("java")) {
  89.418 -                result.add(sg.getRootFolder());
  89.419 -            }
  89.420 -        }
  89.421 -
  89.422 -        return result;
  89.423 -    }
  89.424 -
  89.425 -    public static Map<ClasspathInfo, Collection<FileObject>> sortFiles(Collection<? extends FileObject> from) {
  89.426 -        Map<CPCategorizer, Collection<FileObject>> m = new HashMap<CPCategorizer, Collection<FileObject>>();
  89.427 -
  89.428 -        for (FileObject f : from) {
  89.429 -            CPCategorizer cpCategorizer = new CPCategorizer(f);
  89.430 -
  89.431 -            Collection<FileObject> files = m.get(cpCategorizer);
  89.432 -
  89.433 -            if (files == null) {
  89.434 -                m.put(cpCategorizer, files = new LinkedList<FileObject>());
  89.435 -            }
  89.436 -
  89.437 -            files.add(f);
  89.438 -        }
  89.439 -        
  89.440 -        Map<ClasspathInfo, Collection<FileObject>> result = new IdentityHashMap<ClasspathInfo, Collection<FileObject>>();
  89.441 -
  89.442 -        for (Entry<CPCategorizer, Collection<FileObject>> e : m.entrySet()) {
  89.443 -            result.put(ClasspathInfo.create(e.getKey().boot, e.getKey().compile, e.getKey().source), e.getValue());
  89.444 -        }
  89.445 -        
  89.446 -        return result;
  89.447 -    }
  89.448 -    
  89.449 -    private static final ClassPath getClassPath(FileObject forFO, String id) {
  89.450 -        ClassPath result = ClassPath.getClassPath(forFO, id);
  89.451 -        
  89.452 -        if (result == null) {
  89.453 -            if (ClassPath.BOOT.equals(id)) {
  89.454 -                result = JavaPlatformManager.getDefault().getDefaultPlatform().getBootstrapLibraries();
  89.455 -            } else {
  89.456 -                result = ClassPath.EMPTY;
  89.457 -            }
  89.458 -        }
  89.459 -        
  89.460 -        return result;
  89.461 -    }
  89.462 -    
  89.463 -    private static final class CPCategorizer {
  89.464 -        private final String cps;
  89.465 -        private final ClassPath boot;
  89.466 -        private final ClassPath compile;
  89.467 -        private final ClassPath source;
  89.468 -        private final FileObject sourceRoot;
  89.469 -
  89.470 -        public CPCategorizer(FileObject file) {
  89.471 -            this.boot = getClassPath(file, ClassPath.BOOT);
  89.472 -            this.compile = getClassPath(file, ClassPath.COMPILE);
  89.473 -            this.source = getClassPath(file, ClassPath.SOURCE);
  89.474 -            this.sourceRoot = source != null ? source.findOwnerRoot(file) : null;
  89.475 -            
  89.476 -            StringBuilder cps = new StringBuilder();
  89.477 -            
  89.478 -            if (boot != null) cps.append(boot.toString(PathConversionMode.PRINT));
  89.479 -            if (compile != null) cps.append(compile.toString(PathConversionMode.PRINT));
  89.480 -            if (source != null) cps.append(source.toString(PathConversionMode.PRINT));
  89.481 -            
  89.482 -            this.cps = cps.toString();
  89.483 -        }
  89.484 -
  89.485 -        @Override
  89.486 -        public int hashCode() {
  89.487 -            int hash = 5;
  89.488 -            hash = 53 * hash + this.cps.hashCode();
  89.489 -            hash = 53 * hash + (this.sourceRoot != null ? this.sourceRoot.hashCode() : 0);
  89.490 -            return hash;
  89.491 -        }
  89.492 -
  89.493 -        @Override
  89.494 -        public boolean equals(Object obj) {
  89.495 -            if (obj == null) {
  89.496 -                return false;
  89.497 -            }
  89.498 -            if (getClass() != obj.getClass()) {
  89.499 -                return false;
  89.500 -            }
  89.501 -            final CPCategorizer other = (CPCategorizer) obj;
  89.502 -            if (!this.cps.equals(other.cps)) {
  89.503 -                return false;
  89.504 -            }
  89.505 -            if (this.sourceRoot != other.sourceRoot && (this.sourceRoot == null || !this.sourceRoot.equals(other.sourceRoot))) {
  89.506 -                return false;
  89.507 -            }
  89.508 -            return true;
  89.509 -        }
  89.510 -        
  89.511 -    }
  89.512 -
  89.513 -    public static final String ENSURE_DEPENDENCY = "ensure-dependency";
  89.514 -
  89.515 -    public static boolean fixDependencies(FileObject file, Iterable<? extends JavaFix> toProcess, Map<Project, Set<String>> alreadyProcessed) {
  89.516 -        boolean modified = false;
  89.517 -//        for (FileObject file : toProcess.keySet()) {
  89.518 -            for (JavaFix fix : toProcess) {
  89.519 -                String updateTo = Accessor.INSTANCE.getOptions(fix).get(ENSURE_DEPENDENCY);
  89.520 -
  89.521 -                if (updateTo != null) {
  89.522 -                    Project p = FileOwnerQuery.getOwner(file);
  89.523 -
  89.524 -                    if (p != null) {
  89.525 -                        Set<String> seen = alreadyProcessed.get(p);
  89.526 -
  89.527 -                        if (seen == null) {
  89.528 -                            alreadyProcessed.put(p, seen = new HashSet<String>());
  89.529 -                        }
  89.530 -
  89.531 -                        if (seen.add(updateTo)) {
  89.532 -                            for (ProjectDependencyUpgrader up : Lookup.getDefault().lookupAll(ProjectDependencyUpgrader.class)) {
  89.533 -                                if (up.ensureDependency(p, updateTo, false)) { //XXX: should check whether the given project was actually modified
  89.534 -                                    modified = true;
  89.535 -                                    break;
  89.536 -                                }
  89.537 -                            }
  89.538 -                            //TODO: fail if cannot update the dependency?
  89.539 -                        }
  89.540 -                    }
  89.541 -                }
  89.542 -            }
  89.543 -
  89.544 -            return modified;
  89.545 -//        }
  89.546 -    }
  89.547 -
  89.548 -    public static void recursive(FileObject root, FileObject file, Collection<FileObject> collected, ProgressHandleWrapper progress, int depth, Properties timeStamps, Set<String> removedFiles, boolean recursive) {
  89.549 -        if (!VisibilityQuery.getDefault().isVisible(file)) return;
  89.550 -
  89.551 -        if (file.isData()) {
  89.552 -            if (timeStamps != null) {
  89.553 -                String relativePath = FileUtil.getRelativePath(root, file);
  89.554 -                String lastModified = Long.toHexString(file.lastModified().getTime());
  89.555 -
  89.556 -                removedFiles.remove(relativePath);
  89.557 -
  89.558 -                if (lastModified.equals(timeStamps.getProperty(relativePath))) {
  89.559 -                    return;
  89.560 -                }
  89.561 -
  89.562 -                timeStamps.setProperty(relativePath, lastModified);
  89.563 -            }
  89.564 -
  89.565 -            if (/*???:*/"java".equals(file.getExt()) || "text/x-java".equals(FileUtil.getMIMEType(file, "text/x-java"))) {
  89.566 -                collected.add(file);
  89.567 -            }
  89.568 -        } else {
  89.569 -            FileObject[] children = file.getChildren();
  89.570 -
  89.571 -            if (children.length == 0) return;
  89.572 -
  89.573 -            ProgressHandleWrapper inner = depth < 2 ? progress.startNextPartWithEmbedding(ProgressHandleWrapper.prepareParts(children.length)) : null;
  89.574 -
  89.575 -            if (inner == null && progress != null) {
  89.576 -                progress.startNextPart(children.length);
  89.577 -            } else {
  89.578 -                progress = null;
  89.579 -            }
  89.580 -
  89.581 -            for (FileObject c : children) {
  89.582 -                if (recursive || c.isData())
  89.583 -                    recursive(root, c, collected, inner, depth + 1, timeStamps, removedFiles, recursive);
  89.584 -
  89.585 -                if (progress != null) progress.tick();
  89.586 -            }
  89.587 -        }
  89.588 -    }    
  89.589 -}
    90.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/ProgressHandleWrapper.java	Sun Jan 08 20:10:08 2017 +0100
    90.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.3 @@ -1,293 +0,0 @@
    90.4 -/*
    90.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    90.6 - *
    90.7 - * Copyright 2009-2011 Oracle and/or its affiliates. All rights reserved.
    90.8 - *
    90.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   90.10 - * Other names may be trademarks of their respective owners.
   90.11 - *
   90.12 - * The contents of this file are subject to the terms of either the GNU
   90.13 - * General Public License Version 2 only ("GPL") or the Common
   90.14 - * Development and Distribution License("CDDL") (collectively, the
   90.15 - * "License"). You may not use this file except in compliance with the
   90.16 - * License. You can obtain a copy of the License at
   90.17 - * http://www.netbeans.org/cddl-gplv2.html
   90.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   90.19 - * specific language governing permissions and limitations under the
   90.20 - * License.  When distributing the software, include this License Header
   90.21 - * Notice in each file and include the License file at
   90.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   90.23 - * particular file as subject to the "Classpath" exception as provided
   90.24 - * by Oracle in the GPL Version 2 section of the License file that
   90.25 - * accompanied this code. If applicable, add the following below the
   90.26 - * License Header, with the fields enclosed by brackets [] replaced by
   90.27 - * your own identifying information:
   90.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   90.29 - *
   90.30 - * If you wish your version of this file to be governed by only the CDDL
   90.31 - * or only the GPL Version 2, indicate your decision by adding
   90.32 - * "[Contributor] elects to include this software in this distribution
   90.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   90.34 - * single choice of license, a recipient has the option to distribute
   90.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   90.36 - * to extend the choice of license to its licensees as provided above.
   90.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   90.38 - * Version 2 license, then the option applies only if the new code is
   90.39 - * made subject to such option by the copyright holder.
   90.40 - *
   90.41 - * Contributor(s):
   90.42 - *
   90.43 - * Portions Copyrighted 2009-2011 Sun Microsystems, Inc.
   90.44 - */
   90.45 -package org.netbeans.modules.java.hints.spiimpl.batch;
   90.46 -
   90.47 -import java.util.Arrays;
   90.48 -import java.util.logging.Level;
   90.49 -import java.util.logging.Logger;
   90.50 -import org.netbeans.api.progress.ProgressHandle;
   90.51 -import org.netbeans.modules.analysis.spi.Analyzer.Context;
   90.52 -import org.netbeans.modules.java.hints.spiimpl.Utilities;
   90.53 -
   90.54 -public final class ProgressHandleWrapper {
   90.55 -
   90.56 -    private static final int TOTAL = 1000;
   90.57 -    private final ProgressHandleAbstraction handle;
   90.58 -    private final int[] parts;
   90.59 -    private int currentPart = -1;
   90.60 -    private int currentPartTotalWork;
   90.61 -    private int currentPartWorkDone;
   90.62 -    private long currentPartStartTime;
   90.63 -    private int currentOffset;
   90.64 -    private final long[] spentTime;
   90.65 -    private boolean debug;
   90.66 -
   90.67 -    public ProgressHandleWrapper(int... parts) {
   90.68 -        this((ProgressHandleAbstraction) null, parts);
   90.69 -    }
   90.70 -
   90.71 -    public ProgressHandleWrapper(ProgressHandle handle, int... parts) {
   90.72 -        this(new ProgressHandleBasedProgressHandleAbstraction(handle), parts);
   90.73 -    }
   90.74 -
   90.75 -    public ProgressHandleWrapper(Context handle, int... parts) {
   90.76 -        this(new AnalysisContextBasedProgressHandleAbstraction(handle), parts);
   90.77 -    }
   90.78 -
   90.79 -    public ProgressHandleWrapper(ProgressHandleAbstraction handle, int... parts) {
   90.80 -        this.handle = handle;
   90.81 -        if (handle == null) {
   90.82 -            this.parts = null;
   90.83 -            this.spentTime = null;
   90.84 -        } else {
   90.85 -            int total = 0;
   90.86 -            for (int i : parts) {
   90.87 -                total += i;
   90.88 -            }
   90.89 -            this.parts = new int[parts.length];
   90.90 -            for (int cntr = 0; cntr < parts.length; cntr++) {
   90.91 -                this.parts[cntr] = (TOTAL * parts[cntr]) / total;
   90.92 -            }
   90.93 -            this.spentTime = new long[parts.length];
   90.94 -        }
   90.95 -    }
   90.96 -
   90.97 -    public void setDebug(boolean debug) {
   90.98 -        this.debug = debug;
   90.99 -    }
  90.100 -
  90.101 -    public void startNextPart(int totalWork) {
  90.102 -        if (handle == null) {
  90.103 -            return;
  90.104 -        }
  90.105 -        if (currentPart == (-1)) {
  90.106 -            handle.start(TOTAL);
  90.107 -        } else {
  90.108 -            currentOffset += parts[currentPart];
  90.109 -            spentTime[currentPart] = System.currentTimeMillis() - currentPartStartTime;
  90.110 -        }
  90.111 -        currentPart++;
  90.112 -        currentPartTotalWork = totalWork;
  90.113 -        currentPartWorkDone = 0;
  90.114 -        currentPartStartTime = System.currentTimeMillis();
  90.115 -        currentPartWorkDoneUpdated();
  90.116 -    }
  90.117 -
  90.118 -    public ProgressHandleWrapper startNextPartWithEmbedding(int... embeddedParts) {
  90.119 -//        startNextPart(TOTAL);
  90.120 -        return new ProgressHandleWrapper(new ProgressHandleWrapperBasedProgressHandleAbstraction(this), embeddedParts);
  90.121 -    }
  90.122 -
  90.123 -    public void tick() {
  90.124 -        if (handle == null) {
  90.125 -            return;
  90.126 -        }
  90.127 -        currentPartWorkDone++;
  90.128 -        currentPartWorkDoneUpdated();
  90.129 -    }
  90.130 -
  90.131 -    private void setCurrentPartWorkDone(int done) {
  90.132 -        if (handle == null) {
  90.133 -            return;
  90.134 -        }
  90.135 -        currentPartWorkDone = done;
  90.136 -        currentPartWorkDoneUpdated();
  90.137 -    }
  90.138 -
  90.139 -    private void currentPartWorkDoneUpdated() {
  90.140 -        if (currentPartTotalWork > 0) {
  90.141 -            int parentProgress = currentOffset + (parts[currentPart] * currentPartWorkDone) / currentPartTotalWork;
  90.142 -            if (debug) {
  90.143 -                System.err.println("currentOffset=" + currentOffset);
  90.144 -                System.err.println("currentPart=" + currentPart);
  90.145 -                System.err.println("parts[currentPart]= " +parts[currentPart]);
  90.146 -                System.err.println("currentPartWorkDone=" + currentPartWorkDone);
  90.147 -                System.err.println("currentPartTotalWork= " +currentPartTotalWork);
  90.148 -                System.err.println("parentProgress=" + parentProgress);
  90.149 -            }
  90.150 -            handle.progress(parentProgress);
  90.151 -        } else {
  90.152 -            handle.progress(currentOffset + parts[currentPart]);
  90.153 -        }
  90.154 -        setAutomatedMessage();
  90.155 -    }
  90.156 -
  90.157 -    public void setMessage(String message) {
  90.158 -        if (handle == null) {
  90.159 -            return;
  90.160 -        }
  90.161 -        handle.progress(message);
  90.162 -    }
  90.163 -
  90.164 -    private void setAutomatedMessage() {
  90.165 -        if (handle == null || currentPart == (-1)) {
  90.166 -            return;
  90.167 -        }
  90.168 -        long spentTime = System.currentTimeMillis() - currentPartStartTime;
  90.169 -        double timePerUnit = ((double) spentTime) / currentPartWorkDone;
  90.170 -        String timeString;
  90.171 -        if (spentTime > 0) {
  90.172 -            double totalTime = currentPartTotalWork * timePerUnit;
  90.173 -            timeString = Utilities.toHumanReadableTime(spentTime) + "/" + Utilities.toHumanReadableTime(totalTime);
  90.174 -        } else {
  90.175 -            timeString = "No estimate";
  90.176 -        }
  90.177 -        handle.progress("Part " + (currentPart + 1) + "/" + parts.length + ", " + currentPartWorkDone + "/" + currentPartTotalWork + ", " + timeString);
  90.178 -    }
  90.179 -
  90.180 -    public void finish() {
  90.181 -        if (handle == null) {
  90.182 -            return ;
  90.183 -        }
  90.184 -
  90.185 -        handle.finish();
  90.186 -
  90.187 -        if (currentPart < 0) return ;
  90.188 -        
  90.189 -        spentTime[currentPart] = System.currentTimeMillis() - currentPartStartTime;
  90.190 -
  90.191 -        double total = 0.0;
  90.192 -
  90.193 -        for (long t : spentTime) {
  90.194 -            total += t;
  90.195 -        }
  90.196 -
  90.197 -        double[] actualSplit = new double[spentTime.length];
  90.198 -        int i = 0;
  90.199 -
  90.200 -        for (long t : spentTime) {
  90.201 -            actualSplit[i++] = TOTAL * (t / total);
  90.202 -        }
  90.203 -
  90.204 -        Logger.getLogger(ProgressHandleWrapper.class.getName()).log(Level.FINE, "Progress handle with split: {0}, actual times: {1}, actual split: {2}", new Object[] {Arrays.toString(parts), Arrays.toString(spentTime), Arrays.toString(actualSplit)});
  90.205 -    }
  90.206 -
  90.207 -    public static int[] prepareParts(int count) {
  90.208 -        int[] result = new int[count];
  90.209 -
  90.210 -        for (int cntr = 0; cntr < count; cntr++) {
  90.211 -            result[cntr] = 1;
  90.212 -        }
  90.213 -
  90.214 -        return result;
  90.215 -    }
  90.216 -
  90.217 -    public static interface ProgressHandleAbstraction {
  90.218 -
  90.219 -        public void start(int totalWork);
  90.220 -
  90.221 -        public void progress(int currentWorkDone);
  90.222 -
  90.223 -        public void progress(String message);
  90.224 -
  90.225 -        public void finish();
  90.226 -
  90.227 -    }
  90.228 -
  90.229 -    private static final class ProgressHandleBasedProgressHandleAbstraction implements ProgressHandleAbstraction {
  90.230 -        private final ProgressHandle delegate;
  90.231 -        public ProgressHandleBasedProgressHandleAbstraction(ProgressHandle delegate) {
  90.232 -            this.delegate = delegate;
  90.233 -        }
  90.234 -
  90.235 -        public void start(int totalWork) {
  90.236 -            delegate.start(totalWork);
  90.237 -        }
  90.238 -
  90.239 -        public void progress(int currentWorkDone) {
  90.240 -            delegate.progress(currentWorkDone);
  90.241 -        }
  90.242 -
  90.243 -        public void progress(String message) {
  90.244 -            delegate.progress(message);
  90.245 -        }
  90.246 -
  90.247 -        public void finish() {
  90.248 -            delegate.finish();
  90.249 -        }
  90.250 -    }
  90.251 -
  90.252 -    private static final class AnalysisContextBasedProgressHandleAbstraction implements ProgressHandleAbstraction {
  90.253 -        private final Context delegate;
  90.254 -        AnalysisContextBasedProgressHandleAbstraction(Context delegate) {
  90.255 -            this.delegate = delegate;
  90.256 -        }
  90.257 -
  90.258 -        public void start(int totalWork) {
  90.259 -            delegate.start(totalWork);
  90.260 -        }
  90.261 -
  90.262 -        public void progress(int currentWorkDone) {
  90.263 -            delegate.progress(currentWorkDone);
  90.264 -        }
  90.265 -
  90.266 -        public void progress(String message) {
  90.267 -            delegate.progress(message);
  90.268 -        }
  90.269 -
  90.270 -        public void finish() {
  90.271 -            delegate.finish();
  90.272 -        }
  90.273 -    }
  90.274 -
  90.275 -    private static final class ProgressHandleWrapperBasedProgressHandleAbstraction implements ProgressHandleAbstraction {
  90.276 -        private final ProgressHandleWrapper delegate;
  90.277 -        public ProgressHandleWrapperBasedProgressHandleAbstraction(ProgressHandleWrapper delegate) {
  90.278 -            this.delegate = delegate;
  90.279 -        }
  90.280 -
  90.281 -        public void start(int totalWork) {
  90.282 -            delegate.startNextPart(totalWork);
  90.283 -        }
  90.284 -
  90.285 -        public void progress(int currentWorkDone) {
  90.286 -            delegate.setCurrentPartWorkDone(currentWorkDone);
  90.287 -        }
  90.288 -
  90.289 -        public void progress(String message) {
  90.290 -            delegate.setMessage(message);
  90.291 -        }
  90.292 -
  90.293 -        public void finish() {}
  90.294 -    }
  90.295 -
  90.296 -}
    91.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/Scopes.java	Sun Jan 08 20:10:08 2017 +0100
    91.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.3 @@ -1,141 +0,0 @@
    91.4 -/*
    91.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    91.6 - *
    91.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    91.8 - *
    91.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   91.10 - * Other names may be trademarks of their respective owners.
   91.11 - *
   91.12 - * The contents of this file are subject to the terms of either the GNU
   91.13 - * General Public License Version 2 only ("GPL") or the Common
   91.14 - * Development and Distribution License("CDDL") (collectively, the
   91.15 - * "License"). You may not use this file except in compliance with the
   91.16 - * License. You can obtain a copy of the License at
   91.17 - * http://www.netbeans.org/cddl-gplv2.html
   91.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   91.19 - * specific language governing permissions and limitations under the
   91.20 - * License.  When distributing the software, include this License Header
   91.21 - * Notice in each file and include the License file at
   91.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   91.23 - * particular file as subject to the "Classpath" exception as provided
   91.24 - * by Oracle in the GPL Version 2 section of the License file that
   91.25 - * accompanied this code. If applicable, add the following below the
   91.26 - * License Header, with the fields enclosed by brackets [] replaced by
   91.27 - * your own identifying information:
   91.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   91.29 - *
   91.30 - * If you wish your version of this file to be governed by only the CDDL
   91.31 - * or only the GPL Version 2, indicate your decision by adding
   91.32 - * "[Contributor] elects to include this software in this distribution
   91.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   91.34 - * single choice of license, a recipient has the option to distribute
   91.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   91.36 - * to extend the choice of license to its licensees as provided above.
   91.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   91.38 - * Version 2 license, then the option applies only if the new code is
   91.39 - * made subject to such option by the copyright holder.
   91.40 - *
   91.41 - * Contributor(s):
   91.42 - *
   91.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
   91.44 - */
   91.45 -package org.netbeans.modules.java.hints.spiimpl.batch;
   91.46 -
   91.47 -import java.util.Arrays;
   91.48 -import java.util.Collection;
   91.49 -import java.util.HashSet;
   91.50 -import java.util.Set;
   91.51 -import org.netbeans.api.java.classpath.ClassPath;
   91.52 -import org.netbeans.api.java.classpath.GlobalPathRegistry;
   91.53 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Folder;
   91.54 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.IndexEnquirer;
   91.55 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.MapIndices;
   91.56 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Scope;
   91.57 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   91.58 -import org.openide.filesystems.FileObject;
   91.59 -import org.openide.util.Lookup;
   91.60 -
   91.61 -/**
   91.62 - *
   91.63 - * @author lahvac
   91.64 - */
   91.65 -public class Scopes {
   91.66 -
   91.67 -    public static Scope allOpenedProjectsScope() {
   91.68 -        return new AllOpenedProjectsScope();
   91.69 -    }
   91.70 -
   91.71 -    private static final class AllOpenedProjectsScope extends Scope {
   91.72 -
   91.73 -        @Override
   91.74 -        public String getDisplayName() {
   91.75 -            return "All Opened Projects";
   91.76 -        }
   91.77 -
   91.78 -        @Override
   91.79 -        public Collection<? extends Folder> getTodo() {
   91.80 -            Set<Folder> todo = new HashSet<Folder>();
   91.81 -
   91.82 -            for (ClassPath source : GlobalPathRegistry.getDefault().getPaths(ClassPath.SOURCE)) {
   91.83 -                todo.addAll(Arrays.asList(Folder.convert(source.getRoots())));
   91.84 -            }
   91.85 -
   91.86 -            return todo;
   91.87 -        }
   91.88 -
   91.89 -        @Override
   91.90 -        public MapIndices getIndexMapper(Iterable<? extends HintDescription> hints) {
   91.91 -            return getDefaultIndicesMapper();
   91.92 -        }
   91.93 -    }
   91.94 -
   91.95 -    public static Scope specifiedFoldersScope(Folder... roots) {
   91.96 -        return new SpecificFoldersScope(roots);
   91.97 -    }
   91.98 -    
   91.99 -    private static final class SpecificFoldersScope extends Scope {
  91.100 -
  91.101 -        private final Collection<? extends Folder> roots;
  91.102 -
  91.103 -        public SpecificFoldersScope(Folder... roots) {
  91.104 -            this.roots = Arrays.asList(roots);
  91.105 -        }
  91.106 -
  91.107 -        @Override
  91.108 -        public String getDisplayName() {
  91.109 -            return "Specified Root";
  91.110 -        }
  91.111 -
  91.112 -        @Override
  91.113 -        public Collection<? extends Folder> getTodo() {
  91.114 -            return roots;
  91.115 -        }
  91.116 -
  91.117 -        @Override
  91.118 -        public MapIndices getIndexMapper(Iterable<? extends HintDescription> hints) {
  91.119 -            return getDefaultIndicesMapper();
  91.120 -        }
  91.121 -    }
  91.122 -
  91.123 -    public static MapIndices getDefaultIndicesMapper() {
  91.124 -        return new MapIndices() {
  91.125 -            @Override
  91.126 -            public IndexEnquirer findIndex(FileObject root, ProgressHandleWrapper progress, boolean recursive) {
  91.127 -                IndexEnquirer e = findIndexEnquirer(root, progress, recursive);
  91.128 -
  91.129 -                if (e != null) return e;
  91.130 -                else return new BatchSearch.FileSystemBasedIndexEnquirer(root, recursive);
  91.131 -            }
  91.132 -        };
  91.133 -    }
  91.134 -    
  91.135 -    public static IndexEnquirer findIndexEnquirer(FileObject root, ProgressHandleWrapper progress, boolean recursive) {
  91.136 -        for (MapIndices mi : Lookup.getDefault().lookupAll(MapIndices.class)) {
  91.137 -            IndexEnquirer r = mi.findIndex(root, progress, recursive);
  91.138 -
  91.139 -            if (r != null) return r;
  91.140 -        }
  91.141 -
  91.142 -        return null;
  91.143 -    }
  91.144 -}
    92.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/hints/GlobalProcessingContext.java	Sun Jan 08 20:10:08 2017 +0100
    92.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.3 @@ -1,56 +0,0 @@
    92.4 -/*
    92.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    92.6 - *
    92.7 - * Copyright 2013 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):
   92.42 - *
   92.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
   92.44 - */
   92.45 -package org.netbeans.modules.java.hints.spiimpl.hints;
   92.46 -
   92.47 -import java.util.HashMap;
   92.48 -import java.util.List;
   92.49 -import java.util.Map;
   92.50 -import org.netbeans.api.java.source.TreePathHandle;
   92.51 -import org.netbeans.spi.java.hints.Decision;
   92.52 -
   92.53 -/**
   92.54 - *
   92.55 - * @author lahvac
   92.56 - */
   92.57 -public class GlobalProcessingContext {
   92.58 -    public final Map<TreePathHandle, List<Decision<?, ?>>> decisions = new HashMap<TreePathHandle, List<Decision<?, ?>>>();
   92.59 -}
    93.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/hints/HintsInvoker.java	Sun Jan 08 20:10:08 2017 +0100
    93.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.3 @@ -1,863 +0,0 @@
    93.4 -/*
    93.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    93.6 - *
    93.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
    93.8 - *
    93.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   93.10 - * Other names may be trademarks of their respective owners.
   93.11 - *
   93.12 - * The contents of this file are subject to the terms of either the GNU
   93.13 - * General Public License Version 2 only ("GPL") or the Common
   93.14 - * Development and Distribution License("CDDL") (collectively, the
   93.15 - * "License"). You may not use this file except in compliance with the
   93.16 - * License. You can obtain a copy of the License at
   93.17 - * http://www.netbeans.org/cddl-gplv2.html
   93.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   93.19 - * specific language governing permissions and limitations under the
   93.20 - * License.  When distributing the software, include this License Header
   93.21 - * Notice in each file and include the License file at
   93.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   93.23 - * particular file as subject to the "Classpath" exception as provided
   93.24 - * by Oracle in the GPL Version 2 section of the License file that
   93.25 - * accompanied this code. If applicable, add the following below the
   93.26 - * License Header, with the fields enclosed by brackets [] replaced by
   93.27 - * your own identifying information:
   93.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   93.29 - *
   93.30 - * If you wish your version of this file to be governed by only the CDDL
   93.31 - * or only the GPL Version 2, indicate your decision by adding
   93.32 - * "[Contributor] elects to include this software in this distribution
   93.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   93.34 - * single choice of license, a recipient has the option to distribute
   93.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   93.36 - * to extend the choice of license to its licensees as provided above.
   93.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   93.38 - * Version 2 license, then the option applies only if the new code is
   93.39 - * made subject to such option by the copyright holder.
   93.40 - *
   93.41 - * Contributor(s):
   93.42 - *
   93.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
   93.44 - */
   93.45 -
   93.46 -package org.netbeans.modules.java.hints.spiimpl.hints;
   93.47 -
   93.48 -import com.sun.source.tree.Tree;
   93.49 -import java.util.Stack;
   93.50 -import java.util.concurrent.atomic.AtomicBoolean;
   93.51 -import javax.lang.model.element.AnnotationMirror;
   93.52 -import javax.lang.model.element.AnnotationValue;
   93.53 -import javax.lang.model.element.Element;
   93.54 -import javax.lang.model.element.ExecutableElement;
   93.55 -import javax.lang.model.element.TypeElement;
   93.56 -import javax.swing.text.Document;
   93.57 -import org.netbeans.api.java.source.support.CancellableTreePathScanner;
   93.58 -import org.netbeans.editor.GuardedDocument;
   93.59 -import org.netbeans.editor.MarkBlock;
   93.60 -import org.netbeans.editor.MarkBlockChain;
   93.61 -import org.openide.filesystems.FileObject;
   93.62 -
   93.63 -import com.sun.source.tree.Tree.Kind;
   93.64 -import com.sun.source.util.TreePath;
   93.65 -import com.sun.source.util.Trees;
   93.66 -import java.io.IOException;
   93.67 -import java.util.ArrayList;
   93.68 -import java.util.Arrays;
   93.69 -import java.util.Collection;
   93.70 -import java.util.Collections;
   93.71 -import java.util.Comparator;
   93.72 -import java.util.EnumMap;
   93.73 -import java.util.HashMap;
   93.74 -import java.util.HashSet;
   93.75 -import java.util.Iterator;
   93.76 -import java.util.LinkedList;
   93.77 -import java.util.List;
   93.78 -import java.util.Map;
   93.79 -import java.util.Map.Entry;
   93.80 -import java.util.Set;
   93.81 -import java.util.prefs.Preferences;
   93.82 -import javax.annotation.processing.ProcessingEnvironment;
   93.83 -import javax.lang.model.type.TypeKind;
   93.84 -import javax.lang.model.type.TypeMirror;
   93.85 -import org.netbeans.api.annotations.common.CheckForNull;
   93.86 -import org.netbeans.api.java.source.CompilationInfo;
   93.87 -import org.netbeans.modules.java.hints.spiimpl.Hacks;
   93.88 -import org.netbeans.spi.java.hints.HintContext;
   93.89 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
   93.90 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
   93.91 -import org.netbeans.modules.java.hints.providers.spi.Trigger;
   93.92 -import org.netbeans.modules.java.hints.providers.spi.Trigger.Kinds;
   93.93 -import org.netbeans.modules.java.hints.providers.spi.Trigger.PatternDescription;
   93.94 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
   93.95 -import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
   93.96 -import org.netbeans.modules.java.hints.spiimpl.RulesManager;
   93.97 -import org.netbeans.modules.java.hints.spiimpl.SPIAccessor;
   93.98 -import org.netbeans.modules.java.hints.spiimpl.Utilities;
   93.99 -import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch;
  93.100 -import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch.BulkPattern;
  93.101 -import org.netbeans.modules.java.hints.spiimpl.pm.PatternCompiler;
  93.102 -import org.netbeans.spi.editor.hints.ErrorDescription;
  93.103 -import org.netbeans.spi.editor.hints.Severity;
  93.104 -import org.netbeans.spi.java.hints.Hint;
  93.105 -import org.netbeans.api.java.source.matching.Matcher;
  93.106 -import org.netbeans.api.java.source.matching.Occurrence;
  93.107 -import org.netbeans.api.java.source.matching.Pattern;
  93.108 -import org.netbeans.modules.java.hints.providers.spi.Trigger.DecisionTrigger;
  93.109 -import org.openide.util.Exceptions;
  93.110 -
  93.111 -/**
  93.112 - *
  93.113 - * @author lahvac
  93.114 - */
  93.115 -public class HintsInvoker {
  93.116 -
  93.117 -    private final Map<String, Long> timeLog = new HashMap<String, Long>();
  93.118 -
  93.119 -    private final HintsSettings settings;
  93.120 -    private final int caret;
  93.121 -    private final int from;
  93.122 -    private final int to;
  93.123 -    private final GlobalProcessingContext globalContext;
  93.124 -    private final AtomicBoolean cancel;
  93.125 -
  93.126 -    public HintsInvoker(HintsSettings settings, AtomicBoolean cancel) {
  93.127 -        this(settings, null, cancel);
  93.128 -    }
  93.129 -
  93.130 -    public HintsInvoker(HintsSettings settings, GlobalProcessingContext globalContext, AtomicBoolean cancel) {
  93.131 -        this(settings, -1, -1, -1, globalContext, cancel);
  93.132 -    }
  93.133 -
  93.134 -    public HintsInvoker(HintsSettings settings, int caret, AtomicBoolean cancel) {
  93.135 -        this(settings, caret, -1, -1, null, cancel);
  93.136 -    }
  93.137 -
  93.138 -    public HintsInvoker(HintsSettings settings, int from, int to, AtomicBoolean cancel) {
  93.139 -        this(settings, -1, from, to, null, cancel);
  93.140 -    }
  93.141 -
  93.142 -    private HintsInvoker(HintsSettings settings, int caret, int from, int to, GlobalProcessingContext globalContext, AtomicBoolean cancel) {
  93.143 -        this.settings = settings;
  93.144 -        this.caret = caret;
  93.145 -        this.from = from;
  93.146 -        this.to = to;
  93.147 -        this.globalContext = globalContext;
  93.148 -        this.cancel = cancel;
  93.149 -    }
  93.150 -
  93.151 -    @CheckForNull
  93.152 -    public List<ErrorDescription> computeHints(CompilationInfo info) {
  93.153 -        return computeHints(info, new TreePath(info.getCompilationUnit()));
  93.154 -    }
  93.155 -
  93.156 -    private List<ErrorDescription> computeHints(CompilationInfo info, TreePath startAt) {
  93.157 -        List<HintDescription> descs = new LinkedList<HintDescription>();
  93.158 -        Map<HintMetadata, ? extends Collection<? extends HintDescription>> allHints = RulesManager.getInstance().readHints(info, null, cancel);
  93.159 -
  93.160 -        for (Entry<HintMetadata, ? extends Collection<? extends HintDescription>> e : allHints.entrySet()) {
  93.161 -            HintMetadata m = e.getKey();
  93.162 -
  93.163 -            if (!settings.isEnabled(m)) {
  93.164 -                continue;
  93.165 -            }
  93.166 -
  93.167 -            if (caret != -1) {
  93.168 -                if (m.kind == Hint.Kind.ACTION) {
  93.169 -                    descs.addAll(e.getValue());
  93.170 -                } else {
  93.171 -                    if (settings.getSeverity(m) == Severity.HINT) {
  93.172 -                        descs.addAll(e.getValue());
  93.173 -                    }
  93.174 -                }
  93.175 -            } else {
  93.176 -                if (m.kind == Hint.Kind.INSPECTION) {
  93.177 -                    if (settings.getSeverity(m) != Severity.HINT) {
  93.178 -                        descs.addAll(e.getValue());
  93.179 -                    }
  93.180 -                }
  93.181 -            }
  93.182 -        }
  93.183 -
  93.184 -        List<ErrorDescription> errors = join(computeHints(info, startAt, descs, new LinkedList<MessageImpl>()));
  93.185 -
  93.186 -        dumpTimeSpentInHints();
  93.187 -        
  93.188 -        return errors;
  93.189 -    }
  93.190 -
  93.191 -    @CheckForNull
  93.192 -    public List<ErrorDescription> computeHints(CompilationInfo info,
  93.193 -                                               Iterable<? extends HintDescription> hints) {
  93.194 -        return computeHints(info, hints, new LinkedList<MessageImpl>());
  93.195 -    }
  93.196 -
  93.197 -    @CheckForNull
  93.198 -    public List<ErrorDescription> computeHints(CompilationInfo info,
  93.199 -                                               Iterable<? extends HintDescription> hints,
  93.200 -                                               Collection<? super MessageImpl> problems) {
  93.201 -        return join(computeHints(info, new TreePath(info.getCompilationUnit()), hints, problems));
  93.202 -    }
  93.203 -
  93.204 -    private static final Iterable<? extends Class<? extends Trigger>> TRIGGER_KINDS = Arrays.asList(Kinds.class, PatternDescription.class, DecisionTrigger.class);
  93.205 -    
  93.206 -    @CheckForNull
  93.207 -    public Map<HintDescription, List<ErrorDescription>> computeHints(CompilationInfo info,
  93.208 -                                        TreePath startAt,
  93.209 -                                        Iterable<? extends HintDescription> hints,
  93.210 -                                        Collection<? super MessageImpl> problems) {
  93.211 -        return computeHints(info, startAt, true, hints, problems);
  93.212 -    }
  93.213 -    
  93.214 -    @CheckForNull
  93.215 -    public Map<HintDescription, List<ErrorDescription>> computeHints(CompilationInfo info,
  93.216 -                                        TreePath startAt,
  93.217 -                                        boolean recursive,
  93.218 -                                        Iterable<? extends HintDescription> hints,
  93.219 -                                        Collection<? super MessageImpl> problems) {
  93.220 -        Map<Class, List<HintDescription>> triggerKind2Hints = new HashMap<Class, List<HintDescription>>();
  93.221 -
  93.222 -        for (Class<? extends Trigger> c : TRIGGER_KINDS) {
  93.223 -            triggerKind2Hints.put(c, new ArrayList<HintDescription>());
  93.224 -        }
  93.225 -
  93.226 -        for (HintDescription hd : hints) {
  93.227 -            List<HintDescription> sorted = triggerKind2Hints.get(hd.getTrigger().getClass());
  93.228 -
  93.229 -            sorted.add(hd);
  93.230 -        }
  93.231 -
  93.232 -        if (caret != -1) {
  93.233 -            TreePath tp = info.getTreeUtilities().pathFor(caret);
  93.234 -            return computeSuggestions(info, tp, true, triggerKind2Hints, problems);
  93.235 -        } else {
  93.236 -            if (from != (-1) && to != (-1)) {
  93.237 -                return computeHintsInSpan(info, triggerKind2Hints, problems);
  93.238 -            } else if (!recursive) {
  93.239 -                return computeSuggestions(info, startAt, false, triggerKind2Hints, problems);
  93.240 -            } else {
  93.241 -                return computeHintsImpl(info, startAt, triggerKind2Hints, problems);
  93.242 -            }
  93.243 -        }
  93.244 -    }
  93.245 -
  93.246 -    private Map<HintDescription, List<ErrorDescription>> computeHintsImpl(CompilationInfo info,
  93.247 -                                        TreePath startAt,
  93.248 -                                        Map<Class, List<HintDescription>> triggerKind2Hints,
  93.249 -                                        Collection<? super MessageImpl> problems) {
  93.250 -        Map<HintDescription, List<ErrorDescription>> errors = new HashMap<HintDescription, List<ErrorDescription>>();
  93.251 -        List<HintDescription> kindBasedHints = triggerKind2Hints.get(Kinds.class);
  93.252 -
  93.253 -        timeLog.put("[C] Kind Based Hints", (long) kindBasedHints.size());
  93.254 -
  93.255 -        if (!kindBasedHints.isEmpty()) {
  93.256 -            long kindStart = System.currentTimeMillis();
  93.257 -
  93.258 -            new ScannerImpl(info, cancel, sortByKinds(kindBasedHints), problems).scan(startAt, errors);
  93.259 -
  93.260 -            long kindEnd = System.currentTimeMillis();
  93.261 -
  93.262 -            timeLog.put("Kind Based Hints", kindEnd - kindStart);
  93.263 -        }
  93.264 -
  93.265 -        if (cancel.get()) return null;
  93.266 -        
  93.267 -        List<HintDescription> patternBasedHints = triggerKind2Hints.get(PatternDescription.class);
  93.268 -
  93.269 -        timeLog.put("[C] Pattern Based Hints", (long) patternBasedHints.size());
  93.270 -
  93.271 -        long patternStart = System.currentTimeMillis();
  93.272 -
  93.273 -        Map<PatternDescription, List<HintDescription>> patternHints = sortByPatterns(patternBasedHints);
  93.274 -        Map<String, List<PatternDescription>> patternTests = computePatternTests(patternHints);
  93.275 -
  93.276 -        long bulkPatternStart = System.currentTimeMillis();
  93.277 -
  93.278 -        BulkPattern bulkPattern = BulkSearch.getDefault().create(info, cancel, patternTests.keySet());
  93.279 -
  93.280 -        if (bulkPattern == null || cancel.get()) return null;
  93.281 -        
  93.282 -        long bulkPatternEnd = System.currentTimeMillis();
  93.283 -
  93.284 -        timeLog.put("Bulk Pattern preparation", bulkPatternEnd - bulkPatternStart);
  93.285 -
  93.286 -        long bulkStart = System.currentTimeMillis();
  93.287 -
  93.288 -        Map<String, Collection<TreePath>> occurringPatterns = BulkSearch.getDefault().match(info, cancel, startAt, bulkPattern, timeLog);
  93.289 -        
  93.290 -        if (occurringPatterns == null || cancel.get()) return null;
  93.291 -
  93.292 -        long bulkEnd = System.currentTimeMillis();
  93.293 -
  93.294 -        timeLog.put("Bulk Search", bulkEnd - bulkStart);
  93.295 -        
  93.296 -        Map<HintDescription, List<ErrorDescription>> computedHints = doComputeHints(info, occurringPatterns, patternTests, patternHints, problems);
  93.297 -
  93.298 -        if (computedHints == null || cancel.get()) return null;
  93.299 -        
  93.300 -        mergeAll(errors, computedHints);
  93.301 -
  93.302 -        long patternEnd = System.currentTimeMillis();
  93.303 -
  93.304 -        timeLog.put("Pattern Based Hints", patternEnd - patternStart);
  93.305 -
  93.306 -        return errors;
  93.307 -    }
  93.308 -
  93.309 -    private Map<HintDescription, List<ErrorDescription>> computeHintsInSpan(CompilationInfo info,
  93.310 -                                        Map<Class, List<HintDescription>> triggerKind2Hints,
  93.311 -                                        Collection<? super MessageImpl> problems) {
  93.312 -
  93.313 -        TreePath path = info.getTreeUtilities().pathFor((from + to) / 2);
  93.314 -
  93.315 -        while (path.getLeaf().getKind() != Kind.COMPILATION_UNIT) {
  93.316 -            int start = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), path.getLeaf());
  93.317 -            int end = (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), path.getLeaf());
  93.318 -
  93.319 -            if (start <= from && end >= to) {
  93.320 -                break;
  93.321 -            }
  93.322 -
  93.323 -            path = path.getParentPath();
  93.324 -        }
  93.325 -
  93.326 -        Map<HintDescription, List<ErrorDescription>> errors = new HashMap<HintDescription, List<ErrorDescription>>();
  93.327 -        List<HintDescription> kindBasedHints = triggerKind2Hints.get(Kinds.class);
  93.328 -
  93.329 -        if (!kindBasedHints.isEmpty()) {
  93.330 -            long kindStart = System.currentTimeMillis();
  93.331 -
  93.332 -            new ScannerImpl(info, cancel, sortByKinds(kindBasedHints), problems).scan(path, errors);
  93.333 -
  93.334 -            long kindEnd = System.currentTimeMillis();
  93.335 -
  93.336 -            timeLog.put("Kind Based Hints", kindEnd - kindStart);
  93.337 -        }
  93.338 -
  93.339 -        List<HintDescription> patternBasedHints = triggerKind2Hints.get(PatternDescription.class);
  93.340 -
  93.341 -        if (!patternBasedHints.isEmpty()) {
  93.342 -            long patternStart = System.currentTimeMillis();
  93.343 -
  93.344 -            Map<PatternDescription, List<HintDescription>> patternHints = sortByPatterns(patternBasedHints);
  93.345 -            Map<String, List<PatternDescription>> patternTests = computePatternTests(patternHints);
  93.346 -
  93.347 -            long bulkStart = System.currentTimeMillis();
  93.348 -
  93.349 -            BulkPattern bulkPattern = BulkSearch.getDefault().create(info, cancel, patternTests.keySet());
  93.350 -            
  93.351 -            if (bulkPattern == null || cancel.get()) return null;
  93.352 -            
  93.353 -            Map<String, Collection<TreePath>> occurringPatterns = BulkSearch.getDefault().match(info, cancel, path, bulkPattern, timeLog);
  93.354 -
  93.355 -            long bulkEnd = System.currentTimeMillis();
  93.356 -
  93.357 -            timeLog.put("Bulk Search", bulkEnd - bulkStart);
  93.358 -            
  93.359 -            Map<HintDescription, List<ErrorDescription>> computedHints = doComputeHints(info, occurringPatterns, patternTests, patternHints, problems);
  93.360 -
  93.361 -            if (computedHints == null || cancel.get()) return null;
  93.362 -            
  93.363 -            mergeAll(errors, computedHints);
  93.364 -
  93.365 -            long patternEnd = System.currentTimeMillis();
  93.366 -
  93.367 -            timeLog.put("Pattern Based Hints", patternEnd - patternStart);
  93.368 -        }
  93.369 -
  93.370 -        if (path != null) {
  93.371 -            Map<HintDescription, List<ErrorDescription>> suggestions = computeSuggestions(info, path, true, triggerKind2Hints, problems);
  93.372 -            
  93.373 -            if (suggestions == null || cancel.get()) return null;
  93.374 -            
  93.375 -            mergeAll(errors, suggestions);
  93.376 -        }
  93.377 -
  93.378 -        return errors;
  93.379 -    }
  93.380 -
  93.381 -    private Map<HintDescription, List<ErrorDescription>> computeSuggestions(CompilationInfo info,
  93.382 -                                        TreePath workOn,
  93.383 -                                        boolean up,
  93.384 -                                        Map<Class, List<HintDescription>> triggerKind2Hints,
  93.385 -                                        Collection<? super MessageImpl> problems) {
  93.386 -        Map<HintDescription, List<ErrorDescription>> errors = new HashMap<HintDescription, List<ErrorDescription>>();
  93.387 -        List<HintDescription> kindBasedHints = triggerKind2Hints.get(Kinds.class);
  93.388 -
  93.389 -        if (!kindBasedHints.isEmpty()) {
  93.390 -            long kindStart = System.currentTimeMillis();
  93.391 -            
  93.392 -            Map<Kind, List<HintDescription>> hints = sortByKinds(kindBasedHints);
  93.393 -            TreePath proc = workOn;
  93.394 -
  93.395 -            while (proc != null) {
  93.396 -                new ScannerImpl(info, cancel, hints, problems).scanDoNotGoDeeper(proc, errors);
  93.397 -                if (!up) break;
  93.398 -                proc = proc.getParentPath();
  93.399 -            }
  93.400 -
  93.401 -            long kindEnd = System.currentTimeMillis();
  93.402 -
  93.403 -            timeLog.put("Kind Based Suggestions", kindEnd - kindStart);
  93.404 -        }
  93.405 -        
  93.406 -        if (cancel.get()) return null;
  93.407 -
  93.408 -        List<HintDescription> patternBasedHints = triggerKind2Hints.get(PatternDescription.class);
  93.409 -
  93.410 -        if (!patternBasedHints.isEmpty()) {
  93.411 -            long patternStart = System.currentTimeMillis();
  93.412 -
  93.413 -            Map<PatternDescription, List<HintDescription>> patternHints = sortByPatterns(patternBasedHints);
  93.414 -            Map<String, List<PatternDescription>> patternTests = computePatternTests(patternHints);
  93.415 -
  93.416 -            //pretend that all the patterns occur on all treepaths from the current path
  93.417 -            //up (probably faster than using BulkSearch over whole file)
  93.418 -            //TODO: what about machint trees under the current path?
  93.419 -            Set<TreePath> paths = new HashSet<TreePath>();
  93.420 -
  93.421 -            TreePath tp = workOn;
  93.422 -
  93.423 -            while (tp != null) {
  93.424 -                paths.add(tp);
  93.425 -                if (!up) break;
  93.426 -                tp = tp.getParentPath();
  93.427 -            }
  93.428 -
  93.429 -            Map<String, Collection<TreePath>> occurringPatterns = new HashMap<String, Collection<TreePath>>();
  93.430 -
  93.431 -            for (String p : patternTests.keySet()) {
  93.432 -                occurringPatterns.put(p, paths);
  93.433 -            }
  93.434 -
  93.435 -//            long bulkStart = System.currentTimeMillis();
  93.436 -//
  93.437 -//            BulkPattern bulkPattern = BulkSearch.getDefault().create(info, patternTests.keySet());
  93.438 -//            Map<String, Collection<TreePath>> occurringPatterns = BulkSearch.getDefault().match(info, new TreePath(info.getCompilationUnit()), bulkPattern, timeLog);
  93.439 -//
  93.440 -//            long bulkEnd = System.currentTimeMillis();
  93.441 -//
  93.442 -//            Set<Tree> acceptedLeafs = new HashSet<Tree>();
  93.443 -//
  93.444 -//            TreePath tp = workOn;
  93.445 -//
  93.446 -//            while (tp != null) {
  93.447 -//                acceptedLeafs.add(tp.getLeaf());
  93.448 -//                tp = tp.getParentPath();
  93.449 -//            }
  93.450 -//
  93.451 -//            for (Entry<String, Collection<TreePath>> e : occurringPatterns.entrySet()) {
  93.452 -//                for (Iterator<TreePath> it = e.getValue().iterator(); it.hasNext(); ) {
  93.453 -//                    if (!acceptedLeafs.contains(it.next().getLeaf())) {
  93.454 -//                        it.remove();
  93.455 -//                    }
  93.456 -//                }
  93.457 -//            }
  93.458 -//
  93.459 -//            timeLog.put("Bulk Search", bulkEnd - bulkStart);
  93.460 -
  93.461 -            Map<HintDescription, List<ErrorDescription>> computed = doComputeHints(info, occurringPatterns, patternTests, patternHints, problems);
  93.462 -            
  93.463 -            if (computed == null || cancel.get()) return null;
  93.464 -            
  93.465 -            mergeAll(errors, computed);
  93.466 -
  93.467 -            long patternEnd = System.currentTimeMillis();
  93.468 -
  93.469 -            timeLog.put("Pattern Based Hints", patternEnd - patternStart);
  93.470 -        }
  93.471 -
  93.472 -        return errors;
  93.473 -    }
  93.474 -
  93.475 -    public Map<HintDescription, List<ErrorDescription>> doComputeHints(CompilationInfo info, Map<String, Collection<TreePath>> occurringPatterns, Map<String, List<PatternDescription>> patterns, Map<PatternDescription, List<HintDescription>> patternHints) throws IllegalStateException {
  93.476 -        return doComputeHints(info, occurringPatterns, patterns, patternHints, new LinkedList<MessageImpl>());
  93.477 -    }
  93.478 -
  93.479 -    private static Map<Kind, List<HintDescription>> sortByKinds(List<HintDescription> kindBasedHints) {
  93.480 -        Map<Kind, List<HintDescription>> result = new EnumMap<Kind, List<HintDescription>>(Kind.class);
  93.481 -
  93.482 -        for (HintDescription hd : kindBasedHints) {
  93.483 -            for (Kind k : ((Kinds) hd.getTrigger()).getKinds()) {
  93.484 -                List<HintDescription> hints = result.get(k);
  93.485 -
  93.486 -                if (hints == null) {
  93.487 -                    result.put(k, hints = new ArrayList<HintDescription>());
  93.488 -                }
  93.489 -
  93.490 -                hints.add(hd);
  93.491 -            }
  93.492 -        }
  93.493 -
  93.494 -        return result;
  93.495 -    }
  93.496 -
  93.497 -    private static Map<PatternDescription, List<HintDescription>> sortByPatterns(List<HintDescription> kindBasedHints) {
  93.498 -        Map<PatternDescription, List<HintDescription>> result = new HashMap<PatternDescription, List<HintDescription>>();
  93.499 -
  93.500 -        for (HintDescription hd : kindBasedHints) {
  93.501 -            List<HintDescription> hints = result.get((PatternDescription) hd.getTrigger());
  93.502 -
  93.503 -            if (hints == null) {
  93.504 -                result.put((PatternDescription) hd.getTrigger(), hints = new ArrayList<HintDescription>());
  93.505 -            }
  93.506 -
  93.507 -            hints.add(hd);
  93.508 -        }
  93.509 -
  93.510 -        return result;
  93.511 -    }
  93.512 -
  93.513 -    public static Map<String, List<PatternDescription>> computePatternTests(Map<PatternDescription, List<HintDescription>> patternHints) {
  93.514 -        Map<String, List<PatternDescription>> patternTests = new HashMap<String, List<PatternDescription>>();
  93.515 -        for (Entry<PatternDescription, List<HintDescription>> e : patternHints.entrySet()) {
  93.516 -            String p = e.getKey().getPattern();
  93.517 -            List<PatternDescription> descs = patternTests.get(p);
  93.518 -            if (descs == null) {
  93.519 -                patternTests.put(p, descs = new LinkedList<PatternDescription>());
  93.520 -            }
  93.521 -            descs.add(e.getKey());
  93.522 -        }
  93.523 -        return patternTests;
  93.524 -    }
  93.525 -
  93.526 -    private Map<HintDescription, List<ErrorDescription>> doComputeHints(CompilationInfo info, Map<String, Collection<TreePath>> occurringPatterns, Map<String, List<PatternDescription>> patterns, Map<PatternDescription, List<HintDescription>> patternHints, Collection<? super MessageImpl> problems) throws IllegalStateException {
  93.527 -        Map<HintDescription, List<ErrorDescription>> errors = new HashMap<HintDescription, List<ErrorDescription>>();
  93.528 -
  93.529 -        for (Entry<String, Collection<TreePath>> occ : occurringPatterns.entrySet()) {
  93.530 -            PATTERN_LOOP: for (PatternDescription d : patterns.get(occ.getKey())) {
  93.531 -                if (cancel.get()) return null;
  93.532 -                
  93.533 -                Map<String, TypeMirror> constraints = new HashMap<String, TypeMirror>();
  93.534 -
  93.535 -                for (Entry<String, String> e : d.getConstraints().entrySet()) {
  93.536 -                    TypeMirror designedType = Hacks.parseFQNType(info, e.getValue());
  93.537 -
  93.538 -                    if (designedType == null || designedType.getKind() == TypeKind.ERROR) {
  93.539 -                        //will not bind to anything anyway (#190449), skip pattern:
  93.540 -                        continue PATTERN_LOOP;
  93.541 -                    }
  93.542 -
  93.543 -                    constraints.put(e.getKey(), designedType);
  93.544 -                }
  93.545 -
  93.546 -                Pattern pattern = PatternCompiler.compile(info, occ.getKey(), constraints, d.getImports());
  93.547 -
  93.548 -                for (TreePath candidate : occ.getValue()) {
  93.549 -                    if (cancel.get()) return null;
  93.550 -                
  93.551 -                    Iterator<? extends Occurrence> verified = Matcher.create(info).setCancel(cancel).setSearchRoot(candidate).setTreeTopSearch().match(pattern).iterator();
  93.552 -
  93.553 -                    if (!verified.hasNext()) {
  93.554 -                        continue;
  93.555 -                    }
  93.556 -
  93.557 -                    Set<String> suppressedWarnings = new HashSet<String>(Utilities.findSuppressedWarnings(info, candidate));
  93.558 -                    Occurrence verifiedVariables = verified.next();
  93.559 -
  93.560 -                    for (HintDescription hd : patternHints.get(d)) {
  93.561 -                        HintMetadata hm = hd.getMetadata();
  93.562 -                        HintContext c = SPIAccessor.getINSTANCE().createHintContext(info, settings, hm, globalContext != null ? globalContext : new GlobalProcessingContext(), candidate, verifiedVariables.getVariables(), verifiedVariables.getMultiVariables(), verifiedVariables.getVariables2Names(), constraints, problems, globalContext != null, cancel, caret);
  93.563 -
  93.564 -                        if (!Collections.disjoint(suppressedWarnings, hm.suppressWarnings))
  93.565 -                            continue;
  93.566 -
  93.567 -                        Collection<? extends ErrorDescription> workerErrors = runHint(hd, c);
  93.568 -
  93.569 -                        if (workerErrors != null) {
  93.570 -                            merge(errors, hd, workerErrors);
  93.571 -                        }
  93.572 -                    }
  93.573 -                }
  93.574 -            }
  93.575 -        }
  93.576 -
  93.577 -        return errors;
  93.578 -    }
  93.579 -
  93.580 -//    public static void computeHints(URI file, ProcessingEnvironment env, CompilationUnitTree cut, RulesManager m) {
  93.581 -//        Map<Kind, HintDescription> hints = m.getKindBasedHints();
  93.582 -//
  93.583 -//        if (hints.isEmpty()) {
  93.584 -//            return ;
  93.585 -//        }
  93.586 -//
  93.587 -//        List<ErrorDescription> errors = new  LinkedList<ErrorDescription>();
  93.588 -//
  93.589 -//        File af = new File(file.getPath());
  93.590 -//        FileObject f = FileUtil.toFileObject(af);
  93.591 -//
  93.592 -//        new ScannerImpl(f, env, hints).scan(cut, errors);
  93.593 -//
  93.594 -//        for (ErrorDescription ed : errors) {
  93.595 -//            Diagnostic.Kind k;
  93.596 -//
  93.597 -//            switch (ed.getSeverity()) {
  93.598 -//                case ERROR:
  93.599 -//                    k = Diagnostic.Kind.ERROR;
  93.600 -//                    break;
  93.601 -//                default:
  93.602 -//                    k = Diagnostic.Kind.WARNING;
  93.603 -//                    break;
  93.604 -//            }
  93.605 -//
  93.606 -//            env.getMessager().printMessage(k, ed.getDescription());
  93.607 -//        }
  93.608 -//    }
  93.609 -
  93.610 -    public Map<String, Long> getTimeLog() {
  93.611 -        return timeLog;
  93.612 -    }
  93.613 -
  93.614 -    private final class ScannerImpl extends CancellableTreePathScanner<Void, Map<HintDescription, List<ErrorDescription>>> {
  93.615 -
  93.616 -        private final Stack<Set<String>> suppresWarnings = new Stack<Set<String>>();
  93.617 -        private final CompilationInfo info;
  93.618 -        private final FileObject file;
  93.619 -        private final ProcessingEnvironment env;
  93.620 -        private final Map<Kind, List<HintDescription>> hints;
  93.621 -        private final Collection<? super MessageImpl> problems;
  93.622 -        
  93.623 -        public ScannerImpl(CompilationInfo info, AtomicBoolean cancel, Map<Kind, List<HintDescription>> hints, Collection<? super MessageImpl> problems) {
  93.624 -            super(cancel);
  93.625 -            this.info = info;
  93.626 -            this.file = null;
  93.627 -            this.env  = null;
  93.628 -            this.hints = hints;
  93.629 -            this.problems = problems;
  93.630 -        }
  93.631 -
  93.632 -        public ScannerImpl(FileObject file, ProcessingEnvironment env, Map<Kind, List<HintDescription>> hints, Collection<? super MessageImpl> problems) {
  93.633 -            super(new AtomicBoolean());
  93.634 -            this.info = null;
  93.635 -            this.file = file;
  93.636 -            this.env = env;
  93.637 -            this.hints = hints;
  93.638 -            this.problems = problems;
  93.639 -        }
  93.640 -
  93.641 -        private void runAndAdd(TreePath path, List<HintDescription> rules, Map<HintDescription, List<ErrorDescription>> d) {
  93.642 -            if (rules != null && !isInGuarded(info, path)) {
  93.643 -                OUTER: for (HintDescription hd : rules) {
  93.644 -                    if (isCanceled()) {
  93.645 -                        return ;
  93.646 -                    }
  93.647 -
  93.648 -                    HintMetadata hm = hd.getMetadata();
  93.649 -
  93.650 -                    for (String wname : hm.suppressWarnings) {
  93.651 -                        if( !suppresWarnings.empty() && suppresWarnings.peek().contains(wname)) {
  93.652 -                            continue OUTER;
  93.653 -                        }
  93.654 -                    }
  93.655 -
  93.656 -                    HintContext c = SPIAccessor.getINSTANCE().createHintContext(info, settings, hm, globalContext != null ? globalContext : new GlobalProcessingContext(), path, Collections.<String, TreePath>emptyMap(), Collections.<String, Collection<? extends TreePath>>emptyMap(), Collections.<String, String>emptyMap(), Collections.<String, TypeMirror>emptyMap(), new ArrayList<MessageImpl>(), globalContext != null, cancel, caret);
  93.657 -                    Collection<? extends ErrorDescription> errors = runHint(hd, c);
  93.658 -
  93.659 -                    if (errors != null) {
  93.660 -                        merge(d, hd, errors);
  93.661 -                    }
  93.662 -                }
  93.663 -            }
  93.664 -        }
  93.665 -
  93.666 -        @Override
  93.667 -        public Void scan(Tree tree, Map<HintDescription, List<ErrorDescription>> p) {
  93.668 -            if (tree == null)
  93.669 -                return null;
  93.670 -
  93.671 -            TreePath tp = new TreePath(getCurrentPath(), tree);
  93.672 -            Kind k = tree.getKind();
  93.673 -
  93.674 -            boolean b = pushSuppressWarrnings(tp);
  93.675 -            try {
  93.676 -                runAndAdd(tp, hints.get(k), p);
  93.677 -
  93.678 -                if (isCanceled()) {
  93.679 -                    return null;
  93.680 -                }
  93.681 -
  93.682 -                return super.scan(tree, p);
  93.683 -            } finally {
  93.684 -                if (b) {
  93.685 -                    suppresWarnings.pop();
  93.686 -                }
  93.687 -            }
  93.688 -        }
  93.689 -
  93.690 -        @Override
  93.691 -        public Void scan(TreePath path, Map<HintDescription, List<ErrorDescription>> p) {
  93.692 -            Kind k = path.getLeaf().getKind();
  93.693 -            boolean b = pushSuppressWarrnings(path);
  93.694 -            try {
  93.695 -                runAndAdd(path, hints.get(k), p);
  93.696 -
  93.697 -                if (isCanceled()) {
  93.698 -                    return null;
  93.699 -                }
  93.700 -
  93.701 -                return super.scan(path, p);
  93.702 -            } finally {
  93.703 -                if (b) {
  93.704 -                    suppresWarnings.pop();
  93.705 -                }
  93.706 -            }
  93.707 -        }
  93.708 -
  93.709 -        public void scanDoNotGoDeeper(TreePath path, Map<HintDescription, List<ErrorDescription>> p) {
  93.710 -            Kind k = path.getLeaf().getKind();
  93.711 -            runAndAdd(path, hints.get(k), p);
  93.712 -        }
  93.713 -
  93.714 -        private boolean pushSuppressWarrnings(TreePath path) {
  93.715 -            switch(path.getLeaf().getKind()) {
  93.716 -                case ANNOTATION_TYPE:
  93.717 -                case CLASS:
  93.718 -                case ENUM:
  93.719 -                case INTERFACE:
  93.720 -                case METHOD:
  93.721 -                case VARIABLE:
  93.722 -                    Set<String> current = suppresWarnings.size() == 0 ? null : suppresWarnings.peek();
  93.723 -                    Set<String> nju = current == null ? new HashSet<String>() : new HashSet<String>(current);
  93.724 -
  93.725 -                    Element e = getTrees().getElement(path);
  93.726 -
  93.727 -                    if ( e != null) {
  93.728 -                        for (AnnotationMirror am : e.getAnnotationMirrors()) {
  93.729 -                            String name = ((TypeElement)am.getAnnotationType().asElement()).getQualifiedName().toString();
  93.730 -                            if ( "java.lang.SuppressWarnings".equals(name) ) { // NOI18N
  93.731 -                                Map<? extends ExecutableElement, ? extends AnnotationValue> elementValues = am.getElementValues();
  93.732 -                                for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : elementValues.entrySet()) {
  93.733 -                                    if( "value".equals(entry.getKey().getSimpleName().toString()) ) { // NOI18N
  93.734 -                                        Object value = entry.getValue().getValue();
  93.735 -                                        if ( value instanceof List) {
  93.736 -                                            for (Object av : (List)value) {
  93.737 -                                                if( av instanceof AnnotationValue ) {
  93.738 -                                                    Object wname = ((AnnotationValue)av).getValue();
  93.739 -                                                    if ( wname instanceof String ) {
  93.740 -                                                        nju.add((String)wname);
  93.741 -                                                    }
  93.742 -                                                }
  93.743 -                                            }
  93.744 -                                        }
  93.745 -                                    }
  93.746 -                                }
  93.747 -                            }
  93.748 -                        }
  93.749 -                    }
  93.750 -
  93.751 -                    suppresWarnings.push(nju);
  93.752 -                    return true;
  93.753 -            }
  93.754 -            return false;
  93.755 -        }
  93.756 -
  93.757 -        private Trees getTrees() {
  93.758 -            return info != null ? info.getTrees() : Trees.instance(env);
  93.759 -        }
  93.760 -    }
  93.761 -
  93.762 -    static boolean isInGuarded(CompilationInfo info, TreePath tree) {
  93.763 -        if (info == null) {
  93.764 -            return false;
  93.765 -        }
  93.766 -
  93.767 -        try {
  93.768 -            Document doc = info.getDocument();
  93.769 -
  93.770 -            if (doc instanceof GuardedDocument) {
  93.771 -                int start = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), tree.getLeaf());
  93.772 -                int end = (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), tree.getLeaf());
  93.773 -                GuardedDocument gdoc = (GuardedDocument) doc;
  93.774 -                MarkBlockChain guardedBlockChain = gdoc.getGuardedBlockChain();
  93.775 -                if (guardedBlockChain.compareBlock(start, end) == MarkBlock.INNER) {
  93.776 -                    return true;
  93.777 -                }
  93.778 -            }
  93.779 -        } catch (IOException ex) {
  93.780 -            Exceptions.printStackTrace(ex);
  93.781 -        }
  93.782 -
  93.783 -        return false;
  93.784 -    }
  93.785 -
  93.786 -    private Collection<? extends ErrorDescription> runHint(HintDescription hd, HintContext ctx) {
  93.787 -        long start = System.nanoTime();
  93.788 -
  93.789 -        try {
  93.790 -            return hd.getWorker().createErrors(ctx);
  93.791 -        } finally {
  93.792 -            long end = System.nanoTime();
  93.793 -            reportSpentTime(hd.getMetadata().id, end - start);
  93.794 -        }
  93.795 -    }
  93.796 -
  93.797 -    public static <K, V> Map<K, List<V>> merge(Map<K, List<V>> to, K key, Collection<? extends V> value) {
  93.798 -        List<V> toColl = to.get(key);
  93.799 -
  93.800 -        if (toColl == null) {
  93.801 -            to.put(key, toColl = new LinkedList<V>());
  93.802 -        }
  93.803 -
  93.804 -        toColl.addAll(value);
  93.805 -
  93.806 -        return to;
  93.807 -    }
  93.808 -
  93.809 -    public static <K, V> Map<K, List<V>> mergeAll(Map<K, List<V>> to, Map<? extends K, ? extends Collection<? extends V>> what) {
  93.810 -        for (Entry<? extends K, ? extends Collection<? extends V>> e : what.entrySet()) {
  93.811 -            List<V> toColl = to.get(e.getKey());
  93.812 -
  93.813 -            if (toColl == null) {
  93.814 -                to.put(e.getKey(), toColl = new LinkedList<V>());
  93.815 -            }
  93.816 -
  93.817 -            toColl.addAll(e.getValue());
  93.818 -        }
  93.819 -
  93.820 -        return to;
  93.821 -    }
  93.822 -
  93.823 -    public static List<ErrorDescription> join(Map<?, ? extends List<? extends ErrorDescription>> errors) {
  93.824 -        if (errors == null) return null;
  93.825 -        
  93.826 -        List<ErrorDescription> result = new LinkedList<ErrorDescription>();
  93.827 -
  93.828 -        for (Entry<?, ? extends Collection<? extends ErrorDescription>> e : errors.entrySet()) {
  93.829 -            result.addAll(e.getValue());
  93.830 -        }
  93.831 -
  93.832 -        return result;
  93.833 -    }
  93.834 -
  93.835 -    private static final boolean logTimeSpentInHints = Boolean.getBoolean("java.HintsInvoker.time.in.hints");
  93.836 -    private final Map<String, Long> hint2SpentTime = new HashMap<String, Long>();
  93.837 -
  93.838 -    private void reportSpentTime(String id, long nanoTime) {
  93.839 -        if (!logTimeSpentInHints) return;
  93.840 -        
  93.841 -        Long prev = hint2SpentTime.get(id);
  93.842 -
  93.843 -        if (prev == null) {
  93.844 -            prev = (long) 0;
  93.845 -        }
  93.846 -
  93.847 -        hint2SpentTime.put(id, prev + nanoTime);
  93.848 -    }
  93.849 -
  93.850 -    private void dumpTimeSpentInHints() {
  93.851 -        if (!logTimeSpentInHints) return;
  93.852 -
  93.853 -        List<Entry<String, Long>> l = new ArrayList<Entry<String, Long>>(hint2SpentTime.entrySet());
  93.854 -
  93.855 -        Collections.sort(l, new Comparator<Entry<String, Long>>() {
  93.856 -            @Override
  93.857 -            public int compare(Entry<String, Long> o1, Entry<String, Long> o2) {
  93.858 -                return (int) Math.signum(o1.getValue() - o2.getValue());
  93.859 -            }
  93.860 -        });
  93.861 -
  93.862 -        for (Entry<String, Long> e : l) {
  93.863 -            System.err.println(e.getKey() + "=" + String.format("%3.2f", e.getValue() / 1000000.0));
  93.864 -        }
  93.865 -    }
  93.866 -}
    94.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/hints/HintsTask.java	Sun Jan 08 20:10:08 2017 +0100
    94.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.3 @@ -1,254 +0,0 @@
    94.4 -/*
    94.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    94.6 - *
    94.7 - * Copyright 2008-2010 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):
   94.42 - *
   94.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
   94.44 - */
   94.45 -
   94.46 -package org.netbeans.modules.java.hints.spiimpl.hints;
   94.47 -
   94.48 -import java.util.List;
   94.49 -import java.util.Map.Entry;
   94.50 -import java.util.concurrent.atomic.AtomicBoolean;
   94.51 -import java.util.logging.Level;
   94.52 -import java.util.logging.Logger;
   94.53 -import javax.swing.event.ChangeEvent;
   94.54 -import javax.swing.event.ChangeListener;
   94.55 -import javax.swing.text.BadLocationException;
   94.56 -import javax.swing.text.Document;
   94.57 -import org.netbeans.api.editor.mimelookup.MimeLookup;
   94.58 -import org.netbeans.api.editor.mimelookup.MimeRegistration;
   94.59 -import org.netbeans.api.java.source.CancellableTask;
   94.60 -import org.netbeans.api.java.source.CompilationInfo;
   94.61 -import org.netbeans.api.java.source.JavaSource.Phase;
   94.62 -import org.netbeans.api.java.source.JavaSource.Priority;
   94.63 -import org.netbeans.api.java.source.JavaSourceTaskFactory;
   94.64 -import org.netbeans.api.java.source.support.CaretAwareJavaSourceTaskFactory;
   94.65 -import org.netbeans.api.java.source.support.EditorAwareJavaSourceTaskFactory;
   94.66 -import org.netbeans.editor.BaseDocument;
   94.67 -import org.netbeans.editor.Utilities;
   94.68 -import org.netbeans.lib.editor.util.swing.DocumentUtilities;
   94.69 -import org.netbeans.modules.java.hints.providers.spi.PositionRefresherHelper;
   94.70 -import org.netbeans.modules.java.hints.providers.spi.PositionRefresherHelper.DocumentVersion;
   94.71 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
   94.72 -import org.netbeans.modules.parsing.spi.TaskIndexingMode;
   94.73 -import org.netbeans.spi.editor.hints.Context;
   94.74 -import org.netbeans.spi.editor.hints.ErrorDescription;
   94.75 -import org.netbeans.spi.editor.hints.HintsController;
   94.76 -import org.netbeans.spi.editor.hints.Severity;
   94.77 -import org.netbeans.spi.editor.hints.settings.FileHintPreferences;
   94.78 -import org.openide.filesystems.FileObject;
   94.79 -import org.openide.util.WeakListeners;
   94.80 -import org.openide.util.lookup.ServiceProvider;
   94.81 -
   94.82 -/**
   94.83 - *
   94.84 - * @author lahvac
   94.85 - */
   94.86 -public class HintsTask implements CancellableTask<CompilationInfo> {
   94.87 -
   94.88 -    public static final String KEY_HINTS = HintsInvoker.class.getName() + "-hints";
   94.89 -    public static final String KEY_SUGGESTIONS = HintsInvoker.class.getName() + "-suggestions";
   94.90 -
   94.91 -    private static final Logger TIMER = Logger.getLogger("TIMER");
   94.92 -    private static final Logger TIMER_EDITOR = Logger.getLogger("TIMER.editor");
   94.93 -    private static final Logger TIMER_CARET = Logger.getLogger("TIMER.caret");
   94.94 -
   94.95 -    private final AtomicBoolean cancel = new AtomicBoolean();
   94.96 -
   94.97 -    private final boolean caretAware;
   94.98 -
   94.99 -    public HintsTask(boolean caretAware) {
  94.100 -        this.caretAware = caretAware;
  94.101 -    }
  94.102 -    
  94.103 -    public void run(CompilationInfo info) {
  94.104 -        cancel.set(false);
  94.105 -
  94.106 -        if (org.netbeans.modules.java.hints.spiimpl.Utilities.disableErrors(info.getFileObject()).contains(Severity.VERIFIER)) {
  94.107 -            return;
  94.108 -        }
  94.109 -
  94.110 -        Document doc = info.getSnapshot().getSource().getDocument(false);
  94.111 -        long version = doc != null ? DocumentUtilities.getDocumentVersion(doc) : 0;
  94.112 -        long startTime = System.currentTimeMillis();
  94.113 -
  94.114 -        int caret = CaretAwareJavaSourceTaskFactory.getLastPosition(info.getFileObject());
  94.115 -        HintsSettings settings = HintsSettings.getSettingsFor(info.getFileObject());
  94.116 -        HintsInvoker inv = caretAware ? new HintsInvoker(settings, caret, cancel) : new HintsInvoker(settings, cancel);
  94.117 -        List<ErrorDescription> result = inv.computeHints(info);
  94.118 -
  94.119 -        if (result == null || cancel.get()) {
  94.120 -            return;
  94.121 -        }
  94.122 -
  94.123 -        HintsController.setErrors(info.getFileObject(), caretAware ? KEY_SUGGESTIONS : KEY_HINTS, result);
  94.124 -
  94.125 -        if (caretAware) {
  94.126 -            SuggestionsPositionRefresherHelper.setVersion(doc, caret);
  94.127 -        } else {
  94.128 -            HintPositionRefresherHelper.setVersion(doc);
  94.129 -        }
  94.130 -
  94.131 -        long endTime = System.currentTimeMillis();
  94.132 -        
  94.133 -        TIMER.log(Level.FINE, "Jackpot 3.0 Hints Task" + (caretAware ? " - Caret Aware" : ""), new Object[] {info.getFileObject(), endTime - startTime});
  94.134 -
  94.135 -        Logger l = caretAware ? TIMER_CARET : TIMER_EDITOR;
  94.136 -
  94.137 -        for (Entry<String, Long> e : inv.getTimeLog().entrySet()) {
  94.138 -            l.log(Level.FINE, e.getKey(), new Object[] {info.getFileObject(), e.getValue()});
  94.139 -        }
  94.140 -    }
  94.141 -
  94.142 -    public void cancel() {
  94.143 -        cancel.set(true);
  94.144 -    }
  94.145 -
  94.146 -
  94.147 -    @ServiceProvider(service=JavaSourceTaskFactory.class)
  94.148 -    public static final class FactoryImpl extends EditorAwareJavaSourceTaskFactory implements ChangeListener {
  94.149 -
  94.150 -        public FactoryImpl() {
  94.151 -            super(Phase.RESOLVED, Priority.LOW, TaskIndexingMode.ALLOWED_DURING_SCAN);
  94.152 -            FileHintPreferences.addChangeListener(WeakListeners.change(this, HintsSettings.class));
  94.153 -        }
  94.154 -
  94.155 -        @Override
  94.156 -        protected CancellableTask<CompilationInfo> createTask(FileObject file) {
  94.157 -            return new HintsTask(false);
  94.158 -        }
  94.159 -
  94.160 -	@Override
  94.161 -	public void stateChanged(ChangeEvent e) {
  94.162 -	    for (FileObject file : getFileObjects()) {
  94.163 -		reschedule(file);
  94.164 -	    }
  94.165 -	}
  94.166 -        
  94.167 -    }
  94.168 -
  94.169 -    @ServiceProvider(service=JavaSourceTaskFactory.class)
  94.170 -    public static final class CaretFactoryImpl extends CaretAwareJavaSourceTaskFactory implements ChangeListener {
  94.171 -
  94.172 -        public CaretFactoryImpl() {
  94.173 -            super(Phase.RESOLVED, Priority.LOW);
  94.174 -            FileHintPreferences.addChangeListener(WeakListeners.change(this, HintsSettings.class));
  94.175 -        }
  94.176 -
  94.177 -        @Override
  94.178 -        protected CancellableTask<CompilationInfo> createTask(FileObject file) {
  94.179 -            return new HintsTask(true);
  94.180 -        }
  94.181 -
  94.182 -	@Override
  94.183 -	public void stateChanged(ChangeEvent e) {
  94.184 -	    for (FileObject file : getFileObjects()) {
  94.185 -		reschedule(file);
  94.186 -	    }
  94.187 -	}
  94.188 -
  94.189 -    }
  94.190 -
  94.191 -    @MimeRegistration(mimeType="text/x-java", service=PositionRefresherHelper.class)
  94.192 -    public static final class HintPositionRefresherHelper extends PositionRefresherHelper<DocumentVersion> {
  94.193 -
  94.194 -        public HintPositionRefresherHelper() {
  94.195 -            super(KEY_HINTS);
  94.196 -        }
  94.197 -
  94.198 -        @Override
  94.199 -        protected boolean isUpToDate(Context context, Document doc, DocumentVersion oldVersion) {
  94.200 -            return true;
  94.201 -        }
  94.202 -
  94.203 -        @Override
  94.204 -        public List<ErrorDescription> getErrorDescriptionsAt(CompilationInfo info, Context context, Document doc) throws BadLocationException {
  94.205 -            int rowStart = Utilities.getRowStart((BaseDocument) doc, context.getPosition());
  94.206 -            int rowEnd = Utilities.getRowEnd((BaseDocument) doc, context.getPosition());
  94.207 -
  94.208 -            return new HintsInvoker(HintsSettings.getSettingsFor(info.getFileObject()), rowStart, rowEnd, context.getCancel()).computeHints(info);
  94.209 -        }
  94.210 -
  94.211 -        private static void setVersion(Document doc) {
  94.212 -            for (PositionRefresherHelper h : MimeLookup.getLookup("text/x-java").lookupAll(PositionRefresherHelper.class)) {
  94.213 -                if (h instanceof HintPositionRefresherHelper) {
  94.214 -                    ((HintPositionRefresherHelper) h).setVersion(doc, new DocumentVersion(doc));
  94.215 -                }
  94.216 -            }
  94.217 -        }
  94.218 -
  94.219 -    }
  94.220 -
  94.221 -    @MimeRegistration(mimeType="text/x-java", service=PositionRefresherHelper.class)
  94.222 -    public static final class SuggestionsPositionRefresherHelper extends PositionRefresherHelper<SuggestionsDocumentVersion> {
  94.223 -
  94.224 -        public SuggestionsPositionRefresherHelper() {
  94.225 -            super(KEY_SUGGESTIONS);
  94.226 -        }
  94.227 -
  94.228 -        @Override
  94.229 -        protected boolean isUpToDate(Context context, Document doc, SuggestionsDocumentVersion oldVersion) {
  94.230 -            return oldVersion.suggestionsCaret == context.getPosition();
  94.231 -        }
  94.232 -
  94.233 -        @Override
  94.234 -        public List<ErrorDescription> getErrorDescriptionsAt(CompilationInfo info, Context context, Document doc) throws BadLocationException {
  94.235 -            return new HintsInvoker(HintsSettings.getSettingsFor(info.getFileObject()), context.getPosition(), context.getCancel()).computeHints(info);
  94.236 -        }
  94.237 -
  94.238 -        private static void setVersion(Document doc, int caret) {
  94.239 -            for (PositionRefresherHelper h : MimeLookup.getLookup("text/x-java").lookupAll(PositionRefresherHelper.class)) {
  94.240 -                if (h instanceof SuggestionsPositionRefresherHelper) {
  94.241 -                    ((SuggestionsPositionRefresherHelper) h).setVersion(doc, new SuggestionsDocumentVersion(doc, caret));
  94.242 -                }
  94.243 -            }
  94.244 -        }
  94.245 -    }
  94.246 -
  94.247 -    private static class SuggestionsDocumentVersion extends DocumentVersion {
  94.248 -
  94.249 -        private final int suggestionsCaret;
  94.250 -        
  94.251 -        public SuggestionsDocumentVersion(Document doc, int suggestionsCaret) {
  94.252 -            super(doc);
  94.253 -            this.suggestionsCaret = suggestionsCaret;
  94.254 -        }
  94.255 -    }
  94.256 -
  94.257 -}
    95.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/ipi/upgrade/ProjectDependencyUpgrader.java	Sun Jan 08 20:10:08 2017 +0100
    95.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.3 @@ -1,64 +0,0 @@
    95.4 -/*
    95.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    95.6 - *
    95.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    95.8 - *
    95.9 - * The contents of this file are subject to the terms of either the GNU
   95.10 - * General Public License Version 2 only ("GPL") or the Common
   95.11 - * Development and Distribution License("CDDL") (collectively, the
   95.12 - * "License"). You may not use this file except in compliance with the
   95.13 - * License. You can obtain a copy of the License at
   95.14 - * http://www.netbeans.org/cddl-gplv2.html
   95.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   95.16 - * specific language governing permissions and limitations under the
   95.17 - * License.  When distributing the software, include this License Header
   95.18 - * Notice in each file and include the License file at
   95.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   95.20 - * particular file as subject to the "Classpath" exception as provided
   95.21 - * by Sun in the GPL Version 2 section of the License file that
   95.22 - * accompanied this code. If applicable, add the following below the
   95.23 - * License Header, with the fields enclosed by brackets [] replaced by
   95.24 - * your own identifying information:
   95.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   95.26 - *
   95.27 - * If you wish your version of this file to be governed by only the CDDL
   95.28 - * or only the GPL Version 2, indicate your decision by adding
   95.29 - * "[Contributor] elects to include this software in this distribution
   95.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   95.31 - * single choice of license, a recipient has the option to distribute
   95.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   95.33 - * to extend the choice of license to its licensees as provided above.
   95.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   95.35 - * Version 2 license, then the option applies only if the new code is
   95.36 - * made subject to such option by the copyright holder.
   95.37 - *
   95.38 - * Contributor(s):
   95.39 - *
   95.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
   95.41 - */
   95.42 -package org.netbeans.modules.java.hints.spiimpl.ipi.upgrade;
   95.43 -
   95.44 -import org.netbeans.api.project.Project;
   95.45 -import org.openide.DialogDisplayer;
   95.46 -import org.openide.NotifyDescriptor;
   95.47 -import org.openide.filesystems.FileObject;
   95.48 -import org.openide.modules.SpecificationVersion;
   95.49 -
   95.50 -/**
   95.51 - *
   95.52 - * @author lahvac
   95.53 - */
   95.54 -public abstract class ProjectDependencyUpgrader {
   95.55 -
   95.56 -    public abstract boolean ensureDependency(Project p, FileObject dep, SpecificationVersion spec, boolean canShowUI);
   95.57 -    public abstract boolean ensureDependency(Project p, String specification, boolean b);
   95.58 -
   95.59 -    protected final boolean showDependencyUpgradeDialog(Project p, String dep, SpecificationVersion currentDependency, SpecificationVersion spec, boolean newDepenency, boolean canShowUI) {
   95.60 -        if (!canShowUI) return true;
   95.61 -        
   95.62 -        NotifyDescriptor nd = new NotifyDescriptor.Confirmation("New version: " + spec, "Update spec version.", NotifyDescriptor.YES_NO_OPTION);
   95.63 -
   95.64 -        return DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION;
   95.65 -    }
   95.66 -
   95.67 -}
    96.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/options/HintsSettings.java	Sun Jan 08 20:10:08 2017 +0100
    96.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.3 @@ -1,149 +0,0 @@
    96.4 -/*
    96.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    96.6 - *
    96.7 - * Copyright 1997-2010 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 - * Contributor(s):
   96.31 - *
   96.32 - * The Original Software is NetBeans. The Initial Developer of the Original
   96.33 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun
   96.34 - * Microsystems, Inc. All Rights Reserved.
   96.35 - *
   96.36 - * If you wish your version of this file to be governed by only the CDDL
   96.37 - * or only the GPL Version 2, indicate your decision by adding
   96.38 - * "[Contributor] elects to include this software in this distribution
   96.39 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   96.40 - * single choice of license, a recipient has the option to distribute
   96.41 - * your version of this file under either the CDDL, the GPL Version 2 or
   96.42 - * to extend the choice of license to its licensees as provided above.
   96.43 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   96.44 - * Version 2 license, then the option applies only if the new code is
   96.45 - * made subject to such option by the copyright holder.
   96.46 - */
   96.47 -package org.netbeans.modules.java.hints.spiimpl.options;
   96.48 -
   96.49 -import java.util.prefs.Preferences;
   96.50 -import org.netbeans.api.editor.mimelookup.MimeRegistration;
   96.51 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
   96.52 -import org.netbeans.spi.editor.hints.Severity;
   96.53 -import org.netbeans.spi.editor.hints.settings.FileHintPreferences;
   96.54 -import org.netbeans.spi.editor.hints.settings.FileHintPreferences.GlobalHintPreferencesProvider;
   96.55 -import org.openide.filesystems.FileObject;
   96.56 -import org.openide.util.NbPreferences;
   96.57 -
   96.58 -/**
   96.59 - *
   96.60 - * @author Petr Hrebejk
   96.61 - * @author Jan Lahoda
   96.62 - */
   96.63 -public abstract class HintsSettings {
   96.64 -
   96.65 -    private static final String ENABLED_KEY = "enabled";         // NOI18N
   96.66 -    private static final String OLD_SEVERITY_KEY = "severity";       // NOI18N
   96.67 -    private static final String NEW_SEVERITY_KEY = "hintSeverity";       // NOI18N
   96.68 -//    protected static final String IN_TASK_LIST_KEY = "inTaskList"; // NOI18N
   96.69 -
   96.70 -    public abstract boolean isEnabled(HintMetadata hint);
   96.71 -    public abstract void setEnabled(HintMetadata hint, boolean value);
   96.72 -    public abstract Preferences getHintPreferences(HintMetadata hint);
   96.73 -    public abstract Severity getSeverity(HintMetadata hint);
   96.74 -    public abstract void setSeverity(HintMetadata hint, Severity severity);
   96.75 -//    public abstract Iterable<? extends HintDescription> getEnabledHints();
   96.76 -    
   96.77 -    private static final class PreferencesBasedHintsSettings extends HintsSettings {
   96.78 -
   96.79 -        private final Preferences preferences;
   96.80 -        private final boolean useDefaultEnabled;
   96.81 -        private final Severity overrideSeverity;
   96.82 -
   96.83 -        public PreferencesBasedHintsSettings(Preferences preferences, boolean useDefaultEnabled, Severity overrideSeverity) {
   96.84 -            this.preferences = preferences;
   96.85 -            this.useDefaultEnabled = useDefaultEnabled;
   96.86 -            this.overrideSeverity = overrideSeverity;
   96.87 -        }
   96.88 -
   96.89 -        @Override
   96.90 -        public boolean isEnabled(HintMetadata hint) {
   96.91 -            return getHintPreferences(hint).getBoolean(ENABLED_KEY, useDefaultEnabled && hint.enabled);
   96.92 -        }
   96.93 -
   96.94 -        @Override
   96.95 -        public void setEnabled(HintMetadata hint, boolean value) {
   96.96 -            getHintPreferences(hint).putBoolean(ENABLED_KEY, value);
   96.97 -        }
   96.98 -
   96.99 -        @Override
  96.100 -        public Preferences getHintPreferences(HintMetadata hint) {
  96.101 -            return preferences.node(hint.id);
  96.102 -        }
  96.103 -
  96.104 -        @Override
  96.105 -        public Severity getSeverity(HintMetadata hint) {
  96.106 -            Preferences prefs = getHintPreferences(hint);
  96.107 -            String s = prefs.get(NEW_SEVERITY_KEY, null);
  96.108 -            if (s != null) return Severity.valueOf(s);
  96.109 -
  96.110 -            s = prefs.get(OLD_SEVERITY_KEY, null);
  96.111 -
  96.112 -            if (s == null) return overrideSeverity != null ? overrideSeverity : hint != null ? hint.severity : null;
  96.113 -
  96.114 -            if ("ERROR".equals(s)) return Severity.ERROR;
  96.115 -            else if ("WARNING".equals(s)) return Severity.VERIFIER;
  96.116 -            else if ("CURRENT_LINE_WARNING".equals(s)) return Severity.HINT;
  96.117 -
  96.118 -            return overrideSeverity != null ? overrideSeverity : hint != null ? hint.severity : null;
  96.119 -        }
  96.120 -        
  96.121 -        @Override
  96.122 -        public void setSeverity(HintMetadata hint, Severity severity) {
  96.123 -            getHintPreferences(hint).put(NEW_SEVERITY_KEY, severity.name());
  96.124 -        }
  96.125 -    }
  96.126 -    
  96.127 -    public static HintsSettings createPreferencesBasedHintsSettings(Preferences preferences, boolean useDefaultEnabled, Severity overrideSeverity) {
  96.128 -        return new PreferencesBasedHintsSettings(preferences, useDefaultEnabled, overrideSeverity);
  96.129 -    }
  96.130 -    
  96.131 -    public static HintsSettings getSettingsFor(FileObject file) {
  96.132 -        return createPreferencesBasedHintsSettings(FileHintPreferences.getFilePreferences(file, "text/x-java"), true, null);
  96.133 -    }
  96.134 -    
  96.135 -    public static HintsSettings getGlobalSettings() {
  96.136 -        return GLOBAL_SETTINGS;
  96.137 -    }
  96.138 -    
  96.139 -    private static final String DEFAULT_PROFILE = "default"; // NOI18N
  96.140 -    private static final String PREFERENCES_LOCATION = "org/netbeans/modules/java/hints";
  96.141 -    private static final HintsSettings GLOBAL_SETTINGS = createPreferencesBasedHintsSettings(NbPreferences.root().node(PREFERENCES_LOCATION).node(DEFAULT_PROFILE), true, null);
  96.142 -    
  96.143 -    @MimeRegistration(mimeType="text/x-java", service=GlobalHintPreferencesProvider.class)
  96.144 -    public static class GlobalSettingsProvider implements GlobalHintPreferencesProvider {
  96.145 -
  96.146 -        @Override
  96.147 -        public Preferences getGlobalPreferences() {
  96.148 -            return NbPreferences.root().node(PREFERENCES_LOCATION).node(DEFAULT_PROFILE);
  96.149 -        }
  96.150 -        
  96.151 -    }
  96.152 -}
    97.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/BulkSearch.java	Sun Jan 08 20:10:08 2017 +0100
    97.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.3 @@ -1,190 +0,0 @@
    97.4 -/*
    97.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    97.6 - *
    97.7 - * Copyright 2010 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):
   97.42 - *
   97.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   97.44 - */
   97.45 -
   97.46 -package org.netbeans.modules.java.hints.spiimpl.pm;
   97.47 -
   97.48 -import com.sun.source.tree.Tree;
   97.49 -import com.sun.source.util.TreePath;
   97.50 -import java.io.InputStream;
   97.51 -import java.io.OutputStream;
   97.52 -import java.util.Arrays;
   97.53 -import java.util.Collection;
   97.54 -import java.util.LinkedList;
   97.55 -import java.util.List;
   97.56 -import java.util.Map;
   97.57 -import java.util.Set;
   97.58 -import java.util.concurrent.atomic.AtomicBoolean;
   97.59 -import org.netbeans.api.annotations.common.CheckForNull;
   97.60 -import org.netbeans.api.java.source.CompilationInfo;
   97.61 -import org.netbeans.modules.java.hints.spiimpl.Utilities;
   97.62 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.AdditionalQueryConstraints;
   97.63 -
   97.64 -/**
   97.65 - *
   97.66 - * @author lahvac
   97.67 - */
   97.68 -public abstract class BulkSearch {
   97.69 -
   97.70 -    private static final BulkSearch INSTANCE = new NFABasedBulkSearch();
   97.71 -//    private static final BulkSearch INSTANCE = new REBasedBulkSearch();
   97.72 -
   97.73 -    public static BulkSearch getDefault() {
   97.74 -        return INSTANCE;
   97.75 -    }
   97.76 -    
   97.77 -    private final boolean requiresLightweightVerification;
   97.78 -    
   97.79 -    protected BulkSearch(boolean requiresLightweightVerification) {
   97.80 -        this.requiresLightweightVerification = requiresLightweightVerification;
   97.81 -    }
   97.82 -    
   97.83 -    public final Map<String, Collection<TreePath>> match(CompilationInfo info, AtomicBoolean cancel, TreePath toSearch, BulkPattern pattern) {
   97.84 -        return match(info, cancel, toSearch, pattern, null);
   97.85 -    }
   97.86 -
   97.87 -    public final boolean requiresLightweightVerification() {
   97.88 -        return requiresLightweightVerification;
   97.89 -    }
   97.90 -
   97.91 -    @CheckForNull
   97.92 -    public abstract Map<String, Collection<TreePath>> match(CompilationInfo info, AtomicBoolean cancel, TreePath toSearch, BulkPattern pattern, Map<String, Long> timeLog);
   97.93 -
   97.94 -    public abstract boolean matches(InputStream encoded, AtomicBoolean cancel, BulkPattern pattern);
   97.95 -    
   97.96 -    @CheckForNull
   97.97 -    public abstract Map<String, Integer> matchesWithFrequencies(InputStream encoded, BulkPattern pattern, AtomicBoolean cancel);
   97.98 -    
   97.99 -    public abstract boolean matches(CompilationInfo info, AtomicBoolean cancel, TreePath toSearch, BulkPattern pattern);
  97.100 -
  97.101 -    public abstract void encode(Tree tree, EncodingContext ctx, AtomicBoolean cancel);
  97.102 -    
  97.103 -    @CheckForNull
  97.104 -    public final BulkPattern create(CompilationInfo info, AtomicBoolean cancel, String... code) {
  97.105 -        return create(info, cancel, Arrays.asList(code));
  97.106 -    }
  97.107 -
  97.108 -    @CheckForNull
  97.109 -    public final BulkPattern create(CompilationInfo info, AtomicBoolean cancel, Collection<? extends String> code) {
  97.110 -        List<Tree> patterns = new LinkedList<Tree>();
  97.111 -        List<AdditionalQueryConstraints> additionalConstraints = new LinkedList<AdditionalQueryConstraints>();
  97.112 -
  97.113 -        for (String c : code) {
  97.114 -            patterns.add(Utilities.parseAndAttribute(info, c, null));
  97.115 -            additionalConstraints.add(AdditionalQueryConstraints.empty());
  97.116 -        }
  97.117 -
  97.118 -        return create(code, patterns, additionalConstraints, cancel);
  97.119 -    }
  97.120 -    
  97.121 -    @CheckForNull
  97.122 -    public abstract BulkPattern create(Collection<? extends String> code, Collection<? extends Tree> patterns, Collection<? extends AdditionalQueryConstraints> additionalConstraints, AtomicBoolean cancel);
  97.123 -
  97.124 -    public static abstract class BulkPattern {
  97.125 -
  97.126 -        private final List<? extends String> patterns;
  97.127 -        private final List<? extends Set<? extends String>> identifiers;
  97.128 -        private final List<List<List<String>>> requiredContent;
  97.129 -        private final List<AdditionalQueryConstraints> additionalConstraints;
  97.130 -
  97.131 -        public BulkPattern(List<? extends String> patterns, List<? extends Set<? extends String>> identifiers, List<List<List<String>>> requiredContent, List<AdditionalQueryConstraints> additionalConstraints) {
  97.132 -            this.patterns = patterns;
  97.133 -            this.identifiers = identifiers;//TODO: immutable, maybe clone
  97.134 -            this.requiredContent = requiredContent;
  97.135 -            this.additionalConstraints = additionalConstraints;
  97.136 -        }
  97.137 -
  97.138 -        public List<? extends String> getPatterns() {
  97.139 -            return patterns;
  97.140 -        }
  97.141 -
  97.142 -        public List<? extends Set<? extends String>> getIdentifiers() {
  97.143 -            return identifiers;
  97.144 -        }
  97.145 -
  97.146 -        public List<List<List<String>>> getRequiredContent() {
  97.147 -            return requiredContent;
  97.148 -        }
  97.149 -
  97.150 -        public List<AdditionalQueryConstraints> getAdditionalConstraints() {
  97.151 -            return additionalConstraints;
  97.152 -        }
  97.153 -
  97.154 -    }
  97.155 -
  97.156 -    public static final class EncodingContext {
  97.157 -
  97.158 -        private final OutputStream out;
  97.159 -        private final boolean forDuplicates;
  97.160 -        private Set<? extends String> identifiers;
  97.161 -        private List<String> content;
  97.162 -
  97.163 -        public EncodingContext(OutputStream out, boolean forDuplicates) {
  97.164 -            this.out = out;
  97.165 -            this.forDuplicates = forDuplicates;
  97.166 -        }
  97.167 -
  97.168 -        public Set<? extends String> getIdentifiers() {
  97.169 -            return identifiers;
  97.170 -        }
  97.171 -
  97.172 -        public OutputStream getOut() {
  97.173 -            return out;
  97.174 -        }
  97.175 -
  97.176 -        public boolean isForDuplicates() {
  97.177 -            return forDuplicates;
  97.178 -        }
  97.179 -
  97.180 -        public void setIdentifiers(Set<? extends String> identifiers) {
  97.181 -            this.identifiers = identifiers;
  97.182 -        }
  97.183 -
  97.184 -        public void setContent(List<String> content) {
  97.185 -            this.content = content;
  97.186 -        }
  97.187 -
  97.188 -        public List<String> getContent() {
  97.189 -            return content;
  97.190 -        }
  97.191 -
  97.192 -    }
  97.193 -}
    98.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/CopyFinderBasedBulkSearch.java	Sun Jan 08 20:10:08 2017 +0100
    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 2010 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):
   98.42 - *
   98.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   98.44 - */
   98.45 -
   98.46 -package org.netbeans.modules.java.hints.spiimpl.pm;
   98.47 -
   98.48 -import com.sun.source.tree.Tree;
   98.49 -import com.sun.source.util.TreePath;
   98.50 -import java.io.InputStream;
   98.51 -import java.util.Collection;
   98.52 -import java.util.Collections;
   98.53 -import java.util.HashMap;
   98.54 -import java.util.Iterator;
   98.55 -import java.util.LinkedList;
   98.56 -import java.util.Map;
   98.57 -import java.util.Map.Entry;
   98.58 -import java.util.concurrent.atomic.AtomicBoolean;
   98.59 -import javax.lang.model.type.TypeMirror;
   98.60 -import org.netbeans.api.java.source.CompilationInfo;
   98.61 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.AdditionalQueryConstraints;
   98.62 -import org.netbeans.api.java.source.matching.Matcher;
   98.63 -import org.netbeans.api.java.source.matching.Occurrence;
   98.64 -import org.netbeans.api.java.source.matching.Pattern;
   98.65 -import org.openide.util.Parameters;
   98.66 -
   98.67 -/**
   98.68 - *
   98.69 - * @author lahvac
   98.70 - */
   98.71 -public class CopyFinderBasedBulkSearch extends BulkSearch {
   98.72 -
   98.73 -    public CopyFinderBasedBulkSearch() {
   98.74 -        super(false);
   98.75 -    }
   98.76 -
   98.77 -    @Override
   98.78 -    public Map<String, Collection<TreePath>> match(CompilationInfo info, AtomicBoolean cancel, TreePath toSearch, BulkPattern pattern, Map<String, Long> timeLog) {
   98.79 -        Parameters.notNull("info", info);
   98.80 -        Map<String, Collection<TreePath>> result = new HashMap<String, Collection<TreePath>>();
   98.81 -        TreePath topLevel = new TreePath(info.getCompilationUnit());
   98.82 -        
   98.83 -        for (Entry<Tree, String> e : ((BulkPatternImpl) pattern).pattern2Code.entrySet()) {
   98.84 -            for (Occurrence od : Matcher.create(info).setCancel(new AtomicBoolean()).setUntypedMatching().setCancel(cancel).match(Pattern.createPatternWithFreeVariables(new TreePath(topLevel, e.getKey()), Collections.<String, TypeMirror>emptyMap()))) {
   98.85 -                Collection<TreePath> c = result.get(e.getValue());
   98.86 -
   98.87 -                if (c == null) {
   98.88 -                    result.put(e.getValue(), c = new LinkedList<TreePath>());
   98.89 -                }
   98.90 -
   98.91 -                c.add(od.getOccurrenceRoot());
   98.92 -            }
   98.93 -        }
   98.94 -
   98.95 -        return result;
   98.96 -    }
   98.97 -
   98.98 -    @Override
   98.99 -    public boolean matches(CompilationInfo info, AtomicBoolean cancel, TreePath toSearch, BulkPattern pattern) {
  98.100 -        //XXX: performance
  98.101 -        return !match(info, cancel, toSearch, pattern).isEmpty();
  98.102 -    }
  98.103 -
  98.104 -    @Override
  98.105 -    public BulkPattern create(Collection<? extends String> code, Collection<? extends Tree> patterns, Collection<? extends AdditionalQueryConstraints> additionalConstraints, AtomicBoolean cancel) {
  98.106 -        Map<Tree, String> pattern2Code = new HashMap<Tree, String>();
  98.107 -
  98.108 -        Iterator<? extends String> itCode = code.iterator();
  98.109 -        Iterator<? extends Tree>   itPatt = patterns.iterator();
  98.110 -
  98.111 -        while (itCode.hasNext() && itPatt.hasNext()) {
  98.112 -            pattern2Code.put(itPatt.next(), itCode.next());
  98.113 -        }
  98.114 -
  98.115 -        return new BulkPatternImpl(additionalConstraints, pattern2Code);
  98.116 -    }
  98.117 -
  98.118 -    @Override
  98.119 -    public boolean matches(InputStream encoded, AtomicBoolean cancel, BulkPattern pattern) {
  98.120 -        throw new UnsupportedOperationException("Not supported yet.");
  98.121 -    }
  98.122 -
  98.123 -    @Override
  98.124 -    public void encode(Tree tree, EncodingContext ctx, AtomicBoolean cancel) {
  98.125 -        throw new UnsupportedOperationException("Not supported yet.");
  98.126 -    }
  98.127 -
  98.128 -    @Override
  98.129 -    public Map<String, Integer> matchesWithFrequencies(InputStream encoded, BulkPattern pattern, AtomicBoolean cancel) {
  98.130 -        throw new UnsupportedOperationException("Not supported yet.");
  98.131 -    }
  98.132 -
  98.133 -    private static final class BulkPatternImpl extends BulkPattern {
  98.134 -
  98.135 -        private final Map<Tree, String> pattern2Code;
  98.136 -        
  98.137 -        public BulkPatternImpl(Collection<? extends AdditionalQueryConstraints> additionalConstraints, Map<Tree, String> pattern2Code) {
  98.138 -            super(new LinkedList<String>(pattern2Code.values()), null, null, new LinkedList<AdditionalQueryConstraints>(additionalConstraints));
  98.139 -            this.pattern2Code = pattern2Code;
  98.140 -        }
  98.141 -
  98.142 -    }
  98.143 -
  98.144 -}
    99.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/NFA.java	Sun Jan 08 20:10:08 2017 +0100
    99.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.3 @@ -1,216 +0,0 @@
    99.4 -/*
    99.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    99.6 - *
    99.7 - * Copyright 2009-2010 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):
   99.42 - *
   99.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   99.44 - */
   99.45 -
   99.46 -package org.netbeans.modules.java.hints.spiimpl.pm;
   99.47 -
   99.48 -import java.util.BitSet;
   99.49 -import java.util.HashSet;
   99.50 -import java.util.Map;
   99.51 -import java.util.Set;
   99.52 -
   99.53 -/**
   99.54 - *
   99.55 - * @author lahvac
   99.56 - */
   99.57 -public class NFA<I, R> {
   99.58 -
   99.59 -    /*XXX: private*/ final int stateCount;
   99.60 -    private final int startingState;
   99.61 -    private final Set<I> inputs;
   99.62 -    private final Map<Key<I>, State> transitionTable;
   99.63 -    private final Map<Integer, R> finalStates;
   99.64 -
   99.65 -    private final State startingStateObject;
   99.66 -
   99.67 -    private NFA(int startingState, int stateCount, Set<I> inputs, Map<Key<I>, State> transitionTable, Map<Integer, R> finalStates) {
   99.68 -        this.startingState = startingState;
   99.69 -        this.stateCount = stateCount;
   99.70 -        this.inputs = inputs;
   99.71 -        this.transitionTable = transitionTable;
   99.72 -        this.finalStates = finalStates;
   99.73 -
   99.74 -        startingStateObject = State.create().mutableOr(startingState);
   99.75 -    }
   99.76 -
   99.77 -    public State getStartingState() {
   99.78 -        return startingStateObject;
   99.79 -    }
   99.80 -
   99.81 -    public State transition(final State active, final I input) {
   99.82 -        State result = null;
   99.83 -
   99.84 -//        for (int i : active) {
   99.85 -        for (int i = active.nextSetBit(0); i >= 0; i = active.nextSetBit(i+1)) {
   99.86 -             State target = transitionTable.get(Key.create(i, input));
   99.87 -
   99.88 -             if (target != null) {
   99.89 -                 if (result == null) {
   99.90 -                     result = State.create();
   99.91 -                 }
   99.92 -                 
   99.93 -                 result.mutableOr(target);
   99.94 -             }
   99.95 -        }
   99.96 -
   99.97 -        State r;
   99.98 -
   99.99 -        //XXX:
  99.100 -        if (result == null) {
  99.101 -            r = startingStateObject;
  99.102 -        } else {
  99.103 -            r = result.mutableOr(startingState);//???
  99.104 -        }
  99.105 -
  99.106 -        return r;
  99.107 -    }
  99.108 -
  99.109 -    public Set<R> getResults(State bs) {
  99.110 -        Set<R> result = new HashSet<R>();
  99.111 -
  99.112 -        for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
  99.113 -            if (finalStates.get(i) != null) {
  99.114 -                result.add(finalStates.get(i));
  99.115 -            }
  99.116 -        }
  99.117 -
  99.118 -        return result;
  99.119 -    }
  99.120 -
  99.121 -    public static <I, R> NFA<I, R> create(int startingState, int stateCount, Set<I> inputs, Map<Key<I>, State> transitionTable, Map<Integer, R> finalStates) {
  99.122 -        return new NFA<I, R>(startingState, stateCount, inputs, transitionTable, finalStates);
  99.123 -    }
  99.124 -
  99.125 -    public State join(State s1, State s2) {
  99.126 -        State bs = State.create();
  99.127 -
  99.128 -        bs.mutableOr(s1);
  99.129 -        bs.mutableOr(s2);
  99.130 -
  99.131 -        return bs;
  99.132 -    }
  99.133 -
  99.134 -    public static final class Key<I> {
  99.135 -        private final int state;
  99.136 -        private final I   input;
  99.137 -
  99.138 -        private Key(int state, I input) {
  99.139 -            this.state = state;
  99.140 -            this.input = input;
  99.141 -        }
  99.142 -
  99.143 -        public static <I> Key<I> create(int state, I input) {
  99.144 -            return new Key<I>(state, input);
  99.145 -        }
  99.146 -
  99.147 -        @Override
  99.148 -        public boolean equals(Object obj) {
  99.149 -            if (obj == null) {
  99.150 -                return false;
  99.151 -            }
  99.152 -            if (getClass() != obj.getClass()) {
  99.153 -                return false;
  99.154 -            }
  99.155 -            final Key<?> other = (Key<?>) obj;
  99.156 -            if (this.state != other.state) {
  99.157 -                return false;
  99.158 -            }
  99.159 -            if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) {
  99.160 -                return false;
  99.161 -            }
  99.162 -            return true;
  99.163 -        }
  99.164 -
  99.165 -        @Override
  99.166 -        public int hashCode() {
  99.167 -            int hash = 3;
  99.168 -            hash = 83 * hash + this.state;
  99.169 -            hash = 83 * hash + (this.input != null ? this.input.hashCode() : 0);
  99.170 -            return hash;
  99.171 -        }
  99.172 -
  99.173 -        @Override
  99.174 -        public String toString() {
  99.175 -            return "[" + state + ", " + input + "]";
  99.176 -        }
  99.177 -
  99.178 -    }
  99.179 -
  99.180 -//    public static final class State extends HashSet<Integer> {
  99.181 -//        private State() {
  99.182 -//        }
  99.183 -//
  99.184 -//        public static State create() {
  99.185 -//            return new State();
  99.186 -//        }
  99.187 -//
  99.188 -//        public State mutableOr(int state) {
  99.189 -//            add(state);
  99.190 -//            return this;
  99.191 -//        }
  99.192 -//
  99.193 -//        public State mutableOr(State or) {
  99.194 -//            addAll(or);
  99.195 -//            return this;
  99.196 -//        }
  99.197 -//
  99.198 -//    }
  99.199 -
  99.200 -    public static final class State extends BitSet {
  99.201 -        private State() {}
  99.202 -
  99.203 -        public static State create() {
  99.204 -            return new State();
  99.205 -        }
  99.206 -
  99.207 -        public State mutableOr(int state) {
  99.208 -            set(state);
  99.209 -            return this;
  99.210 -        }
  99.211 -
  99.212 -        public State mutableOr(State or) {
  99.213 -            or(or);
  99.214 -            return this;
  99.215 -        }
  99.216 -
  99.217 -    }
  99.218 -
  99.219 -}
   100.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/NFABasedBulkSearch.java	Sun Jan 08 20:10:08 2017 +0100
   100.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.3 @@ -1,826 +0,0 @@
   100.4 -/*
   100.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   100.6 - *
   100.7 - * Copyright 2009-2010 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):
  100.42 - *
  100.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  100.44 - */
  100.45 -
  100.46 -package org.netbeans.modules.java.hints.spiimpl.pm;
  100.47 -
  100.48 -import com.sun.source.tree.AnnotationTree;
  100.49 -import com.sun.source.tree.BlockTree;
  100.50 -import com.sun.source.tree.ClassTree;
  100.51 -import com.sun.source.tree.IdentifierTree;
  100.52 -import com.sun.source.tree.LiteralTree;
  100.53 -import com.sun.source.tree.MemberSelectTree;
  100.54 -import com.sun.source.tree.MethodTree;
  100.55 -import com.sun.source.tree.ModifiersTree;
  100.56 -import com.sun.source.tree.StatementTree;
  100.57 -import com.sun.source.tree.Tree;
  100.58 -import com.sun.source.tree.Tree.Kind;
  100.59 -import com.sun.source.tree.VariableTree;
  100.60 -import com.sun.source.util.TreePath;
  100.61 -import com.sun.source.util.TreeScanner;
  100.62 -import java.io.ByteArrayOutputStream;
  100.63 -import java.io.IOException;
  100.64 -import java.io.InputStream;
  100.65 -import java.io.UnsupportedEncodingException;
  100.66 -import java.util.ArrayList;
  100.67 -import java.util.Collection;
  100.68 -import java.util.Collections;
  100.69 -import java.util.EnumMap;
  100.70 -import java.util.EnumSet;
  100.71 -import java.util.HashMap;
  100.72 -import java.util.HashSet;
  100.73 -import java.util.Iterator;
  100.74 -import java.util.LinkedHashMap;
  100.75 -import java.util.LinkedList;
  100.76 -import java.util.List;
  100.77 -import java.util.Map;
  100.78 -import java.util.Map.Entry;
  100.79 -import java.util.Set;
  100.80 -import java.util.Stack;
  100.81 -import java.util.concurrent.atomic.AtomicBoolean;
  100.82 -import javax.lang.model.element.Name;
  100.83 -import org.netbeans.api.java.source.CompilationInfo;
  100.84 -import org.netbeans.api.java.source.support.CancellableTreeScanner;
  100.85 -import org.netbeans.modules.java.hints.spiimpl.Utilities;
  100.86 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.AdditionalQueryConstraints;
  100.87 -import org.openide.util.Exceptions;
  100.88 -
  100.89 -/**
  100.90 - *
  100.91 - * @author lahvac
  100.92 - */
  100.93 -public class NFABasedBulkSearch extends BulkSearch {
  100.94 -
  100.95 -    public NFABasedBulkSearch() {
  100.96 -        super(false);
  100.97 -    }
  100.98 -
  100.99 -    @Override
 100.100 -    public Map<String, Collection<TreePath>> match(CompilationInfo info, final AtomicBoolean cancel, TreePath tree, BulkPattern patternIn, Map<String, Long> timeLog) {
 100.101 -        BulkPatternImpl pattern = (BulkPatternImpl) patternIn;
 100.102 -        
 100.103 -        final Map<Res, Collection<TreePath>> occurringPatterns = new HashMap<Res, Collection<TreePath>>();
 100.104 -        final NFA<Input, Res> nfa = pattern.toNFA();
 100.105 -        final Set<String> identifiers = new HashSet<String>();
 100.106 -
 100.107 -        new CollectIdentifiers<Void, TreePath>(identifiers, cancel) {
 100.108 -            private NFA.State active = nfa.getStartingState();
 100.109 -            @Override
 100.110 -            public Void scan(Tree node, TreePath p) {
 100.111 -                if (node == null) {
 100.112 -                    return null;
 100.113 -                }
 100.114 -
 100.115 -                TreePath currentPath = new TreePath(p, node);
 100.116 -                boolean[] goDeeper = new boolean[1];
 100.117 -                final NFA.State newActiveAfterVariable = nfa.transition(active, new Input(Kind.IDENTIFIER, "$", false));
 100.118 -                Input normalizedInput = normalizeInput(node, goDeeper, null);
 100.119 -                boolean ignoreKind = normalizedInput.kind == Kind.IDENTIFIER || normalizedInput.kind == Kind.MEMBER_SELECT;
 100.120 -
 100.121 -                NFA.State newActiveBefore = nfa.transition(active, normalizedInput);
 100.122 -
 100.123 -                if (normalizedInput.name != null && !ignoreKind) {
 100.124 -                    newActiveBefore = nfa.join(newActiveBefore, nfa.transition(active, new Input(normalizedInput.kind, "$", false)));
 100.125 -                }
 100.126 -
 100.127 -                active = newActiveBefore;
 100.128 -
 100.129 -                if (goDeeper[0]) {
 100.130 -                    super.scan(node, currentPath);
 100.131 -                } else {
 100.132 -                    new CollectIdentifiers<Void, Void>(identifiers, cancel).scan(node, null);
 100.133 -                }
 100.134 -                
 100.135 -                if (cancel.get()) return null;
 100.136 -
 100.137 -                NFA.State newActiveAfter = nfa.transition(active, UP);
 100.138 -
 100.139 -                active = nfa.join(newActiveAfter, nfa.transition(newActiveAfterVariable, UP));
 100.140 -
 100.141 -                for (Res r : nfa.getResults(active)) {
 100.142 -                    addOccurrence(r, currentPath);
 100.143 -                }
 100.144 -
 100.145 -                return null;
 100.146 -            }
 100.147 -
 100.148 -            @Override
 100.149 -            public Void scan(Iterable<? extends Tree> nodes, TreePath p) {
 100.150 -                active = nfa.transition(active, new Input(Kind.IDENTIFIER, "(", false));
 100.151 -                try {
 100.152 -                    return super.scan(nodes, p);
 100.153 -                } finally {
 100.154 -                    active = nfa.transition(active, UP);
 100.155 -                }
 100.156 -            }
 100.157 -            
 100.158 -            private void addOccurrence(Res r, TreePath currentPath) {
 100.159 -                Collection<TreePath> occurrences = occurringPatterns.get(r);
 100.160 -                if (occurrences == null) {
 100.161 -                    occurringPatterns.put(r, occurrences = new LinkedList<TreePath>());
 100.162 -                }
 100.163 -                occurrences.add(currentPath);
 100.164 -            }
 100.165 -        }.scan(tree, tree.getParentPath());
 100.166 -
 100.167 -        if (cancel.get()) return null;
 100.168 -        
 100.169 -        Map<String, Collection<TreePath>> result = new HashMap<String, Collection<TreePath>>();
 100.170 -
 100.171 -        for (Entry<Res, Collection<TreePath>> e : occurringPatterns.entrySet()) {
 100.172 -            if (cancel.get()) return null;
 100.173 -            if (!identifiers.containsAll(pattern.getIdentifiers().get(e.getKey().patternIndex))) {
 100.174 -                continue;
 100.175 -            }
 100.176 -
 100.177 -            result.put(e.getKey().pattern, e.getValue());
 100.178 -        }
 100.179 -
 100.180 -        return result;
 100.181 -    }
 100.182 -
 100.183 -    @Override
 100.184 -    public BulkPattern create(Collection<? extends String> code, Collection<? extends Tree> patterns, Collection<? extends AdditionalQueryConstraints> additionalConstraints, final AtomicBoolean cancel) {
 100.185 -        int startState = 0;
 100.186 -        final int[] nextState = new int[] {1};
 100.187 -        final Map<NFA.Key<Input>, NFA.State> transitionTable = new LinkedHashMap<NFA.Key<Input>, NFA.State>();
 100.188 -        Map<Integer, Res> finalStates = new HashMap<Integer, Res>();
 100.189 -        List<Set<? extends String>> identifiers = new LinkedList<Set<? extends String>>();
 100.190 -        List<List<List<String>>> requiredContent = new ArrayList<List<List<String>>>();
 100.191 -        Iterator<? extends String> codeIt = code.iterator();
 100.192 -        int patternIndex = 0;
 100.193 -
 100.194 -        for (final Tree pattern : patterns) {
 100.195 -            final int[] currentState = new int[] {startState};
 100.196 -            final Set<String> patternIdentifiers = new HashSet<String>();
 100.197 -            final List<List<String>> content = new ArrayList<List<String>>();
 100.198 -
 100.199 -            identifiers.add(patternIdentifiers);
 100.200 -            requiredContent.add(content);
 100.201 -
 100.202 -            class Scanner extends CollectIdentifiers<Void, Void> {
 100.203 -                public Scanner() {
 100.204 -                    super(patternIdentifiers, cancel);
 100.205 -                }
 100.206 -                private boolean auxPath;
 100.207 -                private List<String> currentContent;
 100.208 -                {
 100.209 -                    content.add(currentContent = new ArrayList<String>());
 100.210 -                }
 100.211 -                @Override
 100.212 -                public Void scan(Tree t, Void v) {
 100.213 -                    if (t == null) {
 100.214 -                        return null;
 100.215 -                    }
 100.216 -
 100.217 -                    if (Utilities.isMultistatementWildcardTree(t) || multiModifiers(t)) {
 100.218 -                        int target = nextState[0]++;
 100.219 -
 100.220 -                        setBit(transitionTable, NFA.Key.create(currentState[0], new Input(Kind.IDENTIFIER, "$", false)), target);
 100.221 -                        setBit(transitionTable, NFA.Key.create(target, UP), currentState[0]);
 100.222 -
 100.223 -                        content.add(currentContent = new ArrayList<String>());
 100.224 -                        
 100.225 -                        return null;
 100.226 -                    }
 100.227 -
 100.228 -                    if (t.getKind() == Kind.BLOCK) {
 100.229 -                        StatementTree singletonStatement = null;
 100.230 -                        BlockTree bt = (BlockTree) t;
 100.231 -
 100.232 -                        if (!bt.isStatic()) {
 100.233 -                            switch (bt.getStatements().size()) {
 100.234 -                                case 1:
 100.235 -                                    singletonStatement = bt.getStatements().get(0);
 100.236 -                                    break;
 100.237 -                                case 2:
 100.238 -                                    if (Utilities.isMultistatementWildcardTree(bt.getStatements().get(0))) {
 100.239 -                                        singletonStatement = bt.getStatements().get(1);
 100.240 -                                    } else {
 100.241 -                                        if (Utilities.isMultistatementWildcardTree(bt.getStatements().get(1))) {
 100.242 -                                            singletonStatement = bt.getStatements().get(0);
 100.243 -                                        }
 100.244 -                                    }
 100.245 -                                    break;
 100.246 -                                case 3:
 100.247 -                                    if (Utilities.isMultistatementWildcardTree(bt.getStatements().get(0)) && Utilities.isMultistatementWildcardTree(bt.getStatements().get(2))) {
 100.248 -                                        singletonStatement = bt.getStatements().get(1);
 100.249 -                                    }
 100.250 -                                    break;
 100.251 -                            }
 100.252 -                        }
 100.253 -
 100.254 -                        if (singletonStatement != null) {
 100.255 -                            int backup = currentState[0];
 100.256 -
 100.257 -                            boolean oldAuxPath = auxPath;
 100.258 -
 100.259 -                            auxPath = true;
 100.260 -
 100.261 -                            scan(singletonStatement, null);
 100.262 -
 100.263 -                            auxPath = oldAuxPath;
 100.264 -
 100.265 -                            int target = currentState[0];
 100.266 -
 100.267 -                            setBit(transitionTable, NFA.Key.create(backup, new Input(Kind.BLOCK, null, false)), currentState[0] = nextState[0]++);
 100.268 -                            setBit(transitionTable, NFA.Key.create(currentState[0], new Input(Kind.IDENTIFIER, "(", false)), currentState[0] = nextState[0]++);
 100.269 -
 100.270 -                            for (StatementTree st : bt.getStatements()) {
 100.271 -                                scan(st, null);
 100.272 -                            }
 100.273 -
 100.274 -                            setBit(transitionTable, NFA.Key.create(currentState[0], UP), currentState[0] = nextState[0]++);
 100.275 -                            setBit(transitionTable, NFA.Key.create(currentState[0], UP), target);
 100.276 -                            currentState[0] = target;
 100.277 -
 100.278 -                            return null;
 100.279 -                        }
 100.280 -                    }
 100.281 -                    
 100.282 -                    boolean[] goDeeper = new boolean[1];
 100.283 -                    Input[] bypass = new Input[1];
 100.284 -                    Input i = normalizeInput(t, goDeeper, bypass);
 100.285 -
 100.286 -                    if (!TO_IGNORE.contains(i.kind) && !auxPath) {
 100.287 -                        currentContent.add(kind2EncodedString.get(i.kind));
 100.288 -                    }
 100.289 -
 100.290 -                    if (i.name != null && !auxPath) {
 100.291 -                        if (!"$".equals(i.name)) {
 100.292 -                            if (isIdentifierAcceptable(i.name)) {
 100.293 -                                currentContent.add(i.name);
 100.294 -                            }
 100.295 -                            if (Utilities.isPureMemberSelect(t, false)) {
 100.296 -                                content.add(currentContent = new ArrayList<String>());
 100.297 -                            }
 100.298 -                        } else {
 100.299 -                            content.add(currentContent = new ArrayList<String>());
 100.300 -                        }
 100.301 -                    }
 100.302 -
 100.303 -                    int backup = currentState[0];
 100.304 -
 100.305 -                    handleTree(i, goDeeper, t, bypass);
 100.306 -
 100.307 -                    boolean oldAuxPath = auxPath;
 100.308 -
 100.309 -                    auxPath = true;
 100.310 -
 100.311 -                    if (StatementTree.class.isAssignableFrom(t.getKind().asInterface()) && t != pattern) {
 100.312 -                        int target = currentState[0];
 100.313 -
 100.314 -                        setBit(transitionTable, NFA.Key.create(backup, new Input(Kind.BLOCK, null, false)), currentState[0] = nextState[0]++);
 100.315 -                        setBit(transitionTable, NFA.Key.create(currentState[0], new Input(Kind.IDENTIFIER, "(", false)), currentState[0] = nextState[0]++);
 100.316 -                        handleTree(i, goDeeper, t, bypass);
 100.317 -                        setBit(transitionTable, NFA.Key.create(currentState[0], UP), currentState[0] = nextState[0]++);
 100.318 -                        setBit(transitionTable, NFA.Key.create(currentState[0], UP), target);
 100.319 -                        currentState[0] = target;
 100.320 -                    }
 100.321 -
 100.322 -                    auxPath = oldAuxPath;
 100.323 -
 100.324 -                    return null;
 100.325 -                }
 100.326 -
 100.327 -                @Override
 100.328 -                public Void scan(Iterable<? extends Tree> nodes, Void p) {
 100.329 -                    setBit(transitionTable, NFA.Key.create(currentState[0], new Input(Kind.IDENTIFIER, "(", false)), currentState[0] = nextState[0]++);
 100.330 -                    try {
 100.331 -                        return super.scan(nodes, p);
 100.332 -                    } finally {
 100.333 -                        setBit(transitionTable, NFA.Key.create(currentState[0], UP), currentState[0] = nextState[0]++);
 100.334 -                    }
 100.335 -                }
 100.336 -
 100.337 -                private void handleTree(Input i, boolean[] goDeeper, Tree t, Input[] bypass) {
 100.338 -                    int backup = currentState[0];
 100.339 -                    int target = nextState[0]++;
 100.340 -
 100.341 -                    setBit(transitionTable, NFA.Key.create(backup, i), currentState[0] = nextState[0]++);
 100.342 -
 100.343 -                    if (goDeeper[0]) {
 100.344 -                        super.scan(t, null);
 100.345 -                    } else {
 100.346 -                        new CollectIdentifiers<Void, Void>(patternIdentifiers, cancel).scan(t, null);
 100.347 -                        int aux = nextState[0]++;
 100.348 -                        setBit(transitionTable, NFA.Key.create(backup, new Input(Kind.MEMBER_SELECT, i.name, false)), aux);
 100.349 -                        setBit(transitionTable, NFA.Key.create(aux, new Input(Kind.IDENTIFIER, "$", false)), aux = nextState[0]++);
 100.350 -                        setBit(transitionTable, NFA.Key.create(aux, UP), aux = nextState[0]++);
 100.351 -                        setBit(transitionTable, NFA.Key.create(aux, UP), target);
 100.352 -                    }
 100.353 -
 100.354 -                    setBit(transitionTable, NFA.Key.create(currentState[0], UP), target);
 100.355 -                    
 100.356 -                    if (bypass[0] != null) {
 100.357 -                        int intermediate = nextState[0]++;
 100.358 -                        
 100.359 -                        setBit(transitionTable, NFA.Key.create(backup, bypass[0]), intermediate);
 100.360 -                        setBit(transitionTable, NFA.Key.create(intermediate, UP), target);
 100.361 -                    }
 100.362 -                    
 100.363 -                    currentState[0] = target;
 100.364 -                }
 100.365 -            }
 100.366 -
 100.367 -            Scanner s = new Scanner();
 100.368 -
 100.369 -            s.scan(pattern, null);
 100.370 -
 100.371 -            finalStates.put(currentState[0], new Res(codeIt.next(), patternIndex++));
 100.372 -        }
 100.373 -
 100.374 -        if (cancel.get()) return null;
 100.375 -        
 100.376 -        NFA<Input, Res> nfa = NFA.<Input, Res>create(startState, nextState[0], null, transitionTable, finalStates);
 100.377 -
 100.378 -        return new BulkPatternImpl(new LinkedList<String>(code), identifiers, requiredContent, new LinkedList<AdditionalQueryConstraints>(additionalConstraints), nfa);
 100.379 -    }
 100.380 -
 100.381 -    private static void setBit(Map<NFA.Key<Input>, NFA.State> transitionTable, NFA.Key<Input> input, int state) {
 100.382 -        NFA.State target = transitionTable.get(input);
 100.383 -
 100.384 -        if (target == null) {
 100.385 -            transitionTable.put(input, target = NFA.State.create());
 100.386 -        }
 100.387 -
 100.388 -        target.mutableOr(state);
 100.389 -    }
 100.390 -
 100.391 -    private static Input normalizeInput(Tree t, boolean[] goDeeper, Input[] bypass) {
 100.392 -        if (t.getKind() == Kind.IDENTIFIER && ((IdentifierTree) t).getName().toString().startsWith("$")) {
 100.393 -            goDeeper[0] = false;
 100.394 -            return new Input(Kind.IDENTIFIER, "$", false);
 100.395 -        }
 100.396 -
 100.397 -        if (Utilities.getWildcardTreeName(t) != null) {
 100.398 -            goDeeper[0] = false;
 100.399 -            return new Input(Kind.IDENTIFIER, "$", false);
 100.400 -        }
 100.401 -        
 100.402 -        if (t.getKind() == Kind.IDENTIFIER) {
 100.403 -            goDeeper[0] = false;
 100.404 -            String name = ((IdentifierTree) t).getName().toString();
 100.405 -            return new Input(Kind.IDENTIFIER, name, false);
 100.406 -        }
 100.407 -
 100.408 -        if (t.getKind() == Kind.MEMBER_SELECT) {
 100.409 -            String name = ((MemberSelectTree) t).getIdentifier().toString();
 100.410 -            if (name.startsWith("$")) {
 100.411 -                goDeeper[0] = false;//???
 100.412 -                return new Input(Kind.IDENTIFIER, "$", false);
 100.413 -            }
 100.414 -            if (bypass != null && Utilities.isPureMemberSelect(t, true)) {
 100.415 -                bypass[0] = new Input(Kind.IDENTIFIER, name, false);
 100.416 -            }
 100.417 -            goDeeper[0] = true;
 100.418 -            return new Input(Kind.MEMBER_SELECT, name, false);
 100.419 -        }
 100.420 -
 100.421 -        goDeeper[0] = true;
 100.422 -
 100.423 -        String name;
 100.424 -
 100.425 -        switch (t.getKind()) {
 100.426 -            case CLASS: name = ((ClassTree)t).getSimpleName().toString(); break;
 100.427 -            case VARIABLE: name = ((VariableTree)t).getName().toString(); break;
 100.428 -            case METHOD: name = ((MethodTree)t).getName().toString(); break;
 100.429 -            case BOOLEAN_LITERAL: name = ((LiteralTree) t).getValue().toString(); break;
 100.430 -            default: name = null;
 100.431 -        }
 100.432 -
 100.433 -        if (name != null) {
 100.434 -            if (!name.isEmpty() && name.charAt(0) == '$') {
 100.435 -                name = "$";
 100.436 -            }
 100.437 -        }
 100.438 -        return new Input(t.getKind(), name, false);
 100.439 -    }
 100.440 -    
 100.441 -    private boolean multiModifiers(Tree t) {
 100.442 -        if (t.getKind() != Kind.MODIFIERS) return false;
 100.443 -        
 100.444 -        List<AnnotationTree> annotations = new ArrayList<AnnotationTree>(((ModifiersTree) t).getAnnotations());
 100.445 -
 100.446 -        return !annotations.isEmpty() && annotations.get(0).getAnnotationType().getKind() == Kind.IDENTIFIER;
 100.447 -    }
 100.448 -
 100.449 -    @Override
 100.450 -    public boolean matches(CompilationInfo info, AtomicBoolean cancel, TreePath tree, BulkPattern pattern) {
 100.451 -        //XXX: performance
 100.452 -        return !match(info, cancel, tree, pattern).isEmpty();
 100.453 -    }
 100.454 -
 100.455 -    private static final Set<Kind> TO_IGNORE = EnumSet.of(Kind.BLOCK, Kind.IDENTIFIER, Kind.MEMBER_SELECT);
 100.456 -
 100.457 -    @Override
 100.458 -    public void encode(Tree tree, final EncodingContext ctx, AtomicBoolean cancel) {
 100.459 -        final Set<String> identifiers = new HashSet<String>();
 100.460 -        final List<String> content = new ArrayList<String>();
 100.461 -        if (!ctx.isForDuplicates()) {
 100.462 -            new CollectIdentifiers<Void, Void>(identifiers, cancel).scan(tree, null);
 100.463 -            try {
 100.464 -                int size = identifiers.size();
 100.465 -                ctx.getOut().write((size >> 24) & 0xFF);
 100.466 -                ctx.getOut().write((size >> 16) & 0xFF);
 100.467 -                ctx.getOut().write((size >>  8) & 0xFF);
 100.468 -                ctx.getOut().write((size >>  0) & 0xFF);
 100.469 -                for (String ident : identifiers) {
 100.470 -                    ctx.getOut().write(ident.getBytes("UTF-8"));//XXX: might probably contain ';'
 100.471 -                    ctx.getOut().write(';');
 100.472 -                }
 100.473 -            } catch (IOException ex) {
 100.474 -                throw new IllegalStateException(ex);
 100.475 -            }
 100.476 -        }
 100.477 -        if (cancel.get());
 100.478 -        new CollectIdentifiers<Void, Void>(new HashSet<String>(), cancel) {
 100.479 -            private boolean encode = true;
 100.480 -            @Override
 100.481 -            public Void scan(Tree t, Void v) {
 100.482 -                if (t == null) return null;
 100.483 -
 100.484 -                if (t instanceof StatementTree && Utilities.isMultistatementWildcardTree((StatementTree) t)) {
 100.485 -                    return null;
 100.486 -                }
 100.487 -
 100.488 -                boolean[] goDeeper = new boolean[1];
 100.489 -
 100.490 -                Input i = normalizeInput(t, goDeeper, null);
 100.491 -                try {
 100.492 -                    ctx.getOut().write('(');
 100.493 -                    ctx.getOut().write(kind2Encoded.get(i.kind));
 100.494 -                    if (!TO_IGNORE.contains(i.kind)) {
 100.495 -                        content.add(kind2EncodedString.get(i.kind));
 100.496 -                    }
 100.497 -                    if (i.name != null) {
 100.498 -                        if (encode) {
 100.499 -                            ctx.getOut().write('$');
 100.500 -                            ctx.getOut().write(i.name.getBytes("UTF-8"));
 100.501 -                            ctx.getOut().write(';');
 100.502 -                        }
 100.503 -                        if (isIdentifierAcceptable(i.name)) content.add(i.name);
 100.504 -                    }
 100.505 -
 100.506 -                    boolean oldEncode = encode;
 100.507 -
 100.508 -                    encode &= goDeeper[0];
 100.509 -                    super.scan(t, v);
 100.510 -                    encode = oldEncode;
 100.511 -
 100.512 -                    ctx.getOut().write(')');
 100.513 -                } catch (IOException ex) {
 100.514 -                    //XXX
 100.515 -                    Exceptions.printStackTrace(ex);
 100.516 -                }
 100.517 -
 100.518 -                return null;
 100.519 -            }
 100.520 -            @Override
 100.521 -            public Void scan(Iterable<? extends Tree> nodes, Void p) {
 100.522 -                try {
 100.523 -                    ctx.getOut().write('(');
 100.524 -                    ctx.getOut().write(kind2Encoded.get(Kind.IDENTIFIER));
 100.525 -                    ctx.getOut().write('$');
 100.526 -                    ctx.getOut().write('(');
 100.527 -                    ctx.getOut().write(';');
 100.528 -                    super.scan(nodes, p);
 100.529 -                    ctx.getOut().write(')');
 100.530 -                } catch (IOException ex) {
 100.531 -                    //XXX
 100.532 -                    Exceptions.printStackTrace(ex);
 100.533 -                }
 100.534 -                return null;
 100.535 -            }
 100.536 -        }.scan(tree, null);
 100.537 -
 100.538 -        ctx.setIdentifiers(identifiers);
 100.539 -        ctx.setContent(content);
 100.540 -        if (cancel.get());
 100.541 -    }
 100.542 -
 100.543 -    @Override
 100.544 -    public boolean matches(InputStream encoded, AtomicBoolean cancel, BulkPattern patternIn) {
 100.545 -        try {
 100.546 -            return !matchesImpl(encoded, cancel, patternIn, false).isEmpty();
 100.547 -        } catch (IOException ex) {
 100.548 -            Exceptions.printStackTrace(ex);
 100.549 -            return false;
 100.550 -        }
 100.551 -    }
 100.552 -
 100.553 -    @Override
 100.554 -    public Map<String, Integer> matchesWithFrequencies(InputStream encoded, BulkPattern patternIn, AtomicBoolean cancel) {
 100.555 -        try {
 100.556 -            return matchesImpl(encoded, cancel, patternIn, true);
 100.557 -        } catch (IOException ex) {
 100.558 -            Exceptions.printStackTrace(ex);
 100.559 -            return Collections.emptyMap();
 100.560 -        }
 100.561 -    }
 100.562 -
 100.563 -    public Map<String, Integer> matchesImpl(InputStream encoded, AtomicBoolean cancel, BulkPattern patternIn, boolean withFrequencies) throws IOException {
 100.564 -        BulkPatternImpl pattern = (BulkPatternImpl) patternIn;
 100.565 -        final NFA<Input, Res> nfa = pattern.toNFA();
 100.566 -        Stack<NFA.State> skips = new Stack<NFA.State>();
 100.567 -        NFA.State active = nfa.getStartingState();
 100.568 -        int identSize = 0;
 100.569 -
 100.570 -        identSize = encoded.read();
 100.571 -        identSize = (identSize << 8) + encoded.read();
 100.572 -        identSize = (identSize << 8) + encoded.read();
 100.573 -        identSize = (identSize << 8) + encoded.read();
 100.574 -
 100.575 -        Set<String> identifiers = new HashSet<String>(2 * identSize);
 100.576 -
 100.577 -        while (identSize-- > 0) {
 100.578 -            if (cancel.get()) return null;
 100.579 -            int read = encoded.read();
 100.580 -
 100.581 -            ByteArrayOutputStream baos = new ByteArrayOutputStream();
 100.582 -
 100.583 -            //read name:
 100.584 -            while (read != ';') {
 100.585 -                baos.write(read);
 100.586 -                read = encoded.read();
 100.587 -            }
 100.588 -
 100.589 -            identifiers.add(new String(baos.toByteArray(), "UTF-8"));
 100.590 -        }
 100.591 -
 100.592 -        Map<String, Integer> patternsAndFrequencies = new HashMap<String, Integer>();
 100.593 -        int read = encoded.read();
 100.594 -        
 100.595 -        while (read != (-1)) {
 100.596 -            if (cancel.get()) return null;
 100.597 -            if (read == '(') {
 100.598 -                read = encoded.read(); //kind
 100.599 -
 100.600 -                Kind k = encoded2Kind.get((read << 8) + encoded.read());
 100.601 -
 100.602 -                read = encoded.read();
 100.603 -
 100.604 -                String name;
 100.605 -
 100.606 -                if (read == '$') {
 100.607 -                    //XXX:
 100.608 -                    read = encoded.read();
 100.609 -
 100.610 -                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
 100.611 -
 100.612 -                    //read name:
 100.613 -                    while (read != ';') {
 100.614 -                        baos.write(read);
 100.615 -                        read = encoded.read();
 100.616 -                    }
 100.617 -
 100.618 -                    read = encoded.read();
 100.619 -                    name = new String(baos.toByteArray(), "UTF-8");
 100.620 -                } else {
 100.621 -                    name = null;
 100.622 -                }
 100.623 -                
 100.624 -                final NFA.State newActiveAfterVariable = nfa.transition(active, new Input(Kind.IDENTIFIER, "$", false));
 100.625 -                Input normalizedInput = new Input(k, name, false);
 100.626 -                boolean ignoreKind = normalizedInput.kind == Kind.IDENTIFIER || normalizedInput.kind == Kind.MEMBER_SELECT;
 100.627 -
 100.628 -                NFA.State newActive = nfa.transition(active, normalizedInput);
 100.629 -
 100.630 -                if (normalizedInput.name != null && !ignoreKind) {
 100.631 -                    newActive = nfa.join(newActive, nfa.transition(active, new Input(k, "$", false)));
 100.632 -                }
 100.633 -
 100.634 -                active = newActive;
 100.635 -
 100.636 -                skips.push(newActiveAfterVariable);
 100.637 -            } else {
 100.638 -                NFA.State newActiveAfterVariable = skips.pop();
 100.639 -                NFA.State newActive = nfa.transition(active, UP);
 100.640 -                NFA.State s2 = nfa.transition(newActiveAfterVariable, UP);
 100.641 -
 100.642 -                active = nfa.join(newActive, s2);
 100.643 -                
 100.644 -                for (Res res : nfa.getResults(active)) {
 100.645 -                    if (identifiers.containsAll(pattern.getIdentifiers().get(res.patternIndex))) {
 100.646 -                        if (!withFrequencies) {
 100.647 -                            patternsAndFrequencies.put(res.pattern, 1);
 100.648 -                            return patternsAndFrequencies;
 100.649 -                        }
 100.650 -                        
 100.651 -                        Integer freqs = patternsAndFrequencies.get(res.pattern);
 100.652 -
 100.653 -                        if (freqs == null) freqs = 0;
 100.654 -
 100.655 -                        patternsAndFrequencies.put(res.pattern, freqs + 1);
 100.656 -                    }
 100.657 -                }
 100.658 -
 100.659 -                read = encoded.read();
 100.660 -            }
 100.661 -        }
 100.662 -
 100.663 -        return patternsAndFrequencies;
 100.664 -    }
 100.665 -
 100.666 -    private static final Map<Kind, byte[]> kind2Encoded;
 100.667 -    private static final Map<Kind, String> kind2EncodedString;
 100.668 -    private static final Map<Integer, Kind> encoded2Kind;
 100.669 -
 100.670 -    static {
 100.671 -        kind2Encoded = new EnumMap<Kind, byte[]>(Kind.class);
 100.672 -        kind2EncodedString = new EnumMap<Kind, String>(Kind.class);
 100.673 -        encoded2Kind = new HashMap<Integer, Kind>();
 100.674 -
 100.675 -        for (Kind k : Kind.values()) {
 100.676 -            String enc = Integer.toHexString(k.ordinal());
 100.677 -
 100.678 -            if (enc.length() < 2) {
 100.679 -                enc = "0" + enc;
 100.680 -            }
 100.681 -
 100.682 -            try {
 100.683 -                final byte[] bytes = enc.getBytes("UTF-8");
 100.684 -
 100.685 -                assert bytes.length == 2;
 100.686 -
 100.687 -                kind2Encoded.put(k, bytes);
 100.688 -                kind2EncodedString.put(k, enc);
 100.689 -
 100.690 -                encoded2Kind.put((bytes[0] << 8) + bytes[1], k);
 100.691 -            } catch (UnsupportedEncodingException ex) {
 100.692 -                throw new IllegalStateException(ex);
 100.693 -            }
 100.694 -        }
 100.695 -    }
 100.696 -
 100.697 -    public static class BulkPatternImpl extends BulkPattern {
 100.698 -
 100.699 -        private final NFA<Input, Res> nfa;
 100.700 -
 100.701 -        private BulkPatternImpl(List<? extends String> patterns, List<? extends Set<? extends String>> identifiers, List<List<List<String>>> requiredContent, List<AdditionalQueryConstraints> additionalConstraints, NFA<Input, Res> nfa) {
 100.702 -            super(patterns, identifiers, requiredContent, additionalConstraints);
 100.703 -            this.nfa = nfa;
 100.704 -        }
 100.705 -
 100.706 -        NFA<Input, Res> toNFA() {
 100.707 -            return nfa;
 100.708 -        }
 100.709 -        
 100.710 -    }
 100.711 -
 100.712 -    private static final class Res {
 100.713 -        private final String pattern;
 100.714 -        private final int patternIndex;
 100.715 -
 100.716 -        public Res(String pattern, int patternIndex) {
 100.717 -            this.pattern = pattern;
 100.718 -            this.patternIndex = patternIndex;
 100.719 -        }
 100.720 -
 100.721 -    }
 100.722 -
 100.723 -    private static final class Input {
 100.724 -        private final Kind kind;
 100.725 -        private final String name;
 100.726 -        private final boolean end;
 100.727 -
 100.728 -        private Input(Kind kind, String name, boolean end) {
 100.729 -            this.kind = kind;
 100.730 -            this.name = name;
 100.731 -            this.end = end;
 100.732 -        }
 100.733 -
 100.734 -        @Override
 100.735 -        public boolean equals(Object obj) {
 100.736 -            if (obj == null) {
 100.737 -                return false;
 100.738 -            }
 100.739 -            if (getClass() != obj.getClass()) {
 100.740 -                return false;
 100.741 -            }
 100.742 -            final Input other = (Input) obj;
 100.743 -            if (this.kind != other.kind) {
 100.744 -                return false;
 100.745 -            }
 100.746 -            if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
 100.747 -                return false;
 100.748 -            }
 100.749 -            if (this.end != other.end) {
 100.750 -                return false;
 100.751 -            }
 100.752 -            return true;
 100.753 -        }
 100.754 -
 100.755 -        @Override
 100.756 -        public int hashCode() {
 100.757 -            int hash = 7;
 100.758 -            hash = 47 * hash + (this.kind != null ? this.kind.hashCode() : 17);
 100.759 -            hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
 100.760 -            hash = 47 * hash + (this.end ? 1 : 0);
 100.761 -            return hash;
 100.762 -        }
 100.763 -
 100.764 -        @Override
 100.765 -        public String toString() {
 100.766 -            return kind + ", " + name + ", " + end;
 100.767 -        }
 100.768 -
 100.769 -    }
 100.770 -
 100.771 -    private static final Input UP = new Input(null, null, true);
 100.772 -
 100.773 -    private static boolean isIdentifierAcceptable(CharSequence content) {
 100.774 -        if (content.length() == 0) return false;
 100.775 -        if (content.charAt(0) == '$' || content.charAt(0) == '<') return false;
 100.776 -        String stringValue = content.toString();
 100.777 -        if (stringValue.contentEquals("java") || "lang".equals(stringValue)) return false;
 100.778 -        return true;
 100.779 -    }
 100.780 -
 100.781 -    private static class CollectIdentifiers<R, P> extends CancellableTreeScanner<R, P> {
 100.782 -
 100.783 -        private final Set<String> identifiers;
 100.784 -
 100.785 -        public CollectIdentifiers(Set<String> identifiers, AtomicBoolean cancel) {
 100.786 -            super(cancel);
 100.787 -            this.identifiers = identifiers;
 100.788 -        }
 100.789 -
 100.790 -        private void addIdentifier(Name ident) {
 100.791 -            if (!isIdentifierAcceptable(ident)) return;
 100.792 -            identifiers.add(ident.toString());
 100.793 -        }
 100.794 -
 100.795 -        @Override
 100.796 -        public R visitMemberSelect(MemberSelectTree node, P p) {
 100.797 -            addIdentifier(node.getIdentifier());
 100.798 -            return super.visitMemberSelect(node, p);
 100.799 -        }
 100.800 -
 100.801 -        @Override
 100.802 -        public R visitIdentifier(IdentifierTree node, P p) {
 100.803 -            addIdentifier(node.getName());
 100.804 -            return super.visitIdentifier(node, p);
 100.805 -        }
 100.806 -
 100.807 -        @Override
 100.808 -        public R visitClass(ClassTree node, P p) {
 100.809 -            if (node.getSimpleName().length() == 0) {
 100.810 -                return scan(Utilities.filterHidden(null, node.getMembers()), p);
 100.811 -            }
 100.812 -            addIdentifier(node.getSimpleName());
 100.813 -            return super.visitClass(node, p);
 100.814 -        }
 100.815 -
 100.816 -        @Override
 100.817 -        public R visitMethod(MethodTree node, P p) {
 100.818 -            addIdentifier(node.getName());
 100.819 -            return super.visitMethod(node, p);
 100.820 -        }
 100.821 -
 100.822 -        @Override
 100.823 -        public R visitVariable(VariableTree node, P p) {
 100.824 -            addIdentifier(node.getName());
 100.825 -            return super.visitVariable(node, p);
 100.826 -        }
 100.827 -
 100.828 -    }
 100.829 -}
   101.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/PatternCompiler.java	Sun Jan 08 20:10:08 2017 +0100
   101.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   101.3 @@ -1,72 +0,0 @@
   101.4 -/*
   101.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   101.6 - *
   101.7 - * Copyright 2008-2010 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):
  101.42 - *
  101.43 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
  101.44 - */
  101.45 -
  101.46 -package org.netbeans.modules.java.hints.spiimpl.pm;
  101.47 -
  101.48 -import com.sun.source.tree.Scope;
  101.49 -import com.sun.source.tree.Tree;
  101.50 -import com.sun.source.util.TreePath;
  101.51 -import java.util.Map;
  101.52 -import javax.lang.model.type.TypeMirror;
  101.53 -import org.netbeans.api.java.source.CompilationInfo;
  101.54 -import org.netbeans.modules.java.hints.spiimpl.Utilities;
  101.55 -import org.netbeans.api.java.source.matching.Pattern;
  101.56 -
  101.57 -/**XXX: cancelability!
  101.58 - *
  101.59 - * @author Jan Lahoda
  101.60 - */
  101.61 -public class PatternCompiler {
  101.62 -
  101.63 -    public static Pattern compile(CompilationInfo info, String pattern, Map<String, TypeMirror> constraints, Iterable<? extends String> imports) {
  101.64 -        Scope scope = Utilities.constructScope(info, constraints, imports);
  101.65 -
  101.66 -        if (scope == null) {
  101.67 -            return null; //TODO: can happen?
  101.68 -        }
  101.69 -
  101.70 -        Tree patternTree = Utilities.parseAndAttribute(info, pattern, scope);
  101.71 -
  101.72 -        return Pattern.createPatternWithFreeVariables(new TreePath(new TreePath(info.getCompilationUnit()), patternTree), constraints);
  101.73 -    }
  101.74 -
  101.75 -}
   102.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/processor/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   102.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.3 @@ -1,44 +0,0 @@
   102.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   102.5 -#
   102.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   102.7 -#
   102.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   102.9 -# Other names may be trademarks of their respective owners.
  102.10 -#
  102.11 -# The contents of this file are subject to the terms of either the GNU
  102.12 -# General Public License Version 2 only ("GPL") or the Common
  102.13 -# Development and Distribution License("CDDL") (collectively, the
  102.14 -# "License"). You may not use this file except in compliance with the
  102.15 -# License. You can obtain a copy of the License at
  102.16 -# http://www.netbeans.org/cddl-gplv2.html
  102.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  102.18 -# specific language governing permissions and limitations under the
  102.19 -# License.  When distributing the software, include this License Header
  102.20 -# Notice in each file and include the License file at
  102.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  102.22 -# particular file as subject to the "Classpath" exception as provided
  102.23 -# by Oracle in the GPL Version 2 section of the License file that
  102.24 -# accompanied this code. If applicable, add the following below the
  102.25 -# License Header, with the fields enclosed by brackets [] replaced by
  102.26 -# your own identifying information:
  102.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  102.28 -#
  102.29 -# Contributor(s):
  102.30 -#
  102.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  102.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  102.33 -# Microsystems, Inc. All Rights Reserved.
  102.34 -#
  102.35 -# If you wish your version of this file to be governed by only the CDDL
  102.36 -# or only the GPL Version 2, indicate your decision by adding
  102.37 -# "[Contributor] elects to include this software in this distribution
  102.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  102.39 -# single choice of license, a recipient has the option to distribute
  102.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  102.41 -# to extend the choice of license to its licensees as provided above.
  102.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  102.43 -# Version 2 license, then the option applies only if the new code is
  102.44 -# made subject to such option by the copyright holder.
  102.45 -OpenIDE-Module-Name=Java Hints Annotation Processor
  102.46 -OpenIDE-Module-Display-Category=Java
  102.47 -OpenIDE-Module-Short-Description=Java Hints Annotation Processor
   103.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/processor/JavaHintsAnnotationProcessor.java	Sun Jan 08 20:10:08 2017 +0100
   103.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.3 @@ -1,635 +0,0 @@
   103.4 -/*
   103.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   103.6 - *
   103.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   103.8 - *
   103.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  103.10 - * Other names may be trademarks of their respective owners.
  103.11 - *
  103.12 - * The contents of this file are subject to the terms of either the GNU
  103.13 - * General Public License Version 2 only ("GPL") or the Common
  103.14 - * Development and Distribution License("CDDL") (collectively, the
  103.15 - * "License"). You may not use this file except in compliance with the
  103.16 - * License. You can obtain a copy of the License at
  103.17 - * http://www.netbeans.org/cddl-gplv2.html
  103.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  103.19 - * specific language governing permissions and limitations under the
  103.20 - * License.  When distributing the software, include this License Header
  103.21 - * Notice in each file and include the License file at
  103.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  103.23 - * particular file as subject to the "Classpath" exception as provided
  103.24 - * by Oracle in the GPL Version 2 section of the License file that
  103.25 - * accompanied this code. If applicable, add the following below the
  103.26 - * License Header, with the fields enclosed by brackets [] replaced by
  103.27 - * your own identifying information:
  103.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  103.29 - *
  103.30 - * If you wish your version of this file to be governed by only the CDDL
  103.31 - * or only the GPL Version 2, indicate your decision by adding
  103.32 - * "[Contributor] elects to include this software in this distribution
  103.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  103.34 - * single choice of license, a recipient has the option to distribute
  103.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  103.36 - * to extend the choice of license to its licensees as provided above.
  103.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  103.38 - * Version 2 license, then the option applies only if the new code is
  103.39 - * made subject to such option by the copyright holder.
  103.40 - *
  103.41 - * Contributor(s):
  103.42 - *
  103.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  103.44 - */
  103.45 -
  103.46 -package org.netbeans.modules.java.hints.spiimpl.processor;
  103.47 -
  103.48 -import java.lang.reflect.Array;
  103.49 -import java.util.Map.Entry;
  103.50 -import java.util.*;
  103.51 -import java.util.AbstractMap.SimpleEntry;
  103.52 -import java.util.logging.Logger;
  103.53 -import java.util.regex.Matcher;
  103.54 -import java.util.regex.Pattern;
  103.55 -import javax.annotation.processing.Processor;
  103.56 -import javax.annotation.processing.RoundEnvironment;
  103.57 -import javax.annotation.processing.SupportedAnnotationTypes;
  103.58 -import javax.annotation.processing.SupportedSourceVersion;
  103.59 -import javax.lang.model.SourceVersion;
  103.60 -import javax.lang.model.element.*;
  103.61 -import javax.lang.model.type.DeclaredType;
  103.62 -import javax.lang.model.type.TypeMirror;
  103.63 -import javax.lang.model.util.AbstractAnnotationValueVisitor6;
  103.64 -import javax.lang.model.util.ElementFilter;
  103.65 -import javax.lang.model.util.ElementScanner6;
  103.66 -import javax.lang.model.util.Elements;
  103.67 -import javax.lang.model.util.Types;
  103.68 -import javax.tools.Diagnostic.Kind;
  103.69 -import org.openide.filesystems.annotations.LayerBuilder;
  103.70 -import org.openide.filesystems.annotations.LayerBuilder.File;
  103.71 -import org.openide.filesystems.annotations.LayerGeneratingProcessor;
  103.72 -import org.openide.filesystems.annotations.LayerGenerationException;
  103.73 -import org.openide.util.NbCollections;
  103.74 -import org.openide.util.lookup.ServiceProvider;
  103.75 -
  103.76 -/**Inspired by https://sezpoz.dev.java.net/.
  103.77 - *
  103.78 - * @author lahvac
  103.79 - */
  103.80 -@SupportedSourceVersion(SourceVersion.RELEASE_6)
  103.81 -@SupportedAnnotationTypes("org.netbeans.spi.java.hints.*")
  103.82 -@ServiceProvider(service=Processor.class, position=100)
  103.83 -public class JavaHintsAnnotationProcessor extends LayerGeneratingProcessor {
  103.84 -    
  103.85 -    private static final Logger LOG = Logger.getLogger(JavaHintsAnnotationProcessor.class.getName());
  103.86 -    
  103.87 -    @Override
  103.88 -    protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
  103.89 -        if (!roundEnv.processingOver()) {
  103.90 -            generateTypeList("org.netbeans.spi.java.hints.Hint", roundEnv);
  103.91 -        }
  103.92 -
  103.93 -        return false;
  103.94 -    }
  103.95 -
  103.96 -    private static final String[] TRIGGERS = new String[] {
  103.97 -        "org.netbeans.spi.java.hints.TriggerTreeKind",
  103.98 -        "org.netbeans.spi.java.hints.TriggerPattern",
  103.99 -        "org.netbeans.spi.java.hints.TriggerPatterns",
 103.100 -    };
 103.101 -
 103.102 -    private static final String[] OPTIONS = new String[] {
 103.103 -        "org.netbeans.spi.java.hints.BooleanOption"
 103.104 -    };
 103.105 -
 103.106 -    private void generateTypeList(String annotationName, RoundEnvironment roundEnv) throws LayerGenerationException {
 103.107 -        TypeElement hint = processingEnv.getElementUtils().getTypeElement(annotationName);
 103.108 -
 103.109 -        if (hint == null) return ;
 103.110 -        
 103.111 -        for (Element annotated : roundEnv.getElementsAnnotatedWith(hint)) {
 103.112 -            if (!verifyHintAnnotationAcceptable(annotated)) continue;
 103.113 -            if (!annotated.getKind().isClass() && !annotated.getKind().isInterface()) {
 103.114 -                if (annotated.getKind() != ElementKind.METHOD) {
 103.115 -                    //the compiler should have already warned about this
 103.116 -                    continue;
 103.117 -                }
 103.118 -
 103.119 -                annotated = annotated.getEnclosingElement();
 103.120 -            } else {
 103.121 -                if (!annotated.getKind().isClass()) {
 103.122 -                    //the compiler should have already warned about this
 103.123 -                    continue;
 103.124 -                }
 103.125 -            }
 103.126 -
 103.127 -            if (!annotated.getKind().isClass()) {
 103.128 -                processingEnv.getMessager().printMessage(Kind.ERROR, "Internal error - cannot find class containing the hint", annotated);
 103.129 -                continue;
 103.130 -            }
 103.131 -
 103.132 -            TypeElement clazz = (TypeElement) annotated;
 103.133 -            String classFolder = "org-netbeans-modules-java-hints/code-hints/" + getFQN(clazz).replace('.', '-') + ".class";
 103.134 -
 103.135 -            {
 103.136 -                LayerBuilder builder = layer(clazz);
 103.137 -                File clazzFolder = builder.folder(classFolder);
 103.138 -                
 103.139 -                for (AnnotationMirror am : clazz.getAnnotationMirrors()) {
 103.140 -                    dumpAnnotation(builder, clazzFolder, clazz, am, true);
 103.141 -                }
 103.142 -                
 103.143 -                clazzFolder.write();
 103.144 -            }
 103.145 -
 103.146 -            for (ExecutableElement ee : ElementFilter.methodsIn(clazz.getEnclosedElements())) {
 103.147 -                if (!ee.getAnnotationMirrors().isEmpty()) {
 103.148 -                    LayerBuilder builder = layer(ee);
 103.149 -                    File methodFolder = builder.folder(classFolder + "/" + ee.getSimpleName() + ".method");
 103.150 -
 103.151 -                    for (AnnotationMirror am : ee.getAnnotationMirrors()) {
 103.152 -                        dumpAnnotation(builder, methodFolder, ee, am, true);
 103.153 -                    }
 103.154 -
 103.155 -                    methodFolder.write();
 103.156 -                }
 103.157 -            }
 103.158 -
 103.159 -            for (VariableElement var : ElementFilter.fieldsIn(clazz.getEnclosedElements())) {
 103.160 -                if (!var.getAnnotationMirrors().isEmpty()) {
 103.161 -                    LayerBuilder builder = layer(var);
 103.162 -                    File fieldFolder = builder.folder(classFolder + "/" + var.getSimpleName() + ".field");
 103.163 -
 103.164 -                    for (AnnotationMirror am : var.getAnnotationMirrors()) {
 103.165 -                        dumpAnnotation(builder, fieldFolder, var, am, true);
 103.166 -                    }
 103.167 -
 103.168 -                    if (var.getConstantValue() instanceof String) {
 103.169 -                        fieldFolder.stringvalue("constantValue", (String) var.getConstantValue());
 103.170 -                    }
 103.171 -
 103.172 -                    fieldFolder.write();
 103.173 -                }
 103.174 -            }
 103.175 -            
 103.176 -            new ElementScanner6<Void, Void>() {
 103.177 -                @Override public Void scan(Element e, Void p) {
 103.178 -                    AnnotationMirror hintMirror = findAnnotation(e.getAnnotationMirrors(), "org.netbeans.spi.java.hints.Hint");
 103.179 -            
 103.180 -                    if (hintMirror != null) {
 103.181 -                        String qualifiedName;
 103.182 -                        switch (e.getKind()) {
 103.183 -                            case METHOD: case CONSTRUCTOR:
 103.184 -                                qualifiedName = e.getEnclosingElement().asType().toString() + "." + e.getSimpleName().toString() + e.asType().toString();
 103.185 -                                break;
 103.186 -                            case FIELD: case ENUM_CONSTANT:
 103.187 -                                qualifiedName = e.getEnclosingElement().asType().toString() + "." + e.getSimpleName().toString();
 103.188 -                                break;
 103.189 -                            case ANNOTATION_TYPE: case CLASS:
 103.190 -                            case ENUM: case INTERFACE:
 103.191 -                            default:
 103.192 -                                qualifiedName = e.asType().toString();
 103.193 -                                break;
 103.194 -                        }
 103.195 -                        
 103.196 -                        try {
 103.197 -                            File keywordsFile = layer(e)
 103.198 -                                               .file("OptionsDialog/Keywords/".concat(qualifiedName))
 103.199 -                                               .stringvalue("location", "Editor")
 103.200 -                                               .bundlevalue("tabTitle", "org.netbeans.modules.options.editor.Bundle", "CTL_Hints_DisplayName");
 103.201 -
 103.202 -                            String displayName = getAttributeValue(hintMirror, "displayName", String.class);
 103.203 -
 103.204 -                            if (displayName != null)
 103.205 -                                keywordsFile = keywordsFile.bundlevalue("keywords-1", displayName);
 103.206 -
 103.207 -                            String description = getAttributeValue(hintMirror, "description", String.class);
 103.208 -
 103.209 -                            if (description != null)
 103.210 -                                keywordsFile = keywordsFile.bundlevalue("keywords-2", description);
 103.211 -
 103.212 -                            int i = 3;
 103.213 -
 103.214 -                            for (String sw : getAttributeValue(hintMirror, "suppressWarnings", String[].class)) {
 103.215 -                                keywordsFile = keywordsFile.stringvalue("keywords-" + i++, sw);
 103.216 -                            }
 103.217 -
 103.218 -                            keywordsFile.write();
 103.219 -                        } catch (LayerGenerationException ex) {
 103.220 -                            JavaHintsAnnotationProcessor.<RuntimeException>rethrowAsRuntime(ex);
 103.221 -                        }
 103.222 -                    }
 103.223 -
 103.224 -                    return super.scan(e, p);
 103.225 -                }
 103.226 -            }.scan(annotated, null);
 103.227 -        }
 103.228 -
 103.229 -        for (String ann : TRIGGERS) {
 103.230 -            TypeElement annRes = processingEnv.getElementUtils().getTypeElement(ann);
 103.231 -
 103.232 -            if (annRes == null) continue;
 103.233 -
 103.234 -            for (ExecutableElement method : ElementFilter.methodsIn(roundEnv.getElementsAnnotatedWith(annRes))) {
 103.235 -                verifyHintMethod(method);
 103.236 -                verifyTriggerAnnotations(method);
 103.237 -            }
 103.238 -        }
 103.239 -
 103.240 -        for (String ann : OPTIONS) {
 103.241 -            TypeElement annRes = processingEnv.getElementUtils().getTypeElement(ann);
 103.242 -
 103.243 -            if (annRes == null) continue;
 103.244 -
 103.245 -            for (VariableElement var : ElementFilter.fieldsIn(roundEnv.getElementsAnnotatedWith(annRes))) {
 103.246 -                verifyOptionField(var);
 103.247 -            }
 103.248 -        }
 103.249 -
 103.250 -    }
 103.251 -
 103.252 -    private void dumpAnnotation(LayerBuilder builder, File folder, Element errElement, AnnotationMirror annotation, boolean topLevel) {
 103.253 -        String fqn = getFQN(((TypeElement) annotation.getAnnotationType().asElement())).replace('.', '-');
 103.254 -        if (topLevel && !fqn.startsWith("org-netbeans-spi-java-hints")) return ;
 103.255 -        final File   annotationFolder = builder.folder(folder.getPath() + "/" + fqn + ".annotation");
 103.256 -
 103.257 -        for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e : annotation.getElementValues().entrySet()) {
 103.258 -            final String attrName = e.getKey().getSimpleName().toString();
 103.259 -            e.getValue().accept(new DumpAnnotationValue(builder, annotationFolder, attrName, errElement, annotation, e.getValue()), null);
 103.260 -        }
 103.261 -
 103.262 -        annotationFolder.write();
 103.263 -    }
 103.264 -
 103.265 -    private String getFQN(TypeElement clazz) {
 103.266 -        return processingEnv.getElementUtils().getBinaryName(clazz).toString();
 103.267 -    }
 103.268 -
 103.269 -    static final String ERR_RETURN_TYPE = "The return type must be either org.netbeans.spi.editor.hints.ErrorDescription or java.util.List<org.netbeans.spi.editor.hints.ErrorDescription>";
 103.270 -    static final String ERR_PARAMETERS = "The method must have exactly one parameter of type org.netbeans.spi.java.hints.HintContext";
 103.271 -    static final String ERR_MUST_BE_STATIC = "The method must be static";
 103.272 -    static final String ERR_OPTION_TYPE = "The option field must be of type java.lang.String";
 103.273 -    static final String ERR_OPTION_MUST_BE_STATIC_FINAL = "The option field must be static final";
 103.274 -    static final String WARN_BUNDLE_KEY_NOT_FOUND = "Bundle key %s not found";
 103.275 -
 103.276 -    private static AnnotationMirror findAnnotation(Iterable<? extends AnnotationMirror> annotations, String annotationFQN) {
 103.277 -        for (AnnotationMirror am : annotations) {
 103.278 -            if (((TypeElement) am.getAnnotationType().asElement()).getQualifiedName().contentEquals(annotationFQN)) {
 103.279 -                return am;
 103.280 -            }
 103.281 -        }
 103.282 -
 103.283 -        return null;
 103.284 -    }
 103.285 -
 103.286 -    private <T> T getAttributeValue(AnnotationMirror annotation, String attribute, Class<T> clazz) {
 103.287 -        if (clazz.isArray()) {
 103.288 -            Iterable<?> attributes = getAttributeValueInternal(annotation, attribute, Iterable.class);
 103.289 -            
 103.290 -            Collection<Object> coll = new ArrayList<Object>();
 103.291 -            Class<?> componentType = clazz.getComponentType();
 103.292 -
 103.293 -            for (Object attr : attributes) {
 103.294 -                if (attr instanceof AnnotationValue) {
 103.295 -                    attr = ((AnnotationValue) attr).getValue();
 103.296 -                }
 103.297 -                
 103.298 -                if (componentType.isAssignableFrom(attr.getClass())) {
 103.299 -                    coll.add(componentType.cast(attr));
 103.300 -                }
 103.301 -            }
 103.302 -
 103.303 -            return clazz.cast(coll.toArray((Object[]) Array.newInstance(clazz.getComponentType(), 0)));
 103.304 -        } else {
 103.305 -            return getAttributeValueInternal(annotation, attribute, clazz);
 103.306 -        }
 103.307 -    }
 103.308 -
 103.309 -    private <T> T getAttributeValueInternal(AnnotationMirror annotation, String attribute, Class<T> clazz) {
 103.310 -        for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e : processingEnv.getElementUtils().getElementValuesWithDefaults(annotation).entrySet()) {
 103.311 -            if (e.getKey().getSimpleName().contentEquals(attribute)) {
 103.312 -                Object value = e.getValue().getValue();
 103.313 -
 103.314 -                if (clazz.isAssignableFrom(value.getClass())) {
 103.315 -                    return clazz.cast(value);
 103.316 -                }
 103.317 -
 103.318 -                return null;
 103.319 -            }
 103.320 -        }
 103.321 -        
 103.322 -        return null;
 103.323 -    }
 103.324 -
 103.325 -    private AnnotationValue getAttributeValueDescription(AnnotationMirror annotation, String attribute) {
 103.326 -        for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e : processingEnv.getElementUtils().getElementValuesWithDefaults(annotation).entrySet()) {
 103.327 -            if (e.getKey().getSimpleName().contentEquals(attribute)) {
 103.328 -                return e.getValue();
 103.329 -            }
 103.330 -        }
 103.331 -
 103.332 -        return null;
 103.333 -    }
 103.334 -    
 103.335 -    private boolean verifyHintAnnotationAcceptable(Element hint) {
 103.336 -        AnnotationMirror hintMirror = findAnnotation(hint.getAnnotationMirrors(), "org.netbeans.spi.java.hints.Hint");
 103.337 -
 103.338 -        if (hintMirror == null) return false;
 103.339 -
 103.340 -        String id = getAttributeValue(hintMirror, "id", String.class);
 103.341 -
 103.342 -        if (id == null || id.isEmpty()) {
 103.343 -            switch (hint.getKind()) {
 103.344 -                case CLASS:
 103.345 -                case METHOD:
 103.346 -                    break; //OK
 103.347 -                default:
 103.348 -                    //compiler should have already warned about this
 103.349 -                    return false;
 103.350 -            }
 103.351 -        }
 103.352 -
 103.353 -        TypeMirror customizerProviderType = getAttributeValue(hintMirror, "customizerProvider", TypeMirror.class);
 103.354 -
 103.355 -        if (customizerProviderType != null) {
 103.356 -            Element customizerProvider = processingEnv.getTypeUtils().asElement(customizerProviderType);
 103.357 -
 103.358 -            if (customizerProvider != null) {
 103.359 -                if (customizerProvider.getKind() != ElementKind.CLASS) {
 103.360 -                    TypeElement customizerProviderInterface = processingEnv.getElementUtils().getTypeElement("org.netbeans.spi.java.hints.CustomizerProvider");
 103.361 -
 103.362 -                    if (customizerProviderInterface != null && !customizerProviderInterface.equals(customizerProvider)) {
 103.363 -                        processingEnv.getMessager().printMessage(Kind.ERROR, "Customizer provider must be a concrete class", hint, hintMirror, getAttributeValueDescription(hintMirror, "customizerProvider"));
 103.364 -                    }
 103.365 -                } else {
 103.366 -                    TypeElement customizerProviderClazz = (TypeElement) customizerProvider;
 103.367 -
 103.368 -                    if (!customizerProviderClazz.getModifiers().contains(Modifier.PUBLIC)) {
 103.369 -                        processingEnv.getMessager().printMessage(Kind.ERROR, "Customizer provider must be public", hint, hintMirror, getAttributeValueDescription(hintMirror, "customizerProvider"));
 103.370 -                    }
 103.371 -
 103.372 -                    if (   customizerProviderClazz.getEnclosingElement().getKind() != ElementKind.PACKAGE
 103.373 -                        && !customizerProviderClazz.getModifiers().contains(Modifier.STATIC)) {
 103.374 -                        processingEnv.getMessager().printMessage(Kind.ERROR, "Customizer provider must be non-static innerclass", hint, hintMirror, getAttributeValueDescription(hintMirror, "customizerProvider"));
 103.375 -                    }
 103.376 -
 103.377 -                    boolean foundDefaultConstructor = false;
 103.378 -
 103.379 -                    for (ExecutableElement ee : ElementFilter.constructorsIn(customizerProviderClazz.getEnclosedElements())) {
 103.380 -                        if (ee.getParameters().isEmpty()) {
 103.381 -                            foundDefaultConstructor = true;
 103.382 -                            if (!ee.getModifiers().contains(Modifier.PUBLIC)) {
 103.383 -                                processingEnv.getMessager().printMessage(Kind.ERROR, "Customizer provider must provide a public default constructor", hint, hintMirror, getAttributeValueDescription(hintMirror, "customizerProvider"));
 103.384 -                            }
 103.385 -                            break;
 103.386 -                        }
 103.387 -                    }
 103.388 -
 103.389 -                    if (!foundDefaultConstructor) {
 103.390 -                        processingEnv.getMessager().printMessage(Kind.ERROR, "Customizer provider must provide a public default constructor", hint, hintMirror, getAttributeValueDescription(hintMirror, "customizerProvider"));
 103.391 -                    }
 103.392 -                }
 103.393 -            }
 103.394 -        }
 103.395 -
 103.396 -        return true;
 103.397 -    }
 103.398 -
 103.399 -    private boolean verifyHintMethod(ExecutableElement method) {
 103.400 -        StringBuilder error = new StringBuilder();
 103.401 -        Elements elements = processingEnv.getElementUtils();
 103.402 -        TypeElement errDesc = elements.getTypeElement("org.netbeans.spi.editor.hints.ErrorDescription");
 103.403 -        TypeElement jlIterable = elements.getTypeElement("java.lang.Iterable");
 103.404 -        TypeElement hintCtx = elements.getTypeElement("org.netbeans.spi.java.hints.HintContext");
 103.405 -
 103.406 -        if (errDesc == null || jlIterable == null || hintCtx == null) {
 103.407 -            return true;
 103.408 -        }
 103.409 -
 103.410 -        Types types = processingEnv.getTypeUtils();
 103.411 -        TypeMirror errDescType = errDesc.asType(); //no type params, no need to erasure
 103.412 -        TypeMirror jlIterableErrDesc = types.getDeclaredType(jlIterable, errDescType);
 103.413 -        TypeMirror ret = method.getReturnType();
 103.414 -
 103.415 -        if (!types.isSameType(ret, errDescType) && !types.isAssignable(ret, jlIterableErrDesc)) {
 103.416 -            error.append(ERR_RETURN_TYPE);
 103.417 -            error.append("\n");
 103.418 -        }
 103.419 -
 103.420 -        if (method.getParameters().size() != 1 || !types.isSameType(method.getParameters().get(0).asType(), hintCtx.asType())) {
 103.421 -            error.append(ERR_PARAMETERS);
 103.422 -            error.append("\n");
 103.423 -        }
 103.424 -
 103.425 -        if (!method.getModifiers().contains(Modifier.STATIC)) {
 103.426 -            error.append(ERR_MUST_BE_STATIC);
 103.427 -            error.append("\n");
 103.428 -        }
 103.429 -
 103.430 -        if (error.length() == 0) {
 103.431 -            return true;
 103.432 -        }
 103.433 -
 103.434 -        if (error.charAt(error.length() - 1) == '\n') {
 103.435 -            error.delete(error.length() - 1, error.length());
 103.436 -        }
 103.437 -
 103.438 -        processingEnv.getMessager().printMessage(Kind.ERROR, error.toString(), method);
 103.439 -
 103.440 -        return false;
 103.441 -    }
 103.442 -
 103.443 -    private static final Pattern VARIABLE_PATTERN = Pattern.compile("\\$[a-zA-Z0-9_]+");
 103.444 -    private boolean verifyTriggerAnnotations(ExecutableElement method) {
 103.445 -        List<AnnotationMirror> patternAnnotations = new ArrayList<AnnotationMirror>();
 103.446 -        AnnotationMirror am = findAnnotation(method.getAnnotationMirrors(), "org.netbeans.spi.java.hints.TriggerPattern");
 103.447 -
 103.448 -        if (am != null) {
 103.449 -            patternAnnotations.add(am);
 103.450 -        }
 103.451 -
 103.452 -        am = findAnnotation(method.getAnnotationMirrors(), "org.netbeans.spi.java.hints.TriggerPatterns");
 103.453 -
 103.454 -        if (am != null) {
 103.455 -            patternAnnotations.addAll(Arrays.asList(getAttributeValue(am, "value", AnnotationMirror[].class)));
 103.456 -        }
 103.457 -
 103.458 -        for (AnnotationMirror patternDescription : patternAnnotations) {
 103.459 -            String pattern = getAttributeValue(patternDescription, "value", String.class);
 103.460 -
 103.461 -            if (pattern == null) continue;
 103.462 -
 103.463 -            Set<String> variables = new HashSet<String>();
 103.464 -            Matcher m = VARIABLE_PATTERN.matcher(pattern);
 103.465 -
 103.466 -            while (m.find()) {
 103.467 -                variables.add(m.group(0));
 103.468 -            }
 103.469 -
 103.470 -            for (AnnotationMirror constraint : getAttributeValue(patternDescription, "constraints", AnnotationMirror[].class)) {
 103.471 -                String variable = getAttributeValue(constraint, "variable", String.class);
 103.472 -                String type = getAttributeValue(constraint, "type", String.class);
 103.473 -
 103.474 -                if (variable == null || type == null) continue;
 103.475 -
 103.476 -                if (!variables.contains(variable)) {
 103.477 -                    processingEnv.getMessager().printMessage(Kind.WARNING, "Variable " + variable + " not used in the pattern", method, constraint, getAttributeValueDescription(constraint, "variable"));
 103.478 -                }
 103.479 -            }
 103.480 -        }
 103.481 -
 103.482 -        return false;
 103.483 -    }
 103.484 -
 103.485 -    private boolean verifyOptionField(VariableElement field) {
 103.486 -        StringBuilder error = new StringBuilder();
 103.487 -        Elements elements = processingEnv.getElementUtils();
 103.488 -        TypeElement jlString = elements.getTypeElement("java.lang.String");
 103.489 -
 103.490 -        if (jlString == null) {
 103.491 -            return true;
 103.492 -        }
 103.493 -
 103.494 -        Types types = processingEnv.getTypeUtils();
 103.495 -        TypeMirror jlStringType = jlString.asType(); //no type params, no need to erasure
 103.496 -
 103.497 -        if (!types.isSameType(field.asType(), jlStringType)) {
 103.498 -            error.append(ERR_RETURN_TYPE);
 103.499 -            error.append("\n");
 103.500 -        }
 103.501 -
 103.502 -        if (!field.getModifiers().contains(Modifier.STATIC) || !field.getModifiers().contains(Modifier.FINAL)) {
 103.503 -            error.append(ERR_OPTION_MUST_BE_STATIC_FINAL);
 103.504 -            error.append("\n");
 103.505 -        }
 103.506 -
 103.507 -        Object key = field.getConstantValue();
 103.508 -
 103.509 -        if (key == null) {
 103.510 -            error.append("Option field not a compile-time constant");
 103.511 -            error.append("\n");
 103.512 -        }
 103.513 -
 103.514 -        if (error.length() == 0) {
 103.515 -            return true;
 103.516 -        }
 103.517 -
 103.518 -        if (error.charAt(error.length() - 1) == '\n') {
 103.519 -            error.delete(error.length() - 1, error.length());
 103.520 -        }
 103.521 -
 103.522 -        processingEnv.getMessager().printMessage(Kind.ERROR, error.toString(), field);
 103.523 -
 103.524 -        return false;
 103.525 -    }
 103.526 -
 103.527 -    private class DumpAnnotationValue extends AbstractAnnotationValueVisitor6<Void, Void> {
 103.528 -
 103.529 -        private final LayerBuilder builder;
 103.530 -        private final File annotationFolder;
 103.531 -        private final String attrName;
 103.532 -        private final Element errElement;
 103.533 -        private final AnnotationMirror errAnnotationMirror;
 103.534 -        private final AnnotationValue errAnnotationValue;
 103.535 -
 103.536 -        public DumpAnnotationValue(LayerBuilder builder, File annotationFolder, String attrName, Element errElement, AnnotationMirror errAnnotationMirror, AnnotationValue errAnnotationValue) {
 103.537 -            this.builder = builder;
 103.538 -            this.annotationFolder = annotationFolder;
 103.539 -            this.attrName = attrName;
 103.540 -            this.errElement = errElement;
 103.541 -            this.errAnnotationMirror = errAnnotationMirror;
 103.542 -            this.errAnnotationValue = errAnnotationValue;
 103.543 -        }
 103.544 -
 103.545 -        public Void visitBoolean(boolean b, Void p) {
 103.546 -            annotationFolder.boolvalue(attrName, b);
 103.547 -            return null;
 103.548 -        }
 103.549 -
 103.550 -        public Void visitByte(byte b, Void p) {
 103.551 -            annotationFolder.bytevalue(attrName, b);
 103.552 -            return null;
 103.553 -        }
 103.554 -
 103.555 -        public Void visitChar(char c, Void p) {
 103.556 -            annotationFolder.charvalue(attrName, c);
 103.557 -            return null;
 103.558 -        }
 103.559 -
 103.560 -        public Void visitDouble(double d, Void p) {
 103.561 -            annotationFolder.doublevalue(attrName, d);
 103.562 -            return null;
 103.563 -        }
 103.564 -
 103.565 -        public Void visitFloat(float f, Void p) {
 103.566 -            annotationFolder.floatvalue(attrName, f);
 103.567 -            return null;
 103.568 -        }
 103.569 -
 103.570 -        public Void visitInt(int i, Void p) {
 103.571 -            annotationFolder.intvalue(attrName, i);
 103.572 -            return null;
 103.573 -        }
 103.574 -
 103.575 -        public Void visitLong(long i, Void p) {
 103.576 -            annotationFolder.longvalue(attrName, i);
 103.577 -            return null;
 103.578 -        }
 103.579 -
 103.580 -        public Void visitShort(short s, Void p) {
 103.581 -            annotationFolder.shortvalue(attrName, s);
 103.582 -            return null;
 103.583 -        }
 103.584 -
 103.585 -        public Void visitString(String s, Void p) {
 103.586 -            if ("displayName".equals(attrName) || "description".equals(attrName) || "tooltip".equals(attrName)) {
 103.587 -                try {
 103.588 -                    annotationFolder.bundlevalue(attrName, s);
 103.589 -                } catch (LayerGenerationException ex) {
 103.590 -                   processingEnv.getMessager().printMessage(Kind.ERROR, ex.getLocalizedMessage(), errElement, errAnnotationMirror, errAnnotationValue);
 103.591 -                }
 103.592 -            } else {
 103.593 -                annotationFolder.stringvalue(attrName, s);
 103.594 -            }
 103.595 -            return null;
 103.596 -        }
 103.597 -
 103.598 -        public Void visitType(TypeMirror t, Void p) {
 103.599 -            annotationFolder.stringvalue(attrName, getFQN(((TypeElement) ((DeclaredType) t).asElement())));
 103.600 -            return null;
 103.601 -        }
 103.602 -
 103.603 -        public Void visitEnumConstant(VariableElement c, Void p) {
 103.604 -            TypeElement owner = (TypeElement) c.getEnclosingElement();
 103.605 -            annotationFolder.stringvalue(attrName, getFQN(owner) + "." + c.getSimpleName());
 103.606 -            return null;
 103.607 -        }
 103.608 -
 103.609 -        public Void visitAnnotation(AnnotationMirror a, Void p) {
 103.610 -            File f = builder.folder(annotationFolder.getPath() + "/" + attrName);
 103.611 -            
 103.612 -            dumpAnnotation(builder, f, errElement, a, false);
 103.613 -
 103.614 -            f.write();
 103.615 -            return null;
 103.616 -        }
 103.617 -
 103.618 -        public Void visitArray(List<? extends AnnotationValue> vals, Void p) {
 103.619 -            File arr = builder.folder(annotationFolder.getPath() + "/" + attrName);
 103.620 -            int c = 0;
 103.621 -
 103.622 -            for (AnnotationValue av : vals) {
 103.623 -                av.accept(new DumpAnnotationValue(builder, arr, "item" + c, errElement, errAnnotationMirror, av), null);
 103.624 -                c++;
 103.625 -            }
 103.626 -
 103.627 -            arr.write();
 103.628 -
 103.629 -            return null;
 103.630 -        }
 103.631 -    }
 103.632 -    
 103.633 -    @SuppressWarnings("unchecked")
 103.634 -    private static <T extends Throwable> void rethrowAsRuntime(Throwable t) throws T {
 103.635 -        throw (T) t;
 103.636 -    }
 103.637 -
 103.638 -}
   104.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/BooleanOption.java	Sun Jan 08 20:10:08 2017 +0100
   104.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.3 @@ -1,87 +0,0 @@
   104.4 -/*
   104.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   104.6 - *
   104.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
   104.8 - *
   104.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  104.10 - * Other names may be trademarks of their respective owners.
  104.11 - *
  104.12 - * The contents of this file are subject to the terms of either the GNU
  104.13 - * General Public License Version 2 only ("GPL") or the Common
  104.14 - * Development and Distribution License("CDDL") (collectively, the
  104.15 - * "License"). You may not use this file except in compliance with the
  104.16 - * License. You can obtain a copy of the License at
  104.17 - * http://www.netbeans.org/cddl-gplv2.html
  104.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  104.19 - * specific language governing permissions and limitations under the
  104.20 - * License.  When distributing the software, include this License Header
  104.21 - * Notice in each file and include the License file at
  104.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  104.23 - * particular file as subject to the "Classpath" exception as provided
  104.24 - * by Oracle in the GPL Version 2 section of the License file that
  104.25 - * accompanied this code. If applicable, add the following below the
  104.26 - * License Header, with the fields enclosed by brackets [] replaced by
  104.27 - * your own identifying information:
  104.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  104.29 - *
  104.30 - * If you wish your version of this file to be governed by only the CDDL
  104.31 - * or only the GPL Version 2, indicate your decision by adding
  104.32 - * "[Contributor] elects to include this software in this distribution
  104.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  104.34 - * single choice of license, a recipient has the option to distribute
  104.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  104.36 - * to extend the choice of license to its licensees as provided above.
  104.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  104.38 - * Version 2 license, then the option applies only if the new code is
  104.39 - * made subject to such option by the copyright holder.
  104.40 - *
  104.41 - * Contributor(s):
  104.42 - *
  104.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
  104.44 - */
  104.45 -package org.netbeans.spi.java.hints;
  104.46 -
  104.47 -import java.lang.annotation.ElementType;
  104.48 -import java.lang.annotation.Retention;
  104.49 -import java.lang.annotation.RetentionPolicy;
  104.50 -import java.lang.annotation.Target;
  104.51 -import java.util.prefs.Preferences;
  104.52 -
  104.53 -/**Specify an option that affects the way the hint works.
  104.54 - *
  104.55 - * Only {@code static final String} compile-time constant can be marked with this
  104.56 - * annotation. The value of the constant will be used as the key to the hint's {@link Preferences}.
  104.57 - *
  104.58 - * For hints that consist of a class, all options that are directly enclosed in the class
  104.59 - * will be used in their source order.
  104.60 - *
  104.61 - * For hints that consist of a single method, use {@link UseOptions} to specify which options
  104.62 - * from the enclosing class should be used. The order of the options will be the order in which
  104.63 - * they appear in the source code of the enclosing class.
  104.64 - *
  104.65 - * The customizer will be generated automatically when {@link BooleanOption} is used.
  104.66 - *
  104.67 - * Two keys need to be defined in the corresponding {@code Bundle.properties}:
  104.68 - * {@code LBL_<class-fqn>.<field_name>}, which will be used as the display name of
  104.69 - * the corresponding checkbox in the customizer, and {@code TP_<class-fqn>.<field_name>}
  104.70 - * which will be used as the tooltip of the checkbox.
  104.71 - *
  104.72 - * @author lahvac
  104.73 - */
  104.74 -@Retention(RetentionPolicy.SOURCE)
  104.75 -@Target(ElementType.FIELD)
  104.76 -public @interface BooleanOption {
  104.77 -
  104.78 -    /**The options' display name. Will be used as the display name of the
  104.79 -     * checkbox in the customizer.
  104.80 -     */
  104.81 -    public String displayName();
  104.82 -    /**The tooltip of the checkbox in the customizer.
  104.83 -     */
  104.84 -    public String tooltip();
  104.85 -    
  104.86 -    /**The default value of the option.
  104.87 -     */
  104.88 -    public boolean defaultValue();
  104.89 -    
  104.90 -}
   105.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   105.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   105.3 @@ -1,48 +0,0 @@
   105.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   105.5 -#
   105.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   105.7 -#
   105.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   105.9 -# Other names may be trademarks of their respective owners.
  105.10 -#
  105.11 -# The contents of this file are subject to the terms of either the GNU
  105.12 -# General Public License Version 2 only ("GPL") or the Common
  105.13 -# Development and Distribution License("CDDL") (collectively, the
  105.14 -# "License"). You may not use this file except in compliance with the
  105.15 -# License. You can obtain a copy of the License at
  105.16 -# http://www.netbeans.org/cddl-gplv2.html
  105.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  105.18 -# specific language governing permissions and limitations under the
  105.19 -# License.  When distributing the software, include this License Header
  105.20 -# Notice in each file and include the License file at
  105.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  105.22 -# particular file as subject to the "Classpath" exception as provided
  105.23 -# by Oracle in the GPL Version 2 section of the License file that
  105.24 -# accompanied this code. If applicable, add the following below the
  105.25 -# License Header, with the fields enclosed by brackets [] replaced by
  105.26 -# your own identifying information:
  105.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  105.28 -#
  105.29 -# Contributor(s):
  105.30 -#
  105.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  105.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  105.33 -# Microsystems, Inc. All Rights Reserved.
  105.34 -#
  105.35 -# If you wish your version of this file to be governed by only the CDDL
  105.36 -# or only the GPL Version 2, indicate your decision by adding
  105.37 -# "[Contributor] elects to include this software in this distribution
  105.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  105.39 -# single choice of license, a recipient has the option to distribute
  105.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  105.41 -# to extend the choice of license to its licensees as provided above.
  105.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  105.43 -# Version 2 license, then the option applies only if the new code is
  105.44 -# made subject to such option by the copyright holder.
  105.45 -#{0}: hint/suggestion name
  105.46 -FIX_DisableHint=Disable "{0}" Hint
  105.47 -FIX_ConfigureHint=Configure "{0}" Hint
  105.48 -FIX_DisableSuggestion=Disable "{0}" Suggestion
  105.49 -FIX_ConfigureSuggestion=Configure "{0}" Suggestion
  105.50 -#{0}: Key of the warning
  105.51 -LBL_FIX_Suppress_Waning=Suppress Warning - {0}
   106.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/ConstraintVariableType.java	Sun Jan 08 20:10:08 2017 +0100
   106.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   106.3 @@ -1,73 +0,0 @@
   106.4 -/*
   106.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   106.6 - *
   106.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   106.8 - *
   106.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  106.10 - * Other names may be trademarks of their respective owners.
  106.11 - *
  106.12 - * The contents of this file are subject to the terms of either the GNU
  106.13 - * General Public License Version 2 only ("GPL") or the Common
  106.14 - * Development and Distribution License("CDDL") (collectively, the
  106.15 - * "License"). You may not use this file except in compliance with the
  106.16 - * License. You can obtain a copy of the License at
  106.17 - * http://www.netbeans.org/cddl-gplv2.html
  106.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  106.19 - * specific language governing permissions and limitations under the
  106.20 - * License.  When distributing the software, include this License Header
  106.21 - * Notice in each file and include the License file at
  106.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  106.23 - * particular file as subject to the "Classpath" exception as provided
  106.24 - * by Oracle in the GPL Version 2 section of the License file that
  106.25 - * accompanied this code. If applicable, add the following below the
  106.26 - * License Header, with the fields enclosed by brackets [] replaced by
  106.27 - * your own identifying information:
  106.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  106.29 - *
  106.30 - * If you wish your version of this file to be governed by only the CDDL
  106.31 - * or only the GPL Version 2, indicate your decision by adding
  106.32 - * "[Contributor] elects to include this software in this distribution
  106.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  106.34 - * single choice of license, a recipient has the option to distribute
  106.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  106.36 - * to extend the choice of license to its licensees as provided above.
  106.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  106.38 - * Version 2 license, then the option applies only if the new code is
  106.39 - * made subject to such option by the copyright holder.
  106.40 - *
  106.41 - * Contributor(s):
  106.42 - *
  106.43 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
  106.44 - */
  106.45 -
  106.46 -package org.netbeans.spi.java.hints;
  106.47 -
  106.48 -import java.lang.annotation.Target;
  106.49 -
  106.50 -/**Specifies a type of a variable. During the matching process, only those
  106.51 - * sections of the source code that have the given type are considered.
  106.52 - *
  106.53 - * @author Jan Lahoda
  106.54 - */
  106.55 -@Target({})
  106.56 -public @interface ConstraintVariableType {
  106.57 -
  106.58 -    /**Variable name, must start with the dollar sign (<code>$</code>).
  106.59 -     * Variable<code>$this</code> is automatically bound to the current class.
  106.60 -     */
  106.61 -    public String variable();
  106.62 -
  106.63 -    /**The required type of the section of source code. The value must be a type
  106.64 -     * per JLS 4.1, i.e. a primitive type (JLS 4.2), or a reference type (JLS 4.3).
  106.65 -     * All elements of the type must be resolvable when written to any Java file,
  106.66 -     * they may not contain e.g. references to type variables, simple names, etc.
  106.67 -     *
  106.68 -     * The type may include any actual type arguments, including wildcard.
  106.69 -     *
  106.70 -     * While matching, the type of the tree that corresponds to the variable in
  106.71 -     * the actual occurrence candidate is accepted if it is assignable into the
  106.72 -     * variable defined by the attribute.
  106.73 -     */
  106.74 -    public String type();
  106.75 -    
  106.76 -}
   107.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/CustomizerProvider.java	Sun Jan 08 20:10:08 2017 +0100
   107.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   107.3 @@ -1,66 +0,0 @@
   107.4 -/*
   107.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   107.6 - *
   107.7 - * Copyright 2010-2012 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):
  107.42 - *
  107.43 - * Portions Copyrighted 2010-2012 Sun Microsystems, Inc.
  107.44 - */
  107.45 -
  107.46 -package org.netbeans.spi.java.hints;
  107.47 -
  107.48 -import java.util.prefs.Preferences;
  107.49 -import javax.swing.JComponent;
  107.50 -import org.netbeans.api.annotations.common.NonNull;
  107.51 -
  107.52 -/**A factory for hint customizer.
  107.53 - *
  107.54 - * @author lahvac
  107.55 - */
  107.56 -public interface CustomizerProvider {
  107.57 -
  107.58 -    /**Create a customizer component. The hint settings are in the given
  107.59 -     * {@link Preferences}. The customizer can write into the provided {@link Preferences}
  107.60 -     * immediately, the values will be persisted or rolled-back automatically
  107.61 -     * based on the user's gesture.
  107.62 -     *
  107.63 -     * @param prefs the hints preferences from which the data to show should be read,
  107.64 -     *              and to which the new settings should be written
  107.65 -     * @return a customizer component
  107.66 -     */
  107.67 -    public @NonNull JComponent getCustomizer(@NonNull Preferences prefs);
  107.68 -
  107.69 -}
   108.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/Decision.java	Sun Jan 08 20:10:08 2017 +0100
   108.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   108.3 @@ -1,106 +0,0 @@
   108.4 -/*
   108.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   108.6 - *
   108.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
   108.8 - *
   108.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  108.10 - * Other names may be trademarks of their respective owners.
  108.11 - *
  108.12 - * The contents of this file are subject to the terms of either the GNU
  108.13 - * General Public License Version 2 only ("GPL") or the Common
  108.14 - * Development and Distribution License("CDDL") (collectively, the
  108.15 - * "License"). You may not use this file except in compliance with the
  108.16 - * License. You can obtain a copy of the License at
  108.17 - * http://www.netbeans.org/cddl-gplv2.html
  108.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  108.19 - * specific language governing permissions and limitations under the
  108.20 - * License.  When distributing the software, include this License Header
  108.21 - * Notice in each file and include the License file at
  108.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  108.23 - * particular file as subject to the "Classpath" exception as provided
  108.24 - * by Oracle in the GPL Version 2 section of the License file that
  108.25 - * accompanied this code. If applicable, add the following below the
  108.26 - * License Header, with the fields enclosed by brackets [] replaced by
  108.27 - * your own identifying information:
  108.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  108.29 - *
  108.30 - * If you wish your version of this file to be governed by only the CDDL
  108.31 - * or only the GPL Version 2, indicate your decision by adding
  108.32 - * "[Contributor] elects to include this software in this distribution
  108.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  108.34 - * single choice of license, a recipient has the option to distribute
  108.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  108.36 - * to extend the choice of license to its licensees as provided above.
  108.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  108.38 - * Version 2 license, then the option applies only if the new code is
  108.39 - * made subject to such option by the copyright holder.
  108.40 - *
  108.41 - * Contributor(s):
  108.42 - *
  108.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
  108.44 - */
  108.45 -package org.netbeans.spi.java.hints;
  108.46 -
  108.47 -import java.util.ArrayList;
  108.48 -import java.util.HashMap;
  108.49 -import java.util.List;
  108.50 -import java.util.Map;
  108.51 -import org.netbeans.api.java.source.CompilationInfo;
  108.52 -import org.netbeans.api.java.source.TreePathHandle;
  108.53 -import org.openide.filesystems.FileObject;
  108.54 -
  108.55 -/**
  108.56 - *
  108.57 - * @author lahvac
  108.58 - */
  108.59 -public abstract class Decision<V, R> {
  108.60 -    
  108.61 -    /*XXX: should not be public*/public final TreePathHandle root;
  108.62 -    private final Map<FileObject, List<V>> file2Facts = new HashMap<FileObject, List<V>>();
  108.63 -
  108.64 -    protected Decision(TreePathHandle root) {
  108.65 -        this.root = root;
  108.66 -    }
  108.67 -    
  108.68 -    protected abstract R makeDecision(Iterable<? extends V> input);
  108.69 -    
  108.70 -    private R previousResult;
  108.71 -    
  108.72 -    /*XXX: should not be public*/public boolean makeDecision() {
  108.73 -        List<V> inputs = new ArrayList<V>();
  108.74 -        
  108.75 -        for (List<V> v : file2Facts.values()) {
  108.76 -            inputs.addAll(v);
  108.77 -        }
  108.78 -        
  108.79 -        R current = makeDecision(inputs);
  108.80 -        
  108.81 -        boolean changed = !(previousResult == null ? current == null : previousResult.equals(current));
  108.82 -        
  108.83 -        previousResult = current;
  108.84 -        
  108.85 -        return changed;
  108.86 -    }
  108.87 -    
  108.88 -    public R getCurrentResult() {
  108.89 -        return previousResult;
  108.90 -    }
  108.91 -    
  108.92 -    public void recordLocalFact(/*XXX: should not require the CompilationInfo!*/CompilationInfo info, V fact) {
  108.93 -        List<V> facts = file2Facts.get(info.getFileObject());
  108.94 -        
  108.95 -        if (facts == null) {
  108.96 -            file2Facts.put(info.getFileObject(), facts = new ArrayList<V>());
  108.97 -        }
  108.98 -        
  108.99 -        facts.add(fact);
 108.100 -    }
 108.101 -    
 108.102 -    public static abstract class Factory<V, R, DecisionImpl extends Decision<V, R>> {
 108.103 -        /*XXX: should not be public*/public final Class<DecisionImpl> decisionClass;
 108.104 -        public Factory(Class<DecisionImpl> decisionClass) {
 108.105 -            this.decisionClass = decisionClass;
 108.106 -        }
 108.107 -        public abstract DecisionImpl create(TreePathHandle handle);
 108.108 -    }
 108.109 -}
   109.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/ErrorDescriptionFactory.java	Sun Jan 08 20:10:08 2017 +0100
   109.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   109.3 @@ -1,619 +0,0 @@
   109.4 -/*
   109.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   109.6 - *
   109.7 - * Copyright 2008-2010 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):
  109.42 - *
  109.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  109.44 - */
  109.45 -
  109.46 -package org.netbeans.spi.java.hints;
  109.47 -
  109.48 -import com.sun.source.tree.BlockTree;
  109.49 -import com.sun.source.tree.ClassTree;
  109.50 -import com.sun.source.tree.LiteralTree;
  109.51 -import com.sun.source.tree.MemberSelectTree;
  109.52 -import com.sun.source.tree.MethodInvocationTree;
  109.53 -import com.sun.source.tree.MethodTree;
  109.54 -import com.sun.source.tree.ModifiersTree;
  109.55 -import com.sun.source.tree.StatementTree;
  109.56 -import com.sun.source.tree.Tree;
  109.57 -import com.sun.source.tree.Tree.Kind;
  109.58 -import com.sun.source.tree.VariableTree;
  109.59 -import com.sun.source.util.TreePath;
  109.60 -import java.io.IOException;
  109.61 -import java.util.Arrays;
  109.62 -import java.util.Collection;
  109.63 -import java.util.Collections;
  109.64 -import java.util.EnumSet;
  109.65 -import java.util.LinkedHashSet;
  109.66 -import java.util.LinkedList;
  109.67 -import java.util.List;
  109.68 -import java.util.Set;
  109.69 -import javax.lang.model.SourceVersion;
  109.70 -import javax.lang.model.element.TypeElement;
  109.71 -import javax.swing.SwingUtilities;
  109.72 -import org.netbeans.api.annotations.common.NonNull;
  109.73 -import org.netbeans.api.java.source.CompilationInfo;
  109.74 -import org.netbeans.api.java.source.GeneratorUtilities;
  109.75 -import org.netbeans.api.java.source.JavaSource;
  109.76 -import org.netbeans.api.java.source.JavaSource.Phase;
  109.77 -import org.netbeans.api.java.source.Task;
  109.78 -import org.netbeans.api.java.source.TreePathHandle;
  109.79 -import org.netbeans.api.java.source.WorkingCopy;
  109.80 -import org.netbeans.api.lexer.TokenSequence;
  109.81 -import org.netbeans.api.options.OptionsDisplayer;
  109.82 -import org.netbeans.modules.analysis.api.CodeAnalysis;
  109.83 -import org.netbeans.modules.analysis.spi.Analyzer.WarningDescription;
  109.84 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
  109.85 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata.Options;
  109.86 -import org.netbeans.modules.java.hints.spiimpl.Hacks.InspectAndTransformOpener;
  109.87 -import org.netbeans.modules.java.hints.spiimpl.SPIAccessor;
  109.88 -import org.netbeans.modules.java.hints.spiimpl.SyntheticFix;
  109.89 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
  109.90 -import org.netbeans.spi.editor.hints.ChangeInfo;
  109.91 -import org.netbeans.spi.editor.hints.EnhancedFix;
  109.92 -import org.netbeans.spi.editor.hints.ErrorDescription;
  109.93 -import org.netbeans.spi.editor.hints.Fix;
  109.94 -import org.netbeans.spi.editor.hints.LazyFixList;
  109.95 -import org.openide.filesystems.FileObject;
  109.96 -import org.openide.util.Lookup;
  109.97 -import org.openide.util.NbBundle;
  109.98 -import org.openide.util.NbBundle.Messages;
  109.99 -import org.openide.util.Parameters;
 109.100 -
 109.101 -/**
 109.102 - *
 109.103 - * @author Jan Lahoda
 109.104 - */
 109.105 -public class ErrorDescriptionFactory {
 109.106 -
 109.107 -    private ErrorDescriptionFactory() {
 109.108 -    }
 109.109 -
 109.110 -//    public static ErrorDescription forTree(HintContext context, String text, Fix... fixes) {
 109.111 -//        return forTree(context, context.getContext(), text, fixes);
 109.112 -//    }
 109.113 -
 109.114 -    public static ErrorDescription forTree(HintContext context, TreePath tree, String text, Fix... fixes) {
 109.115 -        return forTree(context, tree.getLeaf(), text, fixes);
 109.116 -    }
 109.117 -    
 109.118 -    public static ErrorDescription forTree(HintContext context, Tree tree, String text, Fix... fixes) {
 109.119 -        int start;
 109.120 -        int end;
 109.121 -
 109.122 -        if (context.getHintMetadata().kind == Hint.Kind.INSPECTION) {
 109.123 -            start = (int) context.getInfo().getTrees().getSourcePositions().getStartPosition(context.getInfo().getCompilationUnit(), tree);
 109.124 -            end = (int) context.getInfo().getTrees().getSourcePositions().getEndPosition(context.getInfo().getCompilationUnit(), tree);
 109.125 -        } else {
 109.126 -            start = end = context.getCaretLocation();
 109.127 -        }
 109.128 -
 109.129 -        if (start != (-1) && end != (-1)) {
 109.130 -            LazyFixList fixesForED = org.netbeans.spi.editor.hints.ErrorDescriptionFactory.lazyListForFixes(resolveDefaultFixes(context, fixes));
 109.131 -            return org.netbeans.spi.editor.hints.ErrorDescriptionFactory.createErrorDescription("text/x-java:" + context.getHintMetadata().id, context.getSeverity(), text, context.getHintMetadata().description, fixesForED, context.getInfo().getFileObject(), start, end);
 109.132 -        }
 109.133 -
 109.134 -        return null;
 109.135 -    }
 109.136 -    
 109.137 -    /**Create a new {@link ErrorDescription}. Severity is automatically inferred from the {@link HintContext},
 109.138 -     * and the {@link ErrorDescription} is created to be consistent with {@link ErrorDescription}s created
 109.139 -     * by the other factory methods in this class.
 109.140 -     * 
 109.141 -     * @param context from which the {@link Severity} and other properties are inferred.
 109.142 -     * @param start start of the warning
 109.143 -     * @param end end of the warning
 109.144 -     * @param text the warning text
 109.145 -     * @param fixes one or more {@link Fix}es to show shown to the user.
 109.146 -     * @return a standard {@link ErrorDescription} for use in Java source
 109.147 -     * @since 1.9
 109.148 -     */
 109.149 -    public static ErrorDescription forSpan(HintContext context, int start, int end, String text, Fix... fixes) {
 109.150 -        if (context.getHintMetadata().kind != Hint.Kind.INSPECTION) {
 109.151 -            start = end = context.getCaretLocation();
 109.152 -        }
 109.153 -
 109.154 -        if (start != (-1) && end != (-1)) {
 109.155 -            LazyFixList fixesForED = org.netbeans.spi.editor.hints.ErrorDescriptionFactory.lazyListForFixes(resolveDefaultFixes(context, fixes));
 109.156 -            return org.netbeans.spi.editor.hints.ErrorDescriptionFactory.createErrorDescription("text/x-java:" + context.getHintMetadata().id, context.getSeverity(), text, context.getHintMetadata().description, fixesForED, context.getInfo().getFileObject(), start, end);
 109.157 -        }
 109.158 -
 109.159 -        return null;
 109.160 -    }
 109.161 -    
 109.162 -    public static ErrorDescription forName(HintContext context, TreePath tree, String text, Fix... fixes) {
 109.163 -        return forName(context, tree.getLeaf(), text, fixes);
 109.164 -    }
 109.165 -
 109.166 -    public static ErrorDescription forName(HintContext context, Tree tree, String text, Fix... fixes) {
 109.167 -        int[] span;
 109.168 -        
 109.169 -        if (context.getHintMetadata().kind == Hint.Kind.INSPECTION) {
 109.170 -            span = computeNameSpan(tree, context);
 109.171 -        } else {
 109.172 -            span = new int[] {context.getCaretLocation(), context.getCaretLocation()};
 109.173 -        }
 109.174 -        
 109.175 -        if (span != null && span[0] != (-1) && span[1] != (-1)) {
 109.176 -            LazyFixList fixesForED = org.netbeans.spi.editor.hints.ErrorDescriptionFactory.lazyListForFixes(resolveDefaultFixes(context, fixes));
 109.177 -            return org.netbeans.spi.editor.hints.ErrorDescriptionFactory.createErrorDescription("text/x-java:" + context.getHintMetadata().id, context.getSeverity(), text, context.getHintMetadata().description, fixesForED, context.getInfo().getFileObject(), span[0], span[1]);
 109.178 -        }
 109.179 -
 109.180 -        return null;
 109.181 -    }
 109.182 -
 109.183 -    private static int[] computeNameSpan(Tree tree, HintContext context) {
 109.184 -        switch (tree.getKind()) {
 109.185 -            case METHOD:
 109.186 -                return context.getInfo().getTreeUtilities().findNameSpan((MethodTree) tree);
 109.187 -            case ANNOTATION_TYPE:
 109.188 -            case CLASS:
 109.189 -            case ENUM:
 109.190 -            case INTERFACE:
 109.191 -                return context.getInfo().getTreeUtilities().findNameSpan((ClassTree) tree);
 109.192 -            case VARIABLE:
 109.193 -                return context.getInfo().getTreeUtilities().findNameSpan((VariableTree) tree);
 109.194 -            case MEMBER_SELECT:
 109.195 -                //XXX:
 109.196 -                MemberSelectTree mst = (MemberSelectTree) tree;
 109.197 -                int[] span = context.getInfo().getTreeUtilities().findNameSpan(mst);
 109.198 -
 109.199 -                if (span == null) {
 109.200 -                    int end = (int) context.getInfo().getTrees().getSourcePositions().getEndPosition(context.getInfo().getCompilationUnit(), tree);
 109.201 -                    span = new int[] {end - mst.getIdentifier().length(), end};
 109.202 -                }
 109.203 -                return span;
 109.204 -            case METHOD_INVOCATION:
 109.205 -                return computeNameSpan(((MethodInvocationTree) tree).getMethodSelect(), context);
 109.206 -            case BLOCK:
 109.207 -                Collection<? extends TreePath> prefix = context.getMultiVariables().get("$$1$");
 109.208 -                
 109.209 -                if (prefix != null) {
 109.210 -                    BlockTree bt = (BlockTree) tree;
 109.211 -                    
 109.212 -                    if (bt.getStatements().size() > prefix.size()) {
 109.213 -                        return computeNameSpan(bt.getStatements().get(prefix.size()), context);
 109.214 -                    }
 109.215 -                }
 109.216 -            default:
 109.217 -                int start = (int) context.getInfo().getTrees().getSourcePositions().getStartPosition(context.getInfo().getCompilationUnit(), tree);
 109.218 -                if (    StatementTree.class.isAssignableFrom(tree.getKind().asInterface())
 109.219 -                    && tree.getKind() != Kind.EXPRESSION_STATEMENT
 109.220 -                    && tree.getKind() != Kind.BLOCK) {
 109.221 -                    TokenSequence<?> ts = context.getInfo().getTokenHierarchy().tokenSequence();
 109.222 -                    ts.move(start);
 109.223 -                    if (ts.moveNext()) {
 109.224 -                        return new int[] {ts.offset(), ts.offset() + ts.token().length()};
 109.225 -                    }
 109.226 -                }
 109.227 -                return new int[] {
 109.228 -                    start,
 109.229 -                    (int) context.getInfo().getTrees().getSourcePositions().getEndPosition(context.getInfo().getCompilationUnit(), tree),
 109.230 -                };
 109.231 -        }
 109.232 -    }
 109.233 -
 109.234 -    static List<Fix> resolveDefaultFixes(HintContext ctx, Fix... provided) {
 109.235 -        List<Fix> auxiliaryFixes = new LinkedList<Fix>();
 109.236 -        HintMetadata hm = SPIAccessor.getINSTANCE().getHintMetadata(ctx);
 109.237 -
 109.238 -        if (hm != null) {
 109.239 -            Set<String> suppressWarningsKeys = new LinkedHashSet<String>();
 109.240 -
 109.241 -            for (String key : hm.suppressWarnings) {
 109.242 -                if (key == null || key.length() == 0) {
 109.243 -                    break;
 109.244 -                }
 109.245 -
 109.246 -                suppressWarningsKeys.add(key);
 109.247 -            }
 109.248 -
 109.249 -
 109.250 -            auxiliaryFixes.add(new DisableConfigure(hm, true, SPIAccessor.getINSTANCE().getHintSettings(ctx)));
 109.251 -            auxiliaryFixes.add(new DisableConfigure(hm, false, null));
 109.252 -
 109.253 -            if (hm.kind == Hint.Kind.INSPECTION) {
 109.254 -                auxiliaryFixes.add(new InspectFix(hm, false));
 109.255 -                if (!hm.options.contains(Options.QUERY)) {
 109.256 -                    auxiliaryFixes.add(new InspectFix(hm, true));
 109.257 -                }
 109.258 -            }
 109.259 -            
 109.260 -            if (!suppressWarningsKeys.isEmpty()) {
 109.261 -                auxiliaryFixes.addAll(createSuppressWarnings(ctx.getInfo(), ctx.getPath(), suppressWarningsKeys.toArray(new String[0])));
 109.262 -            }
 109.263 -
 109.264 -            List<Fix> result = new LinkedList<Fix>();
 109.265 -
 109.266 -            for (Fix f : provided != null ? provided : new Fix[0]) {
 109.267 -                if (f == null) continue;
 109.268 -                
 109.269 -                result.add(org.netbeans.spi.editor.hints.ErrorDescriptionFactory.attachSubfixes(f, auxiliaryFixes));
 109.270 -            }
 109.271 -
 109.272 -            if (result.isEmpty()) {
 109.273 -                result.add(org.netbeans.spi.editor.hints.ErrorDescriptionFactory.attachSubfixes(new TopLevelConfigureFix(hm), auxiliaryFixes));
 109.274 -            }
 109.275 -
 109.276 -            return result;
 109.277 -        }
 109.278 -
 109.279 -        return Arrays.asList(provided);
 109.280 -    }
 109.281 -
 109.282 -    private static class DisableConfigure implements Fix, SyntheticFix {
 109.283 -        private final @NonNull HintMetadata metadata;
 109.284 -        private final boolean disable;
 109.285 -        private final HintsSettings hintsSettings;
 109.286 -
 109.287 -        DisableConfigure(@NonNull HintMetadata metadata, boolean disable, HintsSettings hintsSettings) {
 109.288 -            this.metadata = metadata;
 109.289 -            this.disable = disable;
 109.290 -            this.hintsSettings = hintsSettings;
 109.291 -        }
 109.292 -
 109.293 -        @Override
 109.294 -        public String getText() {
 109.295 -            String displayName = metadata.displayName;
 109.296 -            String key;
 109.297 -            switch (metadata.kind) {
 109.298 -                case INSPECTION:
 109.299 -                    key = disable ? "FIX_DisableHint" : "FIX_ConfigureHint";
 109.300 -                    break;
 109.301 -                case ACTION:
 109.302 -                    key = disable ? "FIX_DisableSuggestion" : "FIX_ConfigureSuggestion";
 109.303 -                    break;
 109.304 -                default:
 109.305 -                    throw new IllegalStateException();
 109.306 -            }
 109.307 -
 109.308 -            return NbBundle.getMessage(ErrorDescriptionFactory.class, key, displayName);
 109.309 -        }
 109.310 -
 109.311 -        @Override
 109.312 -        public ChangeInfo implement() throws Exception {
 109.313 -            if (disable) {
 109.314 -                hintsSettings.setEnabled(metadata, false);
 109.315 -                //XXX: re-run hints task
 109.316 -            } else {
 109.317 -                OptionsDisplayer.getDefault().open("Editor/Hints/text/x-java/" + metadata.id);
 109.318 -            }
 109.319 -
 109.320 -            return null;
 109.321 -        }
 109.322 -
 109.323 -        @Override
 109.324 -        public boolean equals(Object obj) {
 109.325 -            if (obj == null) {
 109.326 -                return false;
 109.327 -            }
 109.328 -            if (this.getClass() != obj.getClass()) {
 109.329 -                return false;
 109.330 -            }
 109.331 -            final DisableConfigure other = (DisableConfigure) obj;
 109.332 -            if (this.metadata != other.metadata && (this.metadata == null || !this.metadata.equals(other.metadata))) {
 109.333 -                return false;
 109.334 -            }
 109.335 -            if (this.disable != other.disable) {
 109.336 -                return false;
 109.337 -            }
 109.338 -            return true;
 109.339 -        }
 109.340 -
 109.341 -        @Override
 109.342 -        public int hashCode() {
 109.343 -            int hash = 7;
 109.344 -            hash = 43 * hash + (this.metadata != null ? this.metadata.hashCode() : 0);
 109.345 -            hash = 43 * hash + (this.disable ? 1 : 0);
 109.346 -            return hash;
 109.347 -        }
 109.348 -
 109.349 -
 109.350 -    }
 109.351 -
 109.352 -    private static final class TopLevelConfigureFix extends DisableConfigure implements EnhancedFix {
 109.353 -
 109.354 -        public TopLevelConfigureFix(@NonNull HintMetadata metadata) {
 109.355 -            super(metadata, false, null);
 109.356 -        }
 109.357 -
 109.358 -        @Override
 109.359 -        public CharSequence getSortText() {
 109.360 -            return "\uFFFFzz";
 109.361 -        }
 109.362 -        
 109.363 -    }
 109.364 -
 109.365 -    private static class InspectFix implements Fix, SyntheticFix {
 109.366 -        private final @NonNull HintMetadata metadata;
 109.367 -        private final boolean transform;
 109.368 -
 109.369 -        InspectFix(@NonNull HintMetadata metadata, boolean transform) {
 109.370 -            this.metadata = metadata;
 109.371 -            this.transform = transform;
 109.372 -        }
 109.373 -
 109.374 -        @Override
 109.375 -        @Messages({
 109.376 -            "DN_InspectAndTransform=Run Inspect&Transform on...",
 109.377 -            "DN_Inspect=Run Inspect on..."
 109.378 -        })
 109.379 -        public String getText() {
 109.380 -            return transform ? Bundle.DN_InspectAndTransform() : Bundle.DN_Inspect();
 109.381 -        }
 109.382 -
 109.383 -        @Override
 109.384 -        public ChangeInfo implement() throws Exception {
 109.385 -            SwingUtilities.invokeLater(new Runnable() {
 109.386 -                @Override
 109.387 -                public void run() {
 109.388 -                    if (transform) {
 109.389 -                        final InspectAndTransformOpener o = Lookup.getDefault().lookup(InspectAndTransformOpener.class);
 109.390 -
 109.391 -                        if (o != null) {
 109.392 -                            o.openIAT(metadata);
 109.393 -                        } else {
 109.394 -                            //warn
 109.395 -                        }
 109.396 -                    } else {
 109.397 -                        CodeAnalysis.open(WarningDescription.create("text/x-java:" + metadata.id, null, null, null));
 109.398 -                    }
 109.399 -                }
 109.400 -            });
 109.401 -            
 109.402 -            return null;
 109.403 -        }
 109.404 -
 109.405 -        @Override
 109.406 -        public boolean equals(Object obj) {
 109.407 -            if (obj == null) {
 109.408 -                return false;
 109.409 -            }
 109.410 -            if (this.getClass() != obj.getClass()) {
 109.411 -                return false;
 109.412 -            }
 109.413 -            final InspectFix other = (InspectFix) obj;
 109.414 -            if (this.metadata != other.metadata && (this.metadata == null || !this.metadata.equals(other.metadata))) {
 109.415 -                return false;
 109.416 -            }
 109.417 -            if (this.transform != other.transform) {
 109.418 -                return false;
 109.419 -            }
 109.420 -            return true;
 109.421 -        }
 109.422 -
 109.423 -        @Override
 109.424 -        public int hashCode() {
 109.425 -            int hash = 7;
 109.426 -            hash = 43 * hash + (this.metadata != null ? this.metadata.hashCode() : 0);
 109.427 -            hash = 43 * hash + (this.transform ? 1 : 0);
 109.428 -            return hash;
 109.429 -        }
 109.430 -
 109.431 -
 109.432 -    }
 109.433 -    
 109.434 -    /** Creates a fix, which when invoked adds @SuppresWarnings(keys) to
 109.435 -     * nearest declaration.
 109.436 -     * @param compilationInfo CompilationInfo to work on
 109.437 -     * @param treePath TreePath to a tree. The method will find nearest outer
 109.438 -     *        declaration. (type, method, field or local variable)
 109.439 -     * @param keys keys to be contained in the SuppresWarnings annotation. E.g.
 109.440 -     *        @SuppresWarnings( "key" ) or @SuppresWarnings( {"key1", "key2", ..., "keyN" } ).
 109.441 -     * @throws IllegalArgumentException if keys are null or empty or id no suitable element
 109.442 -     *         to put the annotation on is found (e.g. if TreePath to CompilationUnit is given")
 109.443 -     */
 109.444 -    static Fix createSuppressWarningsFix(CompilationInfo compilationInfo, TreePath treePath, String... keys ) {
 109.445 -        Parameters.notNull("compilationInfo", compilationInfo);
 109.446 -        Parameters.notNull("treePath", treePath);
 109.447 -        Parameters.notNull("keys", keys);
 109.448 -
 109.449 -        if (keys.length == 0) {
 109.450 -            throw new IllegalArgumentException("key must not be empty"); // NOI18N
 109.451 -        }
 109.452 -
 109.453 -        if (!isSuppressWarningsSupported(compilationInfo)) {
 109.454 -            return null;
 109.455 -        }
 109.456 -
 109.457 -        while (treePath.getLeaf().getKind() != Kind.COMPILATION_UNIT && !DECLARATION.contains(treePath.getLeaf().getKind())) {
 109.458 -            treePath = treePath.getParentPath();
 109.459 -        }
 109.460 -
 109.461 -        if (treePath.getLeaf().getKind() != Kind.COMPILATION_UNIT) {
 109.462 -            return new FixImpl(TreePathHandle.create(treePath, compilationInfo), compilationInfo.getFileObject(), keys);
 109.463 -        } else {
 109.464 -            return null;
 109.465 -        }
 109.466 -    }
 109.467 -
 109.468 -    /** Creates a fix, which when invoked adds @SuppresWarnings(keys) to
 109.469 -     * nearest declaration.
 109.470 -     * @param compilationInfo CompilationInfo to work on
 109.471 -     * @param treePath TreePath to a tree. The method will find nearest outer
 109.472 -     *        declaration. (type, method, field or local variable)
 109.473 -     * @param keys keys to be contained in the SuppresWarnings annotation. E.g.
 109.474 -     *        @SuppresWarnings( "key" ) or @SuppresWarnings( {"key1", "key2", ..., "keyN" } ).
 109.475 -     * @throws IllegalArgumentException if keys are null or empty or id no suitable element
 109.476 -     *         to put the annotation on is found (e.g. if TreePath to CompilationUnit is given")
 109.477 -     */
 109.478 -    static List<Fix> createSuppressWarnings(CompilationInfo compilationInfo, TreePath treePath, String... keys ) {
 109.479 -        Parameters.notNull("compilationInfo", compilationInfo);
 109.480 -        Parameters.notNull("treePath", treePath);
 109.481 -        Parameters.notNull("keys", keys);
 109.482 -
 109.483 -        if (keys.length == 0) {
 109.484 -            throw new IllegalArgumentException("key must not be empty"); // NOI18N
 109.485 -        }
 109.486 -
 109.487 -        Fix f = createSuppressWarningsFix(compilationInfo, treePath, keys);
 109.488 -
 109.489 -        if (f != null) {
 109.490 -            return Collections.<Fix>singletonList(f);
 109.491 -        } else {
 109.492 -            return Collections.emptyList();
 109.493 -        }
 109.494 -    }
 109.495 -
 109.496 -    private static boolean isSuppressWarningsSupported(CompilationInfo info) {
 109.497 -        //cannot suppress if there is no SuppressWarnings annotation in the platform:
 109.498 -        if (info.getElements().getTypeElement("java.lang.SuppressWarnings") == null)
 109.499 -            return false;
 109.500 -
 109.501 -        return info.getSourceVersion().compareTo(SourceVersion.RELEASE_5) >= 0;
 109.502 -    }
 109.503 -
 109.504 -    private static final Set<Kind> DECLARATION = EnumSet.of(Kind.ANNOTATION_TYPE, Kind.CLASS, Kind.ENUM, Kind.INTERFACE, Kind.METHOD, Kind.VARIABLE);
 109.505 -
 109.506 -    private static final class FixImpl implements Fix, SyntheticFix {
 109.507 -
 109.508 -        private String keys[];
 109.509 -        private TreePathHandle handle;
 109.510 -        private FileObject file;
 109.511 -
 109.512 -        public FixImpl(TreePathHandle handle, FileObject file, String... keys) {
 109.513 -            this.keys = keys;
 109.514 -            this.handle = handle;
 109.515 -            this.file = file;
 109.516 -        }
 109.517 -
 109.518 -        public String getText() {
 109.519 -            StringBuilder keyNames = new StringBuilder();
 109.520 -            for (int i = 0; i < keys.length; i++) {
 109.521 -                String string = keys[i];
 109.522 -                keyNames.append(string);
 109.523 -                if ( i < keys.length - 1) {
 109.524 -                    keyNames.append(", "); // NOI18N
 109.525 -                }
 109.526 -            }
 109.527 -
 109.528 -            return NbBundle.getMessage(ErrorDescriptionFactory.class, "LBL_FIX_Suppress_Waning",  keyNames.toString() );  // NOI18N
 109.529 -        }
 109.530 -
 109.531 -        public ChangeInfo implement() throws IOException {
 109.532 -            JavaSource js = JavaSource.forFileObject(file);
 109.533 -
 109.534 -            js.runModificationTask(new Task<WorkingCopy>() {
 109.535 -                public void run(WorkingCopy copy) throws IOException {
 109.536 -                    copy.toPhase(Phase.RESOLVED); //XXX: performance
 109.537 -                    TreePath path = handle.resolve(copy);
 109.538 -
 109.539 -                    while (path != null && path.getLeaf().getKind() != Kind.COMPILATION_UNIT && !DECLARATION.contains(path.getLeaf().getKind())) {
 109.540 -                        path = path.getParentPath();
 109.541 -                    }
 109.542 -
 109.543 -                    if (path.getLeaf().getKind() == Kind.COMPILATION_UNIT) {
 109.544 -                        return ;
 109.545 -                    }
 109.546 -
 109.547 -                    Tree top = path.getLeaf();
 109.548 -                    ModifiersTree modifiers = null;
 109.549 -
 109.550 -                    switch (top.getKind()) {
 109.551 -                        case ANNOTATION_TYPE:
 109.552 -                        case CLASS:
 109.553 -                        case ENUM:
 109.554 -                        case INTERFACE:
 109.555 -                            modifiers = ((ClassTree) top).getModifiers();
 109.556 -                            break;
 109.557 -                        case METHOD:
 109.558 -                            modifiers = ((MethodTree) top).getModifiers();
 109.559 -                            break;
 109.560 -                        case VARIABLE:
 109.561 -                            modifiers = ((VariableTree) top).getModifiers();
 109.562 -                            break;
 109.563 -                        default: assert false : "Unhandled Tree.Kind";  // NOI18N
 109.564 -                    }
 109.565 -
 109.566 -                    if (modifiers == null) {
 109.567 -                        return ;
 109.568 -                    }
 109.569 -
 109.570 -                    TypeElement el = copy.getElements().getTypeElement("java.lang.SuppressWarnings");  // NOI18N
 109.571 -
 109.572 -                    if (el == null) {
 109.573 -                        return ;
 109.574 -                    }
 109.575 -
 109.576 -                    LiteralTree[] keyLiterals = new LiteralTree[keys.length];
 109.577 -
 109.578 -                    for (int i = 0; i < keys.length; i++) {
 109.579 -                        keyLiterals[i] = copy.getTreeMaker().
 109.580 -                                Literal(keys[i]);
 109.581 -                    }
 109.582 -
 109.583 -                    ModifiersTree nueMods = GeneratorUtilities.get(copy).appendToAnnotationValue(modifiers, el, "value", keyLiterals);
 109.584 -
 109.585 -                    copy.rewrite(modifiers, nueMods);
 109.586 -                }
 109.587 -            }).commit();
 109.588 -
 109.589 -            return null;
 109.590 -        }
 109.591 -
 109.592 -        @Override
 109.593 -        public boolean equals(Object obj) {
 109.594 -            if (obj == null) {
 109.595 -                return false;
 109.596 -            }
 109.597 -            if (getClass() != obj.getClass()) {
 109.598 -                return false;
 109.599 -            }
 109.600 -            final FixImpl other = (FixImpl) obj;
 109.601 -            if (!Arrays.deepEquals(this.keys, other.keys)) {
 109.602 -                return false;
 109.603 -            }
 109.604 -            if (this.handle != other.handle && (this.handle == null || !this.handle.equals(other.handle))) {
 109.605 -                return false;
 109.606 -            }
 109.607 -            if (this.file != other.file && (this.file == null || !this.file.equals(other.file))) {
 109.608 -                return false;
 109.609 -            }
 109.610 -            return true;
 109.611 -        }
 109.612 -
 109.613 -        @Override
 109.614 -        public int hashCode() {
 109.615 -            int hash = 5;
 109.616 -            hash = 79 * hash + Arrays.deepHashCode(this.keys);
 109.617 -            hash = 79 * hash + (this.handle != null ? this.handle.hashCode() : 0);
 109.618 -            hash = 79 * hash + (this.file != null ? this.file.hashCode() : 0);
 109.619 -            return hash;
 109.620 -        }
 109.621 -    }
 109.622 -}
   110.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/Hint.java	Sun Jan 08 20:10:08 2017 +0100
   110.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   110.3 @@ -1,128 +0,0 @@
   110.4 -/*
   110.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   110.6 - *
   110.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   110.8 - *
   110.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  110.10 - * Other names may be trademarks of their respective owners.
  110.11 - *
  110.12 - * The contents of this file are subject to the terms of either the GNU
  110.13 - * General Public License Version 2 only ("GPL") or the Common
  110.14 - * Development and Distribution License("CDDL") (collectively, the
  110.15 - * "License"). You may not use this file except in compliance with the
  110.16 - * License. You can obtain a copy of the License at
  110.17 - * http://www.netbeans.org/cddl-gplv2.html
  110.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  110.19 - * specific language governing permissions and limitations under the
  110.20 - * License.  When distributing the software, include this License Header
  110.21 - * Notice in each file and include the License file at
  110.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  110.23 - * particular file as subject to the "Classpath" exception as provided
  110.24 - * by Oracle in the GPL Version 2 section of the License file that
  110.25 - * accompanied this code. If applicable, add the following below the
  110.26 - * License Header, with the fields enclosed by brackets [] replaced by
  110.27 - * your own identifying information:
  110.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  110.29 - *
  110.30 - * If you wish your version of this file to be governed by only the CDDL
  110.31 - * or only the GPL Version 2, indicate your decision by adding
  110.32 - * "[Contributor] elects to include this software in this distribution
  110.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  110.34 - * single choice of license, a recipient has the option to distribute
  110.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  110.36 - * to extend the choice of license to its licensees as provided above.
  110.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  110.38 - * Version 2 license, then the option applies only if the new code is
  110.39 - * made subject to such option by the copyright holder.
  110.40 - *
  110.41 - * Contributor(s):
  110.42 - *
  110.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  110.44 - */
  110.45 -
  110.46 -package org.netbeans.spi.java.hints;
  110.47 -
  110.48 -import java.lang.annotation.ElementType;
  110.49 -import java.lang.annotation.Retention;
  110.50 -import java.lang.annotation.RetentionPolicy;
  110.51 -import java.lang.annotation.Target;
  110.52 -import org.netbeans.spi.editor.hints.Severity;
  110.53 -
  110.54 -/** Description of a hint.
  110.55 - * When applied to a class, any enclosed method marked with a trigger
  110.56 - * will be considered to be part of this hint. When applied to a method, only this specific
  110.57 - * method will be considered to the part of the hint.
  110.58 - * Currently recognized triggers include {@link TriggerPattern} and {@link TriggerTreeKind}.
  110.59 - * @author lahvac, Petr Hrebejk
  110.60 - */
  110.61 -@Target({ElementType.TYPE, ElementType.METHOD})
  110.62 -@Retention(RetentionPolicy.SOURCE)
  110.63 -public @interface Hint {
  110.64 -    /**Manually specify the hint's id. Use only reorganizing code to keep compatibility with settings
  110.65 -     * from previous version. Id will be generated automatically is not specified.
  110.66 -     */
  110.67 -    public String id() default "";
  110.68 -    /** The hint's display name.
  110.69 -     */
  110.70 -    public String displayName();
  110.71 -    /** The hint's long description.
  110.72 -     */
  110.73 -    public String description();
  110.74 -    /**Category where the hint belongs.
  110.75 -     */
  110.76 -    public String category();
  110.77 -    /**Should the hint be enabled by default?*/
  110.78 -    public boolean enabled() default true;
  110.79 -    /**Default severity of the hint. {@link Severity#HINT} will typically be shown
  110.80 -     * only on the line with the caret.*/
  110.81 -    public Severity severity() default Severity.VERIFIER;
  110.82 -    /**Suppress warnings keys that should automatically suppress the hint.*/
  110.83 -    public String[] suppressWarnings() default {};
  110.84 -    /**A customizer that allows to customize hint's preferences.
  110.85 -     */
  110.86 -    public Class<? extends CustomizerProvider> customizerProvider() default CustomizerProvider.class;
  110.87 -    /**Whether the hint should be considered an {@link Kind#INSPECTION inspection}, i.e. it detects a code smell,
  110.88 -     * or otherwise leads to improving the code, or a {@link Kind#SUGGESTION}, which is simply
  110.89 -     * an offer to do automatically do something for the user.
  110.90 -     */
  110.91 -    public Kind hintKind() default Kind.INSPECTION;
  110.92 -    /**Specify various options for the hint*/
  110.93 -    public Options[] options() default {};
  110.94 -
  110.95 -    /**Whether the hint should be considered a {@link Kind#HINT hint}, e.g. it
  110.96 -     * detects a code smell, or otherwise leads to improving the code, or a {@link Kind#ACTION},
  110.97 -     * which is simply an offer to do automatically do something for the user.
  110.98 -     */
  110.99 -   public enum Kind {
 110.100 -       /**The hint represents a code-smell detector, or alike. It marks code that
 110.101 -        * is not correct (in some sense).
 110.102 -        */
 110.103 -       INSPECTION,
 110.104 -       
 110.105 -       /**The hint represents an offer to the user to automatically alter the code.
 110.106 -        * The transformation is not intended to improve the code, only allow the
 110.107 -        * user to do some kind of code transformation quickly.
 110.108 -        *
 110.109 -        * The only meaningful severity for suggestions if {@link Severity#CURRENT_LINE_WARNING}.
 110.110 -        */
 110.111 -       ACTION;
 110.112 -    }
 110.113 -
 110.114 -   /**Various options to altering the behavior of the hint.
 110.115 -    */
 110.116 -    public enum Options {
 110.117 -        /**The hint does not produce any automatic transformations that could be run
 110.118 -         * inside the Inspect&Refactor dialog.
 110.119 -         */
 110.120 -        QUERY,
 110.121 -        /**The hint cannot be run inside the Inspect&Refactor dialog.
 110.122 -         */
 110.123 -        NO_BATCH,
 110.124 -        /**
 110.125 -         * The hint requires heavyweight processing so it should be run explicitly only by Inspect, Refactor (or similar) 
 110.126 -         * features
 110.127 -         */
 110.128 -        HEAVY;
 110.129 -    }
 110.130 -
 110.131 -}
   111.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/HintContext.java	Sun Jan 08 20:10:08 2017 +0100
   111.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   111.3 @@ -1,230 +0,0 @@
   111.4 -/*
   111.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   111.6 - *
   111.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   111.8 - *
   111.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  111.10 - * Other names may be trademarks of their respective owners.
  111.11 - *
  111.12 - * The contents of this file are subject to the terms of either the GNU
  111.13 - * General Public License Version 2 only ("GPL") or the Common
  111.14 - * Development and Distribution License("CDDL") (collectively, the
  111.15 - * "License"). You may not use this file except in compliance with the
  111.16 - * License. You can obtain a copy of the License at
  111.17 - * http://www.netbeans.org/cddl-gplv2.html
  111.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  111.19 - * specific language governing permissions and limitations under the
  111.20 - * License.  When distributing the software, include this License Header
  111.21 - * Notice in each file and include the License file at
  111.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  111.23 - * particular file as subject to the "Classpath" exception as provided
  111.24 - * by Oracle in the GPL Version 2 section of the License file that
  111.25 - * accompanied this code. If applicable, add the following below the
  111.26 - * License Header, with the fields enclosed by brackets [] replaced by
  111.27 - * your own identifying information:
  111.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  111.29 - *
  111.30 - * If you wish your version of this file to be governed by only the CDDL
  111.31 - * or only the GPL Version 2, indicate your decision by adding
  111.32 - * "[Contributor] elects to include this software in this distribution
  111.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  111.34 - * single choice of license, a recipient has the option to distribute
  111.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  111.36 - * to extend the choice of license to its licensees as provided above.
  111.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  111.38 - * Version 2 license, then the option applies only if the new code is
  111.39 - * made subject to such option by the copyright holder.
  111.40 - *
  111.41 - * Contributor(s):
  111.42 - *
  111.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  111.44 - */
  111.45 -
  111.46 -package org.netbeans.spi.java.hints;
  111.47 -
  111.48 -import com.sun.source.util.TreePath;
  111.49 -import java.util.ArrayList;
  111.50 -import java.util.Collection;
  111.51 -import java.util.Collections;
  111.52 -import java.util.HashMap;
  111.53 -import java.util.LinkedList;
  111.54 -import java.util.List;
  111.55 -import java.util.Map;
  111.56 -import java.util.concurrent.atomic.AtomicBoolean;
  111.57 -import java.util.prefs.Preferences;
  111.58 -import javax.lang.model.type.TypeMirror;
  111.59 -import org.netbeans.api.java.source.CompilationInfo;
  111.60 -import org.netbeans.api.java.source.TreePathHandle;
  111.61 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
  111.62 -import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
  111.63 -import org.netbeans.modules.java.hints.spiimpl.SPIAccessor;
  111.64 -import org.netbeans.modules.java.hints.spiimpl.hints.GlobalProcessingContext;
  111.65 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
  111.66 -import org.netbeans.spi.editor.hints.Severity;
  111.67 -import org.netbeans.spi.java.hints.Decision.Factory;
  111.68 -import org.netbeans.spi.java.hints.Hint.Kind;
  111.69 -
  111.70 -/**
  111.71 - *
  111.72 - * @author Jan Lahoda
  111.73 - */
  111.74 -public class HintContext {
  111.75 -
  111.76 -    private final CompilationInfo info;
  111.77 -    private final HintsSettings settings;
  111.78 -    private final Preferences preferences;
  111.79 -    private final Severity severity;
  111.80 -    private final HintMetadata metadata;
  111.81 -    private final GlobalProcessingContext globalContext;
  111.82 -    private final TreePath path;
  111.83 -    private final Map<String, TreePath> variables;
  111.84 -    private final Map<String, Collection<? extends TreePath>> multiVariables;
  111.85 -    private final Map<String, String> variableNames;
  111.86 -    private final Collection<? super MessageImpl> messages;
  111.87 -    private final Map<String, TypeMirror> constraints;
  111.88 -    private final boolean bulkMode;
  111.89 -    private final AtomicBoolean cancel;
  111.90 -    private final int caret;
  111.91 -
  111.92 -    private HintContext(CompilationInfo info, HintsSettings settings, HintMetadata metadata, GlobalProcessingContext globalContext, TreePath path, Map<String, TreePath> variables, Map<String, Collection<? extends TreePath>> multiVariables, Map<String, String> variableNames, Map<String, TypeMirror> constraints, Collection<? super MessageImpl> problems, boolean bulkMode, AtomicBoolean cancel, int caret) {
  111.93 -        this.info = info;
  111.94 -        this.settings = settings;
  111.95 -        this.preferences = metadata != null ? settings.getHintPreferences(metadata) : null;
  111.96 -        this.severity = preferences != null ? settings.getSeverity(metadata) : Severity.ERROR;
  111.97 -        this.metadata = metadata;
  111.98 -        this.globalContext = globalContext;
  111.99 -        this.path = path;
 111.100 -
 111.101 -        variables = new HashMap<String, TreePath>(variables);
 111.102 -        variables.put("$_", path);
 111.103 -        
 111.104 -        this.variables = variables;
 111.105 -        this.multiVariables = multiVariables;
 111.106 -        this.variableNames = variableNames;
 111.107 -        this.messages = problems;
 111.108 -        this.constraints = constraints;
 111.109 -        this.bulkMode = bulkMode;
 111.110 -        this.cancel = cancel;
 111.111 -        this.caret = caret;
 111.112 -    }
 111.113 -
 111.114 -    public CompilationInfo getInfo() {
 111.115 -        return info;
 111.116 -    }
 111.117 -
 111.118 -    public Preferences getPreferences() {
 111.119 -        return preferences;
 111.120 -    }
 111.121 -
 111.122 -    public Severity getSeverity() {
 111.123 -        return severity;
 111.124 -    }
 111.125 -
 111.126 -    public TreePath getPath() {
 111.127 -        return path;
 111.128 -    }
 111.129 -
 111.130 -    public Map<String, TreePath> getVariables() {
 111.131 -        return variables;
 111.132 -    }
 111.133 -
 111.134 -    public Map<String, Collection<? extends TreePath>> getMultiVariables() {
 111.135 -        return multiVariables;
 111.136 -    }
 111.137 -
 111.138 -    public Map<String, String> getVariableNames() {
 111.139 -        return variableNames;
 111.140 -    }
 111.141 -
 111.142 -    HintMetadata getHintMetadata() {
 111.143 -        return metadata;
 111.144 -    }
 111.145 -
 111.146 -    //TODO: not sure it should be here:
 111.147 -    public Map<String, TypeMirror> getConstraints() {
 111.148 -        return constraints;
 111.149 -    }
 111.150 -
 111.151 -    /**
 111.152 -     * Will be used only for refactoring(s), will be ignored for hints.
 111.153 -     * 
 111.154 -     * @param kind
 111.155 -     * @param text
 111.156 -     */
 111.157 -    public void reportMessage(MessageKind kind, String text) {
 111.158 -        messages.add(new MessageImpl(kind, text));
 111.159 -    }
 111.160 -
 111.161 -    /**Returns {@code true} if the hint is being run in over many files, {@code false}
 111.162 -     * if only the file opened in the editor is being inspected.
 111.163 -     *
 111.164 -     * @return {@code true} if the hint is being run in over many files.
 111.165 -     */
 111.166 -    public boolean isBulkMode() {
 111.167 -        return bulkMode;
 111.168 -    }
 111.169 -
 111.170 -    /**Returns {@code true} if the computation has been canceled.
 111.171 -     *
 111.172 -     * @return {@code true} if the computation has been canceled.
 111.173 -     */
 111.174 -    public boolean isCanceled() {
 111.175 -        return cancel.get();
 111.176 -    }
 111.177 -
 111.178 -    /**For suggestions, returns the caret location for the editor
 111.179 -     * for which the suggestion is being computed. Returns -1 for hints.
 111.180 -     *
 111.181 -     * @return for suggestions, returns the caret location, -1 otherwise
 111.182 -     */
 111.183 -    public int getCaretLocation() {
 111.184 -        return metadata.kind == Kind.ACTION ? caret : -1;
 111.185 -    }
 111.186 -    
 111.187 -    public <V, R, D extends Decision<V, R>> D findDecision(TreePathHandle forPath, Factory<V, R, D> f) {
 111.188 -        List<Decision<?, ?>> decs = globalContext.decisions.get(forPath);
 111.189 -
 111.190 -        if (decs == null) {
 111.191 -            globalContext.decisions.put(forPath, decs = new ArrayList<Decision<?, ?>>());
 111.192 -        }
 111.193 -
 111.194 -        for (Decision<?, ?> d : decs) {
 111.195 -            if (d.getClass() == f.decisionClass) {
 111.196 -                return f.decisionClass.cast(d);
 111.197 -            }
 111.198 -        }
 111.199 -
 111.200 -        D res = f.create(forPath);
 111.201 -
 111.202 -        decs.add((Decision<?, ?>) res);
 111.203 -
 111.204 -        return res;
 111.205 -    }
 111.206 -
 111.207 -    public Decision<?, ?> decision;
 111.208 -
 111.209 -    public Decision<?, ?> getDecision() {
 111.210 -        return decision;
 111.211 -    }
 111.212 -
 111.213 -    public enum MessageKind {
 111.214 -        WARNING, ERROR;
 111.215 -    }
 111.216 -    
 111.217 -    static {
 111.218 -        SPIAccessor.setINSTANCE(new SPIAccessor() {
 111.219 -            @Override public HintContext createHintContext(CompilationInfo info, HintsSettings settings, HintMetadata metadata, GlobalProcessingContext globalContext, TreePath path, Map<String, TreePath> variables, Map<String, Collection<? extends TreePath>> multiVariables, Map<String, String> variableNames, Map<String, TypeMirror> constraints, Collection<? super MessageImpl> problems, boolean bulkMode, AtomicBoolean cancel, int caret) {
 111.220 -                return new HintContext(info, settings, metadata, globalContext, path, variables, multiVariables, variableNames, constraints, problems, bulkMode, cancel, caret);
 111.221 -            }
 111.222 -            @Override public HintContext createHintContext(CompilationInfo info, HintsSettings settings, HintMetadata metadata, GlobalProcessingContext globalContext, TreePath path, Map<String, TreePath> variables, Map<String, Collection<? extends TreePath>> multiVariables, Map<String, String> variableNames) {
 111.223 -                return new HintContext(info, settings, metadata, globalContext, path, variables, multiVariables, variableNames, Collections.<String, TypeMirror>emptyMap(), new LinkedList<MessageImpl>(), false, new AtomicBoolean(), -1);
 111.224 -            }
 111.225 -            @Override public HintMetadata getHintMetadata(HintContext ctx) {
 111.226 -                return ctx.getHintMetadata();
 111.227 -            }
 111.228 -            @Override public HintsSettings getHintSettings(HintContext ctx) {
 111.229 -                return ctx.settings;
 111.230 -            }
 111.231 -        });
 111.232 -    }
 111.233 -}
   112.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/HintSeverity.java	Sun Jan 08 20:10:08 2017 +0100
   112.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   112.3 @@ -1,69 +0,0 @@
   112.4 -/*
   112.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   112.6 - *
   112.7 - * Copyright 2011 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):
  112.42 - *
  112.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
  112.44 - */
  112.45 -package org.netbeans.spi.java.hints;
  112.46 -
  112.47 -import org.netbeans.spi.editor.hints.Severity;
  112.48 -
  112.49 -/** Severity of hint
  112.50 - *  <li><code>ERROR</code>  - will show up as error
  112.51 - *  <li><code>WARNING</code>  - will show up as warning
  112.52 - *  <li><code>CURRENT_LINE_WARNING</code>  - will only show up when the caret is placed in the erroneous element
  112.53 - * @author Petr Hrebejk
  112.54 - */
  112.55 -public enum HintSeverity {
  112.56 -    ERROR,
  112.57 -    WARNING,
  112.58 -    CURRENT_LINE_WARNING;
  112.59 -
  112.60 -    public Severity toEditorSeverity() {
  112.61 -        switch ( this ) {
  112.62 -            case ERROR:
  112.63 -                return Severity.ERROR;
  112.64 -            case WARNING:
  112.65 -                return Severity.VERIFIER;
  112.66 -            case CURRENT_LINE_WARNING:
  112.67 -                return Severity.HINT;
  112.68 -            default:
  112.69 -                return null;
  112.70 -        }
  112.71 -    }
  112.72 -}
   113.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/IntegerOption.java	Sun Jan 08 20:10:08 2017 +0100
   113.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   113.3 @@ -1,99 +0,0 @@
   113.4 -/*
   113.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   113.6 - *
   113.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
   113.8 - *
   113.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  113.10 - * Other names may be trademarks of their respective owners.
  113.11 - *
  113.12 - * The contents of this file are subject to the terms of either the GNU
  113.13 - * General Public License Version 2 only ("GPL") or the Common
  113.14 - * Development and Distribution License("CDDL") (collectively, the
  113.15 - * "License"). You may not use this file except in compliance with the
  113.16 - * License. You can obtain a copy of the License at
  113.17 - * http://www.netbeans.org/cddl-gplv2.html
  113.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  113.19 - * specific language governing permissions and limitations under the
  113.20 - * License.  When distributing the software, include this License Header
  113.21 - * Notice in each file and include the License file at
  113.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  113.23 - * particular file as subject to the "Classpath" exception as provided
  113.24 - * by Oracle in the GPL Version 2 section of the License file that
  113.25 - * accompanied this code. If applicable, add the following below the
  113.26 - * License Header, with the fields enclosed by brackets [] replaced by
  113.27 - * your own identifying information:
  113.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  113.29 - *
  113.30 - * If you wish your version of this file to be governed by only the CDDL
  113.31 - * or only the GPL Version 2, indicate your decision by adding
  113.32 - * "[Contributor] elects to include this software in this distribution
  113.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  113.34 - * single choice of license, a recipient has the option to distribute
  113.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  113.36 - * to extend the choice of license to its licensees as provided above.
  113.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  113.38 - * Version 2 license, then the option applies only if the new code is
  113.39 - * made subject to such option by the copyright holder.
  113.40 - *
  113.41 - * Contributor(s):
  113.42 - *
  113.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
  113.44 - */
  113.45 -package org.netbeans.spi.java.hints;
  113.46 -
  113.47 -import java.lang.annotation.Documented;
  113.48 -import java.lang.annotation.ElementType;
  113.49 -import java.lang.annotation.Retention;
  113.50 -import java.lang.annotation.RetentionPolicy;
  113.51 -import java.lang.annotation.Target;
  113.52 -
  113.53 -/**
  113.54 - *  Declares an int-value option that affects hint processing.
  113.55 - *  If the Hint mixes integer and boolean options, the integer options
  113.56 - *  come first, boolean second in the UI.
  113.57 - * 
  113.58 - *  @author sdedic
  113.59 - */
  113.60 -@Retention(RetentionPolicy.SOURCE)
  113.61 -@Target(ElementType.FIELD)
  113.62 -@Documented
  113.63 -public @interface IntegerOption {
  113.64 -    /**
  113.65 -     * @return Display name of the option
  113.66 -     */
  113.67 -    public String displayName();
  113.68 -    
  113.69 -    /**
  113.70 -     * @return tooltip for mouse hover over the option
  113.71 -     */
  113.72 -    public String tooltip() default "";
  113.73 -    
  113.74 -    /**
  113.75 -     * @return default value for the option
  113.76 -     */
  113.77 -    public int defaultValue() default 0;
  113.78 -    
  113.79 -    /**
  113.80 -     * Minimum value for the option. If Integer.MIN_VALUE (the default),
  113.81 -     * no minimum will be enforced.
  113.82 -     * 
  113.83 -     * @return minimum value.
  113.84 -     */
  113.85 -    public int minValue() default 0;
  113.86 -    
  113.87 -    /**
  113.88 -     * Maximum value for the option. If Integer.MAX_VALUE (the default),
  113.89 -     * no maximum will be enforced. Please do choose a reasonable maximum value,
  113.90 -     * as the UI may size the input box to accommodate all digits of the maximum
  113.91 -     * permitted value, and the input box may seem unreasonably large.
  113.92 -     * 
  113.93 -     * @return maximum value
  113.94 -     */
  113.95 -    public int maxValue() default Integer.MAX_VALUE;
  113.96 -    
  113.97 -    /**
  113.98 -     * If non-zero, a spinner will be created with the specified step. If zero (the default),
  113.99 -     * a plain input will be presented. Negative values are not accepted at the moment and are reserved.
 113.100 -     */
 113.101 -    public int step() default 0;
 113.102 -}
   114.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFix.java	Sun Jan 08 20:10:08 2017 +0100
   114.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   114.3 @@ -1,309 +0,0 @@
   114.4 -/*
   114.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   114.6 - *
   114.7 - * Copyright 2008-2012 Oracle and/or its affiliates. All rights reserved.
   114.8 - *
   114.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  114.10 - * Other names may be trademarks of their respective owners.
  114.11 - *
  114.12 - * The contents of this file are subject to the terms of either the GNU
  114.13 - * General Public License Version 2 only ("GPL") or the Common
  114.14 - * Development and Distribution License("CDDL") (collectively, the
  114.15 - * "License"). You may not use this file except in compliance with the
  114.16 - * License. You can obtain a copy of the License at
  114.17 - * http://www.netbeans.org/cddl-gplv2.html
  114.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  114.19 - * specific language governing permissions and limitations under the
  114.20 - * License.  When distributing the software, include this License Header
  114.21 - * Notice in each file and include the License file at
  114.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  114.23 - * particular file as subject to the "Classpath" exception as provided
  114.24 - * by Oracle in the GPL Version 2 section of the License file that
  114.25 - * accompanied this code. If applicable, add the following below the
  114.26 - * License Header, with the fields enclosed by brackets [] replaced by
  114.27 - * your own identifying information:
  114.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  114.29 - *
  114.30 - * If you wish your version of this file to be governed by only the CDDL
  114.31 - * or only the GPL Version 2, indicate your decision by adding
  114.32 - * "[Contributor] elects to include this software in this distribution
  114.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  114.34 - * single choice of license, a recipient has the option to distribute
  114.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  114.36 - * to extend the choice of license to its licensees as provided above.
  114.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  114.38 - * Version 2 license, then the option applies only if the new code is
  114.39 - * made subject to such option by the copyright holder.
  114.40 - *
  114.41 - * Contributor(s):
  114.42 - *
  114.43 - * Portions Copyrighted 2008-2012 Sun Microsystems, Inc.
  114.44 - */
  114.45 -
  114.46 -package org.netbeans.spi.java.hints;
  114.47 -
  114.48 -import com.sun.source.util.TreePath;
  114.49 -import java.io.ByteArrayInputStream;
  114.50 -import java.io.ByteArrayOutputStream;
  114.51 -import java.io.IOException;
  114.52 -import java.io.InputStream;
  114.53 -import java.io.OutputStream;
  114.54 -import java.nio.ByteBuffer;
  114.55 -import java.util.Collection;
  114.56 -import java.util.Collections;
  114.57 -import java.util.HashMap;
  114.58 -import java.util.List;
  114.59 -import java.util.Map;
  114.60 -import java.util.logging.Level;
  114.61 -import java.util.logging.Logger;
  114.62 -import javax.lang.model.type.TypeMirror;
  114.63 -import javax.swing.text.BadLocationException;
  114.64 -import javax.swing.text.Document;
  114.65 -import org.netbeans.api.annotations.common.NonNull;
  114.66 -import org.netbeans.api.java.source.CompilationInfo;
  114.67 -import org.netbeans.api.java.source.TreePathHandle;
  114.68 -import org.netbeans.api.java.source.WorkingCopy;
  114.69 -import org.netbeans.api.queries.FileEncodingQuery;
  114.70 -import org.netbeans.modules.java.hints.spiimpl.JavaFixImpl;
  114.71 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchUtilities;
  114.72 -import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation;
  114.73 -import org.netbeans.spi.editor.hints.ChangeInfo;
  114.74 -import org.netbeans.spi.editor.hints.Fix;
  114.75 -import org.openide.filesystems.FileObject;
  114.76 -import org.openide.util.Exceptions;
  114.77 -import org.openide.util.Parameters;
  114.78 -
  114.79 -/**A base class for fixes that modify Java source code. Using this class
  114.80 - * as a base class makes creating the fix somewhat simpler, but also supports
  114.81 - * running the hint in the Inspect&Transform dialog. The fix can be converted
  114.82 - * to {@link Fix} by means of the {@link #toEditorFix() } method.
  114.83 - *
  114.84 - * @see JavaFixUtilities for various predefined fixes.
  114.85 - * @author Jan Lahoda
  114.86 - */
  114.87 -public abstract class JavaFix {
  114.88 -
  114.89 -    private final TreePathHandle handle;
  114.90 -    private final Map<String, String> options;
  114.91 -
  114.92 -    /**Create JavaFix with the given base {@link TreePath}. The base {@link TreePath}
  114.93 -     * will be passed back to the real implementation of the fix.
  114.94 -     *
  114.95 -     * @param info a {@link CompilationInfo} from which the given {@link TreePath} originates
  114.96 -     * @param tp a {@link TreePath} that will be passed back to the
  114.97 -     *           {@link #performRewrite(org.netbeans.spi.java.hints.JavaFix.TransformationContext) } method
  114.98 -     */
  114.99 -    protected JavaFix(@NonNull CompilationInfo info, @NonNull TreePath tp) {
 114.100 -        this(info, tp, Collections.<String, String>emptyMap());
 114.101 -    }
 114.102 -
 114.103 -    JavaFix(CompilationInfo info, TreePath tp, Map<String, String> options) {
 114.104 -        this.handle = TreePathHandle.create(tp, info);
 114.105 -        this.options = Collections.unmodifiableMap(new HashMap<String, String>(options));
 114.106 -    }
 114.107 -
 114.108 -    /**Create JavaFix with the given base {@link TreePathHandle}. The base {@link TreePathHandle}
 114.109 -     * will be resolved and passed back to the real implementation of the fix.
 114.110 -     *
 114.111 -     * @param handle a {@link TreePathHandle} that will be resolved and passed back to the
 114.112 -     *              {@link #performRewrite(org.netbeans.spi.java.hints.JavaFix.TransformationContext) } method
 114.113 -     */
 114.114 -    protected JavaFix(@NonNull TreePathHandle handle) {
 114.115 -        this(handle, Collections.<String, String>emptyMap());
 114.116 -    }
 114.117 -
 114.118 -    JavaFix(TreePathHandle handle, Map<String, String> options) {
 114.119 -        this.handle = handle;
 114.120 -        this.options = Collections.unmodifiableMap(new HashMap<String, String>(options));
 114.121 -    }
 114.122 -
 114.123 -    /**The display text of the fix.
 114.124 -     *
 114.125 -     * @return the display text of the fix.
 114.126 -     */
 114.127 -    protected abstract @NonNull String getText();
 114.128 -
 114.129 -    /**Do the transformations needed to implement the hint's function.
 114.130 -     *
 114.131 -     * @param ctx a context over which the fix should operate
 114.132 -     * @throws Exception if something goes wrong while performing the transformation
 114.133 -     *                   - will be logged by the infrastructure
 114.134 -     */
 114.135 -    protected abstract void performRewrite(@NonNull TransformationContext ctx) throws Exception;
 114.136 -
 114.137 -    /**Convert this {@link JavaFix} into the Editor Hints {@link Fix}.
 114.138 -     *
 114.139 -     * @return a {@link Fix}, that when invoked, will invoke {@link #performRewrite(org.netbeans.spi.java.hints.JavaFix.TransformationContext) }
 114.140 -     * method on this {@link JavaFix}.
 114.141 -     */
 114.142 -    public final Fix toEditorFix() {
 114.143 -        return new JavaFixImpl(this);
 114.144 -    }
 114.145 -
 114.146 -    static {
 114.147 -        JavaFixImpl.Accessor.INSTANCE = new JavaFixImpl.Accessor() {
 114.148 -            @Override
 114.149 -            public String getText(JavaFix jf) {
 114.150 -                return jf.getText();
 114.151 -            }
 114.152 -            @Override
 114.153 -            public ChangeInfo process(JavaFix jf, WorkingCopy wc, boolean canShowUI, Map<FileObject, byte[]> resourceContent, Collection<? super RefactoringElementImplementation> fileChanges) throws Exception {
 114.154 -                TreePath tp = jf.handle.resolve(wc);
 114.155 -
 114.156 -                if (tp == null) {
 114.157 -                    Logger.getLogger(JavaFix.class.getName()).log(Level.SEVERE, "Cannot resolve handle={0}", jf.handle);
 114.158 -                    return null;
 114.159 -                }
 114.160 -
 114.161 -                jf.performRewrite(new TransformationContext(wc, tp, canShowUI, resourceContent, fileChanges));
 114.162 -
 114.163 -                return null;
 114.164 -            }
 114.165 -            @Override
 114.166 -            public FileObject getFile(JavaFix jf) {
 114.167 -                return jf.handle.getFileObject();
 114.168 -            }
 114.169 -            @Override
 114.170 -            public Map<String, String> getOptions(JavaFix jf) {
 114.171 -                return jf.options;
 114.172 -            }
 114.173 -
 114.174 -            @Override
 114.175 -            public Fix rewriteFix(CompilationInfo info, String displayName, TreePath what, String to, Map<String, TreePath> parameters, Map<String, Collection<? extends TreePath>> parametersMulti, Map<String, String> parameterNames, Map<String, TypeMirror> constraints, Map<String, String> options, String... imports) {
 114.176 -                return JavaFixUtilities.rewriteFix(info, displayName, what, to, parameters, parametersMulti, parameterNames, constraints, options, imports);
 114.177 -            }
 114.178 -
 114.179 -            @Override
 114.180 -            public Fix createSuppressWarningsFix(CompilationInfo compilationInfo, TreePath treePath, String... keys) {
 114.181 -                return ErrorDescriptionFactory.createSuppressWarningsFix(compilationInfo, treePath, keys);
 114.182 -            }
 114.183 -
 114.184 -            @Override
 114.185 -            public List<Fix> createSuppressWarnings(CompilationInfo compilationInfo, TreePath treePath, String... keys) {
 114.186 -                return ErrorDescriptionFactory.createSuppressWarnings(compilationInfo, treePath, keys);
 114.187 -            }
 114.188 -
 114.189 -            @Override
 114.190 -            public List<Fix> resolveDefaultFixes(HintContext ctx, Fix... provided) {
 114.191 -                return ErrorDescriptionFactory.resolveDefaultFixes(ctx, provided);
 114.192 -            }
 114.193 -        };
 114.194 -    }
 114.195 -
 114.196 -    /**A context that contains a reference to a {@link WorkingCopy} through which
 114.197 -     * modifications of Java source code can be made.
 114.198 -     *
 114.199 -     */
 114.200 -    public static final class TransformationContext {
 114.201 -        private final WorkingCopy workingCopy;
 114.202 -        private final TreePath path;
 114.203 -        private final boolean canShowUI;
 114.204 -        private final Map<FileObject, byte[]> resourceContentChanges;
 114.205 -        private final Collection<? super RefactoringElementImplementation> fileChanges;
 114.206 -        TransformationContext(WorkingCopy workingCopy, TreePath path, boolean canShowUI, Map<FileObject, byte[]> resourceContentChanges, Collection<? super RefactoringElementImplementation> fileChanges) {
 114.207 -            this.workingCopy = workingCopy;
 114.208 -            this.path = path;
 114.209 -            this.canShowUI = canShowUI;
 114.210 -            this.resourceContentChanges = resourceContentChanges;
 114.211 -            this.fileChanges = fileChanges;
 114.212 -        }
 114.213 -
 114.214 -        boolean isCanShowUI() {
 114.215 -            return canShowUI;
 114.216 -        }
 114.217 -
 114.218 -        /**Returns the {@link TreePath} that was passed to a {@link JavaFix} constructor.
 114.219 -         *
 114.220 -         * @return the {@link TreePath} that was passed to a {@link JavaFix} constructor.
 114.221 -         */
 114.222 -        public @NonNull TreePath getPath() {
 114.223 -            return path;
 114.224 -        }
 114.225 -
 114.226 -        /**A {@link WorkingCopy} over which the transformation should operate.
 114.227 -         * @return {@link WorkingCopy} over which the transformation should operate.
 114.228 -         */
 114.229 -        public @NonNull WorkingCopy getWorkingCopy() {
 114.230 -            return workingCopy;
 114.231 -        }
 114.232 -
 114.233 -        /**Allows access to non-Java resources. The content of this InputStream will
 114.234 -         * include all changes done through {@link #getResourceOutput(org.openide.filesystems.FileObject) }
 114.235 -         * before calling this method.
 114.236 -         *
 114.237 -         * @param file whose content should be returned
 114.238 -         * @return the file's content
 114.239 -         * @throws IOException if something goes wrong while opening the file
 114.240 -         * @throws IllegalArgumentException if {@code file} parameter is null, or
 114.241 -         *                                  if it represents a Java file
 114.242 -         */
 114.243 -        public @NonNull InputStream getResourceContent(@NonNull FileObject file) throws IOException, IllegalArgumentException {
 114.244 -            Parameters.notNull("file", file);
 114.245 -            if ("text/x-java".equals(file.getMIMEType("text/x-java")))
 114.246 -                throw new IllegalArgumentException("Cannot access Java files");
 114.247 -
 114.248 -            byte[] newContent = resourceContentChanges != null ? resourceContentChanges.get(file) : null;
 114.249 -
 114.250 -            if (newContent == null) {
 114.251 -                final Document doc = BatchUtilities.getDocument(file);
 114.252 -
 114.253 -                if (doc != null) {
 114.254 -                    final String[] result = new String[1];
 114.255 -
 114.256 -                    doc.render(new Runnable() {
 114.257 -                        @Override public void run() {
 114.258 -                            try {
 114.259 -                                result[0] = doc.getText(0, doc.getLength());
 114.260 -                            } catch (BadLocationException ex) {
 114.261 -                                Exceptions.printStackTrace(ex);
 114.262 -                            }
 114.263 -                        }
 114.264 -                    });
 114.265 -
 114.266 -                    if (result[0] != null) {
 114.267 -                        ByteBuffer encoded = FileEncodingQuery.getEncoding(file).encode(result[0]);
 114.268 -                        byte[] encodedBytes = new byte[encoded.remaining()];
 114.269 -
 114.270 -                        encoded.get(encodedBytes);
 114.271 -
 114.272 -                        return new ByteArrayInputStream(encodedBytes);
 114.273 -                    }
 114.274 -                }
 114.275 -                
 114.276 -                return file.getInputStream();
 114.277 -            } else {
 114.278 -                return new ByteArrayInputStream(newContent);
 114.279 -            }
 114.280 -        }
 114.281 -
 114.282 -        /**Record a changed version of a file. The changes will be applied altogether with
 114.283 -         * changes to the Java file. In Inspect&Transform, changes done through this
 114.284 -         * method will be part of the preview.
 114.285 -         *
 114.286 -         * @param file whose content should be changed
 114.287 -         * @return an {@link java.io.OutputStream} into which the new content of the file should be written
 114.288 -         * @throws IOException if something goes wrong while opening the file
 114.289 -         * @throws IllegalArgumentException if {@code file} parameter is null, or
 114.290 -         *                                  if it represents a Java file
 114.291 -         */
 114.292 -        public @NonNull OutputStream getResourceOutput(@NonNull final FileObject file) throws IOException {
 114.293 -            Parameters.notNull("file", file);
 114.294 -            if ("text/x-java".equals(file.getMIMEType("text/x-java")))
 114.295 -                throw new IllegalArgumentException("Cannot access Java files");
 114.296 -            if (resourceContentChanges == null) return file.getOutputStream();
 114.297 -
 114.298 -            return new ByteArrayOutputStream() {
 114.299 -                @Override public void close() throws IOException {
 114.300 -                    super.close();
 114.301 -                    resourceContentChanges.put(file, toByteArray());
 114.302 -                }
 114.303 -            };
 114.304 -        }
 114.305 -
 114.306 -        Collection<? super RefactoringElementImplementation> getFileChanges() {
 114.307 -            return fileChanges;
 114.308 -        }
 114.309 -
 114.310 -    }
 114.311 -
 114.312 -}
   115.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFixUtilities.java	Sun Jan 08 20:10:08 2017 +0100
   115.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   115.3 @@ -1,1642 +0,0 @@
   115.4 -/*
   115.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   115.6 - *
   115.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
   115.8 - *
   115.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  115.10 - * Other names may be trademarks of their respective owners.
  115.11 - *
  115.12 - * The contents of this file are subject to the terms of either the GNU
  115.13 - * General Public License Version 2 only ("GPL") or the Common
  115.14 - * Development and Distribution License("CDDL") (collectively, the
  115.15 - * "License"). You may not use this file except in compliance with the
  115.16 - * License. You can obtain a copy of the License at
  115.17 - * http://www.netbeans.org/cddl-gplv2.html
  115.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  115.19 - * specific language governing permissions and limitations under the
  115.20 - * License.  When distributing the software, include this License Header
  115.21 - * Notice in each file and include the License file at
  115.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  115.23 - * particular file as subject to the "Classpath" exception as provided
  115.24 - * by Oracle in the GPL Version 2 section of the License file that
  115.25 - * accompanied this code. If applicable, add the following below the
  115.26 - * License Header, with the fields enclosed by brackets [] replaced by
  115.27 - * your own identifying information:
  115.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  115.29 - *
  115.30 - * If you wish your version of this file to be governed by only the CDDL
  115.31 - * or only the GPL Version 2, indicate your decision by adding
  115.32 - * "[Contributor] elects to include this software in this distribution
  115.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  115.34 - * single choice of license, a recipient has the option to distribute
  115.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  115.36 - * to extend the choice of license to its licensees as provided above.
  115.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  115.38 - * Version 2 license, then the option applies only if the new code is
  115.39 - * made subject to such option by the copyright holder.
  115.40 - *
  115.41 - * Contributor(s):
  115.42 - *
  115.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
  115.44 - */
  115.45 -package org.netbeans.spi.java.hints;
  115.46 -
  115.47 -import com.sun.javadoc.Doc;
  115.48 -import com.sun.javadoc.Tag;
  115.49 -import com.sun.source.tree.AnnotationTree;
  115.50 -import com.sun.source.tree.AssignmentTree;
  115.51 -import com.sun.source.tree.BinaryTree;
  115.52 -import com.sun.source.tree.BlockTree;
  115.53 -import com.sun.source.tree.CaseTree;
  115.54 -import com.sun.source.tree.CatchTree;
  115.55 -import com.sun.source.tree.ClassTree;
  115.56 -import com.sun.source.tree.CompilationUnitTree;
  115.57 -import com.sun.source.tree.CompoundAssignmentTree;
  115.58 -import com.sun.source.tree.ExpressionStatementTree;
  115.59 -import com.sun.source.tree.ExpressionTree;
  115.60 -import com.sun.source.tree.IdentifierTree;
  115.61 -import com.sun.source.tree.IfTree;
  115.62 -import com.sun.source.tree.LambdaExpressionTree;
  115.63 -import com.sun.source.tree.LiteralTree;
  115.64 -import com.sun.source.tree.MemberSelectTree;
  115.65 -import com.sun.source.tree.MethodInvocationTree;
  115.66 -import com.sun.source.tree.MethodTree;
  115.67 -import com.sun.source.tree.ModifiersTree;
  115.68 -import com.sun.source.tree.NewArrayTree;
  115.69 -import com.sun.source.tree.NewClassTree;
  115.70 -import com.sun.source.tree.ParameterizedTypeTree;
  115.71 -import com.sun.source.tree.ParenthesizedTree;
  115.72 -import com.sun.source.tree.Scope;
  115.73 -import com.sun.source.tree.StatementTree;
  115.74 -import com.sun.source.tree.SwitchTree;
  115.75 -import com.sun.source.tree.Tree;
  115.76 -import com.sun.source.tree.Tree.Kind;
  115.77 -import com.sun.source.tree.TryTree;
  115.78 -import com.sun.source.tree.TypeParameterTree;
  115.79 -import com.sun.source.tree.UnaryTree;
  115.80 -import com.sun.source.tree.UnionTypeTree;
  115.81 -import com.sun.source.tree.VariableTree;
  115.82 -import com.sun.source.util.SourcePositions;
  115.83 -import com.sun.source.util.TreePath;
  115.84 -import com.sun.source.util.TreePathScanner;
  115.85 -import com.sun.source.util.TreeScanner;
  115.86 -import java.io.IOException;
  115.87 -import java.util.ArrayList;
  115.88 -import java.util.Arrays;
  115.89 -import java.util.Collection;
  115.90 -import java.util.Collections;
  115.91 -import java.util.EnumMap;
  115.92 -import java.util.EnumSet;
  115.93 -import java.util.HashMap;
  115.94 -import java.util.IdentityHashMap;
  115.95 -import java.util.Iterator;
  115.96 -import java.util.LinkedList;
  115.97 -import java.util.List;
  115.98 -import java.util.Map;
  115.99 -import java.util.Map.Entry;
 115.100 -import java.util.Set;
 115.101 -import java.util.concurrent.Callable;
 115.102 -import java.util.logging.Level;
 115.103 -import java.util.logging.Logger;
 115.104 -import java.util.regex.Matcher;
 115.105 -import javax.lang.model.element.Element;
 115.106 -import javax.lang.model.element.ElementKind;
 115.107 -import javax.lang.model.element.Modifier;
 115.108 -import javax.lang.model.element.TypeElement;
 115.109 -import javax.lang.model.type.TypeKind;
 115.110 -import javax.lang.model.type.TypeMirror;
 115.111 -import org.netbeans.api.java.classpath.ClassPath;
 115.112 -import org.netbeans.api.java.classpath.ClassPath.PathConversionMode;
 115.113 -import org.netbeans.api.java.queries.SourceForBinaryQuery;
 115.114 -import org.netbeans.api.java.source.ClasspathInfo;
 115.115 -import org.netbeans.api.java.source.ClasspathInfo.PathKind;
 115.116 -import org.netbeans.api.java.source.CompilationInfo;
 115.117 -import org.netbeans.api.java.source.SourceUtils;
 115.118 -import org.netbeans.api.java.source.TreeMaker;
 115.119 -import org.netbeans.api.java.source.TreePathHandle;
 115.120 -import org.netbeans.api.java.source.TypeMirrorHandle;
 115.121 -import org.netbeans.api.java.source.WorkingCopy;
 115.122 -import org.netbeans.api.java.source.matching.Occurrence;
 115.123 -import org.netbeans.api.java.source.matching.Pattern;
 115.124 -import org.netbeans.api.project.FileOwnerQuery;
 115.125 -import org.netbeans.api.project.Project;
 115.126 -import org.netbeans.modules.java.hints.spiimpl.Hacks;
 115.127 -import org.netbeans.modules.java.hints.spiimpl.Utilities;
 115.128 -import org.netbeans.modules.java.hints.spiimpl.ipi.upgrade.ProjectDependencyUpgrader;
 115.129 -import org.netbeans.modules.refactoring.spi.SimpleRefactoringElementImplementation;
 115.130 -import org.netbeans.spi.editor.hints.Fix;
 115.131 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
 115.132 -import org.netbeans.spi.java.hints.JavaFix.TransformationContext;
 115.133 -import org.openide.filesystems.FileObject;
 115.134 -import org.openide.filesystems.FileUtil;
 115.135 -import org.openide.loaders.DataFolder;
 115.136 -import org.openide.loaders.DataObject;
 115.137 -import org.openide.loaders.DataObjectNotFoundException;
 115.138 -import org.openide.modules.SpecificationVersion;
 115.139 -import org.openide.text.PositionBounds;
 115.140 -import org.openide.util.Exceptions;
 115.141 -import org.openide.util.Lookup;
 115.142 -import org.openide.util.NbBundle.Messages;
 115.143 -import org.openide.util.NbCollections;
 115.144 -
 115.145 -/**Factory methods for various predefined {@link JavaFix} implementations.
 115.146 - *
 115.147 - * @author lahvac
 115.148 - */
 115.149 -public class JavaFixUtilities {
 115.150 -
 115.151 -    /**Prepare a fix that will replace the given tree node ({@code what}) with the
 115.152 -     * given code. Any variables in the {@code to} pattern will be replaced with their
 115.153 -     * values from {@link HintContext#getVariables() }, {@link HintContext#getMultiVariables() }
 115.154 -     * and {@link HintContext#getVariableNames() }.
 115.155 -     *
 115.156 -     * @param ctx basic context for which the fix should be created
 115.157 -     * @param displayName the display name of the fix
 115.158 -     * @param what the tree node that should be replaced
 115.159 -     * @param to the new code that should replaced the {@code what} tree node
 115.160 -     * @return an editor fix that performs the required transformation
 115.161 -     */
 115.162 -    public static Fix rewriteFix(HintContext ctx, String displayName, TreePath what, final String to) {
 115.163 -        return rewriteFix(ctx.getInfo(), displayName, what, to, ctx.getVariables(), ctx.getMultiVariables(), ctx.getVariableNames(), ctx.getConstraints(), Collections.<String, String>emptyMap());
 115.164 -    }
 115.165 -
 115.166 -    static Fix rewriteFix(CompilationInfo info, String displayName, TreePath what, final String to, Map<String, TreePath> parameters, Map<String, Collection<? extends TreePath>> parametersMulti, final Map<String, String> parameterNames, Map<String, TypeMirror> constraints, Map<String, String> options, String... imports) {
 115.167 -        final Map<String, TreePathHandle> params = new HashMap<String, TreePathHandle>();
 115.168 -        final Map<String, Object> extraParamsData = new HashMap<String, Object>();
 115.169 -
 115.170 -        for (Entry<String, TreePath> e : parameters.entrySet()) {
 115.171 -            params.put(e.getKey(), TreePathHandle.create(e.getValue(), info));
 115.172 -            if (e.getValue() instanceof Callable) {
 115.173 -                try {
 115.174 -                    extraParamsData.put(e.getKey(), ((Callable) e.getValue()).call());
 115.175 -                } catch (Exception ex) {
 115.176 -                    Exceptions.printStackTrace(ex);
 115.177 -                }
 115.178 -            }
 115.179 -        }
 115.180 -
 115.181 -        final Map<String, Collection<TreePathHandle>> paramsMulti = new HashMap<String, Collection<TreePathHandle>>();
 115.182 -
 115.183 -        for (Entry<String, Collection<? extends TreePath>> e : parametersMulti.entrySet()) {
 115.184 -            Collection<TreePathHandle> tph = new LinkedList<TreePathHandle>();
 115.185 -
 115.186 -            for (TreePath tp : e.getValue()) {
 115.187 -                tph.add(TreePathHandle.create(tp, info));
 115.188 -            }
 115.189 -
 115.190 -            paramsMulti.put(e.getKey(), tph);
 115.191 -        }
 115.192 -
 115.193 -        final Map<String, TypeMirrorHandle<?>> constraintsHandles = new HashMap<String, TypeMirrorHandle<?>>();
 115.194 -
 115.195 -        for (Entry<String, TypeMirror> c : constraints.entrySet()) {
 115.196 -            constraintsHandles.put(c.getKey(), TypeMirrorHandle.create(c.getValue()));
 115.197 -        }
 115.198 -
 115.199 -        if (displayName == null) {
 115.200 -            displayName = defaultFixDisplayName(info, parameters, to);
 115.201 -        }
 115.202 -
 115.203 -        return new JavaFixRealImpl(info, what, options, displayName, to, params, extraParamsData, paramsMulti, parameterNames, constraintsHandles, Arrays.asList(imports)).toEditorFix();
 115.204 -    }
 115.205 -
 115.206 -    /**Creates a fix that removes the given code corresponding to the given tree
 115.207 -     * node from the source code.
 115.208 -     * 
 115.209 -     * @param ctx basic context for which the fix should be created
 115.210 -     * @param displayName the display name of the fix
 115.211 -     * @param what the tree node that should be removed
 115.212 -     * @return an editor fix that removes the give tree from the source code
 115.213 -     */
 115.214 -    public static Fix removeFromParent(HintContext ctx, String displayName, TreePath what) {
 115.215 -        return new RemoveFromParent(displayName, ctx.getInfo(), what).toEditorFix();
 115.216 -    }
 115.217 -
 115.218 -    private static String defaultFixDisplayName(CompilationInfo info, Map<String, TreePath> variables, String replaceTarget) {
 115.219 -        Map<String, String> stringsForVariables = new HashMap<String, String>();
 115.220 -
 115.221 -        for (Entry<String, TreePath> e : variables.entrySet()) {
 115.222 -            Tree t = e.getValue().getLeaf();
 115.223 -            SourcePositions sp = info.getTrees().getSourcePositions();
 115.224 -            int startPos = (int) sp.getStartPosition(info.getCompilationUnit(), t);
 115.225 -            int endPos = (int) sp.getEndPosition(info.getCompilationUnit(), t);
 115.226 -
 115.227 -            if (startPos >= 0 && endPos >= 0) {
 115.228 -                stringsForVariables.put(e.getKey(), info.getText().substring(startPos, endPos));
 115.229 -            } else {
 115.230 -                stringsForVariables.put(e.getKey(), "");
 115.231 -            }
 115.232 -        }
 115.233 -
 115.234 -        if (!stringsForVariables.containsKey("$this")) {
 115.235 -            //XXX: is this correct?
 115.236 -            stringsForVariables.put("$this", "this");
 115.237 -        }
 115.238 -
 115.239 -        for (Entry<String, String> e : stringsForVariables.entrySet()) {
 115.240 -            String quotedVariable = java.util.regex.Pattern.quote(e.getKey());
 115.241 -            String quotedTarget = Matcher.quoteReplacement(e.getValue());
 115.242 -            replaceTarget = replaceTarget.replaceAll(quotedVariable, quotedTarget);
 115.243 -        }
 115.244 -
 115.245 -        return "Rewrite to " + replaceTarget;
 115.246 -    }
 115.247 -
 115.248 -    private static void checkDependency(CompilationInfo copy, Element e, boolean canShowUI) {
 115.249 -        SpecificationVersion sv = computeSpecVersion(copy, e);
 115.250 -
 115.251 -        while (sv == null && e.getKind() != ElementKind.PACKAGE) {
 115.252 -            e = e.getEnclosingElement();
 115.253 -            sv = computeSpecVersion(copy, e);
 115.254 -        }
 115.255 -
 115.256 -        if (sv == null) {
 115.257 -            return ;
 115.258 -        }
 115.259 -
 115.260 -        Project currentProject = FileOwnerQuery.getOwner(copy.getFileObject());
 115.261 -
 115.262 -        if (currentProject == null) {
 115.263 -            return ;
 115.264 -        }
 115.265 -
 115.266 -        FileObject file = getFile(copy, e);
 115.267 -
 115.268 -        if (file == null) {
 115.269 -            return ;
 115.270 -        }
 115.271 -
 115.272 -        FileObject root = findRootForFile(file, copy.getClasspathInfo());
 115.273 -
 115.274 -        if (root == null) {
 115.275 -            return ;
 115.276 -        }
 115.277 -
 115.278 -        Project referedProject = FileOwnerQuery.getOwner(file);
 115.279 -
 115.280 -        if (referedProject != null && currentProject.getProjectDirectory().equals(referedProject.getProjectDirectory())) {
 115.281 -            return ;
 115.282 -        }
 115.283 -
 115.284 -        for (ProjectDependencyUpgrader pdu : Lookup.getDefault().lookupAll(ProjectDependencyUpgrader.class)) {
 115.285 -            if (pdu.ensureDependency(currentProject, root, sv, canShowUI)) {
 115.286 -                return ;
 115.287 -            }
 115.288 -        }
 115.289 -    }
 115.290 -
 115.291 -    private static java.util.regex.Pattern SPEC_VERSION = java.util.regex.Pattern.compile("[0-9]+(\\.[0-9]+)+");
 115.292 -
 115.293 -    static SpecificationVersion computeSpecVersion(CompilationInfo info, Element el) {
 115.294 -        if (!Utilities.isJavadocSupported(info)) return null;
 115.295 -
 115.296 -        Doc javaDoc = info.getElementUtilities().javaDocFor(el);
 115.297 -
 115.298 -        if (javaDoc == null) return null;
 115.299 -
 115.300 -        for (Tag since : javaDoc.tags("@since")) {
 115.301 -            String text = since.text();
 115.302 -
 115.303 -            Matcher m = SPEC_VERSION.matcher(text);
 115.304 -
 115.305 -            if (!m.find()) {
 115.306 -                continue;
 115.307 -            }
 115.308 -
 115.309 -            return new SpecificationVersion(m.group()/*ver.toString()*/);
 115.310 -        }
 115.311 -
 115.312 -        return null;
 115.313 -    }
 115.314 -
 115.315 -    @SuppressWarnings("deprecation")
 115.316 -    private static FileObject getFile(CompilationInfo copy, Element e) {
 115.317 -        return SourceUtils.getFile(e, copy.getClasspathInfo());
 115.318 -    }
 115.319 -
 115.320 -    private static FileObject findRootForFile(final FileObject file, final ClasspathInfo cpInfo) {
 115.321 -        ClassPath cp = ClassPathSupport.createProxyClassPath(
 115.322 -            new ClassPath[] {
 115.323 -                cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE),
 115.324 -                cpInfo.getClassPath(ClasspathInfo.PathKind.BOOT),
 115.325 -                cpInfo.getClassPath(ClasspathInfo.PathKind.COMPILE),
 115.326 -            });
 115.327 -
 115.328 -        FileObject root = cp.findOwnerRoot(file);
 115.329 -
 115.330 -        if (root != null) {
 115.331 -            return root;
 115.332 -        }
 115.333 -
 115.334 -        for (ClassPath.Entry e : cp.entries()) {
 115.335 -            FileObject[] sourceRoots = SourceForBinaryQuery.findSourceRoots(e.getURL()).getRoots();
 115.336 -
 115.337 -            if (sourceRoots.length == 0) continue;
 115.338 -
 115.339 -            ClassPath sourcePath = ClassPathSupport.createClassPath(sourceRoots);
 115.340 -
 115.341 -            root = sourcePath.findOwnerRoot(file);
 115.342 -
 115.343 -            if (root != null) {
 115.344 -                return root;
 115.345 -            }
 115.346 -        }
 115.347 -        return null;
 115.348 -    }
 115.349 -
 115.350 -    private static boolean isStaticElement(Element el) {
 115.351 -        if (el == null) return false;
 115.352 -
 115.353 -        if (el.asType() == null || el.asType().getKind() == TypeKind.ERROR) {
 115.354 -            return false;
 115.355 -        }
 115.356 -
 115.357 -        if (el.getModifiers().contains(Modifier.STATIC)) {
 115.358 -            //XXX:
 115.359 -            if (!el.getKind().isClass() && !el.getKind().isInterface()) {
 115.360 -                return false;
 115.361 -            }
 115.362 -
 115.363 -            return true;
 115.364 -        }
 115.365 -
 115.366 -        if (el.getKind().isClass() || el.getKind().isInterface()) {
 115.367 -            return el.getEnclosingElement().getKind() == ElementKind.PACKAGE;
 115.368 -        }
 115.369 -
 115.370 -        return false;
 115.371 -    }
 115.372 -
 115.373 -    private static class JavaFixRealImpl extends JavaFix {
 115.374 -        private final String displayName;
 115.375 -        private final Map<String, TreePathHandle> params;
 115.376 -        private final Map<String, Object> extraParamsData;
 115.377 -        private final Map<String, Collection<TreePathHandle>> paramsMulti;
 115.378 -        private final Map<String, String> parameterNames;
 115.379 -        private final Map<String, TypeMirrorHandle<?>> constraintsHandles;
 115.380 -        private final Iterable<? extends String> imports;
 115.381 -        private final String to;
 115.382 -
 115.383 -        public JavaFixRealImpl(CompilationInfo info, TreePath what, Map<String, String> options, String displayName, String to, Map<String, TreePathHandle> params, Map<String, Object> extraParamsData, Map<String, Collection<TreePathHandle>> paramsMulti, final Map<String, String> parameterNames, Map<String, TypeMirrorHandle<?>> constraintsHandles, Iterable<? extends String> imports) {
 115.384 -            super(info, what, options);
 115.385 -
 115.386 -            this.displayName = displayName;
 115.387 -            this.to = to;
 115.388 -            this.params = params;
 115.389 -            this.extraParamsData = extraParamsData;
 115.390 -            this.paramsMulti = paramsMulti;
 115.391 -            this.parameterNames = parameterNames;
 115.392 -            this.constraintsHandles = constraintsHandles;
 115.393 -            this.imports = imports;
 115.394 -        }
 115.395 -
 115.396 -        @Override
 115.397 -        protected String getText() {
 115.398 -            return displayName;
 115.399 -        }
 115.400 -
 115.401 -        @Override
 115.402 -        protected void performRewrite(TransformationContext ctx) {
 115.403 -            final WorkingCopy wc = ctx.getWorkingCopy();
 115.404 -            TreePath tp = ctx.getPath();
 115.405 -            final Map<String, TreePath> parameters = new HashMap<String, TreePath>();
 115.406 -
 115.407 -            for (Entry<String, TreePathHandle> e : params.entrySet()) {
 115.408 -                TreePath p = e.getValue().resolve(wc);
 115.409 -
 115.410 -                if (p == null) {
 115.411 -                    Logger.getLogger(JavaFix.class.getName()).log(Level.SEVERE, "Cannot resolve handle={0}", e.getValue());
 115.412 -                }
 115.413 -
 115.414 -                parameters.put(e.getKey(), p);
 115.415 -            }
 115.416 -
 115.417 -            final Map<String, Collection<TreePath>> parametersMulti = new HashMap<String, Collection<TreePath>>();
 115.418 -
 115.419 -            for (Entry<String, Collection<TreePathHandle>> e : paramsMulti.entrySet()) {
 115.420 -                Collection<TreePath> tps = new LinkedList<TreePath>();
 115.421 -
 115.422 -                for (TreePathHandle tph : e.getValue()) {
 115.423 -                    TreePath p = tph.resolve(wc);
 115.424 -
 115.425 -                    if (p == null) {
 115.426 -                        Logger.getLogger(JavaFix.class.getName()).log(Level.SEVERE, "Cannot resolve handle={0}", e.getValue());
 115.427 -                    }
 115.428 -
 115.429 -                    tps.add(p);
 115.430 -                }
 115.431 -
 115.432 -                parametersMulti.put(e.getKey(), tps);
 115.433 -            }
 115.434 -
 115.435 -            Map<String, TypeMirror> constraints = new HashMap<String, TypeMirror>();
 115.436 -
 115.437 -            for (Entry<String, TypeMirrorHandle<?>> c : constraintsHandles.entrySet()) {
 115.438 -                constraints.put(c.getKey(), c.getValue().resolve(wc));
 115.439 -            }
 115.440 -
 115.441 -            Scope scope = Utilities.constructScope(wc, constraints, imports);
 115.442 -
 115.443 -            assert scope != null;
 115.444 -
 115.445 -            Tree parsed = Utilities.parseAndAttribute(wc, to, scope);
 115.446 -            
 115.447 -            if (parsed.getKind() == Kind.EXPRESSION_STATEMENT && ExpressionTree.class.isAssignableFrom(tp.getLeaf().getKind().asInterface())) {
 115.448 -                parsed = ((ExpressionStatementTree) parsed).getExpression();
 115.449 -            }
 115.450 -            
 115.451 -            Map<Tree, Tree> rewriteFromTo = new IdentityHashMap<Tree, Tree>();
 115.452 -            Tree original;
 115.453 -
 115.454 -            if (Utilities.isFakeBlock(parsed)) {
 115.455 -                TreePath parent = tp.getParentPath();
 115.456 -                List<? extends StatementTree> statements = ((BlockTree) parsed).getStatements();
 115.457 -                
 115.458 -                if (tp.getLeaf().getKind() == Kind.BLOCK) {
 115.459 -                    BlockTree real = (BlockTree) tp.getLeaf();
 115.460 -                    rewriteFromTo.put(original = real, wc.getTreeMaker().Block(statements, real.isStatic()));
 115.461 -                } else {
 115.462 -                    statements = statements.subList(1, statements.size() - 1);
 115.463 -
 115.464 -                    if (parent.getLeaf().getKind() == Kind.BLOCK) {
 115.465 -                        List<StatementTree> newStatements = new LinkedList<StatementTree>();
 115.466 -
 115.467 -                        for (StatementTree st : ((BlockTree) parent.getLeaf()).getStatements()) {
 115.468 -                            if (st == tp.getLeaf()) {
 115.469 -                                newStatements.addAll(statements);
 115.470 -                            } else {
 115.471 -                                newStatements.add(st);
 115.472 -                            }
 115.473 -                        }
 115.474 -
 115.475 -                        rewriteFromTo.put(original = parent.getLeaf(), wc.getTreeMaker().Block(newStatements, ((BlockTree) parent.getLeaf()).isStatic()));
 115.476 -                    } else {
 115.477 -                        rewriteFromTo.put(original = tp.getLeaf(), wc.getTreeMaker().Block(statements, false));
 115.478 -                    }
 115.479 -                }
 115.480 -            } else if (Utilities.isFakeClass(parsed)) {
 115.481 -                TreePath parent = tp.getParentPath();
 115.482 -                List<? extends Tree> members = ((ClassTree) parsed).getMembers();
 115.483 -
 115.484 -                members = members.subList(1, members.size());
 115.485 -
 115.486 -                assert parent.getLeaf().getKind() == Kind.CLASS;
 115.487 -
 115.488 -                List<Tree> newMembers = new LinkedList<Tree>();
 115.489 -
 115.490 -                ClassTree ct = (ClassTree) parent.getLeaf();
 115.491 -
 115.492 -                for (Tree t : ct.getMembers()) {
 115.493 -                    if (t == tp.getLeaf()) {
 115.494 -                        newMembers.addAll(members);
 115.495 -                    } else {
 115.496 -                        newMembers.add(t);
 115.497 -                    }
 115.498 -                }
 115.499 -
 115.500 -                rewriteFromTo.put(original = parent.getLeaf(), wc.getTreeMaker().Class(ct.getModifiers(), ct.getSimpleName(), ct.getTypeParameters(), ct.getExtendsClause(), ct.getImplementsClause(), newMembers));
 115.501 -            } else if (tp.getLeaf().getKind() == Kind.BLOCK && parametersMulti.containsKey("$$1$") && parsed.getKind() != Kind.BLOCK && StatementTree.class.isAssignableFrom(parsed.getKind().asInterface())) {
 115.502 -                List<StatementTree> newStatements = new LinkedList<StatementTree>();
 115.503 -
 115.504 -                newStatements.add(wc.getTreeMaker().ExpressionStatement(wc.getTreeMaker().Identifier("$$1$")));
 115.505 -                newStatements.add((StatementTree) parsed);
 115.506 -                newStatements.add(wc.getTreeMaker().ExpressionStatement(wc.getTreeMaker().Identifier("$$2$")));
 115.507 -
 115.508 -                parsed = wc.getTreeMaker().Block(newStatements, ((BlockTree) tp.getLeaf()).isStatic());
 115.509 -
 115.510 -                rewriteFromTo.put(original = tp.getLeaf(), parsed);
 115.511 -            } else {
 115.512 -                while (   tp.getParentPath().getLeaf().getKind() == Kind.PARENTHESIZED
 115.513 -                       && tp.getLeaf().getKind() != parsed.getKind()
 115.514 -                       && tp.getParentPath() != null
 115.515 -                       && tp.getParentPath().getParentPath() != null
 115.516 -                       && !requiresParenthesis(parsed, tp.getParentPath().getLeaf(), tp.getParentPath().getParentPath().getLeaf())
 115.517 -                       && requiresParenthesis(tp.getLeaf(), tp.getParentPath().getLeaf(), tp.getParentPath().getParentPath().getLeaf()))
 115.518 -                    tp = tp.getParentPath();
 115.519 -                rewriteFromTo.put(original = tp.getLeaf(), parsed);
 115.520 -            }
 115.521 -
 115.522 -            //prevent generating QualIdents inside import clauses - might be better to solve that inside ImportAnalysis2,
 115.523 -            //but that seems not to be straightforward:
 115.524 -            boolean inImport = parsed.getKind() == Kind.IMPORT;
 115.525 -            boolean inPackage = false;
 115.526 -            TreePath w = tp;
 115.527 -
 115.528 -            while (!inImport && w != null) {
 115.529 -                inImport |= w.getLeaf().getKind() == Kind.IMPORT;
 115.530 -                inPackage |= w.getParentPath() != null && w.getParentPath().getLeaf().getKind() == Kind.COMPILATION_UNIT && ((CompilationUnitTree) w.getParentPath().getLeaf()).getPackageName() == w.getLeaf();
 115.531 -                w = w.getParentPath();
 115.532 -            }
 115.533 -
 115.534 -            final Set<Tree> originalTrees = Collections.newSetFromMap(new IdentityHashMap<Tree, Boolean>());
 115.535 -            
 115.536 -            new TreeScanner<Void, Void>() {
 115.537 -                @Override public Void scan(Tree tree, Void p) {
 115.538 -                    originalTrees.add(tree);
 115.539 -                    return super.scan(tree, p);
 115.540 -                }
 115.541 -            }.scan(original, null);
 115.542 -            
 115.543 -            new ReplaceParameters(wc, ctx.isCanShowUI(), inImport, parameters, extraParamsData, parametersMulti, parameterNames, rewriteFromTo, originalTrees).scan(new TreePath(tp.getParentPath(), rewriteFromTo.get(original)), null);
 115.544 -
 115.545 -            if (inPackage) {
 115.546 -                String newPackage = wc.getTreeUtilities().translate(wc.getCompilationUnit().getPackageName(), new IdentityHashMap<Tree, Tree>(rewriteFromTo))./*XXX: not correct*/toString();
 115.547 -
 115.548 -                ClassPath source = wc.getClasspathInfo().getClassPath(PathKind.SOURCE);
 115.549 -                FileObject ownerRoot = source.findOwnerRoot(wc.getFileObject());
 115.550 -
 115.551 -                if (ownerRoot != null) {
 115.552 -                    ctx.getFileChanges().add(new MoveFile(wc.getFileObject(), ownerRoot, newPackage.replace('.', '/')));
 115.553 -                } else {
 115.554 -                    Logger.getLogger(JavaFix.class.getName()).log(Level.WARNING, "{0} not on its source path ({1})", new Object[] {FileUtil.getFileDisplayName(wc.getFileObject()), source.toString(PathConversionMode.PRINT)});
 115.555 -                }
 115.556 -            }
 115.557 -            
 115.558 -            for (Entry<Tree, Tree> e : rewriteFromTo.entrySet()) {
 115.559 -                wc.rewrite(e.getKey(), e.getValue());
 115.560 -            }
 115.561 -        }
 115.562 -    }
 115.563 -
 115.564 -    private static final Set<Kind> NUMBER_LITERAL_KINDS = EnumSet.of(Kind.FLOAT_LITERAL, Kind.DOUBLE_LITERAL, Kind.INT_LITERAL, Kind.LONG_LITERAL);
 115.565 -
 115.566 -    private static class ReplaceParameters extends TreePathScanner<Number, Void> {
 115.567 -
 115.568 -        private final CompilationInfo info;
 115.569 -        private final TreeMaker make;
 115.570 -        private final boolean canShowUI;
 115.571 -        private final boolean inImport;
 115.572 -        private final Map<String, TreePath> parameters;
 115.573 -        private final Map<String, Object> extraParamsData;
 115.574 -        private final Map<String, Collection<TreePath>> parametersMulti;
 115.575 -        private final Map<String, String> parameterNames;
 115.576 -        private final Map<Tree, Tree> rewriteFromTo;
 115.577 -        private final Set<Tree> originalTrees;
 115.578 -
 115.579 -        public ReplaceParameters(WorkingCopy wc, boolean canShowUI, boolean inImport, Map<String, TreePath> parameters, Map<String, Object> extraParamsData, Map<String, Collection<TreePath>> parametersMulti, Map<String, String> parameterNames, Map<Tree, Tree> rewriteFromTo, Set<Tree> originalTrees) {
 115.580 -            this.parameters = parameters;
 115.581 -            this.info = wc;
 115.582 -            this.make = wc.getTreeMaker();
 115.583 -            this.canShowUI = canShowUI;
 115.584 -            this.inImport = inImport;
 115.585 -            this.extraParamsData = extraParamsData;
 115.586 -            this.parametersMulti = parametersMulti;
 115.587 -            this.parameterNames = parameterNames;
 115.588 -            this.rewriteFromTo = rewriteFromTo;
 115.589 -            this.originalTrees = originalTrees;
 115.590 -        }
 115.591 -
 115.592 -        @Override
 115.593 -        public Number visitIdentifier(IdentifierTree node, Void p) {
 115.594 -            String name = node.getName().toString();
 115.595 -            Tree newNode = handleIdentifier(name, node);
 115.596 -            
 115.597 -            if (newNode != null) {
 115.598 -                rewrite(node, newNode);
 115.599 -                if (NUMBER_LITERAL_KINDS.contains(newNode.getKind())) {
 115.600 -                    return (Number) ((LiteralTree) newNode).getValue();
 115.601 -                }
 115.602 -            }
 115.603 -
 115.604 -            Element e = info.getTrees().getElement(getCurrentPath());
 115.605 -
 115.606 -            if (e != null && isStaticElement(e) && !inImport) {
 115.607 -                rewrite(node, make.QualIdent(e));
 115.608 -            }
 115.609 -
 115.610 -            return super.visitIdentifier(node, p);
 115.611 -        }
 115.612 -
 115.613 -        @Override
 115.614 -        public Number visitTypeParameter(TypeParameterTree node, Void p) {
 115.615 -            String name = node.getName().toString();
 115.616 -            Tree newNode = handleIdentifier(name, node);
 115.617 -            
 115.618 -            if (newNode != null) {
 115.619 -                rewrite(node, newNode);
 115.620 -                if (NUMBER_LITERAL_KINDS.contains(newNode.getKind())) {
 115.621 -                    return (Number) ((LiteralTree) newNode).getValue();
 115.622 -                }
 115.623 -            }
 115.624 -            
 115.625 -            return super.visitTypeParameter(node, p);
 115.626 -        }
 115.627 -        
 115.628 -        private Tree handleIdentifier(String name, Tree node) {
 115.629 -            TreePath tp = parameters.get(name);
 115.630 -
 115.631 -            if (tp != null) {
 115.632 -                if (tp.getLeaf() instanceof Hacks.RenameTree) {
 115.633 -                    Hacks.RenameTree rt = (Hacks.RenameTree) tp.getLeaf();
 115.634 -                    return make.setLabel(rt.originalTree, rt.newName);
 115.635 -                }
 115.636 -                if (!parameterNames.containsKey(name)) {
 115.637 -                    Tree target = tp.getLeaf();
 115.638 -                    if (NUMBER_LITERAL_KINDS.contains(target.getKind())) {
 115.639 -                        return target;
 115.640 -                    }
 115.641 -                    //TODO: might also remove parenthesis, but needs to ensure the diff will still be minimal
 115.642 -//                    while (target.getKind() == Kind.PARENTHESIZED
 115.643 -//                           && !requiresParenthesis(((ParenthesizedTree) target).getExpression(), getCurrentPath().getParentPath().getLeaf())) {
 115.644 -//                        target = ((ParenthesizedTree) target).getExpression();
 115.645 -//                    }
 115.646 -                    if (   getCurrentPath().getParentPath() != null
 115.647 -                        && getCurrentPath().getParentPath().getLeaf().getKind() == Kind.LOGICAL_COMPLEMENT
 115.648 -                        && (   tp.getParentPath() == null
 115.649 -                            || tp.getParentPath().getLeaf().getKind() != Kind.LOGICAL_COMPLEMENT)) {
 115.650 -                        Tree negated = negate((ExpressionTree) tp.getLeaf(), getCurrentPath().getParentPath().getParentPath().getLeaf(), true);
 115.651 -                        
 115.652 -                        if (negated != null) {
 115.653 -                            rewrite(getCurrentPath().getParentPath().getLeaf(), negated);
 115.654 -                        }
 115.655 -                    }
 115.656 -                    if (requiresParenthesis(target, node, getCurrentPath().getParentPath().getLeaf())) {
 115.657 -                        target = make.Parenthesized((ExpressionTree) target);
 115.658 -                    }
 115.659 -                    return target;
 115.660 -                }
 115.661 -            }
 115.662 -
 115.663 -            String variableName = parameterNames.get(name);
 115.664 -
 115.665 -            if (variableName != null) {
 115.666 -                return make.Identifier(variableName);
 115.667 -            }
 115.668 -            
 115.669 -            return null;
 115.670 -        }
 115.671 -
 115.672 -        @Override
 115.673 -        public Number visitMemberSelect(MemberSelectTree node, Void p) {
 115.674 -            Element e = info.getTrees().getElement(getCurrentPath());
 115.675 -
 115.676 -            if (e != null && (e.getKind() != ElementKind.CLASS || ((TypeElement) e).asType().getKind() != TypeKind.ERROR)) {
 115.677 -                //check correct dependency:
 115.678 -                checkDependency(info, e, canShowUI);
 115.679 -
 115.680 -                if (isStaticElement(e) && !inImport) {
 115.681 -                    rewrite(node, make.QualIdent(e));
 115.682 -
 115.683 -                    return null;
 115.684 -                }
 115.685 -            }
 115.686 -            
 115.687 -            MemberSelectTree nue = node;
 115.688 -            String selectedName = node.getIdentifier().toString();
 115.689 -
 115.690 -            if (selectedName.startsWith("$") && parameterNames.get(selectedName) != null) {
 115.691 -                nue = make.MemberSelect(node.getExpression(), parameterNames.get(selectedName));
 115.692 -            }
 115.693 -
 115.694 -            if (nue.getExpression().getKind() == Kind.IDENTIFIER) {
 115.695 -                String name = ((IdentifierTree) nue.getExpression()).getName().toString();
 115.696 -
 115.697 -                if (name.startsWith("$") && parameters.get(name) == null) {
 115.698 -                    //XXX: unbound variable, use identifier instead of member select - may cause problems?
 115.699 -                    rewrite(node, make.Identifier(nue.getIdentifier()));
 115.700 -                    return null;
 115.701 -                }
 115.702 -            }
 115.703 -
 115.704 -            if (nue != node) {
 115.705 -                rewrite(node, nue);
 115.706 -            }
 115.707 -            
 115.708 -            return super.visitMemberSelect(node, p);
 115.709 -        }
 115.710 -
 115.711 -        @Override
 115.712 -        public Number visitVariable(VariableTree node, Void p) {
 115.713 -            String name = node.getName().toString();
 115.714 -
 115.715 -            if (name.startsWith("$")) {
 115.716 -                String nueName = parameterNames.get(name);
 115.717 -
 115.718 -                if (nueName != null) {
 115.719 -                    name = nueName;
 115.720 -                }
 115.721 -            }
 115.722 -            
 115.723 -            VariableTree nue = make.Variable(node.getModifiers(), name, node.getType(), resolveOptionalValue(node.getInitializer()));
 115.724 -
 115.725 -            rewrite(node, nue);
 115.726 -
 115.727 -            return super.visitVariable(nue, p);
 115.728 -        }
 115.729 -
 115.730 -        @Override
 115.731 -        public Number visitIf(IfTree node, Void p) {
 115.732 -            IfTree nue = make.If(node.getCondition(), node.getThenStatement(), resolveOptionalValue(node.getElseStatement()));
 115.733 -            
 115.734 -            rewrite(node, nue);
 115.735 -            
 115.736 -            return super.visitIf(nue, p);
 115.737 -        }
 115.738 -
 115.739 -        @Override
 115.740 -        public Number visitMethod(MethodTree node, Void p) {
 115.741 -            String name = node.getName().toString();
 115.742 -            String newName = name;
 115.743 -
 115.744 -            if (name.startsWith("$")) {
 115.745 -                if (parameterNames.containsKey(name)) {
 115.746 -                    newName = parameterNames.get(name);
 115.747 -                }
 115.748 -            }
 115.749 -
 115.750 -            List<? extends TypeParameterTree> typeParams = resolveMultiParameters(node.getTypeParameters());
 115.751 -            List<? extends VariableTree> params = resolveMultiParameters(node.getParameters());
 115.752 -            List<? extends ExpressionTree> thrown = resolveMultiParameters(node.getThrows());
 115.753 -            
 115.754 -            MethodTree nue = make.Method(node.getModifiers(), newName, node.getReturnType(), typeParams, params, thrown, node.getBody(), (ExpressionTree) node.getDefaultValue());
 115.755 -            
 115.756 -            rewrite(node, nue);
 115.757 -            
 115.758 -            return super.visitMethod(nue, p);
 115.759 -        }
 115.760 -
 115.761 -        @Override
 115.762 -        public Number visitClass(ClassTree node, Void p) {
 115.763 -            String name = node.getSimpleName().toString();
 115.764 -            String newName = name;
 115.765 -
 115.766 -            if (name.startsWith("$")) {
 115.767 -                if (parameterNames.containsKey(name)) {
 115.768 -                    newName = parameterNames.get(name);
 115.769 -                }
 115.770 -            }
 115.771 -
 115.772 -            List<? extends TypeParameterTree> typeParams = resolveMultiParameters(node.getTypeParameters());
 115.773 -            List<? extends Tree> implementsClauses = resolveMultiParameters(node.getImplementsClause());
 115.774 -            List<? extends Tree> members = resolveMultiParameters(Utilities.filterHidden(getCurrentPath(), node.getMembers()));
 115.775 -            Tree extend = resolveOptionalValue(node.getExtendsClause());
 115.776 -            ClassTree nue = make.Class(node.getModifiers(), newName, typeParams, extend, implementsClauses, members);
 115.777 -            
 115.778 -            rewrite(node, nue);
 115.779 -            
 115.780 -            return super.visitClass(nue, p);
 115.781 -        }
 115.782 -
 115.783 -        @Override
 115.784 -        public Number visitExpressionStatement(ExpressionStatementTree node, Void p) {
 115.785 -            CharSequence name = Utilities.getWildcardTreeName(node);
 115.786 -
 115.787 -            if (name != null) {
 115.788 -                TreePath tp = parameters.get(name.toString());
 115.789 -
 115.790 -                if (tp != null) {
 115.791 -                    rewrite(node, tp.getLeaf());
 115.792 -                    return null;
 115.793 -                }
 115.794 -            }
 115.795 -
 115.796 -            return super.visitExpressionStatement(node, p);
 115.797 -        }
 115.798 -
 115.799 -        @Override
 115.800 -        public Number visitLiteral(LiteralTree node, Void p) {
 115.801 -            if (node.getValue() instanceof Number) {
 115.802 -                return (Number) node.getValue();
 115.803 -            }
 115.804 -
 115.805 -            return super.visitLiteral(node, p);
 115.806 -        }
 115.807 -
 115.808 -        @Override
 115.809 -        public Number visitBinary(BinaryTree node, Void p) {
 115.810 -            Number left  = scan(node.getLeftOperand(), p);
 115.811 -            Number right = scan(node.getRightOperand(), p);
 115.812 -
 115.813 -            if (left != null && right != null) {
 115.814 -                Number result = null;
 115.815 -                switch (node.getKind()) {
 115.816 -                    case MULTIPLY:
 115.817 -                            if (left instanceof Double || right instanceof Double) {
 115.818 -                                result = left.doubleValue() * right.doubleValue();
 115.819 -                            } else if (left instanceof Float || right instanceof Float) {
 115.820 -                                result = left.floatValue() * right.floatValue();
 115.821 -                            } else if (left instanceof Long || right instanceof Long) {
 115.822 -                                result = left.longValue() * right.longValue();
 115.823 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.824 -                                result = left.intValue() * right.intValue();
 115.825 -                            } else {
 115.826 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.827 -                            }
 115.828 -                            break;
 115.829 -
 115.830 -                    case DIVIDE:
 115.831 -                            if (left instanceof Double || right instanceof Double) {
 115.832 -                                result = left.doubleValue() / right.doubleValue();
 115.833 -                            } else if (left instanceof Float || right instanceof Float) {
 115.834 -                                result = left.floatValue() / right.floatValue();
 115.835 -                            } else if (left instanceof Long || right instanceof Long) {
 115.836 -                                result = left.longValue() / right.longValue();
 115.837 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.838 -                                result = left.intValue() / right.intValue();
 115.839 -                            } else {
 115.840 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.841 -                            }
 115.842 -                            break;
 115.843 -
 115.844 -                    case REMAINDER:
 115.845 -                            if (left instanceof Double || right instanceof Double) {
 115.846 -                                result = left.doubleValue() % right.doubleValue();
 115.847 -                            } else if (left instanceof Float || right instanceof Float) {
 115.848 -                                result = left.floatValue() % right.floatValue();
 115.849 -                            } else if (left instanceof Long || right instanceof Long) {
 115.850 -                                result = left.longValue() % right.longValue();
 115.851 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.852 -                                result = left.intValue() % right.intValue();
 115.853 -                            } else {
 115.854 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.855 -                            }
 115.856 -                            break;
 115.857 -
 115.858 -                    case PLUS:
 115.859 -                            if (left instanceof Double || right instanceof Double) {
 115.860 -                                result = left.doubleValue() + right.doubleValue();
 115.861 -                            } else if (left instanceof Float || right instanceof Float) {
 115.862 -                                result = left.floatValue() + right.floatValue();
 115.863 -                            } else if (left instanceof Long || right instanceof Long) {
 115.864 -                                result = left.longValue() + right.longValue();
 115.865 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.866 -                                result = left.intValue() + right.intValue();
 115.867 -                            } else {
 115.868 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.869 -                            }
 115.870 -                            break;
 115.871 -
 115.872 -                    case MINUS:
 115.873 -                            if (left instanceof Double || right instanceof Double) {
 115.874 -                                result = left.doubleValue() - right.doubleValue();
 115.875 -                            } else if (left instanceof Float || right instanceof Float) {
 115.876 -                                result = left.floatValue() - right.floatValue();
 115.877 -                            } else if (left instanceof Long || right instanceof Long) {
 115.878 -                                result = left.longValue() - right.longValue();
 115.879 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.880 -                                result = left.intValue() - right.intValue();
 115.881 -                            } else {
 115.882 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.883 -                            }
 115.884 -                            break;
 115.885 -
 115.886 -                    case LEFT_SHIFT:
 115.887 -                            if (left instanceof Long || right instanceof Long) {
 115.888 -                                result = left.longValue() << right.longValue();
 115.889 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.890 -                                result = left.intValue() << right.intValue();
 115.891 -                            } else {
 115.892 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.893 -                            }
 115.894 -                            break;
 115.895 -
 115.896 -                    case RIGHT_SHIFT:
 115.897 -                            if (left instanceof Long || right instanceof Long) {
 115.898 -                                result = left.longValue() >> right.longValue();
 115.899 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.900 -                                result = left.intValue() >> right.intValue();
 115.901 -                            } else {
 115.902 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.903 -                            }
 115.904 -                            break;
 115.905 -
 115.906 -                    case UNSIGNED_RIGHT_SHIFT:
 115.907 -                            if (left instanceof Long || right instanceof Long) {
 115.908 -                                result = left.longValue() >>> right.longValue();
 115.909 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.910 -                                result = left.intValue() >>> right.intValue();
 115.911 -                            } else {
 115.912 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.913 -                            }
 115.914 -                            break;
 115.915 -
 115.916 -                    case AND:
 115.917 -                            if (left instanceof Long || right instanceof Long) {
 115.918 -                                result = left.longValue() & right.longValue();
 115.919 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.920 -                                result = left.intValue() & right.intValue();
 115.921 -                            } else {
 115.922 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.923 -                            }
 115.924 -                            break;
 115.925 -
 115.926 -                    case XOR:
 115.927 -                            if (left instanceof Long || right instanceof Long) {
 115.928 -                                result = left.longValue() ^ right.longValue();
 115.929 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.930 -                                result = left.intValue() ^ right.intValue();
 115.931 -                            } else {
 115.932 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.933 -                            }
 115.934 -                            break;
 115.935 -
 115.936 -                    case OR:
 115.937 -                            if (left instanceof Long || right instanceof Long) {
 115.938 -                                result = left.longValue() | right.longValue();
 115.939 -                            } else if (left instanceof Integer || right instanceof Integer) {
 115.940 -                                result = left.intValue() | right.intValue();
 115.941 -                            } else {
 115.942 -                                throw new IllegalStateException("left=" + left.getClass() + ", right=" + right.getClass());
 115.943 -                            }
 115.944 -                            break;
 115.945 -                }
 115.946 -
 115.947 -                if (result != null) {
 115.948 -                    rewrite(node, make.Literal(result));
 115.949 -
 115.950 -                    return result;
 115.951 -                }
 115.952 -            }
 115.953 -
 115.954 -            return null;
 115.955 -        }
 115.956 -
 115.957 -        @Override
 115.958 -        public Number visitUnary(UnaryTree node, Void p) {
 115.959 -            Number op  = scan(node.getExpression(), p);
 115.960 -
 115.961 -            if (op != null) {
 115.962 -                Number result = null;
 115.963 -                switch (node.getKind()) {
 115.964 -                    case UNARY_MINUS:
 115.965 -                            if (op instanceof Double) {
 115.966 -                                result = -op.doubleValue();
 115.967 -                            } else if (op instanceof Float) {
 115.968 -                                result = -op.floatValue();
 115.969 -                            } else if (op instanceof Long) {
 115.970 -                                result = -op.longValue();
 115.971 -                            } else if (op instanceof Integer) {
 115.972 -                                result = -op.intValue();
 115.973 -                            } else {
 115.974 -                                throw new IllegalStateException("op=" + op.getClass());
 115.975 -                            }
 115.976 -                            break;
 115.977 -                    case UNARY_PLUS:
 115.978 -                        result = op;
 115.979 -                        break;
 115.980 -                }
 115.981 -
 115.982 -                if (result != null) {
 115.983 -                    rewrite(node, make.Literal(result));
 115.984 -
 115.985 -                    return result;
 115.986 -                }
 115.987 -            }
 115.988 -
 115.989 -            return super.visitUnary(node, p);
 115.990 -        }
 115.991 -
 115.992 -        @Override
 115.993 -        public Number visitBlock(BlockTree node, Void p) {
 115.994 -            List<? extends StatementTree> nueStatement = resolveMultiParameters(node.getStatements());
 115.995 -            BlockTree nue = make.Block(nueStatement, node.isStatic());
 115.996 -
 115.997 -            rewrite(node, nue);
 115.998 -
 115.999 -            return super.visitBlock(nue, p);
115.1000 -        }
115.1001 -
115.1002 -        @Override
115.1003 -        public Number visitCase(CaseTree node, Void p) {
115.1004 -            List<? extends StatementTree> statements = (List<? extends StatementTree>) resolveMultiParameters(node.getStatements());
115.1005 -            CaseTree nue = make.Case(node.getExpression(), statements);
115.1006 -
115.1007 -            rewrite(node, nue);
115.1008 -            return super.visitCase(node, p);
115.1009 -        }
115.1010 -
115.1011 -        @Override
115.1012 -        public Number visitMethodInvocation(MethodInvocationTree node, Void p) {
115.1013 -            List<? extends ExpressionTree> typeArgs = (List<? extends ExpressionTree>) resolveMultiParameters(node.getTypeArguments());
115.1014 -            List<? extends ExpressionTree> args = resolveMultiParameters(node.getArguments());
115.1015 -            MethodInvocationTree nue = make.MethodInvocation(typeArgs, node.getMethodSelect(), args);
115.1016 -
115.1017 -            rewrite(node, nue);
115.1018 -
115.1019 -            return super.visitMethodInvocation(nue, p);
115.1020 -        }
115.1021 -
115.1022 -        @Override
115.1023 -        public Number visitNewClass(NewClassTree node, Void p) {
115.1024 -            List<? extends ExpressionTree> typeArgs = (List<? extends ExpressionTree>) resolveMultiParameters(node.getTypeArguments());
115.1025 -            List<? extends ExpressionTree> args = resolveMultiParameters(node.getArguments());
115.1026 -            NewClassTree nue = make.NewClass(node.getEnclosingExpression(), typeArgs, node.getIdentifier(), args, node.getClassBody());
115.1027 -
115.1028 -            rewrite(node, nue);
115.1029 -            return super.visitNewClass(nue, p);
115.1030 -        }
115.1031 -
115.1032 -        @Override
115.1033 -        public Number visitParameterizedType(ParameterizedTypeTree node, Void p) {
115.1034 -            List<? extends ExpressionTree> typeArgs = (List<? extends ExpressionTree>) resolveMultiParameters(node.getTypeArguments());
115.1035 -            ParameterizedTypeTree nue = make.ParameterizedType(node.getType(), typeArgs);
115.1036 -
115.1037 -            rewrite(node, nue);
115.1038 -            return super.visitParameterizedType(node, p);
115.1039 -        }
115.1040 -
115.1041 -        @Override
115.1042 -        public Number visitSwitch(SwitchTree node, Void p) {
115.1043 -            List<? extends CaseTree> cases = (List<? extends CaseTree>) resolveMultiParameters(node.getCases());
115.1044 -            SwitchTree nue = make.Switch(node.getExpression(), cases);
115.1045 -
115.1046 -            rewrite(node, nue);
115.1047 -            return super.visitSwitch(node, p);
115.1048 -        }
115.1049 -
115.1050 -        @Override
115.1051 -        public Number visitTry(TryTree node, Void p) {
115.1052 -            List<? extends Tree> resources = (List<? extends Tree>) resolveMultiParameters(node.getResources());
115.1053 -            List<? extends CatchTree> catches = (List<? extends CatchTree>) resolveMultiParameters(node.getCatches());
115.1054 -            TryTree nue = make.Try(resources, node.getBlock(), catches, node.getFinallyBlock());
115.1055 -
115.1056 -            rewrite(node, nue);
115.1057 -            return super.visitTry(node, p);
115.1058 -        }
115.1059 -
115.1060 -        @Override
115.1061 -        public Number visitModifiers(ModifiersTree node, Void p) {
115.1062 -            List<AnnotationTree> annotations = new ArrayList<AnnotationTree>(node.getAnnotations());
115.1063 -            IdentifierTree ident = !annotations.isEmpty() && annotations.get(0).getAnnotationType().getKind() == Kind.IDENTIFIER ? (IdentifierTree) annotations.get(0).getAnnotationType() : null;
115.1064 -
115.1065 -            if (ident != null) {
115.1066 -                annotations.remove(0);
115.1067 -                
115.1068 -                String name = ident.getName().toString();
115.1069 -                TreePath orig = parameters.get(name);
115.1070 -                ModifiersTree nue;
115.1071 -                
115.1072 -                if (orig != null && orig.getLeaf().getKind() == Kind.MODIFIERS) {
115.1073 -                    ModifiersTree origMods = (ModifiersTree) orig.getLeaf();
115.1074 -                    Object actualContent = extraParamsData.get(name);
115.1075 -                    Set<Modifier> actualFlags = EnumSet.noneOf(Modifier.class);
115.1076 -                    boolean[] actualAnnotationsMask = new boolean[0];
115.1077 -                    
115.1078 -                    if (actualContent instanceof Object[] && ((Object[]) actualContent)[0] instanceof Set) {
115.1079 -                        actualFlags.addAll(NbCollections.checkedSetByFilter((Set) ((Object[]) actualContent)[0], Modifier.class, false));
115.1080 -                    }
115.1081 -                    
115.1082 -                    if (actualContent instanceof Object[] && ((Object[]) actualContent)[1] instanceof boolean[]) {
115.1083 -                        actualAnnotationsMask = (boolean[]) ((Object[]) actualContent)[1];
115.1084 -                    }
115.1085 -                    
115.1086 -                    nue = origMods;
115.1087 -                    
115.1088 -                    for (Modifier m : origMods.getFlags()) {
115.1089 -                        if (actualFlags.contains(m)) continue;
115.1090 -                        nue = make.removeModifiersModifier(nue, m);
115.1091 -                    }
115.1092 -                    
115.1093 -                    for (Modifier m : node.getFlags()) {
115.1094 -                        nue = make.addModifiersModifier(nue, m);
115.1095 -                    }
115.1096 -                    
115.1097 -                    int ai = 0;
115.1098 -                    
115.1099 -                    OUTER: for (AnnotationTree a : origMods.getAnnotations()) {
115.1100 -                        if (actualAnnotationsMask.length <= ai || actualAnnotationsMask[ai++]) continue;
115.1101 -                        for (Iterator<AnnotationTree> it = annotations.iterator(); it.hasNext();) {
115.1102 -                            AnnotationTree toCheck = it.next();
115.1103 -                            Collection<? extends Occurrence> match = org.netbeans.api.java.source.matching.Matcher.create(info).setTreeTopSearch().setSearchRoot(new TreePath(getCurrentPath(), a)).match(Pattern.createSimplePattern(new TreePath(getCurrentPath(), toCheck)));
115.1104 -                            
115.1105 -                            if (!match.isEmpty()) {
115.1106 -                                //should be kept:
115.1107 -                                it.remove();
115.1108 -                                break OUTER;
115.1109 -                            }
115.1110 -                        }
115.1111 -                        
115.1112 -                        nue = make.removeModifiersAnnotation(nue, a);
115.1113 -                    }
115.1114 -                    
115.1115 -                    for (AnnotationTree a : annotations) {
115.1116 -                        nue = make.addModifiersAnnotation(nue, a);
115.1117 -                        scan(a, p);
115.1118 -                    }
115.1119 -                } else {
115.1120 -                    nue = make.removeModifiersAnnotation(node, 0);
115.1121 -                }
115.1122 -                
115.1123 -                rewrite(node, nue);
115.1124 -                
115.1125 -                return null;
115.1126 -            }
115.1127 -            
115.1128 -            return super.visitModifiers(node, p);
115.1129 -        }
115.1130 -
115.1131 -        @Override
115.1132 -        public Number visitNewArray(NewArrayTree node, Void p) {
115.1133 -            List<? extends ExpressionTree> dimensions = (List<? extends ExpressionTree>) resolveMultiParameters(node.getDimensions());
115.1134 -            List<? extends ExpressionTree> initializers = (List<? extends ExpressionTree>) resolveMultiParameters(node.getInitializers());
115.1135 -            NewArrayTree nue = make.NewArray(node.getType(), dimensions, initializers);
115.1136 -
115.1137 -            rewrite(node, nue);
115.1138 -            return super.visitNewArray(node, p);
115.1139 -        }
115.1140 -
115.1141 -        @Override
115.1142 -        public Number visitLambdaExpression(LambdaExpressionTree node, Void p) {
115.1143 -            List<? extends VariableTree> args = resolveMultiParameters(node.getParameters());
115.1144 -            LambdaExpressionTree nue = make.LambdaExpression(args, node.getBody());
115.1145 -
115.1146 -            rewrite(node, nue);
115.1147 -
115.1148 -            return super.visitLambdaExpression(node, p);
115.1149 -        }
115.1150 -
115.1151 -        @Override
115.1152 -        public Number visitAnnotation(AnnotationTree node, Void p) {
115.1153 -            List<? extends ExpressionTree> args = resolveMultiParameters(node.getArguments());
115.1154 -            AnnotationTree nue = make.Annotation(node.getAnnotationType(), args);
115.1155 -
115.1156 -            rewrite(node, nue);
115.1157 -
115.1158 -            return super.visitAnnotation(node, p);
115.1159 -        }
115.1160 -
115.1161 -        private <T extends Tree> List<T> resolveMultiParameters(List<T> list) {
115.1162 -            if (list == null) return null;
115.1163 -            if (!Utilities.containsMultistatementTrees(list)) return list;
115.1164 -
115.1165 -            List<T> result = new LinkedList<T>();
115.1166 -
115.1167 -            for (T t : list) {
115.1168 -                if (Utilities.isMultistatementWildcardTree(t)) {
115.1169 -                    Collection<TreePath> embedded = parametersMulti.get(Utilities.getWildcardTreeName(t).toString());
115.1170 -
115.1171 -                    if (embedded != null) {
115.1172 -                        for (TreePath tp : embedded) {
115.1173 -                            result.add((T) tp.getLeaf());
115.1174 -                        }
115.1175 -                    }
115.1176 -                } else {
115.1177 -                    result.add(t);
115.1178 -                }
115.1179 -            }
115.1180 -
115.1181 -            return result;
115.1182 -        }
115.1183 -        
115.1184 -        private <T extends Tree> T resolveOptionalValue(T in) {
115.1185 -            if (in != null && Utilities.isMultistatementWildcardTree(in)) {
115.1186 -                TreePath out = parameters.get(Utilities.getWildcardTreeName(in).toString());
115.1187 -                if (out != null) return (T) out.getLeaf();
115.1188 -                return null;
115.1189 -            }
115.1190 -            
115.1191 -            return in;
115.1192 -        }
115.1193 -
115.1194 -        private ExpressionTree negate(ExpressionTree original, Tree parent, boolean nullOnPlainNeg) {
115.1195 -            ExpressionTree newTree;
115.1196 -            switch (original.getKind()) {
115.1197 -                case PARENTHESIZED:
115.1198 -                    ExpressionTree expr = ((ParenthesizedTree) original).getExpression();
115.1199 -                    return make.Parenthesized(negate(expr, original, nullOnPlainNeg));
115.1200 -                case LOGICAL_COMPLEMENT:
115.1201 -                    newTree = ((UnaryTree) original).getExpression();
115.1202 -                    while (newTree.getKind() == Kind.PARENTHESIZED && !JavaFixUtilities.requiresParenthesis(((ParenthesizedTree) newTree).getExpression(), original, parent)) {
115.1203 -                        newTree = ((ParenthesizedTree) newTree).getExpression();
115.1204 -                    }
115.1205 -                    break;
115.1206 -                case NOT_EQUAL_TO:
115.1207 -                    newTree = negateBinaryOperator(original, Kind.EQUAL_TO, false);
115.1208 -                    break;
115.1209 -                case EQUAL_TO:
115.1210 -                    newTree = negateBinaryOperator(original, Kind.NOT_EQUAL_TO, false);
115.1211 -                    break;
115.1212 -                case BOOLEAN_LITERAL:
115.1213 -                    newTree = make.Literal(!(Boolean) ((LiteralTree) original).getValue());
115.1214 -                    break;
115.1215 -                case CONDITIONAL_AND:
115.1216 -                    newTree = negateBinaryOperator(original, Kind.CONDITIONAL_OR, true);
115.1217 -                    break;
115.1218 -                case CONDITIONAL_OR:
115.1219 -                    newTree = negateBinaryOperator(original, Kind.CONDITIONAL_AND, true);
115.1220 -                    break;
115.1221 -                case LESS_THAN:
115.1222 -                    newTree = negateBinaryOperator(original, Kind.GREATER_THAN_EQUAL, false);
115.1223 -                    break;
115.1224 -                case LESS_THAN_EQUAL:
115.1225 -                    newTree = negateBinaryOperator(original, Kind.GREATER_THAN, false);
115.1226 -                    break;
115.1227 -                case GREATER_THAN:
115.1228 -                    newTree = negateBinaryOperator(original, Kind.LESS_THAN_EQUAL, false);
115.1229 -                    break;
115.1230 -                case GREATER_THAN_EQUAL:
115.1231 -                    newTree = negateBinaryOperator(original, Kind.LESS_THAN, false);
115.1232 -                    break;
115.1233 -                default:
115.1234 -                    if (nullOnPlainNeg)
115.1235 -                        return null;
115.1236 -                    newTree = make.Unary(Kind.LOGICAL_COMPLEMENT, original);
115.1237 -            }
115.1238 -         
115.1239 -            if (JavaFixUtilities.requiresParenthesis(newTree, original, parent)) {
115.1240 -                newTree = make.Parenthesized(newTree);
115.1241 -            }
115.1242 -            
115.1243 -            return newTree;
115.1244 -        }
115.1245 -        
115.1246 -        private ExpressionTree negateBinaryOperator(Tree original, Kind newKind, boolean negateOperands) {
115.1247 -            BinaryTree bt = (BinaryTree) original;
115.1248 -            BinaryTree nonNegated = make.Binary(newKind,
115.1249 -                                                bt.getLeftOperand(),
115.1250 -                                                bt.getRightOperand());
115.1251 -            if (negateOperands) {
115.1252 -                ExpressionTree lo = negate(bt.getLeftOperand(), nonNegated, false);
115.1253 -                ExpressionTree ro = negate(bt.getRightOperand(), nonNegated, false);
115.1254 -                return make.Binary(newKind,
115.1255 -                                   lo != null ? lo : bt.getLeftOperand(),
115.1256 -                                   ro != null ? ro : bt.getRightOperand());
115.1257 -            }
115.1258 -            return nonNegated;
115.1259 -        }
115.1260 -        
115.1261 -        private void rewrite(Tree from, Tree to) {
115.1262 -            if (originalTrees.contains(from)) return ;
115.1263 -            rewriteFromTo.put(from, to);
115.1264 -        }
115.1265 -    }
115.1266 -
115.1267 -    private static final Map<Kind, Integer> OPERATOR_PRIORITIES;
115.1268 -
115.1269 -    static {
115.1270 -        OPERATOR_PRIORITIES = new EnumMap<Kind, Integer>(Kind.class);
115.1271 -
115.1272 -        OPERATOR_PRIORITIES.put(Kind.IDENTIFIER, 0);
115.1273 -
115.1274 -        for (Kind k : Kind.values()) {
115.1275 -            if (k.asInterface() == LiteralTree.class) {
115.1276 -                OPERATOR_PRIORITIES.put(k, 0);
115.1277 -            }
115.1278 -        }
115.1279 -
115.1280 -        OPERATOR_PRIORITIES.put(Kind.ARRAY_ACCESS, 1);
115.1281 -        OPERATOR_PRIORITIES.put(Kind.METHOD_INVOCATION, 1);
115.1282 -        OPERATOR_PRIORITIES.put(Kind.MEMBER_SELECT, 1);
115.1283 -        OPERATOR_PRIORITIES.put(Kind.POSTFIX_DECREMENT, 1);
115.1284 -        OPERATOR_PRIORITIES.put(Kind.POSTFIX_INCREMENT, 1);
115.1285 -        OPERATOR_PRIORITIES.put(Kind.NEW_ARRAY, 1);
115.1286 -        OPERATOR_PRIORITIES.put(Kind.NEW_CLASS, 1);
115.1287 -
115.1288 -        OPERATOR_PRIORITIES.put(Kind.BITWISE_COMPLEMENT, 2);
115.1289 -        OPERATOR_PRIORITIES.put(Kind.LOGICAL_COMPLEMENT, 2);
115.1290 -        OPERATOR_PRIORITIES.put(Kind.PREFIX_DECREMENT, 2);
115.1291 -        OPERATOR_PRIORITIES.put(Kind.PREFIX_INCREMENT, 2);
115.1292 -        OPERATOR_PRIORITIES.put(Kind.UNARY_MINUS, 2);
115.1293 -        OPERATOR_PRIORITIES.put(Kind.UNARY_PLUS, 2);
115.1294 -
115.1295 -        OPERATOR_PRIORITIES.put(Kind.TYPE_CAST, 3);
115.1296 -
115.1297 -        OPERATOR_PRIORITIES.put(Kind.DIVIDE, 4);
115.1298 -        OPERATOR_PRIORITIES.put(Kind.MULTIPLY, 4);
115.1299 -        OPERATOR_PRIORITIES.put(Kind.REMAINDER, 4);
115.1300 -
115.1301 -        OPERATOR_PRIORITIES.put(Kind.MINUS, 5);
115.1302 -        OPERATOR_PRIORITIES.put(Kind.PLUS, 5);
115.1303 -
115.1304 -        OPERATOR_PRIORITIES.put(Kind.LEFT_SHIFT, 6);
115.1305 -        OPERATOR_PRIORITIES.put(Kind.RIGHT_SHIFT, 6);
115.1306 -        OPERATOR_PRIORITIES.put(Kind.UNSIGNED_RIGHT_SHIFT, 6);
115.1307 -
115.1308 -        OPERATOR_PRIORITIES.put(Kind.INSTANCE_OF, 7);
115.1309 -        OPERATOR_PRIORITIES.put(Kind.GREATER_THAN, 7);
115.1310 -        OPERATOR_PRIORITIES.put(Kind.GREATER_THAN_EQUAL, 7);
115.1311 -        OPERATOR_PRIORITIES.put(Kind.LESS_THAN, 7);
115.1312 -        OPERATOR_PRIORITIES.put(Kind.LESS_THAN_EQUAL, 7);
115.1313 -
115.1314 -        OPERATOR_PRIORITIES.put(Kind.EQUAL_TO, 8);
115.1315 -        OPERATOR_PRIORITIES.put(Kind.NOT_EQUAL_TO, 8);
115.1316 -
115.1317 -        OPERATOR_PRIORITIES.put(Kind.AND, 9);
115.1318 -        OPERATOR_PRIORITIES.put(Kind.OR, 11);
115.1319 -        OPERATOR_PRIORITIES.put(Kind.XOR, 10);
115.1320 -
115.1321 -        OPERATOR_PRIORITIES.put(Kind.CONDITIONAL_AND, 12);
115.1322 -        OPERATOR_PRIORITIES.put(Kind.CONDITIONAL_OR, 13);
115.1323 -
115.1324 -        OPERATOR_PRIORITIES.put(Kind.CONDITIONAL_EXPRESSION, 14);
115.1325 -
115.1326 -        OPERATOR_PRIORITIES.put(Kind.AND_ASSIGNMENT, 15);
115.1327 -        OPERATOR_PRIORITIES.put(Kind.ASSIGNMENT, 15);
115.1328 -        OPERATOR_PRIORITIES.put(Kind.DIVIDE_ASSIGNMENT, 15);
115.1329 -        OPERATOR_PRIORITIES.put(Kind.LEFT_SHIFT_ASSIGNMENT, 15);
115.1330 -        OPERATOR_PRIORITIES.put(Kind.MINUS_ASSIGNMENT, 15);
115.1331 -        OPERATOR_PRIORITIES.put(Kind.MULTIPLY_ASSIGNMENT, 15);
115.1332 -        OPERATOR_PRIORITIES.put(Kind.OR_ASSIGNMENT, 15);
115.1333 -        OPERATOR_PRIORITIES.put(Kind.PLUS_ASSIGNMENT, 15);
115.1334 -        OPERATOR_PRIORITIES.put(Kind.REMAINDER_ASSIGNMENT, 15);
115.1335 -        OPERATOR_PRIORITIES.put(Kind.RIGHT_SHIFT_ASSIGNMENT, 15);
115.1336 -        OPERATOR_PRIORITIES.put(Kind.UNSIGNED_RIGHT_SHIFT_ASSIGNMENT, 15);
115.1337 -        OPERATOR_PRIORITIES.put(Kind.XOR_ASSIGNMENT, 15);
115.1338 -    }
115.1339 -
115.1340 -    /**Checks whether putting {@code inner} tree into {@code outter} tree,
115.1341 -     * when {@code original} is being replaced with {@code inner} requires parentheses.
115.1342 -     *
115.1343 -     * @param inner    the new tree node that will be placed under {@code outter}
115.1344 -     * @param original the tree node that is being replaced with {@code inner}
115.1345 -     * @param outter   the future parent node of {@code inner}
115.1346 -     * @return true if and only if inner needs to be wrapped using {@link TreeMaker#Parenthesized(com.sun.source.tree.ExpressionTree) }
115.1347 -     *              to keep the original meaning.
115.1348 -     */
115.1349 -    public static boolean requiresParenthesis(Tree inner, Tree original, Tree outter) {
115.1350 -        if (!ExpressionTree.class.isAssignableFrom(inner.getKind().asInterface())) return false;
115.1351 -        if (!ExpressionTree.class.isAssignableFrom(outter.getKind().asInterface())) return false;
115.1352 -
115.1353 -        if (outter.getKind() == Kind.PARENTHESIZED || inner.getKind() == Kind.PARENTHESIZED) return false;
115.1354 -
115.1355 -        if (outter.getKind() == Kind.METHOD_INVOCATION) {
115.1356 -            if (((MethodInvocationTree) outter).getArguments().contains(original)) return false;
115.1357 -        }
115.1358 -
115.1359 -        if (outter.getKind() == Kind.NEW_CLASS) {
115.1360 -            if (((NewClassTree) outter).getArguments().contains(original)) return false;
115.1361 -        }
115.1362 -
115.1363 -        Integer innerPriority = OPERATOR_PRIORITIES.get(inner.getKind());
115.1364 -        Integer outterPriority = OPERATOR_PRIORITIES.get(outter.getKind());
115.1365 -
115.1366 -        if (innerPriority == null || outterPriority == null) {
115.1367 -            Logger.getLogger(JavaFix.class.getName()).log(Level.WARNING, "Unknown tree kind(s): {0}/{1}", new Object[] {inner.getKind(), outter.getKind()});
115.1368 -            return true;
115.1369 -        }
115.1370 -
115.1371 -        if (innerPriority > outterPriority) {
115.1372 -            return true;
115.1373 -        }
115.1374 -
115.1375 -        if (innerPriority < outterPriority) {
115.1376 -            return false;
115.1377 -        }
115.1378 -
115.1379 -        //associativity
115.1380 -        if (BinaryTree.class.isAssignableFrom(outter.getKind().asInterface())) {
115.1381 -            BinaryTree ot = (BinaryTree) outter;
115.1382 -
115.1383 -            //TODO: for + it might be possible to skip the parenthesis:
115.1384 -            return ot.getRightOperand() == original;
115.1385 -        }
115.1386 -
115.1387 -        if (CompoundAssignmentTree.class.isAssignableFrom(outter.getKind().asInterface())) {
115.1388 -            CompoundAssignmentTree ot = (CompoundAssignmentTree) outter;
115.1389 -
115.1390 -            return ot.getVariable() == original;
115.1391 -        }
115.1392 -
115.1393 -        if (AssignmentTree.class.isAssignableFrom(outter.getKind().asInterface())) {
115.1394 -            AssignmentTree ot = (AssignmentTree) outter;
115.1395 -
115.1396 -            return ot.getVariable() == original;
115.1397 -        }
115.1398 -
115.1399 -        return false;
115.1400 -    }
115.1401 -
115.1402 -    private static final class RemoveFromParent extends JavaFix {
115.1403 -
115.1404 -        private final String displayName;
115.1405 -
115.1406 -        public RemoveFromParent(String displayName, CompilationInfo info, TreePath toRemove) {
115.1407 -            super(info, toRemove);
115.1408 -            this.displayName = displayName;
115.1409 -        }
115.1410 -
115.1411 -        @Override
115.1412 -        protected String getText() {
115.1413 -            return displayName;
115.1414 -        }
115.1415 -
115.1416 -        @Override
115.1417 -        protected void performRewrite(TransformationContext ctx) {
115.1418 -            WorkingCopy wc = ctx.getWorkingCopy();
115.1419 -            TreePath tp = ctx.getPath();
115.1420 -            
115.1421 -            doRemoveFromParent(wc, tp);
115.1422 -        }
115.1423 -        
115.1424 -        private void doRemoveFromParent(WorkingCopy wc, TreePath what) {
115.1425 -            TreeMaker make = wc.getTreeMaker();
115.1426 -            Tree leaf = what.getLeaf();
115.1427 -            Tree parentLeaf = what.getParentPath().getLeaf();
115.1428 -
115.1429 -            switch (parentLeaf.getKind()) {
115.1430 -                case ANNOTATION:
115.1431 -                    AnnotationTree at = (AnnotationTree) parentLeaf;
115.1432 -                    AnnotationTree newAnnot;
115.1433 -
115.1434 -                    newAnnot = make.removeAnnotationAttrValue(at, (ExpressionTree) leaf);
115.1435 -
115.1436 -                    wc.rewrite(at, newAnnot);
115.1437 -                    break;
115.1438 -                case BLOCK:
115.1439 -                    BlockTree bt = (BlockTree) parentLeaf;
115.1440 -
115.1441 -                    wc.rewrite(bt, make.removeBlockStatement(bt, (StatementTree) leaf));
115.1442 -                    break;
115.1443 -                case CASE:
115.1444 -                    CaseTree caseTree = (CaseTree) parentLeaf;
115.1445 -
115.1446 -                    wc.rewrite(caseTree, make.removeCaseStatement(caseTree, (StatementTree) leaf));
115.1447 -                    break;
115.1448 -                case CLASS:
115.1449 -                    ClassTree classTree = (ClassTree) parentLeaf;
115.1450 -                    ClassTree nueClassTree;
115.1451 -
115.1452 -                    if (classTree.getTypeParameters().contains(leaf)) {
115.1453 -                        nueClassTree = make.removeClassTypeParameter(classTree, (TypeParameterTree) leaf);
115.1454 -                    } else if (classTree.getExtendsClause() == leaf) {
115.1455 -                        nueClassTree = make.Class(classTree.getModifiers(), classTree.getSimpleName(), classTree.getTypeParameters(), null, classTree.getImplementsClause(), classTree.getMembers());
115.1456 -                    } else if (classTree.getImplementsClause().contains(leaf)) {
115.1457 -                        nueClassTree = make.removeClassImplementsClause(classTree, leaf);
115.1458 -                    } else if (classTree.getMembers().contains(leaf)) {
115.1459 -                        nueClassTree = make.removeClassMember(classTree, leaf);
115.1460 -                    } else {
115.1461 -                        throw new UnsupportedOperationException();
115.1462 -                    }
115.1463 -
115.1464 -                    wc.rewrite(classTree, nueClassTree);
115.1465 -                    break;
115.1466 -                case UNION_TYPE:
115.1467 -                    UnionTypeTree disjunct = (UnionTypeTree) parentLeaf;
115.1468 -                    List<? extends Tree> alternatives = new LinkedList<Tree>(disjunct.getTypeAlternatives());
115.1469 -
115.1470 -                    alternatives.remove(leaf);
115.1471 -
115.1472 -                    wc.rewrite(disjunct, make.UnionType(alternatives));
115.1473 -                    break;
115.1474 -                case METHOD:
115.1475 -                    MethodTree mTree = (MethodTree) parentLeaf;
115.1476 -                    MethodTree newMethod;
115.1477 -
115.1478 -                    if (mTree.getTypeParameters().contains(leaf)) {
115.1479 -                        newMethod = make.removeMethodTypeParameter(mTree, (TypeParameterTree) leaf);
115.1480 -                    } else if (mTree.getParameters().contains(leaf)) {
115.1481 -                        newMethod = make.removeMethodParameter(mTree, (VariableTree) leaf);
115.1482 -                    } else if (mTree.getThrows().contains(leaf)) {
115.1483 -                        newMethod = make.removeMethodThrows(mTree, (ExpressionTree) leaf);
115.1484 -                    } else {
115.1485 -                        throw new UnsupportedOperationException();
115.1486 -                    }
115.1487 -
115.1488 -                    wc.rewrite(mTree, newMethod);
115.1489 -                    break;
115.1490 -                case METHOD_INVOCATION:
115.1491 -                    MethodInvocationTree iTree = (MethodInvocationTree) parentLeaf;
115.1492 -                    MethodInvocationTree newInvocation;
115.1493 -
115.1494 -                    if (iTree.getTypeArguments().contains(leaf)) {
115.1495 -                        newInvocation = make.removeMethodInvocationTypeArgument(iTree, (ExpressionTree) leaf);
115.1496 -                    } else if (iTree.getArguments().contains(leaf)) {
115.1497 -                        newInvocation = make.removeMethodInvocationArgument(iTree, (ExpressionTree) leaf);
115.1498 -                    } else {
115.1499 -                        throw new UnsupportedOperationException();
115.1500 -                    }
115.1501 -
115.1502 -                    wc.rewrite(iTree, newInvocation);
115.1503 -                    break;
115.1504 -                case MODIFIERS:
115.1505 -                    ModifiersTree modsTree = (ModifiersTree) parentLeaf;
115.1506 -
115.1507 -                    wc.rewrite(modsTree, make.removeModifiersAnnotation(modsTree, (AnnotationTree) leaf));
115.1508 -                    break;
115.1509 -                case NEW_CLASS:
115.1510 -                    NewClassTree newCTree = (NewClassTree) parentLeaf;
115.1511 -                    NewClassTree newNCT;
115.1512 -
115.1513 -                    if (newCTree.getTypeArguments().contains(leaf)) {
115.1514 -                        newNCT = make.removeNewClassTypeArgument(newCTree, (ExpressionTree) leaf);
115.1515 -                    } else if (newCTree.getArguments().contains(leaf)) {
115.1516 -                        newNCT = make.removeNewClassArgument(newCTree, (ExpressionTree) leaf);
115.1517 -                    } else {
115.1518 -                        throw new UnsupportedOperationException();
115.1519 -                    }
115.1520 -
115.1521 -                    wc.rewrite(newCTree, newNCT);
115.1522 -                    break;
115.1523 -                case PARAMETERIZED_TYPE:
115.1524 -                    ParameterizedTypeTree parTree = (ParameterizedTypeTree) parentLeaf;
115.1525 -
115.1526 -                    wc.rewrite(parTree, make.removeParameterizedTypeTypeArgument(parTree, (ExpressionTree) leaf));
115.1527 -                    break;
115.1528 -                case SWITCH:
115.1529 -                    SwitchTree switchTree = (SwitchTree) parentLeaf;
115.1530 -                    SwitchTree newSwitch;
115.1531 -
115.1532 -                    if (switchTree.getCases().contains(leaf)) {
115.1533 -                        newSwitch = make.removeSwitchCase(switchTree, (CaseTree) leaf);
115.1534 -                    } else {
115.1535 -                        throw new UnsupportedOperationException();
115.1536 -                    }
115.1537 -
115.1538 -                    wc.rewrite(switchTree, newSwitch);
115.1539 -                    break;
115.1540 -                case TRY:
115.1541 -                    TryTree tryTree = (TryTree) parentLeaf;
115.1542 -                    TryTree newTry;
115.1543 -
115.1544 -                    if (tryTree.getResources().contains(leaf)) {
115.1545 -                        LinkedList<Tree> resources = new LinkedList<Tree>(tryTree.getResources());
115.1546 -
115.1547 -                        resources.remove(leaf);
115.1548 -
115.1549 -                        newTry = make.Try(resources, tryTree.getBlock(), tryTree.getCatches(), tryTree.getFinallyBlock());
115.1550 -                    } else if (tryTree.getCatches().contains(leaf)) {
115.1551 -                        newTry = make.removeTryCatch(tryTree, (CatchTree) leaf);
115.1552 -                    } else {
115.1553 -                        throw new UnsupportedOperationException();
115.1554 -                    }
115.1555 -
115.1556 -                    wc.rewrite(tryTree, newTry);
115.1557 -                    break;
115.1558 -                case EXPRESSION_STATEMENT:
115.1559 -                    doRemoveFromParent(wc, what.getParentPath());
115.1560 -                    break;
115.1561 -                default:
115.1562 -                    wc.rewrite(what.getLeaf(), make.Block(Collections.<StatementTree>emptyList(), false));
115.1563 -                    break;
115.1564 -            }
115.1565 -        }
115.1566 -
115.1567 -    }
115.1568 -
115.1569 -    //TODO: from FileMovePlugin
115.1570 -    private static class MoveFile extends SimpleRefactoringElementImplementation {
115.1571 -
115.1572 -        private FileObject toMove;
115.1573 -        private final FileObject sourceRoot;
115.1574 -        private final String targetFolderName;
115.1575 -
115.1576 -        public MoveFile(FileObject toMove, FileObject sourceRoot, String targetFolderName) {
115.1577 -            this.toMove = toMove;
115.1578 -            this.sourceRoot = sourceRoot;
115.1579 -            this.targetFolderName = targetFolderName;
115.1580 -        }
115.1581 -
115.1582 -        @Override
115.1583 -        @Messages({"#{0} - original file name", "TXT_MoveFile=Move {0}"})
115.1584 -        public String getText() {
115.1585 -            return Bundle.TXT_MoveFile(toMove.getNameExt());
115.1586 -        }
115.1587 -
115.1588 -        @Override
115.1589 -        public String getDisplayText() {
115.1590 -            return getText();
115.1591 -        }
115.1592 -
115.1593 -        DataFolder sourceFolder;
115.1594 -        DataObject source;
115.1595 -        @Override
115.1596 -        public void performChange() {
115.1597 -            try {
115.1598 -                FileObject target = FileUtil.createFolder(sourceRoot, targetFolderName);
115.1599 -                DataFolder targetFolder = DataFolder.findFolder(target);
115.1600 -                if (!toMove.isValid()) {
115.1601 -                    String path = FileUtil.getFileDisplayName(toMove);
115.1602 -                    Logger.getLogger(JavaFix.class.getName()).fine("Invalid FileObject " + path + "trying to recreate...");
115.1603 -                    toMove = FileUtil.toFileObject(FileUtil.toFile(toMove));
115.1604 -                    if (toMove==null) {
115.1605 -                        Logger.getLogger(JavaFix.class.getName()).severe("Invalid FileObject " + path + "\n. File not found.");
115.1606 -                        return;
115.1607 -                    }
115.1608 -                }
115.1609 -                source = DataObject.find(toMove);
115.1610 -                sourceFolder = source.getFolder();
115.1611 -                source.move(targetFolder);
115.1612 -            } catch (DataObjectNotFoundException ex) {
115.1613 -                ex.printStackTrace();
115.1614 -            } catch (IOException ex) {
115.1615 -                ex.printStackTrace();
115.1616 -            }
115.1617 -        }
115.1618 -
115.1619 -        @Override
115.1620 -        public void undoChange() {
115.1621 -            try {
115.1622 -                source.move(sourceFolder);
115.1623 -            } catch (DataObjectNotFoundException ex) {
115.1624 -                ex.printStackTrace();
115.1625 -            } catch (IOException ex) {
115.1626 -                ex.printStackTrace();
115.1627 -            }
115.1628 -        }
115.1629 -
115.1630 -        @Override
115.1631 -        public Lookup getLookup() {
115.1632 -            return Lookup.EMPTY;
115.1633 -        }
115.1634 -
115.1635 -        @Override
115.1636 -        public FileObject getParentFile() {
115.1637 -            return toMove;
115.1638 -        }
115.1639 -
115.1640 -        @Override
115.1641 -        public PositionBounds getPosition() {
115.1642 -            return null;
115.1643 -        }
115.1644 -    }
115.1645 -}
   116.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/MatcherUtilities.java	Sun Jan 08 20:10:08 2017 +0100
   116.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   116.3 @@ -1,157 +0,0 @@
   116.4 -/*
   116.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   116.6 - *
   116.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   116.8 - *
   116.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  116.10 - * Other names may be trademarks of their respective owners.
  116.11 - *
  116.12 - * The contents of this file are subject to the terms of either the GNU
  116.13 - * General Public License Version 2 only ("GPL") or the Common
  116.14 - * Development and Distribution License("CDDL") (collectively, the
  116.15 - * "License"). You may not use this file except in compliance with the
  116.16 - * License. You can obtain a copy of the License at
  116.17 - * http://www.netbeans.org/cddl-gplv2.html
  116.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  116.19 - * specific language governing permissions and limitations under the
  116.20 - * License.  When distributing the software, include this License Header
  116.21 - * Notice in each file and include the License file at
  116.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  116.23 - * particular file as subject to the "Classpath" exception as provided
  116.24 - * by Oracle in the GPL Version 2 section of the License file that
  116.25 - * accompanied this code. If applicable, add the following below the
  116.26 - * License Header, with the fields enclosed by brackets [] replaced by
  116.27 - * your own identifying information:
  116.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  116.29 - *
  116.30 - * If you wish your version of this file to be governed by only the CDDL
  116.31 - * or only the GPL Version 2, indicate your decision by adding
  116.32 - * "[Contributor] elects to include this software in this distribution
  116.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  116.34 - * single choice of license, a recipient has the option to distribute
  116.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  116.36 - * to extend the choice of license to its licensees as provided above.
  116.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  116.38 - * Version 2 license, then the option applies only if the new code is
  116.39 - * made subject to such option by the copyright holder.
  116.40 - *
  116.41 - * Contributor(s):
  116.42 - *
  116.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
  116.44 - */
  116.45 -
  116.46 -package org.netbeans.spi.java.hints;
  116.47 -
  116.48 -import com.sun.source.tree.BlockTree;
  116.49 -import com.sun.source.tree.Scope;
  116.50 -import com.sun.source.tree.StatementTree;
  116.51 -import com.sun.source.tree.Tree;
  116.52 -import com.sun.source.util.TreePath;
  116.53 -import java.util.Collection;
  116.54 -import java.util.Collections;
  116.55 -import java.util.HashMap;
  116.56 -import java.util.Iterator;
  116.57 -import java.util.List;
  116.58 -import java.util.Map;
  116.59 -import java.util.concurrent.atomic.AtomicBoolean;
  116.60 -import javax.lang.model.type.TypeMirror;
  116.61 -import org.netbeans.api.annotations.common.NonNull;
  116.62 -import org.netbeans.modules.java.hints.spiimpl.Utilities;
  116.63 -import org.netbeans.modules.java.hints.spiimpl.pm.PatternCompiler;
  116.64 -import org.netbeans.api.java.source.matching.Matcher;
  116.65 -import org.netbeans.api.java.source.matching.Occurrence;
  116.66 -import org.netbeans.api.java.source.matching.Pattern;
  116.67 -
  116.68 -/**XXX: cancelability
  116.69 - * TODO: needed?
  116.70 - *
  116.71 - * @author lahvac
  116.72 - */
  116.73 -public class MatcherUtilities {
  116.74 -
  116.75 -    public static boolean matches(@NonNull HintContext ctx, @NonNull TreePath variable, @NonNull String pattern) {
  116.76 -        return matches(ctx, variable, pattern, null, null, null);
  116.77 -    }
  116.78 -
  116.79 -    public static boolean matches(@NonNull HintContext ctx, @NonNull TreePath variable, @NonNull String pattern, boolean fillInVariablesHack) {
  116.80 -        return matches(ctx, variable, pattern, ctx.getVariables(), ctx.getMultiVariables(), ctx.getVariableNames());
  116.81 -    }
  116.82 -
  116.83 -    public static boolean matches(@NonNull HintContext ctx, @NonNull TreePath variable, @NonNull String pattern, Map<String, TreePath> outVariables, Map<String, Collection<? extends TreePath>> outMultiVariables, Map<String, String> outVariables2Names) {
  116.84 -        Pattern p = PatternCompiler.compile(ctx.getInfo(), pattern, Collections.<String, TypeMirror>emptyMap(), Collections.<String>emptyList());
  116.85 -        Map<String, TreePath> variables = new HashMap<String, TreePath>(ctx.getVariables());
  116.86 -        Map<String, Collection<? extends TreePath>> multiVariables = new HashMap<String, Collection<? extends TreePath>>(ctx.getMultiVariables());
  116.87 -        Map<String, String> variables2Names = new HashMap<String, String>(ctx.getVariableNames());
  116.88 -        Iterable<? extends Occurrence> occurrences = Matcher.create(ctx.getInfo()).setCancel(new AtomicBoolean()).setPresetVariable(variables, multiVariables, variables2Names).setSearchRoot(variable).setTreeTopSearch().match(p);
  116.89 -
  116.90 -        if (occurrences.iterator().hasNext()) {
  116.91 -            Occurrence od = occurrences.iterator().next();
  116.92 -            outVariables(outVariables, od.getVariables(), ctx.getVariables());
  116.93 -            outVariables(outMultiVariables, od.getMultiVariables(), ctx.getMultiVariables());
  116.94 -            outVariables(outVariables2Names, od.getVariables2Names(), ctx.getVariableNames());
  116.95 -
  116.96 -            return true;
  116.97 -        }
  116.98 -
  116.99 -        return false;
 116.100 -    }
 116.101 -
 116.102 -    public static boolean matches(@NonNull HintContext ctx, @NonNull Collection<? extends TreePath> variable, @NonNull String pattern, Map<String, TreePath> outVariables, Map<String, Collection<? extends TreePath>> outMultiVariables, Map<String, String> outVariables2Names) {
 116.103 -        Scope s = Utilities.constructScope(ctx.getInfo(), Collections.<String, TypeMirror>emptyMap());
 116.104 -        Tree  patternTree = Utilities.parseAndAttribute(ctx.getInfo(), pattern, s);
 116.105 -        List<? extends Tree> patternTrees;
 116.106 -
 116.107 -        if (Utilities.isFakeBlock(patternTree)) {
 116.108 -            List<? extends StatementTree> statements = ((BlockTree) patternTree).getStatements();
 116.109 -
 116.110 -            patternTrees = statements.subList(1, statements.size() - 1);
 116.111 -        } else {
 116.112 -            patternTrees = Collections.singletonList(patternTree);
 116.113 -        }
 116.114 -
 116.115 -        if (variable.size() != patternTrees.size()) return false;
 116.116 -        
 116.117 -        Map<String, TreePath> variables = new HashMap<String, TreePath>(ctx.getVariables());
 116.118 -        Map<String, Collection<? extends TreePath>> multiVariables = new HashMap<String, Collection<? extends TreePath>>(ctx.getMultiVariables());
 116.119 -        Map<String, String> variables2Names = new HashMap<String, String>(ctx.getVariableNames());
 116.120 -        Iterator<? extends TreePath> variableIt = variable.iterator();
 116.121 -        Iterator<? extends Tree> patternTreesIt = patternTrees.iterator();
 116.122 -
 116.123 -        while (variableIt.hasNext() && patternTreesIt.hasNext()) {
 116.124 -            TreePath patternTreePath = new TreePath(new TreePath(ctx.getInfo().getCompilationUnit()), patternTreesIt.next());
 116.125 -            Pattern p = Pattern.createPatternWithFreeVariables(patternTreePath, Collections.<String, TypeMirror>emptyMap());
 116.126 -            Iterable<? extends Occurrence> occurrences = Matcher.create(ctx.getInfo()).setCancel(new AtomicBoolean()).setPresetVariable(variables, multiVariables, variables2Names).setSearchRoot(variableIt.next()).setTreeTopSearch().match(p);
 116.127 -
 116.128 -            if (!occurrences.iterator().hasNext()) {
 116.129 -                return false;
 116.130 -            }
 116.131 -
 116.132 -            Occurrence od = occurrences.iterator().next();
 116.133 -
 116.134 -            variables = od.getVariables();
 116.135 -            multiVariables = od.getMultiVariables();
 116.136 -            variables2Names = od.getVariables2Names();
 116.137 -        }
 116.138 -
 116.139 -        if (variableIt.hasNext() == patternTreesIt.hasNext()) {
 116.140 -            outVariables(outVariables, variables, ctx.getVariables());
 116.141 -            outVariables(outMultiVariables, multiVariables, ctx.getMultiVariables());
 116.142 -            outVariables(outVariables2Names, variables2Names, ctx.getVariableNames());
 116.143 -
 116.144 -            return true;
 116.145 -        }
 116.146 -
 116.147 -        return false;
 116.148 -    }
 116.149 -
 116.150 -    private static <T> void outVariables(Map<String, T> outMap, Map<String, T> currentValues, Map<String, T> origValues) {
 116.151 -        if (outMap == null) return;
 116.152 -
 116.153 -        for (String key : origValues.keySet()) {
 116.154 -            currentValues.remove(key);
 116.155 -        }
 116.156 -
 116.157 -        outMap.putAll(currentValues);
 116.158 -    }
 116.159 -
 116.160 -}
   117.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/TriggerDecision.java	Sun Jan 08 20:10:08 2017 +0100
   117.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   117.3 @@ -1,59 +0,0 @@
   117.4 -/*
   117.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   117.6 - *
   117.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   117.8 - *
   117.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  117.10 - * Other names may be trademarks of their respective owners.
  117.11 - *
  117.12 - * The contents of this file are subject to the terms of either the GNU
  117.13 - * General Public License Version 2 only ("GPL") or the Common
  117.14 - * Development and Distribution License("CDDL") (collectively, the
  117.15 - * "License"). You may not use this file except in compliance with the
  117.16 - * License. You can obtain a copy of the License at
  117.17 - * http://www.netbeans.org/cddl-gplv2.html
  117.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  117.19 - * specific language governing permissions and limitations under the
  117.20 - * License.  When distributing the software, include this License Header
  117.21 - * Notice in each file and include the License file at
  117.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  117.23 - * particular file as subject to the "Classpath" exception as provided
  117.24 - * by Oracle in the GPL Version 2 section of the License file that
  117.25 - * accompanied this code. If applicable, add the following below the
  117.26 - * License Header, with the fields enclosed by brackets [] replaced by
  117.27 - * your own identifying information:
  117.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  117.29 - *
  117.30 - * If you wish your version of this file to be governed by only the CDDL
  117.31 - * or only the GPL Version 2, indicate your decision by adding
  117.32 - * "[Contributor] elects to include this software in this distribution
  117.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  117.34 - * single choice of license, a recipient has the option to distribute
  117.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  117.36 - * to extend the choice of license to its licensees as provided above.
  117.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  117.38 - * Version 2 license, then the option applies only if the new code is
  117.39 - * made subject to such option by the copyright holder.
  117.40 - *
  117.41 - * Contributor(s):
  117.42 - *
  117.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  117.44 - */
  117.45 -
  117.46 -package org.netbeans.spi.java.hints;
  117.47 -
  117.48 -import java.lang.annotation.ElementType;
  117.49 -import java.lang.annotation.Retention;
  117.50 -import java.lang.annotation.RetentionPolicy;
  117.51 -import java.lang.annotation.Target;
  117.52 -
  117.53 -/**
  117.54 - * @author lahvac
  117.55 - */
  117.56 -@Retention(RetentionPolicy.SOURCE)
  117.57 -@Target(ElementType.METHOD)
  117.58 -public @interface TriggerDecision {
  117.59 -
  117.60 -    public Class<? extends Decision<?, ?>> value();
  117.61 -
  117.62 -}
   118.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/TriggerPattern.java	Sun Jan 08 20:10:08 2017 +0100
   118.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   118.3 @@ -1,93 +0,0 @@
   118.4 -/*
   118.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   118.6 - *
   118.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   118.8 - *
   118.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  118.10 - * Other names may be trademarks of their respective owners.
  118.11 - *
  118.12 - * The contents of this file are subject to the terms of either the GNU
  118.13 - * General Public License Version 2 only ("GPL") or the Common
  118.14 - * Development and Distribution License("CDDL") (collectively, the
  118.15 - * "License"). You may not use this file except in compliance with the
  118.16 - * License. You can obtain a copy of the License at
  118.17 - * http://www.netbeans.org/cddl-gplv2.html
  118.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  118.19 - * specific language governing permissions and limitations under the
  118.20 - * License.  When distributing the software, include this License Header
  118.21 - * Notice in each file and include the License file at
  118.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  118.23 - * particular file as subject to the "Classpath" exception as provided
  118.24 - * by Oracle in the GPL Version 2 section of the License file that
  118.25 - * accompanied this code. If applicable, add the following below the
  118.26 - * License Header, with the fields enclosed by brackets [] replaced by
  118.27 - * your own identifying information:
  118.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  118.29 - *
  118.30 - * If you wish your version of this file to be governed by only the CDDL
  118.31 - * or only the GPL Version 2, indicate your decision by adding
  118.32 - * "[Contributor] elects to include this software in this distribution
  118.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  118.34 - * single choice of license, a recipient has the option to distribute
  118.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  118.36 - * to extend the choice of license to its licensees as provided above.
  118.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  118.38 - * Version 2 license, then the option applies only if the new code is
  118.39 - * made subject to such option by the copyright holder.
  118.40 - *
  118.41 - * Contributor(s):
  118.42 - *
  118.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  118.44 - */
  118.45 -
  118.46 -package org.netbeans.spi.java.hints;
  118.47 -
  118.48 -import java.lang.annotation.ElementType;
  118.49 -import java.lang.annotation.Retention;
  118.50 -import java.lang.annotation.RetentionPolicy;
  118.51 -import java.lang.annotation.Target;
  118.52 -import org.netbeans.spi.editor.hints.ErrorDescription;
  118.53 -
  118.54 -/**Find parts of the source code that satisfy the given pattern, and invoke the method
  118.55 - * that is annotated with this annotation.
  118.56 - *
  118.57 - * The method must be {@code public static}, the return type must either be assignable to
  118.58 - * {@link ErrorDescription} or to {@link Iterable}{@code <? extends }{@link ErrorDescription}{@code >}.
  118.59 - * Its sole parameter must be {@link HintContext}.
  118.60 - *
  118.61 - * @author lahvac
  118.62 - */
  118.63 -@Retention(RetentionPolicy.SOURCE)
  118.64 -@Target(ElementType.METHOD)
  118.65 -public @interface TriggerPattern {
  118.66 -
  118.67 -    /**
  118.68 -     * Pattern to match on.
  118.69 -     * The pattern consists of:
  118.70 -     * <ul>
  118.71 -     *     <li>a single Java expression</li>
  118.72 -     *     <li>a single Java statement</li>
  118.73 -     *     <li>multiple Java statements</li>
  118.74 -     *     <li>a Java field, method or class</li>
  118.75 -     * </ul>
  118.76 -     *
  118.77 -     * Variables (identifiers starting with {@code $}) can be used to replace part of the pattern.
  118.78 -     * During matching, the actual part of the AST that corresponds to the variable in the pattern
  118.79 -     * will be "bound" to the variable. Variables whose names that do not end with a {@code $} ("single" variables)
  118.80 -     * will be bound to exactly one AST node, whereas variables whose names end with a {@code $} ("multi" variables)
  118.81 -     * will be bound to any number of consecutive AST nodes (with the same AST node as a parent).
  118.82 -     *
  118.83 -     * The actual AST nodes that were bound to single variables are available through {@link HintContext#getVariables() },
  118.84 -     * nodes bound to multi variables are available through {@link HintContext#getMultiVariables() }.
  118.85 -     *
  118.86 -     * For variables that represent an expression, a type constraint can be specified using the
  118.87 -     * {@link #constraints() } attribute.
  118.88 -     *
  118.89 -     * All classes should be referred to using FQNs.
  118.90 -     */
  118.91 -    public String value();
  118.92 -    /**Expected types for variables from the {@link #value() pattern}.
  118.93 -     */
  118.94 -    public ConstraintVariableType[] constraints() default {};
  118.95 -
  118.96 -}
   119.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/TriggerPatterns.java	Sun Jan 08 20:10:08 2017 +0100
   119.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   119.3 @@ -1,60 +0,0 @@
   119.4 -/*
   119.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   119.6 - *
   119.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   119.8 - *
   119.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  119.10 - * Other names may be trademarks of their respective owners.
  119.11 - *
  119.12 - * The contents of this file are subject to the terms of either the GNU
  119.13 - * General Public License Version 2 only ("GPL") or the Common
  119.14 - * Development and Distribution License("CDDL") (collectively, the
  119.15 - * "License"). You may not use this file except in compliance with the
  119.16 - * License. You can obtain a copy of the License at
  119.17 - * http://www.netbeans.org/cddl-gplv2.html
  119.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  119.19 - * specific language governing permissions and limitations under the
  119.20 - * License.  When distributing the software, include this License Header
  119.21 - * Notice in each file and include the License file at
  119.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  119.23 - * particular file as subject to the "Classpath" exception as provided
  119.24 - * by Oracle in the GPL Version 2 section of the License file that
  119.25 - * accompanied this code. If applicable, add the following below the
  119.26 - * License Header, with the fields enclosed by brackets [] replaced by
  119.27 - * your own identifying information:
  119.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  119.29 - *
  119.30 - * If you wish your version of this file to be governed by only the CDDL
  119.31 - * or only the GPL Version 2, indicate your decision by adding
  119.32 - * "[Contributor] elects to include this software in this distribution
  119.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  119.34 - * single choice of license, a recipient has the option to distribute
  119.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  119.36 - * to extend the choice of license to its licensees as provided above.
  119.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  119.38 - * Version 2 license, then the option applies only if the new code is
  119.39 - * made subject to such option by the copyright holder.
  119.40 - *
  119.41 - * Contributor(s):
  119.42 - *
  119.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  119.44 - */
  119.45 -
  119.46 -package org.netbeans.spi.java.hints;
  119.47 -
  119.48 -import java.lang.annotation.ElementType;
  119.49 -import java.lang.annotation.Retention;
  119.50 -import java.lang.annotation.RetentionPolicy;
  119.51 -import java.lang.annotation.Target;
  119.52 -
  119.53 -/**Multiple {@link TriggerPattern}s.
  119.54 - *
  119.55 - * @author lahvac
  119.56 - */
  119.57 -@Retention(RetentionPolicy.SOURCE)
  119.58 -@Target(ElementType.METHOD)
  119.59 -public @interface TriggerPatterns {
  119.60 -
  119.61 -    public TriggerPattern[] value();
  119.62 -    
  119.63 -}
   120.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/TriggerTreeKind.java	Sun Jan 08 20:10:08 2017 +0100
   120.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   120.3 @@ -1,66 +0,0 @@
   120.4 -/*
   120.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   120.6 - *
   120.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   120.8 - *
   120.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  120.10 - * Other names may be trademarks of their respective owners.
  120.11 - *
  120.12 - * The contents of this file are subject to the terms of either the GNU
  120.13 - * General Public License Version 2 only ("GPL") or the Common
  120.14 - * Development and Distribution License("CDDL") (collectively, the
  120.15 - * "License"). You may not use this file except in compliance with the
  120.16 - * License. You can obtain a copy of the License at
  120.17 - * http://www.netbeans.org/cddl-gplv2.html
  120.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  120.19 - * specific language governing permissions and limitations under the
  120.20 - * License.  When distributing the software, include this License Header
  120.21 - * Notice in each file and include the License file at
  120.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  120.23 - * particular file as subject to the "Classpath" exception as provided
  120.24 - * by Oracle in the GPL Version 2 section of the License file that
  120.25 - * accompanied this code. If applicable, add the following below the
  120.26 - * License Header, with the fields enclosed by brackets [] replaced by
  120.27 - * your own identifying information:
  120.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  120.29 - *
  120.30 - * If you wish your version of this file to be governed by only the CDDL
  120.31 - * or only the GPL Version 2, indicate your decision by adding
  120.32 - * "[Contributor] elects to include this software in this distribution
  120.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  120.34 - * single choice of license, a recipient has the option to distribute
  120.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  120.36 - * to extend the choice of license to its licensees as provided above.
  120.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  120.38 - * Version 2 license, then the option applies only if the new code is
  120.39 - * made subject to such option by the copyright holder.
  120.40 - *
  120.41 - * Contributor(s):
  120.42 - *
  120.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  120.44 - */
  120.45 -
  120.46 -package org.netbeans.spi.java.hints;
  120.47 -
  120.48 -import com.sun.source.tree.Tree.Kind;
  120.49 -import com.sun.source.util.TreePath;
  120.50 -import java.lang.annotation.ElementType;
  120.51 -import java.lang.annotation.Retention;
  120.52 -import java.lang.annotation.RetentionPolicy;
  120.53 -import java.lang.annotation.Target;
  120.54 -
  120.55 -/**Invoke the method for {@link TreePath}s of the given kind.
  120.56 - *
  120.57 - * The method must be {@code public static}, the return type must either be assignable to
  120.58 - * {@link ErrorDescription} or to {@link Iterable}{@code <? extends }{@link ErrorDescription}{@code >}.
  120.59 - * Its sole parameter must be {@link HintContext}.
  120.60 - *
  120.61 - * @author lahvac
  120.62 - */
  120.63 -@Retention(RetentionPolicy.SOURCE)
  120.64 -@Target(ElementType.METHOD)
  120.65 -public @interface TriggerTreeKind {
  120.66 -
  120.67 -    public Kind[] value();
  120.68 -
  120.69 -}
   121.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/UseOptions.java	Sun Jan 08 20:10:08 2017 +0100
   121.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   121.3 @@ -1,64 +0,0 @@
   121.4 -/*
   121.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   121.6 - *
   121.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
   121.8 - *
   121.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  121.10 - * Other names may be trademarks of their respective owners.
  121.11 - *
  121.12 - * The contents of this file are subject to the terms of either the GNU
  121.13 - * General Public License Version 2 only ("GPL") or the Common
  121.14 - * Development and Distribution License("CDDL") (collectively, the
  121.15 - * "License"). You may not use this file except in compliance with the
  121.16 - * License. You can obtain a copy of the License at
  121.17 - * http://www.netbeans.org/cddl-gplv2.html
  121.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  121.19 - * specific language governing permissions and limitations under the
  121.20 - * License.  When distributing the software, include this License Header
  121.21 - * Notice in each file and include the License file at
  121.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  121.23 - * particular file as subject to the "Classpath" exception as provided
  121.24 - * by Oracle in the GPL Version 2 section of the License file that
  121.25 - * accompanied this code. If applicable, add the following below the
  121.26 - * License Header, with the fields enclosed by brackets [] replaced by
  121.27 - * your own identifying information:
  121.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  121.29 - *
  121.30 - * If you wish your version of this file to be governed by only the CDDL
  121.31 - * or only the GPL Version 2, indicate your decision by adding
  121.32 - * "[Contributor] elects to include this software in this distribution
  121.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  121.34 - * single choice of license, a recipient has the option to distribute
  121.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  121.36 - * to extend the choice of license to its licensees as provided above.
  121.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  121.38 - * Version 2 license, then the option applies only if the new code is
  121.39 - * made subject to such option by the copyright holder.
  121.40 - *
  121.41 - * Contributor(s):
  121.42 - *
  121.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
  121.44 - */
  121.45 -package org.netbeans.spi.java.hints;
  121.46 -
  121.47 -import java.lang.annotation.ElementType;
  121.48 -import java.lang.annotation.Retention;
  121.49 -import java.lang.annotation.RetentionPolicy;
  121.50 -import java.lang.annotation.Target;
  121.51 -
  121.52 -/**Specifies which options from the enclosing class should be used for this hint.
  121.53 - *
  121.54 - * Only applies to methods marked with the {@link Hint} annotation.
  121.55 - *
  121.56 - * @author lahvac
  121.57 - */
  121.58 -@Retention(RetentionPolicy.SOURCE)
  121.59 -@Target(ElementType.METHOD)
  121.60 -public @interface UseOptions {
  121.61 -
  121.62 -    /**Keys (values of the compile-time constants) of the options that should be used
  121.63 -     * for this hint method.
  121.64 -     */
  121.65 -    public String[] value();
  121.66 -    
  121.67 -}
   122.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/support/FixFactory.java	Sun Jan 08 20:10:08 2017 +0100
   122.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   122.3 @@ -1,171 +0,0 @@
   122.4 -/*
   122.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   122.6 - *
   122.7 - * Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved.
   122.8 - *
   122.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  122.10 - * Other names may be trademarks of their respective owners.
  122.11 - *
  122.12 - * The contents of this file are subject to the terms of either the GNU
  122.13 - * General Public License Version 2 only ("GPL") or the Common
  122.14 - * Development and Distribution License("CDDL") (collectively, the
  122.15 - * "License"). You may not use this file except in compliance with the
  122.16 - * License. You can obtain a copy of the License at
  122.17 - * http://www.netbeans.org/cddl-gplv2.html
  122.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  122.19 - * specific language governing permissions and limitations under the
  122.20 - * License.  When distributing the software, include this License Header
  122.21 - * Notice in each file and include the License file at
  122.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  122.23 - * particular file as subject to the "Classpath" exception as provided
  122.24 - * by Oracle in the GPL Version 2 section of the License file that
  122.25 - * accompanied this code. If applicable, add the following below the
  122.26 - * License Header, with the fields enclosed by brackets [] replaced by
  122.27 - * your own identifying information:
  122.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  122.29 - *
  122.30 - * Contributor(s):
  122.31 - *
  122.32 - * Portions Copyrighted 2007-2012 Sun Microsystems, Inc.
  122.33 - */
  122.34 -package org.netbeans.spi.java.hints.support;
  122.35 -
  122.36 -import com.sun.source.tree.ModifiersTree;
  122.37 -import com.sun.source.tree.Tree.Kind;
  122.38 -import com.sun.source.util.TreePath;
  122.39 -import java.util.Collections;
  122.40 -import java.util.EnumSet;
  122.41 -import java.util.Set;
  122.42 -import javax.lang.model.element.Modifier;
  122.43 -import org.netbeans.api.java.source.CompilationInfo;
  122.44 -import org.netbeans.api.java.source.TreeMaker;
  122.45 -import org.netbeans.api.java.source.TreePathHandle;
  122.46 -import org.netbeans.api.java.source.WorkingCopy;
  122.47 -import org.netbeans.spi.editor.hints.Fix;
  122.48 -import org.netbeans.spi.java.hints.JavaFix;
  122.49 -import org.openide.util.Parameters;
  122.50 -
  122.51 -/** Factory for creating generally useful fixes. Currently, changes to the modifiers
  122.52 - *  are supported.
  122.53 - *
  122.54 - * @author Dusan Balek
  122.55 - */
  122.56 -public final class FixFactory {
  122.57 -
  122.58 -    private FixFactory() {}
  122.59 -
  122.60 -    /** Creates a fix, which when invoked adds a set of modifiers to the existing ones
  122.61 -     * @param compilationInfo CompilationInfo to work on
  122.62 -     * @param treePath TreePath to a ModifiersTree.
  122.63 -     * @param toAdd set of Modifiers to add
  122.64 -     * @param text text displayed as a fix description
  122.65 -     */
  122.66 -    public static final Fix addModifiersFix(CompilationInfo compilationInfo, TreePath treePath, Set<Modifier> toAdd, String text) {
  122.67 -        Parameters.notNull("compilationInfo", compilationInfo);
  122.68 -        Parameters.notNull("treePath", treePath);
  122.69 -        Parameters.notNull("toAdd", toAdd);
  122.70 -        Parameters.notNull("text", text);
  122.71 -
  122.72 -        return changeModifiersFix(compilationInfo, treePath, toAdd, Collections.<Modifier>emptySet(), text);
  122.73 -    }
  122.74 -
  122.75 -    /** Creates a fix, which when invoked removes a set of modifiers from the existing ones
  122.76 -     * @param compilationInfo CompilationInfo to work on
  122.77 -     * @param treePath TreePath to a ModifiersTree.
  122.78 -     * @param toRemove set of Modifiers to remove
  122.79 -     * @param text text displayed as a fix description
  122.80 -     */
  122.81 -    public static final Fix removeModifiersFix(CompilationInfo compilationInfo, TreePath treePath, Set<Modifier> toRemove, String text) {
  122.82 -        Parameters.notNull("compilationInfo", compilationInfo);
  122.83 -        Parameters.notNull("treePath", treePath);
  122.84 -        Parameters.notNull("toRemove", toRemove);
  122.85 -        Parameters.notNull("text", text);
  122.86 -
  122.87 -        return changeModifiersFix(compilationInfo, treePath, Collections.<Modifier>emptySet(), toRemove, text);
  122.88 -    }
  122.89 -
  122.90 -    /** Creates a fix, which when invoked changes the existing modifiers
  122.91 -     * @param compilationInfo CompilationInfo to work on
  122.92 -     * @param treePath TreePath to a ModifiersTree.
  122.93 -     * @param toAdd set of Modifiers to add
  122.94 -     * @param toRemove set of Modifiers to remove
  122.95 -     * @param text text displayed as a fix description
  122.96 -     */
  122.97 -    public static final Fix changeModifiersFix(CompilationInfo compilationInfo, TreePath treePath, Set<Modifier> toAdd, Set<Modifier> toRemove, String text) {
  122.98 -        Parameters.notNull("compilationInfo", compilationInfo);
  122.99 -        Parameters.notNull("treePath", treePath);
 122.100 -        Parameters.notNull("toAdd", toAdd);
 122.101 -        Parameters.notNull("toRemove", toRemove);
 122.102 -        Parameters.notNull("text", text);
 122.103 -
 122.104 -        if (treePath.getLeaf().getKind() != Kind.MODIFIERS) {
 122.105 -            return null;
 122.106 -        }
 122.107 -        return new ChangeModifiersFixImpl(TreePathHandle.create(treePath, compilationInfo), toAdd, toRemove, text).toEditorFix();
 122.108 -    }
 122.109 -
 122.110 -    private static final class ChangeModifiersFixImpl extends JavaFix {
 122.111 -
 122.112 -        private final TreePathHandle modsHandle;
 122.113 -        private final Set<Modifier> toAdd;
 122.114 -        private final Set<Modifier> toRemove;
 122.115 -        private final String text;
 122.116 -
 122.117 -        public ChangeModifiersFixImpl(TreePathHandle modsHandle, Set<Modifier> toAdd, Set<Modifier> toRemove, String text) {
 122.118 -            super(modsHandle);
 122.119 -            this.modsHandle = modsHandle;
 122.120 -            this.toAdd = toAdd;
 122.121 -            this.toRemove = toRemove;
 122.122 -            this.text = text;
 122.123 -        }
 122.124 -
 122.125 -        public String getText() {
 122.126 -            return text;
 122.127 -        }
 122.128 -
 122.129 -        @Override
 122.130 -        protected void performRewrite(TransformationContext ctx) {
 122.131 -            WorkingCopy wc = ctx.getWorkingCopy();
 122.132 -            TreePath path = ctx.getPath();
 122.133 -            TreeMaker make = wc.getTreeMaker();
 122.134 -            ModifiersTree newMods = (ModifiersTree) path.getLeaf();
 122.135 -            for (Modifier a : toAdd) {
 122.136 -                newMods = make.addModifiersModifier(newMods, a);
 122.137 -            }
 122.138 -            for (Modifier r : toRemove) {
 122.139 -                newMods = make.removeModifiersModifier(newMods, r);
 122.140 -            }
 122.141 -            wc.rewrite(path.getLeaf(), newMods);
 122.142 -        }
 122.143 -
 122.144 -        @Override
 122.145 -        public boolean equals(Object obj) {
 122.146 -            if (obj == null) {
 122.147 -                return false;
 122.148 -            }
 122.149 -            if (getClass() != obj.getClass()) {
 122.150 -                return false;
 122.151 -            }
 122.152 -            final ChangeModifiersFixImpl other = (ChangeModifiersFixImpl) obj;
 122.153 -            if (this.modsHandle != other.modsHandle && (this.modsHandle == null || !this.modsHandle.equals(other.modsHandle))) {
 122.154 -                return false;
 122.155 -            }
 122.156 -            if (this.toAdd != other.toAdd && (this.toAdd == null || !this.toAdd.equals(other.toAdd))) {
 122.157 -                return false;
 122.158 -            }
 122.159 -            if (this.toRemove != other.toRemove && (this.toRemove == null || !this.toRemove.equals(other.toRemove))) {
 122.160 -                return false;
 122.161 -            }
 122.162 -            return true;
 122.163 -        }
 122.164 -
 122.165 -        @Override
 122.166 -        public int hashCode() {
 122.167 -            int hash = 5;
 122.168 -            hash = 71 * hash + (this.modsHandle != null ? this.modsHandle.hashCode() : 0);
 122.169 -            hash = 71 * hash + (this.toAdd != null ? this.toAdd.hashCode() : 0);
 122.170 -            hash = 71 * hash + (this.toRemove != null ? this.toRemove.hashCode() : 0);
 122.171 -            return hash;
 122.172 -        }
 122.173 -    }
 122.174 -}
   123.1 --- a/sandbox/java.hints/spi.java.hints/src/org/netbeans/spi/java/hints/support/TransformationSupport.java	Sun Jan 08 20:10:08 2017 +0100
   123.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   123.3 @@ -1,311 +0,0 @@
   123.4 -/*
   123.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   123.6 - *
   123.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
   123.8 - *
   123.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  123.10 - * Other names may be trademarks of their respective owners.
  123.11 - *
  123.12 - * The contents of this file are subject to the terms of either the GNU
  123.13 - * General Public License Version 2 only ("GPL") or the Common
  123.14 - * Development and Distribution License("CDDL") (collectively, the
  123.15 - * "License"). You may not use this file except in compliance with the
  123.16 - * License. You can obtain a copy of the License at
  123.17 - * http://www.netbeans.org/cddl-gplv2.html
  123.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  123.19 - * specific language governing permissions and limitations under the
  123.20 - * License.  When distributing the software, include this License Header
  123.21 - * Notice in each file and include the License file at
  123.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  123.23 - * particular file as subject to the "Classpath" exception as provided
  123.24 - * by Oracle in the GPL Version 2 section of the License file that
  123.25 - * accompanied this code. If applicable, add the following below the
  123.26 - * License Header, with the fields enclosed by brackets [] replaced by
  123.27 - * your own identifying information:
  123.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  123.29 - *
  123.30 - * If you wish your version of this file to be governed by only the CDDL
  123.31 - * or only the GPL Version 2, indicate your decision by adding
  123.32 - * "[Contributor] elects to include this software in this distribution
  123.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  123.34 - * single choice of license, a recipient has the option to distribute
  123.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  123.36 - * to extend the choice of license to its licensees as provided above.
  123.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  123.38 - * Version 2 license, then the option applies only if the new code is
  123.39 - * made subject to such option by the copyright holder.
  123.40 - *
  123.41 - * Contributor(s):
  123.42 - *
  123.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
  123.44 - */
  123.45 -package org.netbeans.spi.java.hints.support;
  123.46 -
  123.47 -import com.sun.source.util.TreePath;
  123.48 -import java.util.*;
  123.49 -import java.util.Map.Entry;
  123.50 -import java.util.concurrent.atomic.AtomicBoolean;
  123.51 -import javax.lang.model.type.TypeMirror;
  123.52 -import org.netbeans.api.annotations.common.NonNull;
  123.53 -import org.netbeans.api.java.source.CompilationInfo;
  123.54 -import org.netbeans.api.java.source.ModificationResult;
  123.55 -import org.netbeans.api.java.source.TypeMirrorHandle;
  123.56 -import org.netbeans.api.java.source.WorkingCopy;
  123.57 -import org.netbeans.api.java.source.matching.Matcher;
  123.58 -import org.netbeans.api.java.source.matching.Occurrence;
  123.59 -import org.netbeans.api.java.source.matching.Pattern;
  123.60 -import org.netbeans.api.project.Project;
  123.61 -import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
  123.62 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
  123.63 -import org.netbeans.modules.java.hints.providers.spi.HintDescriptionFactory;
  123.64 -import org.netbeans.modules.java.hints.providers.spi.Trigger;
  123.65 -import org.netbeans.modules.java.hints.spiimpl.JavaFixImpl;
  123.66 -import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
  123.67 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch;
  123.68 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.BatchResult;
  123.69 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchUtilities;
  123.70 -import org.netbeans.modules.java.hints.spiimpl.batch.ProgressHandleWrapper;
  123.71 -import org.netbeans.modules.java.hints.spiimpl.batch.Scopes;
  123.72 -import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker;
  123.73 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
  123.74 -import org.netbeans.modules.java.hints.spiimpl.pm.PatternCompiler;
  123.75 -import org.netbeans.modules.refactoring.spi.RefactoringElementImplementation;
  123.76 -import org.netbeans.spi.editor.hints.*;
  123.77 -import org.netbeans.spi.java.hints.HintContext;
  123.78 -import org.netbeans.spi.java.hints.JavaFix;
  123.79 -import org.openide.util.Exceptions;
  123.80 -
  123.81 -/**
  123.82 - * Static utility classes for processing jackpot patterns.
  123.83 - * <a href="https://bitbucket.org/jlahoda/jackpot30/wiki/RulesLanguage">Rules Language</a>
  123.84 - * @author Jan Becicka
  123.85 - * @since 1.1
  123.86 - */
  123.87 -public final class TransformationSupport {
  123.88 -
  123.89 -    private String jackpotPattern;
  123.90 -    private Transformer transformer;
  123.91 -    private AtomicBoolean cancel = new AtomicBoolean();
  123.92 -
  123.93 -    private TransformationSupport(String jackpotPattern, Transformer transformer) {
  123.94 -        this.jackpotPattern = jackpotPattern;
  123.95 -        this.transformer = transformer;
  123.96 -    }
  123.97 -    
  123.98 -    /**
  123.99 -     * Creates new TransformationSupport representing given jackpotPattern.
 123.100 -     * @param jackpotPattern
 123.101 -     * @return
 123.102 -     */
 123.103 -    public static @NonNull TransformationSupport create(@NonNull String jackpotPattern) {
 123.104 -        return new TransformationSupport(jackpotPattern, null);
 123.105 -    }
 123.106 -
 123.107 -    /**
 123.108 -     * Creates new TransformationSupport representing given jackpotPattern with custom Transformer.
 123.109 -     * @param inputJackpotPattern
 123.110 -     * @param t
 123.111 -     * @see Transformer
 123.112 -     * @return
 123.113 -     */
 123.114 -    public static @NonNull TransformationSupport create(@NonNull String inputJackpotPattern, @NonNull Transformer t) {
 123.115 -        return new TransformationSupport(inputJackpotPattern, t);
 123.116 -    }
 123.117 -
 123.118 -    /**
 123.119 -     * Option to cancel query.
 123.120 -     * @param cancel
 123.121 -     * @return
 123.122 -     */
 123.123 -    public @NonNull TransformationSupport setCancel(@NonNull AtomicBoolean cancel) {
 123.124 -        this.cancel = cancel;
 123.125 -        return this;
 123.126 -    }
 123.127 -
 123.128 -
 123.129 -    /**
 123.130 -     * Run current transformation on all projects and collect results.
 123.131 -     * @return collection of {@link ModificationResult}
 123.132 -     */
 123.133 -    public @NonNull Collection<? extends ModificationResult> processAllProjects() {
 123.134 -        if (transformer!=null) {
 123.135 -            return performTransformation(jackpotPattern, transformer, cancel);
 123.136 -        } else {
 123.137 -            return performTransformation(jackpotPattern, cancel);
 123.138 -        }
 123.139 -    }
 123.140 -
 123.141 -    
 123.142 -    /**
 123.143 -     * Process current transformation on given treePath and performs rewrite on
 123.144 -     * workingCopy.
 123.145 -     * @param workingCopy
 123.146 -     * @param treePath 
 123.147 -     */
 123.148 -    public void transformTreePath(@NonNull WorkingCopy workingCopy, @NonNull TreePath treePath) {
 123.149 -        if (transformer!=null) {
 123.150 -            throw new UnsupportedOperationException("Not implemented yet");
 123.151 -        } else {
 123.152 -            performTransformation(workingCopy, treePath, jackpotPattern, cancel);
 123.153 -        }
 123.154 -    }
 123.155 -
 123.156 -
 123.157 -    /**
 123.158 -     * Transformer callback which is called for each occurrence during processing 
 123.159 -     * of {@link #performTransformation(java.lang.String, org.netbeans.spi.java.hints.support.JackpotSupport.Transformer, java.util.concurrent.atomic.AtomicBoolean)    
 123.160 -     */
 123.161 -    public interface Transformer {
 123.162 -
 123.163 -        /**
 123.164 -         * Implement custom transformation of occurrence here.
 123.165 -         * @param copy
 123.166 -         * @param occurrence
 123.167 -         */
 123.168 -        public void transform(WorkingCopy copy, Occurrence occurrence);
 123.169 -
 123.170 -    }
 123.171 -    
 123.172 -    
 123.173 -    
 123.174 -    /**
 123.175 -     * Performs transformation described by jackpotPattern on given workingCopy.
 123.176 -     * @param workingCopy
 123.177 -     * @param jackpotPattern
 123.178 -     * @param cancel
 123.179 -     */
 123.180 -    private static void performTransformation(WorkingCopy workingCopy, TreePath on, String jackpotPattern, AtomicBoolean cancel) {
 123.181 -        Iterable<? extends HintDescription> hints = PatternConvertor.create(jackpotPattern);
 123.182 -        HintsInvoker inv = new HintsInvoker(HintsSettings.getSettingsFor(workingCopy.getFileObject()), cancel);
 123.183 -        Map<HintDescription, List<ErrorDescription>> computeHints = inv.computeHints(workingCopy, on, false, hints, new ArrayList<MessageImpl>());
 123.184 -        
 123.185 -        if (computeHints == null || cancel.get()) return ;
 123.186 -        
 123.187 -        List<ErrorDescription> errs = new ArrayList<ErrorDescription>();
 123.188 -        for (Entry<HintDescription, List<ErrorDescription>> entry: computeHints.entrySet()) {
 123.189 -            errs.addAll(entry.getValue());
 123.190 -        }
 123.191 -        List<MessageImpl> problems = new LinkedList<MessageImpl>();
 123.192 -
 123.193 -        try {
 123.194 -            if (BatchUtilities.applyFixes(workingCopy, Collections.<Project, Set<String>>emptyMap(), errs, null, new ArrayList<RefactoringElementImplementation>(), problems)) {
 123.195 -                throw new IllegalStateException();
 123.196 -            }
 123.197 -        } catch (IllegalStateException ex) {
 123.198 -            Exceptions.printStackTrace(ex);
 123.199 -        } catch (Exception ex) {
 123.200 -            Exceptions.printStackTrace(ex);
 123.201 -        }
 123.202 -
 123.203 -        if (!problems.isEmpty()) {
 123.204 -            throw new IllegalStateException(problems.get(0).text);
 123.205 -        }
 123.206 -    }
 123.207 -    
 123.208 -    /**
 123.209 -     * Performs jackpotPattern transformation in all open projects.
 123.210 -     * @param jackpotPattern
 123.211 -     * @param cancel
 123.212 -     * @return
 123.213 -     */
 123.214 -    private static  Collection<? extends ModificationResult> performTransformation(String jackpotPattern, AtomicBoolean cancel) {
 123.215 -        Collection<MessageImpl> problems = new LinkedList<MessageImpl>();
 123.216 -        BatchResult batchResult = BatchSearch.findOccurrences(PatternConvertor.create(jackpotPattern), Scopes.allOpenedProjectsScope());
 123.217 -        return BatchUtilities.applyFixes(batchResult, new ProgressHandleWrapper(1, 1), cancel, problems);
 123.218 -    }
 123.219 -    
 123.220 -    /**
 123.221 -     * Performs transformation defined by transformer on all occurrences, which matches inputJackpotPattern.
 123.222 -     * @param inputJackpotPattern
 123.223 -     * @param transformer
 123.224 -     * @return collection of ModificationResults.
 123.225 -     */
 123.226 -    private static Collection<? extends ModificationResult> performTransformation(final String inputJackpotPattern, final Transformer transformer, AtomicBoolean cancel) {
 123.227 -        List<HintDescription> descriptions = new ArrayList<HintDescription>();
 123.228 -
 123.229 -        for (HintDescription hd : PatternConvertor.create(inputJackpotPattern)) {
 123.230 -            final String triggerPattern = ((Trigger.PatternDescription) hd.getTrigger()).getPattern();
 123.231 -            descriptions.add(HintDescriptionFactory.create().setTrigger(hd.getTrigger()).setWorker(new HintDescription.Worker() {
 123.232 -                @Override public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
 123.233 -                    final Map<String, TypeMirrorHandle<?>> constraintsHandles = new HashMap<String, TypeMirrorHandle<?>>();
 123.234 -
 123.235 -                    for (Map.Entry<String, TypeMirror> c : ctx.getConstraints().entrySet()) {
 123.236 -                        constraintsHandles.put(c.getKey(), TypeMirrorHandle.create(c.getValue()));
 123.237 -                    }
 123.238 -
 123.239 -                    Fix fix = new JavaFix(ctx.getInfo(), ctx.getPath()) {
 123.240 -                        @Override protected String getText() {
 123.241 -                            return "";
 123.242 -                        }
 123.243 -                        @Override protected void performRewrite(JavaFix.TransformationContext ctx) {
 123.244 -                            WorkingCopy wc = ctx.getWorkingCopy();
 123.245 -                            Map<String, TypeMirror> constraints = new HashMap<String, TypeMirror>();
 123.246 -
 123.247 -                            for (Map.Entry<String, TypeMirrorHandle<?>> c : constraintsHandles.entrySet()) {
 123.248 -                                constraints.put(c.getKey(), c.getValue().resolve(wc));
 123.249 -                            }
 123.250 -
 123.251 -                            Pattern pattern = PatternCompiler.compile(wc, triggerPattern, constraints, Collections.<String>emptyList());
 123.252 -                            Collection<? extends Occurrence> occurrence = Matcher.create(wc).setTreeTopSearch().setSearchRoot(ctx.getPath()).match(pattern);
 123.253 -
 123.254 -                            assert occurrence.size() == 1;
 123.255 -
 123.256 -                            transformer.transform(wc, occurrence.iterator().next());
 123.257 -                        }
 123.258 -                    }.toEditorFix();
 123.259 -                    
 123.260 -                    return Collections.singletonList(ErrorDescriptionFactory.createErrorDescription(Severity.WARNING, "", Collections.singletonList(fix), ctx.getInfo().getFileObject(), 0, 0));
 123.261 -                }
 123.262 -            }).produce());
 123.263 -
 123.264 -        }
 123.265 -        
 123.266 -        BatchSearch.BatchResult batchResult = BatchSearch.findOccurrences(descriptions, Scopes.allOpenedProjectsScope());
 123.267 -        return BatchUtilities.applyFixes(batchResult, new ProgressHandleWrapper(1, 1), cancel, new ArrayList<MessageImpl>());
 123.268 -    }
 123.269 -    
 123.270 -    /**
 123.271 -     * Performs transformation described by transformationJackpotPattern on all occurences described by inputJackpotPattern.
 123.272 -     * @param inputJackpotPattern
 123.273 -     * @param transformationJackpotPattern
 123.274 -     * @param cancel 
 123.275 -     * @return
 123.276 -     */
 123.277 -    private static Collection<? extends ModificationResult> performTransformation(String inputJackpotPattern, final String transformationJackpotPattern, AtomicBoolean cancel) {
 123.278 -        return performTransformation(inputJackpotPattern, new Transformer() {
 123.279 -
 123.280 -            @Override
 123.281 -            public void transform(WorkingCopy copy, Occurrence occurrence) {
 123.282 -                try {
 123.283 -                    Fix toFix = TransformationSupport.rewriteFix(copy, "whatever", occurrence.getOccurrenceRoot(), transformationJackpotPattern, occurrence.getVariables(), occurrence.getMultiVariables(), occurrence.getVariables2Names(), Collections.<String, TypeMirror>emptyMap(), Collections.<String, String>emptyMap());
 123.284 -                    TransformationSupport.process(((JavaFixImpl) toFix).jf, copy, false, null, new ArrayList<RefactoringElementImplementation>());
 123.285 -                } catch (Exception ex) {
 123.286 -                    Exceptions.printStackTrace(ex);
 123.287 -                }
 123.288 -            }
 123.289 -        }, cancel);
 123.290 -    }
 123.291 -
 123.292 -    private static ChangeInfo process(JavaFix jf, WorkingCopy wc, boolean canShowUI, Map<org.openide.filesystems.FileObject, byte[]> resourceContent, Collection<? super RefactoringElementImplementation> fileChanges) throws Exception {
 123.293 -        return JavaFixImpl.Accessor.INSTANCE.process(jf, wc, canShowUI, resourceContent, fileChanges);
 123.294 -    }
 123.295 -
 123.296 -    /**
 123.297 -     * 
 123.298 -     * @param info
 123.299 -     * @param displayName
 123.300 -     * @param what
 123.301 -     * @param to
 123.302 -     * @param parameters
 123.303 -     * @param parametersMulti
 123.304 -     * @param parameterNames
 123.305 -     * @param constraints
 123.306 -     * @param options
 123.307 -     * @param imports
 123.308 -     * @return
 123.309 -     */
 123.310 -    private static Fix rewriteFix(CompilationInfo info, String displayName, TreePath what, final String to, Map<String, TreePath> parameters, Map<String, Collection<? extends TreePath>> parametersMulti, final Map<String, String> parameterNames, Map<String, TypeMirror> constraints, Map<String, String> options, String... imports) {
 123.311 -        return JavaFixImpl.Accessor.INSTANCE.rewriteFix(info, displayName, what, to, parameters, parametersMulti, parameterNames, constraints, options, imports);
 123.312 -    }
 123.313 -    
 123.314 -}
   124.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/providers/code/CodeHintProviderImplTest.java	Sun Jan 08 20:10:08 2017 +0100
   124.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   124.3 @@ -1,114 +0,0 @@
   124.4 -/*
   124.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   124.6 - *
   124.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
   124.8 - *
   124.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  124.10 - * Other names may be trademarks of their respective owners.
  124.11 - *
  124.12 - * The contents of this file are subject to the terms of either the GNU
  124.13 - * General Public License Version 2 only ("GPL") or the Common
  124.14 - * Development and Distribution License("CDDL") (collectively, the
  124.15 - * "License"). You may not use this file except in compliance with the
  124.16 - * License. You can obtain a copy of the License at
  124.17 - * http://www.netbeans.org/cddl-gplv2.html
  124.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  124.19 - * specific language governing permissions and limitations under the
  124.20 - * License.  When distributing the software, include this License Header
  124.21 - * Notice in each file and include the License file at
  124.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  124.23 - * particular file as subject to the "Classpath" exception as provided
  124.24 - * by Oracle in the GPL Version 2 section of the License file that
  124.25 - * accompanied this code. If applicable, add the following below the
  124.26 - * License Header, with the fields enclosed by brackets [] replaced by
  124.27 - * your own identifying information:
  124.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  124.29 - *
  124.30 - * If you wish your version of this file to be governed by only the CDDL
  124.31 - * or only the GPL Version 2, indicate your decision by adding
  124.32 - * "[Contributor] elects to include this software in this distribution
  124.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  124.34 - * single choice of license, a recipient has the option to distribute
  124.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  124.36 - * to extend the choice of license to its licensees as provided above.
  124.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  124.38 - * Version 2 license, then the option applies only if the new code is
  124.39 - * made subject to such option by the copyright holder.
  124.40 - *
  124.41 - * Contributor(s):
  124.42 - *
  124.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  124.44 - */
  124.45 -
  124.46 -package org.netbeans.modules.java.hints.providers.code;
  124.47 -
  124.48 -import com.sun.source.tree.Tree.Kind;
  124.49 -import java.util.Arrays;
  124.50 -import java.util.Collection;
  124.51 -import java.util.HashSet;
  124.52 -import java.util.Map;
  124.53 -import java.util.Set;
  124.54 -import org.junit.Test;
  124.55 -import org.netbeans.spi.java.hints.ConstraintVariableType;
  124.56 -import org.netbeans.spi.java.hints.Hint;
  124.57 -import org.netbeans.spi.java.hints.TriggerPattern;
  124.58 -import org.netbeans.spi.java.hints.TriggerTreeKind;
  124.59 -import org.netbeans.spi.java.hints.HintContext;
  124.60 -import static org.junit.Assert.*;
  124.61 -import org.netbeans.modules.java.hints.providers.code.CodeHintProviderImpl.WorkerImpl;
  124.62 -import org.netbeans.modules.java.hints.spiimpl.SPIAccessor;
  124.63 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
  124.64 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
  124.65 -import org.netbeans.spi.editor.hints.ErrorDescription;
  124.66 -
  124.67 -/**
  124.68 - *
  124.69 - * @author lahvac
  124.70 - */
  124.71 -@Hint(displayName="foo", description="bar", id="hintPattern", category="general")
  124.72 -public class CodeHintProviderImplTest {
  124.73 -
  124.74 -    public CodeHintProviderImplTest() {
  124.75 -    }
  124.76 -
  124.77 -    @Test
  124.78 -    public void testComputeHints() throws Exception {
  124.79 -        Map<HintMetadata, ? extends Collection<? extends HintDescription>> hints = new CodeHintProviderImpl().computeHints();
  124.80 -
  124.81 -        Set<String> golden = new HashSet<String>(Arrays.asList(
  124.82 -            "$1.toURL():public static org.netbeans.spi.editor.hints.ErrorDescription org.netbeans.modules.java.hints.providers.code.CodeHintProviderImplTest.hintPattern1(org.netbeans.spi.java.hints.HintContext)",
  124.83 -            "[METHOD_INVOCATION]:public static org.netbeans.spi.editor.hints.ErrorDescription org.netbeans.modules.java.hints.providers.code.CodeHintProviderImplTest.hintPattern2(org.netbeans.spi.java.hints.HintContext)"
  124.84 -        ));
  124.85 -
  124.86 -        for (Collection<? extends HintDescription> hds : hints.values()) {
  124.87 -            for (HintDescription d : hds) {
  124.88 -                golden.remove(toString(d));
  124.89 -            }
  124.90 -        }
  124.91 -
  124.92 -        assertTrue(golden.toString(), golden.isEmpty());
  124.93 -    }
  124.94 -
  124.95 -    private static String toString(HintDescription hd) throws Exception {
  124.96 -        StringBuilder sb = new StringBuilder();
  124.97 -
  124.98 -        sb.append(hd.getTrigger());
  124.99 -        sb.append(":");
 124.100 -        
 124.101 -        //TODO: constraints
 124.102 -        sb.append(((WorkerImpl) hd.getWorker()).getMethod().toGenericString());
 124.103 -
 124.104 -        return sb.toString();
 124.105 -    }
 124.106 -
 124.107 -    @TriggerPattern(value="$1.toURL()", constraints=@ConstraintVariableType(variable="$1", type="java.io.File"))
 124.108 -    public static ErrorDescription hintPattern1(HintContext ctx) {
 124.109 -        return null;
 124.110 -    }
 124.111 -
 124.112 -    @TriggerTreeKind(Kind.METHOD_INVOCATION)
 124.113 -    public static ErrorDescription hintPattern2(HintContext ctx) {
 124.114 -        return null;
 124.115 -    }
 124.116 -
 124.117 -}
 124.118 \ No newline at end of file
   125.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/providers/code/FSWrapperTest.java	Sun Jan 08 20:10:08 2017 +0100
   125.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   125.3 @@ -1,221 +0,0 @@
   125.4 -/*
   125.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   125.6 - *
   125.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   125.8 - *
   125.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  125.10 - * Other names may be trademarks of their respective owners.
  125.11 - *
  125.12 - * The contents of this file are subject to the terms of either the GNU
  125.13 - * General Public License Version 2 only ("GPL") or the Common
  125.14 - * Development and Distribution License("CDDL") (collectively, the
  125.15 - * "License"). You may not use this file except in compliance with the
  125.16 - * License. You can obtain a copy of the License at
  125.17 - * http://www.netbeans.org/cddl-gplv2.html
  125.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  125.19 - * specific language governing permissions and limitations under the
  125.20 - * License.  When distributing the software, include this License Header
  125.21 - * Notice in each file and include the License file at
  125.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  125.23 - * particular file as subject to the "Classpath" exception as provided
  125.24 - * by Oracle in the GPL Version 2 section of the License file that
  125.25 - * accompanied this code. If applicable, add the following below the
  125.26 - * License Header, with the fields enclosed by brackets [] replaced by
  125.27 - * your own identifying information:
  125.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  125.29 - *
  125.30 - * If you wish your version of this file to be governed by only the CDDL
  125.31 - * or only the GPL Version 2, indicate your decision by adding
  125.32 - * "[Contributor] elects to include this software in this distribution
  125.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  125.34 - * single choice of license, a recipient has the option to distribute
  125.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  125.36 - * to extend the choice of license to its licensees as provided above.
  125.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  125.38 - * Version 2 license, then the option applies only if the new code is
  125.39 - * made subject to such option by the copyright holder.
  125.40 - *
  125.41 - * Contributor(s):
  125.42 - *
  125.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  125.44 - */
  125.45 -
  125.46 -package org.netbeans.modules.java.hints.providers.code;
  125.47 -
  125.48 -import java.lang.annotation.Annotation;
  125.49 -import java.lang.reflect.AnnotatedElement;
  125.50 -import java.lang.reflect.Array;
  125.51 -import java.lang.reflect.Method;
  125.52 -import java.util.ArrayList;
  125.53 -import java.util.LinkedList;
  125.54 -import java.util.List;
  125.55 -import java.util.Map;
  125.56 -import java.util.prefs.Preferences;
  125.57 -import javax.sound.sampled.LineListener;
  125.58 -import javax.swing.JComponent;
  125.59 -import javax.swing.JPanel;
  125.60 -import static org.junit.Assert.assertEquals;
  125.61 -import static org.junit.Assert.assertNotNull;
  125.62 -import static org.junit.Assert.fail;
  125.63 -import org.junit.Test;
  125.64 -import org.netbeans.modules.java.hints.providers.code.FSWrapper.AnnotatableWrapper;
  125.65 -import org.netbeans.modules.java.hints.providers.code.FSWrapper.ClassWrapper;
  125.66 -import org.netbeans.modules.java.hints.providers.code.FSWrapper.MethodWrapper;
  125.67 -import org.netbeans.spi.java.hints.CustomizerProvider;
  125.68 -import org.netbeans.spi.java.hints.Hint;
  125.69 -import org.netbeans.spi.java.hints.HintContext;
  125.70 -import org.netbeans.spi.java.hints.TestAnnotations.TestAnnotation1;
  125.71 -import org.netbeans.spi.java.hints.TestAnnotations.TestAnnotation2;
  125.72 -import org.netbeans.spi.java.hints.TestAnnotations.TestAnnotation3;
  125.73 -import org.netbeans.spi.java.hints.TestAnnotations.TestEnum;
  125.74 -
  125.75 -/**
  125.76 - *
  125.77 - * @author lahvac
  125.78 - */
  125.79 -public class FSWrapperTest {
  125.80 -
  125.81 -    public FSWrapperTest() {
  125.82 -    }
  125.83 -
  125.84 -    @Test
  125.85 -    public void testWrappedClasses() throws Exception {
  125.86 -        Class[] classes = new Class[] {TestClass.class};
  125.87 -        Iterable<? extends ClassWrapper> wrapped = FSWrapper.listClasses();
  125.88 -
  125.89 -        OUTER: for (Class<?> c : classes) {
  125.90 -            for (ClassWrapper w : wrapped) {
  125.91 -                if (w.getName().equals(c.getName())) {
  125.92 -                    checkClassWrapper(c, w);
  125.93 -                    continue OUTER;
  125.94 -                }
  125.95 -            }
  125.96 -
  125.97 -            fail(c.getName());
  125.98 -        }
  125.99 -    }
 125.100 -
 125.101 -    private static void checkClassWrapper(Class<?> c, ClassWrapper cw) throws Exception {
 125.102 -        checkAnnotations(c, cw);
 125.103 -
 125.104 -        OUTER: for (Method m : c.getDeclaredMethods()) {
 125.105 -            if (m.getAnnotations().length == 0) continue;
 125.106 -            
 125.107 -            for (MethodWrapper wrapped : cw.getMethods()) {
 125.108 -                if (wrapped.getName().equals(m.getName())) {
 125.109 -                    assertEquals(m, FSWrapper.resolveMethod(wrapped.getClazz().getName(), wrapped.getName()));
 125.110 -                    checkAnnotations(m, wrapped);
 125.111 -                    continue OUTER;
 125.112 -                }
 125.113 -            }
 125.114 -            
 125.115 -            fail(m.getName());
 125.116 -        }
 125.117 -    }
 125.118 -
 125.119 -    private static void checkAnnotations(AnnotatedElement el, AnnotatableWrapper aw) throws Exception {
 125.120 -        for (Annotation ann : el.getAnnotations()) {
 125.121 -            Annotation wrapper = aw.getAnnotation(ann.annotationType());
 125.122 -
 125.123 -            assertNotNull(ann.annotationType().getName(), wrapper);
 125.124 -
 125.125 -            checkAnnotation(ann, wrapper);
 125.126 -        }
 125.127 -    }
 125.128 -
 125.129 -    private static void checkAnnotation(Annotation real, Annotation wrapped) throws Exception {
 125.130 -        for (Method m : real.annotationType().getDeclaredMethods()) {
 125.131 -            Object realValue = m.invoke(real);
 125.132 -            Object wrappedValue = m.invoke(wrapped);
 125.133 -
 125.134 -            checkValue(realValue, wrappedValue);
 125.135 -        }
 125.136 -    }
 125.137 -
 125.138 -    private static void checkValue(Object o1, Object o2) throws Exception {
 125.139 -        assertEquals(o1.getClass().isAnnotation(), o2.getClass().isAnnotation());
 125.140 -        if (o1.getClass().isAnnotation()) {
 125.141 -            assertEquals(((Annotation) o1).annotationType(), ((Annotation) o2).annotationType());
 125.142 -        } else {
 125.143 -            assertEquals(o1.getClass(), o2.getClass());
 125.144 -        }
 125.145 -
 125.146 -        if (o1.getClass().isArray()) {
 125.147 -            assertEquals(Array.getLength(o1), Array.getLength(o2));
 125.148 -
 125.149 -            for (int c = 0; c < Array.getLength(o1); c++) {
 125.150 -                checkValue(Array.get(o1, c), Array.get(o2, c));
 125.151 -            }
 125.152 -        } else if (o1.getClass().isAnnotation()) {
 125.153 -            checkAnnotation((Annotation) o1, (Annotation) o2);
 125.154 -        } else {
 125.155 -            assertEquals(o1, o2);
 125.156 -        }
 125.157 -    }
 125.158 -
 125.159 -    @Hint(displayName="foo", description="bar", category="")
 125.160 -    @TestAnnotation1(
 125.161 -        b1=true,
 125.162 -        b3=true,
 125.163 -        i1=42,
 125.164 -        i3=84,
 125.165 -        s1="a42",
 125.166 -        s3="a84",
 125.167 -        a1=@TestAnnotation2(a1=@TestAnnotation3(as1={"u1a2", "u1b2"}, as3="u1c2")),
 125.168 -//        a3=@TestAnnotation2(a1=@TestAnnotation3(as1={"u1a2", "u1b2"}, as3="u1c2")),
 125.169 -        c1=String.class,
 125.170 -        c3=String.class,
 125.171 -        e1=TestEnum.C,
 125.172 -        e3=TestEnum.D,
 125.173 -        ab1={false, true},
 125.174 -        ab3={false, true, false},
 125.175 -        ai1={84, 42},
 125.176 -        ai3={84, 42, 84},
 125.177 -        as1={"c42", "c84"},
 125.178 -        as3={"c42", "c84", "c42"},
 125.179 -        aa1={@TestAnnotation2(a1=@TestAnnotation3(as1={"u3a2", "u3b2"}, as3="u3c2")), @TestAnnotation2(a1=@TestAnnotation3(as1={"u4a2", "u4b2"}, as3="u4c2"))},
 125.180 -//        aa3={@TestAnnotation2(a1=@TestAnnotation3(as1={"u5a2", "u5b2"}, as3="u5c2")), @TestAnnotation2(a1=@TestAnnotation3(as1={"u6a2", "u6b2"}, as3="u6c2"))},
 125.181 -        ac1={List.class, Integer.class},
 125.182 -        ac3={LineListener.class, LinkedList.class},
 125.183 -        ae1={TestEnum.C, TestEnum.D},
 125.184 -        ae3={TestEnum.D, TestEnum.C}
 125.185 -    )
 125.186 -    public static class TestClass {
 125.187 -        @TestAnnotation1(
 125.188 -            b1=false,
 125.189 -            b2=true,
 125.190 -            i1=43,
 125.191 -            i2=85,
 125.192 -            s1="w42",
 125.193 -            s2="w84",
 125.194 -            a1=@TestAnnotation2(a1=@TestAnnotation3(as1={"u7a2", "u7b2"}, as3="u7c2")),
 125.195 -//            a2=@TestAnnotation2(a1=@TestAnnotation3(as1={"u8a2", "u8b2"}, as3="u8c2")),
 125.196 -            c1=String.class,
 125.197 -            c2=String.class,
 125.198 -            e1=TestEnum.C,
 125.199 -            e3=TestEnum.D,
 125.200 -            ab1={false, true},
 125.201 -            ab2={false, true, false},
 125.202 -            ai1={85, 43},
 125.203 -            ai2={85, 43, 85},
 125.204 -            as1={"d42", "d84"},
 125.205 -            as2={"e42", "e84", "e42"},
 125.206 -            aa1={@TestAnnotation2(a1=@TestAnnotation3(as1={"u9a2", "u9b2"}, as3="u9c2")), @TestAnnotation2(a1=@TestAnnotation3(as1={"uaa2", "u4b2"}, as3="uac2"))},
 125.207 -//            aa2={@TestAnnotation2(a1=@TestAnnotation3(as1={"uba2", "ubb2"}, as3="ubc2")), @TestAnnotation2(a1=@TestAnnotation3(as1={"uca2", "ucb2"}, as3="ucc2"))},
 125.208 -            ac1={ArrayList.class, Float.class},
 125.209 -            ac2={StringBuilder.class, Map.class},
 125.210 -            ae1={TestEnum.C, TestEnum.D},
 125.211 -            ae3={TestEnum.D, TestEnum.C}
 125.212 -        )
 125.213 -        public static void test(HintContext ctx) {
 125.214 -            
 125.215 -        }
 125.216 -    }
 125.217 -
 125.218 -    public static class CustomizerImpl implements CustomizerProvider {
 125.219 -        @Override public JComponent getCustomizer(Preferences prefs) {
 125.220 -            return new JPanel();
 125.221 -        }
 125.222 -    }
 125.223 -
 125.224 -}
   126.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/providers/code/TestAnnotations.java	Sun Jan 08 20:10:08 2017 +0100
   126.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   126.3 @@ -1,109 +0,0 @@
   126.4 -/*
   126.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   126.6 - *
   126.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
   126.8 - *
   126.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  126.10 - * Other names may be trademarks of their respective owners.
  126.11 - *
  126.12 - * The contents of this file are subject to the terms of either the GNU
  126.13 - * General Public License Version 2 only ("GPL") or the Common
  126.14 - * Development and Distribution License("CDDL") (collectively, the
  126.15 - * "License"). You may not use this file except in compliance with the
  126.16 - * License. You can obtain a copy of the License at
  126.17 - * http://www.netbeans.org/cddl-gplv2.html
  126.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  126.19 - * specific language governing permissions and limitations under the
  126.20 - * License.  When distributing the software, include this License Header
  126.21 - * Notice in each file and include the License file at
  126.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  126.23 - * particular file as subject to the "Classpath" exception as provided
  126.24 - * by Oracle in the GPL Version 2 section of the License file that
  126.25 - * accompanied this code. If applicable, add the following below the
  126.26 - * License Header, with the fields enclosed by brackets [] replaced by
  126.27 - * your own identifying information:
  126.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  126.29 - *
  126.30 - * If you wish your version of this file to be governed by only the CDDL
  126.31 - * or only the GPL Version 2, indicate your decision by adding
  126.32 - * "[Contributor] elects to include this software in this distribution
  126.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  126.34 - * single choice of license, a recipient has the option to distribute
  126.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  126.36 - * to extend the choice of license to its licensees as provided above.
  126.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  126.38 - * Version 2 license, then the option applies only if the new code is
  126.39 - * made subject to such option by the copyright holder.
  126.40 - *
  126.41 - * Contributor(s):
  126.42 - *
  126.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
  126.44 - */
  126.45 -//placed in this package intentionally: the JavaHintsAnnotationProcessor ignores all annotations outside this package
  126.46 -package org.netbeans.spi.java.hints;
  126.47 -
  126.48 -import java.lang.annotation.Retention;
  126.49 -import java.lang.annotation.RetentionPolicy;
  126.50 -
  126.51 -/**
  126.52 - *
  126.53 - * @author lahvac
  126.54 - */
  126.55 -public class TestAnnotations {
  126.56 -    
  126.57 -    @Retention(RetentionPolicy.RUNTIME)
  126.58 -    public @interface TestAnnotation1 {
  126.59 -        public boolean b1();
  126.60 -        public boolean b2() default false;
  126.61 -        public boolean b3() default false;
  126.62 -        public int     i1();
  126.63 -        public int     i2() default 1;
  126.64 -        public int     i3() default 1;
  126.65 -        public String  s1();
  126.66 -        public String  s2() default "";
  126.67 -        public String  s3() default "";
  126.68 -        public TestAnnotation2 a1();
  126.69 -//        public TestAnnotation2 a2() default @TestAnnotation2(a1=@TestAnnotation3(as1={"a", "b"}, as3="c"));
  126.70 -//        public TestAnnotation2 a3() default @TestAnnotation2(a1=@TestAnnotation3(as1={"a2", "b2"}, as3="c2"));
  126.71 -        public Class   c1();
  126.72 -        public Class   c2() default Void.class;
  126.73 -        public Class   c3() default Void.class;
  126.74 -        public TestEnum e1();
  126.75 -//        public TestEnum e2() default TestEnum.A;
  126.76 -        public TestEnum e3()/* default TestEnum.A*/;
  126.77 -        public boolean[] ab1();
  126.78 -        public boolean[] ab2() default false;
  126.79 -        public boolean[] ab3() default false;
  126.80 -        public int[]     ai1();
  126.81 -        public int[]     ai2() default 1;
  126.82 -        public int[]     ai3() default 1;
  126.83 -        public String[]  as1();
  126.84 -        public String[]  as2() default "";
  126.85 -        public String[]  as3() default "";
  126.86 -        public TestAnnotation2[] aa1();
  126.87 -//        public TestAnnotation2[] aa2() default @TestAnnotation2(a1=@TestAnnotation3(as1={"a", "b"}, as3="c"));
  126.88 -//        public TestAnnotation2[] aa3() default @TestAnnotation2(a1=@TestAnnotation3(as1={"a2", "b2"}, as3="c2"));
  126.89 -        public Class[]   ac1();
  126.90 -        public Class[]   ac2() default Void.class;
  126.91 -        public Class[]   ac3() default Void.class;
  126.92 -        public TestEnum[] ae1();
  126.93 -//        public TestEnum[] ae2() default TestEnum.A;
  126.94 -        public TestEnum[] ae3()/* default TestEnum.A*/;
  126.95 -    }
  126.96 -
  126.97 -    public @interface TestAnnotation2 {
  126.98 -        public TestAnnotation3 a1();
  126.99 -//        public TestAnnotation3 a2() default @TestAnnotation3(as1={"d", "e"}, as3="f");
 126.100 -//        public TestAnnotation3 a3() default @TestAnnotation3(as1={"g", "h"}, as3="i");
 126.101 -    }
 126.102 -
 126.103 -    public @interface TestAnnotation3 {
 126.104 -        public String[] as1();
 126.105 -        public String[] as2() default {""};
 126.106 -        public String[] as3() default {""};
 126.107 -    }
 126.108 -
 126.109 -    public enum TestEnum {
 126.110 -        A, B, C, D;
 126.111 -    }
 126.112 -}
   127.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/TestBase.java	Sun Jan 08 20:10:08 2017 +0100
   127.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   127.3 @@ -1,124 +0,0 @@
   127.4 -/*
   127.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   127.6 - *
   127.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   127.8 - *
   127.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  127.10 - * Other names may be trademarks of their respective owners.
  127.11 - *
  127.12 - * The contents of this file are subject to the terms of either the GNU
  127.13 - * General Public License Version 2 only ("GPL") or the Common
  127.14 - * Development and Distribution License("CDDL") (collectively, the
  127.15 - * "License"). You may not use this file except in compliance with the
  127.16 - * License. You can obtain a copy of the License at
  127.17 - * http://www.netbeans.org/cddl-gplv2.html
  127.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  127.19 - * specific language governing permissions and limitations under the
  127.20 - * License.  When distributing the software, include this License Header
  127.21 - * Notice in each file and include the License file at
  127.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  127.23 - * particular file as subject to the "Classpath" exception as provided
  127.24 - * by Oracle in the GPL Version 2 section of the License file that
  127.25 - * accompanied this code. If applicable, add the following below the
  127.26 - * License Header, with the fields enclosed by brackets [] replaced by
  127.27 - * your own identifying information:
  127.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  127.29 - *
  127.30 - * If you wish your version of this file to be governed by only the CDDL
  127.31 - * or only the GPL Version 2, indicate your decision by adding
  127.32 - * "[Contributor] elects to include this software in this distribution
  127.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  127.34 - * single choice of license, a recipient has the option to distribute
  127.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  127.36 - * to extend the choice of license to its licensees as provided above.
  127.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  127.38 - * Version 2 license, then the option applies only if the new code is
  127.39 - * made subject to such option by the copyright holder.
  127.40 - *
  127.41 - * Contributor(s):
  127.42 - *
  127.43 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
  127.44 - */
  127.45 -
  127.46 -package org.netbeans.modules.java.hints.spiimpl;
  127.47 -
  127.48 -import java.io.File;
  127.49 -import javax.swing.text.Document;
  127.50 -import org.netbeans.api.java.lexer.JavaTokenId;
  127.51 -import org.netbeans.api.java.source.CompilationInfo;
  127.52 -import org.netbeans.api.java.source.JavaSource;
  127.53 -import org.netbeans.api.java.source.JavaSource.Phase;
  127.54 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  127.55 -import org.netbeans.api.java.source.TestUtilities;
  127.56 -import org.netbeans.api.lexer.Language;
  127.57 -import org.netbeans.junit.NbTestCase;
  127.58 -import org.netbeans.modules.java.source.TreeLoader;
  127.59 -import org.openide.cookies.EditorCookie;
  127.60 -import org.openide.filesystems.FileObject;
  127.61 -import org.openide.filesystems.FileUtil;
  127.62 -import org.openide.loaders.DataObject;
  127.63 -
  127.64 -/**
  127.65 - *
  127.66 - * @author Jan Lahoda
  127.67 - */
  127.68 -public class TestBase extends NbTestCase {
  127.69 -
  127.70 -    public TestBase(String name) {
  127.71 -        super(name);
  127.72 -    }
  127.73 -
  127.74 -    @Override
  127.75 -    protected void setUp() throws Exception {
  127.76 -        super.setUp();
  127.77 -        SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
  127.78 -        TreeLoader.DISABLE_CONFINEMENT_TEST = true;
  127.79 -        clearWorkDir();
  127.80 -
  127.81 -        FileUtil.refreshFor(File.listRoots());
  127.82 -    }
  127.83 -
  127.84 -    private int workDirPart = 0;
  127.85 -    
  127.86 -    protected void prepareTest(String fileName, String code) throws Exception {
  127.87 -        FileObject workFO = FileUtil.createFolder(new File(getWorkDir(), String.valueOf(workDirPart++)));
  127.88 -
  127.89 -        assertNotNull(workFO);
  127.90 -
  127.91 -        workFO.refresh();
  127.92 -
  127.93 -        sourceRoot = workFO.createFolder("src");
  127.94 -        FileObject buildRoot  = workFO.createFolder("build");
  127.95 -        FileObject cache = workFO.createFolder("cache");
  127.96 -
  127.97 -        FileObject data = FileUtil.createData(sourceRoot, fileName);
  127.98 -        File dataFile = FileUtil.toFile(data);
  127.99 -
 127.100 -        assertNotNull(dataFile);
 127.101 -
 127.102 -        TestUtilities.copyStringToFile(dataFile, code);
 127.103 -
 127.104 -        SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache);
 127.105 -
 127.106 -        DataObject od = DataObject.find(data);
 127.107 -        EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
 127.108 -
 127.109 -        assertNotNull(ec);
 127.110 -
 127.111 -        doc = ec.openDocument();
 127.112 -        doc.putProperty(Language.class, JavaTokenId.language());
 127.113 -
 127.114 -        JavaSource js = JavaSource.forFileObject(data);
 127.115 -
 127.116 -        assertNotNull(js);
 127.117 -
 127.118 -        info = SourceUtilsTestUtil.getCompilationInfo(js, Phase.RESOLVED);
 127.119 -
 127.120 -        assertNotNull(info);
 127.121 -    }
 127.122 -
 127.123 -    protected FileObject sourceRoot;
 127.124 -    protected CompilationInfo info;
 127.125 -    protected Document doc;
 127.126 -
 127.127 -}
   128.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/TestCompilerSettings.java	Sun Jan 08 20:10:08 2017 +0100
   128.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   128.3 @@ -1,60 +0,0 @@
   128.4 -/*
   128.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   128.6 - *
   128.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
   128.8 - *
   128.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  128.10 - * Other names may be trademarks of their respective owners.
  128.11 - *
  128.12 - * The contents of this file are subject to the terms of either the GNU
  128.13 - * General Public License Version 2 only ("GPL") or the Common
  128.14 - * Development and Distribution License("CDDL") (collectively, the
  128.15 - * "License"). You may not use this file except in compliance with the
  128.16 - * License. You can obtain a copy of the License at
  128.17 - * http://www.netbeans.org/cddl-gplv2.html
  128.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  128.19 - * specific language governing permissions and limitations under the
  128.20 - * License.  When distributing the software, include this License Header
  128.21 - * Notice in each file and include the License file at
  128.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  128.23 - * particular file as subject to the "Classpath" exception as provided
  128.24 - * by Oracle in the GPL Version 2 section of the License file that
  128.25 - * accompanied this code. If applicable, add the following below the
  128.26 - * License Header, with the fields enclosed by brackets [] replaced by
  128.27 - * your own identifying information:
  128.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  128.29 - *
  128.30 - * If you wish your version of this file to be governed by only the CDDL
  128.31 - * or only the GPL Version 2, indicate your decision by adding
  128.32 - * "[Contributor] elects to include this software in this distribution
  128.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  128.34 - * single choice of license, a recipient has the option to distribute
  128.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  128.36 - * to extend the choice of license to its licensees as provided above.
  128.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  128.38 - * Version 2 license, then the option applies only if the new code is
  128.39 - * made subject to such option by the copyright holder.
  128.40 - *
  128.41 - * Contributor(s):
  128.42 - *
  128.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
  128.44 - */
  128.45 -package org.netbeans.modules.java.hints.spiimpl;
  128.46 -
  128.47 -import org.netbeans.modules.java.source.tasklist.CompilerSettings;
  128.48 -import org.openide.filesystems.FileObject;
  128.49 -import org.openide.util.lookup.ServiceProvider;
  128.50 -
  128.51 -/**
  128.52 - *
  128.53 - * @author lahvac
  128.54 - */
  128.55 -@ServiceProvider(service=CompilerSettings.class, position=0, supersedes="org.netbeans.modules.java.hints.StandardJavacWarnings$CompilerSettingsImpl")
  128.56 -public class TestCompilerSettings extends CompilerSettings {
  128.57 -    public static String commandLine;
  128.58 -    @Override
  128.59 -    protected String buildCommandLine(FileObject file) {
  128.60 -        return commandLine;
  128.61 -    }
  128.62 -    
  128.63 -}
   129.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/TestUtilities.java	Sun Jan 08 20:10:08 2017 +0100
   129.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   129.3 @@ -1,67 +0,0 @@
   129.4 -/*
   129.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   129.6 - *
   129.7 - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
   129.8 - *
   129.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  129.10 - * Other names may be trademarks of their respective owners.
  129.11 - *
  129.12 - * The contents of this file are subject to the terms of either the GNU
  129.13 - * General Public License Version 2 only ("GPL") or the Common
  129.14 - * Development and Distribution License("CDDL") (collectively, the
  129.15 - * "License"). You may not use this file except in compliance with the
  129.16 - * License. You can obtain a copy of the License at
  129.17 - * http://www.netbeans.org/cddl-gplv2.html
  129.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  129.19 - * specific language governing permissions and limitations under the
  129.20 - * License.  When distributing the software, include this License Header
  129.21 - * Notice in each file and include the License file at
  129.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  129.23 - * particular file as subject to the "Classpath" exception as provided
  129.24 - * by Oracle in the GPL Version 2 section of the License file that
  129.25 - * accompanied this code. If applicable, add the following below the
  129.26 - * License Header, with the fields enclosed by brackets [] replaced by
  129.27 - * your own identifying information:
  129.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  129.29 - *
  129.30 - * Contributor(s):
  129.31 - *
  129.32 - * Portions Copyrighted 2007 Sun Microsystems, Inc.
  129.33 - */
  129.34 -package org.netbeans.modules.java.hints.spiimpl;
  129.35 -
  129.36 -import junit.framework.Assert;
  129.37 -
  129.38 -/**
  129.39 - *
  129.40 - * @author Jan Lahoda
  129.41 - */
  129.42 -public class TestUtilities {
  129.43 -
  129.44 -    private TestUtilities() {
  129.45 -    }
  129.46 -
  129.47 -    public static String detectOffsets(String source, int[] positionOrSpan) {
  129.48 -        return detectOffsets(source, positionOrSpan, "\\|");
  129.49 -    }
  129.50 -
  129.51 -    public static String detectOffsets(String source, int[] positionOrSpan, String delimiter) {
  129.52 -        //for now, the position/span delimiter is '|', without possibility of escaping:
  129.53 -        String[] split = source.split(delimiter);
  129.54 -        
  129.55 -        Assert.assertTrue("incorrect number of position markers (|)", positionOrSpan.length == split.length - 1);
  129.56 -        
  129.57 -        StringBuilder sb = new StringBuilder();
  129.58 -        int index = 0;
  129.59 -        int offset = 0;
  129.60 -        
  129.61 -        for (String s : split) {
  129.62 -            sb.append(s);
  129.63 -            if (index < positionOrSpan.length)
  129.64 -                positionOrSpan[index++] = (offset += s.length());
  129.65 -        }
  129.66 -        
  129.67 -        return sb.toString();
  129.68 -    }
  129.69 -
  129.70 -}
   130.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/UtilitiesTest.java	Sun Jan 08 20:10:08 2017 +0100
   130.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   130.3 @@ -1,644 +0,0 @@
   130.4 -/*
   130.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   130.6 - *
   130.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   130.8 - *
   130.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  130.10 - * Other names may be trademarks of their respective owners.
  130.11 - *
  130.12 - * The contents of this file are subject to the terms of either the GNU
  130.13 - * General Public License Version 2 only ("GPL") or the Common
  130.14 - * Development and Distribution License("CDDL") (collectively, the
  130.15 - * "License"). You may not use this file except in compliance with the
  130.16 - * License. You can obtain a copy of the License at
  130.17 - * http://www.netbeans.org/cddl-gplv2.html
  130.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  130.19 - * specific language governing permissions and limitations under the
  130.20 - * License.  When distributing the software, include this License Header
  130.21 - * Notice in each file and include the License file at
  130.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  130.23 - * particular file as subject to the "Classpath" exception as provided
  130.24 - * by Oracle in the GPL Version 2 section of the License file that
  130.25 - * accompanied this code. If applicable, add the following below the
  130.26 - * License Header, with the fields enclosed by brackets [] replaced by
  130.27 - * your own identifying information:
  130.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  130.29 - *
  130.30 - * If you wish your version of this file to be governed by only the CDDL
  130.31 - * or only the GPL Version 2, indicate your decision by adding
  130.32 - * "[Contributor] elects to include this software in this distribution
  130.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  130.34 - * single choice of license, a recipient has the option to distribute
  130.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  130.36 - * to extend the choice of license to its licensees as provided above.
  130.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  130.38 - * Version 2 license, then the option applies only if the new code is
  130.39 - * made subject to such option by the copyright holder.
  130.40 - *
  130.41 - * Contributor(s):
  130.42 - *
  130.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  130.44 - */
  130.45 -
  130.46 -package org.netbeans.modules.java.hints.spiimpl;
  130.47 -
  130.48 -import com.sun.source.tree.IfTree;
  130.49 -import com.sun.source.tree.LambdaExpressionTree;
  130.50 -import com.sun.source.tree.MemberSelectTree;
  130.51 -import com.sun.source.tree.ModifiersTree;
  130.52 -import com.sun.source.tree.Scope;
  130.53 -import com.sun.source.tree.Tree;
  130.54 -import com.sun.source.tree.Tree.Kind;
  130.55 -import com.sun.source.tree.VariableTree;
  130.56 -import com.sun.source.util.SourcePositions;
  130.57 -import com.sun.source.util.TreePath;
  130.58 -import com.sun.source.util.TreeScanner;
  130.59 -import com.sun.tools.javac.tree.JCTree;
  130.60 -import java.util.ArrayList;
  130.61 -import java.util.Arrays;
  130.62 -import java.util.Collection;
  130.63 -import java.util.Collections;
  130.64 -import java.util.LinkedList;
  130.65 -import java.util.List;
  130.66 -import javax.lang.model.element.Element;
  130.67 -import javax.lang.model.element.ElementKind;
  130.68 -import javax.lang.model.type.TypeMirror;
  130.69 -import javax.tools.Diagnostic;
  130.70 -import javax.tools.JavaFileObject;
  130.71 -import org.netbeans.api.java.classpath.ClassPath;
  130.72 -import org.netbeans.api.java.source.ClasspathInfo;
  130.73 -import org.netbeans.api.java.source.CompilationController;
  130.74 -import org.netbeans.api.java.source.JavaSource;
  130.75 -import org.netbeans.api.java.source.JavaSource.Phase;
  130.76 -import org.netbeans.api.java.source.Task;
  130.77 -import org.netbeans.junit.RandomlyFails;
  130.78 -import org.netbeans.modules.java.source.pretty.VeryPretty;
  130.79 -import org.netbeans.modules.java.source.save.DiffContext;
  130.80 -
  130.81 -/**
  130.82 - *
  130.83 - * @author lahvac
  130.84 - */
  130.85 -public class UtilitiesTest extends TestBase {
  130.86 -
  130.87 -    public UtilitiesTest(String name) {
  130.88 -        super(name);
  130.89 -    }
  130.90 -
  130.91 -    public void testParseAndAttributeExpressionStatement() throws Exception {
  130.92 -        prepareTest("test/Test.java", "package test; public class Test{}");
  130.93 -
  130.94 -        Scope s = Utilities.constructScope(info, Collections.singletonMap("$1", info.getTreeUtilities().parseType("int", info.getTopLevelElements().get(0))));
  130.95 -        Tree result = Utilities.parseAndAttribute(info, "$1 = 1;", s);
  130.96 -
  130.97 -        assertTrue(result.getKind().name(), result.getKind() == Kind.EXPRESSION_STATEMENT);
  130.98 -    }
  130.99 -
 130.100 -    public void testParseAndAttributeVariable() throws Exception {
 130.101 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.102 -
 130.103 -        Scope s = Utilities.constructScope(info, Collections.singletonMap("$1", info.getTreeUtilities().parseType("int", info.getTopLevelElements().get(0))));
 130.104 -        Tree result = Utilities.parseAndAttribute(info, "int $2 = $1;", s);
 130.105 -
 130.106 -        assertTrue(result.getKind().name(), result.getKind() == Kind.VARIABLE);
 130.107 -    }
 130.108 -
 130.109 -    public void testParseAndAttributeMultipleStatements() throws Exception {
 130.110 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.111 -
 130.112 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.113 -        Tree result = Utilities.parseAndAttribute(info, "String $2 = $1; int $l = $2.length(); System.err.println($l);", s);
 130.114 -
 130.115 -        assertTrue(result.getKind().name(), result.getKind() == Kind.BLOCK);
 130.116 -
 130.117 -        String golden = "{\n" +
 130.118 -                        "    $$1$;\n" +
 130.119 -                        "    String $2 = $1;\n" +
 130.120 -                        "    int $l = $2.length();\n" +
 130.121 -                        "    System.err.println($l);\n" +
 130.122 -                        "    $$2$;\n" +
 130.123 -                        "}";
 130.124 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.125 -    }
 130.126 -
 130.127 -    public void testParseAndAttributeMethod() throws Exception {
 130.128 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.129 -
 130.130 -        Scope s = Utilities.constructScope(info, Collections.singletonMap("$1", info.getTreeUtilities().parseType("int", info.getTopLevelElements().get(0))));
 130.131 -        String methodCode = "private int test(int i) { return i; }";
 130.132 -        Tree result = Utilities.parseAndAttribute(info, methodCode, s);
 130.133 -
 130.134 -        assertEquals(Kind.METHOD, result.getKind());
 130.135 -        assertEquals(methodCode.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " ").trim());
 130.136 -    }
 130.137 -
 130.138 -    public void testParseAndAttributeMultipleClassMembers() throws Exception {
 130.139 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.140 -
 130.141 -        Scope s = Utilities.constructScope(info, Collections.singletonMap("$1", info.getTreeUtilities().parseType("int", info.getTopLevelElements().get(0))));
 130.142 -        String code = "private int i; private int getI() { return i; } private void setI(int i) { this.i = i; }";
 130.143 -        Tree result = Utilities.parseAndAttribute(info, code, s);
 130.144 -
 130.145 -        String golden = "class $ {\n" +
 130.146 -                        "    $$1$;\n" +
 130.147 -                        "    private int i;\n" +
 130.148 -                        "    private int getI() {\n" +
 130.149 -                        "        return i;\n" +
 130.150 -                        "    }\n" +
 130.151 -                        "    private void setI(int i) {\n" +
 130.152 -                        "        this.i = i;\n" +
 130.153 -                        "    }\n" +
 130.154 -                        "}";
 130.155 -
 130.156 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " ").trim());
 130.157 -    }
 130.158 -
 130.159 -    public void testParseAndAttributeFieldModifiersVariable() throws Exception {
 130.160 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.161 -
 130.162 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.163 -        String code = "$mods$ java.lang.String $name;";
 130.164 -        Tree result = Utilities.parseAndAttribute(info, code, s);
 130.165 -
 130.166 -        String golden = "$mods$ java.lang.String $name";
 130.167 -
 130.168 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " ").trim());
 130.169 -    }
 130.170 -
 130.171 -    public void testParseAndAttributeIfWithParenthetised() throws Exception {
 130.172 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.173 -
 130.174 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.175 -        String code = "if ($c) { $1$; System.err.println('a'); $2$; }";
 130.176 -        Tree result = Utilities.parseAndAttribute(info, code, s);
 130.177 -
 130.178 -        IfTree it = (IfTree) result;
 130.179 -
 130.180 -        assertEquals(Kind.PARENTHESIZED, it.getCondition().getKind());
 130.181 -
 130.182 -        String golden = "if ($c) { $1$; System.err.println('a'); $2$; }";
 130.183 -
 130.184 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " ").trim());
 130.185 -    }
 130.186 -
 130.187 -    public void testParseAndAttributeMultipleStatements2() throws Exception {
 130.188 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.189 -
 130.190 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.191 -        Tree result = Utilities.parseAndAttribute(info, "$type $name = $map.get($key); if ($name == null) { $map.put($key, $name = $init); }", s);
 130.192 -
 130.193 -        assertTrue(result.getKind().name(), result.getKind() == Kind.BLOCK);
 130.194 -
 130.195 -        String golden = "{" +
 130.196 -                        "    $$1$;" +
 130.197 -                        "    $type $name = $map.get($key);" +
 130.198 -                        "    if ($name == null) {" +
 130.199 -                        "        $map.put($key, $name = $init);" +
 130.200 -                        "    }" +
 130.201 -                        "    $$2$;\n" +
 130.202 -                        "}";
 130.203 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.204 -    }
 130.205 -
 130.206 -    public void testParseAndAttributeMethodDeclarationWithMultiparameters() throws Exception {
 130.207 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.208 -
 130.209 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.210 -        Tree result = Utilities.parseAndAttribute(info, "public void t($params$) {}", s);
 130.211 -
 130.212 -        assertTrue(result.getKind().name(), result.getKind() == Kind.METHOD);
 130.213 -
 130.214 -        String golden = " public void t($params$) { }";
 130.215 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.216 -    }
 130.217 -
 130.218 -    public void testParseAndAttributeMethodModifiersVariable() throws Exception {
 130.219 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.220 -
 130.221 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.222 -        String code = "$mods$ $type $name() { $r$; }";
 130.223 -        Tree result = Utilities.parseAndAttribute(info, code, s);
 130.224 -
 130.225 -        String golden = "$mods$ $type $name() { $r$; }";
 130.226 -
 130.227 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " ").trim());
 130.228 -    }
 130.229 -
 130.230 -    public void testSimpleExpression() throws Exception {
 130.231 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.232 -
 130.233 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.234 -        Tree result = Utilities.parseAndAttribute(info, "$1.isDirectory()", s);
 130.235 -
 130.236 -        assertTrue(result.getKind().name(), result.getKind() == Kind.METHOD_INVOCATION);
 130.237 -
 130.238 -        String golden = "$1.isDirectory()";
 130.239 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.240 -    }
 130.241 -    
 130.242 -    public void testARMResourceVariable1() throws Exception {
 130.243 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.244 -
 130.245 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.246 -        Tree result = Utilities.parseAndAttribute(info, "try ($t$) { $stmts$; } catch $catches$", s);
 130.247 -
 130.248 -        assertTrue(result.getKind().name(), result.getKind() == Kind.TRY);
 130.249 -
 130.250 -        String golden = "try ($t$) { $stmts$; }$catches$";
 130.251 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.252 -    }
 130.253 -    
 130.254 -    public void testARMResourceVariable2() throws Exception {
 130.255 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.256 -
 130.257 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.258 -        Tree result = Utilities.parseAndAttribute(info, "try ($t$; $type $name = $init) { $stmts$; } catch $catches$", s);
 130.259 -
 130.260 -        assertTrue(result.getKind().name(), result.getKind() == Kind.TRY);
 130.261 -
 130.262 -        String golden = "try ($t$ final $type $name = $init;) { $stmts$; }$catches$";
 130.263 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.264 -    }
 130.265 -    
 130.266 -    public void testARMResourceNotVariable() throws Exception {
 130.267 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.268 -
 130.269 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.270 -        Tree result = Utilities.parseAndAttribute(info, "try ($t $n = $init$) { $stmts$; } catch $catches$", s);
 130.271 -
 130.272 -        assertTrue(result.getKind().name(), result.getKind() == Kind.TRY);
 130.273 -
 130.274 -        String golden = "try (final $t $n = $init$;) { $stmts$; }$catches$";
 130.275 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.276 -    }
 130.277 -
 130.278 -    public void testParseAndAttributeType() throws Exception {
 130.279 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.280 -
 130.281 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.282 -        Tree result = Utilities.parseAndAttribute(info, "\njava. util \n.List \n", s);
 130.283 -
 130.284 -        assertTrue(result.getKind().name(), result.getKind() == Kind.MEMBER_SELECT);
 130.285 -
 130.286 -        assertEquals(ElementKind.INTERFACE, info.getTrees().getElement(new TreePath(new TreePath(info.getCompilationUnit()), result)).getKind());
 130.287 -        assertEquals(info.getElements().getTypeElement("java.util.List"), info.getTrees().getElement(new TreePath(new TreePath(info.getCompilationUnit()), result)));
 130.288 -    }
 130.289 -    
 130.290 -    public void testCatchMultiparam() throws Exception {
 130.291 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.292 -
 130.293 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.294 -        Tree result = Utilities.parseAndAttribute(info, "try {\n }\n catch $catch$ finally {\n }\n", s);
 130.295 -
 130.296 -        assertTrue(result.getKind().name(), result.getKind() == Kind.TRY);
 130.297 -
 130.298 -        String golden = "try {\n }$catch$ finally {\n }";
 130.299 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.300 -    }
 130.301 -
 130.302 -    public void testCaseMultiparam() throws Exception {
 130.303 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.304 -
 130.305 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.306 -        Tree result = Utilities.parseAndAttribute(info, "switch ($v) {case $c1$ case 1: ; case $c2$; case 3: ;}", s);
 130.307 -
 130.308 -        assertTrue(result.getKind().name(), result.getKind() == Kind.SWITCH);
 130.309 -
 130.310 -        String golden = "switch ($v) { $c1$ case 1: ; $c2$ case 3: ; }";
 130.311 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.312 -    }
 130.313 -    
 130.314 -    public void testOrdinaryCatch() throws Exception {
 130.315 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.316 -
 130.317 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.318 -        Tree result = Utilities.parseAndAttribute(info, "try {\n }\n catch (NullPointerException ex) { } finally {\n }\n", s);
 130.319 -
 130.320 -        assertTrue(result.getKind().name(), result.getKind() == Kind.TRY);
 130.321 -
 130.322 -        String golden = "try {\n } catch (NullPointerException ex) { } finally {\n }";
 130.323 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.324 -    }
 130.325 -    
 130.326 -    public void testClassPattern() throws Exception {
 130.327 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.328 -
 130.329 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.330 -        Tree result = Utilities.parseAndAttribute(info, "$mods$ class $name extends java.util.LinkedList { $methods$; }\n", s);
 130.331 -
 130.332 -        assertTrue(result.getKind().name(), result.getKind() == Kind.CLASS);
 130.333 -
 130.334 -        String golden = " $mods$ class $name extends java.util.LinkedList { $name() { super(); } $methods$ }";
 130.335 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.336 -    }
 130.337 -
 130.338 -    public void testErrorsForPatterns1() throws Exception {
 130.339 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.340 -
 130.341 -        SourcePositions[] positions = new SourcePositions[1];
 130.342 -        Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
 130.343 -        String code = "foo bar";
 130.344 -        Tree result = Utilities.parseAndAttribute(info, code, null, positions, errors);
 130.345 -
 130.346 -        assertDiagnostics(errors, "7-7:compiler.err.expected");
 130.347 -        assertPositions(result, positions[0], code, "foo", "foo bar");
 130.348 -    }
 130.349 -
 130.350 -    @RandomlyFails
 130.351 -    public void testErrorsForPatterns2() throws Exception {
 130.352 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.353 -
 130.354 -        SourcePositions[] positions = new SourcePositions[1];
 130.355 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.356 -        Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
 130.357 -        String code = "$1.isDirectory()";
 130.358 -        Tree result = Utilities.parseAndAttribute(info, code, s, positions, errors);
 130.359 -
 130.360 -        assertDiagnostics(errors, "0-0:compiler.err.cant.resolve.location");
 130.361 -        assertPositions(result, positions[0], code, "$1", "$1.isDirectory", "$1.isDirectory()");
 130.362 -    }
 130.363 -
 130.364 -    public void testErrorsForPatterns3() throws Exception {
 130.365 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.366 -
 130.367 -        SourcePositions[] positions = new SourcePositions[1];
 130.368 -        Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
 130.369 -        String code = "if ($cond) { foo() } else $else;";
 130.370 -        Tree result = Utilities.parseAndAttribute(info, code, null, positions, errors);
 130.371 -
 130.372 -        assertDiagnostics(errors, "18-18:compiler.err.expected");
 130.373 -        assertPositions(result, positions[0], code, "$cond", "$else", "$else;", "($cond)", "foo", "foo()", "foo() ", "if ($cond) { foo() } else $else;", "{ foo() }");
 130.374 -    }
 130.375 -
 130.376 -    public void testPositionsForCorrectStatement() throws Exception {
 130.377 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.378 -
 130.379 -        SourcePositions[] positions = new SourcePositions[1];
 130.380 -        Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
 130.381 -        String code = "assert true;";
 130.382 -        Tree result = Utilities.parseAndAttribute(info, code, null, positions, errors);
 130.383 -
 130.384 -        assertTrue(errors.isEmpty());
 130.385 -        assertPositions(result, positions[0], code, "assert true;", "true");
 130.386 -    }
 130.387 -
 130.388 -    public void testCasePattern() throws Exception {
 130.389 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.390 -
 130.391 -        SourcePositions[] positions = new SourcePositions[1];
 130.392 -        Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
 130.393 -        String code = "case $expr: foo bar $stmts$;\n";
 130.394 -        Tree result = Utilities.parseAndAttribute(info, code, null, positions, errors);
 130.395 -
 130.396 -        assertTrue(result.getKind().name(), result.getKind() == Kind.CASE);
 130.397 -
 130.398 -        String golden = "case $expr: foo bar; $stmts$; ";
 130.399 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.400 -        assertDiagnostics(errors, "19-19:compiler.err.expected");
 130.401 -        assertPositions(result, positions[0], code, "$expr", "$stmts$", "$stmts$;", "case $expr: foo bar $stmts$;", "foo", "foo bar ");
 130.402 -    }
 130.403 -
 130.404 -    public void testLambdaPattern() throws Exception {
 130.405 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.406 -
 130.407 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.408 -        Tree result = Utilities.parseAndAttribute(info, "new $type() {\n $mods$ $resultType $methodName($args$) {\n $statements$;\n }\n }\n", s);
 130.409 -
 130.410 -        assertTrue(result.getKind().name(), result.getKind() == Kind.NEW_CLASS);
 130.411 -
 130.412 -        String golden = "new $type(){ $mods$ $resultType $methodName($args$) { $statements$; } }";
 130.413 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.414 -
 130.415 -        Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
 130.416 -
 130.417 -        result = Utilities.parseAndAttribute(info, "new $type() {\n $mods$ $resultType $methodName($args$) {\n $statements$;\n }\n }\n", null, errors);
 130.418 -        assertTrue(result.getKind().name(), result.getKind() == Kind.NEW_CLASS);
 130.419 -
 130.420 -        golden = "new $type(){ $mods$ $resultType $methodName($args$) { $statements$; } }";
 130.421 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.422 -        assertTrue(errors.toString(), errors.isEmpty());
 130.423 -    }
 130.424 -    
 130.425 -    public void testPackagePattern() throws Exception {
 130.426 -        prepareTest("test/a/Test.java", "package test.a; public class Test{}");
 130.427 -
 130.428 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.429 -        Tree result = Utilities.parseAndAttribute(info, "test.$1", s);
 130.430 -
 130.431 -        assertTrue(result.getKind().name(), result.getKind() == Kind.MEMBER_SELECT);
 130.432 -
 130.433 -        String golden = "test.$1";
 130.434 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.435 -        
 130.436 -        Element total = info.getTrees().getElement(new TreePath(new TreePath(info.getCompilationUnit()), result));
 130.437 -        
 130.438 -        assertTrue(Utilities.isError(total));
 130.439 -        
 130.440 -        Element testPack = info.getTrees().getElement(new TreePath(new TreePath(info.getCompilationUnit()), ((MemberSelectTree) result).getExpression()));
 130.441 -
 130.442 -        assertFalse(Utilities.isError(testPack));
 130.443 -        assertEquals(info.getElements().getPackageElement("test"), testPack);
 130.444 -    }
 130.445 -
 130.446 -    public void DtestMultiStatementVarWithModifiers() throws Exception {
 130.447 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.448 -
 130.449 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.450 -        Tree result = Utilities.parseAndAttribute(info, "$mods$ $type $name; $name = $init;", s);
 130.451 -
 130.452 -        assertTrue(result.getKind().name(), result.getKind() == Kind.BLOCK);
 130.453 -
 130.454 -        String golden = "{ $$1$; $mods$$type $name; $name = $init; $$2$; }";
 130.455 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.456 -    }
 130.457 -    
 130.458 -    public void testAnnotation() throws Exception {
 130.459 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.460 -
 130.461 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.462 -        Tree result = Utilities.parseAndAttribute(info, "@$annotation($args$)", s);
 130.463 -
 130.464 -        assertTrue(result.getKind().name(), result.getKind() == Kind.ANNOTATION);
 130.465 -
 130.466 -        String golden = "@$annotation(value = $args$)";
 130.467 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.468 -    }
 130.469 -
 130.470 -    public void testParseAndAttributeMultipleStatementsWithBefore() throws Exception {
 130.471 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.472 -
 130.473 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.474 -        Tree result = Utilities.parseAndAttribute(info, "$before$; String $2 = $1; int $l = $2.length(); System.err.println($l);", s);
 130.475 -
 130.476 -        assertTrue(result.getKind().name(), result.getKind() == Kind.BLOCK);
 130.477 -
 130.478 -        String golden = "{\n" +
 130.479 -                        "    $before$;\n" +
 130.480 -                        "    String $2 = $1;\n" +
 130.481 -                        "    int $l = $2.length();\n" +
 130.482 -                        "    System.err.println($l);\n" +
 130.483 -                        "    $$2$;\n" +
 130.484 -                        "}";
 130.485 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.486 -    }
 130.487 -    
 130.488 -    public void testParseAndAttributeMultipleStatementsWithAfter() throws Exception {
 130.489 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.490 -
 130.491 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.492 -        Tree result = Utilities.parseAndAttribute(info, "String $2 = $1; int $l = $2.length(); System.err.println($l); $after$;", s);
 130.493 -
 130.494 -        assertTrue(result.getKind().name(), result.getKind() == Kind.BLOCK);
 130.495 -
 130.496 -        String golden = "{\n" +
 130.497 -                        "    $$1$;\n" +
 130.498 -                        "    String $2 = $1;\n" +
 130.499 -                        "    int $l = $2.length();\n" +
 130.500 -                        "    System.err.println($l);\n" +
 130.501 -                        "    $after$;\n" +
 130.502 -                        "}";
 130.503 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.504 -    }
 130.505 -    
 130.506 -    public void testMethodFormalParams() throws Exception {
 130.507 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.508 -
 130.509 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.510 -        Tree result = Utilities.parseAndAttribute(info, "$mods$ $ret $name($pref$, $type $name, $suff$) throws $throws$ { $body$; }", s);
 130.511 -
 130.512 -        assertTrue(result.getKind().name(), result.getKind() == Kind.METHOD);
 130.513 -
 130.514 -        String golden = " $mods$ $ret $name($pref$, $type $name, $suff$) throws $throws$ { $body$; }";
 130.515 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " "));
 130.516 -    }
 130.517 -    
 130.518 -    public void testPartialModifiers() throws Exception {
 130.519 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.520 -
 130.521 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.522 -        Tree result = Utilities.parseAndAttribute(info, "$mods$ @Deprecated public $type $name;", s);
 130.523 -
 130.524 -        assertTrue(result.getKind().name(), result.getKind() == Kind.VARIABLE);
 130.525 -
 130.526 -        ModifiersTree mods = ((VariableTree) result).getModifiers();
 130.527 -        String golden = "$mods$,@Deprecated(), [public]";
 130.528 -        
 130.529 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), mods.getAnnotations().toString() + ", " + mods.getFlags().toString());
 130.530 -    }
 130.531 -    
 130.532 -    public void testBrokenPlatform226678() throws Exception {
 130.533 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.534 -
 130.535 -        JavaSource.create(ClasspathInfo.create(ClassPath.EMPTY, ClassPath.EMPTY, ClassPath.EMPTY), info.getFileObject()).runUserActionTask(new Task<CompilationController>() {
 130.536 -            @Override public void run(CompilationController parameter) throws Exception {
 130.537 -                parameter.toPhase(Phase.RESOLVED);
 130.538 -                info = parameter;
 130.539 -            }
 130.540 -        }, true);
 130.541 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.542 -        String methodCode = "private int test(int i) { return i; }";
 130.543 -        Tree result = Utilities.parseAndAttribute(info, methodCode, s);
 130.544 -
 130.545 -        assertEquals(Kind.METHOD, result.getKind());
 130.546 -        assertEquals(methodCode.replaceAll("[ \n\r]+", " "), result.toString().replaceAll("[ \n\r]+", " ").trim());
 130.547 -    }
 130.548 -    
 130.549 -    public void testLambdaExpression1() throws Exception {
 130.550 -        prepareTest("test/Test.java", "package test; public class Test{}");
 130.551 -
 130.552 -        Scope s = Utilities.constructScope(info, Collections.<String, TypeMirror>emptyMap());
 130.553 -        Tree result = Utilities.parseAndAttribute(info, "($args$) -> $expression", s);
 130.554 -
 130.555 -        assertTrue(result.getKind().name(), result.getKind() == Kind.LAMBDA_EXPRESSION);
 130.556 -
 130.557 -        LambdaExpressionTree let = (LambdaExpressionTree) result;
 130.558 -        
 130.559 -        assertEquals(Kind.IDENTIFIER, let.getParameters().get(0).getKind());
 130.560 -        String golden = "($args$)->$expression";
 130.561 -        
 130.562 -        assertEquals(golden.replaceAll("[ \n\r]+", " "), result.toString());
 130.563 -    }
 130.564 -    
 130.565 -    public void testToHumanReadableTime() {
 130.566 -        long time = 202;
 130.567 -        assertEquals(    "5s", Utilities.toHumanReadableTime(time +=           5 * 1000));
 130.568 -        assertEquals(  "3m5s", Utilities.toHumanReadableTime(time +=      3 * 60 * 1000));
 130.569 -        assertEquals("7h3m5s", Utilities.toHumanReadableTime(time += 7 * 60 * 60 * 1000));
 130.570 -    }
 130.571 -
 130.572 -    public void testGeneralization() throws Exception {
 130.573 -        performGeneralizationTest("package test;\n" +
 130.574 -                                  "public class Test {\n" +
 130.575 -                                  "    class Inner {\n" +
 130.576 -                                  "        Inner(int i) {}\n" +
 130.577 -                                  "    }\n" +
 130.578 -                                  "    public static void main(String[] args) {\n" +
 130.579 -                                  "        int i = 1;\n" +
 130.580 -                                  "        Test c = null;\n" +
 130.581 -                                  "        c.new Inner(i++) {};\n" +
 130.582 -                                  "    }\n" +
 130.583 -                                  "}\n",
 130.584 -                                  "package test;\n" +
 130.585 -                                  "public class Test {\n" +
 130.586 -                                  "    class Inner {\n" +
 130.587 -                                  "        Inner(int $0) { super(); }\n" +
 130.588 -                                  "    }\n" +
 130.589 -                                  "    public static void main(String[] $1) {\n" +
 130.590 -                                  "        int $2 = 1;\n" +
 130.591 -                                  "        Test $3 = null;\n" +
 130.592 -                                  "        $4;\n" + //XXX
 130.593 -                                  "    }\n" +
 130.594 -                                  "}\n");
 130.595 -    }
 130.596 -    private void performGeneralizationTest(String code, String generalized) throws Exception {
 130.597 -        prepareTest("test/Test.java", code);
 130.598 -
 130.599 -        Tree generalizedTree = Utilities.generalizePattern(info, new TreePath(info.getCompilationUnit()));
 130.600 -        VeryPretty vp = new VeryPretty(new DiffContext(info));
 130.601 -
 130.602 -        vp.print((JCTree) generalizedTree);
 130.603 -
 130.604 -        String repr = vp.toString();
 130.605 -
 130.606 -        assertEquals(generalized.replaceAll("[ \n\t]+", " "),
 130.607 -                     repr.replaceAll("[ \n\t]+", " "));
 130.608 -    }
 130.609 -
 130.610 -    private void assertDiagnostics(Collection<Diagnostic<? extends JavaFileObject>> errors, String... golden) {
 130.611 -        List<String> actual = new ArrayList<String>(errors.size());
 130.612 -
 130.613 -        for (Diagnostic<? extends JavaFileObject> d : errors) {
 130.614 -            actual.add(d.getStartPosition() + "-" + d.getEndPosition() + ":" + d.getCode());
 130.615 -        }
 130.616 -
 130.617 -        assertEquals(Arrays.asList(golden), actual);
 130.618 -    }
 130.619 -
 130.620 -    private void assertPositions(Tree t, final SourcePositions sp, final String code, String... golden) {
 130.621 -        final List<String> actual = new ArrayList<String>(golden.length);
 130.622 -
 130.623 -        new TreeScanner<Void, Void>() {
 130.624 -            @Override
 130.625 -            public Void scan(Tree node, Void p) {
 130.626 -                if (node != null) {
 130.627 -                    int start = (int) sp.getStartPosition(null, node);
 130.628 -                    int end = (int) sp.getEndPosition(null, node);
 130.629 -
 130.630 -                    if (start >= 0 && end >= 0) {
 130.631 -                        actual.add(code.substring(start, end));
 130.632 -                    }
 130.633 -                }
 130.634 -                return super.scan(node, p);
 130.635 -            }
 130.636 -        }.scan(t, null);
 130.637 -
 130.638 -        Collections.sort(actual);
 130.639 -
 130.640 -        List<String> goldenList = new ArrayList<String>(Arrays.asList(golden));
 130.641 -
 130.642 -        Collections.sort(goldenList);
 130.643 -
 130.644 -        assertEquals(goldenList, actual);
 130.645 -    }
 130.646 -
 130.647 -}
   131.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchSearchTest.java	Sun Jan 08 20:10:08 2017 +0100
   131.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   131.3 @@ -1,458 +0,0 @@
   131.4 -/*
   131.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   131.6 - *
   131.7 - * Copyright 2009-2011 Oracle and/or its affiliates. All rights reserved.
   131.8 - *
   131.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  131.10 - * Other names may be trademarks of their respective owners.
  131.11 - *
  131.12 - * The contents of this file are subject to the terms of either the GNU
  131.13 - * General Public License Version 2 only ("GPL") or the Common
  131.14 - * Development and Distribution License("CDDL") (collectively, the
  131.15 - * "License"). You may not use this file except in compliance with the
  131.16 - * License. You can obtain a copy of the License at
  131.17 - * http://www.netbeans.org/cddl-gplv2.html
  131.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  131.19 - * specific language governing permissions and limitations under the
  131.20 - * License.  When distributing the software, include this License Header
  131.21 - * Notice in each file and include the License file at
  131.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  131.23 - * particular file as subject to the "Classpath" exception as provided
  131.24 - * by Oracle in the GPL Version 2 section of the License file that
  131.25 - * accompanied this code. If applicable, add the following below the
  131.26 - * License Header, with the fields enclosed by brackets [] replaced by
  131.27 - * your own identifying information:
  131.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  131.29 - *
  131.30 - * If you wish your version of this file to be governed by only the CDDL
  131.31 - * or only the GPL Version 2, indicate your decision by adding
  131.32 - * "[Contributor] elects to include this software in this distribution
  131.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  131.34 - * single choice of license, a recipient has the option to distribute
  131.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  131.36 - * to extend the choice of license to its licensees as provided above.
  131.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  131.38 - * Version 2 license, then the option applies only if the new code is
  131.39 - * made subject to such option by the copyright holder.
  131.40 - *
  131.41 - * Contributor(s):
  131.42 - *
  131.43 - * Portions Copyrighted 2009-2011 Sun Microsystems, Inc.
  131.44 - */
  131.45 -package org.netbeans.modules.java.hints.spiimpl.batch;
  131.46 -
  131.47 -import org.netbeans.modules.java.hints.spiimpl.batch.TestUtils.File;
  131.48 -import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
  131.49 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
  131.50 -import java.net.URL;
  131.51 -import java.util.ArrayList;
  131.52 -import java.util.Arrays;
  131.53 -import java.util.Collection;
  131.54 -import java.util.Collections;
  131.55 -import java.util.HashMap;
  131.56 -import java.util.HashSet;
  131.57 -import java.util.Iterator;
  131.58 -import java.util.LinkedList;
  131.59 -import java.util.List;
  131.60 -import java.util.Map;
  131.61 -import java.util.Map.Entry;
  131.62 -import java.util.Set;
  131.63 -import java.util.concurrent.atomic.AtomicBoolean;
  131.64 -import java.util.regex.Pattern;
  131.65 -import junit.framework.TestSuite;
  131.66 -import org.netbeans.api.java.classpath.ClassPath;
  131.67 -import org.netbeans.api.java.classpath.GlobalPathRegistry;
  131.68 -import org.netbeans.api.java.classpath.GlobalPathRegistryEvent;
  131.69 -import org.netbeans.api.java.classpath.GlobalPathRegistryListener;
  131.70 -import org.netbeans.api.java.source.CompilationController;
  131.71 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  131.72 -import org.netbeans.core.startup.Main;
  131.73 -import org.netbeans.junit.NbTestCase;
  131.74 -import org.netbeans.junit.NbTestSuite;
  131.75 -import org.netbeans.junit.RandomlyFails;
  131.76 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.BatchResult;
  131.77 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Folder;
  131.78 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Resource;
  131.79 -import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
  131.80 -import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
  131.81 -import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
  131.82 -import org.netbeans.spi.editor.hints.ErrorDescription;
  131.83 -import org.netbeans.spi.java.classpath.ClassPathProvider;
  131.84 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
  131.85 -import org.openide.filesystems.FileObject;
  131.86 -import org.openide.filesystems.FileStateInvalidException;
  131.87 -import org.openide.filesystems.FileUtil;
  131.88 -
  131.89 -import org.openide.util.Exceptions;
  131.90 -import org.openide.util.lookup.ServiceProvider;
  131.91 -import static org.netbeans.modules.java.hints.spiimpl.batch.TestUtils.writeFilesAndWaitForScan;
  131.92 -import static org.netbeans.modules.java.hints.spiimpl.batch.TestUtils.prepareHints;
  131.93 -
  131.94 -/**
  131.95 - *
  131.96 - * @author lahvac
  131.97 - */
  131.98 -public class BatchSearchTest extends NbTestCase {
  131.99 -
 131.100 -    public BatchSearchTest(String name) {
 131.101 -        super(name);
 131.102 -    }
 131.103 -
 131.104 -    public static TestSuite suite() {
 131.105 -        TestSuite result = new NbTestSuite();
 131.106 -
 131.107 -        result.addTestSuite(BatchSearchTest.class);
 131.108 -//        result.addTest(new BatchSearchTest("testBatchSearchFolderRemoteIndex"));
 131.109 -
 131.110 -        return result;
 131.111 -    }
 131.112 -
 131.113 -    //XXX: copied from CustomIndexerImplTest:
 131.114 -    @Override
 131.115 -    protected void setUp() throws Exception {
 131.116 -        SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
 131.117 -        Main.initializeURLFactory();
 131.118 -        org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
 131.119 -        prepareTest();
 131.120 -        MimeTypes.setAllMimeTypes(Collections.singleton("text/x-java"));
 131.121 -        sourceCP = ClassPathSupport.createClassPath(src1, src2);
 131.122 -        GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {sourceCP});
 131.123 -        RepositoryUpdater.getDefault().start(true);
 131.124 -        super.setUp();
 131.125 -    }
 131.126 -
 131.127 -    @Override
 131.128 -    protected void tearDown() throws Exception {
 131.129 -        super.tearDown();
 131.130 -        GlobalPathRegistry.getDefault().unregister(ClassPath.SOURCE, new ClassPath[] {sourceCP});
 131.131 -    }
 131.132 -
 131.133 -    public void testBatchSearch1() throws Exception {
 131.134 -        writeFilesAndWaitForScan(src1,
 131.135 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { java.io.File f = null; f.isDirectory(); } }"),
 131.136 -                                 new File("test/Test2.java", "package test; public class Test2 { private void test() { new javax.swing.ImageIcon(null); } }"));
 131.137 -        writeFilesAndWaitForScan(src2,
 131.138 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { java.io.File f = null; f.isDirectory(); } }"),
 131.139 -                                 new File("test/Test2.java", "package test; public class Test2 { private void test() { new javax.swing.ImageIcon(null); } }"));
 131.140 -
 131.141 -        Iterable<? extends HintDescription> hints = prepareHints("$1.isDirectory()");
 131.142 -        BatchResult result = BatchSearch.findOccurrences(hints, Scopes.allOpenedProjectsScope());
 131.143 -        Map<String, Iterable<String>> output = new HashMap<String, Iterable<String>>();
 131.144 -
 131.145 -        for (Entry<FileObject, Collection<? extends Resource>> e : result.getResourcesWithRoots().entrySet()) {
 131.146 -            Collection<String> resourcesRepr = new LinkedList<String>();
 131.147 -
 131.148 -            for (Resource r : e.getValue()) {
 131.149 -                resourcesRepr.add(r.getRelativePath());
 131.150 -            }
 131.151 -
 131.152 -            output.put(e.getKey().getURL().toExternalForm(), resourcesRepr);
 131.153 -        }
 131.154 -
 131.155 -        Map<String, Iterable<String>> golden = new HashMap<String, Iterable<String>>();
 131.156 -
 131.157 -        golden.put(src1.getURL().toExternalForm(), Arrays.asList("test/Test1.java"));
 131.158 -        golden.put(src2.getURL().toExternalForm(), Arrays.asList("test/Test1.java"));
 131.159 -
 131.160 -        assertEquals(golden, output);
 131.161 -    }
 131.162 -
 131.163 -    public void testBatchSearchSpan() throws Exception {
 131.164 -        String code = "package test;\n" +
 131.165 -                      "public class Test {\n" +
 131.166 -                      "    private void m() {\n" +
 131.167 -                      "        a(c.i().getFileObject());\n" +
 131.168 -                      "        if (span != null && span[0] != (-1) && span[1] != (-1));\n" +
 131.169 -                      "        c.i().getFileObject(\"\");\n" +
 131.170 -                      "    }\n" +
 131.171 -                      "}\n";
 131.172 -
 131.173 -        writeFilesAndWaitForScan(src1, new File("test/Test.java", code));
 131.174 -
 131.175 -        Iterable<? extends HintDescription> hints = prepareHints("$0.getFileObject($1)");
 131.176 -        BatchResult result = BatchSearch.findOccurrences(hints, Scopes.allOpenedProjectsScope());
 131.177 -
 131.178 -        assertEquals(1, result.getResources().size());
 131.179 -        Iterator<? extends Resource> resources = result.getResources().iterator().next().iterator();
 131.180 -        Resource r = resources.next();
 131.181 -
 131.182 -        assertFalse(resources.hasNext());
 131.183 -
 131.184 -        Set<String> snipets = new HashSet<String>();
 131.185 -
 131.186 -        for (int[] span : r.getCandidateSpans()) {
 131.187 -            snipets.add(code.substring(span[0], span[1]));
 131.188 -        }
 131.189 -
 131.190 -        Set<String> golden = new HashSet<String>(Arrays.asList("c.i().getFileObject(\"\")"));
 131.191 -        assertEquals(golden, snipets);
 131.192 -    }
 131.193 -
 131.194 -    @RandomlyFails
 131.195 -    public void testBatchSearchNotIndexed() throws Exception {
 131.196 -        writeFilesAndWaitForScan(src1,
 131.197 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { java.io.File f = null; f.isDirectory(); } }"),
 131.198 -                                 new File("test/Test2.java", "package test; public class Test2 { private void test() { new javax.swing.ImageIcon(null); } }"));
 131.199 -        writeFilesAndWaitForScan(src3,
 131.200 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { Test2 f = null; f.isDirectory(); } }"),
 131.201 -                                 new File("test/Test2.java", "package test; public class Test2 { public boolean isDirectory() {return false} }"));
 131.202 -
 131.203 -        Iterable<? extends HintDescription> hints = prepareHints("$1.isDirectory()", "$1", "test.Test2");
 131.204 -        BatchResult result = BatchSearch.findOccurrences(hints, Scopes.specifiedFoldersScope(Folder.convert(src1, src3, empty)));
 131.205 -        Map<String, Iterable<String>> output = new HashMap<String, Iterable<String>>();
 131.206 -
 131.207 -        for (Entry<FileObject, Collection<? extends Resource>> e : result.getResourcesWithRoots().entrySet()) {
 131.208 -            Collection<String> resourcesRepr = new LinkedList<String>();
 131.209 -
 131.210 -            for (Resource r : e.getValue()) {
 131.211 -                resourcesRepr.add(r.getRelativePath());
 131.212 -            }
 131.213 -
 131.214 -            output.put(e.getKey().getURL().toExternalForm(), resourcesRepr);
 131.215 -        }
 131.216 -
 131.217 -        Map<String, Iterable<String>> golden = new HashMap<String, Iterable<String>>();
 131.218 -
 131.219 -        golden.put(src1.getURL().toExternalForm(), Arrays.asList("test/Test1.java"));
 131.220 -        golden.put(src3.getURL().toExternalForm(), Arrays.asList("test/Test1.java"));
 131.221 -
 131.222 -        assertEquals(golden, output);
 131.223 -
 131.224 -        //check verification:
 131.225 -        Map<String, Map<String, Iterable<String>>> verifiedOutput = verifiedSpans(result, false);
 131.226 -        Map<String, Map<String, Iterable<String>>> verifiedGolden = new HashMap<String, Map<String, Iterable<String>>>();
 131.227 -
 131.228 -        verifiedGolden.put(src1.getURL().toExternalForm(), Collections.<String, Iterable<String>>singletonMap("test/Test1.java", Arrays.<String>asList()));
 131.229 -        verifiedGolden.put(src3.getURL().toExternalForm(), Collections.<String, Iterable<String>>singletonMap("test/Test1.java", Arrays.asList("0:75-0:86:verifier:")));
 131.230 -
 131.231 -        assertEquals(verifiedGolden, verifiedOutput);
 131.232 -    }
 131.233 -
 131.234 -    public void testBatchSearchForceIndexingOfProperDirectory() throws Exception {
 131.235 -        FileObject data = FileUtil.createFolder(workdir, "data");
 131.236 -        FileObject dataSrc1 = FileUtil.createFolder(data, "src1");
 131.237 -        FileObject dataSrc2 = FileUtil.createFolder(data, "src2");
 131.238 -        writeFilesAndWaitForScan(dataSrc1,
 131.239 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { java.io.File f = null; f.isDirectory(); } }"),
 131.240 -                                 new File("test/Test2.java", "package test; public class Test2 { private void test() { new javax.swing.ImageIcon(null); } }"));
 131.241 -        writeFilesAndWaitForScan(dataSrc2,
 131.242 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { Test2 f = null; f.isDirectory(); } }"),
 131.243 -                                 new File("test/Test2.java", "package test; public class Test2 { public boolean isDirectory() {return false} }"));
 131.244 -
 131.245 -        ClassPathProviderImpl.setSourceRoots(Arrays.asList(dataSrc1, dataSrc2));
 131.246 -
 131.247 -        Iterable<? extends HintDescription> hints = prepareHints("$1.isDirectory()", "$1", "test.Test2");
 131.248 -        BatchResult result = BatchSearch.findOccurrences(hints, Scopes.specifiedFoldersScope(Folder.convert(data)));
 131.249 -        Map<String, Iterable<String>> output = new HashMap<String, Iterable<String>>();
 131.250 -
 131.251 -        for (Entry<FileObject, Collection<? extends Resource>> e : result.getResourcesWithRoots().entrySet()) {
 131.252 -            Collection<String> resourcesRepr = new HashSet<String>();
 131.253 -
 131.254 -            for (Resource r : e.getValue()) {
 131.255 -                resourcesRepr.add(r.getRelativePath());
 131.256 -            }
 131.257 -
 131.258 -            output.put(e.getKey().getURL().toExternalForm(), resourcesRepr);
 131.259 -        }
 131.260 -
 131.261 -        Map<String, Iterable<String>> golden = new HashMap<String, Iterable<String>>();
 131.262 -
 131.263 -        golden.put(data.getURL().toExternalForm(), new HashSet<String>(Arrays.asList("src1/test/Test1.java", "src2/test/Test1.java")));
 131.264 -
 131.265 -        assertEquals(golden, output);
 131.266 -
 131.267 -        //check verification:
 131.268 -        final Set<FileObject> added = new HashSet<FileObject>();
 131.269 -        final Set<FileObject> removed = new HashSet<FileObject>();
 131.270 -
 131.271 -        GlobalPathRegistry.getDefault().addGlobalPathRegistryListener(new GlobalPathRegistryListener() {
 131.272 -            public void pathsAdded(GlobalPathRegistryEvent event) {
 131.273 -                for (ClassPath cp : event.getChangedPaths()) {
 131.274 -                    added.addAll(Arrays.asList(cp.getRoots()));
 131.275 -                }
 131.276 -            }
 131.277 -            public void pathsRemoved(GlobalPathRegistryEvent event) {
 131.278 -                for (ClassPath cp : event.getChangedPaths()) {
 131.279 -                    removed.addAll(Arrays.asList(cp.getRoots()));
 131.280 -                }
 131.281 -            }
 131.282 -        });
 131.283 -
 131.284 -//        verifiedGolden.put(data.getURL().toExternalForm(), Arrays.asList("0:75-0:86:verifier:TODO: No display name"));
 131.285 -        Map<String, Map<String, Iterable<String>>> verifiedOutput = verifiedSpans(result, false);
 131.286 -        Map<String, Map<String, Iterable<String>>> verifiedGolden = new HashMap<String, Map<String, Iterable<String>>>();
 131.287 -
 131.288 -        Map<String, Iterable<String>> verifiedGoldenPart = new HashMap<String, Iterable<String>>();
 131.289 -
 131.290 -        verifiedGoldenPart.put("src1/test/Test1.java", Arrays.<String>asList());
 131.291 -        verifiedGoldenPart.put("src2/test/Test1.java", Arrays.<String>asList("0:75-0:86:verifier:"));
 131.292 -
 131.293 -        verifiedGolden.put(data.getURL().toExternalForm(), verifiedGoldenPart);
 131.294 -
 131.295 -        assertEquals(verifiedGolden, verifiedOutput);
 131.296 -        assertEquals(new HashSet<FileObject>(Arrays.asList(dataSrc1, dataSrc2)), added);
 131.297 -        assertEquals(new HashSet<FileObject>(Arrays.asList(dataSrc1, dataSrc2)), removed);
 131.298 -    }
 131.299 -
 131.300 -    public void testBatchSearchFolderNoIndex() throws Exception {
 131.301 -        FileObject data = FileUtil.createFolder(workdir, "data");
 131.302 -        FileObject dataSrc1 = FileUtil.createFolder(data, "src1");
 131.303 -        FileObject dataSrc2 = FileUtil.createFolder(data, "src2");
 131.304 -        writeFilesAndWaitForScan(dataSrc1,
 131.305 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { java.io.File f = null; f.isDirectory(); } }"),
 131.306 -                                 new File("test/Test2.java", "package test; public class Test2 { private void test() { new javax.swing.ImageIcon(null); } }"));
 131.307 -        writeFilesAndWaitForScan(dataSrc2,
 131.308 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { Test2 f = null; f.isDirectory(); } }"),
 131.309 -                                 new File("test/Test2.java", "package test; public class Test2 { public boolean isDirectory() {return false} }"));
 131.310 -
 131.311 -        Iterable<? extends HintDescription> hints = prepareHints("$1.isDirectory()");
 131.312 -        BatchResult result = BatchSearch.findOccurrences(hints, Scopes.specifiedFoldersScope(Folder.convert(Collections.singleton(data)))); //XXX: should be a no-index variant!
 131.313 -        Map<String, Iterable<String>> output = toDebugOutput(result);
 131.314 -        Map<String, Iterable<String>> golden = new HashMap<String, Iterable<String>>();
 131.315 -
 131.316 -        golden.put(data.getURL().toExternalForm(), new HashSet<String>(Arrays.asList("src1/test/Test1.java", "src2/test/Test1.java")));
 131.317 -
 131.318 -        assertEquals(golden, output);
 131.319 -    }
 131.320 -
 131.321 -    private FileObject workdir;
 131.322 -    private FileObject src1;
 131.323 -    private FileObject src2;
 131.324 -    private FileObject src3;
 131.325 -    private FileObject empty;
 131.326 -    private ClassPath sourceCP;
 131.327 -
 131.328 -    private void prepareTest() throws Exception {
 131.329 -        workdir = SourceUtilsTestUtil.makeScratchDir(this);
 131.330 -
 131.331 -        src1 = FileUtil.createFolder(workdir, "src1");
 131.332 -        src2 = FileUtil.createFolder(workdir, "src2");
 131.333 -        src3 = FileUtil.createFolder(workdir, "src3");
 131.334 -        empty = FileUtil.createFolder(workdir, "empty");
 131.335 -
 131.336 -        ClassPathProviderImpl.setSourceRoots(Arrays.asList(src1, src2, src3));
 131.337 -
 131.338 -        FileObject cache = FileUtil.createFolder(workdir, "cache");
 131.339 -
 131.340 -        CacheFolder.setCacheFolder(cache);
 131.341 -    }
 131.342 -
 131.343 -    private Map<String, Iterable<String>> toDebugOutput(BatchResult result) throws Exception {
 131.344 -        Map<String, Iterable<String>> output = new HashMap<String, Iterable<String>>();
 131.345 -
 131.346 -        for (Entry<FileObject, Collection<? extends Resource>> e : result.getResourcesWithRoots().entrySet()) {
 131.347 -            Collection<String> resourcesRepr = new HashSet<String>();
 131.348 -
 131.349 -            for (Resource r : e.getValue()) {
 131.350 -                resourcesRepr.add(r.getRelativePath());
 131.351 -            }
 131.352 -
 131.353 -            output.put(e.getKey().getURL().toExternalForm(), resourcesRepr);
 131.354 -        }
 131.355 -
 131.356 -        return output;
 131.357 -    }
 131.358 -
 131.359 -    private Map<String, Map<String, Iterable<String>>> verifiedSpans(BatchResult candidates, boolean doNotRegisterClassPath) throws Exception {
 131.360 -        final Map<String, Map<String, Iterable<String>>> result = new HashMap<String, Map<String, Iterable<String>>>();
 131.361 -        List<MessageImpl> errors = new LinkedList<MessageImpl>();
 131.362 -        BatchSearch.getVerifiedSpans(candidates, new ProgressHandleWrapper(1), new BatchSearch.VerifiedSpansCallBack() {
 131.363 -            public void groupStarted() {}
 131.364 -            public boolean spansVerified(CompilationController wc, Resource r, Collection<? extends ErrorDescription> hints) throws Exception {
 131.365 -                Map<String, Iterable<String>> files = result.get(r.getRoot().getURL().toExternalForm());
 131.366 -
 131.367 -                if (files == null) {
 131.368 -                    result.put(r.getRoot().getURL().toExternalForm(), files = new HashMap<String, Iterable<String>>());
 131.369 -                }
 131.370 -
 131.371 -                Collection<String> currentHints = new LinkedList<String>();
 131.372 -
 131.373 -                for (ErrorDescription ed : hints) {
 131.374 -                    currentHints.add(ed.toString());
 131.375 -                }
 131.376 -
 131.377 -                files.put(r.getRelativePath(), currentHints);
 131.378 -
 131.379 -                return true;
 131.380 -            }
 131.381 -            public void groupFinished() {}
 131.382 -            public void cannotVerifySpan(Resource r) {
 131.383 -                fail("Cannot verify: " +r.getRelativePath());
 131.384 -            }
 131.385 -        }, doNotRegisterClassPath, errors, new AtomicBoolean());
 131.386 -
 131.387 -        return result;
 131.388 -    }
 131.389 -
 131.390 -    @ServiceProvider(service=ClassPathProvider.class)
 131.391 -    public static final class ClassPathProviderImpl implements ClassPathProvider {
 131.392 -
 131.393 -        private static Collection<FileObject> sourceRoots;
 131.394 -
 131.395 -        public synchronized static void setSourceRoots(Collection<FileObject> sourceRoots) {
 131.396 -            ClassPathProviderImpl.sourceRoots = sourceRoots;
 131.397 -        }
 131.398 -
 131.399 -        public synchronized static Collection<FileObject> getSourceRoots() {
 131.400 -            return sourceRoots;
 131.401 -        }
 131.402 -
 131.403 -        public synchronized ClassPath findClassPath(FileObject file, String type) {
 131.404 -            if (ClassPath.BOOT.equals(type)) {
 131.405 -                return ClassPathSupport.createClassPath(getBootClassPath().toArray(new URL[0]));
 131.406 -            }
 131.407 -
 131.408 -            if (ClassPath.COMPILE.equals(type)) {
 131.409 -                return ClassPathSupport.createClassPath(new URL[0]);
 131.410 -            }
 131.411 -
 131.412 -            if (ClassPath.SOURCE.equals(type) && sourceRoots != null) {
 131.413 -                for (FileObject sr : sourceRoots) {
 131.414 -                    if (file.equals(sr) || FileUtil.isParentOf(sr, file)) {
 131.415 -                        return ClassPathSupport.createClassPath(sr);
 131.416 -                    }
 131.417 -                }
 131.418 -            }
 131.419 -
 131.420 -            return null;
 131.421 -        }
 131.422 -
 131.423 -    }
 131.424 -
 131.425 -    //TODO: copied from SourceUtilsTestUtil:
 131.426 -    private static List<URL> bootClassPath;
 131.427 -
 131.428 -    public static synchronized List<URL> getBootClassPath() {
 131.429 -        if (bootClassPath == null) {
 131.430 -            try {
 131.431 -                String cp = System.getProperty("sun.boot.class.path");
 131.432 -                List<URL> urls = new ArrayList<URL>();
 131.433 -                String[] paths = cp.split(Pattern.quote(System.getProperty("path.separator")));
 131.434 -
 131.435 -                for (String path : paths) {
 131.436 -                    java.io.File f = new java.io.File(path);
 131.437 -
 131.438 -                    if (!f.canRead())
 131.439 -                        continue;
 131.440 -
 131.441 -                    FileObject fo = FileUtil.toFileObject(f);
 131.442 -
 131.443 -                    if (FileUtil.isArchiveFile(fo)) {
 131.444 -                        fo = FileUtil.getArchiveRoot(fo);
 131.445 -                    }
 131.446 -
 131.447 -                    if (fo != null) {
 131.448 -                        urls.add(fo.getURL());
 131.449 -                    }
 131.450 -                }
 131.451 -
 131.452 -                bootClassPath = urls;
 131.453 -            } catch (FileStateInvalidException e) {
 131.454 -                Exceptions.printStackTrace(e);
 131.455 -            }
 131.456 -        }
 131.457 -
 131.458 -        return bootClassPath;
 131.459 -    }
 131.460 -
 131.461 -}
   132.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchUtilitiesTest.java	Sun Jan 08 20:10:08 2017 +0100
   132.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   132.3 @@ -1,222 +0,0 @@
   132.4 -/*
   132.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   132.6 - *
   132.7 - * Copyright 2009-2011 Oracle and/or its affiliates. All rights reserved.
   132.8 - *
   132.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  132.10 - * Other names may be trademarks of their respective owners.
  132.11 - *
  132.12 - * The contents of this file are subject to the terms of either the GNU
  132.13 - * General Public License Version 2 only ("GPL") or the Common
  132.14 - * Development and Distribution License("CDDL") (collectively, the
  132.15 - * "License"). You may not use this file except in compliance with the
  132.16 - * License. You can obtain a copy of the License at
  132.17 - * http://www.netbeans.org/cddl-gplv2.html
  132.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  132.19 - * specific language governing permissions and limitations under the
  132.20 - * License.  When distributing the software, include this License Header
  132.21 - * Notice in each file and include the License file at
  132.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  132.23 - * particular file as subject to the "Classpath" exception as provided
  132.24 - * by Oracle in the GPL Version 2 section of the License file that
  132.25 - * accompanied this code. If applicable, add the following below the
  132.26 - * License Header, with the fields enclosed by brackets [] replaced by
  132.27 - * your own identifying information:
  132.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  132.29 - *
  132.30 - * If you wish your version of this file to be governed by only the CDDL
  132.31 - * or only the GPL Version 2, indicate your decision by adding
  132.32 - * "[Contributor] elects to include this software in this distribution
  132.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  132.34 - * single choice of license, a recipient has the option to distribute
  132.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  132.36 - * to extend the choice of license to its licensees as provided above.
  132.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  132.38 - * Version 2 license, then the option applies only if the new code is
  132.39 - * made subject to such option by the copyright holder.
  132.40 - *
  132.41 - * Contributor(s):
  132.42 - *
  132.43 - * Portions Copyrighted 2009-2011 Sun Microsystems, Inc.
  132.44 - */
  132.45 -package org.netbeans.modules.java.hints.spiimpl.batch;
  132.46 -
  132.47 -import org.netbeans.modules.java.hints.spiimpl.batch.TestUtils.File;
  132.48 -import org.netbeans.modules.java.hints.spiimpl.MessageImpl;
  132.49 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearchTest.ClassPathProviderImpl;
  132.50 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
  132.51 -import java.util.Arrays;
  132.52 -import java.util.Collection;
  132.53 -import java.util.Collections;
  132.54 -import java.util.HashMap;
  132.55 -import java.util.LinkedList;
  132.56 -import java.util.List;
  132.57 -import java.util.Map;
  132.58 -import java.util.concurrent.atomic.AtomicBoolean;
  132.59 -import org.netbeans.api.editor.mimelookup.MimePath;
  132.60 -import org.netbeans.api.java.classpath.ClassPath;
  132.61 -import org.netbeans.api.java.classpath.GlobalPathRegistry;
  132.62 -import org.netbeans.api.java.lexer.JavaTokenId;
  132.63 -import org.netbeans.api.java.source.ModificationResult;
  132.64 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  132.65 -import org.netbeans.api.java.source.TestUtilities;
  132.66 -import org.netbeans.api.lexer.InputAttributes;
  132.67 -import org.netbeans.api.lexer.Language;
  132.68 -import org.netbeans.api.lexer.LanguagePath;
  132.69 -import org.netbeans.api.lexer.Token;
  132.70 -import org.netbeans.core.startup.Main;
  132.71 -import org.netbeans.junit.NbTestCase;
  132.72 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.BatchResult;
  132.73 -import org.netbeans.modules.java.hints.spiimpl.batch.BatchSearch.Folder;
  132.74 -import org.netbeans.modules.java.source.parsing.JavacParser;
  132.75 -import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
  132.76 -import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
  132.77 -import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
  132.78 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
  132.79 -import org.netbeans.spi.lexer.LanguageEmbedding;
  132.80 -import org.netbeans.spi.lexer.LanguageProvider;
  132.81 -import org.openide.LifecycleManager;
  132.82 -import org.openide.filesystems.FileObject;
  132.83 -import org.openide.filesystems.FileUtil;
  132.84 -
  132.85 -import org.openide.loaders.DataObject;
  132.86 -import org.openide.util.Lookup;
  132.87 -import org.openide.util.lookup.Lookups;
  132.88 -import org.openide.util.lookup.ServiceProvider;
  132.89 -import static org.netbeans.modules.java.hints.spiimpl.batch.TestUtils.writeFilesAndWaitForScan;
  132.90 -import static org.netbeans.modules.java.hints.spiimpl.batch.TestUtils.prepareHints;
  132.91 -import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
  132.92 -
  132.93 -/**
  132.94 - *
  132.95 - * @author lahvac
  132.96 - */
  132.97 -public class BatchUtilitiesTest extends NbTestCase {
  132.98 -
  132.99 -    public BatchUtilitiesTest(String name) {
 132.100 -        super(name);
 132.101 -    }
 132.102 -
 132.103 -    //XXX: copied from CustomIndexerImplTest:
 132.104 -    @Override
 132.105 -    protected void setUp() throws Exception {
 132.106 -        SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/source/resources/layer.xml", "org/netbeans/lib/java/lexer/layer.xml"}, new Object[0]);
 132.107 -        Main.initializeURLFactory();
 132.108 -        org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
 132.109 -        prepareTest();
 132.110 -        MimeTypes.setAllMimeTypes(Collections.singleton("text/x-java"));
 132.111 -        GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {ClassPathSupport.createClassPath(src1, src2)});
 132.112 -        RepositoryUpdater.getDefault().start(true);
 132.113 -        super.setUp();
 132.114 -    }
 132.115 -
 132.116 -    public void testBatchSearchNotIndexed() throws Exception {
 132.117 -        writeFilesAndWaitForScan(src1,
 132.118 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { java.io.File f = null; f.isDirectory(); } }"),
 132.119 -                                 new File("test/Test2.java", "package test; public class Test2 { private void test() { new javax.swing.ImageIcon(null); } }"));
 132.120 -        writeFilesAndWaitForScan(src3,
 132.121 -                                 new File("test/Test1.java", "package test; public class Test1 { private void test() { java.io.File f = null; f.isDirectory(); } }"),
 132.122 -                                 new File("test/Test2.java", "package test; public class Test2 { public boolean isDirectory() {return false} }"));
 132.123 -
 132.124 -        Iterable<? extends HintDescription> hints = prepareHints("$1.isDirectory() => !$1.isFile()", "$1", "java.io.File");
 132.125 -        BatchResult result = BatchSearch.findOccurrences(hints, Scopes.specifiedFoldersScope(Folder.convert(src1, src3, empty)));
 132.126 -        List<MessageImpl> problems = new LinkedList<MessageImpl>();
 132.127 -        Collection<? extends ModificationResult> changes = BatchUtilities.applyFixes(result, new ProgressHandleWrapper(100), new AtomicBoolean(), problems);
 132.128 -
 132.129 -        assertTrue(problems.toString(), problems.isEmpty());
 132.130 -
 132.131 -        Map<FileObject, String> file2New = new HashMap<FileObject, String>();
 132.132 -
 132.133 -        for (ModificationResult mr : changes) {
 132.134 -            for (FileObject file : mr.getModifiedFileObjects()) {
 132.135 -                assertNull(file2New.put(file, mr.getResultingSource(file)));
 132.136 -            }
 132.137 -        }
 132.138 -
 132.139 -        FileObject src1Test1 = src1.getFileObject("test/Test1.java");
 132.140 -        String src1Test1Real = file2New.remove(src1Test1);
 132.141 -        String src1Test1Golden = "package test; public class Test1 { private void test() { java.io.File f = null; !f.isFile(); } }";
 132.142 -
 132.143 -        assertEquals(src1Test1Golden, src1Test1Real);
 132.144 -
 132.145 -        FileObject src3Test1 = src3.getFileObject("test/Test1.java");
 132.146 -        String src3Test1Real = file2New.remove(src3Test1);
 132.147 -        String src3Test1Golden = "package test; public class Test1 { private void test() { java.io.File f = null; !f.isFile(); } }";
 132.148 -
 132.149 -        assertEquals(src3Test1Golden, src3Test1Real);
 132.150 -
 132.151 -        assertTrue(file2New.toString(), file2New.isEmpty());
 132.152 -    }
 132.153 -
 132.154 -//    public void testRemoveUnusedImports() throws Exception {
 132.155 -//        writeFilesAndWaitForScan(src1,
 132.156 -//                                 new File("test/Test1.java", "package test;\n import java.util.List;\n public class Test1 { }"));
 132.157 -//        writeFilesAndWaitForScan(src2,
 132.158 -//                                 new File("test/Test2.java", "package test;\n import java.util.LinkedList;\n public class Test2 { }"));
 132.159 -//
 132.160 -//        FileObject test1 = src1.getFileObject("test/Test1.java");
 132.161 -//        FileObject test2 = src2.getFileObject("test/Test2.java");
 132.162 -//
 132.163 -//        System.err.println(DataObject.find(test1).getClass());
 132.164 -//        BatchUtilities.removeUnusedImports(Arrays.asList(test1, test2));
 132.165 -//
 132.166 -//        LifecycleManager.getDefault().saveAll();
 132.167 -//
 132.168 -//        assertEquals("package test;\n public class Test1 { }", TestUtilities.copyFileToString(FileUtil.toFile(test1)));
 132.169 -//        assertEquals("package test;\n public class Test2 { }", TestUtilities.copyFileToString(FileUtil.toFile(test2)));
 132.170 -//    }
 132.171 -
 132.172 -    private FileObject src1;
 132.173 -    private FileObject src2;
 132.174 -    private FileObject src3;
 132.175 -    private FileObject empty;
 132.176 -
 132.177 -    private void prepareTest() throws Exception {
 132.178 -        FileObject workdir = SourceUtilsTestUtil.makeScratchDir(this);
 132.179 -
 132.180 -        src1 = FileUtil.createFolder(workdir, "src1");
 132.181 -        src2 = FileUtil.createFolder(workdir, "src2");
 132.182 -        src3 = FileUtil.createFolder(workdir, "src3");
 132.183 -        empty = FileUtil.createFolder(workdir, "empty");
 132.184 -
 132.185 -        ClassPathProviderImpl.setSourceRoots(Arrays.asList(src1, src2, src3));
 132.186 -
 132.187 -        FileObject cache = FileUtil.createFolder(workdir, "cache");
 132.188 -
 132.189 -        CacheFolder.setCacheFolder(cache);
 132.190 -    }
 132.191 -
 132.192 -    @ServiceProvider(service=MimeDataProvider.class)
 132.193 -    public static final class JavaLexerProvider implements MimeDataProvider {
 132.194 -
 132.195 -        private Lookup javaLookup = Lookups.fixed(JavaTokenId.language());
 132.196 -
 132.197 -        public Lookup getLookup(MimePath mimePath) {
 132.198 -            if (mimePath.getPath().endsWith(JavacParser.MIME_TYPE)) {
 132.199 -                return javaLookup;
 132.200 -            }
 132.201 -
 132.202 -            return Lookup.EMPTY;
 132.203 -        }
 132.204 -
 132.205 -    }
 132.206 -
 132.207 -    @ServiceProvider(service=LanguageProvider.class)
 132.208 -    public static final class JavaLanguageProvider extends LanguageProvider {
 132.209 -
 132.210 -        @Override
 132.211 -        public Language<?> findLanguage(String mimeType) {
 132.212 -            if ("text/x-java".equals(mimeType)) {
 132.213 -                return JavaTokenId.language();
 132.214 -            }
 132.215 -
 132.216 -            return null;
 132.217 -        }
 132.218 -
 132.219 -        @Override
 132.220 -        public LanguageEmbedding<?> findLanguageEmbedding(Token<?> token, LanguagePath languagePath, InputAttributes inputAttributes) {
 132.221 -            return null;
 132.222 -        }
 132.223 -
 132.224 -    }
 132.225 -}
   133.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/batch/ProgressHandleWrapperTest.java	Sun Jan 08 20:10:08 2017 +0100
   133.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   133.3 @@ -1,66 +0,0 @@
   133.4 -/*
   133.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   133.6 - *
   133.7 - * Copyright 2009-2011 Oracle and/or its affiliates. All rights reserved.
   133.8 - *
   133.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  133.10 - * Other names may be trademarks of their respective owners.
  133.11 - *
  133.12 - * The contents of this file are subject to the terms of either the GNU
  133.13 - * General Public License Version 2 only ("GPL") or the Common
  133.14 - * Development and Distribution License("CDDL") (collectively, the
  133.15 - * "License"). You may not use this file except in compliance with the
  133.16 - * License. You can obtain a copy of the License at
  133.17 - * http://www.netbeans.org/cddl-gplv2.html
  133.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  133.19 - * specific language governing permissions and limitations under the
  133.20 - * License.  When distributing the software, include this License Header
  133.21 - * Notice in each file and include the License file at
  133.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  133.23 - * particular file as subject to the "Classpath" exception as provided
  133.24 - * by Oracle in the GPL Version 2 section of the License file that
  133.25 - * accompanied this code. If applicable, add the following below the
  133.26 - * License Header, with the fields enclosed by brackets [] replaced by
  133.27 - * your own identifying information:
  133.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  133.29 - *
  133.30 - * If you wish your version of this file to be governed by only the CDDL
  133.31 - * or only the GPL Version 2, indicate your decision by adding
  133.32 - * "[Contributor] elects to include this software in this distribution
  133.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  133.34 - * single choice of license, a recipient has the option to distribute
  133.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  133.36 - * to extend the choice of license to its licensees as provided above.
  133.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  133.38 - * Version 2 license, then the option applies only if the new code is
  133.39 - * made subject to such option by the copyright holder.
  133.40 - *
  133.41 - * Contributor(s):
  133.42 - *
  133.43 - * Portions Copyrighted 2009-2011 Sun Microsystems, Inc.
  133.44 - */
  133.45 -package org.netbeans.modules.java.hints.spiimpl.batch;
  133.46 -
  133.47 -import org.netbeans.junit.NbTestCase;
  133.48 -
  133.49 -/**
  133.50 - *
  133.51 - * @author lahvac
  133.52 - */
  133.53 -public class ProgressHandleWrapperTest extends NbTestCase {
  133.54 -
  133.55 -    public ProgressHandleWrapperTest(String name) {
  133.56 -        super(name);
  133.57 -    }
  133.58 -
  133.59 -    public void testNoProgress() {
  133.60 -        ProgressHandleWrapper w = new ProgressHandleWrapper(new ProgressHandleWrapper.ProgressHandleAbstraction() {
  133.61 -            public void start(int totalWork) {}
  133.62 -            public void progress(int currentWorkDone) {}
  133.63 -            public void progress(String message) {}
  133.64 -            public void finish() {}
  133.65 -        }, 1);
  133.66 -        
  133.67 -        w.finish();
  133.68 -    }
  133.69 -}
   134.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/batch/TestUtils.java	Sun Jan 08 20:10:08 2017 +0100
   134.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   134.3 @@ -1,135 +0,0 @@
   134.4 -/*
   134.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   134.6 - *
   134.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
   134.8 - *
   134.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  134.10 - * Other names may be trademarks of their respective owners.
  134.11 - *
  134.12 - * The contents of this file are subject to the terms of either the GNU
  134.13 - * General Public License Version 2 only ("GPL") or the Common
  134.14 - * Development and Distribution License("CDDL") (collectively, the
  134.15 - * "License"). You may not use this file except in compliance with the
  134.16 - * License. You can obtain a copy of the License at
  134.17 - * http://www.netbeans.org/cddl-gplv2.html
  134.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  134.19 - * specific language governing permissions and limitations under the
  134.20 - * License.  When distributing the software, include this License Header
  134.21 - * Notice in each file and include the License file at
  134.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  134.23 - * particular file as subject to the "Classpath" exception as provided
  134.24 - * by Oracle in the GPL Version 2 section of the License file that
  134.25 - * accompanied this code. If applicable, add the following below the
  134.26 - * License Header, with the fields enclosed by brackets [] replaced by
  134.27 - * your own identifying information:
  134.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  134.29 - *
  134.30 - * If you wish your version of this file to be governed by only the CDDL
  134.31 - * or only the GPL Version 2, indicate your decision by adding
  134.32 - * "[Contributor] elects to include this software in this distribution
  134.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  134.34 - * single choice of license, a recipient has the option to distribute
  134.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  134.36 - * to extend the choice of license to its licensees as provided above.
  134.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  134.38 - * Version 2 license, then the option applies only if the new code is
  134.39 - * made subject to such option by the copyright holder.
  134.40 - *
  134.41 - * Contributor(s):
  134.42 - *
  134.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
  134.44 - */
  134.45 -package org.netbeans.modules.java.hints.spiimpl.batch;
  134.46 -
  134.47 -import java.util.Collection;
  134.48 -import java.util.Collections;
  134.49 -import org.netbeans.spi.java.hints.HintContext;
  134.50 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.Worker;
  134.51 -import org.netbeans.modules.java.hints.providers.spi.Trigger.PatternDescription;
  134.52 -import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
  134.53 -import org.netbeans.spi.editor.hints.ErrorDescription;
  134.54 -import org.netbeans.modules.java.hints.providers.spi.HintDescriptionFactory;
  134.55 -import java.util.HashMap;
  134.56 -import java.util.Map;
  134.57 -import org.netbeans.api.java.source.SourceUtils;
  134.58 -import org.netbeans.api.java.source.TestUtilities;
  134.59 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
  134.60 -import org.openide.filesystems.FileObject;
  134.61 -import org.openide.filesystems.FileUtil;
  134.62 -
  134.63 -import static org.junit.Assert.*;
  134.64 -import org.netbeans.spi.java.hints.JavaFixUtilities;
  134.65 -
  134.66 -/**
  134.67 - *
  134.68 - * @author lahvac
  134.69 - */
  134.70 -public class TestUtils {
  134.71 -
  134.72 -    public static void writeFiles(FileObject sourceRoot, File... files) throws Exception {
  134.73 -        for (FileObject c : sourceRoot.getChildren()) {
  134.74 -            c.delete();
  134.75 -        }
  134.76 -
  134.77 -        for (File f : files) {
  134.78 -            FileObject fo = FileUtil.createData(sourceRoot, f.filename);
  134.79 -            TestUtilities.copyStringToFile(fo, f.content);
  134.80 -        }
  134.81 -    }
  134.82 -
  134.83 -    public static void writeFilesAndWaitForScan(FileObject sourceRoot, File... files) throws Exception {
  134.84 -        writeFiles(sourceRoot, files);
  134.85 -        SourceUtils.waitScanFinished();
  134.86 -    }
  134.87 -    
  134.88 -    public static final class File {
  134.89 -        public final String filename;
  134.90 -        public final String content;
  134.91 -        public final boolean index;
  134.92 -
  134.93 -        public File(String filename, String content) {
  134.94 -            this(filename, content, true);
  134.95 -        }
  134.96 -
  134.97 -        public File(String filename, String content, boolean index) {
  134.98 -            this.filename = filename;
  134.99 -            this.content = content;
 134.100 -            this.index = index;
 134.101 -        }
 134.102 -    }
 134.103 -
 134.104 -    public static Iterable<? extends HintDescription> prepareHints(String rule, String... constraints) {
 134.105 -        final String[] split = rule.split("=>");
 134.106 -
 134.107 -        Worker w;
 134.108 -
 134.109 -        if (split.length == 2) {
 134.110 -            w = new HintDescription.Worker() {
 134.111 -                @Override public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
 134.112 -                    return Collections.singletonList(ErrorDescriptionFactory.forName(ctx, ctx.getPath(), "", JavaFixUtilities.rewriteFix(ctx, "", ctx.getPath(), split[1])));
 134.113 -                }
 134.114 -            };
 134.115 -        } else {
 134.116 -            w = new HintDescription.Worker() {
 134.117 -                @Override public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
 134.118 -                    return Collections.singletonList(ErrorDescriptionFactory.forName(ctx, ctx.getPath(), ""));
 134.119 -                }
 134.120 -            };
 134.121 -        }
 134.122 -
 134.123 -        assertTrue(constraints.length % 2 == 0);
 134.124 -
 134.125 -        Map<String, String> constr = new HashMap<String, String>();
 134.126 -
 134.127 -        for (int i = 0; i < constraints.length; i += 2) {
 134.128 -            constr.put(constraints[i], constraints[i + 1]);
 134.129 -        }
 134.130 -
 134.131 -        HintDescription hd = HintDescriptionFactory.create()
 134.132 -                                                   .setTrigger(PatternDescription.create(split[0], constr))
 134.133 -                                                   .setWorker(w)
 134.134 -                                                   .produce();
 134.135 -
 134.136 -        return Collections.singletonList(hd);
 134.137 -    }
 134.138 -}
   135.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/hints/HintsInvokerTest.java	Sun Jan 08 20:10:08 2017 +0100
   135.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   135.3 @@ -1,895 +0,0 @@
   135.4 -/*
   135.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   135.6 - *
   135.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
   135.8 - *
   135.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  135.10 - * Other names may be trademarks of their respective owners.
  135.11 - *
  135.12 - * The contents of this file are subject to the terms of either the GNU
  135.13 - * General Public License Version 2 only ("GPL") or the Common
  135.14 - * Development and Distribution License("CDDL") (collectively, the
  135.15 - * "License"). You may not use this file except in compliance with the
  135.16 - * License. You can obtain a copy of the License at
  135.17 - * http://www.netbeans.org/cddl-gplv2.html
  135.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  135.19 - * specific language governing permissions and limitations under the
  135.20 - * License.  When distributing the software, include this License Header
  135.21 - * Notice in each file and include the License file at
  135.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  135.23 - * particular file as subject to the "Classpath" exception as provided
  135.24 - * by Oracle in the GPL Version 2 section of the License file that
  135.25 - * accompanied this code. If applicable, add the following below the
  135.26 - * License Header, with the fields enclosed by brackets [] replaced by
  135.27 - * your own identifying information:
  135.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  135.29 - *
  135.30 - * If you wish your version of this file to be governed by only the CDDL
  135.31 - * or only the GPL Version 2, indicate your decision by adding
  135.32 - * "[Contributor] elects to include this software in this distribution
  135.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  135.34 - * single choice of license, a recipient has the option to distribute
  135.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  135.36 - * to extend the choice of license to its licensees as provided above.
  135.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  135.38 - * Version 2 license, then the option applies only if the new code is
  135.39 - * made subject to such option by the copyright holder.
  135.40 - *
  135.41 - * Contributor(s):
  135.42 - *
  135.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  135.44 - */
  135.45 -
  135.46 -package org.netbeans.modules.java.hints.spiimpl.hints;
  135.47 -
  135.48 -import com.sun.source.tree.Tree.Kind;
  135.49 -import com.sun.source.util.TreePath;
  135.50 -import java.util.Arrays;
  135.51 -import java.util.Collection;
  135.52 -import java.util.Collections;
  135.53 -import java.util.EnumSet;
  135.54 -import java.util.HashMap;
  135.55 -import java.util.LinkedList;
  135.56 -import java.util.List;
  135.57 -import java.util.Map;
  135.58 -import java.util.concurrent.atomic.AtomicBoolean;
  135.59 -import javax.swing.text.Document;
  135.60 -import static org.junit.Assert.*;
  135.61 -import org.netbeans.api.java.source.CompilationInfo;
  135.62 -import org.netbeans.modules.java.hints.spiimpl.TestBase;
  135.63 -import org.netbeans.spi.java.hints.HintContext;
  135.64 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
  135.65 -import org.netbeans.modules.java.hints.providers.spi.HintDescription.Worker;
  135.66 -import org.netbeans.modules.java.hints.providers.spi.HintDescriptionFactory;
  135.67 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
  135.68 -import org.netbeans.modules.java.hints.providers.spi.HintMetadata.Options;
  135.69 -import org.netbeans.modules.java.hints.providers.spi.Trigger.Kinds;
  135.70 -import org.netbeans.modules.java.hints.providers.spi.Trigger.PatternDescription;
  135.71 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
  135.72 -import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
  135.73 -import org.netbeans.spi.editor.hints.ErrorDescription;
  135.74 -import org.netbeans.spi.editor.hints.Fix;
  135.75 -import org.netbeans.spi.java.hints.JavaFixUtilities;
  135.76 -import org.openide.LifecycleManager;
  135.77 -import org.openide.cookies.EditorCookie;
  135.78 -import org.openide.filesystems.FileObject;
  135.79 -import org.openide.loaders.DataObject;
  135.80 -
  135.81 -/**
  135.82 - *
  135.83 - * @author user
  135.84 - */
  135.85 -public class HintsInvokerTest extends TestBase {
  135.86 -
  135.87 -    public HintsInvokerTest(String name) {
  135.88 -        super(name);
  135.89 -    }
  135.90 -
  135.91 -//    public static TestSuite suite() {
  135.92 -//        NbTestSuite r = new NbTestSuite();
  135.93 -//        r.addTest(new HintsInvokerTest("testPatternVariable1"));
  135.94 -//        return r;
  135.95 -//    }
  135.96 -
  135.97 -    public void testPattern1() throws Exception {
  135.98 -        performAnalysisTest("test/Test.java",
  135.99 -                            "|package test;\n" +
 135.100 -                            "import java.io.File;\n" +
 135.101 -                            "public class Test {\n" +
 135.102 -                            "     private void test(File f) {\n" +
 135.103 -                            "         f.toURL();\n" +
 135.104 -                            "     }\n" +
 135.105 -                            "}\n",
 135.106 -                            "4:11-4:16:verifier:HINT");
 135.107 -    }
 135.108 -
 135.109 -    public void testPattern2() throws Exception {
 135.110 -        performAnalysisTest("test/Test.java",
 135.111 -                            "|package test;\n" +
 135.112 -                            "\n" +
 135.113 -                            "public class Test {\n" +
 135.114 -                            "     private void test(java.io.File f) {\n" +
 135.115 -                            "         f.toURL();\n" +
 135.116 -                            "     }\n" +
 135.117 -                            "}\n",
 135.118 -                            "4:11-4:16:verifier:HINT");
 135.119 -    }
 135.120 -
 135.121 -    public void testKind1() throws Exception {
 135.122 -        performAnalysisTest("test/Test.java",
 135.123 -                            "|package test;\n" +
 135.124 -                            "\n" +
 135.125 -                            "public class Test {\n" +
 135.126 -                            "     private void test(java.io.File f) {\n" +
 135.127 -                            "         f.toURL();\n" +
 135.128 -                            "     }\n" +
 135.129 -                            "}\n",
 135.130 -                            "4:11-4:16:verifier:HINT");
 135.131 -    }
 135.132 -
 135.133 -    public void DISABLEDtestPatternVariable1() throws Exception {
 135.134 -        performFixTest("test/Test.java",
 135.135 -                       "|package test;\n" +
 135.136 -                       "\n" +
 135.137 -                       "public class Test {\n" +
 135.138 -                       "     private void test() {\n" +
 135.139 -                       "         {\n" +
 135.140 -                       "             int y;\n" +
 135.141 -                       "             y = 1;\n" +
 135.142 -                       "         }\n" +
 135.143 -                       "         int z;\n" +
 135.144 -                       "         {\n" +
 135.145 -                       "             int y;\n" +
 135.146 -                       "             z = 1;\n" +
 135.147 -                       "         }\n" +
 135.148 -                       "     }\n" +
 135.149 -                       "}\n",
 135.150 -                       "4:9-7:10:verifier:HINT",
 135.151 -                       "FixImpl",
 135.152 -                       "package test; public class Test { private void test() { { int y = 1; } int z; { int y; z = 1; } } } ");
 135.153 -    }
 135.154 -
 135.155 -    public void testPatternAssert1() throws Exception {
 135.156 -        performAnalysisTest("test/Test.java",
 135.157 -                            "|package test;\n" +
 135.158 -                            "\n" +
 135.159 -                            "public class Test {\n" +
 135.160 -                            "     private void test() {\n" +
 135.161 -                            "         assert true : \"\";\n" +
 135.162 -                            "     }\n" +
 135.163 -                            "}\n",
 135.164 -                            "4:9-4:15:verifier:HINT");
 135.165 -    }
 135.166 -
 135.167 -    public void testPatternStatementAndSingleStatementBlockAreSame() throws Exception {
 135.168 -        performAnalysisTest("test/Test.java",
 135.169 -                            "|package test;\n" +
 135.170 -                            "\n" +
 135.171 -                            "public class Test {\n" +
 135.172 -                            "     private int test() {\n" +
 135.173 -                            "         if (true) {\n" +
 135.174 -                            "             return 0;\n" +
 135.175 -                            "         }\n" +
 135.176 -                            "     }\n" +
 135.177 -                            "}\n",
 135.178 -                            "4:9-4:11:verifier:HINT");
 135.179 -    }
 135.180 -
 135.181 -    public void testPatternFalseOccurrence() throws Exception {
 135.182 -        performAnalysisTest("test/Test.java",
 135.183 -                            "|package test;\n" +
 135.184 -                            "\n" +
 135.185 -                            "public class Test {\n" +
 135.186 -                            "     private int test(java.io.File f) {\n" +
 135.187 -                            "         f.toURI().toURL();\n" +
 135.188 -                            "     }\n" +
 135.189 -                            "}\n");
 135.190 -    }
 135.191 -
 135.192 -    public void testStatementVariables1() throws Exception {
 135.193 -        performFixTest("test/Test.java",
 135.194 -                       "|package test;\n" +
 135.195 -                       "\n" +
 135.196 -                       "public class Test {\n" +
 135.197 -                       "     private int test(java.io.File f) {\n" +
 135.198 -                       "         if (true)\n" +
 135.199 -                       "             System.err.println(1);\n" +
 135.200 -                       "         else\n" +
 135.201 -                       "             System.err.println(2);\n" +
 135.202 -                       "     }\n" +
 135.203 -                       "}\n",
 135.204 -                       "4:9-4:11:verifier:HINT",
 135.205 -                       "FixImpl",
 135.206 -                       ("package test;\n" +
 135.207 -                       "\n" +
 135.208 -                       "public class Test {\n" +
 135.209 -                       "     private int test(java.io.File f) {\n" +
 135.210 -                       "         if (false)\n" +
 135.211 -                       "             System.err.println(2);\n" +
 135.212 -                       "         else\n" +
 135.213 -                       "             System.err.println(1);\n" +
 135.214 -                       "     }\n" +
 135.215 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.216 -    }
 135.217 -
 135.218 -    public void testStatementVariables2() throws Exception {
 135.219 -        performFixTest("test/Test.java",
 135.220 -                       "|package test;\n" +
 135.221 -                       "\n" +
 135.222 -                       "public class Test {\n" +
 135.223 -                       "     private int test(java.io.File f) {\n" +
 135.224 -                       "         if (true)\n" +
 135.225 -                       "             return 1;\n" +
 135.226 -                       "         else\n" +
 135.227 -                       "             return 2;\n" +
 135.228 -                       "     }\n" +
 135.229 -                       "}\n",
 135.230 -                       "4:9-4:11:verifier:HINT",
 135.231 -                       "FixImpl",
 135.232 -                       ("package test;\n" +
 135.233 -                       "\n" +
 135.234 -                       "public class Test {\n" +
 135.235 -                       "     private int test(java.io.File f) {\n" +
 135.236 -                       "         if (false)\n" +
 135.237 -                       "             return 2;\n" +
 135.238 -                       "         else\n" +
 135.239 -                       "             return 1;\n" +
 135.240 -                       "     }\n" +
 135.241 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.242 -    }
 135.243 -
 135.244 -    public void testMultiStatementVariables1() throws Exception {
 135.245 -        performFixTest("test/Test.java",
 135.246 -                       "|package test;\n" +
 135.247 -                       "\n" +
 135.248 -                       "public class Test {\n" +
 135.249 -                       "     private int test(int j) {\n" +
 135.250 -                       "         j++;\n" +
 135.251 -                       "         j++;\n" +
 135.252 -                       "         int i = 3;\n" +
 135.253 -                       "         j++;\n" +
 135.254 -                       "         j++;\n" +
 135.255 -                       "         return i;\n" +
 135.256 -                       "     }\n" +
 135.257 -                       "}\n",
 135.258 -                       "3:29-10:6:verifier:HINT",
 135.259 -                       "FixImpl",
 135.260 -                       ("package test;\n" +
 135.261 -                       "\n" +
 135.262 -                       "public class Test {\n" +
 135.263 -                       "     private int test(int j) {\n" +
 135.264 -                       "         j++;\n" +
 135.265 -                       "         j++;\n" +
 135.266 -                       "         float i = 3;\n" +
 135.267 -                       "         j++;\n" +
 135.268 -                       "         j++;\n" +
 135.269 -                       "         return i;\n" +
 135.270 -                       "     }\n" +
 135.271 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.272 -    }
 135.273 -
 135.274 -    public void testMultiStatementVariables2() throws Exception {
 135.275 -        performFixTest("test/Test.java",
 135.276 -                       "|package test;\n" +
 135.277 -                       "\n" +
 135.278 -                       "public class Test {\n" +
 135.279 -                       "     private int test(int j) {\n" +
 135.280 -                       "         int i = 3;\n" +
 135.281 -                       "         return i;\n" +
 135.282 -                       "     }\n" +
 135.283 -                       "}\n",
 135.284 -                       "3:29-6:6:verifier:HINT",
 135.285 -                       "FixImpl",
 135.286 -                       ("package test;\n" +
 135.287 -                       "\n" +
 135.288 -                       "public class Test {\n" +
 135.289 -                       "     private int test(int j) {\n" +
 135.290 -                       "         float i = 3;\n" +
 135.291 -                       "         return i;\n" +
 135.292 -                       "     }\n" +
 135.293 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.294 -    }
 135.295 -
 135.296 -    public void testMultiStatementVariables3() throws Exception {
 135.297 -        performFixTest("test/Test.java",
 135.298 -                       "|package test;\n" +
 135.299 -                       "\n" +
 135.300 -                       "public class Test {\n" +
 135.301 -                       "     private int test() {\n" +
 135.302 -                       "         System.err.println();\n" +
 135.303 -                       "         System.err.println();\n" +
 135.304 -                       "         int i = 3;\n" +
 135.305 -                       "         System.err.println(i);\n" +
 135.306 -                       "         System.err.println(i);\n" +
 135.307 -                       "         return i;\n" +
 135.308 -                       "     }\n" +
 135.309 -                       "}\n",
 135.310 -                       "3:24-10:6:verifier:HINT",
 135.311 -                       "FixImpl",
 135.312 -                       ("package test;\n" +
 135.313 -                       "\n" +
 135.314 -                       "public class Test {\n" +
 135.315 -                       "     private int test() {\n" +
 135.316 -                       "         System.err.println();\n" +
 135.317 -                       "         System.err.println();\n" +
 135.318 -                       "         float i = 3;\n" +
 135.319 -                       "         System.err.println(i);\n" +
 135.320 -                       "         System.err.println(i);\n" +
 135.321 -                       "         return i;\n" +
 135.322 -                       "     }\n" +
 135.323 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.324 -    }
 135.325 -
 135.326 -    public void testMultiStatementVariablesAndBlocks() throws Exception {
 135.327 -        performFixTest("test/Test.java",
 135.328 -                       "|package test;\n" +
 135.329 -                       "\n" +
 135.330 -                       "public class Test {\n" +
 135.331 -                       "     private void test() {" +
 135.332 -                       "         if (true)\n" +
 135.333 -                       "             System.err.println();\n" +
 135.334 -                       "     }\n" +
 135.335 -                       "}\n",
 135.336 -                       "3:35-3:37:verifier:HINT",
 135.337 -                       "FixImpl",
 135.338 -                       ("package test;\n" +
 135.339 -                       "\n" +
 135.340 -                       "public class Test {\n" +
 135.341 -                       "     private void test() {" +
 135.342 -                       "         if (false) {\n" +
 135.343 -                       "             System.err.println();\n" +
 135.344 -                       "         }\n" +
 135.345 -                       "     }\n" +
 135.346 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.347 -    }
 135.348 -
 135.349 -    public void testOneStatement2MultipleBlock() throws Exception {
 135.350 -        performFixTest("test/Test.java",
 135.351 -                       "|package test;\n" +
 135.352 -                       "\n" +
 135.353 -                       "public class Test {\n" +
 135.354 -                       "     private void test() {\n" +
 135.355 -                       "         System.err.println(\"\");\n" +
 135.356 -                       "     }\n" +
 135.357 -                       "}\n",
 135.358 -                       "4:9-4:32:verifier:HINT",
 135.359 -                       "FixImpl",
 135.360 -                       ("package test;\n" +
 135.361 -                       "\n" +
 135.362 -                       "public class Test {\n" +
 135.363 -                       "     private void test() {\n" +
 135.364 -                       "         System.err.println(\"\");\n" +
 135.365 -                       "         System.err.println(\"\");\n" +
 135.366 -                       "     }\n" +
 135.367 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.368 -    }
 135.369 -
 135.370 -    public void testOneStatement2MultipleStatement() throws Exception {
 135.371 -        performFixTest("test/Test.java",
 135.372 -                       "|package test;\n" +
 135.373 -                       "\n" +
 135.374 -                       "public class Test {\n" +
 135.375 -                       "     private void test() {\n" +
 135.376 -                       "         if (true)\n" +
 135.377 -                       "             System.err.println(\"\");\n" +
 135.378 -                       "     }\n" +
 135.379 -                       "}\n",
 135.380 -                       "5:13-5:36:verifier:HINT",
 135.381 -                       "FixImpl",
 135.382 -                       ("package test;\n" +
 135.383 -                       "\n" +
 135.384 -                       "public class Test {\n" +
 135.385 -                       "     private void test() {\n" +
 135.386 -                       "         if (true) {\n" +
 135.387 -                       "             System.err.println(\"\");\n" +
 135.388 -                       "             System.err.println(\"\");\n" +
 135.389 -                       "         }\n" +
 135.390 -                       "     }\n" +
 135.391 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.392 -    }
 135.393 -
 135.394 -    public void testMultiple2OneStatement1() throws Exception {
 135.395 -        performFixTest("test/Test.java",
 135.396 -                       "|package test;\n" +
 135.397 -                       "\n" +
 135.398 -                       "public class Test {\n" +
 135.399 -                       "     private void test() {\n" +
 135.400 -                       "         System.err.println(\"\");\n" +
 135.401 -                       "         System.err.println(\"\");\n" +
 135.402 -                       "     }\n" +
 135.403 -                       "}\n",
 135.404 -                       "4:9-4:32:verifier:HINT",
 135.405 -                       "FixImpl",
 135.406 -                       ("package test;\n" +
 135.407 -                       "\n" +
 135.408 -                       "public class Test {\n" +
 135.409 -                       "     private void test() {\n" +
 135.410 -                       "         System.err.println(\"\");\n" +
 135.411 -                       "     }\n" +
 135.412 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.413 -    }
 135.414 -
 135.415 -    public void testMultiple2OneStatement2() throws Exception {
 135.416 -        performFixTest("test/Test.java",
 135.417 -                       "|package test;\n" +
 135.418 -                       "\n" +
 135.419 -                       "public class Test {\n" +
 135.420 -                       "     private void test() {\n" +
 135.421 -                       "         int i = 0;\n" +
 135.422 -                       "         System.err.println(\"\");\n" +
 135.423 -                       "         System.err.println(\"\");\n" +
 135.424 -                       "         i++;\n" +
 135.425 -                       "     }\n" +
 135.426 -                       "}\n",
 135.427 -                       "5:9-5:32:verifier:HINT",
 135.428 -                       "FixImpl",
 135.429 -                       ("package test;\n" +
 135.430 -                       "\n" +
 135.431 -                       "public class Test {\n" +
 135.432 -                       "     private void test() {\n" +
 135.433 -                       "         int i = 0;\n" +
 135.434 -                       "         System.err.println(\"\");\n" +
 135.435 -                       "         i++;\n" +
 135.436 -                       "     }\n" +
 135.437 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.438 -    }
 135.439 -
 135.440 -    public void testMemberSelectInsideMemberSelect() throws Exception {
 135.441 -        performFixTest("test/Test.java",
 135.442 -                       "|package test;\n" +
 135.443 -                       "\n" +
 135.444 -                       "public class Test {\n" +
 135.445 -                       "     public Test test;\n" +
 135.446 -                       "     public String name;\n" +
 135.447 -                       "     private void test() {\n" +
 135.448 -                       "         Test t = null;\n" +
 135.449 -                       "         String s = t.test.toString();\n" +
 135.450 -                       "     }\n" +
 135.451 -                       "}\n",
 135.452 -                       "7:22-7:26:verifier:HINT",
 135.453 -                       "FixImpl",
 135.454 -                       ("package test;\n" +
 135.455 -                       "\n" +
 135.456 -                       "public class Test {\n" +
 135.457 -                       "     public Test test;\n" +
 135.458 -                       "     public String name;\n" +
 135.459 -                       "     private void test() {\n" +
 135.460 -                       "         Test t = null;\n" +
 135.461 -                       "         String s = t.getTest().toString();\n" +
 135.462 -                       "     }\n" +
 135.463 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.464 -    }
 135.465 -
 135.466 -    public void testPackageInfo() throws Exception {
 135.467 -        performAnalysisTest("test/package-info.java",
 135.468 -                            "|package test;\n");
 135.469 -    }
 135.470 -
 135.471 -    public void testSuppressWarnings() throws Exception {
 135.472 -        performAnalysisTest("test/Test.java",
 135.473 -                            "|package test;\n" +
 135.474 -                            "@SuppressWarnings(\"test\")\n" +
 135.475 -                            "public class Test {\n" +
 135.476 -                            "     public Test test;\n" +
 135.477 -                            "     public String name;\n" +
 135.478 -                            "     private void test() {\n" +
 135.479 -                            "         Test t = null;\n" +
 135.480 -                            "         String s = t.test.toString();\n" +
 135.481 -                            "     }\n" +
 135.482 -                            "}\n");
 135.483 -    }
 135.484 -
 135.485 -    public void testRewriteOneToMultipleClassMembers() throws Exception {
 135.486 -        performFixTest("test/Test.java",
 135.487 -                       "|package test;\n" +
 135.488 -                       "\n" +
 135.489 -                       "public class Test {\n" +
 135.490 -                       "     private int i;\n" +
 135.491 -                       "}\n",
 135.492 -                       "3:17-3:18:verifier:HINT",
 135.493 -                       "FixImpl",
 135.494 -                       ("package test;\n" +
 135.495 -                       "\n" +
 135.496 -                       "public class Test {\n" +
 135.497 -                       "     private int i;\n" +
 135.498 -                       "     public int getI() {\n" +
 135.499 -                       "         return i;\n" +
 135.500 -                       "     }\n" +
 135.501 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.502 -    }
 135.503 -
 135.504 -    public void testImports1() throws Exception {
 135.505 -        performFixTest("test/Test.java",
 135.506 -                       "|package test;\n" +
 135.507 -                       "\n" +
 135.508 -                       "public class Test {\n" +
 135.509 -                       "     private void test() {\n" +
 135.510 -                       "         new java.util.LinkedList();\n" +
 135.511 -                       "     }" +
 135.512 -                       "}\n",
 135.513 -                       "4:9-4:35:verifier:HINT",
 135.514 -                       "FixImpl",
 135.515 -                       ("package test;\n" +
 135.516 -                       "import java.util.ArrayList;\n" +
 135.517 -                       "public class Test {\n" +
 135.518 -                       "     private void test() {\n" +
 135.519 -                       "         new ArrayList();\n" +
 135.520 -                       "     }" +
 135.521 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.522 -    }
 135.523 -
 135.524 -    public void testImports2() throws Exception {
 135.525 -        performFixTest("test/Test.java",
 135.526 -                       "|package test;\n" +
 135.527 -                       "import java.util.LinkedList;\n" +
 135.528 -                       "public class Test {\n" +
 135.529 -                       "     private void test() {\n" +
 135.530 -                       "         LinkedList l;\n" +
 135.531 -                       "     }" +
 135.532 -                       "}\n",
 135.533 -                       "4:20-4:21:verifier:HINT",
 135.534 -                       "FixImpl",
 135.535 -                       ("package test;\n" +
 135.536 -                       "import java.util.ArrayList;\n" +
 135.537 -                       "import java.util.LinkedList;\n" +
 135.538 -                       "public class Test {\n" +
 135.539 -                       "     private void test() {\n" +
 135.540 -                       "         ArrayList l;\n" +
 135.541 -                       "     }" +
 135.542 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.543 -    }
 135.544 -
 135.545 -    public void testMultiParameters() throws Exception {
 135.546 -        performFixTest("test/Test.java",
 135.547 -                       "|package test;\n" +
 135.548 -                       "import java.util.Arrays;\n" +
 135.549 -                       "public class Test {\n" +
 135.550 -                       "     { Arrays.asList(\"a\", \"b\", \"c\"); }\n" +
 135.551 -                       "}\n",
 135.552 -                       "3:14-3:20:verifier:HINT",
 135.553 -                       "FixImpl",
 135.554 -                       ("package test;\n" +
 135.555 -                       "import java.util.Arrays;\n" +
 135.556 -                       "public class Test {\n" +
 135.557 -                       "     { Arrays.asList(\"d\", \"a\", \"b\", \"c\"); }\n" +
 135.558 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.559 -    }
 135.560 -
 135.561 -    public void testTypeParametersMethod() throws Exception {
 135.562 -        performFixTest("test/Test.java",
 135.563 -                       "|package test;\n" +
 135.564 -                       "import java.util.Arrays;\n" +
 135.565 -                       "public class Test {\n" +
 135.566 -                       "     { Arrays.<String>asList(\"a\", \"b\", \"c\"); }\n" +
 135.567 -                       "}\n",
 135.568 -                       "3:22-3:28:verifier:HINT",
 135.569 -                       "FixImpl",
 135.570 -                       ("package test;\n" +
 135.571 -                       "import java.util.Arrays;\n" +
 135.572 -                       "public class Test {\n" +
 135.573 -                       "     { Arrays.<String>asList(\"d\", \"a\", \"b\", \"c\"); }\n" +
 135.574 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.575 -    }
 135.576 -
 135.577 -    public void testTypeParametersNewClass() throws Exception {
 135.578 -        performFixTest("test/Test.java",
 135.579 -                       "|package test;\n" +
 135.580 -                       "import java.util.Arrays;\n" +
 135.581 -                       "import java.util.HashSet;\n" +
 135.582 -                       "public class Test {\n" +
 135.583 -                       "     { new HashSet<String>(Arrays.<String>asList(\"a\", \"b\", \"c\")); }\n" +
 135.584 -                       "}\n",
 135.585 -                       "4:7-4:64:verifier:HINT",
 135.586 -                       "FixImpl",
 135.587 -                       ("package test;\n" +
 135.588 -                       "import java.util.Arrays;\n" +
 135.589 -                       "import java.util.HashSet;\n" +
 135.590 -                       "public class Test {\n" +
 135.591 -                       "     { new HashSet<String>(Arrays.<String>asList(\"d\", \"a\", \"b\", \"c\")); }\n" +
 135.592 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.593 -    }
 135.594 -
 135.595 -    public void testChangeFieldType1() throws Exception {
 135.596 -        performFixTest("test/Test.java",
 135.597 -                       "|package test;\n" +
 135.598 -                       "public class Test {\n" +
 135.599 -                       "     private String name = null;\n" +
 135.600 -                       "}\n",
 135.601 -                       "2:20-2:24:verifier:HINT",
 135.602 -                       "FixImpl",
 135.603 -                       ("package test;\n" +
 135.604 -                       "public class Test {\n" +
 135.605 -                       "     private CharSequence name = null;\n" +
 135.606 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.607 -    }
 135.608 -
 135.609 -    public void testChangeFieldType2() throws Exception {
 135.610 -        performFixTest("test/Test.java",
 135.611 -                       "|package test;\n" +
 135.612 -                       "public class Test {\n" +
 135.613 -                       "     String name = null;\n" +
 135.614 -                       "}\n",
 135.615 -                       "2:12-2:16:verifier:HINT",
 135.616 -                       "FixImpl",
 135.617 -                       ("package test;\n" +
 135.618 -                       "public class Test {\n" +
 135.619 -                       "     CharSequence name = null;\n" +
 135.620 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.621 -    }
 135.622 -
 135.623 -    public void testChangeFieldType3() throws Exception {
 135.624 -        performFixTest("test/Test.java",
 135.625 -                       "|package test;\n" +
 135.626 -                       "public class Test {\n" +
 135.627 -                       "     private static final String name = \"test\".substring(0, 4);\n" +
 135.628 -                       "}\n",
 135.629 -                       "2:33-2:37:verifier:HINT",
 135.630 -                       "FixImpl",
 135.631 -                       ("package test;\n" +
 135.632 -                       "public class Test {\n" +
 135.633 -                       "     private static final CharSequence name = \"test\".substring(0, 4);\n" +
 135.634 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.635 -    }
 135.636 -
 135.637 -    public void testIdentifier() throws Exception {
 135.638 -        performFixTest("test/Test.java",
 135.639 -                       "|package test;\n" +
 135.640 -                       "public class Test {\n" +
 135.641 -                       "     private int l;" +
 135.642 -                       "     {System.err.println(l);}\n" +
 135.643 -                       "}\n",
 135.644 -                       "2:44-2:45:verifier:HINT",
 135.645 -                       "FixImpl",
 135.646 -                       ("package test;\n" +
 135.647 -                       "public class Test {\n" +
 135.648 -                       "     private int l;" +
 135.649 -                       "     {System.err.println(2);}\n" +
 135.650 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.651 -    }
 135.652 -
 135.653 -    public void testLambda() throws Exception {
 135.654 -        performAnalysisTest("test/Test.java",
 135.655 -                       "|package test;\n" +
 135.656 -                       "public class Test {\n" +
 135.657 -                       "     { new java.io.FileFilter() {public boolean accept(java.io.File f) { return true; } } }\n" +
 135.658 -                       "}\n",
 135.659 -                       "2:7-2:89:verifier:HINT");
 135.660 -    }
 135.661 -
 135.662 -    public void testAddCasesToSwitch() throws Exception {
 135.663 -        performFixTest("test/Test.java",
 135.664 -                       "|package test;\n" +
 135.665 -                       "public class Test {\n" +
 135.666 -                       "     {\n" +
 135.667 -                       "         E e = null;\n" +
 135.668 -                       "         switch (e) {\n" +
 135.669 -                       "             case A: System.err.println(1); break;\n" +
 135.670 -                       "             case D: System.err.println(2); break;\n" +
 135.671 -                       "             case E: System.err.println(3); break;\n" +
 135.672 -                       "         }\n" +
 135.673 -                       "     }\n" +
 135.674 -                       "     public enum E {A, B, C, D, E, F;}\n" +
 135.675 -                       "}\n",
 135.676 -                       "4:9-4:15:verifier:HINT",
 135.677 -                       "FixImpl",
 135.678 -                       ("package test;\n" +
 135.679 -                       "public class Test {\n" +
 135.680 -                       "     {\n" +
 135.681 -                       "         E e = null;\n" +
 135.682 -                       "         switch (e) {\n" +
 135.683 -                       "             case A: System.err.println(1); break;\n" +
 135.684 -                       "             case B:case C:\n" +
 135.685 -//                       "             case C:\n" +
 135.686 -                       "             case D: System.err.println(2); break;\n" +
 135.687 -                       "             case E: System.err.println(3); break;\n" +
 135.688 -                       "         }\n" +
 135.689 -                       "     }\n" +
 135.690 -                       "     public enum E {A, B, C, D, E, F;}\n" +
 135.691 -                       "}\n").replaceAll("[ \t\n]+", " "));
 135.692 -    }
 135.693 -
 135.694 -    private static final Map<String, HintDescription> test2Hint;
 135.695 -
 135.696 -    static {
 135.697 -        test2Hint = new HashMap<String, HintDescription>();
 135.698 -        test2Hint.put("testPattern1", HintDescriptionFactory.create().setTrigger(PatternDescription.create("$1.toURL()", Collections.singletonMap("$1", "java.io.File"))).setWorker(new WorkerImpl()).produce());
 135.699 -        test2Hint.put("testPattern2", test2Hint.get("testPattern1"));
 135.700 -        test2Hint.put("testKind1", HintDescriptionFactory.create().setTrigger(new Kinds(EnumSet.of(Kind.METHOD_INVOCATION))).setWorker(new WorkerImpl()).produce());
 135.701 -        test2Hint.put("testPatternVariable1", HintDescriptionFactory.create().setTrigger(PatternDescription.create("{ $1 $2; $2 = $3; }", Collections.<String, String>emptyMap())).setWorker(new WorkerImpl("{ $1 $2 = $3; }")).produce());
 135.702 -        Map<String, String> constraints = new HashMap<String, String>();
 135.703 -
 135.704 -        constraints.put("$1", "boolean");
 135.705 -        constraints.put("$2", "java.lang.Object");
 135.706 -
 135.707 -        test2Hint.put("testPatternAssert1", HintDescriptionFactory.create().setTrigger(PatternDescription.create("assert $1 : $2;", constraints)).setWorker(new WorkerImpl()).produce());
 135.708 -        test2Hint.put("testPatternStatementAndSingleStatementBlockAreSame", HintDescriptionFactory.create().setTrigger(PatternDescription.create("if ($1) return $2;", Collections.<String, String>emptyMap())).setWorker(new WorkerImpl()).produce());
 135.709 -        test2Hint.put("testPatternFalseOccurrence", HintDescriptionFactory.create().setTrigger(PatternDescription.create("$1.toURL()", Collections.singletonMap("$1", "java.io.File"))).setWorker(new WorkerImpl()).produce());
 135.710 -        test2Hint.put("testStatementVariables1", HintDescriptionFactory.create().setTrigger(PatternDescription.create("if ($1) $2; else $3;", constraints)).setWorker(new WorkerImpl("if (!$1) $3; else $2;")).produce());
 135.711 -        test2Hint.put("testStatementVariables2", test2Hint.get("testStatementVariables1"));
 135.712 -        test2Hint.put("testMultiStatementVariables1", HintDescriptionFactory.create().setTrigger(PatternDescription.create("{ $pref$; int $i = 3; $inf$; return $i; }", Collections.<String, String>emptyMap())).setWorker(new WorkerImpl("{ $pref$; float $i = 3; $inf$; return $i; }")).produce());
 135.713 -        test2Hint.put("testMultiStatementVariables2", test2Hint.get("testMultiStatementVariables1"));
 135.714 -        test2Hint.put("testMultiStatementVariables3", test2Hint.get("testMultiStatementVariables1"));
 135.715 -        test2Hint.put("testMultiStatementVariablesAndBlocks", HintDescriptionFactory.create().setTrigger(PatternDescription.create("if ($c) {$s1$; System.err.println(); $s2$; }", Collections.<String, String>emptyMap())).setWorker(new WorkerImpl("if (!$c) {$s1$; System.err.println(); $s2$; }")).produce());
 135.716 -        test2Hint.put("testOneStatement2MultipleBlock", HintDescriptionFactory.create().setTrigger(PatternDescription.create("System.err.println($1);", Collections.<String, String>emptyMap())).setWorker(new WorkerImpl("System.err.println($1); System.err.println($1);")).produce());
 135.717 -        test2Hint.put("testOneStatement2MultipleStatement", test2Hint.get("testOneStatement2MultipleBlock"));
 135.718 -        test2Hint.put("testMultiple2OneStatement1", HintDescriptionFactory.create().setTrigger(PatternDescription.create("System.err.println($1); System.err.println($2);", Collections.<String, String>emptyMap())).setWorker(new WorkerImpl("System.err.println($1);")).produce());
 135.719 -        test2Hint.put("testMultiple2OneStatement2", test2Hint.get("testMultiple2OneStatement1"));
 135.720 -        test2Hint.put("testMemberSelectInsideMemberSelect", HintDescriptionFactory.create().setTrigger(PatternDescription.create("$Test.test", Collections.<String, String>singletonMap("$Test", "test.Test"))).setWorker(new WorkerImpl("$Test.getTest()")).produce());
 135.721 -        test2Hint.put("testPackageInfo", HintDescriptionFactory.create().setTrigger(PatternDescription.create("$Test.test", Collections.<String, String>singletonMap("$Test", "test.Test"))).setWorker(new WorkerImpl("$Test.getTest()")).produce());
 135.722 -        HintMetadata metadata = HintMetadata.Builder.create("no-id").addOptions(Options.NON_GUI).addSuppressWarnings("test").build();
 135.723 -        test2Hint.put("testSuppressWarnings", HintDescriptionFactory.create().setTrigger(PatternDescription.create("$Test.test", Collections.<String, String>singletonMap("$Test", "test.Test"))).setWorker(new WorkerImpl("$Test.getTest()")).setMetadata(metadata).produce());
 135.724 -        test2Hint.put("testRewriteOneToMultipleClassMembers", HintDescriptionFactory.create().setTrigger(PatternDescription.create("private int i;", Collections.<String, String>emptyMap())).setWorker(new WorkerImpl("private int i; public int getI() { return i; }")).produce());
 135.725 -//        test2Hint.put("testImports1", HintDescriptionFactory.create().setTrigger(PatternDescription.create("new LinkedList()", Collections.<String, String>emptyMap(), "import java.util.LinkedList;")).setWorker(new WorkerImpl("new ArrayList()", "import java.util.ArrayList;\n")).produce());
 135.726 -//        test2Hint.put("testImports2", HintDescriptionFactory.create().setTrigger(PatternDescription.create("LinkedList $0;", Collections.<String, String>emptyMap(), "import java.util.LinkedList;")).setWorker(new WorkerImpl("ArrayList $0;", "import java.util.ArrayList;\n")).produce());
 135.727 -        test2Hint.put("testImports1", HintDescriptionFactory.create().setTrigger(PatternDescription.create("new LinkedList()", Collections.<String, String>emptyMap(), "import java.util.LinkedList;")).setWorker(new WorkerImpl("new java.util.ArrayList()")).produce());
 135.728 -        test2Hint.put("testImports2", HintDescriptionFactory.create().setTrigger(PatternDescription.create("LinkedList $0;", Collections.<String, String>emptyMap(), "import java.util.LinkedList;")).setWorker(new WorkerImpl("java.util.ArrayList $0;")).produce());
 135.729 -        test2Hint.put("testMultiParameters", HintDescriptionFactory.create().setTrigger(PatternDescription.create("java.util.Arrays.asList($1$)", Collections.<String,String>emptyMap())).setWorker(new WorkerImpl("java.util.Arrays.asList(\"d\", $1$)")).produce());
 135.730 -        test2Hint.put("testTypeParametersMethod", HintDescriptionFactory.create().setTrigger(PatternDescription.create("java.util.Arrays.<$T>asList($1$)", Collections.<String,String>emptyMap())).setWorker(new WorkerImpl("java.util.Arrays.<$T>asList(\"d\", $1$)")).produce());
 135.731 -        test2Hint.put("testTypeParametersNewClass", HintDescriptionFactory.create().setTrigger(PatternDescription.create("new java.util.HashSet<$T1$>(java.util.Arrays.<$T$>asList($1$))", Collections.<String,String>emptyMap())).setWorker(new WorkerImpl("new java.util.HashSet<$T1$>(java.util.Arrays.<$T$>asList(\"d\", $1$))")).produce());
 135.732 -        test2Hint.put("testChangeFieldType1", HintDescriptionFactory.create().setTrigger(PatternDescription.create("$modifiers$ java.lang.String $name = $initializer;", Collections.<String, String>emptyMap())).setWorker(new WorkerImpl("$modifiers$ java.lang.CharSequence $name = $initializer;")).produce());
 135.733 -        test2Hint.put("testChangeFieldType2", test2Hint.get("testChangeFieldType1"));
 135.734 -        test2Hint.put("testChangeFieldType3", test2Hint.get("testChangeFieldType1"));
 135.735 -        test2Hint.put("testIdentifier", HintDescriptionFactory.create().setTrigger(PatternDescription.create("$i", Collections.<String, String>singletonMap("$i", "int"))).setWorker(new WorkerImpl("2")).produce());
 135.736 -        test2Hint.put("testLambda", HintDescriptionFactory.create().setTrigger(PatternDescription.create("new $type() { $mods$ $retType $name($params$) { $body$; } }", Collections.<String, String>emptyMap())).setWorker(new WorkerImpl()).produce());
 135.737 -        test2Hint.put("testAddCasesToSwitch", HintDescriptionFactory.create().setTrigger(PatternDescription.create("switch ($var) { case $c1$; case D: $stmts$; case $c2$; }", Collections.<String,String>singletonMap("$var", "test.Test.E"))).setWorker(new WorkerImpl("switch ($var) { case $c1$ case B: case C: case D: $stmts$; case $c2$ }")).produce());
 135.738 -    }
 135.739 -
 135.740 -//    @Override
 135.741 -    protected List<ErrorDescription> computeErrors(CompilationInfo info, TreePath path, int pos) {
 135.742 -        HintDescription hd = test2Hint.get(getName());
 135.743 -
 135.744 -        assertNotNull(hd);
 135.745 -
 135.746 -        return new HintsInvoker(HintsSettings.getGlobalSettings(), new AtomicBoolean()).computeHints(info, Collections.singletonList(hd));
 135.747 -    }
 135.748 -
 135.749 -//    @Override
 135.750 -    protected String toDebugString(CompilationInfo info, Fix f) {
 135.751 -        return "FixImpl";
 135.752 -    }
 135.753 -
 135.754 -//    @Override
 135.755 -//    public void testIssue105979() throws Exception {}
 135.756 -//
 135.757 -//    @Override
 135.758 -//    public void testIssue108246() throws Exception {}
 135.759 -//
 135.760 -//    @Override
 135.761 -//    public void testIssue113933() throws Exception {}
 135.762 -//
 135.763 -//    @Override
 135.764 -//    public void testNoHintsForSimpleInitialize() throws Exception {}
 135.765 -
 135.766 -    private static final class WorkerImpl implements Worker {
 135.767 -
 135.768 -        private final String fix;
 135.769 -
 135.770 -        public WorkerImpl() {
 135.771 -            this(null);
 135.772 -        }
 135.773 -
 135.774 -        public WorkerImpl(String fix) {
 135.775 -            this.fix = fix;
 135.776 -        }
 135.777 -
 135.778 -        public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
 135.779 -            if (ctx.getInfo().getTreeUtilities().isSynthetic(ctx.getPath())) {
 135.780 -                return null;
 135.781 -            }
 135.782 -
 135.783 -            List<Fix> fixes = new LinkedList<Fix>();
 135.784 -
 135.785 -            if (fix != null) {
 135.786 -                fixes.add(JavaFixUtilities.rewriteFix(ctx, "Rewrite", ctx.getPath(), fix));
 135.787 -            }
 135.788 -            
 135.789 -            return Collections.singletonList(ErrorDescriptionFactory.forName(ctx, ctx.getPath(), "HINT", fixes.toArray(new Fix[0])));
 135.790 -        }
 135.791 -    }
 135.792 -
 135.793 -
 135.794 -    //XXX:copied from TreeRuleTestBase:
 135.795 -
 135.796 -    protected void performAnalysisTest(String fileName, String code, String... golden) throws Exception {
 135.797 -        int[] offset = new int[1];
 135.798 -
 135.799 -        code = org.netbeans.modules.java.hints.spiimpl.TestUtilities.detectOffsets(code, offset);
 135.800 -
 135.801 -        performAnalysisTest(fileName, code, offset[0], golden);
 135.802 -    }
 135.803 -
 135.804 -    protected void performAnalysisTest(String fileName, String code, int pos, String... golden) throws Exception {
 135.805 -        prepareTest(fileName, code);
 135.806 -
 135.807 -        TreePath path = info.getTreeUtilities().pathFor(pos);
 135.808 -
 135.809 -        List<ErrorDescription> errors = computeErrors(info, path, pos);
 135.810 -        List<String> errorsNames = new LinkedList<String>();
 135.811 -
 135.812 -        errors = errors != null ? errors : Collections.<ErrorDescription>emptyList();
 135.813 -
 135.814 -        for (ErrorDescription e : errors) {
 135.815 -            errorsNames.add(e.toString());
 135.816 -        }
 135.817 -
 135.818 -        assertTrue("The warnings provided by the hint do not match expected warnings. Provided warnings: " + errorsNames.toString(), Arrays.equals(golden, errorsNames.toArray(new String[0])));
 135.819 -    }
 135.820 -
 135.821 -    protected String performFixTest(String fileName, String code, String errorDescriptionToString, String fixDebugString, String golden) throws Exception {
 135.822 -        int[] offset = new int[1];
 135.823 -
 135.824 -        code = org.netbeans.modules.java.hints.spiimpl.TestUtilities.detectOffsets(code, offset);
 135.825 -
 135.826 -        return performFixTest(fileName, code, offset[0], errorDescriptionToString, fixDebugString, golden);
 135.827 -    }
 135.828 -
 135.829 -    protected String performFixTest(String fileName, String code, int pos, String errorDescriptionToString, String fixDebugString, String golden) throws Exception {
 135.830 -        return performFixTest(fileName, code, pos, errorDescriptionToString, fixDebugString, fileName, golden);
 135.831 -    }
 135.832 -
 135.833 -    protected String performFixTest(String fileName, String code, String errorDescriptionToString, String fixDebugString, String goldenFileName, String golden) throws Exception {
 135.834 -        int[] offset = new int[1];
 135.835 -
 135.836 -        code = org.netbeans.modules.java.hints.spiimpl.TestUtilities.detectOffsets(code, offset);
 135.837 -
 135.838 -        return performFixTest(fileName, code, offset[0], errorDescriptionToString, fixDebugString, goldenFileName, golden);
 135.839 -    }
 135.840 -
 135.841 -    protected String performFixTest(String fileName, String code, int pos, String errorDescriptionToString, String fixDebugString, String goldenFileName, String golden) throws Exception {
 135.842 -        prepareTest(fileName, code);
 135.843 -
 135.844 -        TreePath path = info.getTreeUtilities().pathFor(pos);
 135.845 -
 135.846 -        List<ErrorDescription> errors = computeErrors(info, path, pos);
 135.847 -
 135.848 -        ErrorDescription toFix = null;
 135.849 -
 135.850 -        for (ErrorDescription d : errors) {
 135.851 -            if (errorDescriptionToString.equals(d.toString())) {
 135.852 -                toFix = d;
 135.853 -                break;
 135.854 -            }
 135.855 -        }
 135.856 -
 135.857 -        assertNotNull("Error: \"" + errorDescriptionToString + "\" not found. All ErrorDescriptions: " + errors.toString(), toFix);
 135.858 -
 135.859 -        assertTrue("Must be computed", toFix.getFixes().isComputed());
 135.860 -
 135.861 -        List<Fix> fixes = toFix.getFixes().getFixes();
 135.862 -        List<String> fixNames = new LinkedList<String>();
 135.863 -        Fix toApply = null;
 135.864 -
 135.865 -        for (Fix f : fixes) {
 135.866 -            if (fixDebugString.equals(toDebugString(info, f))) {
 135.867 -                toApply = f;
 135.868 -            }
 135.869 -
 135.870 -            fixNames.add(toDebugString(info, f));
 135.871 -        }
 135.872 -
 135.873 -        assertNotNull("Cannot find fix to invoke: " + fixNames.toString(), toApply);
 135.874 -
 135.875 -        toApply.implement();
 135.876 -
 135.877 -        FileObject toCheck = sourceRoot.getFileObject(goldenFileName);
 135.878 -
 135.879 -        assertNotNull(toCheck);
 135.880 -
 135.881 -        DataObject toCheckDO = DataObject.find(toCheck);
 135.882 -        EditorCookie ec = toCheckDO.getLookup().lookup(EditorCookie.class);
 135.883 -        Document toCheckDocument = ec.openDocument();
 135.884 -
 135.885 -        String realCode = toCheckDocument.getText(0, toCheckDocument.getLength());
 135.886 -
 135.887 -        //ignore whitespaces:
 135.888 -        realCode = realCode.replaceAll("[ \t\n]+", " ");
 135.889 -
 135.890 -        if (golden != null) {
 135.891 -            assertEquals("The output code does not match the expected code.", golden, realCode);
 135.892 -        }
 135.893 -
 135.894 -        LifecycleManager.getDefault().saveAll();
 135.895 -
 135.896 -        return realCode;
 135.897 -    }
 135.898 -}
 135.899 \ No newline at end of file
   136.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/BulkSearchTestPerformer.java	Sun Jan 08 20:10:08 2017 +0100
   136.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   136.3 @@ -1,694 +0,0 @@
   136.4 -/*
   136.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   136.6 - *
   136.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   136.8 - *
   136.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  136.10 - * Other names may be trademarks of their respective owners.
  136.11 - *
  136.12 - * The contents of this file are subject to the terms of either the GNU
  136.13 - * General Public License Version 2 only ("GPL") or the Common
  136.14 - * Development and Distribution License("CDDL") (collectively, the
  136.15 - * "License"). You may not use this file except in compliance with the
  136.16 - * License. You can obtain a copy of the License at
  136.17 - * http://www.netbeans.org/cddl-gplv2.html
  136.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  136.19 - * specific language governing permissions and limitations under the
  136.20 - * License.  When distributing the software, include this License Header
  136.21 - * Notice in each file and include the License file at
  136.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  136.23 - * particular file as subject to the "Classpath" exception as provided
  136.24 - * by Oracle in the GPL Version 2 section of the License file that
  136.25 - * accompanied this code. If applicable, add the following below the
  136.26 - * License Header, with the fields enclosed by brackets [] replaced by
  136.27 - * your own identifying information:
  136.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  136.29 - *
  136.30 - * If you wish your version of this file to be governed by only the CDDL
  136.31 - * or only the GPL Version 2, indicate your decision by adding
  136.32 - * "[Contributor] elects to include this software in this distribution
  136.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  136.34 - * single choice of license, a recipient has the option to distribute
  136.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  136.36 - * to extend the choice of license to its licensees as provided above.
  136.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  136.38 - * Version 2 license, then the option applies only if the new code is
  136.39 - * made subject to such option by the copyright holder.
  136.40 - *
  136.41 - * Contributor(s):
  136.42 - *
  136.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
  136.44 - */
  136.45 -
  136.46 -package org.netbeans.modules.java.hints.spiimpl.pm;
  136.47 -
  136.48 -import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch.BulkPattern;
  136.49 -import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch.EncodingContext;
  136.50 -import com.sun.source.util.TreePath;
  136.51 -import java.io.ByteArrayInputStream;
  136.52 -import java.io.ByteArrayOutputStream;
  136.53 -import java.io.File;
  136.54 -import java.util.Arrays;
  136.55 -import java.util.Collection;
  136.56 -import java.util.Collections;
  136.57 -import java.util.HashMap;
  136.58 -import java.util.HashSet;
  136.59 -import java.util.LinkedList;
  136.60 -import java.util.List;
  136.61 -import java.util.Map;
  136.62 -import java.util.Map.Entry;
  136.63 -import java.util.Set;
  136.64 -import java.util.concurrent.atomic.AtomicBoolean;
  136.65 -import java.util.regex.Pattern;
  136.66 -import javax.swing.text.Document;
  136.67 -import org.netbeans.api.java.lexer.JavaTokenId;
  136.68 -import org.netbeans.api.java.source.CompilationInfo;
  136.69 -import org.netbeans.api.java.source.JavaSource;
  136.70 -import org.netbeans.api.java.source.JavaSource.Phase;
  136.71 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  136.72 -import org.netbeans.api.java.source.TestUtilities;
  136.73 -import org.netbeans.api.java.source.TreePathHandle;
  136.74 -import org.netbeans.api.lexer.Language;
  136.75 -import org.netbeans.junit.NbTestCase;
  136.76 -import org.netbeans.modules.java.source.TreeLoader;
  136.77 -import org.openide.cookies.EditorCookie;
  136.78 -import org.openide.filesystems.FileObject;
  136.79 -import org.openide.filesystems.FileUtil;
  136.80 -import org.openide.loaders.DataObject;
  136.81 -import static org.junit.Assert.*;
  136.82 -import org.netbeans.junit.RandomlyFails;
  136.83 -
  136.84 -/**
  136.85 - *
  136.86 - * @author lahvac
  136.87 - */
  136.88 -public abstract class BulkSearchTestPerformer extends NbTestCase {
  136.89 -
  136.90 -    public BulkSearchTestPerformer(String name) {
  136.91 -        super(name);
  136.92 -    }
  136.93 -
  136.94 -    @Override
  136.95 -    protected void setUp() throws Exception {
  136.96 -        super.setUp();
  136.97 -        SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/editor/resources/layer.xml"}, new Object[0]);
  136.98 -        TreeLoader.DISABLE_CONFINEMENT_TEST = true;
  136.99 -    }
 136.100 -
 136.101 -//    public static TestSuite suite() {
 136.102 -//        NbTestSuite s = new NbTestSuite();
 136.103 -//
 136.104 -//        s.addTestSuite(NFABasedBulkSearchTest.class);
 136.105 -//
 136.106 -//        return s;
 136.107 -//    }
 136.108 -
 136.109 -    public void testSimple1() throws Exception {
 136.110 -        performTest("package test; public class Test { private void test() { System.err./**/println(\"\");}}",
 136.111 -                    Collections.singletonMap("System.err.println(\"\")", Arrays.asList("System.err./**/println(\"\")")),
 136.112 -                    Arrays.asList("System.err.println(\"\" + \"\")"));
 136.113 -    }
 136.114 -
 136.115 -    public void testDontCare() throws Exception {
 136.116 -        performTest("package test; public class Test { private void test() { System.err./**/println(\"\" + \"\");}}",
 136.117 -                    Collections.singletonMap("System.err.println($1)", Arrays.asList("System.err./**/println(\"\" + \"\")")),
 136.118 -                    Collections.<String>emptyList());
 136.119 -    }
 136.120 -
 136.121 -    public void testMemberSelectAndIdentifier() throws Exception {
 136.122 -        performTest("package test; public class Test { private static void test() { test();}}",
 136.123 -                    Collections.singletonMap("test.Test.test()", Arrays.asList("test()")),
 136.124 -                    Collections.<String>emptyList());
 136.125 -    }
 136.126 -
 136.127 -    public void testUnpureMemberSelect() throws Exception {
 136.128 -        performTest("package test; public class Test { private static void test() { new StringBuilder().append(\"\");}}",
 136.129 -                    Collections.<String, List<String>>emptyMap(),
 136.130 -                    Arrays.asList("test.append(\"\")"));
 136.131 -    }
 136.132 -
 136.133 -    public void testMemberSelectWithVariables1() throws Exception {
 136.134 -        performTest("package test; public class Test { private static void test() { new StringBuilder().append(\"\");}}",
 136.135 -                    Collections.singletonMap("$0.append(\"\")", Arrays.asList("new StringBuilder().append(\"\")")),
 136.136 -                    Collections.<String>emptyList());
 136.137 -    }
 136.138 -
 136.139 -    public void testMemberSelectWithVariables2() throws Exception {
 136.140 -        performTest("package test; public class Test { private void append(char c) { append(\"\");}}",
 136.141 -                    Collections.singletonMap("$0.append(\"\")", Arrays.asList("append(\"\")")),
 136.142 -                    Collections.<String>emptyList());
 136.143 -    }
 136.144 -
 136.145 -    public void testLocalVariables() throws Exception {
 136.146 -        performTest("package test; public class Test { private void test() { { int y; y = 1; } }}",
 136.147 -                    Collections.singletonMap("{ int $1; $1 = 1; }", Arrays.asList("{ int y; y = 1; }")),
 136.148 -                    Collections.<String>emptyList());
 136.149 -    }
 136.150 -
 136.151 -    public void testAssert() throws Exception {
 136.152 -        performTest("package test; public class Test { private void test() { assert true : \"\"; }}",
 136.153 -                    Collections.singletonMap("assert $1 : $2;", Arrays.asList("assert true : \"\";")),
 136.154 -                    Collections.<String>emptyList());
 136.155 -    }
 136.156 -
 136.157 -    public void testStatementAndSingleBlockStatementAreSame1() throws Exception {
 136.158 -        performTest("package test; public class Test { private void test() { { int y; { y = 1; } } }}",
 136.159 -                    Collections.singletonMap("{ int $1; $1 = 1; }", Arrays.asList("{ int y; { y = 1; } }")),
 136.160 -                    Collections.<String>emptyList());
 136.161 -    }
 136.162 -
 136.163 -    public void testStatementAndSingleBlockStatementAreSame2() throws Exception {
 136.164 -        performTest("package test; public class Test { private void test() { { int y; y = 1; } }}",
 136.165 -                    Collections.singletonMap("{ int $1; { $1 = 1; } }", Arrays.asList("{ int y; y = 1; }")),
 136.166 -                    Collections.<String>emptyList());
 136.167 -    }
 136.168 -
 136.169 -    public void testStatementVariables1() throws Exception {
 136.170 -        performTest("package test; public class Test { public int test1() { if (true) return 1; else return 2; } }",
 136.171 -                    Collections.singletonMap("if ($1) $2; else $3;", Arrays.asList("if (true) return 1; else return 2;")),
 136.172 -                    Collections.<String>emptyList());
 136.173 -    }
 136.174 -
 136.175 -    public void testMultiStatementVariables1() throws Exception {
 136.176 -        performTest("package test; public class Test { public int test1(int i) { System.err.println(i); System.err.println(i); i = 3; System.err.println(i); System.err.println(i); return i; } }",
 136.177 -                    Collections.singletonMap("{ $s1$; i = 3; $s2$; return i; }", Arrays.asList("{ System.err.println(i); System.err.println(i); i = 3; System.err.println(i); System.err.println(i); return i; }")),
 136.178 -                    Collections.<String>emptyList());
 136.179 -    }
 136.180 -
 136.181 -    public void testMultiStatementVariables2() throws Exception {
 136.182 -        performTest("package test; public class Test { public int test1(int i) { i = 3; return i; } }",
 136.183 -                    Collections.singletonMap("{ $s1$; i = 3; $s2$; return i; }", Arrays.asList("{ i = 3; return i; }")),
 136.184 -                    Collections.<String>emptyList());
 136.185 -    }
 136.186 -
 136.187 -    public void testMultiStatementVariablesAndBlocks1() throws Exception {
 136.188 -        performTest("package test; public class Test { public void test1() { if (true) System.err.println(); } }",
 136.189 -                    Collections.singletonMap("if ($c) {$s1$; System.err.println(); $s2$; }", Arrays.asList("if (true) System.err.println();")),
 136.190 -                    Collections.<String>emptyList());
 136.191 -    }
 136.192 -
 136.193 -    public void testMultiStatementVariablesAndBlocks2() throws Exception {
 136.194 -        performTest("package test; public class Test { public void test1() { if (true) System.err.println(); } }",
 136.195 -                    Collections.singletonMap("if ($c) {$s1$; System.err.println(); }", Arrays.asList("if (true) System.err.println();")),
 136.196 -                    Collections.<String>emptyList());
 136.197 -    }
 136.198 -
 136.199 -    public void testMultiStatementVariablesAndBlocks3() throws Exception {
 136.200 -        performTest("package test; public class Test { public void test1() { if (true) System.err.println(); } }",
 136.201 -                    Collections.singletonMap("if ($c) {System.err.println(); $s2$; }", Arrays.asList("if (true) System.err.println();")),
 136.202 -                    Collections.<String>emptyList());
 136.203 -    }
 136.204 -
 136.205 -    public void testMultiStatementVariablesAndBlocks4() throws Exception {
 136.206 -        performTest("package test; public class Test { public void test1() { if (true) System.err.println(); } }",
 136.207 -                    Collections.singletonMap("{ $s1$; System.err.println(); $s2$; }", Arrays.asList("System.err.println();")),
 136.208 -                    Collections.<String>emptyList());
 136.209 -    }
 136.210 -
 136.211 -    public void testTwoPatterns() throws Exception {
 136.212 -        Map<String, List<String>> contained = new HashMap<String, List<String>>();
 136.213 -
 136.214 -        contained.put("if ($a) $ret = $b; else $ret = $c;", Arrays.asList("if (b) q = 2; else q = 3;"));
 136.215 -        contained.put("{ $p$; $T $v; if($a) $v = $b; else $v = $c; $q$; }", Arrays.asList("{ int q; if (b) q = 2; else q = 3; }"));
 136.216 -
 136.217 -        performTest("package test; public class Test { public void test1(boolean b) { int q; if (b) q = 2; else q = 3; } }",
 136.218 -                    contained,
 136.219 -                    Collections.<String>emptyList());
 136.220 -    }
 136.221 -
 136.222 -    public void testEffectiveNewClass() throws Exception {
 136.223 -        performTest("package test; import javax.swing.ImageIcon; public class Test { public void test1(java.awt.Image i) { new ImageIcon(i); new String(i); } }",
 136.224 -                    Collections.singletonMap("new javax.swing.ImageIcon($1)", Arrays.asList("new ImageIcon(i)")),
 136.225 -                    Collections.<String>emptyList());
 136.226 -    }
 136.227 -
 136.228 -    public void testSynchronizedAndMultiStatementVariables() throws Exception {
 136.229 -        performTest("package test; public class Test {public void test() { Object o = null; int i = 0; synchronized (o) {} } }",
 136.230 -                    Collections.singletonMap("synchronized($var) {$stmts$;}", Arrays.asList("synchronized (o) {}")),
 136.231 -                    Collections.<String>emptyList());
 136.232 -    }
 136.233 -
 136.234 -    public void testJackpot30_2() throws Exception {
 136.235 -        String code = "package test;\n" +
 136.236 -                      "public class Test {\n" +
 136.237 -                      "    private void m() {\n" +
 136.238 -                      "        a(c.i().getFileObject());\n" +
 136.239 -                      "        if (span != null && span[0] != (-1) && span[1] != (-1));\n" +
 136.240 -                      "    }\n" +
 136.241 -                      "}\n";
 136.242 -
 136.243 -        performTest(code,
 136.244 -                    Collections.<String, List<String>>emptyMap(),
 136.245 -                    Arrays.asList("$0.getFileObject($1)"));
 136.246 -    }
 136.247 -
 136.248 -    public void testIdentifierInPureMemberSelect() throws Exception {
 136.249 -        String code = "package test;\n" +
 136.250 -                       "public class Test {\n" +
 136.251 -                       "     public Test test;\n" +
 136.252 -                       "     public String name;\n" +
 136.253 -                       "     private void test() {\n" +
 136.254 -                       "         Test t = null;\n" +
 136.255 -                       "         String s = t.test.name;\n" +
 136.256 -                       "     }\n" +
 136.257 -                       "}\n";
 136.258 -
 136.259 -        performTest(code,
 136.260 -                    Collections.singletonMap("$Test.test", Arrays.asList("test", "t.test")),
 136.261 -                    Collections.<String>emptyList());
 136.262 -    }
 136.263 -
 136.264 -    @RandomlyFails
 136.265 -    public void testNoExponentialTimeComplexity() throws Exception {
 136.266 -        try {
 136.267 -        String code = "package test;\n" +
 136.268 -                      "public class Test {\n" +
 136.269 -                      "    private void test() {\n" +
 136.270 -                      "        Object o;\n" +
 136.271 -                      "        if(o == null) {\n" +
 136.272 -                      "            f(\"\");\n" +
 136.273 -                      "        }|\n" +
 136.274 -                      "    }\n" +
 136.275 -                      "}";
 136.276 -        String pattern = "{ $p$; $T $v; if($a) $v = $b; else $v = $c; }";
 136.277 -
 136.278 -        measure(code, "\na(\"\");", 5, pattern); //to load needed classes, etc.
 136.279 -
 136.280 -        int rep = 1;
 136.281 -        long baseline;
 136.282 -
 136.283 -        while (true) {
 136.284 -            baseline = measure(code, "\na(\"\");", rep, pattern);
 136.285 -
 136.286 -            if (baseline >= 2000) {
 136.287 -                break;
 136.288 -            }
 136.289 -
 136.290 -            rep *= 2;
 136.291 -        }
 136.292 -
 136.293 -        long doubleSize = measure(code, "\na(\"\");", 2 * rep, pattern);
 136.294 -
 136.295 -        assertTrue("baseline=" + baseline + ", actual=" + String.valueOf(doubleSize), doubleSize <= 4 * baseline);
 136.296 -        } catch (OutOfMemoryError oome) {
 136.297 -            //OK
 136.298 -        }
 136.299 -    }
 136.300 -
 136.301 -    public void testMultiParameter1() throws Exception {
 136.302 -        performTest("package test; public class Test { { java.util.Arrays.asList(\"a\", \"b\", \"c\"); } }",
 136.303 -                    Collections.singletonMap("java.util.Arrays.asList($params$)", Arrays.asList("java.util.Arrays.asList(\"a\", \"b\", \"c\")")),
 136.304 -                    Collections.<String>emptyList());
 136.305 -    }
 136.306 -
 136.307 -    public void testMultiParameter2() throws Exception {
 136.308 -        performTest("package test; public class Test { { java.util.Arrays.asList(); } }",
 136.309 -                    Collections.singletonMap("java.util.Arrays.asList($params$)", Arrays.asList("java.util.Arrays.asList()")),
 136.310 -                    Collections.<String>emptyList());
 136.311 -    }
 136.312 -
 136.313 -    public void testTypeParameter() throws Exception {
 136.314 -        performTest("package test; public class Test { { java.util.Arrays.<String>asList(); } }",
 136.315 -                    Collections.singletonMap("java.util.Arrays.<$1>asList($params$)", Arrays.asList("java.util.Arrays.<String>asList()")),
 136.316 -                    Collections.<String>emptyList());
 136.317 -    }
 136.318 -
 136.319 -    public void testField1() throws Exception {
 136.320 -        String code = "package test;\n" +
 136.321 -                       "public class Test {\n" +
 136.322 -                       "     String name = null;\n" +
 136.323 -                       "}\n";
 136.324 -
 136.325 -        performTest(code,
 136.326 -                    Collections.singletonMap("$modifiers$ java.lang.String $name = $initializer;", Arrays.asList("String name = null;")),
 136.327 -                    Collections.<String>emptyList());
 136.328 -    }
 136.329 -
 136.330 -    public void testField2() throws Exception {
 136.331 -        String code = "package test;\n" +
 136.332 -                       "public class Test {\n" +
 136.333 -                       "     private String name = null;\n" +
 136.334 -                       "}\n";
 136.335 -
 136.336 -        performTest(code,
 136.337 -                    Collections.singletonMap("$modifiers$ java.lang.String $name = $initializer;", Arrays.asList("private String name = null;")),
 136.338 -                    Collections.<String>emptyList());
 136.339 -    }
 136.340 -
 136.341 -    public void testMemberSelectWithVariable() throws Exception {
 136.342 -        String code = "package test;\n" +
 136.343 -                      "import java.util.Arrays;\n" +
 136.344 -                      "public class Test {" +
 136.345 -                      "     {\n" +
 136.346 -                      "          foo.bar(0, 3, 4);\n" +
 136.347 -                      "     }\n" +
 136.348 -                      "}\n";
 136.349 -
 136.350 -        performTest(code,
 136.351 -                    Collections.singletonMap("$foo.$bar($p1, $p2$)", Arrays.asList("foo.bar(0, 3, 4)")),
 136.352 -                    Collections.<String>emptyList());
 136.353 -    }
 136.354 -
 136.355 -    public void testCheckIdentifiers1() throws Exception {
 136.356 -        String code = "package test;\n" +
 136.357 -                      "import static java.util.Arrays.*;\n" +
 136.358 -                      "public class Test {" +
 136.359 -                      "     {\n" +
 136.360 -                      "          toString(new int[] {0, 3, 4});\n" +
 136.361 -                      "     }\n" +
 136.362 -                      "}\n";
 136.363 -
 136.364 -        performTest(code,
 136.365 -                    Collections.singletonMap("java.util.Arrays.toString($x)", Arrays.asList("toString(new int[] {0, 3, 4})")),
 136.366 -                    Collections.<String>emptyList());
 136.367 -    }
 136.368 -
 136.369 -    public void testCheckIdentifiers2() throws Exception {
 136.370 -        String code = "package test;\n" +
 136.371 -                      "public class Test {" +
 136.372 -                      "     {\n" +
 136.373 -                      "          toString(new int[] {0, 3, 4});\n" +
 136.374 -                      "     }\n" +
 136.375 -                      "}\n";
 136.376 -
 136.377 -        performTest(code,
 136.378 -                    Collections.<String, List<String>>emptyMap(),
 136.379 -                    Collections.singletonList("java.util.Arrays.toString($x)"));
 136.380 -    }
 136.381 -
 136.382 -    public void testCheckIdentifiers3() throws Exception {
 136.383 -        String code = "package test;\n" +
 136.384 -                      "import static java.util.Arrays.*;\n" +
 136.385 -                      "public class Test {" +
 136.386 -                      "     {\n" +
 136.387 -                      "          Foo.toString(new int[] {0, 3, 4});\n" +
 136.388 -                      "     }\n" +
 136.389 -                      "}\n";
 136.390 -
 136.391 -        performTest(code,
 136.392 -                    Collections.<String, List<String>>emptyMap(),
 136.393 -                    Collections.singletonList("java.util.Arrays.toString($x)"));
 136.394 -    }
 136.395 -
 136.396 -    public void testCheckIdentifiers4() throws Exception {
 136.397 -        String code = "package test;\n" +
 136.398 -                      "public class Test {" +
 136.399 -                      "     {\n" +
 136.400 -                      "          java.util.Arrays.toString(new int[] {0, 3, 4});\n" +
 136.401 -                      "     }\n" +
 136.402 -                      "}\n";
 136.403 -
 136.404 -        performTest(code,
 136.405 -                    Collections.singletonMap("Arrays", Arrays.asList("java.util.Arrays")), //could be imported in the input pattern
 136.406 -                    Collections.<String>emptyList());
 136.407 -    }
 136.408 -
 136.409 -    public void testLambdaInput() throws Exception {
 136.410 -        String code = "package test; public class Test {public void test() { new java.io.FilenameFilter() { public boolean accept(java.io.File dir, String name) { return true; } }; } }";
 136.411 -
 136.412 -        performTest(code,
 136.413 -                    Collections.singletonMap("new $type() {public $retType $name($params$) { $body$; } }", Arrays.asList("new java.io.FilenameFilter() { public boolean accept(java.io.File dir, String name) { return true; } }")),
 136.414 -
 136.415 -                    Collections.<String>emptyList());
 136.416 -    }
 136.417 -
 136.418 -    public void testDoubleCheckedLockingWithVariable() throws Exception {
 136.419 -        String dcl =  "if (o == null) {\n" +
 136.420 -                      "              Object o1 = new Object();\n" +
 136.421 -                      "              synchronized (Test.class) {\n" +
 136.422 -                      "                  if (o == null) {\n" +
 136.423 -                      "                      o = o1;\n" +
 136.424 -                      "                  }\n" +
 136.425 -                      "              }\n" +
 136.426 -                      "          }";
 136.427 -        String code = "package test;\n" +
 136.428 -                      "public class Test {\n" +
 136.429 -                      "     private Object o;\n" +
 136.430 -                      "     private void t() {\n" +
 136.431 -                      "          " + dcl + "\n" +
 136.432 -                      "     }\n" +
 136.433 -                      "}\n";
 136.434 -
 136.435 -        performTest(code,
 136.436 -                    Collections.singletonMap("if ($var == null) {$pref$; synchronized ($lock) { if ($var == null) { $init$; } } }", Arrays.asList(dcl)),
 136.437 -                    Collections.<String>emptyList());
 136.438 -    }
 136.439 -
 136.440 -    public void testMethodName1() throws Exception {
 136.441 -        String code = "package test; public class Test {public void test() { clone(); } }";
 136.442 -
 136.443 -        performTest(code,
 136.444 -                    Collections.<String, List<String>>emptyMap(),
 136.445 -                    Collections.<String>singletonList("public void clone() {$stmts$;}"));
 136.446 -    }
 136.447 -
 136.448 -    public void testMethodName2() throws Exception {
 136.449 -        String code = "package test; public class Test {public void test() { clone(); } }";
 136.450 -
 136.451 -        performTest(code,
 136.452 -                    Collections.singletonMap("public void test() {$stmts$;}", Arrays.asList("public void test() { clone(); }")),
 136.453 -                    Collections.<String>emptyList());
 136.454 -    }
 136.455 -    
 136.456 -    public void testBooleanLiterals() throws Exception {
 136.457 -        String code = "package test; public class Test { public void test() { if (false) { System.err.println(\"false\"); } if (true) { System.err.println(\"true\"); } } }";
 136.458 -
 136.459 -        performTest(code,
 136.460 -                    Collections.singletonMap("if (true) $then; else $else$;", Arrays.asList("if (true) { System.err.println(\"true\"); }")),
 136.461 -                    Collections.<String>emptyList());
 136.462 -    }
 136.463 -    
 136.464 -    public void testEfficientMultiMatching() throws Exception {
 136.465 -        String code = "package test; public class Test { private void m() {} }";
 136.466 -
 136.467 -        performTest(code,
 136.468 -                    Collections.<String, List<String>>emptyMap(),
 136.469 -                    Collections.singletonList("$mods$ class $name implements $i$ { }"));
 136.470 -    }
 136.471 -
 136.472 -    private long measure(String baseCode, String toInsert, int repetitions, String pattern) throws Exception {
 136.473 -        int pos = baseCode.indexOf('|');
 136.474 -
 136.475 -        assertTrue(pos != (-1));
 136.476 -
 136.477 -        baseCode = baseCode.replaceAll(Pattern.quote("|"), "");
 136.478 -        
 136.479 -        StringBuilder code = new StringBuilder(baseCode.length() + repetitions * toInsert.length());
 136.480 -
 136.481 -        code.append(baseCode);
 136.482 -        
 136.483 -        while (repetitions-- > 0) {
 136.484 -            code.insert(pos, toInsert);
 136.485 -        }
 136.486 -
 136.487 -        long startTime = System.currentTimeMillis();
 136.488 -
 136.489 -        performTest(code.toString(),
 136.490 -                    Collections.<String, List<String>>emptyMap(),
 136.491 -                    Arrays.asList(pattern));
 136.492 -
 136.493 -        long endTime = System.currentTimeMillis();
 136.494 -
 136.495 -        return endTime - startTime;
 136.496 -    }
 136.497 -
 136.498 -    public void XtestMeasureTime() throws Exception {
 136.499 -        String code = TestUtilities.copyFileToString(new File("/usr/local/home/lahvac/src/nb//outgoing/java.editor/src/org/netbeans/modules/editor/java/JavaCompletionProvider.java"));
 136.500 -        List<String> patterns = new LinkedList<String>();
 136.501 -
 136.502 -        for (int cntr = 0; cntr < 1000; cntr++) {
 136.503 -            patterns.add("System.err.println($1)");
 136.504 -        }
 136.505 -
 136.506 -        performTest(code,
 136.507 -                    Collections.<String, List<String>>emptyMap(),
 136.508 -                    patterns);
 136.509 -    }
 136.510 -
 136.511 -    public void testMatches1() throws Exception {
 136.512 -        performMatchesTest("package test; public class Test { private void test() { f.isDirectory(); } }", Arrays.asList("$1.isDirectory()", "new ImageIcon($1)"), true);
 136.513 -    }
 136.514 -
 136.515 -    public void testSerialization() throws Exception {
 136.516 -        String text = "package test; public class Test { public void test1(boolean b) { int q; if (b) q = 2; else q = 3; } }";
 136.517 -
 136.518 -        prepareTest("test/Test.java", text);
 136.519 -
 136.520 -        ByteArrayOutputStream out = new ByteArrayOutputStream();
 136.521 -        EncodingContext ec = new EncodingContext(out, false);
 136.522 -
 136.523 -        createSearch().encode(info.getCompilationUnit(), ec, new AtomicBoolean());
 136.524 -        
 136.525 -        boolean matches = createSearch().matches(new ByteArrayInputStream(out.toByteArray()), new AtomicBoolean(), createSearch().create(info, new AtomicBoolean(), "{ $p$; $T $v; if($a) $v = $b; else $v = $c; $q$; }"));
 136.526 -
 136.527 -        assertTrue(matches);
 136.528 -    }
 136.529 -
 136.530 -    public void testFrequencies() throws Exception {
 136.531 -        String text = "package test; public class Test { public void test1(boolean b) { java.io.File f = null; f.isDirectory(); f.isDirectory(); new javax.swing.ImageIcon(null); } }";
 136.532 -
 136.533 -        prepareTest("test/Test.java", text);
 136.534 -
 136.535 -        ByteArrayOutputStream out = new ByteArrayOutputStream();
 136.536 -        EncodingContext ec = new EncodingContext(out, false);
 136.537 -
 136.538 -        createSearch().encode(info.getCompilationUnit(), ec, new AtomicBoolean());
 136.539 -        
 136.540 -        Map<String, Integer> actual = createSearch().matchesWithFrequencies(new ByteArrayInputStream(out.toByteArray()), createSearch().create(info, new AtomicBoolean(), "$1.isDirectory()", "new ImageIcon($1)"), new AtomicBoolean());
 136.541 -        Map<String, Integer> golden = new HashMap<String, Integer>();
 136.542 -
 136.543 -        golden.put("$1.isDirectory()", 2);
 136.544 -        golden.put("new ImageIcon($1)", 1);
 136.545 -
 136.546 -        assertEquals(golden, actual);
 136.547 -    }
 136.548 -
 136.549 -    public void testPatternEncodingAndIdentifiers() throws Exception {
 136.550 -        String text = "package test; public class Test { }";
 136.551 -
 136.552 -        prepareTest("test/Test.java", text);
 136.553 -
 136.554 -        BulkPattern bp = createSearch().create(info, new AtomicBoolean(), "$0.isDirectory()");
 136.555 -
 136.556 -        assertEquals(Arrays.asList(new HashSet<String>(Arrays.asList("isDirectory"))), bp.getIdentifiers());
 136.557 -        //TODO: the actual code for kinds differs for NFABased search and REBased search:
 136.558 -//        assertEquals(Arrays.asList(new HashSet<String>(Arrays.asList(Kind.METHOD_INVOCATION.name()))), bp.getKinds());
 136.559 -    }
 136.560 -    
 136.561 -    public void testModifiersMultiVariable() throws Exception {
 136.562 -        String code = "package test;\n" +
 136.563 -                       "public class Test {\n" +
 136.564 -                       "     @Deprecated @Override public Test test;\n" +
 136.565 -                       "}\n";
 136.566 -
 136.567 -        performTest(code,
 136.568 -                    Collections.singletonMap("$mods$ @Deprecated public $type $name = $init$;", Arrays.asList("@Deprecated @Override public Test test;")),
 136.569 -                    Collections.<String>emptyList());
 136.570 -    }
 136.571 -
 136.572 -    protected abstract BulkSearch createSearch();
 136.573 -    
 136.574 -    private void performMatchesTest(String text, List<String> patterns, boolean golden) throws Exception {
 136.575 -        prepareTest("test/Test.java", text);
 136.576 -
 136.577 -        BulkPattern p = createSearch().create(info, new AtomicBoolean(), patterns);
 136.578 -
 136.579 -        boolean result = createSearch().matches(info, new AtomicBoolean(), new TreePath(info.getCompilationUnit()), p);
 136.580 -
 136.581 -        assertEquals(golden, result);
 136.582 -    }
 136.583 -    
 136.584 -    private void performTest(String text, Map<String, List<String>> containedPatterns, Collection<String> notContainedPatterns) throws Exception {
 136.585 -        prepareTest("test/Test.java", text);
 136.586 -
 136.587 -        List<String> patterns = new LinkedList<String>();
 136.588 -
 136.589 -        patterns.addAll(containedPatterns.keySet());
 136.590 -        patterns.addAll(notContainedPatterns);
 136.591 -
 136.592 -        long s1 = System.currentTimeMillis();
 136.593 -        BulkPattern p = createSearch().create(info, new AtomicBoolean(), patterns);
 136.594 -        long e1 = System.currentTimeMillis();
 136.595 -
 136.596 -//        System.err.println("create: " + (e1 - s1));
 136.597 -
 136.598 -        long s2 = System.currentTimeMillis();
 136.599 -        Map<String, Collection<TreePath>> result = createSearch().match(info, new AtomicBoolean(), new TreePath(info.getCompilationUnit()), p);
 136.600 -        long e2 = System.currentTimeMillis();
 136.601 -
 136.602 -//        System.err.println("match: " + (e2 - s2));
 136.603 -
 136.604 -        assertTrue(result.toString(), result.keySet().containsAll(containedPatterns.keySet()));
 136.605 -
 136.606 -        for (Entry<String, Collection<TreePath>> e : result.entrySet()) {
 136.607 -            List<String> actual = new LinkedList<String>();
 136.608 -
 136.609 -            for (TreePath tp : e.getValue()) {
 136.610 -                assertNotNull(TreePathHandle.create(tp, info).resolve(info));
 136.611 -                
 136.612 -                int start = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), tp.getLeaf());
 136.613 -                int end   = (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), tp.getLeaf());
 136.614 -
 136.615 -                actual.add(info.getText().substring(start, end));
 136.616 -            }
 136.617 -
 136.618 -            assertEquals(e.getKey(), containedPatterns.get(e.getKey()), actual);
 136.619 -        }
 136.620 -
 136.621 -
 136.622 -        Set<String> none = new HashSet<String>(result.keySet());
 136.623 -
 136.624 -        none.retainAll(notContainedPatterns);
 136.625 -
 136.626 -        assertTrue(none.isEmpty());
 136.627 -
 136.628 -        if (!verifyIndexingData())
 136.629 -            return ;
 136.630 -        
 136.631 -        //ensure the returned identifiers/treeKinds are correct:
 136.632 -        ByteArrayOutputStream data = new ByteArrayOutputStream();
 136.633 -        EncodingContext ec = new EncodingContext(data, false);
 136.634 -        
 136.635 -        createSearch().encode(info.getCompilationUnit(), ec, new AtomicBoolean());
 136.636 -
 136.637 -        for (int i = 0; i < containedPatterns.size(); i++) {
 136.638 -            assertTrue("expected: " + p.getIdentifiers().get(i) + ", but exist only: " + ec.getIdentifiers(), ec.getIdentifiers().containsAll(p.getIdentifiers().get(i)));
 136.639 -            
 136.640 -            for (List<String> phrase : p.getRequiredContent().get(i)) {
 136.641 -                assertTrue("expected: " + phrase + ", but exist only: " + ec.getContent() + "(all phrases: " + p.getRequiredContent().get(i) + ")", Collections.indexOfSubList(ec.getContent(), phrase) != (-1));
 136.642 -            }
 136.643 -        }
 136.644 -
 136.645 -        data.close();
 136.646 -        assertEquals(!containedPatterns.isEmpty(), createSearch().matches(new ByteArrayInputStream(data.toByteArray()), new AtomicBoolean(), p));
 136.647 -    }
 136.648 -    
 136.649 -    private void prepareTest(String fileName, String code) throws Exception {
 136.650 -        clearWorkDir();
 136.651 -
 136.652 -        FileUtil.refreshFor(File.listRoots());
 136.653 -
 136.654 -        FileObject workFO = FileUtil.toFileObject(getWorkDir());
 136.655 -
 136.656 -        assertNotNull(workFO);
 136.657 -
 136.658 -        workFO.refresh();
 136.659 -
 136.660 -        sourceRoot = workFO.createFolder("src");
 136.661 -        FileObject buildRoot  = workFO.createFolder("build");
 136.662 -        FileObject cache = workFO.createFolder("cache");
 136.663 -
 136.664 -        FileObject data = FileUtil.createData(sourceRoot, fileName);
 136.665 -        File dataFile = FileUtil.toFile(data);
 136.666 -
 136.667 -        assertNotNull(dataFile);
 136.668 -
 136.669 -        TestUtilities.copyStringToFile(dataFile, code);
 136.670 -
 136.671 -        SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache);
 136.672 -
 136.673 -        DataObject od = DataObject.find(data);
 136.674 -        EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
 136.675 -
 136.676 -        assertNotNull(ec);
 136.677 -
 136.678 -        doc = ec.openDocument();
 136.679 -        doc.putProperty(Language.class, JavaTokenId.language());
 136.680 -
 136.681 -        JavaSource js = JavaSource.forFileObject(data);
 136.682 -
 136.683 -        assertNotNull(js);
 136.684 -
 136.685 -        info = SourceUtilsTestUtil.getCompilationInfo(js, Phase.RESOLVED);
 136.686 -
 136.687 -        assertNotNull(info);
 136.688 -    }
 136.689 -
 136.690 -    private FileObject sourceRoot;
 136.691 -    private CompilationInfo info;
 136.692 -    private Document doc;
 136.693 -
 136.694 -    protected boolean verifyIndexingData() {
 136.695 -        return true;
 136.696 -    }
 136.697 -}
   137.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/CopyFinderBasedBulkSearchTest.java	Sun Jan 08 20:10:08 2017 +0100
   137.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   137.3 @@ -1,99 +0,0 @@
   137.4 -/*
   137.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   137.6 - *
   137.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   137.8 - *
   137.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  137.10 - * Other names may be trademarks of their respective owners.
  137.11 - *
  137.12 - * The contents of this file are subject to the terms of either the GNU
  137.13 - * General Public License Version 2 only ("GPL") or the Common
  137.14 - * Development and Distribution License("CDDL") (collectively, the
  137.15 - * "License"). You may not use this file except in compliance with the
  137.16 - * License. You can obtain a copy of the License at
  137.17 - * http://www.netbeans.org/cddl-gplv2.html
  137.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  137.19 - * specific language governing permissions and limitations under the
  137.20 - * License.  When distributing the software, include this License Header
  137.21 - * Notice in each file and include the License file at
  137.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  137.23 - * particular file as subject to the "Classpath" exception as provided
  137.24 - * by Oracle in the GPL Version 2 section of the License file that
  137.25 - * accompanied this code. If applicable, add the following below the
  137.26 - * License Header, with the fields enclosed by brackets [] replaced by
  137.27 - * your own identifying information:
  137.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  137.29 - *
  137.30 - * If you wish your version of this file to be governed by only the CDDL
  137.31 - * or only the GPL Version 2, indicate your decision by adding
  137.32 - * "[Contributor] elects to include this software in this distribution
  137.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  137.34 - * single choice of license, a recipient has the option to distribute
  137.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  137.36 - * to extend the choice of license to its licensees as provided above.
  137.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  137.38 - * Version 2 license, then the option applies only if the new code is
  137.39 - * made subject to such option by the copyright holder.
  137.40 - *
  137.41 - * Contributor(s):
  137.42 - *
  137.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
  137.44 - */
  137.45 -
  137.46 -package org.netbeans.modules.java.hints.spiimpl.pm;
  137.47 -
  137.48 -/**
  137.49 - *
  137.50 - * @author lahvac
  137.51 - */
  137.52 -public class CopyFinderBasedBulkSearchTest extends BulkSearchTestPerformer {
  137.53 -
  137.54 -    public CopyFinderBasedBulkSearchTest(String name) {
  137.55 -        super(name);
  137.56 -    }
  137.57 -
  137.58 -    @Override
  137.59 -    protected BulkSearch createSearch() {
  137.60 -        return new CopyFinderBasedBulkSearch();
  137.61 -    }
  137.62 -
  137.63 -    @Override
  137.64 -    protected boolean verifyIndexingData() {
  137.65 -        return false;
  137.66 -    }
  137.67 -
  137.68 -    @Override
  137.69 -    public void testSerialization() throws Exception {
  137.70 -        //XXX
  137.71 -    }
  137.72 -
  137.73 -    @Override
  137.74 -    public void testFrequencies() throws Exception {
  137.75 -        //XXX: serialization is a prerequisite
  137.76 -    }
  137.77 -
  137.78 -    @Override
  137.79 -    public void testPatternEncodingAndIdentifiers() throws Exception {
  137.80 -        //XXX
  137.81 -    }
  137.82 -
  137.83 -    @Override
  137.84 -    public void testNoExponentialTimeComplexity() throws Exception {
  137.85 -        //XXX
  137.86 -    }
  137.87 -
  137.88 -    @Override
  137.89 -    public void testCheckIdentifiers2() throws Exception {
  137.90 -        //not critical, only improves performance on vast amounts of sources,
  137.91 -        //and NFA based search is used in such case anyway.
  137.92 -        //XXX
  137.93 -    }
  137.94 -
  137.95 -    @Override
  137.96 -    public void testCheckIdentifiers3() throws Exception {
  137.97 -        //not critical, only improves performance on vast amounts of sources,
  137.98 -        //and NFA based search is used in such case anyway.
  137.99 -        //XXX
 137.100 -    }
 137.101 -
 137.102 -}
 137.103 \ No newline at end of file
   138.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/NFABasedBulkSearchTest.java	Sun Jan 08 20:10:08 2017 +0100
   138.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   138.3 @@ -1,69 +0,0 @@
   138.4 -/*
   138.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   138.6 - *
   138.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
   138.8 - *
   138.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  138.10 - * Other names may be trademarks of their respective owners.
  138.11 - *
  138.12 - * The contents of this file are subject to the terms of either the GNU
  138.13 - * General Public License Version 2 only ("GPL") or the Common
  138.14 - * Development and Distribution License("CDDL") (collectively, the
  138.15 - * "License"). You may not use this file except in compliance with the
  138.16 - * License. You can obtain a copy of the License at
  138.17 - * http://www.netbeans.org/cddl-gplv2.html
  138.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  138.19 - * specific language governing permissions and limitations under the
  138.20 - * License.  When distributing the software, include this License Header
  138.21 - * Notice in each file and include the License file at
  138.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  138.23 - * particular file as subject to the "Classpath" exception as provided
  138.24 - * by Oracle in the GPL Version 2 section of the License file that
  138.25 - * accompanied this code. If applicable, add the following below the
  138.26 - * License Header, with the fields enclosed by brackets [] replaced by
  138.27 - * your own identifying information:
  138.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  138.29 - *
  138.30 - * If you wish your version of this file to be governed by only the CDDL
  138.31 - * or only the GPL Version 2, indicate your decision by adding
  138.32 - * "[Contributor] elects to include this software in this distribution
  138.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  138.34 - * single choice of license, a recipient has the option to distribute
  138.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  138.36 - * to extend the choice of license to its licensees as provided above.
  138.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  138.38 - * Version 2 license, then the option applies only if the new code is
  138.39 - * made subject to such option by the copyright holder.
  138.40 - *
  138.41 - * Contributor(s):
  138.42 - *
  138.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  138.44 - */
  138.45 -
  138.46 -package org.netbeans.modules.java.hints.spiimpl.pm;
  138.47 -
  138.48 -/**
  138.49 - *
  138.50 - * @author lahvac
  138.51 - */
  138.52 -public class NFABasedBulkSearchTest extends BulkSearchTestPerformer {
  138.53 -
  138.54 -    public NFABasedBulkSearchTest(String name) {
  138.55 -        super(name);
  138.56 -    }
  138.57 -
  138.58 -//    public static TestSuite suite() {
  138.59 -//        NbTestSuite r = new NbTestSuite();
  138.60 -//
  138.61 -//        r.addTest(new NFABasedBulkSearchTest("testField1"));
  138.62 -//        r.addTest(new NFABasedBulkSearchTest("testField2"));
  138.63 -//
  138.64 -//        return r;
  138.65 -//    }
  138.66 -
  138.67 -    @Override
  138.68 -    protected BulkSearch createSearch() {
  138.69 -        return new NFABasedBulkSearch();
  138.70 -    }
  138.71 -
  138.72 -}
   139.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/PatternCompilerTest.java	Sun Jan 08 20:10:08 2017 +0100
   139.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   139.3 @@ -1,203 +0,0 @@
   139.4 -/*
   139.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   139.6 - *
   139.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   139.8 - *
   139.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  139.10 - * Other names may be trademarks of their respective owners.
  139.11 - *
  139.12 - * The contents of this file are subject to the terms of either the GNU
  139.13 - * General Public License Version 2 only ("GPL") or the Common
  139.14 - * Development and Distribution License("CDDL") (collectively, the
  139.15 - * "License"). You may not use this file except in compliance with the
  139.16 - * License. You can obtain a copy of the License at
  139.17 - * http://www.netbeans.org/cddl-gplv2.html
  139.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  139.19 - * specific language governing permissions and limitations under the
  139.20 - * License.  When distributing the software, include this License Header
  139.21 - * Notice in each file and include the License file at
  139.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  139.23 - * particular file as subject to the "Classpath" exception as provided
  139.24 - * by Oracle in the GPL Version 2 section of the License file that
  139.25 - * accompanied this code. If applicable, add the following below the
  139.26 - * License Header, with the fields enclosed by brackets [] replaced by
  139.27 - * your own identifying information:
  139.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  139.29 - *
  139.30 - * If you wish your version of this file to be governed by only the CDDL
  139.31 - * or only the GPL Version 2, indicate your decision by adding
  139.32 - * "[Contributor] elects to include this software in this distribution
  139.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  139.34 - * single choice of license, a recipient has the option to distribute
  139.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  139.36 - * to extend the choice of license to its licensees as provided above.
  139.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  139.38 - * Version 2 license, then the option applies only if the new code is
  139.39 - * made subject to such option by the copyright holder.
  139.40 - *
  139.41 - * Contributor(s):
  139.42 - *
  139.43 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
  139.44 - */
  139.45 -
  139.46 -package org.netbeans.modules.java.hints.spiimpl.pm;
  139.47 -
  139.48 -import com.sun.source.tree.Tree;
  139.49 -import com.sun.source.util.SourcePositions;
  139.50 -import com.sun.source.util.TreePath;
  139.51 -import java.util.Arrays;
  139.52 -import java.util.HashMap;
  139.53 -import java.util.Iterator;
  139.54 -import java.util.Map;
  139.55 -import java.util.Map.Entry;
  139.56 -import java.util.concurrent.atomic.AtomicBoolean;
  139.57 -import org.netbeans.modules.java.hints.spiimpl.TestBase;
  139.58 -import org.netbeans.api.java.source.matching.Matcher;
  139.59 -import org.netbeans.api.java.source.matching.Occurrence;
  139.60 -import org.openide.util.Pair;
  139.61 -
  139.62 -/**
  139.63 - *
  139.64 - * @author Jan Lahoda
  139.65 - */
  139.66 -public class PatternCompilerTest extends TestBase {
  139.67 -
  139.68 -    public PatternCompilerTest(String name) {
  139.69 -        super(name);
  139.70 -    }
  139.71 -
  139.72 -    public void testSimple1() throws Exception {
  139.73 -        performVariablesTest("package test; public class Test {public void test() {int i = |1 + 2|;}}", "$1+$2",
  139.74 -                             Pair.<String, String>of("$1", "1"),
  139.75 -                             Pair.<String, String>of("$2", "2"));
  139.76 -    }
  139.77 -
  139.78 -    public void testTyped1() throws Exception {
  139.79 -        performVariablesTest("package test; public class Test {public void test() {|String.valueOf(\"t\")|;}}", "String.valueOf($1{String})",
  139.80 -                             Pair.<String, String>of("$1", "\"t\""));
  139.81 -    }
  139.82 -
  139.83 -//    public void testTyped2() throws Exception {
  139.84 -//        performVariablesTest("package test; public class Test {public void test() {|String.valueOf(\"t\")|;}}", "$2{java.lang.String}.valueOf($1{String})",
  139.85 -//                             new Pair<String, String>("$1", "\"t\""),
  139.86 -//                             new Pair<String, String>("$2", "String"));
  139.87 -//    }
  139.88 -
  139.89 -    public void testTyped3() throws Exception {
  139.90 -        performVariablesTest("package test; public class Test {public void test(String str) {|str.valueOf(\"t\")|;}}", "String.valueOf($1{String})",
  139.91 -                             Pair.<String, String>of("$1", "\"t\""));
  139.92 -    }
  139.93 -
  139.94 -    public void testTyped4() throws Exception {
  139.95 -        performVariablesTest("package test; public class Test {public void test() {|Integer.bitCount(1)|;}}", "$2{java.lang.String}.valueOf($1{String})",
  139.96 -                             (Pair[]) null);
  139.97 -    }
  139.98 -
  139.99 -    public void testTyped5() throws Exception {
 139.100 -        performVariablesTest("package test; public class Test {public void test() {java.io.File f = null; |f.toURI().toURL()|;}}", "$1{java.io.File}.toURL()",
 139.101 -                             (Pair[]) null);
 139.102 -    }
 139.103 -
 139.104 -    public void testTypedPrimitiveType() throws Exception {
 139.105 -        performVariablesTest("package test; public class Test {public void test(int i) {|test(1)|;}}", "$0{test.Test}.test($1{int})",
 139.106 -                             Pair.<String, String>of("$1", "1"));
 139.107 -    }
 139.108 -
 139.109 -    public void testMemberSelectVSIdentifier() throws Exception {
 139.110 -        performVariablesTest("package test; public class Test {void test1() {} void test2() {|test1()|;}}", "$1{test.Test}.test1()",
 139.111 -                             new Pair[0]);
 139.112 -    }
 139.113 -
 139.114 -    public void testSubClass() throws Exception {
 139.115 -        performVariablesTest("package test; public class Test {void test() {String s = null; |s.toString()|;}}", "$1{java.lang.CharSequence}.toString()",
 139.116 -                             Pair.<String, String>of("$1", "s"));
 139.117 -    }
 139.118 -
 139.119 -    public void testEquality1() throws Exception {
 139.120 -        performVariablesTest("package test; public class Test {void test() {|test()|;}}", "$1{test.Test}.test()",
 139.121 -                             new Pair[0]);
 139.122 -    }
 139.123 -
 139.124 -    public void testEquality2() throws Exception {
 139.125 -        performVariablesTest("package test; public class Test {void test() {String s = null; |String.valueOf(1).charAt(0)|;}}", "$1{java.lang.String}.charAt(0)",
 139.126 -                             Pair.<String, String>of("$1", "String.valueOf(1)"));
 139.127 -    }
 139.128 -
 139.129 -    public void testEquality3() throws Exception {
 139.130 -        performVariablesTest("package test; public class Test {void test() {String s = null; |s.charAt(0)|;}}", "java.lang.String.valueOf(1).charAt(0)",
 139.131 -                             (Pair[]) null);
 139.132 -    }
 139.133 -
 139.134 -    public void testType1() throws Exception {
 139.135 -        performVariablesTest("package test; public class Test {void test() {|String| s;}}", "java.lang.String",
 139.136 -                             new Pair[0]);
 139.137 -    }
 139.138 -
 139.139 -    public void testStatements1() throws Exception {
 139.140 -        performVariablesTest("package test; public class Test {void test() {|assert true : \"\";|}}", "assert $1{boolean} : $2{java.lang.Object};",
 139.141 -                             new Pair[0]);
 139.142 -    }
 139.143 -
 139.144 -    protected void performVariablesTest(String code, String pattern, Pair<String, String>... duplicates) throws Exception {
 139.145 -        String[] split = code.split("\\|");
 139.146 -
 139.147 -        assertEquals(Arrays.toString(split), 3, split.length);
 139.148 -
 139.149 -        int      start = split[0].length();
 139.150 -        int      end   = start + split[1].length();
 139.151 -
 139.152 -        code = split[0] + split[1] + split[2];
 139.153 -
 139.154 -        prepareTest("test/Test.java", code);
 139.155 -
 139.156 -        TreePath tp = info.getTreeUtilities().pathFor((start + end) / 2);
 139.157 -
 139.158 -        while (tp != null) {
 139.159 -            Tree t = tp.getLeaf();
 139.160 -            SourcePositions sp = info.getTrees().getSourcePositions();
 139.161 -
 139.162 -            if (   start == sp.getStartPosition(info.getCompilationUnit(), t)
 139.163 -                && end   == sp.getEndPosition(info.getCompilationUnit(), t)) {
 139.164 -                break;
 139.165 -            }
 139.166 -
 139.167 -            tp = tp.getParentPath();
 139.168 -        }
 139.169 -
 139.170 -        assertNotNull(tp);
 139.171 -
 139.172 -        //XXX:
 139.173 -        Iterator<? extends Occurrence> vars = Matcher.create(info).setCancel(new AtomicBoolean()).setSearchRoot(tp).setTreeTopSearch().match(PatternCompilerUtilities.compile(info, pattern)).iterator();
 139.174 -
 139.175 -        if (duplicates == null) {
 139.176 -            assertFalse(vars.hasNext());
 139.177 -            return ;
 139.178 -        }
 139.179 -
 139.180 -        assertNotNull(vars);
 139.181 -        assertTrue(vars.hasNext());
 139.182 -
 139.183 -        Map<String, String> actual = new HashMap<String, String>();
 139.184 -
 139.185 -        for (Entry<String, TreePath> e : vars.next().getVariables().entrySet()) {
 139.186 -            int[] span = new int[] {
 139.187 -                (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), e.getValue().getLeaf()),
 139.188 -                (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), e.getValue().getLeaf())
 139.189 -            };
 139.190 -
 139.191 -            actual.put(e.getKey(), info.getText().substring(span[0], span[1]));
 139.192 -        }
 139.193 -
 139.194 -        assertFalse(vars.hasNext());
 139.195 -
 139.196 -        for (Pair<String, String> dup : duplicates) {
 139.197 -            String span = actual.remove(dup.first());
 139.198 -
 139.199 -            if (span == null) {
 139.200 -                fail(dup.first());
 139.201 -            }
 139.202 -            assertEquals(dup.first()+ ":" + span, span, dup.second());
 139.203 -        }
 139.204 -    }
 139.205 -
 139.206 -}
   140.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/pm/PatternCompilerUtilities.java	Sun Jan 08 20:10:08 2017 +0100
   140.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   140.3 @@ -1,88 +0,0 @@
   140.4 -/*
   140.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   140.6 - *
   140.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
   140.8 - *
   140.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  140.10 - * Other names may be trademarks of their respective owners.
  140.11 - *
  140.12 - * The contents of this file are subject to the terms of either the GNU
  140.13 - * General Public License Version 2 only ("GPL") or the Common
  140.14 - * Development and Distribution License("CDDL") (collectively, the
  140.15 - * "License"). You may not use this file except in compliance with the
  140.16 - * License. You can obtain a copy of the License at
  140.17 - * http://www.netbeans.org/cddl-gplv2.html
  140.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  140.19 - * specific language governing permissions and limitations under the
  140.20 - * License.  When distributing the software, include this License Header
  140.21 - * Notice in each file and include the License file at
  140.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  140.23 - * particular file as subject to the "Classpath" exception as provided
  140.24 - * by Oracle in the GPL Version 2 section of the License file that
  140.25 - * accompanied this code. If applicable, add the following below the
  140.26 - * License Header, with the fields enclosed by brackets [] replaced by
  140.27 - * your own identifying information:
  140.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  140.29 - *
  140.30 - * If you wish your version of this file to be governed by only the CDDL
  140.31 - * or only the GPL Version 2, indicate your decision by adding
  140.32 - * "[Contributor] elects to include this software in this distribution
  140.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  140.34 - * single choice of license, a recipient has the option to distribute
  140.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  140.36 - * to extend the choice of license to its licensees as provided above.
  140.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  140.38 - * Version 2 license, then the option applies only if the new code is
  140.39 - * made subject to such option by the copyright holder.
  140.40 - *
  140.41 - * Contributor(s):
  140.42 - *
  140.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
  140.44 - */
  140.45 -package org.netbeans.modules.java.hints.spiimpl.pm;
  140.46 -
  140.47 -import java.util.Collections;
  140.48 -import java.util.HashMap;
  140.49 -import java.util.Map;
  140.50 -import java.util.regex.Matcher;
  140.51 -import javax.lang.model.type.TypeMirror;
  140.52 -import org.netbeans.api.java.source.CompilationInfo;
  140.53 -import org.netbeans.modules.java.hints.spiimpl.pm.PatternCompiler;
  140.54 -import org.netbeans.api.java.source.matching.Pattern;
  140.55 -import org.netbeans.modules.java.hints.spiimpl.Hacks;
  140.56 -
  140.57 -/**
  140.58 - *
  140.59 - * @author lahvac
  140.60 - */
  140.61 -public class PatternCompilerUtilities {
  140.62 -
  140.63 -    public static Pattern compile(CompilationInfo info, String pattern) {
  140.64 -        Map<String, TypeMirror> constraints = new HashMap<String, TypeMirror>();
  140.65 -        pattern = parseOutTypesFromPattern(info, pattern, constraints);
  140.66 -
  140.67 -        return PatternCompiler.compile(info, pattern, constraints, Collections.<String>emptyList());
  140.68 -    }
  140.69 -
  140.70 -    public static String parseOutTypesFromPattern(CompilationInfo info, String pattern, Map<String, TypeMirror> variablesToTypes) {
  140.71 -        java.util.regex.Pattern p = java.util.regex.Pattern.compile("(\\$[0-9])(\\{([^}]*)\\})?");
  140.72 -        StringBuilder filtered = new StringBuilder();
  140.73 -        Matcher m = p.matcher(pattern);
  140.74 -        int i = 0;
  140.75 -
  140.76 -        while (m.find()) {
  140.77 -            filtered.append(pattern.substring(i, m.start()));
  140.78 -            i = m.end();
  140.79 -
  140.80 -            String var  = m.group(1);
  140.81 -            String type = m.group(3);
  140.82 -
  140.83 -            filtered.append(var);
  140.84 -            variablesToTypes.put(var, type != null ? Hacks.parseFQNType(info, type) : null);
  140.85 -        }
  140.86 -
  140.87 -        filtered.append(pattern.substring(i));
  140.88 -
  140.89 -        return filtered.toString();
  140.90 -    }
  140.91 -}
   141.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/modules/java/hints/spiimpl/processor/JavaHintsAnnotationProcessorTest.java	Sun Jan 08 20:10:08 2017 +0100
   141.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   141.3 @@ -1,149 +0,0 @@
   141.4 -/*
   141.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   141.6 - *
   141.7 - * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
   141.8 - *
   141.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  141.10 - * Other names may be trademarks of their respective owners.
  141.11 - *
  141.12 - * The contents of this file are subject to the terms of either the GNU
  141.13 - * General Public License Version 2 only ("GPL") or the Common
  141.14 - * Development and Distribution License("CDDL") (collectively, the
  141.15 - * "License"). You may not use this file except in compliance with the
  141.16 - * License. You can obtain a copy of the License at
  141.17 - * http://www.netbeans.org/cddl-gplv2.html
  141.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  141.19 - * specific language governing permissions and limitations under the
  141.20 - * License.  When distributing the software, include this License Header
  141.21 - * Notice in each file and include the License file at
  141.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  141.23 - * particular file as subject to the "Classpath" exception as provided
  141.24 - * by Oracle in the GPL Version 2 section of the License file that
  141.25 - * accompanied this code. If applicable, add the following below the
  141.26 - * License Header, with the fields enclosed by brackets [] replaced by
  141.27 - * your own identifying information:
  141.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  141.29 - *
  141.30 - * If you wish your version of this file to be governed by only the CDDL
  141.31 - * or only the GPL Version 2, indicate your decision by adding
  141.32 - * "[Contributor] elects to include this software in this distribution
  141.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  141.34 - * single choice of license, a recipient has the option to distribute
  141.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  141.36 - * to extend the choice of license to its licensees as provided above.
  141.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  141.38 - * Version 2 license, then the option applies only if the new code is
  141.39 - * made subject to such option by the copyright holder.
  141.40 - *
  141.41 - * Contributor(s):
  141.42 - *
  141.43 - * Portions Copyrighted 2012 Sun Microsystems, Inc.
  141.44 - */
  141.45 -package org.netbeans.modules.java.hints.spiimpl.processor;
  141.46 -
  141.47 -import java.io.ByteArrayOutputStream;
  141.48 -import java.io.File;
  141.49 -import org.netbeans.junit.NbTestCase;
  141.50 -import org.openide.util.test.AnnotationProcessorTestUtils;
  141.51 -import org.openide.util.test.TestFileUtils;
  141.52 -
  141.53 -/**
  141.54 - *
  141.55 - * @author lahvac
  141.56 - */
  141.57 -public class JavaHintsAnnotationProcessorTest extends NbTestCase {
  141.58 -
  141.59 -    public JavaHintsAnnotationProcessorTest(String name) {
  141.60 -        super(name);
  141.61 -    }
  141.62 -
  141.63 -    public void testErrors1() throws Exception {
  141.64 -        File src = new File(getWorkDir(), "src");
  141.65 -        File dest = new File(getWorkDir(), "classes");
  141.66 -        AnnotationProcessorTestUtils.makeSource(src, "p.H",
  141.67 -                "import org.netbeans.spi.java.hints.*;\n",
  141.68 -                "import org.netbeans.spi.editor.hints.*;\n",
  141.69 -                "@Hint(displayName=\"\", description=\"\", category=\"general\")\n",
  141.70 -                "public class H {\n",
  141.71 -                "    @TriggerPattern(\"$1.$2\")\n",
  141.72 -                "    public static String h1(HintContext ctx) { return null;}\n",
  141.73 -                "    @TriggerPattern(\"$1.$2.$3\")\n",
  141.74 -                "    public static ErrorDescription h2() { return null;}\n",
  141.75 -                "    @TriggerPatterns({@TriggerPattern(\"$1.$2.$3.$4\")})\n",
  141.76 -                "    private ErrorDescription h3(HintContext ctx) { return null;}\n",
  141.77 -                "    @TriggerPattern(value=\"$1.isEmpty()\", constraints=@ConstraintVariableType(variable=\"$unknown\", type=\"java.lang.String\"))\n",
  141.78 -                "    public static ErrorDescription h4(HintContext ctx) { return null;}\n",
  141.79 -                "}\n");
  141.80 -        TestFileUtils.writeFile(new File(src, "p/Bundle.properties"), "");
  141.81 -        ByteArrayOutputStream err = new ByteArrayOutputStream();
  141.82 -        assertFalse(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, err));
  141.83 -        String errors = err.toString();
  141.84 -        assertTrue(errors.contains("error: The return type must be either org.netbeans.spi.editor.hints.ErrorDescription or java.util.List<org.netbeans.spi.editor.hints.ErrorDescription>"));
  141.85 -        assertTrue(errors.contains("error: The method must have exactly one parameter of type org.netbeans.spi.java.hints.HintContext"));
  141.86 -        assertTrue(errors.contains("error: The method must be static"));
  141.87 -        assertTrue(errors.contains("warning: Variable $unknown not used in the pattern"));
  141.88 -    }
  141.89 -
  141.90 -    public void testErrors2() throws Exception {
  141.91 -        File src = new File(getWorkDir(), "src");
  141.92 -        File dest = new File(getWorkDir(), "classes");
  141.93 -        AnnotationProcessorTestUtils.makeSource(src, "p.H",
  141.94 -                "import org.netbeans.spi.java.hints.*;\n",
  141.95 -                "import org.netbeans.spi.editor.hints.*;\n",
  141.96 -                "import java.util.*;\n",
  141.97 -                "@Hint(displayName=\"#DN_p.H\", description=\"#DESC_p.H\", category=\"general\")\n",
  141.98 -                "public class H {\n",
  141.99 -                "    @TriggerPattern(\"$1.$2.$3\")\n",
 141.100 -                "    public static List<ErrorDescription> hint(HintContext ctx) { return null;}\n",
 141.101 -                "}\n");
 141.102 -        TestFileUtils.writeFile(new File(src, "p/Bundle.properties"), "DN_p.H=DN_p.H\nDESC_p.H=DESC_p.H\n");
 141.103 -        ByteArrayOutputStream err = new ByteArrayOutputStream();
 141.104 -        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, err));
 141.105 -    }
 141.106 -
 141.107 -    public void testCustomizerProvider() throws Exception {
 141.108 -        File src = new File(getWorkDir(), "src");
 141.109 -        File dest = new File(getWorkDir(), "classes");
 141.110 -        AnnotationProcessorTestUtils.makeSource(src, "p.H",
 141.111 -                "import org.netbeans.spi.java.hints.*;\n",
 141.112 -                "import org.netbeans.spi.editor.hints.*;\n",
 141.113 -                "import java.util.*;\n",
 141.114 -                "import java.util.prefs.*;\n",
 141.115 -                "import javax.swing.*;\n",
 141.116 -                "@Hint(displayName=\"dn\", description=\"desc\", category=\"general\", customizerProvider=H.Customizer.class)\n",
 141.117 -                "public class H {\n",
 141.118 -                "    @TriggerPattern(\"$1.$2.$3\")\n",
 141.119 -                "    public static List<ErrorDescription> hint(HintContext ctx) { return null;}\n",
 141.120 -                "    static final class Customizer implements CustomizerProvider {\n",
 141.121 -                "        @Override public JComponent getCustomizer(Preferences prefs) {\n",
 141.122 -                "            return new JPanel();\n",
 141.123 -                "        }\n",
 141.124 -                "    }\n",
 141.125 -                "}\n");
 141.126 -        TestFileUtils.writeFile(new File(src, "p/Bundle.properties"), "DN_p.H=DN_p.H\nDESC_p.H=DESC_p.H\n");
 141.127 -        ByteArrayOutputStream err = new ByteArrayOutputStream();
 141.128 -        assertFalse(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, err));
 141.129 -        String errors = err.toString();
 141.130 -        assertTrue(errors.contains("error: Customizer provider must be public"));
 141.131 -        assertTrue(errors.contains("error: Customizer provider must provide a public default constructor"));
 141.132 -    }
 141.133 -
 141.134 -    public void testErrorsMessagesOnMethod() throws Exception {
 141.135 -        File src = new File(getWorkDir(), "src");
 141.136 -        File dest = new File(getWorkDir(), "classes");
 141.137 -        AnnotationProcessorTestUtils.makeSource(src, "p.H",
 141.138 -                "import org.netbeans.spi.java.hints.*;\n",
 141.139 -                "import org.netbeans.spi.editor.hints.*;\n",
 141.140 -                "import org.openide.util.NbBundle.Messages;\n",
 141.141 -                "import java.util.*;\n",
 141.142 -                "public class H {\n",
 141.143 -                "    @Hint(displayName=\"#DN_p.H\", description=\"#DESC_p.H\", category=\"general\")\n",
 141.144 -                "    @TriggerPattern(\"$1.$2.$3\")\n",
 141.145 -                "    @Messages({\"DN_p.H=1\", \"DESC_p.H=2\"})\n",
 141.146 -                "    public static List<ErrorDescription> hint(HintContext ctx) { return null;}\n",
 141.147 -                "}\n");
 141.148 -        ByteArrayOutputStream err = new ByteArrayOutputStream();
 141.149 -        boolean result = AnnotationProcessorTestUtils.runJavac(src, null, dest, null, err);
 141.150 -        assertTrue(err.toString(), result);
 141.151 -    }
 141.152 -}
   142.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/JavaFixUtilitiesTest.java	Sun Jan 08 20:10:08 2017 +0100
   142.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   142.3 @@ -1,1169 +0,0 @@
   142.4 -/*
   142.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   142.6 - *
   142.7 - * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
   142.8 - *
   142.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  142.10 - * Other names may be trademarks of their respective owners.
  142.11 - *
  142.12 - * The contents of this file are subject to the terms of either the GNU
  142.13 - * General Public License Version 2 only ("GPL") or the Common
  142.14 - * Development and Distribution License("CDDL") (collectively, the
  142.15 - * "License"). You may not use this file except in compliance with the
  142.16 - * License. You can obtain a copy of the License at
  142.17 - * http://www.netbeans.org/cddl-gplv2.html
  142.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  142.19 - * specific language governing permissions and limitations under the
  142.20 - * License.  When distributing the software, include this License Header
  142.21 - * Notice in each file and include the License file at
  142.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  142.23 - * particular file as subject to the "Classpath" exception as provided
  142.24 - * by Oracle in the GPL Version 2 section of the License file that
  142.25 - * accompanied this code. If applicable, add the following below the
  142.26 - * License Header, with the fields enclosed by brackets [] replaced by
  142.27 - * your own identifying information:
  142.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  142.29 - *
  142.30 - * If you wish your version of this file to be governed by only the CDDL
  142.31 - * or only the GPL Version 2, indicate your decision by adding
  142.32 - * "[Contributor] elects to include this software in this distribution
  142.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  142.34 - * single choice of license, a recipient has the option to distribute
  142.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  142.36 - * to extend the choice of license to its licensees as provided above.
  142.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  142.38 - * Version 2 license, then the option applies only if the new code is
  142.39 - * made subject to such option by the copyright holder.
  142.40 - *
  142.41 - * Contributor(s):
  142.42 - *
  142.43 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  142.44 - */
  142.45 -
  142.46 -package org.netbeans.spi.java.hints;
  142.47 -
  142.48 -import org.netbeans.modules.java.hints.providers.spi.HintDescriptionFactory;
  142.49 -import org.netbeans.modules.java.hints.providers.spi.HintDescription;
  142.50 -import com.sun.source.tree.ClassTree;
  142.51 -import com.sun.source.tree.ExpressionTree;
  142.52 -import com.sun.source.tree.VariableTree;
  142.53 -import com.sun.source.util.TreePath;
  142.54 -import java.util.Collection;
  142.55 -import java.util.Collections;
  142.56 -import java.util.HashMap;
  142.57 -import java.util.List;
  142.58 -import java.util.Map;
  142.59 -import java.util.Map.Entry;
  142.60 -import java.util.concurrent.atomic.AtomicBoolean;
  142.61 -import javax.lang.model.element.ExecutableElement;
  142.62 -import javax.lang.model.element.TypeElement;
  142.63 -import javax.lang.model.type.TypeMirror;
  142.64 -import javax.lang.model.util.ElementFilter;
  142.65 -import org.netbeans.modules.java.hints.spiimpl.TestBase;
  142.66 -import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker;
  142.67 -import org.netbeans.modules.java.hints.providers.spi.Trigger.PatternDescription;
  142.68 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
  142.69 -import org.netbeans.modules.java.hints.spiimpl.pm.PatternCompilerUtilities;
  142.70 -import org.netbeans.spi.editor.hints.ErrorDescription;
  142.71 -import org.netbeans.spi.editor.hints.Fix;
  142.72 -import org.openide.LifecycleManager;
  142.73 -import org.openide.modules.SpecificationVersion;
  142.74 -import org.openide.util.MapFormat;
  142.75 -
  142.76 -/**
  142.77 - *
  142.78 - * @author Jan Lahoda
  142.79 - */
  142.80 -public class JavaFixUtilitiesTest extends TestBase {
  142.81 -
  142.82 -    public JavaFixUtilitiesTest(String name) {
  142.83 -        super(name);
  142.84 -    }
  142.85 -
  142.86 -    public void testSimple() throws Exception {
  142.87 -        SpecificationVersion v = computeSpecVersion("/**\n" +
  142.88 -                                                    " * @since 1.5\n" +
  142.89 -                                                    " */\n");
  142.90 -
  142.91 -        assertEquals(0, v.compareTo(new SpecificationVersion("1.5")));
  142.92 -    }
  142.93 -
  142.94 -    public void testSimpleDate() throws Exception {
  142.95 -        SpecificationVersion v = computeSpecVersion("/**\n" +
  142.96 -                                                    " * @since 1.5 (16 May 2005)\n" +
  142.97 -                                                    " */\n");
  142.98 -
  142.99 -        assertEquals(0, v.compareTo(new SpecificationVersion("1.5")));
 142.100 -    }
 142.101 -
 142.102 -    public void testLongText() throws Exception {
 142.103 -        SpecificationVersion v = computeSpecVersion("/**\n" +
 142.104 -                                                    " * @since 1.123.2.1 - branch propsheet_issue_29447\n" +
 142.105 -                                                    " */\n");
 142.106 -
 142.107 -        assertEquals(0, v.compareTo(new SpecificationVersion("1.123.2.1")));
 142.108 -    }
 142.109 -
 142.110 -    public void testModuleName() throws Exception {
 142.111 -        SpecificationVersion v = computeSpecVersion("/**\n" +
 142.112 -                                                    " * @since org.openide.filesystems 7.15\n" +
 142.113 -                                                    " */\n");
 142.114 -
 142.115 -        assertEquals(0, v.compareTo(new SpecificationVersion("7.15")));
 142.116 -    }
 142.117 -
 142.118 -    public void testModuleNameMajor() throws Exception {
 142.119 -        SpecificationVersion v = computeSpecVersion("/**\n" +
 142.120 -                                                    " * @since org.openide/1 4.42\n" +
 142.121 -                                                    " */\n");
 142.122 -
 142.123 -        assertEquals(0, v.compareTo(new SpecificationVersion("4.42")));
 142.124 -    }
 142.125 -
 142.126 -    public void testEnd() throws Exception {
 142.127 -        SpecificationVersion v = computeSpecVersion("/**\n" +
 142.128 -                                                    " * @since 1.5 */\n");
 142.129 -
 142.130 -        assertEquals(0, v.compareTo(new SpecificationVersion("1.5")));
 142.131 -    }
 142.132 -
 142.133 -    public void testOpenAPI() throws Exception {
 142.134 -        SpecificationVersion v = computeSpecVersion("/**\n" +
 142.135 -                                                    " * @since OpenAPI version 2.12" +
 142.136 -                                                    " */\n");
 142.137 -
 142.138 -        assertEquals(0, v.compareTo(new SpecificationVersion("2.12")));
 142.139 -
 142.140 -    }
 142.141 -
 142.142 -    private SpecificationVersion computeSpecVersion(String javadoc) throws Exception {
 142.143 -        prepareTest("test/Test.java",
 142.144 -                    "package test;\n" +
 142.145 -                    "public class Test {\n" +
 142.146 -                    javadoc +
 142.147 -                    "     public void test() {\n" +
 142.148 -                    "     }\n" +
 142.149 -                    "}\n");
 142.150 -
 142.151 -        TypeElement te = info.getElements().getTypeElement("test.Test");
 142.152 -        ExecutableElement method = ElementFilter.methodsIn(te.getEnclosedElements()).iterator().next();
 142.153 -
 142.154 -        return JavaFixUtilities.computeSpecVersion(info, method);
 142.155 -    }
 142.156 -
 142.157 -    public void testArithmetic1() throws Exception {
 142.158 -        performArithmeticTest("1 + 2", "3");
 142.159 -        performArithmeticTest("1f + 2", "3.0F");
 142.160 -        performArithmeticTest("1 + 2f", "3.0F");
 142.161 -        performArithmeticTest("1.0 + 2f", "3.0");
 142.162 -        performArithmeticTest("1 + 2.0", "3.0");
 142.163 -        performArithmeticTest("1L + 2", "3L");
 142.164 -    }
 142.165 -
 142.166 -    public void testArithmetic2() throws Exception {
 142.167 -        performArithmeticTest("1 * 2", "2");
 142.168 -        performArithmeticTest("1f * 2", "2.0F");
 142.169 -        performArithmeticTest("1 * 2f", "2.0F");
 142.170 -        performArithmeticTest("1.0 * 2f", "2.0");
 142.171 -        performArithmeticTest("1 * 2.0", "2.0");
 142.172 -        performArithmeticTest("1L * 2", "2L");
 142.173 -    }
 142.174 -
 142.175 -    public void testArithmetic3() throws Exception {
 142.176 -        performArithmeticTest("4 / 2", "2");
 142.177 -        performArithmeticTest("4f / 2", "2.0F");
 142.178 -        performArithmeticTest("4 / 2f", "2.0F");
 142.179 -        performArithmeticTest("4.0 / 2f", "2.0");
 142.180 -        performArithmeticTest("4 / 2.0", "2.0");
 142.181 -        performArithmeticTest("4L / 2", "2L");
 142.182 -    }
 142.183 -
 142.184 -    public void testArithmetic4() throws Exception {
 142.185 -        performArithmeticTest("5 % 2", "1");
 142.186 -        performArithmeticTest("5f % 2", "1.0F");
 142.187 -        performArithmeticTest("5 % 2f", "1.0F");
 142.188 -        performArithmeticTest("5.0 % 2f", "1.0");
 142.189 -        performArithmeticTest("5 % 2.0", "1.0");
 142.190 -        performArithmeticTest("5L % 2", "1L");
 142.191 -    }
 142.192 -
 142.193 -    public void testArithmetic5() throws Exception {
 142.194 -        performArithmeticTest("5 - 2", "3");
 142.195 -        performArithmeticTest("5f - 2", "3.0F");
 142.196 -        performArithmeticTest("5 - 2f", "3.0F");
 142.197 -        performArithmeticTest("5.0 - 2f", "3.0");
 142.198 -        performArithmeticTest("5 - 2.0", "3.0");
 142.199 -        performArithmeticTest("5L - 2", "3L");
 142.200 -    }
 142.201 -
 142.202 -    public void testArithmetic6() throws Exception {
 142.203 -        performArithmeticTest("5 | 2", "7");
 142.204 -        performArithmeticTest("5L | 2", "7L");
 142.205 -        performArithmeticTest("5 | 2L", "7L");
 142.206 -    }
 142.207 -
 142.208 -    public void testArithmetic7() throws Exception {
 142.209 -        performArithmeticTest("5 & 4", "4");
 142.210 -        performArithmeticTest("5L & 4", "4L");
 142.211 -        performArithmeticTest("5 & 4L", "4L");
 142.212 -    }
 142.213 -
 142.214 -    public void testArithmetic8() throws Exception {
 142.215 -        performArithmeticTest("5 ^ 4", "1");
 142.216 -        performArithmeticTest("5L ^ 4", "1L");
 142.217 -        performArithmeticTest("5 ^ 4L", "1L");
 142.218 -    }
 142.219 -
 142.220 -    public void testArithmetic9() throws Exception {
 142.221 -        performArithmeticTest("5 << 2", "20");
 142.222 -        performArithmeticTest("5L << 2", "20L");
 142.223 -        performArithmeticTest("5 << 2L", "20L");
 142.224 -    }
 142.225 -
 142.226 -    public void testArithmeticA() throws Exception {
 142.227 -        performArithmeticTest("-20 >> 2", "-5");
 142.228 -        performArithmeticTest("-20L >> 2", "-5L");
 142.229 -        performArithmeticTest("-20 >> 2L", "-5L");
 142.230 -    }
 142.231 -
 142.232 -    public void testArithmeticB() throws Exception {
 142.233 -        performArithmeticTest("-20 >>> 2", "1073741819");
 142.234 -    }
 142.235 -
 142.236 -    public void testArithmeticC() throws Exception {
 142.237 -        performArithmeticTest("0 + -20", "-20");
 142.238 -        performArithmeticTest("0 + +20", "20");
 142.239 -    }
 142.240 -
 142.241 -    public void testArithmeticComplex() throws Exception {
 142.242 -        performArithmeticTest("1 + 2 * 4 - 5", "4");
 142.243 -        performArithmeticTest("1f + 2 * 4.0 - 5", "4.0");
 142.244 -        performArithmeticTest("1L + 2 * 4 - 5", "4L");
 142.245 -    }
 142.246 -
 142.247 -    private static final String ARITHMETIC = "public class Test { private Object o = __VAL__; }";
 142.248 -    private void performArithmeticTest(String orig, String nue) throws Exception {
 142.249 -        String code = replace("0");
 142.250 -
 142.251 -        prepareTest("Test.java", code);
 142.252 -        ClassTree clazz = (ClassTree) info.getCompilationUnit().getTypeDecls().get(0);
 142.253 -        VariableTree variable = (VariableTree) clazz.getMembers().get(1);
 142.254 -        ExpressionTree init = variable.getInitializer();
 142.255 -        TreePath tp = new TreePath(new TreePath(new TreePath(new TreePath(info.getCompilationUnit()), clazz), variable), init);
 142.256 -        Fix fix = JavaFixUtilities.rewriteFix(info, "A", tp, orig, Collections.<String, TreePath>emptyMap(), Collections.<String, Collection<? extends TreePath>>emptyMap(), Collections.<String, String>emptyMap(), Collections.<String, TypeMirror>emptyMap(), Collections.<String, String>emptyMap());
 142.257 -        fix.implement();
 142.258 -
 142.259 -        String golden = replace(nue);
 142.260 -        String out = doc.getText(0, doc.getLength());
 142.261 -
 142.262 -        assertEquals(golden, out);
 142.263 -
 142.264 -        LifecycleManager.getDefault().saveAll();
 142.265 -    }
 142.266 -
 142.267 -    private static String replace(String val) {
 142.268 -        MapFormat f = new MapFormat(Collections.singletonMap("VAL", val));
 142.269 -
 142.270 -        f.setLeftBrace("__");
 142.271 -        f.setRightBrace("__");
 142.272 -
 142.273 -        return f.format(ARITHMETIC);
 142.274 -    }
 142.275 -
 142.276 -    public void testRewriteWithParenthesis1() throws Exception {
 142.277 -        performRewriteTest("package test;\n" +
 142.278 -                           "public class Test {\n" +
 142.279 -                           "    int i = new String(\"a\" + \"b\").length();\n" +
 142.280 -                           "}\n",
 142.281 -                           "new String($1)=>$1",
 142.282 -                           "package test;\n" +
 142.283 -                           "public class Test {\n" +
 142.284 -		           "    int i = (\"a\" + \"b\").length();\n" +
 142.285 -		           "}\n");
 142.286 -    }
 142.287 -
 142.288 -    public void testRewriteWithParenthesis2() throws Exception {
 142.289 -        performRewriteTest("package test;\n" +
 142.290 -                           "public class Test {\n" +
 142.291 -                           "    int i = Integer.valueOf(1 + 2) * 3;\n" +
 142.292 -                           "}\n",
 142.293 -                           "Integer.valueOf($1)=>$1",
 142.294 -                           "package test;\n" +
 142.295 -                           "public class Test {\n" +
 142.296 -		           "    int i = (1 + 2) * 3;\n" +
 142.297 -		           "}\n");
 142.298 -    }
 142.299 -
 142.300 -    public void testRewriteWithoutParenthesis1() throws Exception {
 142.301 -        performRewriteTest("package test;\n" +
 142.302 -                           "public class Test {\n" +
 142.303 -                           "    int i = new String(\"a\" + \"b\").length();\n" +
 142.304 -                           "}\n",
 142.305 -                           "new String($1)=>java.lang.String.format(\"%s%s\", $1, \"\")",
 142.306 -                           "package test;\n" +
 142.307 -                           "public class Test {\n" +
 142.308 -		           "    int i = String.format(\"%s%s\", \"a\" + \"b\", \"\").length();\n" +
 142.309 -		           "}\n");
 142.310 -    }
 142.311 -
 142.312 -    public void testRewriteWithoutParenthesis2() throws Exception {
 142.313 -        performRewriteTest("package test;\n" +
 142.314 -                           "public class Test {\n" +
 142.315 -                           "    String s = (\"a\" + \"b\").intern();\n" +
 142.316 -                           "}\n",
 142.317 -                           "($1).intern()=>$1",
 142.318 -                           "package test;\n" +
 142.319 -                           "public class Test {\n" +
 142.320 -		           "    String s = \"a\" + \"b\";\n" +
 142.321 -		           "}\n");
 142.322 -    }
 142.323 -
 142.324 -    public void testRewriteWithoutParenthesis3() throws Exception {
 142.325 -        performRewriteTest("package test;\n" +
 142.326 -                           "public class Test {\n" +
 142.327 -                           "    int i = Integer.valueOf(1 + 2) + 3;\n" +
 142.328 -                           "}\n",
 142.329 -                           "Integer.valueOf($1)=>$1",
 142.330 -                           "package test;\n" +
 142.331 -                           "public class Test {\n" +
 142.332 -		           "    int i = 1 + 2 + 3;\n" +
 142.333 -		           "}\n");
 142.334 -    }
 142.335 -
 142.336 -    public void testRewriteWithoutParenthesis4() throws Exception {
 142.337 -        performRewriteTest("package test;\n" +
 142.338 -                           "public class Test {\n" +
 142.339 -                           "    int i = Integer.valueOf(1 * 2) + 3;\n" +
 142.340 -                           "}\n",
 142.341 -                           "Integer.valueOf($1)=>$1",
 142.342 -                           "package test;\n" +
 142.343 -                           "public class Test {\n" +
 142.344 -		           "    int i = 1 * 2 + 3;\n" +
 142.345 -		           "}\n");
 142.346 -    }
 142.347 -
 142.348 -    public void testRewriteWithoutParenthesis5() throws Exception {
 142.349 -        performRewriteTest("package test;\n" +
 142.350 -                           "public class Test {\n" +
 142.351 -                           "    int i = new Integer(1 * 2).hashCode();\n" +
 142.352 -                           "}\n",
 142.353 -                           "$1.hashCode()=>$1.hashCode()",
 142.354 -                           "package test;\n" +
 142.355 -                           "public class Test {\n" +
 142.356 -		           "    int i = new Integer(1 * 2).hashCode();\n" +
 142.357 -		           "}\n");
 142.358 -    }
 142.359 -
 142.360 -    public void testRewriteWithoutParenthesis6() throws Exception {
 142.361 -        performRewriteTest("package test;\n" +
 142.362 -                           "public class Test {\n" +
 142.363 -                           "    {\n" +
 142.364 -                           "        System.err.println(\"a\" + 1);\n" +
 142.365 -                           "    }\n" +
 142.366 -                           "}\n",
 142.367 -                           "System.err.println($t)=>D.println($t)",
 142.368 -                           "package test;\n" +
 142.369 -                           "public class Test {\n" +
 142.370 -                           "    {\n" +
 142.371 -                           "        D.println(\"a\" + 1);\n" +
 142.372 -                           "    }\n" +
 142.373 -		           "}\n");
 142.374 -    }
 142.375 -
 142.376 -    public void testRewriteWithoutParenthesis7() throws Exception {
 142.377 -        performRewriteTest("package test;\n" +
 142.378 -                           "public class Test {\n" +
 142.379 -                           "    {\n" +
 142.380 -                           "        new String(\"a\" + 1);\n" +
 142.381 -                           "    }\n" +
 142.382 -                           "}\n",
 142.383 -                           "new String($t)=>new D($t)",
 142.384 -                           "package test;\n" +
 142.385 -                           "public class Test {\n" +
 142.386 -                           "    {\n" +
 142.387 -                           "        new D(\"a\" + 1);\n" +
 142.388 -                           "    }\n" +
 142.389 -		           "}\n");
 142.390 -    }
 142.391 -
 142.392 -    public void testTopLevelRewriteWithoutParenthesis1() throws Exception {
 142.393 -        performRewriteTest("package test;\n" +
 142.394 -                           "public class Test {\n" +
 142.395 -                           "    int i = (1 + 2) * 2;\n" +
 142.396 -                           "}\n",
 142.397 -                           "$1 + $2=>3",
 142.398 -                           "package test;\n" +
 142.399 -                           "public class Test {\n" +
 142.400 -		           "    int i = 3 * 2;\n" +
 142.401 -		           "}\n");
 142.402 -    }
 142.403 -
 142.404 -    public void testTopLevelRewriteKeepParenthesis1() throws Exception {
 142.405 -        performRewriteTest("package test;\n" +
 142.406 -                           "public class Test {\n" +
 142.407 -                           "    int i = (1 * 2) + 2;\n" +
 142.408 -                           "}\n",
 142.409 -                           "$1 * $2=>2",
 142.410 -                           "package test;\n" +
 142.411 -                           "public class Test {\n" +
 142.412 -		           "    int i = (2) + 2;\n" +
 142.413 -		           "}\n");
 142.414 -    }
 142.415 -
 142.416 -    public void testTopLevelRewriteKeepParenthesis2() throws Exception {
 142.417 -        performRewriteTest("package test;\n" +
 142.418 -                           "public class Test {\n" +
 142.419 -                           "    { if (1 > 2) ; }\n" +
 142.420 -                           "}\n",
 142.421 -                           "$1 > $2=>false",
 142.422 -                           "package test;\n" +
 142.423 -                           "public class Test {\n" +
 142.424 -                           "    { if (false) ; }\n" +
 142.425 -		           "}\n");
 142.426 -    }
 142.427 -    
 142.428 -    public void testRewriteCatchMultiVariable() throws Exception {
 142.429 -        performRewriteTest("package test;\n" +
 142.430 -                           "public class Test {\n" +
 142.431 -                           "    { try { } catch {NullPointerException ex} { } }\n" +
 142.432 -                           "}\n",
 142.433 -                           "try { } catch $catches$ => try { new Object(); } catch $catches$",
 142.434 -                           "package test;\n" +
 142.435 -                           "public class Test {\n" +
 142.436 -                           //XXX: whitespaces:
 142.437 -                           "    {  try {new Object();\n } catch {NullPointerException ex} { } }\n" +
 142.438 -//                           "    { try {      new Object();\n } catch {NullPointerException ex} { } }\n" +
 142.439 -		           "}\n");
 142.440 -    }
 142.441 -
 142.442 -    public void testRewriteCaseMultiVariable() throws Exception {
 142.443 -        performRewriteTest("package test;\n" +
 142.444 -                           "public class Test {\n" +
 142.445 -                           "    { int i = 0; switch (i) {case 0: System.err.println(1); break; case 1: System.err.println(2); break; case 2: System.err.println(3); break; }\n" +
 142.446 -                           "}\n",
 142.447 -                           "switch ($v) { case $p$ case 2: $stmts$; } => switch ($v) { case $p$ case 3: $stmts$; }",
 142.448 -                           "package test;\n" +
 142.449 -                           "public class Test {\n" +
 142.450 -                           "    { int i = 0; switch (i) {case 0: System.err.println(1); break; case 1: System.err.println(2); break; case 3: System.err.println(3); break; }\n" +
 142.451 -		           "}\n");
 142.452 -    }
 142.453 -
 142.454 -    public void testRewriteMemberSelectVariable() throws Exception {
 142.455 -        performRewriteTest("package test;\n" +
 142.456 -                           "public class Test {\n" +
 142.457 -                           "    { java.io.File f = null; boolean b = f.isDirectory(); }\n" +
 142.458 -                           "}\n",
 142.459 -                           "$file.$m() => foo.Bar.$m($file)",
 142.460 -                           "package test;\n" +
 142.461 -                           "public class Test {\n" +
 142.462 -                           "    { java.io.File f = null; boolean b = foo.Bar.isDirectory(f); }\n" +
 142.463 -		           "}\n");
 142.464 -    }
 142.465 -    
 142.466 -    public void testRewriteIdent2IdentMemberSelectPattern() throws Exception {
 142.467 -        performRewriteTest("package test;\n" +
 142.468 -                           "public class Test {\n" +
 142.469 -                           "    private boolean b; private void t() { boolean c = b; }\n" +
 142.470 -                           "}\n",
 142.471 -                           "$0{test.Test}.b => !$0.b",
 142.472 -                           "package test;\n" +
 142.473 -                           "public class Test {\n" +
 142.474 -                           "    private boolean b; private void t() { boolean c = !b; }\n" +
 142.475 -		           "}\n");
 142.476 -    }
 142.477 -
 142.478 -    public void testCarefulRewriteInImports() throws Exception {
 142.479 -        performRewriteTest("package test;\n" +
 142.480 -                           "import javax.swing.text.AbstractDocument;\n" +
 142.481 -                           "public class Test {\n" +
 142.482 -                           "}\n",
 142.483 -                           "javax.swing.text.AbstractDocument => javax.swing.text.Document",
 142.484 -                           "package test;\n" +
 142.485 -                           "import javax.swing.text.Document;\n" +
 142.486 -                           "public class Test {\n" +
 142.487 -		           "}\n");
 142.488 -    }
 142.489 -
 142.490 -    public void testRemoveFromParent1() throws Exception {
 142.491 -        performRemoveFromParentTest("package test;\n" +
 142.492 -                                    "public class Test {\n" +
 142.493 -                                    "    private int I;" +
 142.494 -                                    "}\n",
 142.495 -                                    "$mods$ int $f;",
 142.496 -                                    "package test;\n" +
 142.497 -                                    "public class Test {\n" +
 142.498 -                                    "}\n");
 142.499 -    }
 142.500 -
 142.501 -    public void testRemoveFromParent2() throws Exception {
 142.502 -        performRemoveFromParentTest("package test;\n" +
 142.503 -                                    "public class Test extends java.util.ArrayList {\n" +
 142.504 -                                    "}\n",
 142.505 -                                    "java.util.ArrayList",
 142.506 -                                    "package test;\n" +
 142.507 -                                    "public class Test {\n" +
 142.508 -                                    "}\n");
 142.509 -    }
 142.510 -    
 142.511 -    public void testRemoveFromParentExpressionStatement206116() throws Exception {
 142.512 -        performRemoveFromParentTest("package test;\n" +
 142.513 -                           "import java.io.InputStream;\n" +
 142.514 -                           "public class Test {\n" +
 142.515 -                           "    private void t() throws Exception {\n" +
 142.516 -                           "        System.err.println();\n" +
 142.517 -                           "        System.err.println(\"a\");\n" +
 142.518 -                           "    }\n" +
 142.519 -                           "}\n",
 142.520 -                           "System.err.println()",
 142.521 -                           "package test;\n" +
 142.522 -                           "import java.io.InputStream;\n" +
 142.523 -                           "public class Test {\n" +
 142.524 -                           "    private void t() throws Exception {\n" +
 142.525 -                           "        System.err.println(\"a\");\n" +
 142.526 -                           "    }\n" +
 142.527 -		           "}\n");
 142.528 -    }
 142.529 -
 142.530 -    public void testUnresolvableTarget() throws Exception {
 142.531 -        performRewriteTest("package test;\n" +
 142.532 -                           "public class Test extends java.util.ArrayList {\n" +
 142.533 -                           "}\n",
 142.534 -                           "java.util.ArrayList => Test",
 142.535 -                           "package test;\n" +
 142.536 -                           "public class Test extends Test {\n" +
 142.537 -                           "}\n");
 142.538 -    }
 142.539 -
 142.540 -    public void testTryWithResourceTarget() throws Exception {
 142.541 -        performRewriteTest("package test;\n" +
 142.542 -                           "import java.io.InputStream;\n" +
 142.543 -                           "public class Test {\n" +
 142.544 -                           "    private void t() throws Exception {\n" +
 142.545 -                           "        InputStream in = null;\n" +
 142.546 -                           "        try {\n" +
 142.547 -                           "        } finally {\n" +
 142.548 -                           "            in.close()\n" +
 142.549 -                           "        }\n" +
 142.550 -                           "    }\n" +
 142.551 -                           "}\n",
 142.552 -                           "$type $var = $init; try {} finally {$var.close();} => try ($type $var = $init) {} finally {$var.close();}",
 142.553 -                           "package test;\n" +
 142.554 -                           "import java.io.InputStream;\n" +
 142.555 -                           "public class Test {\n" +
 142.556 -                           "    private void t() throws Exception {\n" +
 142.557 -//                           "        try (InputStream in = null) {\n" +
 142.558 -                           //XXX:
 142.559 -                           "        try (final InputStream in = null) {\n" +
 142.560 -                           "        } finally {\n" +
 142.561 -                           "            in.close()\n" +
 142.562 -                           "        }\n" +
 142.563 -                           "    }\n" +
 142.564 -		           "}\n");
 142.565 -    }
 142.566 -
 142.567 -    public void testSingle2MultipleStatements() throws Exception {
 142.568 -        performRewriteTest("package test;\n" +
 142.569 -                           "import java.io.InputStream;\n" +
 142.570 -                           "public class Test {\n" +
 142.571 -                           "    private void t() throws Exception {\n" +
 142.572 -                           "        int i = 0;\n" +
 142.573 -                           "    }\n" +
 142.574 -                           "}\n",
 142.575 -                           "$type $var = $init; => $type $var; $var = $init;",
 142.576 -                           "package test;\n" +
 142.577 -                           "import java.io.InputStream;\n" +
 142.578 -                           "public class Test {\n" +
 142.579 -                           "    private void t() throws Exception {\n" +
 142.580 -                           "        int i;\n" +
 142.581 -                           "        i = 0;\n" +
 142.582 -                           "    }\n" +
 142.583 -		           "}\n");
 142.584 -    }
 142.585 -    
 142.586 -    public void testSingle2MultipleStatements2() throws Exception {
 142.587 -        performRewriteTest("package test;\n" +
 142.588 -                           "import java.io.InputStream;\n" +
 142.589 -                           "public class Test {\n" +
 142.590 -                           "    private void t() throws Exception {\n" +
 142.591 -                           "        while (true)\n" +
 142.592 -                           "            if (true) {\n" +
 142.593 -                           "                System.err.println();\n" +
 142.594 -                           "            }\n" +
 142.595 -                           "    }\n" +
 142.596 -                           "}\n",
 142.597 -                           "if (true) $then; => if (true) $then; System.err.println();",
 142.598 -                           "package test;\n" +
 142.599 -                           "import java.io.InputStream;\n" +
 142.600 -                           "public class Test {\n" +
 142.601 -                           "    private void t() throws Exception {\n" +
 142.602 -                           "        while (true) {\n" +
 142.603 -                           "            if (true) {\n" +
 142.604 -                           "                System.err.println();\n" +
 142.605 -                           "            }\n" +
 142.606 -                           "            System.err.println();\n" +
 142.607 -                           "        }\n" +
 142.608 -                           "    }\n" +
 142.609 -		           "}\n");
 142.610 -    }
 142.611 -    
 142.612 -    public void testMultipleStatementsWrapComments1() throws Exception {
 142.613 -        performRewriteTest("package test;\n" +
 142.614 -                           "import java.io.InputStream;\n" +
 142.615 -                           "public class Test {\n" +
 142.616 -                           "    private void t() throws Exception {\n" +
 142.617 -                           "        if (1 == 1) {\n" +
 142.618 -                           "            System.err.println();\n" +
 142.619 -                           "            System.err.println(\"a\");\n" +
 142.620 -                           "            \n" +
 142.621 -                           "            \n" +
 142.622 -                           "            //C\n" +
 142.623 -                           "            System.err.println(\"b\");\n" +
 142.624 -                           "        }\n" +
 142.625 -                           "    }\n" +
 142.626 -                           "}\n",
 142.627 -                           "if ($cond) { System.err.println(); $stmts$;} => while ($cond) { $stmts$;}",
 142.628 -                           "package test;\n" +
 142.629 -                           "import java.io.InputStream;\n" +
 142.630 -                           "public class Test {\n" +
 142.631 -                           "    private void t() throws Exception {\n" +
 142.632 -                           "        while (1 == 1) {\n" +
 142.633 -                           "            System.err.println(\"a\");\n" +
 142.634 -                           "            \n" +
 142.635 -                           "            \n" +
 142.636 -                           "            //C\n" +
 142.637 -                           "            System.err.println(\"b\");\n" +
 142.638 -                           "        }\n" +
 142.639 -                           "    }\n" +
 142.640 -		           "}\n");
 142.641 -    }
 142.642 -    
 142.643 -    public void testMultipleStatementsWrapComments2() throws Exception {
 142.644 -        performRewriteTest("package test;\n" +
 142.645 -                           "import java.io.InputStream;\n" +
 142.646 -                           "public class Test {\n" +
 142.647 -                           "    private void t() throws Exception {\n" +
 142.648 -                           "        if (1 == 1) {\n" +
 142.649 -                           "            System.err.println();\n" +
 142.650 -                           "            System.err.println(\"a\");\n" +
 142.651 -                           "            \n" +
 142.652 -                           "            \n" +
 142.653 -                           "            //C\n" +
 142.654 -                           "            System.err.println(\"b\");\n" +
 142.655 -                           "        }\n" +
 142.656 -                           "    }\n" +
 142.657 -                           "}\n",
 142.658 -                           "if ($cond) { $stmts$;} => while ($cond) { $stmts$;}",
 142.659 -                           "package test;\n" +
 142.660 -                           "import java.io.InputStream;\n" +
 142.661 -                           "public class Test {\n" +
 142.662 -                           "    private void t() throws Exception {\n" +
 142.663 -                           "        while (1 == 1) {\n" +
 142.664 -                           "            System.err.println();\n" +
 142.665 -                           "            System.err.println(\"a\");\n" +
 142.666 -                           "            \n" +
 142.667 -                           "            \n" +
 142.668 -                           "            //C\n" +
 142.669 -                           "            System.err.println(\"b\");\n" +
 142.670 -                           "        }\n" +
 142.671 -                           "    }\n" +
 142.672 -		           "}\n");
 142.673 -    }
 142.674 -    
 142.675 -    public void testReplaceTypeParameters1() throws Exception {
 142.676 -        performRewriteTest("package test;\n" +
 142.677 -                           "import java.io.InputStream;\n" +
 142.678 -                           "public class Test {\n" +
 142.679 -                           "    private <A, B> void t() {\n" +
 142.680 -                           "    }\n" +
 142.681 -                           "}\n",
 142.682 -                           "$mods$ <$O, $T> $ret $name() { $body$; } => $mods$ <$T, $O> $ret $name() { $body$; }",
 142.683 -                           "package test;\n" +
 142.684 -                           "import java.io.InputStream;\n" +
 142.685 -                           "public class Test {\n" +
 142.686 -                           "    private <B, A> void t() {\n" +
 142.687 -                           "    }\n" +
 142.688 -		           "}\n");
 142.689 -    }
 142.690 -    
 142.691 -    public void testReplaceTypeParameters2() throws Exception {
 142.692 -        performRewriteTest("package test;\n" +
 142.693 -                           "import java.io.InputStream;\n" +
 142.694 -                           "public class Test {\n" +
 142.695 -                           "    private <A, B> void t() {\n" +
 142.696 -                           "    }\n" +
 142.697 -                           "}\n",
 142.698 -                           "$mods$ <$T$> $ret $name() { $body$; } => $mods$ <C, $T$> $ret $name() { $body$; }",
 142.699 -                           "package test;\n" +
 142.700 -                           "import java.io.InputStream;\n" +
 142.701 -                           "public class Test {\n" +
 142.702 -                           "    private <C, A, B> void t() {\n" +
 142.703 -                           "    }\n" +
 142.704 -		           "}\n");
 142.705 -    }
 142.706 -    
 142.707 -    public void testAdd2Modifiers() throws Exception {
 142.708 -        performRewriteTest("package test;\n" +
 142.709 -                           "import java.io.InputStream;\n" +
 142.710 -                           "public class Test {\n" +
 142.711 -                           "    void t() {\n" +
 142.712 -                           "    }\n" +
 142.713 -                           "}\n",
 142.714 -                           "$mods$ $ret $name() { $body$; } => $mods$ @java.lang.Deprecated private $ret $name() { $body$; }",
 142.715 -                           "package test;\n" +
 142.716 -                           "import java.io.InputStream;\n" +
 142.717 -                           "public class Test {\n" +
 142.718 -                           "    @Deprecated\n" +
 142.719 -                           "    private void t() {\n" +
 142.720 -                           "    }\n" +
 142.721 -		           "}\n");
 142.722 -    }
 142.723 -    
 142.724 -    public void testReplaceInModifiers() throws Exception {
 142.725 -        performRewriteTest("package test;\n" +
 142.726 -                           "import java.io.InputStream;\n" +
 142.727 -                           "public class Test {\n" +
 142.728 -                           "    public @Override void t() {\n" +
 142.729 -                           "    }\n" +
 142.730 -                           "}\n",
 142.731 -                           "$mods$ public @Override $ret $name() { $body$; } => $mods$ private @Deprecated $ret $name() { $body$; }",
 142.732 -                           "package test;\n" +
 142.733 -                           "import java.io.InputStream;\n" +
 142.734 -                           "public class Test {\n" +
 142.735 -                           "    private @Deprecated void t() {\n" +
 142.736 -                           "    }\n" +
 142.737 -		           "}\n");
 142.738 -    }
 142.739 -    
 142.740 -    public void testKeepInModifiers() throws Exception {
 142.741 -        performRewriteTest("package test;\n" +
 142.742 -                           "import java.io.InputStream;\n" +
 142.743 -                           "public class Test {\n" +
 142.744 -                           "    public @Override void t() {\n" +
 142.745 -                           "    }\n" +
 142.746 -                           "}\n",
 142.747 -                           "$mods$ public @Override $ret $name() { $body$; } => $mods$ public @Override $ret $name() { $body$; }",
 142.748 -                           "package test;\n" +
 142.749 -                           "import java.io.InputStream;\n" +
 142.750 -                           "public class Test {\n" +
 142.751 -                           "    public @Override void t() {\n" +
 142.752 -                           "    }\n" +
 142.753 -		           "}\n");
 142.754 -    }
 142.755 -    
 142.756 -    public void testRemoveInModifiers() throws Exception {
 142.757 -        performRewriteTest("package test;\n" +
 142.758 -                           "import java.io.InputStream;\n" +
 142.759 -                           "public class Test {\n" +
 142.760 -                           "    public static @Deprecated @Override void t() {\n" +
 142.761 -                           "    }\n" +
 142.762 -                           "}\n",
 142.763 -                           "$mods$ public @Override $ret $name() { $body$; } => $mods$ $ret $name() { $body$; }",
 142.764 -                           "package test;\n" +
 142.765 -                           "import java.io.InputStream;\n" +
 142.766 -                           "public class Test {\n" +
 142.767 -                           "    static @Deprecated void t() {\n" +
 142.768 -                           "    }\n" +
 142.769 -		           "}\n");
 142.770 -    }
 142.771 -    
 142.772 -    public void testRewriteMethodParametersWildcard() throws Exception {
 142.773 -        performRewriteTest("package test;\n" +
 142.774 -                           "import java.io.InputStream;\n" +
 142.775 -                           "public class Test {\n" +
 142.776 -                           "    public static void t() {\n" +
 142.777 -                           "    }\n" +
 142.778 -                           "}\n",
 142.779 -                           "$mods$ void $name($args$) { $body$; } => $mods$ int $name($args$) { $body$; }",
 142.780 -                           "package test;\n" +
 142.781 -                           "import java.io.InputStream;\n" +
 142.782 -                           "public class Test {\n" +
 142.783 -                           "    public static int t() {\n" +
 142.784 -                           "    }\n" +
 142.785 -		           "}\n");
 142.786 -    }
 142.787 -    
 142.788 -    public void testRewriteClass() throws Exception {
 142.789 -        performRewriteTest("package test;\n" +
 142.790 -                           "public class Test {\n" +
 142.791 -                           "}\n",
 142.792 -                           "$mods$ class $name<$tp$> extends $e$ implements $i$ { $members$; } => $mods$ @java.lang.Deprecated class $name<$tp$> extends $e$ implements $i$ { $members$; }",
 142.793 -                           "package test;\n" +
 142.794 -                           "@Deprecated\n" +
 142.795 -                           "public class Test {\n" +
 142.796 -		           "}\n");
 142.797 -    }
 142.798 -    
 142.799 -    public void testOptionalVariableInitializer1() throws Exception {
 142.800 -        performRewriteTest("package test;\n" +
 142.801 -                           "public class Test {\n" +
 142.802 -                           "    private int I;\n" +
 142.803 -                           "}\n",
 142.804 -                           "$mods$ int $name = $init$; => $mods$ long $name = $init$;",
 142.805 -                           "package test;\n" +
 142.806 -                           "public class Test {\n" +
 142.807 -                           "    private long I;\n" +
 142.808 -		           "}\n");
 142.809 -    }
 142.810 -    
 142.811 -    public void testOptionalVariableInitializer2() throws Exception {
 142.812 -        performRewriteTest("package test;\n" +
 142.813 -                           "public class Test {\n" +
 142.814 -                           "    private int I = 1;\n" +
 142.815 -                           "}\n",
 142.816 -                           "$mods$ int $name = $init$; => $mods$ long $name = $init$;",
 142.817 -                           "package test;\n" +
 142.818 -                           "public class Test {\n" +
 142.819 -                           "    private long I = 1;\n" +
 142.820 -		           "}\n");
 142.821 -    }
 142.822 -    
 142.823 -    public void testOptionalElse1() throws Exception {
 142.824 -        performRewriteTest("package test;\n" +
 142.825 -                           "public class Test {\n" +
 142.826 -                           "    {\n" +
 142.827 -                           "        if (true) System.err.println(\"a\");\n" +
 142.828 -                           "    }\n" +
 142.829 -                           "}\n",
 142.830 -                           "if (true) $then else $else$; => if (false) $then else $else$;",
 142.831 -                           "package test;\n" +
 142.832 -                           "public class Test {\n" +
 142.833 -                           "    {\n" +
 142.834 -                           "        if (false) System.err.println(\"a\");\n" +
 142.835 -                           "    }\n" +
 142.836 -		           "}\n");
 142.837 -    }
 142.838 -    
 142.839 -    public void testOptionalElse2() throws Exception {
 142.840 -        performRewriteTest("package test;\n" +
 142.841 -                           "public class Test {\n" +
 142.842 -                           "    {\n" +
 142.843 -                           "        if (true) System.err.println(\"a\");\n" +
 142.844 -                           "        else System.err.println(\"b\");\n" +
 142.845 -                           "    }\n" +
 142.846 -                           "}\n",
 142.847 -                           "if (true) $then else $else$; => if (false) $then else $else$;",
 142.848 -                           "package test;\n" +
 142.849 -                           "public class Test {\n" +
 142.850 -                           "    {\n" +
 142.851 -                           "        if (false) System.err.println(\"a\");\n" +
 142.852 -                           "        else System.err.println(\"b\");\n" +
 142.853 -                           "    }\n" +
 142.854 -		           "}\n");
 142.855 -    }
 142.856 -    
 142.857 -    public void testMultiNewArray() throws Exception {
 142.858 -        performRewriteTest("package test;\n" +
 142.859 -                           "public class Test {\n" +
 142.860 -                           "    private static void t(Object... obj) {\n" +
 142.861 -                           "        Test.t(1);\n" +
 142.862 -                           "    }\n" +
 142.863 -                           "}\n",
 142.864 -                           "test.Test.t($args$) => test.Test.t(new Object[] {$args$})",
 142.865 -                           "package test;\n" +
 142.866 -                           "public class Test {\n" +
 142.867 -                           "    private static void t(Object... obj) {\n" +
 142.868 -                           "        Test.t(new Object[]{1});\n" +
 142.869 -                           "    }\n" +
 142.870 -		           "}\n");
 142.871 -    }
 142.872 -
 142.873 -    public void testFakeBlock2FakeBlock191283() throws Exception {
 142.874 -        performRewriteTest("package test;\n" +
 142.875 -                           "import java.io.InputStream;\n" +
 142.876 -                           "public class Test {\n" +
 142.877 -                           "    private void t() throws Exception {\n" +
 142.878 -                           "        System.err.println(1);\n" +
 142.879 -                           "        lock();\n" +
 142.880 -                           "        System.err.println(2);\n" +
 142.881 -                           "        unlock();\n" +
 142.882 -                           "        System.err.println(3);\n" +
 142.883 -                           "    }\n" +
 142.884 -                           "    private static void lock() {}\n" +
 142.885 -                           "    private static void unlock() {}\n" +
 142.886 -                           "}\n",
 142.887 -                           "test.Test.lock(); $i$; test.Test.unlock(); => lock(); try { $i$; } finally { unlock(); }",
 142.888 -                           "package test;\n" +
 142.889 -                           "import java.io.InputStream;\n" +
 142.890 -                           "public class Test {\n" +
 142.891 -                           "    private void t() throws Exception {\n" +
 142.892 -                           "        System.err.println(1);\n" +
 142.893 -                           "        lock();\n" +
 142.894 -                           "        try {\n" +
 142.895 -                           "            System.err.println(2);\n" +
 142.896 -                           "        } finally {\n" +
 142.897 -                           "            unlock();\n" +
 142.898 -                           "        }\n" +
 142.899 -                           "        System.err.println(3);\n" +
 142.900 -                           "    }\n" +
 142.901 -                           "    private static void lock() {}\n" +
 142.902 -                           "    private static void unlock() {}\n" +
 142.903 -		           "}\n");
 142.904 -    }
 142.905 -    
 142.906 -    public void testOptimizeNegExpression() throws Exception {
 142.907 -        performRewriteTest("package test;\n" +
 142.908 -                           "public class Test {\n" +
 142.909 -                           "    private static void t(int i) {\n" +
 142.910 -                           "        if (i == 0) {\n" +
 142.911 -                           "            System.err.println(1);\n" +
 142.912 -                           "        } else {\n" +
 142.913 -                           "            System.err.println(2);\n" +
 142.914 -                           "        }\n" +
 142.915 -                           "    }\n" +
 142.916 -                           "}\n",
 142.917 -                           "if ($cond) $then; else $else; => if (!$cond) $else; else $then;",
 142.918 -                           "package test;\n" +
 142.919 -                           "public class Test {\n" +
 142.920 -                           "    private static void t(int i) {\n" +
 142.921 -                           "        if (i != 0) {\n" +
 142.922 -                           "            System.err.println(2);\n" +
 142.923 -                           "        } else {\n" +
 142.924 -                           "            System.err.println(1);\n" +
 142.925 -                           "        }\n" +
 142.926 -                           "    }\n" +
 142.927 -		           "}\n");
 142.928 -    }
 142.929 -    
 142.930 -    public void testDontOptimizeNegExpression() throws Exception {
 142.931 -        performRewriteTest("package test;\n" +
 142.932 -                           "public class Test {\n" +
 142.933 -                           "    private static void t(int i) {\n" +
 142.934 -                           "        if (!(i == 0)) {\n" +
 142.935 -                           "            System.err.println(1);\n" +
 142.936 -                           "        } else {\n" +
 142.937 -                           "            System.err.println(2);\n" +
 142.938 -                           "        }\n" +
 142.939 -                           "    }\n" +
 142.940 -                           "}\n",
 142.941 -                           "if (!$cond) $then; else $else; => if (!$cond) $else; else $then;",
 142.942 -                           "package test;\n" +
 142.943 -                           "public class Test {\n" +
 142.944 -                           "    private static void t(int i) {\n" +
 142.945 -                           "        if (!(i == 0)) {\n" +
 142.946 -                           "            System.err.println(2);\n" +
 142.947 -                           "        } else {\n" +
 142.948 -                           "            System.err.println(1);\n" +
 142.949 -                           "        }\n" +
 142.950 -                           "    }\n" +
 142.951 -		           "}\n");
 142.952 -    }
 142.953 -    
 142.954 -    public void testCannotOptimizeNegExpression() throws Exception {
 142.955 -        performRewriteTest("package test;\n" +
 142.956 -                           "public class Test {\n" +
 142.957 -                           "    private static void t(String str) {\n" +
 142.958 -                           "        if (str.isEmpty()) {\n" +
 142.959 -                           "            System.err.println(1);\n" +
 142.960 -                           "        } else {\n" +
 142.961 -                           "            System.err.println(2);\n" +
 142.962 -                           "        }\n" +
 142.963 -                           "    }\n" +
 142.964 -                           "}\n",
 142.965 -                           "if ($cond) $then; else $else; => if (!$cond) $else; else $then;",
 142.966 -                           "package test;\n" +
 142.967 -                           "public class Test {\n" +
 142.968 -                           "    private static void t(String str) {\n" +
 142.969 -                           "        if (!str.isEmpty()) {\n" +
 142.970 -                           "            System.err.println(2);\n" +
 142.971 -                           "        } else {\n" +
 142.972 -                           "            System.err.println(1);\n" +
 142.973 -                           "        }\n" +
 142.974 -                           "    }\n" +
 142.975 -		           "}\n");
 142.976 -    }
 142.977 -    
 142.978 -    public void testOptimizeNegExpressionNeg() throws Exception {
 142.979 -        performOptimizeNegExpressionTest("!s.isEmpty()", "s.isEmpty()");
 142.980 -    }
 142.981 -    
 142.982 -    public void testOptimizeNegExpressionParens() throws Exception {
 142.983 -        performOptimizeNegExpressionTest("!(a.length == 0)", "a.length == 0");
 142.984 -    }
 142.985 -    
 142.986 -    public void testOptimizeNegExpressionEquals() throws Exception {
 142.987 -        performOptimizeNegExpressionTest("i == 0", "i != 0");
 142.988 -    }
 142.989 -    
 142.990 -    public void testOptimizeNegExpressionNotEquals() throws Exception {
 142.991 -        performOptimizeNegExpressionTest("i != 0", "i == 0");
 142.992 -    }
 142.993 -    
 142.994 -    public void testOptimizeNegExpressionTrue() throws Exception {
 142.995 -        performOptimizeNegExpressionTest("true", "false");
 142.996 -    }
 142.997 -    
 142.998 -    public void testOptimizeNegExpressionFalse() throws Exception {
 142.999 -        performOptimizeNegExpressionTest("false", "true");
142.1000 -    }
142.1001 -    
142.1002 -    public void testOptimizeNegExpressionDeMorganAnd() throws Exception {
142.1003 -        performOptimizeNegExpressionTest("a.length != 0 && true", "a.length == 0 || false");
142.1004 -    }
142.1005 -    
142.1006 -    public void testOptimizeNegExpressionDeMorganOr() throws Exception {
142.1007 -        performOptimizeNegExpressionTest("args.length != 0 || false", "args.length == 0 && true");
142.1008 -    }
142.1009 -    
142.1010 -    public void testOptimizeNegExpressionLess() throws Exception {
142.1011 -        performOptimizeNegExpressionTest("i < 0", "i >= 0");
142.1012 -    }
142.1013 -    
142.1014 -    public void testOptimizeNegExpressionLessEq() throws Exception {
142.1015 -        performOptimizeNegExpressionTest("i <= 0", "i > 0");
142.1016 -    }
142.1017 -    
142.1018 -    public void testOptimizeNegExpressionGreater() throws Exception {
142.1019 -        performOptimizeNegExpressionTest("i > 0", "i <= 0");
142.1020 -    }
142.1021 -    
142.1022 -    public void testOptimizeNegExpressionGreaterEq() throws Exception {
142.1023 -        performOptimizeNegExpressionTest("i >= 0", "i < 0");
142.1024 -    }
142.1025 -    
142.1026 -    public void testOptimizeNegExpressionAnd() throws Exception {
142.1027 -        performOptimizeNegExpressionTest("b1 && b2", "!b1 || !b2");
142.1028 -    }
142.1029 -    
142.1030 -    public void test229785a() throws Exception {
142.1031 -        performOptimizeNegExpressionTest("(a[0] == null && a[1] != null) || (a[0] != null && !a[0].equals(a[1]))", "(a[0] != null || a[1] == null) && (a[0] == null || a[0].equals(a[1]))");
142.1032 -    }
142.1033 -    
142.1034 -    public void test229785b() throws Exception {
142.1035 -        performOptimizeNegExpressionTest("a[0] == null && a[1] != null || a[0] != null && !a[0].equals(a[1])", "(a[0] != null || a[1] == null) && (a[0] == null || a[0].equals(a[1]))");
142.1036 -    }
142.1037 -    
142.1038 -    private void performOptimizeNegExpressionTest(String origExpr, String newExpr) throws Exception {
142.1039 -        performRewriteTest("package test;\n" +
142.1040 -                           "public class Test {\n" +
142.1041 -                           "    private static void t(String s, int i, boolean b1, boolean b2, String... a) {\n" +
142.1042 -                           "        if (" + origExpr + ") {\n" +
142.1043 -                           "            System.err.println(1);\n" +
142.1044 -                           "        } else {\n" +
142.1045 -                           "            System.err.println(2);\n" +
142.1046 -                           "        }\n" +
142.1047 -                           "    }\n" +
142.1048 -                           "}\n",
142.1049 -                           "if ($cond) $then; else $else; => if (!$cond) $else; else $then;",
142.1050 -                           "package test;\n" +
142.1051 -                           "public class Test {\n" +
142.1052 -                           "    private static void t(String s, int i, boolean b1, boolean b2, String... a) {\n" +
142.1053 -                           "        if (" + newExpr + ") {\n" +
142.1054 -                           "            System.err.println(2);\n" +
142.1055 -                           "        } else {\n" +
142.1056 -                           "            System.err.println(1);\n" +
142.1057 -                           "        }\n" +
142.1058 -                           "    }\n" +
142.1059 -		           "}\n");
142.1060 -    }
142.1061 -    
142.1062 -    public void testExpression2ExpressionStatementTolerance227429() throws Exception {
142.1063 -        performRewriteTest("package test;\n" +
142.1064 -                           "public class Test {\n" +
142.1065 -                           "    private static void t() {\n" +
142.1066 -                           "        System.err.println(1);\n" +
142.1067 -                           "    }\n" +
142.1068 -                           "}\n",
142.1069 -                           "java.lang.System.err.println($args$) => java.lang.System.out.println($args$);",
142.1070 -                           "package test;\n" +
142.1071 -                           "public class Test {\n" +
142.1072 -                           "    private static void t() {\n" +
142.1073 -                           "        System.out.println(1);\n" +
142.1074 -                           "    }\n" +
142.1075 -		           "}\n");
142.1076 -    }
142.1077 -    
142.1078 -    public void testSplitIfOr() throws Exception {
142.1079 -        performRewriteTest("package test;\n" +
142.1080 -                           "public class Test {\n" +
142.1081 -                           "    private static void t(int i) {\n" +
142.1082 -                           "        if (i == 0 || i == 1) {\n" +
142.1083 -                           "            System.err.println();\n" +
142.1084 -                           "        }\n" +
142.1085 -                           "    }\n" +
142.1086 -                           "}\n",
142.1087 -                           "if ($cond1 || $cond2) $then; => if ($cond1) $then; else if ($cond2) $then;",
142.1088 -                           "package test;\n" +
142.1089 -                           "public class Test {\n" +
142.1090 -                           "    private static void t(int i) {\n" +
142.1091 -                           "        if (i == 0) {\n" +
142.1092 -                           "            System.err.println();\n" +
142.1093 -                           "        } else if (i == 1) {\n" +
142.1094 -                           "            System.err.println();\n" +
142.1095 -                           "        }\n" +
142.1096 -                           "    }\n" +
142.1097 -		           "}\n");
142.1098 -    }
142.1099 -    
142.1100 -    public void testLambdaExpr2Block() throws Exception {
142.1101 -        performRewriteTest("package test;\n" +
142.1102 -                           "import java.util.*;\n" +
142.1103 -                           "public class Test {\n" +
142.1104 -                           "    public void main(List<String> list) {\n" +
142.1105 -                           "        Collections.sort(list, (l, r) -> l.compareTo(r));\n" +
142.1106 -                           "    }\n" +
142.1107 -                           "}\n",
142.1108 -                           "($args$) -> $expr => ($args$) -> { return $expr; }",
142.1109 -                           "package test;\n" +
142.1110 -                           "import java.util.*;\n" +
142.1111 -                           "public class Test {\n" +
142.1112 -                           "    public void main(List<String> list) {\n" +
142.1113 -                           "        Collections.sort(list, (l, r) -> {\n" +
142.1114 -                           "            return l.compareTo(r);\n" +
142.1115 -                           "        });\n" +
142.1116 -                           "    }\n" +
142.1117 -		           "}\n");
142.1118 -    }
142.1119 -    
142.1120 -    public void performRewriteTest(String code, String rule, String golden) throws Exception {
142.1121 -	prepareTest("test/Test.java", code);
142.1122 -
142.1123 -        final String[] split = rule.split("=>");
142.1124 -        assertEquals(2, split.length);
142.1125 -        Map<String, TypeMirror> variablesToTypesTM = new HashMap<String, TypeMirror>();
142.1126 -        String plainRule = PatternCompilerUtilities.parseOutTypesFromPattern(info, split[0], variablesToTypesTM);
142.1127 -        Map<String, String> variablesToTypes = new HashMap<String, String>();
142.1128 -        for (Entry<String, TypeMirror> e : variablesToTypesTM.entrySet()) {
142.1129 -            if (e.getValue() == null) continue;
142.1130 -            variablesToTypes.put(e.getKey(), e.getValue().toString());
142.1131 -        }
142.1132 -        HintDescription hd = HintDescriptionFactory.create()
142.1133 -                                                   .setTrigger(PatternDescription.create(plainRule, variablesToTypes))
142.1134 -                                                   .setWorker(new HintDescription.Worker() {
142.1135 -            @Override public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
142.1136 -                return Collections.singletonList(ErrorDescriptionFactory.forName(ctx, ctx.getPath(), "", JavaFixUtilities.rewriteFix(ctx, "", ctx.getPath(), split[1])));
142.1137 -            }
142.1138 -        }).produce();
142.1139 -
142.1140 -        List<ErrorDescription> computeHints = new HintsInvoker(HintsSettings.getGlobalSettings(), new AtomicBoolean()).computeHints(info, Collections.singleton(hd));
142.1141 -
142.1142 -        assertEquals(computeHints.toString(), 1, computeHints.size());
142.1143 -
142.1144 -        Fix fix = computeHints.get(0).getFixes().getFixes().get(0);
142.1145 -
142.1146 -	fix.implement();
142.1147 -
142.1148 -        assertEquals(golden, doc.getText(0, doc.getLength()));
142.1149 -    }
142.1150 -
142.1151 -    public void performRemoveFromParentTest(String code, String rule, String golden) throws Exception {
142.1152 -	prepareTest("test/Test.java", code);
142.1153 -
142.1154 -        HintDescription hd = HintDescriptionFactory.create()
142.1155 -                                                   .setTrigger(PatternDescription.create(rule, Collections.<String, String>emptyMap()))
142.1156 -                                                   .setWorker(new HintDescription.Worker() {
142.1157 -            @Override public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
142.1158 -                return Collections.singletonList(ErrorDescriptionFactory.forName(ctx, ctx.getPath(), "", JavaFixUtilities.removeFromParent(ctx, "", ctx.getPath())));
142.1159 -            }
142.1160 -        }).produce();
142.1161 -
142.1162 -        List<ErrorDescription> computeHints = new HintsInvoker(HintsSettings.getGlobalSettings(), new AtomicBoolean()).computeHints(info, Collections.singleton(hd));
142.1163 -
142.1164 -        assertEquals(computeHints.toString(), 1, computeHints.size());
142.1165 -
142.1166 -        Fix fix = computeHints.get(0).getFixes().getFixes().get(0);
142.1167 -
142.1168 -	fix.implement();
142.1169 -
142.1170 -        assertEquals(golden, doc.getText(0, doc.getLength()));
142.1171 -    }
142.1172 -}
   143.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/MatcherUtilitiesTest.java	Sun Jan 08 20:10:08 2017 +0100
   143.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   143.3 @@ -1,113 +0,0 @@
   143.4 -/*
   143.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   143.6 - *
   143.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
   143.8 - *
   143.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  143.10 - * Other names may be trademarks of their respective owners.
  143.11 - *
  143.12 - * The contents of this file are subject to the terms of either the GNU
  143.13 - * General Public License Version 2 only ("GPL") or the Common
  143.14 - * Development and Distribution License("CDDL") (collectively, the
  143.15 - * "License"). You may not use this file except in compliance with the
  143.16 - * License. You can obtain a copy of the License at
  143.17 - * http://www.netbeans.org/cddl-gplv2.html
  143.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  143.19 - * specific language governing permissions and limitations under the
  143.20 - * License.  When distributing the software, include this License Header
  143.21 - * Notice in each file and include the License file at
  143.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  143.23 - * particular file as subject to the "Classpath" exception as provided
  143.24 - * by Oracle in the GPL Version 2 section of the License file that
  143.25 - * accompanied this code. If applicable, add the following below the
  143.26 - * License Header, with the fields enclosed by brackets [] replaced by
  143.27 - * your own identifying information:
  143.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  143.29 - *
  143.30 - * If you wish your version of this file to be governed by only the CDDL
  143.31 - * or only the GPL Version 2, indicate your decision by adding
  143.32 - * "[Contributor] elects to include this software in this distribution
  143.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  143.34 - * single choice of license, a recipient has the option to distribute
  143.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  143.36 - * to extend the choice of license to its licensees as provided above.
  143.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  143.38 - * Version 2 license, then the option applies only if the new code is
  143.39 - * made subject to such option by the copyright holder.
  143.40 - *
  143.41 - * Contributor(s):
  143.42 - *
  143.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  143.44 - */
  143.45 -
  143.46 -package org.netbeans.spi.java.hints;
  143.47 -
  143.48 -import com.sun.source.util.TreePath;
  143.49 -import java.util.Collection;
  143.50 -import java.util.Collections;
  143.51 -import java.util.HashMap;
  143.52 -import java.util.Map;
  143.53 -import java.util.regex.Pattern;
  143.54 -import org.netbeans.modules.java.hints.spiimpl.SPIAccessor;
  143.55 -import org.netbeans.modules.java.hints.spiimpl.TestBase;
  143.56 -import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
  143.57 -
  143.58 -/**
  143.59 - *
  143.60 - * @author lahvac
  143.61 - */
  143.62 -public class MatcherUtilitiesTest extends TestBase {
  143.63 -
  143.64 -    public MatcherUtilitiesTest(String name) {
  143.65 -        super(name);
  143.66 -    }
  143.67 -
  143.68 -    public void testParentMatches1() throws Exception {
  143.69 -        String code = "package test; public class Test { private int test() { int i = 0; i = test(|); } }";
  143.70 -        int pos = code.indexOf("|");
  143.71 -
  143.72 -        code = code.replaceAll(Pattern.quote("|"), "");
  143.73 -
  143.74 -        prepareTest("test/Test.java", code);
  143.75 -
  143.76 -        TreePath tp = info.getTreeUtilities().pathFor(pos);
  143.77 -        HintContext ctx = SPIAccessor.getINSTANCE().createHintContext(info, HintsSettings.getGlobalSettings(), null, null, tp, Collections.<String, TreePath>emptyMap(), Collections.<String, Collection<? extends TreePath>>emptyMap(), Collections.<String, String>emptyMap());
  143.78 -
  143.79 -        assertTrue(MatcherUtilities.matches(ctx, ctx.getPath().getParentPath(), "$0 = $_"));
  143.80 -    }
  143.81 -
  143.82 -    public void testParentMatches2() throws Exception {
  143.83 -        String code = "package test; public class Test { private int test() { int i = test(|); } }";
  143.84 -        int pos = code.indexOf("|");
  143.85 -
  143.86 -        code = code.replaceAll(Pattern.quote("|"), "");
  143.87 -
  143.88 -        prepareTest("test/Test.java", code);
  143.89 -
  143.90 -        TreePath tp = info.getTreeUtilities().pathFor(pos);
  143.91 -        HintContext ctx = SPIAccessor.getINSTANCE().createHintContext(info, HintsSettings.getGlobalSettings(), null, null, tp, Collections.<String, TreePath>emptyMap(), Collections.<String, Collection<? extends TreePath>>emptyMap(), Collections.<String, String>emptyMap());
  143.92 -
  143.93 -        assertTrue(MatcherUtilities.matches(ctx, ctx.getPath().getParentPath(), "$1 $0 = $_;"));
  143.94 -    }
  143.95 -
  143.96 -    public void testOutVariables1() throws Exception {
  143.97 -        String code = "package test; public class Test { private int test() { int i = test(|); } }";
  143.98 -        int pos = code.indexOf("|");
  143.99 -
 143.100 -        code = code.replaceAll(Pattern.quote("|"), "");
 143.101 -
 143.102 -        prepareTest("test/Test.java", code);
 143.103 -
 143.104 -        TreePath tp = info.getTreeUtilities().pathFor(pos);
 143.105 -        HintContext ctx = SPIAccessor.getINSTANCE().createHintContext(info, HintsSettings.getGlobalSettings(), null, null, tp, Collections.<String, TreePath>emptyMap(), Collections.<String, Collection<? extends TreePath>>emptyMap(), Collections.<String, String>emptyMap());
 143.106 -
 143.107 -        Map<String, TreePath> outVariables = new HashMap<String, TreePath>();
 143.108 -        Map<String, Collection<? extends TreePath>> outMultiVariables = new HashMap<String, Collection<? extends TreePath>>();
 143.109 -        Map<String, String> outVariables2Names = new HashMap<String, String>();
 143.110 -
 143.111 -        assertTrue(MatcherUtilities.matches(ctx, ctx.getPath().getParentPath(), "$1 $0 = $_;", outVariables, outMultiVariables, outVariables2Names));
 143.112 -        assertEquals("int", outVariables.get("$1").getLeaf().toString());
 143.113 -        assertEquals("i", outVariables2Names.get("$0"));
 143.114 -    }
 143.115 -
 143.116 -}
 143.117 \ No newline at end of file
   144.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/TestUtils.java	Sun Jan 08 20:10:08 2017 +0100
   144.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   144.3 @@ -1,69 +0,0 @@
   144.4 -/*
   144.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   144.6 - *
   144.7 - * Copyright 2015 Oracle and/or its affiliates. All rights reserved.
   144.8 - *
   144.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  144.10 - * Other names may be trademarks of their respective owners.
  144.11 - *
  144.12 - * The contents of this file are subject to the terms of either the GNU
  144.13 - * General Public License Version 2 only ("GPL") or the Common
  144.14 - * Development and Distribution License("CDDL") (collectively, the
  144.15 - * "License"). You may not use this file except in compliance with the
  144.16 - * License. You can obtain a copy of the License at
  144.17 - * http://www.netbeans.org/cddl-gplv2.html
  144.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  144.19 - * specific language governing permissions and limitations under the
  144.20 - * License.  When distributing the software, include this License Header
  144.21 - * Notice in each file and include the License file at
  144.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  144.23 - * particular file as subject to the "Classpath" exception as provided
  144.24 - * by Oracle in the GPL Version 2 section of the License file that
  144.25 - * accompanied this code. If applicable, add the following below the
  144.26 - * License Header, with the fields enclosed by brackets [] replaced by
  144.27 - * your own identifying information:
  144.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  144.29 - *
  144.30 - * If you wish your version of this file to be governed by only the CDDL
  144.31 - * or only the GPL Version 2, indicate your decision by adding
  144.32 - * "[Contributor] elects to include this software in this distribution
  144.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  144.34 - * single choice of license, a recipient has the option to distribute
  144.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  144.36 - * to extend the choice of license to its licensees as provided above.
  144.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  144.38 - * Version 2 license, then the option applies only if the new code is
  144.39 - * made subject to such option by the copyright holder.
  144.40 - *
  144.41 - * Contributor(s):
  144.42 - *
  144.43 - * Portions Copyrighted 2015 Sun Microsystems, Inc.
  144.44 - */
  144.45 -package org.netbeans.spi.java.hints;
  144.46 -
  144.47 -import org.netbeans.api.editor.mimelookup.MimePath;
  144.48 -import org.netbeans.modules.editor.impl.DocumentFactoryImpl;
  144.49 -import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
  144.50 -import org.openide.util.Lookup;
  144.51 -import org.openide.util.lookup.Lookups;
  144.52 -import org.openide.util.lookup.ServiceProvider;
  144.53 -
  144.54 -/**
  144.55 - *
  144.56 - * @author lahvac
  144.57 - */
  144.58 -public class TestUtils {
  144.59 -
  144.60 -    @ServiceProvider(service = MimeDataProvider.class)
  144.61 -    public static final class MimeDataProviderImpl implements MimeDataProvider {
  144.62 -
  144.63 -        private final Lookup l = Lookups.singleton(new DocumentFactoryImpl());
  144.64 -
  144.65 -        @Override
  144.66 -        public Lookup getLookup(MimePath mimePath) {
  144.67 -            return "text/x-java".equals(mimePath.getPath()) ? l : Lookup.EMPTY;
  144.68 -        }
  144.69 -
  144.70 -    }
  144.71 -
  144.72 -}
   145.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/matching/CopyFinderTest.java	Sun Jan 08 20:10:08 2017 +0100
   145.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   145.3 @@ -1,1612 +0,0 @@
   145.4 -/*
   145.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   145.6 - *
   145.7 - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
   145.8 - *
   145.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  145.10 - * Other names may be trademarks of their respective owners.
  145.11 - *
  145.12 - * The contents of this file are subject to the terms of either the GNU
  145.13 - * General Public License Version 2 only ("GPL") or the Common
  145.14 - * Development and Distribution License("CDDL") (collectively, the
  145.15 - * "License"). You may not use this file except in compliance with the
  145.16 - * License. You can obtain a copy of the License at
  145.17 - * http://www.netbeans.org/cddl-gplv2.html
  145.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  145.19 - * specific language governing permissions and limitations under the
  145.20 - * License.  When distributing the software, include this License Header
  145.21 - * Notice in each file and include the License file at
  145.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  145.23 - * particular file as subject to the "Classpath" exception as provided
  145.24 - * by Oracle in the GPL Version 2 section of the License file that
  145.25 - * accompanied this code. If applicable, add the following below the
  145.26 - * License Header, with the fields enclosed by brackets [] replaced by
  145.27 - * your own identifying information:
  145.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  145.29 - *
  145.30 - * Contributor(s):
  145.31 - *
  145.32 - * Portions Copyrighted 2007-2010 Sun Microsystems, Inc.
  145.33 - */
  145.34 -package org.netbeans.spi.java.hints.matching;
  145.35 -
  145.36 -import com.sun.source.tree.BlockTree;
  145.37 -import com.sun.source.tree.StatementTree;
  145.38 -import com.sun.source.tree.Tree;
  145.39 -import com.sun.source.tree.VariableTree;
  145.40 -import com.sun.source.util.SourcePositions;
  145.41 -import com.sun.source.util.TreePath;
  145.42 -import com.sun.source.util.TreePathScanner;
  145.43 -import java.io.File;
  145.44 -import java.util.Arrays;
  145.45 -import java.util.Collection;
  145.46 -import java.util.Collections;
  145.47 -import java.util.EnumSet;
  145.48 -import java.util.HashMap;
  145.49 -import java.util.HashSet;
  145.50 -import java.util.LinkedList;
  145.51 -import java.util.List;
  145.52 -import java.util.Map;
  145.53 -import java.util.Map.Entry;
  145.54 -import java.util.Set;
  145.55 -import java.util.concurrent.atomic.AtomicBoolean;
  145.56 -import javax.lang.model.element.VariableElement;
  145.57 -import javax.lang.model.type.TypeMirror;
  145.58 -import javax.swing.text.Document;
  145.59 -import org.netbeans.api.java.lexer.JavaTokenId;
  145.60 -import org.netbeans.api.java.source.CompilationInfo;
  145.61 -import org.netbeans.api.java.source.JavaSource;
  145.62 -import org.netbeans.api.java.source.JavaSource.Phase;
  145.63 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  145.64 -import org.netbeans.api.java.source.TestUtilities;
  145.65 -import org.netbeans.api.java.source.TreePathHandle;
  145.66 -import org.netbeans.api.java.source.matching.MatchingTestAccessor;
  145.67 -import org.netbeans.api.java.source.matching.Pattern;
  145.68 -import org.netbeans.api.lexer.Language;
  145.69 -import org.netbeans.junit.NbTestCase;
  145.70 -import org.netbeans.modules.java.hints.introduce.IntroduceMethodFix;
  145.71 -import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch;
  145.72 -import org.netbeans.modules.java.hints.spiimpl.pm.BulkSearch.BulkPattern;
  145.73 -import org.netbeans.modules.java.hints.spiimpl.pm.PatternCompiler;
  145.74 -import org.netbeans.modules.java.hints.spiimpl.pm.PatternCompilerUtilities;
  145.75 -import org.netbeans.modules.java.source.matching.CopyFinder;
  145.76 -import org.netbeans.modules.java.source.matching.CopyFinder.Cancel;
  145.77 -import org.netbeans.modules.java.source.matching.CopyFinder.Options;
  145.78 -import org.netbeans.modules.java.source.matching.CopyFinder.VariableAssignments;
  145.79 -import org.openide.cookies.EditorCookie;
  145.80 -import org.openide.filesystems.FileObject;
  145.81 -import org.openide.filesystems.FileUtil;
  145.82 -import org.openide.loaders.DataObject;
  145.83 -
  145.84 -/**
  145.85 - *
  145.86 - * @author Jan Lahoda
  145.87 - */
  145.88 -public class CopyFinderTest extends NbTestCase {
  145.89 -
  145.90 -    public CopyFinderTest(String testName) {
  145.91 -        super(testName);
  145.92 -    }
  145.93 -
  145.94 -//    public static TestSuite suite() {
  145.95 -//        NbTestSuite nb = new NbTestSuite();
  145.96 -//
  145.97 -//        nb.addTest(new CopyFinderTest("testCorrectSite3"));
  145.98 -//
  145.99 -//        return nb;
 145.100 -//    }
 145.101 -
 145.102 -    @Override
 145.103 -    protected void setUp() throws Exception {
 145.104 -        SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
 145.105 -        super.setUp();
 145.106 -    }
 145.107 -
 145.108 -    public void testSimple1() throws Exception {
 145.109 -        performTest("package test; public class Test {public void test() {int i = 0; y = i + i; y = i + i;}}", 90 - 22, 95 - 22, 101 - 22, 106 - 22);
 145.110 -    }
 145.111 -
 145.112 -//    public void testSimple2() throws Exception {
 145.113 -//        performTest("package test; public class Test {public void test() {int i = 0; y = i + i; y = i + i + i;}}", 90 - 22, 95 - 22, 101 - 22, 106 - 22);
 145.114 -//    }
 145.115 -
 145.116 -    public void testSimple3() throws Exception {
 145.117 -        performTest("package test; public class Test {public void test() {int i = System.currentTimeMillis(); y = System.currentTimeMillis();}}", 83 - 22, 109 - 22, 115 - 22, 141 - 22);
 145.118 -    }
 145.119 -
 145.120 -    public void testSimple4() throws Exception {
 145.121 -        performTest("package test; import java.util.ArrayList; public class Test {public void test() {Object o = new ArrayList<String>();o = new ArrayList<String>();}}", 114 - 22, 137- 22, 142 - 22, 165 - 22);
 145.122 -    }
 145.123 -
 145.124 -    public void testSimple5() throws Exception {
 145.125 -        performTest("package test; public class Test {public void test() {Object o = null; String s = (String) o; s = (String) o; s = (String) null; o = (Object) o;}}", 103 - 22, 113 - 22, 119 - 22, 129 - 22);
 145.126 -    }
 145.127 -
 145.128 -    public void testSimple6() throws Exception {
 145.129 -        performTest("package test; public class Test {public void test() {int i = 0; y = i + i; y = i + i;} public void test2() {int i = 0; y = i + i; y = i + i;}}", 90 - 22, 95 - 22, 101 - 22, 106 - 22);
 145.130 -    }
 145.131 -
 145.132 -    public void testSimple7() throws Exception {
 145.133 -        performTest("package test; public class Test {public void test() {int i = 0; y = i != 0 ? i + i : i * i; y = i != 0 ? i + i : i * i; y = i != 1 ? i + i : i * i; y = i == 0 ? i + i : i * i; y = i != 0 ? i * i : i * i; y = i != 0 ? i + i : i + i; y = i != 0 ? i + i : i * 1;}}", 90 - 22, 112 - 22, 118 - 22, 140 - 22);
 145.134 -    }
 145.135 -
 145.136 -    public void testSimple8() throws Exception {
 145.137 -        performTest("package test; public class Test {public void test() {int i = 0; int y = -i; y = -i; y = +i; y = +y;}}", 94 - 22, 96 - 22, 102 - 22, 104 - 22);
 145.138 -    }
 145.139 -
 145.140 -    public void testSimple9() throws Exception {
 145.141 -        performTest("package test; public class Test {public void test() {int i = 0; int y = i *= 9; y = i *= 9; y = i /= 9; y = i *= 8; y = y *= 9;}}", 94 - 22, 100 - 22, 106 - 22, 112 - 22);
 145.142 -    }
 145.143 -
 145.144 -    public void testSimple10() throws Exception {
 145.145 -        performTest("package test; public class Test {public void test() {int[] i = null; int y = i[1]; y = i[1]; y = i[y]; y = i[0];}}", 99 - 22, 103 - 22, 109 - 22, 113 - 22);
 145.146 -    }
 145.147 -
 145.148 -    public void testSimple11() throws Exception {
 145.149 -        performTest("package test; public class Test {public void test() {int[] i = new int[0]; i = new int[0]; i = new int[1];}}", 85 - 22, 95 - 22, 101 - 22, 111 - 22);
 145.150 -    }
 145.151 -
 145.152 -    public void testSimple12() throws Exception {
 145.153 -        performTest("package test; public class Test {public void test() {int[] i = new int[1]; i = new int[1]; i = new int[0];}}", 85 - 22, 95 - 22, 101 - 22, 111 - 22);
 145.154 -    }
 145.155 -
 145.156 -    public void testSimple13() throws Exception {
 145.157 -        performTest("package test; public class Test {public void test() {int i = 0; int y = (i); y = (i); y = i;}}", 94 - 22, 97 - 22, 103 - 22, 106 - 22);
 145.158 -    }
 145.159 -
 145.160 -    public void testSimple14() throws Exception {
 145.161 -        performTest("package test; public class Test {public void test() {Object o = null; boolean b = o instanceof String; b = o instanceof String; b = o instanceof Object;}}", 104 - 22, 123 - 22, 129 - 22, 148 - 22);
 145.162 -    }
 145.163 -
 145.164 -    public void testSimple15() throws Exception {
 145.165 -        performTest("package test; public class Test {private int x = 1; private int y = 1; public void test() {int x = 1; int y = 1;}}", 90 - 22, 91 - 22, 71 - 22, 72 - 22, 121 - 22, 122 - 22, 132 - 22, 133 - 22);
 145.166 -    }
 145.167 -
 145.168 -    public void testSimple16() throws Exception {
 145.169 -        performTest("package test; public class Test {public void test(int i) {int y = \"\".length(); test(\"\".length());} }", 88 - 22, 99 - 22, 106 - 22, 117 - 22);
 145.170 -    }
 145.171 -
 145.172 -    public void testSimple17() throws Exception {
 145.173 -        performTest("package test; public class Test {public void test2() {int a = test(test(test(1))); a = test(test(test(1))); a = test(test(test(1)));} public int test(int i) {return 0;} }", 94 - 22, 101 - 22, 119 - 22, 126 - 22, 144 - 22, 151 - 22);
 145.174 -    }
 145.175 -
 145.176 -    public void testMemberSelectAndIdentifierAreSame() throws Exception {
 145.177 -        performTest("package test; import static java.lang.String.*; public class Test {public void test1() {|String.valueOf(2)|; |valueOf(2)|;} }");
 145.178 -    }
 145.179 -
 145.180 -    public void testVariables1() throws Exception {
 145.181 -        performVariablesTest("package test; import static java.lang.String.*; public class Test {public void test1() {String.valueOf(2+4);} }",
 145.182 -                             "java.lang.String.valueOf($1)",
 145.183 -                             new Pair[] {new Pair<String, int[]>("$1", new int[] {134 - 31, 137 - 31})},
 145.184 -                             new Pair[0]);
 145.185 -    }
 145.186 -
 145.187 -    public void testAssert1() throws Exception {
 145.188 -        performTest("package test; public class Test {public void test() {int i = 0; |assert i == 1;| |assert i == 1;|}}");
 145.189 -    }
 145.190 -
 145.191 -    public void testReturn1() throws Exception {
 145.192 -        performTest("package test; public class Test {public int test1() {|return 1;|} public int test2() {|return 1;|}}");
 145.193 -    }
 145.194 -
 145.195 -    public void testIf1() throws Exception {
 145.196 -        performTest("package test; public class Test {public void test() { int i = 0; int j; |if (i == 0) {j = 1;} else {j = 2;}| |if (i == 0) {j = 1;} else {j = 2;}| } }");
 145.197 -    }
 145.198 -
 145.199 -    public void testExpressionStatement1() throws Exception {
 145.200 -        performTest("package test; public class Test {public void test() { int i = 0; |i = 1;| |i = 1;| } }");
 145.201 -    }
 145.202 -
 145.203 -    public void testBlock1() throws Exception {
 145.204 -        performTest("package test; public class Test {public void test() { int i = 0; |{i = 1;}| |{i = 1;}| } }");
 145.205 -    }
 145.206 -
 145.207 -    public void testSynchronized1() throws Exception {
 145.208 -        performTest("package test; public class Test {public void test() { Object o = null; int i = 0; |synchronized (o) {i = 1;}| |synchronized (o) {i = 1;}| } }");
 145.209 -    }
 145.210 -
 145.211 -//    public void testEnhancedForLoop() throws Exception {
 145.212 -//        performTest("package test; public class Test {public void test(Iterable<String> i) { |for (String s : i) { System.err.println(); }| |for (String s : i) { System.err.println(); }| }");
 145.213 -//    }
 145.214 -
 145.215 -//    public void testConstants() throws Exception {
 145.216 -//        performTest("package test; public class Test {public static final int A = 3; public void test() { int i = |3|; i = |test.Test.A|; } }");
 145.217 -//    }
 145.218 -
 145.219 -    public void testOverridingImplementing1() throws Exception {
 145.220 -        performVariablesTest("package test; public class Test implements Runnable { { this.run(); } public void run() { } } }",
 145.221 -                             "$0{java.lang.Runnable}.run()",
 145.222 -                             new Pair[] {new Pair<String, int[]>("$0", new int[] {56, 60})},
 145.223 -                             new Pair[0]);
 145.224 -    }
 145.225 -
 145.226 -    public void testMemberSelectCCE() throws Exception {
 145.227 -        //should not throw a CCE
 145.228 -        //(selected regions are not duplicates)
 145.229 -        performTest("package test; public class Test {public static class T extends Test { public void test() { |Test.test|(); |System.err.println|(); } } }", false);
 145.230 -    }
 145.231 -
 145.232 -    public void testLocalVariable() throws Exception {
 145.233 -        performVariablesTest("package test; public class Test {public void test1() { { int y; y = 1; } int z; { int y; z = 1; } } }",
 145.234 -                             "{ int $1; $1 = 1; }",
 145.235 -                             new Pair[0],
 145.236 -                             new Pair[] {new Pair<String, String>("$1", "y")});
 145.237 -    }
 145.238 -
 145.239 -    public void testStatementAndSingleBlockStatementAreSame1() throws Exception {
 145.240 -        performVariablesTest("package test; public class Test {public void test1() { { int x; { x = 1; } } } }",
 145.241 -                             "{ int $1; $1 = 1; }",
 145.242 -                             new Pair[0],
 145.243 -                             new Pair[] {new Pair<String, String>("$1", "x")});
 145.244 -    }
 145.245 -
 145.246 -    public void testStatementAndSingleBlockStatementAreSame2() throws Exception {
 145.247 -        performVariablesTest("package test; public class Test {public void test1() { { int x; x = 1; } } }",
 145.248 -                             "{ int $1; { $1 = 1; } }",
 145.249 -                             new Pair[0],
 145.250 -                             new Pair[] {new Pair<String, String>("$1", "x")});
 145.251 -    }
 145.252 -
 145.253 -    public void testStatementVariables() throws Exception {
 145.254 -        performVariablesTest("package test; public class Test {public int test1() { if (true) return 1; else return 2; } }",
 145.255 -                             "if ($1) $2; else $3;",
 145.256 -                             new Pair[] {
 145.257 -                                  new Pair<String, int[]>("$1", new int[] {89 - 31, 93 - 31}),
 145.258 -                                  new Pair<String, int[]>("$2", new int[] {95 - 31, 104 - 31}),
 145.259 -                                  new Pair<String, int[]>("$3", new int[] {110 - 31, 119 - 31})
 145.260 -                             },
 145.261 -                             new Pair[0]);
 145.262 -    }
 145.263 -
 145.264 -    public void testThrowStatement() throws Exception {
 145.265 -        performVariablesTest("package test; public class Test {public void test() { throw new NullPointerException(); throw new IllegalStateException();} }",
 145.266 -                             "throw new NullPointerException()",
 145.267 -                             new Pair[0],
 145.268 -                             new Pair[0]);
 145.269 -    }
 145.270 -
 145.271 -    public void testMultiStatementVariables1() throws Exception {
 145.272 -        performVariablesTest("package test; public class Test { public int test1() { System.err.println(); System.err.println(); int i = 3; System.err.println(i); System.err.println(i); return i; } }",
 145.273 -                             "{ $s1$; int $i = 3; $s2$; return $i; }",
 145.274 -                             new Pair[0],
 145.275 -                             new Pair[] {
 145.276 -                                  new Pair<String, int[]>("$s1$", new int[] {55, 76, 77, 98}),
 145.277 -                                  new Pair<String, int[]>("$s2$", new int[] {110, 132, 133, 155})
 145.278 -                             },
 145.279 -                             new Pair[] {new Pair<String, String>("$i", "i")});
 145.280 -    }
 145.281 -
 145.282 -    public void testMultiStatementVariables2() throws Exception {
 145.283 -        performVariablesTest("package test; public class Test { public int test1() { int i = 3; return i; } }",
 145.284 -                             "{ $s1$; int $i = 3; $s2$; return $i; }",
 145.285 -                             new Pair[0],
 145.286 -                             new Pair[] {
 145.287 -                                  new Pair<String, int[]>("$s1$", new int[] {}),
 145.288 -                                  new Pair<String, int[]>("$s2$", new int[] {}),
 145.289 -                             },
 145.290 -                             new Pair[] {new Pair<String, String>("$i", "i")});
 145.291 -    }
 145.292 -
 145.293 -    public void testMultiStatementVariablesAndBlocks1() throws Exception {
 145.294 -        performVariablesTest("package test; public class Test { public void test1() { if (true) System.err.println(); } }",
 145.295 -                             "if ($c) {$s1$; System.err.println(); $s2$; }",
 145.296 -                             new Pair[] {new Pair<String, int[]>("$c", new int[] {60, 64})},
 145.297 -                             new Pair[] {
 145.298 -                                  new Pair<String, int[]>("$s1$", new int[] {}),
 145.299 -                                  new Pair<String, int[]>("$s2$", new int[] {}),
 145.300 -                             },
 145.301 -                             new Pair[0]);
 145.302 -    }
 145.303 -
 145.304 -    public void testMultiStatementVariablesAndBlocks2() throws Exception {
 145.305 -        performVariablesTest("package test; public class Test { public void test1() { if (true) System.err.println(); } }",
 145.306 -                             "if ($c) {$s1$; System.err.println(); }",
 145.307 -                             new Pair[] {new Pair<String, int[]>("$c", new int[] {60, 64})},
 145.308 -                             new Pair[] {
 145.309 -                                  new Pair<String, int[]>("$s1$", new int[] {}),
 145.310 -                             },
 145.311 -                             new Pair[0]);
 145.312 -    }
 145.313 -
 145.314 -    public void testMultiStatementVariablesAndBlocks3() throws Exception {
 145.315 -        performVariablesTest("package test; public class Test { public void test1() { if (true) System.err.println(); } }",
 145.316 -                             "if ($c) {System.err.println(); $s2$; }",
 145.317 -                             new Pair[] {new Pair<String, int[]>("$c", new int[] {60, 64})},
 145.318 -                             new Pair[] {
 145.319 -                                  new Pair<String, int[]>("$s2$", new int[] {}),
 145.320 -                             },
 145.321 -                             new Pair[0]);
 145.322 -    }
 145.323 -
 145.324 -    public void testMultiStatementVariablesAndBlocks4() throws Exception {
 145.325 -        performVariablesTest("package test; public class Test { public void test1() { if (true) System.err.println(); } }",
 145.326 -                             "if ($c) { $s$; }",
 145.327 -                             new Pair[] {new Pair<String, int[]>("$c", new int[] {60, 64})},
 145.328 -                             new Pair[] {
 145.329 -                                  new Pair<String, int[]>("$s$", new int[] {66, 87}),
 145.330 -                             },
 145.331 -                             new Pair[0]);
 145.332 -    }
 145.333 -
 145.334 -    public void testVariableVerification() throws Exception {
 145.335 -        performVariablesTest("package test; public class Test { public void test1(String[] a, String[] b) { for (int c = 0; c < a.length; c++) { String s = b[c]; System.err.println(s); } } }",
 145.336 -                             "for(int $i = 0; $i < $array.length; $i++) { $T $var = $array[$i]; $stmts$; }",
 145.337 -                             new Pair[0],
 145.338 -                             new Pair[0],
 145.339 -                             new Pair[0],
 145.340 -                             true);
 145.341 -    }
 145.342 -
 145.343 -    public void testFor() throws Exception {
 145.344 -        performVariablesTest("package test; public class Test { public void test1(String[] a) { for (int c = 0; c < a.length; c++) { String s = a[c]; System.err.println(s); } } }",
 145.345 -                             "for(int $i = 0; $i < $array.length; $i++) { $T $var = $array[$i]; $stmts$; }",
 145.346 -                             new Pair[] {
 145.347 -                                  new Pair<String, int[]>("$array", new int[] {117 - 31, 118 - 31}),
 145.348 -                                  new Pair<String, int[]>("$T", new int[] {134 - 31, 140 - 31}),
 145.349 -                             },
 145.350 -                             new Pair[] {
 145.351 -                                  new Pair<String, int[]>("$stmts$", new int[] {151 - 31, 173 - 31}),
 145.352 -                             },
 145.353 -                             new Pair[] {
 145.354 -                                  new Pair<String, String>("$i", "c"),
 145.355 -                                  new Pair<String, String>("$var", "s"),
 145.356 -                             });
 145.357 -    }
 145.358 -
 145.359 -    public void testEnhancedFor() throws Exception {
 145.360 -        performVariablesTest("package test; public class Test { public void test1(String[] a) { for (String s : a) { System.err.println(s); } } }",
 145.361 -                             "for($T $var : $array) { $stmts$; }",
 145.362 -                             new Pair[] {
 145.363 -                                  new Pair<String, int[]>("$array", new int[] {113 - 31, 114 - 31}),
 145.364 -                                  new Pair<String, int[]>("$T", new int[] {102 - 31, 108 - 31}),
 145.365 -                             },
 145.366 -                             new Pair[] {
 145.367 -                                  new Pair<String, int[]>("$stmts$", new int[] {118 - 31, 140 - 31}),
 145.368 -                             },
 145.369 -                             new Pair[] {
 145.370 -                                  new Pair<String, String>("$var", "s"),
 145.371 -                             });
 145.372 -    }
 145.373 -
 145.374 -    public void testWhile() throws Exception {
 145.375 -        performVariablesTest("package test; public class Test { public void test1(String[] a) { int c = 0; while  (c < a.length) { String s = a[c]; System.err.println(s); c++; } } }",
 145.376 -                             "while ($i < $array.length) { $T $var = $array[$i]; $stmts$; $i++; }",
 145.377 -                             new Pair[] {
 145.378 -                                  new Pair<String, int[]>("$array", new int[] {120 - 31, 121 - 31}),
 145.379 -                                  new Pair<String, int[]>("$T", new int[] {132 - 31, 138 - 31}),
 145.380 -                                  new Pair<String, int[]>("$i", new int[] {116 - 31, 117 - 31}),
 145.381 -                             },
 145.382 -                             new Pair[] {
 145.383 -                                  new Pair<String, int[]>("$stmts$", new int[] {149 - 31, 171 - 31}),
 145.384 -                             },
 145.385 -                             new Pair[] {
 145.386 -                                  new Pair<String, String>("$var", "s"),
 145.387 -                             });
 145.388 -    }
 145.389 -
 145.390 -    public void testDoWhile() throws Exception {
 145.391 -        performVariablesTest("package test; public class Test { public void test1(String[] a) { int c = 0; do { String s = a[c]; System.err.println(s); c++; } while  (c < a.length); } }",
 145.392 -                             "do { $T $var = $array[$i]; $stmts$; $i++; } while ($i < $array.length);",
 145.393 -                             new Pair[] {
 145.394 -                                  new Pair<String, int[]>("$array", new int[] {124 - 31, 125 - 31}),
 145.395 -                                  new Pair<String, int[]>("$T", new int[] {113 - 31, 119 - 31}),
 145.396 -                                  new Pair<String, int[]>("$i", new int[] {126 - 31, 127 - 31}),
 145.397 -                             },
 145.398 -                             new Pair[] {
 145.399 -                                  new Pair<String, int[]>("$stmts$", new int[] {130 - 31, 152 - 31}),
 145.400 -                             },
 145.401 -                             new Pair[] {
 145.402 -                                  new Pair<String, String>("$var", "s"),
 145.403 -                             });
 145.404 -    }
 145.405 -
 145.406 -    public void testArrayType() throws Exception {
 145.407 -        performVariablesTest("package test; public class Test { public void test1() { int[][] a; } }",
 145.408 -                             "$T[]",
 145.409 -                             new Pair[] {
 145.410 -                                  new Pair<String, int[]>("$T", new int[] {87 - 31, /*92*//*XXX:*/94 - 31}),
 145.411 -                             },
 145.412 -                             new Pair[0],
 145.413 -                             new Pair[0]);
 145.414 -    }
 145.415 -
 145.416 -    public void testSemiMatchPackage() throws Exception {
 145.417 -        performVariablesTest("package test; import javax.lang.model.type.TypeMirror; public class Test { }",
 145.418 -                             "$T{java.lang.Object}.type",
 145.419 -                             new Pair[0],
 145.420 -                             new Pair[0],
 145.421 -                             new Pair[0],
 145.422 -                             true);
 145.423 -    }
 145.424 -
 145.425 -    public void testNullType() throws Exception {
 145.426 -        performVariablesTest("package javax.lang.model.type; public class Test { }",
 145.427 -                             "$T{java.lang.Object}.type",
 145.428 -                             new Pair[0],
 145.429 -                             new Pair[0],
 145.430 -                             new Pair[0],
 145.431 -                             true);
 145.432 -    }
 145.433 -
 145.434 -    public void testTryCatch() throws Exception {
 145.435 -        performVariablesTest("package test; import java.io.*; public class Test { public void test() { InputStream ins = null; try { ins = new FileInputStream(\"\"); } catch (IOException e) { e.printStackTrace(); } finally {ins.close();} } }",
 145.436 -                             "try {$stmts$;} catch (java.io.IOException $e) {$e.printStackTrace();} finally {$finally$;}",
 145.437 -                             new Pair[] {
 145.438 -                                   new Pair<String, int[]>("$e", new int[] {176 - 31 - 2, 189 - 31 - 2}),
 145.439 -                             },
 145.440 -                             new Pair[] {
 145.441 -                                  new Pair<String, int[]>("$stmts$", new int[] {134 - 31, 166 - 31 - 2}),
 145.442 -                                  new Pair<String, int[]>("$finally$", new int[] {225 - 31 - 2, 237 - 31 - 2}),
 145.443 -                             },
 145.444 -                             new Pair[] {
 145.445 -                                  new Pair<String, String>("$e", "e"),
 145.446 -                             });
 145.447 -    }
 145.448 -
 145.449 -    public void testMultiParameters1() throws Exception {
 145.450 -        performVariablesTest("package test; public class Test { { java.util.Arrays.asList(\"a\", \"b\", \"c\"); }",
 145.451 -                             "java.util.Arrays.asList($1$)",
 145.452 -                             new Pair[] {
 145.453 -                             },
 145.454 -                             new Pair[] {
 145.455 -                                new Pair<String, int[]>("$1$", new int[] {60, 63, 65, 68, 70, 73}),
 145.456 -                             },
 145.457 -                             new Pair[] {
 145.458 -                             });
 145.459 -    }
 145.460 -
 145.461 -    public void testMultiParameters2() throws Exception {
 145.462 -        performVariablesTest("package test; public class Test { { java.util.Arrays.asList(new String(\"a\"), \"b\", \"c\"); }",
 145.463 -                             "java.util.Arrays.asList(new String(\"a\"), $1$)",
 145.464 -                             new Pair[] {
 145.465 -                             },
 145.466 -                             new Pair[] {
 145.467 -                                new Pair<String, int[]>("$1$", new int[] {77, 80, 82, 85}),
 145.468 -                             },
 145.469 -                             new Pair[] {
 145.470 -                             });
 145.471 -    }
 145.472 -
 145.473 -    public void testMultiParameters3() throws Exception {
 145.474 -        performVariablesTest("package test; public class Test { { java.util.Arrays.asList(); }",
 145.475 -                             "java.util.Arrays.asList($1$)",
 145.476 -                             new Pair[] {
 145.477 -                             },
 145.478 -                             new Pair[] {
 145.479 -                                new Pair<String, int[]>("$1$", new int[] {}),
 145.480 -                             },
 145.481 -                             new Pair[] {
 145.482 -                             });
 145.483 -    }
 145.484 -
 145.485 -    public void testTypeParameters() throws Exception {
 145.486 -        performVariablesTest("package test; public class Test { { java.util.Arrays.<String>asList(\"a\", \"b\"); }",
 145.487 -                             "java.util.Arrays.<$1>asList($1$)",
 145.488 -                             new Pair[] {
 145.489 -                                   new Pair<String, int[]>("$1", new int[] {85 - 31, 91 - 31}),
 145.490 -                             },
 145.491 -                             new Pair[] {
 145.492 -                             },
 145.493 -                             new Pair[] {
 145.494 -                             });
 145.495 -    }
 145.496 -
 145.497 -    public void testModifiers() throws Exception {
 145.498 -        performVariablesTest("package test; public class Test { private String s; }",
 145.499 -                             "$mods$ java.lang.String $name;",
 145.500 -                             new Pair[] {
 145.501 -                                 new Pair<String, int[]>("$name", new int[] {65 - 31, 82 - 31}),
 145.502 -                                 new Pair<String, int[]>("$mods$", new int[] {65 - 31, 72 - 31}), //XXX: shouldn't this be a multi-variable?
 145.503 -                             },
 145.504 -                             new Pair[] {
 145.505 -                             },
 145.506 -                             new Pair[] {
 145.507 -                                  new Pair<String, String>("$name", "s"),
 145.508 -                             });
 145.509 -    }
 145.510 -
 145.511 -    public void testVariableIsFullPattern1() throws Exception {
 145.512 -        performVariablesTest("package test; public class Test { private int a; {System.err.println(a);} }",
 145.513 -                             "$0{int}",
 145.514 -                             new Pair[] {
 145.515 -                                 new Pair<String, int[]>("$0", new int[] {100 - 31, 101 - 31}),
 145.516 -                             },
 145.517 -                             new Pair[] {
 145.518 -                             },
 145.519 -                             new Pair[] {
 145.520 -                             });
 145.521 -    }
 145.522 -
 145.523 -    public void testVariableIsFullPattern2() throws Exception {
 145.524 -        performVariablesTest("package test; public class Test { private int a; {System.err.println(a);} }",
 145.525 -                             "$0{int}",
 145.526 -                             new Pair[] {
 145.527 -                                 new Pair<String, int[]>("$0", new int[] {100 - 31, 101 - 31}),
 145.528 -                             },
 145.529 -                             new Pair[] {
 145.530 -                             },
 145.531 -                             new Pair[] {
 145.532 -                             },
 145.533 -                             false,
 145.534 -                             true);
 145.535 -    }
 145.536 -
 145.537 -    public void testNoCCEForVariableName() throws Exception {
 145.538 -        performVariablesTest("package test; public class Test { { int[] arr = null; int a; arr[a] = 0;} }",
 145.539 -                             "int $a; $a = 0;",
 145.540 -                             new Pair[] {
 145.541 -                             },
 145.542 -                             new Pair[] {
 145.543 -                             },
 145.544 -                             new Pair[] {
 145.545 -                             },
 145.546 -                             true,
 145.547 -                             true);
 145.548 -    }
 145.549 -
 145.550 -    public void testVerifySameTrees1() throws Exception {
 145.551 -        performVariablesTest("package test; public class Test { { if (true) { System.err.println(); } else { System.err.println(); System.err.println(); } } }",
 145.552 -                             "if ($c) $s; else $s;",
 145.553 -                             new Pair[] {
 145.554 -                             },
 145.555 -                             new Pair[] {
 145.556 -                             },
 145.557 -                             new Pair[] {
 145.558 -                             },
 145.559 -                             true,
 145.560 -                             true);
 145.561 -    }
 145.562 -
 145.563 -    public void testVerifySameTreesMultiVariables1() throws Exception {
 145.564 -        performVariablesTest("package test; public class Test { { if (true) { System.err.println(); System.err.println(); } else { System.err.println(); System.err.println(); System.err.println(); } } }",
 145.565 -                             "if ($c) { $s$;} else { $s$; }",
 145.566 -                             new Pair[] {
 145.567 -                             },
 145.568 -                             new Pair[] {
 145.569 -                             },
 145.570 -                             new Pair[] {
 145.571 -                             },
 145.572 -                             true,
 145.573 -                             true);
 145.574 -    }
 145.575 -
 145.576 -    public void testVerifySameTreesMultiVariables2() throws Exception {
 145.577 -        performVariablesTest("package test; public class Test { { if (true) { System.err.println(1); System.err.println(); } else System.err.println(1); } }",
 145.578 -                             "if ($c) { System.err.println(1); $s2$; } else { System.err.println(1); $s2$; }",
 145.579 -                             new Pair[] {
 145.580 -                             },
 145.581 -                             new Pair[] {
 145.582 -                             },
 145.583 -                             new Pair[] {
 145.584 -                             },
 145.585 -                             true,
 145.586 -                             true);
 145.587 -    }
 145.588 -
 145.589 -    public void testVerifySameTreesMultiVariables3() throws Exception {
 145.590 -        performVariablesTest("package test; public class Test { { if (true) { System.err.println(); System.err.println(1); } else System.err.println(1); } }",
 145.591 -                             "if ($c) { $s1$; System.err.println(1); } else { $s1$; System.err.println(1); }",
 145.592 -                             new Pair[] {
 145.593 -                             },
 145.594 -                             new Pair[] {
 145.595 -                             },
 145.596 -                             new Pair[] {
 145.597 -                             },
 145.598 -                             true,
 145.599 -                             true);
 145.600 -    }
 145.601 -
 145.602 -    public void XtestVerifySameTreesMultiVariables4() throws Exception {
 145.603 -        performVariablesTest("package test; public class Test { { if (true) { System.err.println(); System.err.println(1); System.err.println(); } else System.err.println(1); } }",
 145.604 -                             "if ($c) { $s1$; System.err.println(1); $s2$; } else { $s1$; System.err.println(1); $s2$; }",
 145.605 -                             new Pair[] {
 145.606 -                             },
 145.607 -                             new Pair[] {
 145.608 -                             },
 145.609 -                             new Pair[] {
 145.610 -                             },
 145.611 -                             true,
 145.612 -                             true);
 145.613 -    }
 145.614 -
 145.615 -    public void testVerifySameTreesMultiVariables5() throws Exception {
 145.616 -        performVariablesTest("package test; public class Test { { if (true) { System.err.println(1); } else System.err.println(2); } }",
 145.617 -                             "if ($c) { $s$; } else { $s$; }",
 145.618 -                             new Pair[] {
 145.619 -                             },
 145.620 -                             new Pair[] {
 145.621 -                             },
 145.622 -                             new Pair[] {
 145.623 -                             },
 145.624 -                             true,
 145.625 -                             true);
 145.626 -    }
 145.627 -
 145.628 -    public void testSimpleRemapping1() throws Exception {
 145.629 -        performRemappingTest("package test;\n" +
 145.630 -                             "public class Test {\n" +
 145.631 -                             "    void t1() {\n" +
 145.632 -                             "        int i = 0;\n" +
 145.633 -                             "        |System.err.println(i);|\n" +
 145.634 -                             "    }\n" +
 145.635 -                             "    void t2() {\n" +
 145.636 -                             "        int a = 0;\n" +
 145.637 -                             "        |System.err.println(a);|\n" +
 145.638 -                             "    }\n" +
 145.639 -                             "}\n",
 145.640 -                             "i",
 145.641 -                             Options.ALLOW_REMAP_VARIABLE_TO_EXPRESSION);
 145.642 -    }
 145.643 -
 145.644 -    public void testSimpleRemapping2() throws Exception {
 145.645 -        performRemappingTest("package test;\n" +
 145.646 -                             "public class Test {\n" +
 145.647 -                             "    void t1() {\n" +
 145.648 -                             "        int i = 0;\n" +
 145.649 -                             "        |System.err.println(i);\n" +
 145.650 -                             "         int i2 = 0;\n" +
 145.651 -                             "         System.err.println(i2);|\n" +
 145.652 -                             "    }\n" +
 145.653 -                             "    void t2() {\n" +
 145.654 -                             "        int a = 0;\n" +
 145.655 -                             "        |System.err.println(a);\n" +
 145.656 -                             "         int a2 = 0;\n" +
 145.657 -                             "         System.err.println(a2);|\n" +
 145.658 -                             "    }\n" +
 145.659 -                             "}\n",
 145.660 -                             "i",
 145.661 -                             Options.ALLOW_REMAP_VARIABLE_TO_EXPRESSION);
 145.662 -    }
 145.663 -
 145.664 -    public void testSimpleRemapping3() throws Exception {
 145.665 -        performRemappingTest("package test;\n" +
 145.666 -                             "public class Test {\n" +
 145.667 -                             "    void t1() {\n" +
 145.668 -                             "        |int i = 0;\n" +
 145.669 -                             "         System.err.println(i);\n" +
 145.670 -                             "         int i2 = 0;\n" +
 145.671 -                             "         System.err.println(i2);|\n" +
 145.672 -                             "    }\n" +
 145.673 -                             "    void t2() {\n" +
 145.674 -                             "        |int a = 0;\n" +
 145.675 -                             "         System.err.println(a);\n" +
 145.676 -                             "         int a2 = 0;\n" +
 145.677 -                             "         System.err.println(a2);|\n" +
 145.678 -                             "    }\n" +
 145.679 -                             "}\n",
 145.680 -                             "",
 145.681 -                             Options.ALLOW_REMAP_VARIABLE_TO_EXPRESSION);
 145.682 -    }
 145.683 -
 145.684 -    public void testSimpleRemapping4() throws Exception {
 145.685 -        performRemappingTest("package test;\n" +
 145.686 -                             "public class Test {\n" +
 145.687 -                             "    void t1() {\n" +
 145.688 -                             "        int i = 0;\n" +
 145.689 -                             "        |System.err.println(i);|\n" +
 145.690 -                             "    }\n" +
 145.691 -                             "    void t2() {\n" +
 145.692 -                             "        int[] a = {0};\n" +
 145.693 -                             "        |System.err.println(a[0]);|\n" +
 145.694 -                             "    }\n" +
 145.695 -                             "}\n",
 145.696 -                             "i",
 145.697 -                             Options.ALLOW_REMAP_VARIABLE_TO_EXPRESSION);
 145.698 -    }
 145.699 -
 145.700 -    public void testPreventRemapOnExpressions1() throws Exception {
 145.701 -        performRemappingTest("package test;\n" +
 145.702 -                             "public class Test {\n" +
 145.703 -                             "    void t1() {\n" +
 145.704 -                             "        Throwable t = null;\n" +
 145.705 -                             "        |System.err.println(t);|\n" +
 145.706 -                             "    }\n" +
 145.707 -                             "    void t2() {\n" +
 145.708 -                             "        Throwable t = null;\n" +
 145.709 -                             "        |System.err.println(t.getCause());|\n" +
 145.710 -                             "    }\n" +
 145.711 -                             "}\n",
 145.712 -                             "t",
 145.713 -                             Options.ALLOW_REMAP_VARIABLE_TO_EXPRESSION);
 145.714 -    }
 145.715 -
 145.716 -    public void testPreventRemapOnExpressions2() throws Exception {
 145.717 -        performRemappingTest("package test;\n" +
 145.718 -                             "public class Test {\n" +
 145.719 -                             "    void t1() {\n" +
 145.720 -                             "        Throwable t = null;\n" +
 145.721 -                             "        |System.err.println(t);|\n" +
 145.722 -                             "    }\n" +
 145.723 -                             "    void t2() {\n" +
 145.724 -                             "        Throwable t = null;\n" +
 145.725 -                             "        System.err.println(t.getCause());\n" +
 145.726 -                             "    }\n" +
 145.727 -                             "}\n",
 145.728 -                             "t");
 145.729 -    }
 145.730 -
 145.731 -    public void testVariableMemberSelect() throws Exception {
 145.732 -        performVariablesTest("package test; public class Test {public void test(String str) { str.length(); str.length(); } public void test1(String str) { str.length(); str.isEmpty(); } }",
 145.733 -                             "{ $str.$method(); $str.$method(); }",
 145.734 -                             new Pair[0],
 145.735 -                             new Pair[] {new Pair<String, String>("$method", "length")});
 145.736 -    }
 145.737 -
 145.738 -    public void testCorrectSite1() throws Exception {
 145.739 -        performVariablesTest("package test; public class Test { public void test(Object o) { o.wait(); } }",
 145.740 -                             "$s{java.util.concurrent.locks.Condition}.wait()",
 145.741 -                             new Pair[0],
 145.742 -                             new Pair[0],
 145.743 -                             new Pair[0],
 145.744 -                             true);
 145.745 -    }
 145.746 -
 145.747 -    public void testCorrectSite2() throws Exception {
 145.748 -        performVariablesTest("package test; public class Test { public void test(Object o) { wait(); } }",
 145.749 -                             "$s{java.util.concurrent.locks.Condition}.wait()",
 145.750 -                             new Pair[0],
 145.751 -                             new Pair[0],
 145.752 -                             new Pair[0],
 145.753 -                             true);
 145.754 -    }
 145.755 -
 145.756 -    public void testCorrectSite3() throws Exception {
 145.757 -        performVariablesTest("package test; public abstract class Test implements java.util.concurrent.locks.Condition { public void test() { new Runnable() { public void run() { wait(); } } } }",
 145.758 -                             "$0{java.util.concurrent.locks.Condition}.wait()",
 145.759 -                             new Pair[0],// {new Pair<String, int[]>("$s", new int[] {-1, -1})},
 145.760 -                             new Pair[0],
 145.761 -                             new Pair[0]);
 145.762 -    }
 145.763 -
 145.764 -    public void testCorrectSite4() throws Exception {
 145.765 -        performVariablesTest("package test; public class Test { public void test() { foo.stop(); } }",
 145.766 -                             "$0{java.lang.Thread}.stop()",
 145.767 -                             new Pair[0],
 145.768 -                             new Pair[0],
 145.769 -                             new Pair[0],
 145.770 -                             true);
 145.771 -    }
 145.772 -
 145.773 -    public void testDotClassForSameClass() throws Exception {
 145.774 -        performTest("package test; public class Test { {Class c = |Test.class|; c = |Test.class|; c = String.class; } }");
 145.775 -    }
 145.776 -
 145.777 -    public void testTryCatchVariable() throws Exception {
 145.778 -        performVariablesTest("package test; public class Test { { try { throw new java.io.IOException(); } catch (java.io.IOException ex) { } } }",
 145.779 -                             "try { $stmts$; } catch $catches$",
 145.780 -                             new Pair[] {
 145.781 -                             },
 145.782 -                             new Pair[] {
 145.783 -                                new Pair<String, int[]>("$stmts$", new int[] {42, 74}),
 145.784 -                                new Pair<String, int[]>("$catches$", new int[] {77, 111}),
 145.785 -                             },
 145.786 -                             new Pair[] {
 145.787 -                             },
 145.788 -                             false,
 145.789 -                             true);
 145.790 -    }
 145.791 -
 145.792 -    public void testMatchInterfaceNoFQN() throws Exception {
 145.793 -        performTest("package test; import java.util.*; public class Test { public void test() { |List| l1; |java.util.List| l2;} }");
 145.794 -    }
 145.795 -
 145.796 -    public void testUnresolvableNonMatchingConstraint() throws Exception {
 145.797 -        performVariablesTest("package test; public class Test { private Object a; {System.err.println(a);} }",
 145.798 -                             "System.err.println($v{does.not.Exist}",
 145.799 -                             new Pair[0],
 145.800 -                             new Pair[0],
 145.801 -                             new Pair[0],
 145.802 -                             true);
 145.803 -    }
 145.804 -
 145.805 -    public void testIndexOutOfBoundsInMultiList() throws Exception {
 145.806 -        performVariablesTest("package test;" +
 145.807 -                             "public class Test {" +
 145.808 -                             "    public void test() {" +
 145.809 -                             "        int i = 0;" +
 145.810 -                             "        int j = 0;" +
 145.811 -                             "        i++;" +
 145.812 -                             "        j++;" +
 145.813 -                             "    }" +
 145.814 -                             "}",
 145.815 -                             "{$type $i = $init; $stms$; $i++;}",
 145.816 -                             new Pair[0],
 145.817 -                             new Pair[0],
 145.818 -                             new Pair[0],
 145.819 -                             true,
 145.820 -                             false);
 145.821 -    }
 145.822 -
 145.823 -    public void testCorrectSite192812() throws Exception {
 145.824 -        performVariablesTest("package test; public class Test { private int i; public void test(Test t) { t.i = i - 10; } }",
 145.825 -                             "$t = $t - $v",
 145.826 -                             new Pair[0],
 145.827 -                             new Pair[0],
 145.828 -                             new Pair[0],
 145.829 -                             true,
 145.830 -                             true);
 145.831 -    }
 145.832 -
 145.833 -    public void testCorrectSite183367() throws Exception {
 145.834 -        performVariablesTest("package test; public class Test { public void test(java.util.List l) { l.subList(0, 0).remove(0); } }",
 145.835 -                             "$l{java.util.Collection}.remove($o{java.lang.Object})",
 145.836 -                             new Pair[0],
 145.837 -                             new Pair[0],
 145.838 -                             new Pair[0],
 145.839 -                             true,
 145.840 -                             true);
 145.841 -    }
 145.842 -
 145.843 -    public void testDisableVariablesWhenVerifyingDuplicates1() throws Exception {
 145.844 -        performVariablesTest("package test; public class Test { public void test() { int $i = 1, $j = 2; int k = $i + $i; } }",
 145.845 -                             "$i + $i",
 145.846 -                             new Pair[] {new Pair<String, int[]>("$i", new int[] {83, 85})},
 145.847 -                             new Pair[0],
 145.848 -                             new Pair[0],
 145.849 -                             false,
 145.850 -                             true);
 145.851 -    }
 145.852 -
 145.853 -    public void testDisableVariablesWhenVerifyingDuplicates2() throws Exception {
 145.854 -        performVariablesTest("package test; public class Test { public void test() { int $i = 1, $j = 2; int k = $i + $i; } }",
 145.855 -                             "$i + $i",
 145.856 -                             new Pair[] {new Pair<String, int[]>("$i", new int[] {83, 85})},
 145.857 -                             new Pair[0],
 145.858 -                             new Pair[0],
 145.859 -                             false,
 145.860 -                             false);
 145.861 -    }
 145.862 -
 145.863 -    public void testMethodMatchingMoreParams() throws Exception {
 145.864 -        performVariablesTest("package test; public class Test {public void test(String s1, String s2) { } }",
 145.865 -                             "public void test($params$) { }",
 145.866 -                             new Pair[0],
 145.867 -                             new Pair[] {new Pair<String, int[]>("$params$", new int[] {50, 59, 61, 70})},
 145.868 -                             new Pair[0],
 145.869 -                             false,
 145.870 -                             true);
 145.871 -    }
 145.872 -
 145.873 -    public void testLambdaInput1() throws Exception {
 145.874 -        performVariablesTest("package test; public class Test {public void test() { new java.io.FilenameFilter() { public boolean accept(File dir, String name) { } }; } }",
 145.875 -                             "new $type() {public $retType $name($params$) { $body$; } }",
 145.876 -                             new Pair[0],
 145.877 -                             new Pair[] {new Pair<String, int[]>("$params$", new int[] { 107, 115, 117, 128 })},
 145.878 -                             new Pair[] {new Pair<String, String>("$name", "accept")},
 145.879 -                             false,
 145.880 -                             false);
 145.881 -    }
 145.882 -
 145.883 -    public void testLambdaInput2() throws Exception {
 145.884 -        performVariablesTest("package test; public class Test {public void test() { new java.io.FilenameFilter() { public boolean accept(File dir, String name) { } }; } }",
 145.885 -                             "new $type() { $mods$ $retType $name($params$) { $body$; } }",
 145.886 -                             new Pair[0],
 145.887 -                             new Pair[] {new Pair<String, int[]>("$params$", new int[] { 107, 115, 117, 128 })},
 145.888 -                             new Pair[] {new Pair<String, String>("$name", "accept")},
 145.889 -                             false,
 145.890 -                             true);
 145.891 -    }
 145.892 -
 145.893 -    public void testSwitch1() throws Exception {
 145.894 -        performVariablesTest("package test;\n" +
 145.895 -                             "public class Test {\n" +
 145.896 -                             "     {\n" +
 145.897 -                             "         E e = null;\n" +
 145.898 -                             "         switch (e) {\n" +
 145.899 -                             "             case A: System.err.println(1); break;\n" +
 145.900 -                             "             case D: System.err.println(2); break;\n" +
 145.901 -                             "             case E: System.err.println(3); break;\n" +
 145.902 -                             "         }\n" +
 145.903 -                             "     }\n" +
 145.904 -                             "     public enum E {A, B, C, D, E, F;}\n" +
 145.905 -                             "}\n",
 145.906 -                             "switch ($0{test.Test.E}) { case $c1$ case D: $stmts$; case $c2$ }",
 145.907 -                             new Pair[] {new Pair<String, int[]>("$0", new int[] {79, 80})},
 145.908 -                             new Pair[] {
 145.909 -                                new Pair<String, int[]>("$stmts$", new int[] { 156, 178, 179, 185 }),
 145.910 -                                new Pair<String, int[]>("$c1$", new int[] { 97, 134 }),
 145.911 -                                new Pair<String, int[]>("$c2$", new int[] { 199, 236 }),
 145.912 -                             },
 145.913 -                             new Pair[0],
 145.914 -                             false,
 145.915 -                             false);
 145.916 -    }
 145.917 -
 145.918 -    public void testWildcard1() throws Exception {
 145.919 -        performTest("package test; import java.util.*; public class Test { public void test() { |List<?>| l1; |List<?>| l2;} }");
 145.920 -    }
 145.921 -
 145.922 -    public void testWildcard2() throws Exception {
 145.923 -        performTest("package test; import java.util.*; public class Test { public void test() { |List<? extends String>| l1; |List<? extends String>| l2;} }");
 145.924 -    }
 145.925 -
 145.926 -    public void testWildcard3() throws Exception {
 145.927 -        performTest("package test; import java.util.*; public class Test { public void test() { |List<? super String>| l1; |List<? super String>| l2;} }");
 145.928 -    }
 145.929 -
 145.930 -    public void testSingleVariableStrict() throws Exception {
 145.931 -        performVariablesTest("package test; public class Test { public void test() { if (true) System.err.println(1); } }",
 145.932 -                             "if ($c) $then; else $else;",
 145.933 -                             new Pair[0],
 145.934 -                             new Pair[0],
 145.935 -                             new Pair[0],
 145.936 -                             true,
 145.937 -                             true);
 145.938 -    }
 145.939 -
 145.940 -    public void testMultiVariableZeroOrOne1() throws Exception {
 145.941 -        performVariablesTest("package test; public class Test { public void test() { if (true) System.err.println(1); } }",
 145.942 -                             "if ($c) $then; else $else$;",
 145.943 -                             new Pair[] {new Pair<String, int[]>("$c", new int[] {59, 63}),
 145.944 -                                         new Pair<String, int[]>("$then", new int[] {65, 87})},
 145.945 -                             new Pair[0],
 145.946 -                             new Pair[0],
 145.947 -                             false,
 145.948 -                             true);
 145.949 -    }
 145.950 -
 145.951 -    public void testMultiVariableZeroOrOne2() throws Exception {
 145.952 -        performVariablesTest("package test; public class Test { public void test() { if (true) System.err.println(1); else System.err.println(2); } }",
 145.953 -                             "if ($c) $then; else $else$;",
 145.954 -                             new Pair[] {new Pair<String, int[]>("$c", new int[] {59, 63}),
 145.955 -                                         new Pair<String, int[]>("$then", new int[] {65, 87}),
 145.956 -                                         new Pair<String, int[]>("$else$", new int[] {93, 115})},
 145.957 -                             new Pair[0],
 145.958 -                             new Pair[0],
 145.959 -                             false,
 145.960 -                             true);
 145.961 -    }
 145.962 -
 145.963 -    public void testNonResolvableType() throws Exception {
 145.964 -        performVariablesTest("package test; public class Test { { java.io.File f = null; boolean b = f.isDirectory(); } }",
 145.965 -                             "$1{can.not.Resolve}.$m($args$)",
 145.966 -                             new Pair[0],
 145.967 -                             new Pair[0],
 145.968 -                             new Pair[0],
 145.969 -                             true,
 145.970 -                             true);
 145.971 -    }
 145.972 -
 145.973 -    public void testTryWithResources() throws Exception {
 145.974 -        performVariablesTest("package test; public class Test { { try (java.io.InputStream in = null) { System.err.println(1); } } }",
 145.975 -                             "try ($resources$) {$body$;}",
 145.976 -                             new Pair[] {
 145.977 -                             },
 145.978 -                             new Pair[] {
 145.979 -                                new Pair<String, int[]>("$resources$", new int[] {41, 70}),
 145.980 -                                new Pair<String, int[]>("$body$", new int[] {74, 96}),
 145.981 -                             },
 145.982 -                             new Pair[] {
 145.983 -                             },
 145.984 -                             false,
 145.985 -                             true);
 145.986 -    }
 145.987 -
 145.988 -    public void testIgnoreOtherKind() throws Exception {
 145.989 -        performVariablesTest("package test; public class Test { private java.util.Collection<String> x() { return java.util.Collections.emptySet(); } } }",
 145.990 -                             "$i{java.lang.Class}",
 145.991 -                             new Pair[] {
 145.992 -                             },
 145.993 -                             new Pair[] {
 145.994 -                             },
 145.995 -                             new Pair[] {
 145.996 -                             },
 145.997 -                             true,
 145.998 -                             true);
 145.999 -    }
145.1000 -
145.1001 -    public void testSearchPackageClause() throws Exception {
145.1002 -        performVariablesTest("package test.a; public class Test { }",
145.1003 -                             "test.$1",
145.1004 -                             new Pair[] {
145.1005 -                             },
145.1006 -                             new Pair[] {
145.1007 -                             },
145.1008 -                             new Pair[] {
145.1009 -                                 new Pair<String, String>("$1", "a"),
145.1010 -                             },
145.1011 -                             false,
145.1012 -                             true);
145.1013 -    }
145.1014 -
145.1015 -    public void testPackageImport() throws Exception {
145.1016 -        performVariablesTest("package test; import java.util.*; public class Test { }",
145.1017 -                             "java.$1",
145.1018 -                             new Pair[] {
145.1019 -                             },
145.1020 -                             new Pair[] {
145.1021 -                             },
145.1022 -                             new Pair[] {
145.1023 -                                 new Pair<String, String>("$1", "util"),
145.1024 -                             },
145.1025 -                             false,
145.1026 -                             true);
145.1027 -    }
145.1028 -    
145.1029 -    public void testSubclassMatching() throws Exception {
145.1030 -        performVariablesTest("package test; import java.util.*; public abstract class Test { Map.Entry e; }",
145.1031 -                             "java.util.Map.$1",
145.1032 -                             new Pair[] {
145.1033 -                             },
145.1034 -                             new Pair[] {
145.1035 -                             },
145.1036 -                             new Pair[] {
145.1037 -                                 new Pair<String, String>("$1", "Entry"),
145.1038 -                             },
145.1039 -                             false,
145.1040 -                             true);
145.1041 -    }
145.1042 -    
145.1043 -    public void testMethodTypeParameters1() throws Exception {
145.1044 -        performVariablesTest("package test; public class Test { private void t() { } }",
145.1045 -                             "$mods$ <$tp$> $ret $name($args$) { $body$; }",
145.1046 -                             new Pair[] {
145.1047 -                                new Pair<String, int[]>("$ret", new int[] {42, 46}),
145.1048 -                                new Pair<String, int[]>("$mods$", new int[] {34, 41}),
145.1049 -                             },
145.1050 -                             new Pair[] {
145.1051 -                                new Pair<String, int[]>("$tp$", new int[] {}),
145.1052 -                                new Pair<String, int[]>("$args$", new int[] {}),
145.1053 -                                new Pair<String, int[]>("$body$", new int[] {}),
145.1054 -                             },
145.1055 -                             new Pair[] {
145.1056 -                                 new Pair<String, String>("$name", "t")
145.1057 -                             },
145.1058 -                             false,
145.1059 -                             false);
145.1060 -    }
145.1061 -    
145.1062 -    public void testMethodTypeParameters2() throws Exception {
145.1063 -        performVariablesTest("package test; public class Test { private <A, B> String aa(int a, int b) { a = b; b = a;} }",
145.1064 -                             "$mods$ <$tp$> $ret $name($args$) { $body$; }",
145.1065 -                             new Pair[] {
145.1066 -                                new Pair<String, int[]>("$ret", new int[] {49, 55}),
145.1067 -                                new Pair<String, int[]>("$mods$", new int[] {34, 41}),
145.1068 -                             },
145.1069 -                             new Pair[] {
145.1070 -                                new Pair<String, int[]>("$tp$", new int[] {43, 44, 46, 47}),
145.1071 -                                new Pair<String, int[]>("$args$", new int[] {59, 64, 66, 71}),
145.1072 -                                new Pair<String, int[]>("$body$", new int[] {75, 81, 82, 88}),
145.1073 -                             },
145.1074 -                             new Pair[] {
145.1075 -                                 new Pair<String, String>("$name", "aa")
145.1076 -                             },
145.1077 -                             false,
145.1078 -                             true);
145.1079 -    }
145.1080 -    
145.1081 -    public void testMethodTypeParameters3() throws Exception {
145.1082 -        performVariablesTest("package test; public class Test { private <A> String aa(int a, int b) { a = b; b = a;} }",
145.1083 -                             "$mods$ <$tp> $ret $name($args$) { $body$; }",
145.1084 -                             new Pair[] {
145.1085 -                                new Pair<String, int[]>("$ret", new int[] {46, 52}),
145.1086 -                                new Pair<String, int[]>("$mods$", new int[] {34, 41}),
145.1087 -                                new Pair<String, int[]>("$tp", new int[] {43, 44}),
145.1088 -                             },
145.1089 -                             new Pair[] {
145.1090 -                                new Pair<String, int[]>("$args$", new int[] {56, 61, 63, 68}),
145.1091 -                                new Pair<String, int[]>("$body$", new int[] {72, 78, 79, 85}),
145.1092 -                             },
145.1093 -                             new Pair[] {
145.1094 -                                 new Pair<String, String>("$name", "aa")
145.1095 -                             },
145.1096 -                             false,
145.1097 -                             true);
145.1098 -    }
145.1099 -    
145.1100 -    public void testTypeParameters1() throws Exception {
145.1101 -        performVariablesTest("package test; public class Test { private <A extends String> void aa() { } }",
145.1102 -                             "$mods$ <$tp extends $bound&$obounds$> $ret $name($args$) { $body$; }",
145.1103 -                             new Pair[] {
145.1104 -                                new Pair<String, int[]>("$ret", new int[] {61, 65}),
145.1105 -                                new Pair<String, int[]>("$mods$", new int[] {34, 41}),
145.1106 -                                new Pair<String, int[]>("$tp", new int[] {43, 59}),
145.1107 -                                new Pair<String, int[]>("$bound", new int[] {53, 59}),
145.1108 -                             },
145.1109 -                             new Pair[] {
145.1110 -                                new Pair<String, int[]>("$obounds$", new int[] {}),
145.1111 -                             },
145.1112 -                             new Pair[] {
145.1113 -                                 new Pair<String, String>("$name", "aa"),
145.1114 -                                 new Pair<String, String>("$tp", "A")
145.1115 -                             },
145.1116 -                             false,
145.1117 -                             true);
145.1118 -    }
145.1119 -    
145.1120 -    public void testPartialModifiers1() throws Exception {
145.1121 -        performVariablesTest("package test; public class Test { @Deprecated @Override private void aa() { } }",
145.1122 -                             "$mods$ @Deprecated private $ret $name() { $body$; }",
145.1123 -                             new Pair[] {
145.1124 -                                new Pair<String, int[]>("$ret", new int[] {64, 68}),
145.1125 -                                new Pair<String, int[]>("$mods$", new int[] {34, 63}),
145.1126 -                             },
145.1127 -                             new Pair[] {
145.1128 -                             },
145.1129 -                             new Pair[] {
145.1130 -                                 new Pair<String, String>("$name", "aa"),
145.1131 -                             },
145.1132 -                             false,
145.1133 -                             true);
145.1134 -    }
145.1135 -    
145.1136 -    public void testPartialModifiers2() throws Exception {
145.1137 -        performVariablesTest("package test; public class Test { @Override private void aa() { } }",
145.1138 -                             "$mods$ @Deprecated private $ret $name() { $body$; }",
145.1139 -                             new Pair[0],
145.1140 -                             new Pair[0],
145.1141 -                             new Pair[0],
145.1142 -                             true,
145.1143 -                             true);
145.1144 -    }
145.1145 -    
145.1146 -    public void testNonStaticInnerClassesMatch() throws Exception {
145.1147 -        performVariablesTest("package test; import test.Test.Inner; public class Test { public class Inner { } } class Other { { Inner i = null; } }",
145.1148 -                             "test.Test.Inner $i = $init$;",
145.1149 -                             new Pair[] {
145.1150 -                                 new Pair<String, int[]>("$i", new int[] {99, 114}),
145.1151 -                                 new Pair<String, int[]>("$init$", new int[] {109, 113})
145.1152 -                             },
145.1153 -                             new Pair[0],
145.1154 -                             new Pair[] {
145.1155 -                                 new Pair<String, String>("$i", "i")
145.1156 -                             },
145.1157 -                             false,
145.1158 -                             true);
145.1159 -    }
145.1160 -    
145.1161 -    public void testNewClassTypeParams222066a() throws Exception {
145.1162 -        performVariablesTest("package test; public class Test { private Object aa() { return new java.util.ArrayList(1); } }",
145.1163 -                             "new java.util.ArrayList<$whatever$>($param)",
145.1164 -                             new Pair[] {
145.1165 -                                 new Pair<String, int[]>("$param", new int[] {87, 88})
145.1166 -                             },
145.1167 -                             new Pair[] {
145.1168 -                                 new Pair<String, int[]>("$whatever$", new int[0])
145.1169 -                             },
145.1170 -                             new Pair[0],
145.1171 -                             false,
145.1172 -                             false);
145.1173 -    }
145.1174 -    
145.1175 -    public void testNewClassTypeParams222066b() throws Exception {
145.1176 -        performVariablesTest("package test; import java.util.ArrayList; public class Test { private Object aa() { return new ArrayList(1); } }",
145.1177 -                             "new java.util.ArrayList<$whatever$>($param)",
145.1178 -                             new Pair[] {
145.1179 -                                 new Pair<String, int[]>("$param", new int[] {105, 106})
145.1180 -                             },
145.1181 -                             new Pair[] {
145.1182 -                                 new Pair<String, int[]>("$whatever$", new int[0])
145.1183 -                             },
145.1184 -                             new Pair[0],
145.1185 -                             false,
145.1186 -                             false);
145.1187 -    }
145.1188 -    
145.1189 -    public void testFindLambda() throws Exception {
145.1190 -        performVariablesTest("package test; import java.util.Comparator; public class Test { private void aa() { Comparator<String> c = (l, r) -> l.compareTo(r); } }",
145.1191 -                             "($args$) -> $expression",
145.1192 -                             new Pair[] {
145.1193 -                                 new Pair<String, int[]>("$expression", new int[] {116, 130})
145.1194 -                             },
145.1195 -                             new Pair[] {
145.1196 -                                 new Pair<String, int[]>("$args$", new int[] {107, 108, 110, 111})
145.1197 -                             },
145.1198 -                             new Pair[0],
145.1199 -                             false,
145.1200 -                             false);
145.1201 -    }
145.1202 -    
145.1203 -    public void testAnnotation1() throws Exception {
145.1204 -        performVariablesTest("package test; import test.Test.A; @A(i=1) public class Test { @interface A { public int i(); } }",
145.1205 -                             "@$annotation($args$)",
145.1206 -                             new Pair[] {
145.1207 -                                 new Pair<String, int[]>("$annotation", new int[] {35, 36})
145.1208 -                             },
145.1209 -                             new Pair[] {
145.1210 -                                 new Pair<String, int[]>("$args$", new int[] {37, 40})
145.1211 -                             },
145.1212 -                             new Pair[0],
145.1213 -                             false,
145.1214 -                             true);
145.1215 -    }
145.1216 -    
145.1217 -    public void testAnnotation2() throws Exception {
145.1218 -        performVariablesTest("package test; import test.Test.A; @A(i=1,b=true,l=2) public class Test { @interface A { public int i(); public boolean b(); public long l(); } }",
145.1219 -                             "@test.Test.A($prefix$, b=$value, $suffix$)",
145.1220 -                             new Pair[] {
145.1221 -                                 new Pair<String, int[]>("$value", new int[] {43, 47})
145.1222 -                             },
145.1223 -                             new Pair[] {
145.1224 -                                 new Pair<String, int[]>("$prefix$", new int[] {37, 40}),
145.1225 -                                 new Pair<String, int[]>("$suffix$", new int[] {48, 51})
145.1226 -                             },
145.1227 -                             new Pair[0],
145.1228 -                             false,
145.1229 -                             false);
145.1230 -    }
145.1231 -    
145.1232 -    protected void prepareTest(String code) throws Exception {
145.1233 -        prepareTest(code, -1);
145.1234 -    }
145.1235 -
145.1236 -    protected void prepareTest(String code, int testIndex) throws Exception {
145.1237 -        File workDirWithIndexFile = testIndex != (-1) ? new File(getWorkDir(), Integer.toString(testIndex)) : getWorkDir();
145.1238 -        FileObject workDirWithIndex = FileUtil.toFileObject(workDirWithIndexFile);
145.1239 -
145.1240 -        if (workDirWithIndex != null) {
145.1241 -            workDirWithIndex.delete();
145.1242 -        }
145.1243 -
145.1244 -        workDirWithIndex = FileUtil.createFolder(workDirWithIndexFile);
145.1245 -
145.1246 -        assertNotNull(workDirWithIndexFile);
145.1247 -
145.1248 -        FileObject sourceRoot = workDirWithIndex.createFolder("src");
145.1249 -        FileObject buildRoot  = workDirWithIndex.createFolder("build");
145.1250 -        FileObject cache = workDirWithIndex.createFolder("cache");
145.1251 -
145.1252 -        FileObject data = FileUtil.createData(sourceRoot, "test/Test.java");
145.1253 -
145.1254 -        TestUtilities.copyStringToFile(data, code);
145.1255 -
145.1256 -        data.refresh();
145.1257 -
145.1258 -        SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache);
145.1259 -
145.1260 -        DataObject od = DataObject.find(data);
145.1261 -        EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
145.1262 -
145.1263 -        assertNotNull(ec);
145.1264 -
145.1265 -        doc = ec.openDocument();
145.1266 -
145.1267 -        doc.putProperty(Language.class, JavaTokenId.language());
145.1268 -        doc.putProperty("mimeType", "text/x-java");
145.1269 -
145.1270 -        JavaSource js = JavaSource.forFileObject(data);
145.1271 -
145.1272 -        assertNotNull(js);
145.1273 -
145.1274 -        info = SourceUtilsTestUtil.getCompilationInfo(js, Phase.RESOLVED);
145.1275 -
145.1276 -        assertNotNull(info);
145.1277 -    }
145.1278 -
145.1279 -    private static String findRegions(String code, List<int[]> regions) {
145.1280 -        String[] split = code.split("\\|");
145.1281 -        StringBuilder filtered = new StringBuilder();
145.1282 -
145.1283 -        filtered.append(split[0]);
145.1284 -
145.1285 -        int offset = split[0].length();
145.1286 -
145.1287 -        for (int cntr = 1; cntr < split.length; cntr += 2) {
145.1288 -            int[] i = new int[] {
145.1289 -                offset,
145.1290 -                offset + split[cntr].length()
145.1291 -            };
145.1292 -
145.1293 -            regions.add(i);
145.1294 -
145.1295 -            filtered.append(split[cntr]);
145.1296 -            filtered.append(split[cntr + 1]);
145.1297 -
145.1298 -            offset += split[cntr].length();
145.1299 -            offset += split[cntr + 1].length();
145.1300 -        }
145.1301 -
145.1302 -        return filtered.toString();
145.1303 -    }
145.1304 -
145.1305 -    protected CompilationInfo info;
145.1306 -    private Document doc;
145.1307 -
145.1308 -    private void performTest(String code) throws Exception {
145.1309 -        performTest(code, true);
145.1310 -    }
145.1311 -
145.1312 -    private void performTest(String code, boolean verify) throws Exception {
145.1313 -        List<int[]> result = new LinkedList<int[]>();
145.1314 -
145.1315 -        code = findRegions(code, result);
145.1316 -
145.1317 -        int testIndex = 0;
145.1318 -
145.1319 -        for (int[] i : result) {
145.1320 -            int[] duplicates = new int[2 * (result.size() - 1)];
145.1321 -            int cntr = 0;
145.1322 -            List<int[]> l = new LinkedList<int[]>(result);
145.1323 -
145.1324 -            l.remove(i);
145.1325 -
145.1326 -            for (int[] span : l) {
145.1327 -                duplicates[cntr++] = span[0];
145.1328 -                duplicates[cntr++] = span[1];
145.1329 -            }
145.1330 -
145.1331 -            doPerformTest(code, i[0], i[1], testIndex++, verify, duplicates);
145.1332 -        }
145.1333 -    }
145.1334 -
145.1335 -    protected void performTest(String code, int start, int end, int... duplicates) throws Exception {
145.1336 -        doPerformTest(code, start, end, -1, true, duplicates);
145.1337 -    }
145.1338 -
145.1339 -    protected void doPerformTest(String code, int start, int end, int testIndex, int... duplicates) throws Exception {
145.1340 -        doPerformTest(code, start, end, testIndex, true, duplicates);
145.1341 -    }
145.1342 -
145.1343 -    protected void doPerformTest(String code, int start, int end, int testIndex, boolean verify, int... duplicates) throws Exception {
145.1344 -        prepareTest(code, testIndex);
145.1345 -
145.1346 -        TreePath path = info.getTreeUtilities().pathFor((start + end) / 2 + 1);
145.1347 -
145.1348 -        while (path != null) {
145.1349 -            Tree t = path.getLeaf();
145.1350 -            SourcePositions sp = info.getTrees().getSourcePositions();
145.1351 -
145.1352 -            if (   start == sp.getStartPosition(info.getCompilationUnit(), t)
145.1353 -                && end   == sp.getEndPosition(info.getCompilationUnit(), t)) {
145.1354 -                break;
145.1355 -            }
145.1356 -
145.1357 -            path = path.getParentPath();
145.1358 -        }
145.1359 -
145.1360 -        assertNotNull(path);
145.1361 -
145.1362 -        Collection<TreePath> result = computeDuplicates(path);
145.1363 -
145.1364 -        //        assertEquals(f.result.toString(), duplicates.length / 2, f.result.size());
145.1365 -
145.1366 -        if (verify) {
145.1367 -            int[] dupes = new int[result.size() * 2];
145.1368 -            int   index = 0;
145.1369 -
145.1370 -            for (TreePath tp : result) {
145.1371 -                dupes[index++] = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), tp.getLeaf());
145.1372 -                dupes[index++] = (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), tp.getLeaf());
145.1373 -            }
145.1374 -
145.1375 -            assertTrue("Was: " + Arrays.toString(dupes) + " should have been: " + Arrays.toString(duplicates), Arrays.equals(duplicates, dupes));
145.1376 -        }
145.1377 -    }
145.1378 -
145.1379 -    protected void performVariablesTest(String code, String pattern, Pair<String, int[]>[] duplicatesPos, Pair<String, String>[] duplicatesNames) throws Exception {
145.1380 -        performVariablesTest(code, pattern, duplicatesPos, new Pair[0], duplicatesNames);
145.1381 -    }
145.1382 -
145.1383 -    protected void performVariablesTest(String code, String pattern, Pair<String, int[]>[] duplicatesPos, Pair<String, int[]>[] multiStatementPos, Pair<String, String>[] duplicatesNames) throws Exception {
145.1384 -        performVariablesTest(code, pattern, duplicatesPos, multiStatementPos, duplicatesNames, false);
145.1385 -    }
145.1386 -
145.1387 -    protected void performVariablesTest(String code, String pattern, Pair<String, int[]>[] duplicatesPos, Pair<String, int[]>[] multiStatementPos, Pair<String, String>[] duplicatesNames, boolean noOccurrences) throws Exception {
145.1388 -        performVariablesTest(code, pattern, duplicatesPos, multiStatementPos, duplicatesNames, noOccurrences, false);
145.1389 -    }
145.1390 -
145.1391 -    protected void performVariablesTest(String code, String pattern, Pair<String, int[]>[] duplicatesPos, Pair<String, int[]>[] multiStatementPos, Pair<String, String>[] duplicatesNames, boolean noOccurrences, boolean useBulkSearch) throws Exception {
145.1392 -        prepareTest(code, -1);
145.1393 -
145.1394 -        Map<String, TypeMirror> constraints = new HashMap<String, TypeMirror>();
145.1395 -        String patternCode = PatternCompilerUtilities.parseOutTypesFromPattern(info, pattern, constraints);
145.1396 -
145.1397 -        Pattern patternObj = PatternCompiler.compile(info, patternCode, constraints, Collections.<String>emptyList());
145.1398 -        TreePath patternPath = MatchingTestAccessor.getPattern(patternObj).iterator().next();
145.1399 -        Map<TreePath, VariableAssignments> result;
145.1400 -
145.1401 -        if (useBulkSearch) {
145.1402 -            result = new HashMap<TreePath, VariableAssignments>();
145.1403 -
145.1404 -            BulkPattern bulkPattern = BulkSearch.getDefault().create(info, new AtomicBoolean(), patternCode);
145.1405 -
145.1406 -            for (Entry<String, Collection<TreePath>> e : BulkSearch.getDefault().match(info, new AtomicBoolean(), new TreePath(info.getCompilationUnit()), bulkPattern).entrySet()) {
145.1407 -                for (TreePath tp : e.getValue()) {
145.1408 -                    VariableAssignments vars = computeVariables(info, patternPath, tp, new AtomicBoolean(), MatchingTestAccessor.getVariable2Type(patternObj));
145.1409 -
145.1410 -                    if (vars != null) {
145.1411 -                        result.put(tp, vars);
145.1412 -                    }
145.1413 -                }
145.1414 -            }
145.1415 -        } else {
145.1416 -            result = computeDuplicates(info, patternPath, new TreePath( info.getCompilationUnit()), new AtomicBoolean(), MatchingTestAccessor.getVariable2Type(patternObj));
145.1417 -        }
145.1418 -
145.1419 -        if (noOccurrences) {
145.1420 -            assertEquals(0, result.size());
145.1421 -            return ;
145.1422 -        }
145.1423 -
145.1424 -        assertSame(1, result.size());
145.1425 -
145.1426 -        Map<String, int[]> actual = new HashMap<String, int[]>();
145.1427 -
145.1428 -        for (Entry<String, TreePath> e : result.values().iterator().next().variables.entrySet()) {
145.1429 -            int[] span = new int[] {
145.1430 -                (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), e.getValue().getLeaf()),
145.1431 -                (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), e.getValue().getLeaf())
145.1432 -            };
145.1433 -
145.1434 -            actual.put(e.getKey(), span);
145.1435 -        }
145.1436 -
145.1437 -        for (Pair<String, int[]> dup : duplicatesPos) {
145.1438 -            int[] span = actual.remove(dup.getA());
145.1439 -
145.1440 -            if (span == null) {
145.1441 -                fail(dup.getA());
145.1442 -            }
145.1443 -            assertTrue(dup.getA() + ":" + Arrays.toString(span), Arrays.equals(span, dup.getB()));
145.1444 -        }
145.1445 -
145.1446 -        Map<String, int[]> actualMulti = new HashMap<String, int[]>();
145.1447 -
145.1448 -        for (Entry<String, Collection<? extends TreePath>> e : result.values().iterator().next().multiVariables.entrySet()) {
145.1449 -            int[] span = new int[2 * e.getValue().size()];
145.1450 -            int i = 0;
145.1451 -
145.1452 -            for (TreePath tp : e.getValue()) {
145.1453 -                span[i++] = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), tp.getLeaf());
145.1454 -                span[i++] = (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), tp.getLeaf());
145.1455 -            }
145.1456 -
145.1457 -            actualMulti.put(e.getKey(), span);
145.1458 -        }
145.1459 -
145.1460 -        for (Pair<String, int[]> dup : multiStatementPos) {
145.1461 -            int[] span = actualMulti.remove(dup.getA());
145.1462 -
145.1463 -            if (span == null) {
145.1464 -                fail(dup.getA());
145.1465 -            }
145.1466 -            assertTrue(dup.getA() + ":" + Arrays.toString(span), Arrays.equals(span, dup.getB()));
145.1467 -        }
145.1468 -
145.1469 -        Map<String, String> golden = new HashMap<String, String>();
145.1470 -
145.1471 -        for ( Pair<String, String> e : duplicatesNames) {
145.1472 -            golden.put(e.getA(), e.getB());
145.1473 -        }
145.1474 -
145.1475 -        assertEquals(golden, result.values().iterator().next().variables2Names);
145.1476 -    }
145.1477 -
145.1478 -    protected VariableAssignments computeVariables(CompilationInfo info, TreePath searchingFor, TreePath scope, AtomicBoolean cancel, Map<String, TypeMirror> designedTypeHack) {
145.1479 -        Collection<VariableAssignments> values = CopyFinder.internalComputeDuplicates(info, Collections.singletonList(searchingFor), scope, null, null, new AtomicBooleanCancel(cancel), designedTypeHack, Options.ALLOW_VARIABLES_IN_PATTERN).values();
145.1480 -
145.1481 -        if (values.iterator().hasNext()) {
145.1482 -            return values.iterator().next();
145.1483 -        } else {
145.1484 -            return null;
145.1485 -        }
145.1486 -    }
145.1487 -
145.1488 -    protected Map<TreePath, VariableAssignments> computeDuplicates(CompilationInfo info, TreePath searchingFor, TreePath scope, AtomicBoolean cancel, Map<String, TypeMirror> designedTypeHack) {
145.1489 -        return CopyFinder.internalComputeDuplicates(info, Collections.singletonList(searchingFor), scope, null, null, new AtomicBooleanCancel(cancel), designedTypeHack, Options.ALLOW_VARIABLES_IN_PATTERN, Options.ALLOW_GO_DEEPER);
145.1490 -    }
145.1491 -
145.1492 -    private void performRemappingTest(String code, String remappableVariables, Options... options) throws Exception {
145.1493 -        List<int[]> regions = new LinkedList<int[]>();
145.1494 -
145.1495 -        code = findRegions(code, regions);
145.1496 -
145.1497 -        prepareTest(code, -1);
145.1498 -
145.1499 -        int[] statements = new int[2];
145.1500 -
145.1501 -        int[] currentRegion = regions.get(0);
145.1502 -        TreePathHandle tph = IntroduceMethodFix.validateSelectionForIntroduceMethod(info, currentRegion[0], currentRegion[1], statements);
145.1503 -
145.1504 -        assertNotNull(tph);
145.1505 -
145.1506 -        TreePath tp = tph.resolve(info);
145.1507 -
145.1508 -        assertNotNull(tp);
145.1509 -
145.1510 -        BlockTree bt = (BlockTree) tp.getParentPath().getLeaf();
145.1511 -        List<TreePath> searchFor = new LinkedList<TreePath>();
145.1512 -
145.1513 -        for (StatementTree t : bt.getStatements().subList(statements[0], statements[1] + 1)) {
145.1514 -            searchFor.add(new TreePath(tp, t));
145.1515 -        }
145.1516 -
145.1517 -        final Set<VariableElement> vars = new HashSet<VariableElement>();
145.1518 -
145.1519 -        for (final String name : remappableVariables.split(",")) {
145.1520 -            if (name.isEmpty()) continue;
145.1521 -            new TreePathScanner<Object, Object>() {
145.1522 -                @Override
145.1523 -                public Object visitVariable(VariableTree node, Object p) {
145.1524 -                    if (node.getName().contentEquals(name)) {
145.1525 -                        vars.add((VariableElement) info.getTrees().getElement(getCurrentPath()));
145.1526 -                    }
145.1527 -
145.1528 -                    return super.visitVariable(node, p);
145.1529 -                }
145.1530 -            }.scan(info.getCompilationUnit(), null);
145.1531 -        }
145.1532 -
145.1533 -        Set<Options> opts = EnumSet.of(Options.ALLOW_GO_DEEPER);
145.1534 -
145.1535 -        opts.addAll(Arrays.asList(options));
145.1536 -
145.1537 -        Map<TreePath, VariableAssignments> result = CopyFinder.internalComputeDuplicates(info, searchFor, new TreePath(info.getCompilationUnit()), null, vars, new AtomicBooleanCancel(), Collections.<String, TypeMirror>emptyMap(), opts.toArray(new Options[0]));
145.1538 -        Set<List<Integer>> realSpans = new HashSet<List<Integer>>();
145.1539 -
145.1540 -        for (Entry<TreePath, VariableAssignments> e : result.entrySet()) {
145.1541 -            List<? extends StatementTree> parentStatements = CopyFinder.getStatements(e.getKey());
145.1542 -            int dupeStart = parentStatements.indexOf(e.getKey().getLeaf());
145.1543 -            int startPos = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), parentStatements.get(dupeStart));
145.1544 -            int endPos = (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), parentStatements.get(dupeStart + searchFor.size() - 1));
145.1545 -
145.1546 -            realSpans.add(Arrays.asList(startPos, endPos));
145.1547 -        }
145.1548 -
145.1549 -        Set<List<Integer>> goldenSpans = new HashSet<List<Integer>>();
145.1550 -
145.1551 -        for (int[] region : regions) {
145.1552 -            if (region == currentRegion) continue;
145.1553 -
145.1554 -            int[] stmts = new int[2];
145.1555 -            TreePathHandle gtph = IntroduceMethodFix.validateSelectionForIntroduceMethod(info, region[0], region[1], stmts);
145.1556 -
145.1557 -            assertNotNull(gtph);
145.1558 -
145.1559 -            TreePath gtp = gtph.resolve(info);
145.1560 -
145.1561 -            assertNotNull(gtp);
145.1562 -
145.1563 -            BlockTree b = (BlockTree) gtp.getParentPath().getLeaf();
145.1564 -
145.1565 -            int startPos = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), b.getStatements().get(stmts[0]));
145.1566 -            int endPos = (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), b.getStatements().get(stmts[1]));
145.1567 -
145.1568 -            goldenSpans.add(Arrays.asList(startPos, endPos));
145.1569 -        }
145.1570 -
145.1571 -        assertEquals(goldenSpans, realSpans);
145.1572 -    }
145.1573 -
145.1574 -    protected Collection<TreePath> computeDuplicates(TreePath path) {
145.1575 -        return CopyFinder.internalComputeDuplicates(info, Collections.singletonList(path), new TreePath(info.getCompilationUnit()), null, null, new AtomicBooleanCancel(), null, Options.ALLOW_GO_DEEPER).keySet();
145.1576 -    }
145.1577 -
145.1578 -    public static final class Pair<A, B> {
145.1579 -        private final A a;
145.1580 -        private final B b;
145.1581 -
145.1582 -        public Pair(A a, B b) {
145.1583 -            this.a = a;
145.1584 -            this.b = b;
145.1585 -        }
145.1586 -
145.1587 -        public A getA() {
145.1588 -            return a;
145.1589 -        }
145.1590 -
145.1591 -        public B getB() {
145.1592 -            return b;
145.1593 -        }
145.1594 -
145.1595 -    }
145.1596 -
145.1597 -    private static final class AtomicBooleanCancel implements Cancel {
145.1598 -
145.1599 -        private final AtomicBoolean cancel;
145.1600 -
145.1601 -        public AtomicBooleanCancel() {
145.1602 -            this(new AtomicBoolean());
145.1603 -        }
145.1604 -
145.1605 -        public AtomicBooleanCancel(AtomicBoolean cancel) {
145.1606 -            this.cancel = cancel;
145.1607 -        }
145.1608 -
145.1609 -        @Override
145.1610 -        public boolean isCancelled() {
145.1611 -            return cancel.get();
145.1612 -        }
145.1613 -
145.1614 -    }
145.1615 -}
   146.1 --- a/sandbox/java.hints/spi.java.hints/test/unit/src/org/netbeans/spi/java/hints/support/FixFactoryTest.java	Sun Jan 08 20:10:08 2017 +0100
   146.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   146.3 @@ -1,79 +0,0 @@
   146.4 -/*
   146.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   146.6 - *
   146.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
   146.8 - *
   146.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  146.10 - * Other names may be trademarks of their respective owners.
  146.11 - *
  146.12 - * The contents of this file are subject to the terms of either the GNU
  146.13 - * General Public License Version 2 only ("GPL") or the Common
  146.14 - * Development and Distribution License("CDDL") (collectively, the
  146.15 - * "License"). You may not use this file except in compliance with the
  146.16 - * License. You can obtain a copy of the License at
  146.17 - * http://www.netbeans.org/cddl-gplv2.html
  146.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  146.19 - * specific language governing permissions and limitations under the
  146.20 - * License.  When distributing the software, include this License Header
  146.21 - * Notice in each file and include the License file at
  146.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  146.23 - * particular file as subject to the "Classpath" exception as provided
  146.24 - * by Oracle in the GPL Version 2 section of the License file that
  146.25 - * accompanied this code. If applicable, add the following below the
  146.26 - * License Header, with the fields enclosed by brackets [] replaced by
  146.27 - * your own identifying information:
  146.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  146.29 - *
  146.30 - * If you wish your version of this file to be governed by only the CDDL
  146.31 - * or only the GPL Version 2, indicate your decision by adding
  146.32 - * "[Contributor] elects to include this software in this distribution
  146.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  146.34 - * single choice of license, a recipient has the option to distribute
  146.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  146.36 - * to extend the choice of license to its licensees as provided above.
  146.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  146.38 - * Version 2 license, then the option applies only if the new code is
  146.39 - * made subject to such option by the copyright holder.
  146.40 - *
  146.41 - * Contributor(s):
  146.42 - *
  146.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
  146.44 - */
  146.45 -package org.netbeans.spi.java.hints.support;
  146.46 -
  146.47 -import com.sun.source.tree.ClassTree;
  146.48 -import com.sun.source.util.TreePath;
  146.49 -import java.util.EnumSet;
  146.50 -import javax.lang.model.element.Modifier;
  146.51 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  146.52 -import org.netbeans.modules.java.hints.spiimpl.TestBase;
  146.53 -import org.openide.LifecycleManager;
  146.54 -
  146.55 -/**
  146.56 - *
  146.57 - * @author lahvac
  146.58 - */
  146.59 -public class FixFactoryTest extends TestBase {
  146.60 -    
  146.61 -    public FixFactoryTest(String name) {
  146.62 -        super(name);
  146.63 -    }
  146.64 -
  146.65 -    @Override
  146.66 -    protected void setUp() throws Exception {
  146.67 -        super.setUp();
  146.68 -        SourceUtilsTestUtil.makeScratchDir(this);
  146.69 -    }
  146.70 -    
  146.71 -    public void testInterfaceModifiers() throws Exception {
  146.72 -        prepareTest("test/Test.java", "package test; public interface I { }");
  146.73 -        
  146.74 -        ClassTree i = (ClassTree) info.getCompilationUnit().getTypeDecls().get(0);
  146.75 -        
  146.76 -        FixFactory.removeModifiersFix(info, TreePath.getPath(info.getCompilationUnit(), i.getModifiers()), EnumSet.of(Modifier.PUBLIC), "").implement();
  146.77 -        
  146.78 -        LifecycleManager.getDefault().saveAll();
  146.79 -        
  146.80 -        assertEquals("package test; interface I { }", info.getFileObject().asText());
  146.81 -    }
  146.82 -}
  146.83 \ No newline at end of file
   147.1 --- a/sandbox/nb-scripts/jackpot-to-nb	Sun Jan 08 20:10:08 2017 +0100
   147.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   147.3 @@ -1,5 +0,0 @@
   147.4 -#!/bin/bash
   147.5 -
   147.6 -. nb-jackpot-lib
   147.7 -
   147.8 -convert $JACKPOT $NETBEANS
   148.1 --- a/sandbox/nb-scripts/nb-jackpot-lib	Sun Jan 08 20:10:08 2017 +0100
   148.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   148.3 @@ -1,21 +0,0 @@
   148.4 -NETBEANS=1
   148.5 -JACKPOT=2
   148.6 -
   148.7 -function convert() {
   148.8 -    MAPPING=`dirname $0i`/nb-to-jackpot.mapping;
   148.9 -    SCRIPT=/tmp/$$.sed
  148.10 -    rm -rf $SCRIPT
  148.11 -
  148.12 -    for map in `cat $MAPPING`; do
  148.13 -        echo -n "s/" >>$SCRIPT
  148.14 -        FROM_PATH=`echo -n $map | cut -d ':' -f $1`;
  148.15 -        TO_PATH=`echo -n $map | cut -d ':' -f $2`;
  148.16 -        echo -n "$FROM_PATH" | sed -e "s/\//\\\\\//g" >>$SCRIPT
  148.17 -        echo -n "/" >>$SCRIPT
  148.18 -        echo -n "$TO_PATH" | sed -e "s/\//\\\\\//g" >>$SCRIPT
  148.19 -        echo "/g" >>$SCRIPT
  148.20 -    done
  148.21 -
  148.22 -#cat $SCRIPT
  148.23 -sed -f $SCRIPT
  148.24 -}
   149.1 --- a/sandbox/nb-scripts/nb-to-jackpot	Sun Jan 08 20:10:08 2017 +0100
   149.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   149.3 @@ -1,5 +0,0 @@
   149.4 -#!/bin/bash
   149.5 -
   149.6 -. `dirname $0`/nb-jackpot-lib
   149.7 -
   149.8 -convert $NETBEANS $JACKPOT
   150.1 --- a/sandbox/nb-scripts/nb-to-jackpot.mapping	Sun Jan 08 20:10:08 2017 +0100
   150.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   150.3 @@ -1,9 +0,0 @@
   150.4 -java.hints/src/org/netbeans/modules/java/hints/introduce/CopyFinder.java:api/src/org/netbeans/modules/jackpot30/impl/pm/CopyFinder.java
   150.5 -java.hints/test/unit/src/org/netbeans/modules/java/hints/introduce/CopyFinderTest.java:borrowedtests/src/org/netbeans/modules/java/hints/introduce/CopyFinderTest.java
   150.6 -java.hints/src/org/netbeans/modules/java/hints/jackpot/file:file/src/org/netbeans/modules/jackpot30/file
   150.7 -java.hints/src/org/netbeans/modules/java/hints/jackpot/impl:api/src/org/netbeans/modules/jackpot30/impl
   150.8 -java.hints/src/org/netbeans/modules/java/hints/jackpot/spi:api/src/org/netbeans/modules/jackpot30/spi
   150.9 -java.hints/test/unit/src/org/netbeans/modules/java/hints/jackpot/file:file/test/unit/src/org/netbeans/modules/jackpot30/file
  150.10 -java.hints/test/unit/src/org/netbeans/modules/java/hints/jackpot/impl/pm:api/test/unit/src/org/netbeans/modules/jackpot30/impl/pm
  150.11 -java.hints/test/unit/src/org/netbeans/modules/java/hints/jackpot/impl:api/test/unit/src/org/netbeans/modules/jackpot30/impl
  150.12 -java.hints/test/unit/src/org/netbeans/modules/java/hints/jackpot/spi:api/test/unit/src/org/netbeans/modules/jackpot30/spi
   151.1 --- a/sandbox/old-modules/api/build.xml	Sun Jan 08 20:10:08 2017 +0100
   151.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   151.3 @@ -1,66 +0,0 @@
   151.4 -<?xml version="1.0" encoding="UTF-8"?>
   151.5 -<!--
   151.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   151.7 -
   151.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   151.9 -
  151.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  151.11 -Other names may be trademarks of their respective owners.
  151.12 -
  151.13 -The contents of this file are subject to the terms of either the GNU
  151.14 -General Public License Version 2 only ("GPL") or the Common
  151.15 -Development and Distribution License("CDDL") (collectively, the
  151.16 -"License"). You may not use this file except in compliance with the
  151.17 -License. You can obtain a copy of the License at
  151.18 -http://www.netbeans.org/cddl-gplv2.html
  151.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  151.20 -specific language governing permissions and limitations under the
  151.21 -License.  When distributing the software, include this License Header
  151.22 -Notice in each file and include the License file at
  151.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  151.24 -particular file as subject to the "Classpath" exception as provided
  151.25 -by Oracle in the GPL Version 2 section of the License file that
  151.26 -accompanied this code. If applicable, add the following below the
  151.27 -License Header, with the fields enclosed by brackets [] replaced by
  151.28 -your own identifying information:
  151.29 -"Portions Copyrighted [year] [name of copyright owner]"
  151.30 -
  151.31 -Contributor(s):
  151.32 -
  151.33 -The Original Software is NetBeans. The Initial Developer of the Original
  151.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  151.35 -Microsystems, Inc. All Rights Reserved.
  151.36 -
  151.37 -If you wish your version of this file to be governed by only the CDDL
  151.38 -or only the GPL Version 2, indicate your decision by adding
  151.39 -"[Contributor] elects to include this software in this distribution
  151.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  151.41 -single choice of license, a recipient has the option to distribute
  151.42 -your version of this file under either the CDDL, the GPL Version 2 or
  151.43 -to extend the choice of license to its licensees as provided above.
  151.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  151.45 -Version 2 license, then the option applies only if the new code is
  151.46 -made subject to such option by the copyright holder.
  151.47 --->
  151.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
  151.49 -<!-- for some information on what you could do (e.g. targets to override). -->
  151.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
  151.51 -<project name="org.netbeans.modules.jackpot30.api" default="netbeans" basedir=".">
  151.52 -    <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.api.</description>
  151.53 -    <import file="nbproject/build-impl.xml"/>
  151.54 -    <import file="${suite.dir}/findbugs-import.xml"/>
  151.55 -
  151.56 -    <!-- Mac -->
  151.57 -    <pathconvert property="retouche.javac">
  151.58 -        <fileset dir="${nbplatform.active.dir}">
  151.59 -            <filename name="java*/modules/ext/javac*.jar"/>
  151.60 -        </fileset>
  151.61 -        <fileset dir="${java.home}/../Classes" erroronmissingdir="false">
  151.62 -            <include name="*.jar"/>
  151.63 -        </fileset>
  151.64 -    </pathconvert>
  151.65 -    <echo message="${retouche.javac}"/>
  151.66 -    <condition property="bootclasspath.mac" value="${retouche.javac}">
  151.67 -        <os family="mac"/>
  151.68 -    </condition>
  151.69 -</project>
   152.1 --- a/sandbox/old-modules/api/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
   152.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   152.3 @@ -1,7 +0,0 @@
   152.4 -Manifest-Version: 1.0
   152.5 -AutoUpdate-Show-In-Client: false
   152.6 -OpenIDE-Module: org.netbeans.modules.jackpot30.api
   152.7 -OpenIDE-Module-Implementation-Version: 1
   152.8 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/impl/resources/layer.xml
   152.9 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/impl/resources/Bundle.properties
  152.10 -
   153.1 --- a/sandbox/old-modules/api/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
   153.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   153.3 @@ -1,73 +0,0 @@
   153.4 -<?xml version="1.0" encoding="UTF-8"?>
   153.5 -<!--
   153.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   153.7 -
   153.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   153.9 -
  153.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  153.11 -Other names may be trademarks of their respective owners.
  153.12 -
  153.13 -The contents of this file are subject to the terms of either the GNU
  153.14 -General Public License Version 2 only ("GPL") or the Common
  153.15 -Development and Distribution License("CDDL") (collectively, the
  153.16 -"License"). You may not use this file except in compliance with the
  153.17 -License. You can obtain a copy of the License at
  153.18 -http://www.netbeans.org/cddl-gplv2.html
  153.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  153.20 -specific language governing permissions and limitations under the
  153.21 -License.  When distributing the software, include this License Header
  153.22 -Notice in each file and include the License file at
  153.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  153.24 -particular file as subject to the "Classpath" exception as provided
  153.25 -by Oracle in the GPL Version 2 section of the License file that
  153.26 -accompanied this code. If applicable, add the following below the
  153.27 -License Header, with the fields enclosed by brackets [] replaced by
  153.28 -your own identifying information:
  153.29 -"Portions Copyrighted [year] [name of copyright owner]"
  153.30 -
  153.31 -Contributor(s):
  153.32 -
  153.33 -The Original Software is NetBeans. The Initial Developer of the Original
  153.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  153.35 -Microsystems, Inc. All Rights Reserved.
  153.36 -
  153.37 -If you wish your version of this file to be governed by only the CDDL
  153.38 -or only the GPL Version 2, indicate your decision by adding
  153.39 -"[Contributor] elects to include this software in this distribution
  153.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  153.41 -single choice of license, a recipient has the option to distribute
  153.42 -your version of this file under either the CDDL, the GPL Version 2 or
  153.43 -to extend the choice of license to its licensees as provided above.
  153.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  153.45 -Version 2 license, then the option applies only if the new code is
  153.46 -made subject to such option by the copyright holder.
  153.47 --->
  153.48 -<!--
  153.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
  153.50 -***         EDIT ../build.xml INSTEAD         ***
  153.51 --->
  153.52 -<project name="org.netbeans.modules.jackpot30.api-impl" basedir="..">
  153.53 -    <property file="nbproject/private/suite-private.properties"/>
  153.54 -    <property file="nbproject/suite.properties"/>
  153.55 -    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
  153.56 -    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
  153.57 -    <property file="${suite.dir}/nbproject/platform.properties"/>
  153.58 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
  153.59 -        <attribute name="name"/>
  153.60 -        <attribute name="value"/>
  153.61 -        <sequential>
  153.62 -            <property name="@{name}" value="${@{value}}"/>
  153.63 -        </sequential>
  153.64 -    </macrodef>
  153.65 -    <property file="${user.properties.file}"/>
  153.66 -    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  153.67 -    <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  153.68 -    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
  153.69 -        <condition>
  153.70 -            <not>
  153.71 -                <available file="${harness.dir}" type="dir"/>
  153.72 -            </not>
  153.73 -        </condition>
  153.74 -    </fail>
  153.75 -    <import file="${harness.dir}/build.xml"/>
  153.76 -</project>
   154.1 --- a/sandbox/old-modules/api/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
   154.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   154.3 @@ -1,49 +0,0 @@
   154.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   154.5 -#
   154.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   154.7 -#
   154.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   154.9 -# Other names may be trademarks of their respective owners.
  154.10 -#
  154.11 -# The contents of this file are subject to the terms of either the GNU
  154.12 -# General Public License Version 2 only ("GPL") or the Common
  154.13 -# Development and Distribution License("CDDL") (collectively, the
  154.14 -# "License"). You may not use this file except in compliance with the
  154.15 -# License. You can obtain a copy of the License at
  154.16 -# http://www.netbeans.org/cddl-gplv2.html
  154.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  154.18 -# specific language governing permissions and limitations under the
  154.19 -# License.  When distributing the software, include this License Header
  154.20 -# Notice in each file and include the License file at
  154.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  154.22 -# particular file as subject to the "Classpath" exception as provided
  154.23 -# by Oracle in the GPL Version 2 section of the License file that
  154.24 -# accompanied this code. If applicable, add the following below the
  154.25 -# License Header, with the fields enclosed by brackets [] replaced by
  154.26 -# your own identifying information:
  154.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  154.28 -#
  154.29 -# Contributor(s):
  154.30 -#
  154.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  154.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  154.33 -# Microsystems, Inc. All Rights Reserved.
  154.34 -#
  154.35 -# If you wish your version of this file to be governed by only the CDDL
  154.36 -# or only the GPL Version 2, indicate your decision by adding
  154.37 -# "[Contributor] elects to include this software in this distribution
  154.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  154.39 -# single choice of license, a recipient has the option to distribute
  154.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  154.41 -# to extend the choice of license to its licensees as provided above.
  154.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  154.43 -# Version 2 license, then the option applies only if the new code is
  154.44 -# made subject to such option by the copyright holder.
  154.45 -build.xml.data.CRC32=f9c1509c
  154.46 -build.xml.script.CRC32=0abcaef9
  154.47 -build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
  154.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
  154.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
  154.50 -nbproject/build-impl.xml.data.CRC32=6500fcd0
  154.51 -nbproject/build-impl.xml.script.CRC32=ff50c613
  154.52 -nbproject/build-impl.xml.stylesheet.CRC32=68e521fc@2.70
   155.1 --- a/sandbox/old-modules/api/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
   155.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   155.3 @@ -1,44 +0,0 @@
   155.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   155.5 -#
   155.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   155.7 -#
   155.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   155.9 -# Other names may be trademarks of their respective owners.
  155.10 -#
  155.11 -# The contents of this file are subject to the terms of either the GNU
  155.12 -# General Public License Version 2 only ("GPL") or the Common
  155.13 -# Development and Distribution License("CDDL") (collectively, the
  155.14 -# "License"). You may not use this file except in compliance with the
  155.15 -# License. You can obtain a copy of the License at
  155.16 -# http://www.netbeans.org/cddl-gplv2.html
  155.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  155.18 -# specific language governing permissions and limitations under the
  155.19 -# License.  When distributing the software, include this License Header
  155.20 -# Notice in each file and include the License file at
  155.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  155.22 -# particular file as subject to the "Classpath" exception as provided
  155.23 -# by Oracle in the GPL Version 2 section of the License file that
  155.24 -# accompanied this code. If applicable, add the following below the
  155.25 -# License Header, with the fields enclosed by brackets [] replaced by
  155.26 -# your own identifying information:
  155.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  155.28 -#
  155.29 -# Contributor(s):
  155.30 -#
  155.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  155.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  155.33 -# Microsystems, Inc. All Rights Reserved.
  155.34 -#
  155.35 -# If you wish your version of this file to be governed by only the CDDL
  155.36 -# or only the GPL Version 2, indicate your decision by adding
  155.37 -# "[Contributor] elects to include this software in this distribution
  155.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  155.39 -# single choice of license, a recipient has the option to distribute
  155.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  155.41 -# to extend the choice of license to its licensees as provided above.
  155.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  155.43 -# Version 2 license, then the option applies only if the new code is
  155.44 -# made subject to such option by the copyright holder.
  155.45 -javac.source=1.5
  155.46 -javac.compilerargs=-Xlint -Xlint:-serial
  155.47 -spec.version.base=1.16.0
   156.1 --- a/sandbox/old-modules/api/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
   156.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   156.3 @@ -1,480 +0,0 @@
   156.4 -<?xml version="1.0" encoding="UTF-8"?>
   156.5 -<!--
   156.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   156.7 -
   156.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   156.9 -
  156.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  156.11 -Other names may be trademarks of their respective owners.
  156.12 -
  156.13 -The contents of this file are subject to the terms of either the GNU
  156.14 -General Public License Version 2 only ("GPL") or the Common
  156.15 -Development and Distribution License("CDDL") (collectively, the
  156.16 -"License"). You may not use this file except in compliance with the
  156.17 -License. You can obtain a copy of the License at
  156.18 -http://www.netbeans.org/cddl-gplv2.html
  156.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  156.20 -specific language governing permissions and limitations under the
  156.21 -License.  When distributing the software, include this License Header
  156.22 -Notice in each file and include the License file at
  156.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  156.24 -particular file as subject to the "Classpath" exception as provided
  156.25 -by Oracle in the GPL Version 2 section of the License file that
  156.26 -accompanied this code. If applicable, add the following below the
  156.27 -License Header, with the fields enclosed by brackets [] replaced by
  156.28 -your own identifying information:
  156.29 -"Portions Copyrighted [year] [name of copyright owner]"
  156.30 -
  156.31 -Contributor(s):
  156.32 -
  156.33 -The Original Software is NetBeans. The Initial Developer of the Original
  156.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  156.35 -Microsystems, Inc. All Rights Reserved.
  156.36 -
  156.37 -If you wish your version of this file to be governed by only the CDDL
  156.38 -or only the GPL Version 2, indicate your decision by adding
  156.39 -"[Contributor] elects to include this software in this distribution
  156.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  156.41 -single choice of license, a recipient has the option to distribute
  156.42 -your version of this file under either the CDDL, the GPL Version 2 or
  156.43 -to extend the choice of license to its licensees as provided above.
  156.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  156.45 -Version 2 license, then the option applies only if the new code is
  156.46 -made subject to such option by the copyright holder.
  156.47 --->
  156.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
  156.49 -    <type>org.netbeans.modules.apisupport.project</type>
  156.50 -    <configuration>
  156.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
  156.52 -            <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
  156.53 -            <suite-component/>
  156.54 -            <module-dependencies>
  156.55 -                <dependency>
  156.56 -                    <code-name-base>org.jdesktop.layout</code-name-base>
  156.57 -                    <build-prerequisite/>
  156.58 -                    <compile-dependency/>
  156.59 -                    <run-dependency>
  156.60 -                        <release-version>1</release-version>
  156.61 -                        <specification-version>1.7.0.103</specification-version>
  156.62 -                    </run-dependency>
  156.63 -                </dependency>
  156.64 -                <dependency>
  156.65 -                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
  156.66 -                    <build-prerequisite/>
  156.67 -                    <compile-dependency/>
  156.68 -                    <run-dependency>
  156.69 -                        <release-version>1</release-version>
  156.70 -                        <specification-version>1.0</specification-version>
  156.71 -                    </run-dependency>
  156.72 -                </dependency>
  156.73 -                <dependency>
  156.74 -                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
  156.75 -                    <build-prerequisite/>
  156.76 -                    <compile-dependency/>
  156.77 -                    <run-dependency>
  156.78 -                        <release-version>1</release-version>
  156.79 -                        <specification-version>1.19</specification-version>
  156.80 -                    </run-dependency>
  156.81 -                </dependency>
  156.82 -                <dependency>
  156.83 -                    <code-name-base>org.netbeans.api.progress</code-name-base>
  156.84 -                    <build-prerequisite/>
  156.85 -                    <compile-dependency/>
  156.86 -                    <run-dependency>
  156.87 -                        <release-version>1</release-version>
  156.88 -                        <specification-version>1.13.0.1</specification-version>
  156.89 -                    </run-dependency>
  156.90 -                </dependency>
  156.91 -                <dependency>
  156.92 -                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
  156.93 -                    <build-prerequisite/>
  156.94 -                    <compile-dependency/>
  156.95 -                    <run-dependency>
  156.96 -                        <specification-version>7.5.0.3</specification-version>
  156.97 -                    </run-dependency>
  156.98 -                </dependency>
  156.99 -                <dependency>
 156.100 -                    <code-name-base>org.netbeans.libs.javacimpl</code-name-base>
 156.101 -                    <build-prerequisite/>
 156.102 -                    <compile-dependency/>
 156.103 -                    <run-dependency>
 156.104 -                        <release-version>1</release-version>
 156.105 -                        <implementation-version/>
 156.106 -                    </run-dependency>
 156.107 -                </dependency>
 156.108 -                <dependency>
 156.109 -                    <code-name-base>org.netbeans.libs.lucene</code-name-base>
 156.110 -                    <build-prerequisite/>
 156.111 -                    <compile-dependency/>
 156.112 -                    <run-dependency>
 156.113 -                        <release-version>1-3</release-version>
 156.114 -                        <specification-version>2.13</specification-version>
 156.115 -                    </run-dependency>
 156.116 -                </dependency>
 156.117 -                <dependency>
 156.118 -                    <code-name-base>org.netbeans.modules.diff</code-name-base>
 156.119 -                    <build-prerequisite/>
 156.120 -                    <compile-dependency/>
 156.121 -                    <run-dependency>
 156.122 -                        <release-version>1</release-version>
 156.123 -                        <implementation-version/>
 156.124 -                    </run-dependency>
 156.125 -                </dependency>
 156.126 -                <dependency>
 156.127 -                    <code-name-base>org.netbeans.modules.editor</code-name-base>
 156.128 -                    <build-prerequisite/>
 156.129 -                    <compile-dependency/>
 156.130 -                    <run-dependency>
 156.131 -                        <release-version>3</release-version>
 156.132 -                        <specification-version>1.56.0.5.13.6</specification-version>
 156.133 -                    </run-dependency>
 156.134 -                </dependency>
 156.135 -                <dependency>
 156.136 -                    <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
 156.137 -                    <build-prerequisite/>
 156.138 -                    <compile-dependency/>
 156.139 -                    <run-dependency>
 156.140 -                        <release-version>1-3</release-version>
 156.141 -                        <specification-version>1.38.0.9.2</specification-version>
 156.142 -                    </run-dependency>
 156.143 -                </dependency>
 156.144 -                <dependency>
 156.145 -                    <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
 156.146 -                    <build-prerequisite/>
 156.147 -                    <compile-dependency/>
 156.148 -                    <run-dependency>
 156.149 -                        <release-version>1</release-version>
 156.150 -                        <specification-version>1.13.0.2</specification-version>
 156.151 -                    </run-dependency>
 156.152 -                </dependency>
 156.153 -                <dependency>
 156.154 -                    <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
 156.155 -                    <build-prerequisite/>
 156.156 -                    <compile-dependency/>
 156.157 -                    <run-dependency>
 156.158 -                        <release-version>1</release-version>
 156.159 -                        <specification-version>1.12</specification-version>
 156.160 -                    </run-dependency>
 156.161 -                </dependency>
 156.162 -                <dependency>
 156.163 -                    <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
 156.164 -                    <build-prerequisite/>
 156.165 -                    <compile-dependency/>
 156.166 -                    <run-dependency>
 156.167 -                        <release-version>1</release-version>
 156.168 -                        <specification-version>1.25</specification-version>
 156.169 -                    </run-dependency>
 156.170 -                </dependency>
 156.171 -                <dependency>
 156.172 -                    <code-name-base>org.netbeans.modules.jackpot30.remoting.api</code-name-base>
 156.173 -                    <build-prerequisite/>
 156.174 -                    <compile-dependency/>
 156.175 -                    <run-dependency>
 156.176 -                        <specification-version>1.0</specification-version>
 156.177 -                    </run-dependency>
 156.178 -                </dependency>
 156.179 -                <dependency>
 156.180 -                    <code-name-base>org.netbeans.modules.java.editor</code-name-base>
 156.181 -                    <build-prerequisite/>
 156.182 -                    <compile-dependency/>
 156.183 -                    <run-dependency>
 156.184 -                        <release-version>1</release-version>
 156.185 -                        <implementation-version/>
 156.186 -                    </run-dependency>
 156.187 -                </dependency>
 156.188 -                <dependency>
 156.189 -                    <code-name-base>org.netbeans.modules.java.hints</code-name-base>
 156.190 -                    <build-prerequisite/>
 156.191 -                    <compile-dependency/>
 156.192 -                    <run-dependency>
 156.193 -                        <release-version>1</release-version>
 156.194 -                        <implementation-version/>
 156.195 -                    </run-dependency>
 156.196 -                </dependency>
 156.197 -                <dependency>
 156.198 -                    <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
 156.199 -                    <build-prerequisite/>
 156.200 -                    <compile-dependency/>
 156.201 -                    <run-dependency>
 156.202 -                        <release-version>1</release-version>
 156.203 -                        <specification-version>1.9</specification-version>
 156.204 -                    </run-dependency>
 156.205 -                </dependency>
 156.206 -                <dependency>
 156.207 -                    <code-name-base>org.netbeans.modules.java.platform</code-name-base>
 156.208 -                    <build-prerequisite/>
 156.209 -                    <compile-dependency/>
 156.210 -                    <run-dependency>
 156.211 -                        <release-version>1</release-version>
 156.212 -                        <specification-version>1.12</specification-version>
 156.213 -                    </run-dependency>
 156.214 -                </dependency>
 156.215 -                <dependency>
 156.216 -                    <code-name-base>org.netbeans.modules.java.preprocessorbridge</code-name-base>
 156.217 -                    <build-prerequisite/>
 156.218 -                    <compile-dependency/>
 156.219 -                    <run-dependency>
 156.220 -                        <implementation-version/>
 156.221 -                    </run-dependency>
 156.222 -                </dependency>
 156.223 -                <dependency>
 156.224 -                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
 156.225 -                    <build-prerequisite/>
 156.226 -                    <compile-dependency/>
 156.227 -                    <run-dependency>
 156.228 -                        <implementation-version/>
 156.229 -                    </run-dependency>
 156.230 -                </dependency>
 156.231 -                <dependency>
 156.232 -                    <code-name-base>org.netbeans.modules.lexer</code-name-base>
 156.233 -                    <build-prerequisite/>
 156.234 -                    <compile-dependency/>
 156.235 -                    <run-dependency>
 156.236 -                        <release-version>2</release-version>
 156.237 -                        <specification-version>1.34</specification-version>
 156.238 -                    </run-dependency>
 156.239 -                </dependency>
 156.240 -                <dependency>
 156.241 -                    <code-name-base>org.netbeans.modules.options.api</code-name-base>
 156.242 -                    <build-prerequisite/>
 156.243 -                    <compile-dependency/>
 156.244 -                    <run-dependency>
 156.245 -                        <release-version>1</release-version>
 156.246 -                        <specification-version>1.20</specification-version>
 156.247 -                    </run-dependency>
 156.248 -                </dependency>
 156.249 -                <dependency>
 156.250 -                    <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
 156.251 -                    <build-prerequisite/>
 156.252 -                    <compile-dependency/>
 156.253 -                    <run-dependency>
 156.254 -                        <release-version>1</release-version>
 156.255 -                        <implementation-version/>
 156.256 -                    </run-dependency>
 156.257 -                </dependency>
 156.258 -                <dependency>
 156.259 -                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
 156.260 -                    <build-prerequisite/>
 156.261 -                    <compile-dependency/>
 156.262 -                    <run-dependency>
 156.263 -                        <release-version>1</release-version>
 156.264 -                        <specification-version>1.24</specification-version>
 156.265 -                    </run-dependency>
 156.266 -                </dependency>
 156.267 -                <dependency>
 156.268 -                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
 156.269 -                    <build-prerequisite/>
 156.270 -                    <compile-dependency/>
 156.271 -                    <run-dependency>
 156.272 -                        <release-version>1</release-version>
 156.273 -                        <specification-version>1.35.0.6</specification-version>
 156.274 -                    </run-dependency>
 156.275 -                </dependency>
 156.276 -                <dependency>
 156.277 -                    <code-name-base>org.netbeans.modules.queries</code-name-base>
 156.278 -                    <build-prerequisite/>
 156.279 -                    <compile-dependency/>
 156.280 -                    <run-dependency>
 156.281 -                        <release-version>1</release-version>
 156.282 -                        <specification-version>1.15</specification-version>
 156.283 -                    </run-dependency>
 156.284 -                </dependency>
 156.285 -                <dependency>
 156.286 -                    <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
 156.287 -                    <build-prerequisite/>
 156.288 -                    <compile-dependency/>
 156.289 -                    <run-dependency>
 156.290 -                        <specification-version>1.6</specification-version>
 156.291 -                    </run-dependency>
 156.292 -                </dependency>
 156.293 -                <dependency>
 156.294 -                    <code-name-base>org.netbeans.modules.refactoring.java</code-name-base>
 156.295 -                    <build-prerequisite/>
 156.296 -                    <compile-dependency/>
 156.297 -                    <run-dependency>
 156.298 -                        <release-version>1</release-version>
 156.299 -                        <specification-version>1.6</specification-version>
 156.300 -                    </run-dependency>
 156.301 -                </dependency>
 156.302 -                <dependency>
 156.303 -                    <code-name-base>org.netbeans.modules.sendopts</code-name-base>
 156.304 -                    <build-prerequisite/>
 156.305 -                    <compile-dependency/>
 156.306 -                    <run-dependency>
 156.307 -                        <release-version>2</release-version>
 156.308 -                        <specification-version>2.4</specification-version>
 156.309 -                    </run-dependency>
 156.310 -                </dependency>
 156.311 -                <dependency>
 156.312 -                    <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
 156.313 -                    <build-prerequisite/>
 156.314 -                    <compile-dependency/>
 156.315 -                    <run-dependency>
 156.316 -                        <release-version>0-1</release-version>
 156.317 -                        <specification-version>1.7.0.7.2</specification-version>
 156.318 -                    </run-dependency>
 156.319 -                </dependency>
 156.320 -                <dependency>
 156.321 -                    <code-name-base>org.openide.awt</code-name-base>
 156.322 -                    <build-prerequisite/>
 156.323 -                    <compile-dependency/>
 156.324 -                    <run-dependency>
 156.325 -                        <specification-version>7.7.0.1</specification-version>
 156.326 -                    </run-dependency>
 156.327 -                </dependency>
 156.328 -                <dependency>
 156.329 -                    <code-name-base>org.openide.dialogs</code-name-base>
 156.330 -                    <build-prerequisite/>
 156.331 -                    <compile-dependency/>
 156.332 -                    <run-dependency>
 156.333 -                        <specification-version>7.10</specification-version>
 156.334 -                    </run-dependency>
 156.335 -                </dependency>
 156.336 -                <dependency>
 156.337 -                    <code-name-base>org.openide.filesystems</code-name-base>
 156.338 -                    <build-prerequisite/>
 156.339 -                    <compile-dependency/>
 156.340 -                    <run-dependency>
 156.341 -                        <specification-version>7.21.0.1.1</specification-version>
 156.342 -                    </run-dependency>
 156.343 -                </dependency>
 156.344 -                <dependency>
 156.345 -                    <code-name-base>org.openide.loaders</code-name-base>
 156.346 -                    <build-prerequisite/>
 156.347 -                    <compile-dependency/>
 156.348 -                    <run-dependency>
 156.349 -                        <specification-version>7.5</specification-version>
 156.350 -                    </run-dependency>
 156.351 -                </dependency>
 156.352 -                <dependency>
 156.353 -                    <code-name-base>org.openide.modules</code-name-base>
 156.354 -                    <build-prerequisite/>
 156.355 -                    <compile-dependency/>
 156.356 -                    <run-dependency>
 156.357 -                        <specification-version>7.10</specification-version>
 156.358 -                    </run-dependency>
 156.359 -                </dependency>
 156.360 -                <dependency>
 156.361 -                    <code-name-base>org.openide.nodes</code-name-base>
 156.362 -                    <build-prerequisite/>
 156.363 -                    <compile-dependency/>
 156.364 -                    <run-dependency>
 156.365 -                        <specification-version>7.9.0.1</specification-version>
 156.366 -                    </run-dependency>
 156.367 -                </dependency>
 156.368 -                <dependency>
 156.369 -                    <code-name-base>org.openide.text</code-name-base>
 156.370 -                    <build-prerequisite/>
 156.371 -                    <compile-dependency/>
 156.372 -                    <run-dependency>
 156.373 -                        <specification-version>6.22</specification-version>
 156.374 -                    </run-dependency>
 156.375 -                </dependency>
 156.376 -                <dependency>
 156.377 -                    <code-name-base>org.openide.util</code-name-base>
 156.378 -                    <build-prerequisite/>
 156.379 -                    <compile-dependency/>
 156.380 -                    <run-dependency>
 156.381 -                        <specification-version>8.0</specification-version>
 156.382 -                    </run-dependency>
 156.383 -                </dependency>
 156.384 -                <dependency>
 156.385 -                    <code-name-base>org.openide.util.lookup</code-name-base>
 156.386 -                    <build-prerequisite/>
 156.387 -                    <compile-dependency/>
 156.388 -                    <run-dependency>
 156.389 -                        <specification-version>8.0.0.1</specification-version>
 156.390 -                    </run-dependency>
 156.391 -                </dependency>
 156.392 -                <dependency>
 156.393 -                    <code-name-base>org.openide.windows</code-name-base>
 156.394 -                    <build-prerequisite/>
 156.395 -                    <compile-dependency/>
 156.396 -                    <run-dependency>
 156.397 -                        <specification-version>6.27</specification-version>
 156.398 -                    </run-dependency>
 156.399 -                </dependency>
 156.400 -            </module-dependencies>
 156.401 -            <test-dependencies>
 156.402 -                <test-type>
 156.403 -                    <name>unit</name>
 156.404 -                    <test-dependency>
 156.405 -                        <code-name-base>org.netbeans.bootstrap</code-name-base>
 156.406 -                    </test-dependency>
 156.407 -                    <test-dependency>
 156.408 -                        <code-name-base>org.netbeans.core.startup</code-name-base>
 156.409 -                    </test-dependency>
 156.410 -                    <test-dependency>
 156.411 -                        <code-name-base>org.netbeans.insane</code-name-base>
 156.412 -                        <compile-dependency/>
 156.413 -                    </test-dependency>
 156.414 -                    <test-dependency>
 156.415 -                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
 156.416 -                        <compile-dependency/>
 156.417 -                    </test-dependency>
 156.418 -                    <test-dependency>
 156.419 -                        <code-name-base>org.netbeans.modules.classfile</code-name-base>
 156.420 -                    </test-dependency>
 156.421 -                    <test-dependency>
 156.422 -                        <code-name-base>org.netbeans.modules.defaults</code-name-base>
 156.423 -                    </test-dependency>
 156.424 -                    <test-dependency>
 156.425 -                        <code-name-base>org.netbeans.modules.editor</code-name-base>
 156.426 -                    </test-dependency>
 156.427 -                    <test-dependency>
 156.428 -                        <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
 156.429 -                    </test-dependency>
 156.430 -                    <test-dependency>
 156.431 -                        <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
 156.432 -                    </test-dependency>
 156.433 -                    <test-dependency>
 156.434 -                        <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base>
 156.435 -                    </test-dependency>
 156.436 -                    <test-dependency>
 156.437 -                        <code-name-base>org.netbeans.modules.editor.util</code-name-base>
 156.438 -                    </test-dependency>
 156.439 -                    <test-dependency>
 156.440 -                        <code-name-base>org.netbeans.modules.jackpot30.common.test</code-name-base>
 156.441 -                        <compile-dependency/>
 156.442 -                    </test-dependency>
 156.443 -                    <test-dependency>
 156.444 -                        <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
 156.445 -                        <recursive/>
 156.446 -                        <compile-dependency/>
 156.447 -                    </test-dependency>
 156.448 -                    <test-dependency>
 156.449 -                        <code-name-base>org.netbeans.modules.java.hints</code-name-base>
 156.450 -                        <compile-dependency/>
 156.451 -                    </test-dependency>
 156.452 -                    <test-dependency>
 156.453 -                        <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base>
 156.454 -                    </test-dependency>
 156.455 -                    <test-dependency>
 156.456 -                        <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
 156.457 -                    </test-dependency>
 156.458 -                    <test-dependency>
 156.459 -                        <code-name-base>org.netbeans.modules.masterfs</code-name-base>
 156.460 -                    </test-dependency>
 156.461 -                    <test-dependency>
 156.462 -                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
 156.463 -                        <compile-dependency/>
 156.464 -                    </test-dependency>
 156.465 -                    <test-dependency>
 156.466 -                        <code-name-base>org.netbeans.modules.progress.ui</code-name-base>
 156.467 -                    </test-dependency>
 156.468 -                    <test-dependency>
 156.469 -                        <code-name-base>org.netbeans.modules.projectui</code-name-base>
 156.470 -                    </test-dependency>
 156.471 -                    <test-dependency>
 156.472 -                        <code-name-base>org.openidex.util</code-name-base>
 156.473 -                    </test-dependency>
 156.474 -                </test-type>
 156.475 -            </test-dependencies>
 156.476 -            <public-packages>
 156.477 -                <package>org.netbeans.modules.jackpot30.spi</package>
 156.478 -                <package>org.netbeans.modules.jackpot30.spi.refactoring</package>
 156.479 -                <package>org.netbeans.modules.jackpot30.spi.support</package>
 156.480 -            </public-packages>
 156.481 -        </data>
 156.482 -    </configuration>
 156.483 -</project>
   157.1 --- a/sandbox/old-modules/api/nbproject/suite.properties	Sun Jan 08 20:10:08 2017 +0100
   157.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   157.3 @@ -1,42 +0,0 @@
   157.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   157.5 -#
   157.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   157.7 -#
   157.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   157.9 -# Other names may be trademarks of their respective owners.
  157.10 -#
  157.11 -# The contents of this file are subject to the terms of either the GNU
  157.12 -# General Public License Version 2 only ("GPL") or the Common
  157.13 -# Development and Distribution License("CDDL") (collectively, the
  157.14 -# "License"). You may not use this file except in compliance with the
  157.15 -# License. You can obtain a copy of the License at
  157.16 -# http://www.netbeans.org/cddl-gplv2.html
  157.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  157.18 -# specific language governing permissions and limitations under the
  157.19 -# License.  When distributing the software, include this License Header
  157.20 -# Notice in each file and include the License file at
  157.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  157.22 -# particular file as subject to the "Classpath" exception as provided
  157.23 -# by Oracle in the GPL Version 2 section of the License file that
  157.24 -# accompanied this code. If applicable, add the following below the
  157.25 -# License Header, with the fields enclosed by brackets [] replaced by
  157.26 -# your own identifying information:
  157.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  157.28 -#
  157.29 -# Contributor(s):
  157.30 -#
  157.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  157.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  157.33 -# Microsystems, Inc. All Rights Reserved.
  157.34 -#
  157.35 -# If you wish your version of this file to be governed by only the CDDL
  157.36 -# or only the GPL Version 2, indicate your decision by adding
  157.37 -# "[Contributor] elects to include this software in this distribution
  157.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  157.39 -# single choice of license, a recipient has the option to distribute
  157.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  157.41 -# to extend the choice of license to its licensees as provided above.
  157.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  157.43 -# Version 2 license, then the option applies only if the new code is
  157.44 -# made subject to such option by the copyright holder.
  157.45 -suite.dir=${basedir}/..
   158.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   158.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   158.3 @@ -1,46 +0,0 @@
   158.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   158.5 -#
   158.6 -# Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   158.7 -#
   158.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   158.9 -# Other names may be trademarks of their respective owners.
  158.10 -#
  158.11 -# The contents of this file are subject to the terms of either the GNU
  158.12 -# General Public License Version 2 only ("GPL") or the Common
  158.13 -# Development and Distribution License("CDDL") (collectively, the
  158.14 -# "License"). You may not use this file except in compliance with the
  158.15 -# License. You can obtain a copy of the License at
  158.16 -# http://www.netbeans.org/cddl-gplv2.html
  158.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  158.18 -# specific language governing permissions and limitations under the
  158.19 -# License.  When distributing the software, include this License Header
  158.20 -# Notice in each file and include the License file at
  158.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  158.22 -# particular file as subject to the "Classpath" exception as provided
  158.23 -# by Oracle in the GPL Version 2 section of the License file that
  158.24 -# accompanied this code. If applicable, add the following below the
  158.25 -# License Header, with the fields enclosed by brackets [] replaced by
  158.26 -# your own identifying information:
  158.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  158.28 -#
  158.29 -# If you wish your version of this file to be governed by only the CDDL
  158.30 -# or only the GPL Version 2, indicate your decision by adding
  158.31 -# "[Contributor] elects to include this software in this distribution
  158.32 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  158.33 -# single choice of license, a recipient has the option to distribute
  158.34 -# your version of this file under either the CDDL, the GPL Version 2 or
  158.35 -# to extend the choice of license to its licensees as provided above.
  158.36 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  158.37 -# Version 2 license, then the option applies only if the new code is
  158.38 -# made subject to such option by the copyright holder.
  158.39 -#
  158.40 -# Contributor(s):
  158.41 -#
  158.42 -# Portions Copyrighted 2010 Sun Microsystems, Inc.
  158.43 -
  158.44 -double-checked-locking=Double Checked Locking
  158.45 -double-checked-locking-verify=Double Checked Locking Strict
  158.46 -double-checked-locking-fix=Double Checked Locking
  158.47 -new-string=New String Creation
  158.48 -lambda-candidate=Find candidates for Lambda expression
  158.49 -ExamplesList.pattern.contentType=text/x-javahints
   159.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/Example.java	Sun Jan 08 20:10:08 2017 +0100
   159.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   159.3 @@ -1,83 +0,0 @@
   159.4 -/*
   159.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   159.6 - *
   159.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   159.8 - *
   159.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  159.10 - * Other names may be trademarks of their respective owners.
  159.11 - *
  159.12 - * The contents of this file are subject to the terms of either the GNU
  159.13 - * General Public License Version 2 only ("GPL") or the Common
  159.14 - * Development and Distribution License("CDDL") (collectively, the
  159.15 - * "License"). You may not use this file except in compliance with the
  159.16 - * License. You can obtain a copy of the License at
  159.17 - * http://www.netbeans.org/cddl-gplv2.html
  159.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  159.19 - * specific language governing permissions and limitations under the
  159.20 - * License.  When distributing the software, include this License Header
  159.21 - * Notice in each file and include the License file at
  159.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  159.23 - * particular file as subject to the "Classpath" exception as provided
  159.24 - * by Oracle in the GPL Version 2 section of the License file that
  159.25 - * accompanied this code. If applicable, add the following below the
  159.26 - * License Header, with the fields enclosed by brackets [] replaced by
  159.27 - * your own identifying information:
  159.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  159.29 - *
  159.30 - * If you wish your version of this file to be governed by only the CDDL
  159.31 - * or only the GPL Version 2, indicate your decision by adding
  159.32 - * "[Contributor] elects to include this software in this distribution
  159.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  159.34 - * single choice of license, a recipient has the option to distribute
  159.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  159.36 - * to extend the choice of license to its licensees as provided above.
  159.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  159.38 - * Version 2 license, then the option applies only if the new code is
  159.39 - * made subject to such option by the copyright holder.
  159.40 - *
  159.41 - * Contributor(s):
  159.42 - *
  159.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  159.44 - */
  159.45 -
  159.46 -package org.netbeans.modules.jackpot30.impl.examples;
  159.47 -
  159.48 -import java.util.Set;
  159.49 -import org.openide.util.NbBundle;
  159.50 -
  159.51 -/**
  159.52 - *
  159.53 - * @author lahvac
  159.54 - */
  159.55 -public class Example {
  159.56 -
  159.57 -    private final String key;
  159.58 -    private final String code;
  159.59 -    private final Set<Option> options;
  159.60 -
  159.61 -    Example(String key, String code, Set<Option> options) {
  159.62 -        this.key = key;
  159.63 -        this.code = code;
  159.64 -        this.options = options;
  159.65 -    }
  159.66 -
  159.67 -    String getKey() {
  159.68 -        return key;
  159.69 -    }
  159.70 -
  159.71 -    public String getDisplayName() {
  159.72 -        return NbBundle.getMessage(LoadExamples.class, key);
  159.73 -    }
  159.74 -
  159.75 -    public String getCode() {
  159.76 -        return code;
  159.77 -    }
  159.78 -
  159.79 -    public Set<Option> getOptions() {
  159.80 -        return options;
  159.81 -    }
  159.82 -    
  159.83 -    public enum Option {
  159.84 -        VERIFY, FIX;
  159.85 -    }
  159.86 -}
   160.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/ExamplesList.form	Sun Jan 08 20:10:08 2017 +0100
   160.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   160.3 @@ -1,95 +0,0 @@
   160.4 -<?xml version="1.0" encoding="UTF-8" ?>
   160.5 -
   160.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
   160.7 -  <AuxValues>
   160.8 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
   160.9 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
  160.10 -    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
  160.11 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
  160.12 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
  160.13 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
  160.14 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
  160.15 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
  160.16 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
  160.17 -  </AuxValues>
  160.18 -
  160.19 -  <Layout>
  160.20 -    <DimensionLayout dim="0">
  160.21 -      <Group type="103" groupAlignment="0" attributes="0">
  160.22 -          <Group type="102" alignment="1" attributes="0">
  160.23 -              <EmptySpace max="-2" attributes="0"/>
  160.24 -              <Group type="103" groupAlignment="1" attributes="0">
  160.25 -                  <Component id="jScrollPane2" alignment="0" pref="376" max="32767" attributes="0"/>
  160.26 -                  <Component id="jScrollPane1" alignment="0" pref="376" max="32767" attributes="0"/>
  160.27 -                  <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
  160.28 -              </Group>
  160.29 -              <EmptySpace max="-2" attributes="0"/>
  160.30 -          </Group>
  160.31 -      </Group>
  160.32 -    </DimensionLayout>
  160.33 -    <DimensionLayout dim="1">
  160.34 -      <Group type="103" groupAlignment="0" attributes="0">
  160.35 -          <Group type="102" alignment="0" attributes="0">
  160.36 -              <EmptySpace max="-2" attributes="0"/>
  160.37 -              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
  160.38 -              <EmptySpace max="-2" attributes="0"/>
  160.39 -              <Component id="jScrollPane1" pref="130" max="32767" attributes="0"/>
  160.40 -              <EmptySpace max="-2" attributes="0"/>
  160.41 -              <Component id="jScrollPane2" min="-2" pref="119" max="-2" attributes="0"/>
  160.42 -              <EmptySpace max="-2" attributes="0"/>
  160.43 -          </Group>
  160.44 -      </Group>
  160.45 -    </DimensionLayout>
  160.46 -  </Layout>
  160.47 -  <SubComponents>
  160.48 -    <Component class="javax.swing.JLabel" name="jLabel1">
  160.49 -      <Properties>
  160.50 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
  160.51 -          <Connection code="convertor.getHeader()" type="code"/>
  160.52 -        </Property>
  160.53 -      </Properties>
  160.54 -    </Component>
  160.55 -    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
  160.56 -      <AuxValues>
  160.57 -        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
  160.58 -      </AuxValues>
  160.59 -
  160.60 -      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
  160.61 -      <SubComponents>
  160.62 -        <Component class="javax.swing.JList" name="list">
  160.63 -          <Properties>
  160.64 -            <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
  160.65 -              <StringArray count="5">
  160.66 -                <StringItem index="0" value="Item 1"/>
  160.67 -                <StringItem index="1" value="Item 2"/>
  160.68 -                <StringItem index="2" value="Item 3"/>
  160.69 -                <StringItem index="3" value="Item 4"/>
  160.70 -                <StringItem index="4" value="Item 5"/>
  160.71 -              </StringArray>
  160.72 -            </Property>
  160.73 -          </Properties>
  160.74 -          <Events>
  160.75 -            <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="listMouseClicked"/>
  160.76 -            <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="listValueChanged"/>
  160.77 -          </Events>
  160.78 -        </Component>
  160.79 -      </SubComponents>
  160.80 -    </Container>
  160.81 -    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
  160.82 -      <AuxValues>
  160.83 -        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
  160.84 -      </AuxValues>
  160.85 -
  160.86 -      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
  160.87 -      <SubComponents>
  160.88 -        <Component class="javax.swing.JEditorPane" name="pattern">
  160.89 -          <Properties>
  160.90 -            <Property name="contentType" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  160.91 -              <ResourceString bundle="org/netbeans/modules/jackpot30/impl/examples/Bundle.properties" key="ExamplesList.pattern.contentType" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  160.92 -            </Property>
  160.93 -          </Properties>
  160.94 -        </Component>
  160.95 -      </SubComponents>
  160.96 -    </Container>
  160.97 -  </SubComponents>
  160.98 -</Form>
   161.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/ExamplesList.java	Sun Jan 08 20:10:08 2017 +0100
   161.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   161.3 @@ -1,223 +0,0 @@
   161.4 -/*
   161.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   161.6 - *
   161.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   161.8 - *
   161.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  161.10 - * Other names may be trademarks of their respective owners.
  161.11 - *
  161.12 - * The contents of this file are subject to the terms of either the GNU
  161.13 - * General Public License Version 2 only ("GPL") or the Common
  161.14 - * Development and Distribution License("CDDL") (collectively, the
  161.15 - * "License"). You may not use this file except in compliance with the
  161.16 - * License. You can obtain a copy of the License at
  161.17 - * http://www.netbeans.org/cddl-gplv2.html
  161.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  161.19 - * specific language governing permissions and limitations under the
  161.20 - * License.  When distributing the software, include this License Header
  161.21 - * Notice in each file and include the License file at
  161.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  161.23 - * particular file as subject to the "Classpath" exception as provided
  161.24 - * by Oracle in the GPL Version 2 section of the License file that
  161.25 - * accompanied this code. If applicable, add the following below the
  161.26 - * License Header, with the fields enclosed by brackets [] replaced by
  161.27 - * your own identifying information:
  161.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  161.29 - *
  161.30 - * If you wish your version of this file to be governed by only the CDDL
  161.31 - * or only the GPL Version 2, indicate your decision by adding
  161.32 - * "[Contributor] elects to include this software in this distribution
  161.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  161.34 - * single choice of license, a recipient has the option to distribute
  161.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  161.36 - * to extend the choice of license to its licensees as provided above.
  161.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  161.38 - * Version 2 license, then the option applies only if the new code is
  161.39 - * made subject to such option by the copyright holder.
  161.40 - *
  161.41 - * Contributor(s):
  161.42 - *
  161.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  161.44 - */
  161.45 -package org.netbeans.modules.jackpot30.impl.examples;
  161.46 -
  161.47 -import java.awt.Component;
  161.48 -import java.awt.Dialog;
  161.49 -import java.awt.Rectangle;
  161.50 -import java.util.Collections;
  161.51 -import java.util.Set;
  161.52 -import javax.swing.DefaultListCellRenderer;
  161.53 -import javax.swing.DefaultListModel;
  161.54 -import javax.swing.JList;
  161.55 -import javax.swing.text.BadLocationException;
  161.56 -import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
  161.57 -import org.openide.DialogDescriptor;
  161.58 -import org.openide.DialogDisplayer;
  161.59 -import org.openide.util.Exceptions;
  161.60 -
  161.61 -/**
  161.62 - *
  161.63 - * @author lahvac
  161.64 - */
  161.65 -public class ExamplesList<T> extends javax.swing.JPanel {
  161.66 -
  161.67 -    private final DialogDescription<T> convertor;
  161.68 -    private final Class<T> dataClass;
  161.69 -
  161.70 -    public ExamplesList(Iterable<? extends T> data, DialogDescription<T> convertor, Class<T> dataClass, Set<Option> require, Set<Option> forbidden) {
  161.71 -        this.convertor = convertor;
  161.72 -        this.dataClass = dataClass;
  161.73 -        
  161.74 -        initComponents();
  161.75 -
  161.76 -        DefaultListModel listModel = new DefaultListModel();
  161.77 -
  161.78 -        for (T t : data) {
  161.79 -            Set<Option> options = convertor.getOptions(t);
  161.80 -            if (!options.containsAll(require)) continue;
  161.81 -            if (!Collections.disjoint(options, forbidden)) continue;
  161.82 -            
  161.83 -            listModel.addElement(t);
  161.84 -        }
  161.85 -
  161.86 -        list.setModel(listModel);
  161.87 -        list.setCellRenderer(new ExamplesRenderer());
  161.88 -        list.setSelectedIndex(0);
  161.89 -    }
  161.90 -
  161.91 -    /** This method is called from within the constructor to
  161.92 -     * initialize the form.
  161.93 -     * WARNING: Do NOT modify this code. The content of this method is
  161.94 -     * always regenerated by the Form Editor.
  161.95 -     */
  161.96 -    @SuppressWarnings("unchecked")
  161.97 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  161.98 -    private void initComponents() {
  161.99 -
 161.100 -        jLabel1 = new javax.swing.JLabel();
 161.101 -        jScrollPane1 = new javax.swing.JScrollPane();
 161.102 -        list = new javax.swing.JList();
 161.103 -        jScrollPane2 = new javax.swing.JScrollPane();
 161.104 -        pattern = new javax.swing.JEditorPane();
 161.105 -
 161.106 -        jLabel1.setText(convertor.getHeader());
 161.107 -
 161.108 -        list.setModel(new javax.swing.AbstractListModel() {
 161.109 -            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
 161.110 -            public int getSize() { return strings.length; }
 161.111 -            public Object getElementAt(int i) { return strings[i]; }
 161.112 -        });
 161.113 -        list.addMouseListener(new java.awt.event.MouseAdapter() {
 161.114 -            public void mouseClicked(java.awt.event.MouseEvent evt) {
 161.115 -                listMouseClicked(evt);
 161.116 -            }
 161.117 -        });
 161.118 -        list.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
 161.119 -            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
 161.120 -                listValueChanged(evt);
 161.121 -            }
 161.122 -        });
 161.123 -        jScrollPane1.setViewportView(list);
 161.124 -
 161.125 -        pattern.setContentType(org.openide.util.NbBundle.getMessage(ExamplesList.class, "ExamplesList.pattern.contentType")); // NOI18N
 161.126 -        jScrollPane2.setViewportView(pattern);
 161.127 -
 161.128 -        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
 161.129 -        this.setLayout(layout);
 161.130 -        layout.setHorizontalGroup(
 161.131 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 161.132 -            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
 161.133 -                .addContainerGap()
 161.134 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 161.135 -                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
 161.136 -                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
 161.137 -                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING))
 161.138 -                .addContainerGap())
 161.139 -        );
 161.140 -        layout.setVerticalGroup(
 161.141 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 161.142 -            .addGroup(layout.createSequentialGroup()
 161.143 -                .addContainerGap()
 161.144 -                .addComponent(jLabel1)
 161.145 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 161.146 -                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
 161.147 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 161.148 -                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
 161.149 -                .addContainerGap())
 161.150 -        );
 161.151 -    }// </editor-fold>//GEN-END:initComponents
 161.152 -
 161.153 -    private void listMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listMouseClicked
 161.154 -        if (evt.getClickCount() > 1) {
 161.155 -            desc.setValue(DialogDescriptor.OK_OPTION);
 161.156 -            dialog.setVisible(false);
 161.157 -        }
 161.158 -    }//GEN-LAST:event_listMouseClicked
 161.159 -
 161.160 -    private void listValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listValueChanged
 161.161 -        T ex = dataClass.cast(list.getSelectedValue());
 161.162 -
 161.163 -        pattern.setText(convertor.getCode(ex));
 161.164 -        
 161.165 -        try {
 161.166 -            Rectangle rect = pattern.modelToView(0);
 161.167 -
 161.168 -            if (rect != null) {
 161.169 -                pattern.scrollRectToVisible(rect);
 161.170 -            }
 161.171 -        } catch (BadLocationException ex1) {
 161.172 -            Exceptions.printStackTrace(ex1);
 161.173 -        }
 161.174 -    }//GEN-LAST:event_listValueChanged
 161.175 -
 161.176 -    // Variables declaration - do not modify//GEN-BEGIN:variables
 161.177 -    private javax.swing.JLabel jLabel1;
 161.178 -    private javax.swing.JScrollPane jScrollPane1;
 161.179 -    private javax.swing.JScrollPane jScrollPane2;
 161.180 -    private javax.swing.JList list;
 161.181 -    private javax.swing.JEditorPane pattern;
 161.182 -    // End of variables declaration//GEN-END:variables
 161.183 -
 161.184 -    private DialogDescriptor desc;
 161.185 -    private Dialog           dialog;
 161.186 -
 161.187 -    public void setDialog(DialogDescriptor desc, Dialog dialog) {
 161.188 -        this.desc = desc;
 161.189 -        this.dialog = dialog;
 161.190 -    }
 161.191 -
 161.192 -    public T getSelectedExample() {
 161.193 -        return dataClass.cast(list.getSelectedValue());
 161.194 -    }
 161.195 -    
 161.196 -    private class ExamplesRenderer extends DefaultListCellRenderer {
 161.197 -        @Override
 161.198 -        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
 161.199 -            value = convertor.getDisplayName(dataClass.cast(value));
 161.200 -            return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
 161.201 -        }
 161.202 -    }
 161.203 -
 161.204 -    public static <T> T chooseExample(Iterable<? extends T> examplesList, DialogDescription<T> convertor, Class<T> dataClass, Set<Option> require, Set<Option> forbidden) {
 161.205 -        ExamplesList<T> examples = new ExamplesList<T>(examplesList, convertor, dataClass, require, forbidden);
 161.206 -        DialogDescriptor dd = new DialogDescriptor(examples, convertor.getCaption(), true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, null);
 161.207 -        Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
 161.208 -
 161.209 -        examples.setDialog(dd, dialog);
 161.210 -        dialog.setVisible(true);
 161.211 -
 161.212 -        if (dd.getValue() == DialogDescriptor.OK_OPTION) {
 161.213 -            return examples.getSelectedExample();
 161.214 -        }
 161.215 -
 161.216 -        return null;
 161.217 -    }
 161.218 -
 161.219 -    public interface DialogDescription<T> {
 161.220 -        public String getCaption();
 161.221 -        public String getHeader();
 161.222 -        public String getDisplayName(T t);
 161.223 -        public String getCode(T t);
 161.224 -        public Set<Option> getOptions(T t);
 161.225 -    }
 161.226 -}
   162.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/LoadExamples.java	Sun Jan 08 20:10:08 2017 +0100
   162.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   162.3 @@ -1,135 +0,0 @@
   162.4 -/*
   162.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   162.6 - *
   162.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   162.8 - *
   162.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  162.10 - * Other names may be trademarks of their respective owners.
  162.11 - *
  162.12 - * The contents of this file are subject to the terms of either the GNU
  162.13 - * General Public License Version 2 only ("GPL") or the Common
  162.14 - * Development and Distribution License("CDDL") (collectively, the
  162.15 - * "License"). You may not use this file except in compliance with the
  162.16 - * License. You can obtain a copy of the License at
  162.17 - * http://www.netbeans.org/cddl-gplv2.html
  162.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  162.19 - * specific language governing permissions and limitations under the
  162.20 - * License.  When distributing the software, include this License Header
  162.21 - * Notice in each file and include the License file at
  162.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  162.23 - * particular file as subject to the "Classpath" exception as provided
  162.24 - * by Oracle in the GPL Version 2 section of the License file that
  162.25 - * accompanied this code. If applicable, add the following below the
  162.26 - * License Header, with the fields enclosed by brackets [] replaced by
  162.27 - * your own identifying information:
  162.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  162.29 - *
  162.30 - * If you wish your version of this file to be governed by only the CDDL
  162.31 - * or only the GPL Version 2, indicate your decision by adding
  162.32 - * "[Contributor] elects to include this software in this distribution
  162.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  162.34 - * single choice of license, a recipient has the option to distribute
  162.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  162.36 - * to extend the choice of license to its licensees as provided above.
  162.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  162.38 - * Version 2 license, then the option applies only if the new code is
  162.39 - * made subject to such option by the copyright holder.
  162.40 - *
  162.41 - * Contributor(s):
  162.42 - *
  162.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  162.44 - */
  162.45 -
  162.46 -package org.netbeans.modules.jackpot30.impl.examples;
  162.47 -
  162.48 -import java.io.File;
  162.49 -import java.io.IOException;
  162.50 -import java.io.InputStream;
  162.51 -import java.util.Collections;
  162.52 -import java.util.EnumSet;
  162.53 -import java.util.LinkedList;
  162.54 -import java.util.List;
  162.55 -import java.util.Set;
  162.56 -import java.util.regex.Pattern;
  162.57 -import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
  162.58 -import org.openide.filesystems.FileUtil;
  162.59 -import org.openide.modules.InstalledFileLocator;
  162.60 -import org.openide.util.Exceptions;
  162.61 -
  162.62 -/**
  162.63 - *
  162.64 - * @author lahvac
  162.65 - */
  162.66 -public class LoadExamples {
  162.67 -
  162.68 -    public static Iterable<? extends Example> loadExamples() {
  162.69 -        return loadExamples("examples.list");
  162.70 -    }
  162.71 -
  162.72 -    private static final Pattern EXAMPLE_SPLIT = Pattern.compile("^%%", Pattern.MULTILINE);
  162.73 -    
  162.74 -    static Iterable<? extends Example> loadExamples(String examplesListName) {
  162.75 -        String examplesList = loadToString(examplesListName);
  162.76 -
  162.77 -        if (examplesList == null) return Collections.emptyList();
  162.78 -
  162.79 -        List<Example> examples = new LinkedList<Example>();
  162.80 -
  162.81 -        for (String exampleName : examplesList.split("\n")) {
  162.82 -            if (exampleName.isEmpty()) continue;
  162.83 -
  162.84 -            String exampleCode = loadToString(exampleName);
  162.85 -
  162.86 -            for (String oneExample : EXAMPLE_SPLIT.split(exampleCode)) {
  162.87 -                if (oneExample.isEmpty()) continue;
  162.88 -                
  162.89 -                String[] parts = oneExample.split("\n", 2);
  162.90 -                String key = null;
  162.91 -                Set<Option> options = EnumSet.noneOf(Option.class);
  162.92 -                
  162.93 -                for (String option : parts[0].split(",")) {
  162.94 -                    if (option.startsWith("example=")) {
  162.95 -                        key = option.substring("example=".length());
  162.96 -                        continue;
  162.97 -                    }
  162.98 -
  162.99 -                    options.add(Option.valueOf(option.toUpperCase()));
 162.100 -                }
 162.101 -
 162.102 -                examples.add(new Example(key, parts[1], options));
 162.103 -            }
 162.104 -        }
 162.105 -
 162.106 -        return examples;
 162.107 -    }
 162.108 -
 162.109 -    private static String loadToString(String name) {
 162.110 -        InputStream examplesList = null;
 162.111 -
 162.112 -        try {
 162.113 -            examplesList = LoadExamples.class.getResourceAsStream(name);
 162.114 -
 162.115 -            if (examplesList == null) return null;
 162.116 -
 162.117 -            StringBuilder result = new StringBuilder();
 162.118 -            int read;
 162.119 -
 162.120 -            while ((read = examplesList.read()) != (-1)) {
 162.121 -                result.append((char) read);
 162.122 -            }
 162.123 -
 162.124 -            return result.toString();
 162.125 -        } catch (IOException ex) {
 162.126 -            Exceptions.printStackTrace(ex);
 162.127 -            return null;
 162.128 -        } finally {
 162.129 -            if (examplesList != null) {
 162.130 -                try {
 162.131 -                    examplesList.close();
 162.132 -                } catch (IOException ex) {
 162.133 -                    Exceptions.printStackTrace(ex);
 162.134 -                }
 162.135 -            }
 162.136 -        }
 162.137 -    }
 162.138 -}
   163.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/double-checked-locking.example	Sun Jan 08 20:10:08 2017 +0100
   163.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   163.3 @@ -1,33 +0,0 @@
   163.4 -%%example=double-checked-locking
   163.5 -if ($var == null) {
   163.6 -   $preinit$;
   163.7 -   synchronized ($lock) {
   163.8 -       if ($var == null) {
   163.9 -           $s2$;
  163.10 -       }
  163.11 -   }
  163.12 -}
  163.13 -%%example=double-checked-locking-verify,verify
  163.14 -if ($var == null) {
  163.15 -   $preinit$;
  163.16 -   synchronized ($lock) {
  163.17 -       if ($var == null) {
  163.18 -           $s2$;
  163.19 -       }
  163.20 -   }
  163.21 -} :: !hasModifier($var, Modifier.VOLATILE);;
  163.22 -%%example=double-checked-locking-fix,verify,fix
  163.23 -if ($var == null) {
  163.24 -   $preinit$;
  163.25 -   synchronized ($lock) {
  163.26 -       if ($var == null) {
  163.27 -           $s2$;
  163.28 -       }
  163.29 -   }
  163.30 -} :: !hasModifier($var, Modifier.VOLATILE)
  163.31 -=>
  163.32 -synchronized ($lock) {
  163.33 -   if ($var == null) {
  163.34 -       $s2$;
  163.35 -   }
  163.36 -};;
   164.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/examples.list	Sun Jan 08 20:10:08 2017 +0100
   164.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   164.3 @@ -1,3 +0,0 @@
   164.4 -double-checked-locking.example
   164.5 -new-string.example
   164.6 -lambda-candidate.example
   165.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/lambda-candidate.example	Sun Jan 08 20:10:08 2017 +0100
   165.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   165.3 @@ -1,6 +0,0 @@
   165.4 -%%example=lambda-candidate
   165.5 -new $type() {
   165.6 -    $mods$ $resultType $methodName($args$) {
   165.7 -        $statements$;
   165.8 -    }
   165.9 -}
   166.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/new-string.example	Sun Jan 08 20:10:08 2017 +0100
   166.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   166.3 @@ -1,5 +0,0 @@
   166.4 -%%example=new-string,verify
   166.5 -new String($orig) :: $orig instanceof String && !matchesAny($orig, "$o.substring($s)", "$o.substring($s, $e)");;
   166.6 -%%example=new-string,verify,fix
   166.7 -new String($orig) :: $orig instanceof String && !matchesAny($orig, "$o.substring($s)", "$o.substring($s, $e)")
   166.8 -=> $orig;;
   167.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/hints/ExplicitFindDuplicates.java	Sun Jan 08 20:10:08 2017 +0100
   167.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   167.3 @@ -1,379 +0,0 @@
   167.4 -/*
   167.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   167.6 - *
   167.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   167.8 - *
   167.9 - * The contents of this file are subject to the terms of either the GNU
  167.10 - * General Public License Version 2 only ("GPL") or the Common
  167.11 - * Development and Distribution License("CDDL") (collectively, the
  167.12 - * "License"). You may not use this file except in compliance with the
  167.13 - * License. You can obtain a copy of the License at
  167.14 - * http://www.netbeans.org/cddl-gplv2.html
  167.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  167.16 - * specific language governing permissions and limitations under the
  167.17 - * License.  When distributing the software, include this License Header
  167.18 - * Notice in each file and include the License file at
  167.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  167.20 - * particular file as subject to the "Classpath" exception as provided
  167.21 - * by Sun in the GPL Version 2 section of the License file that
  167.22 - * accompanied this code. If applicable, add the following below the
  167.23 - * License Header, with the fields enclosed by brackets [] replaced by
  167.24 - * your own identifying information:
  167.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  167.26 - *
  167.27 - * If you wish your version of this file to be governed by only the CDDL
  167.28 - * or only the GPL Version 2, indicate your decision by adding
  167.29 - * "[Contributor] elects to include this software in this distribution
  167.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  167.31 - * single choice of license, a recipient has the option to distribute
  167.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  167.33 - * to extend the choice of license to its licensees as provided above.
  167.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  167.35 - * Version 2 license, then the option applies only if the new code is
  167.36 - * made subject to such option by the copyright holder.
  167.37 - *
  167.38 - * Contributor(s):
  167.39 - *
  167.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
  167.41 - */
  167.42 -
  167.43 -package org.netbeans.modules.jackpot30.impl.hints;
  167.44 -
  167.45 -import com.sun.source.tree.BlockTree;
  167.46 -import com.sun.source.tree.ExpressionTree;
  167.47 -import com.sun.source.tree.NewClassTree;
  167.48 -import com.sun.source.tree.StatementTree;
  167.49 -import com.sun.source.tree.Tree;
  167.50 -import com.sun.source.tree.Tree.Kind;
  167.51 -import com.sun.source.tree.VariableTree;
  167.52 -import com.sun.source.util.TreePath;
  167.53 -import java.util.Collection;
  167.54 -import java.util.Collections;
  167.55 -import java.util.EnumSet;
  167.56 -import java.util.Set;
  167.57 -import javax.lang.model.type.ErrorType;
  167.58 -import javax.lang.model.type.TypeKind;
  167.59 -import javax.lang.model.type.TypeMirror;
  167.60 -import javax.swing.SwingUtilities;
  167.61 -import org.netbeans.api.java.lexer.JavaTokenId;
  167.62 -import org.netbeans.api.java.source.CancellableTask;
  167.63 -import org.netbeans.api.java.source.CompilationController;
  167.64 -import org.netbeans.api.java.source.CompilationInfo;
  167.65 -import org.netbeans.api.java.source.JavaSource;
  167.66 -import org.netbeans.api.java.source.JavaSource.Phase;
  167.67 -import org.netbeans.api.java.source.JavaSource.Priority;
  167.68 -import org.netbeans.api.java.source.JavaSourceTaskFactory;
  167.69 -import org.netbeans.api.java.source.Task;
  167.70 -import org.netbeans.api.java.source.TreePathHandle;
  167.71 -import org.netbeans.api.java.source.support.CaretAwareJavaSourceTaskFactory;
  167.72 -import org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory;
  167.73 -import org.netbeans.api.lexer.TokenSequence;
  167.74 -import org.netbeans.modules.jackpot30.impl.refactoring.FindDuplicatesRefactoringUI;
  167.75 -import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
  167.76 -import org.netbeans.modules.java.hints.jackpot.impl.batch.Scopes;
  167.77 -import org.netbeans.modules.refactoring.spi.ui.UI;
  167.78 -import org.netbeans.spi.editor.hints.ChangeInfo;
  167.79 -import org.netbeans.spi.editor.hints.ErrorDescription;
  167.80 -import org.netbeans.spi.editor.hints.ErrorDescriptionFactory;
  167.81 -import org.netbeans.spi.editor.hints.Fix;
  167.82 -import org.netbeans.spi.editor.hints.HintsController;
  167.83 -import org.netbeans.spi.editor.hints.Severity;
  167.84 -import org.openide.filesystems.FileObject;
  167.85 -import org.openide.util.lookup.ServiceProvider;
  167.86 -
  167.87 -/**
  167.88 - *
  167.89 - * @author lahvac
  167.90 - */
  167.91 -public class ExplicitFindDuplicates implements CancellableTask<CompilationInfo> {
  167.92 -
  167.93 -    public void run(CompilationInfo info) throws Exception {
  167.94 -        Collection<? extends ErrorDescription> eds = computeErrorDescription(info);
  167.95 -
  167.96 -        if (eds == null) {
  167.97 -            eds = Collections.emptyList();
  167.98 -        }
  167.99 -
 167.100 -        HintsController.setErrors(info.getFileObject(), ExplicitFindDuplicates.class.getName(), eds);
 167.101 -    }
 167.102 -
 167.103 -    private Collection<? extends ErrorDescription> computeErrorDescription(CompilationInfo info) throws Exception {
 167.104 -        int[] span = SelectionAwareJavaSourceTaskFactory.getLastSelection(info.getFileObject());
 167.105 -
 167.106 -        if (span == null) {
 167.107 -            return null;
 167.108 -        }
 167.109 -
 167.110 -        TreePath selection = selectionForExpressionHack(info, span[0], span[1]);
 167.111 -
 167.112 -        if (selection == null) {
 167.113 -            if (selectionForStatementsHack(info, span[0], span[1], new int[2]) == null) {
 167.114 -                return null;
 167.115 -            }
 167.116 -        }
 167.117 -
 167.118 -        Fix f = new FixImpl(info.getFileObject(), span[0], span[1]);
 167.119 -        int caret = CaretAwareJavaSourceTaskFactory.getLastPosition(info.getFileObject());
 167.120 -        ErrorDescription ed = ErrorDescriptionFactory.createErrorDescription(Severity.HINT, "Look for Duplicates", Collections.singletonList(f), info.getFileObject(), caret, caret);
 167.121 -
 167.122 -        return Collections.singletonList(ed);
 167.123 -    }
 167.124 -
 167.125 -    public void cancel() {
 167.126 -        //XXX
 167.127 -    }
 167.128 -
 167.129 -    static Tree resolveAndGeneralizePattern(CompilationInfo info, int start, int end) {
 167.130 -        TreePath selection = selectionForExpressionHack(info, start, end);
 167.131 -
 167.132 -        if (selection == null) {
 167.133 -            int[] statementSpan = new int[2];
 167.134 -            TreePathHandle statementSelection = selectionForStatementsHack(info, start, end, statementSpan);
 167.135 -
 167.136 -            if (statementSelection == null) {
 167.137 -                return null;
 167.138 -            }
 167.139 -
 167.140 -            selection = statementSelection.resolve(info);
 167.141 -
 167.142 -            if (selection == null) {
 167.143 -                return null; //XXX
 167.144 -            }
 167.145 -
 167.146 -            return Utilities.generalizePattern(info, selection, statementSpan[0], statementSpan[1]);
 167.147 -        } else {
 167.148 -            return Utilities.generalizePattern(info, selection);
 167.149 -        }
 167.150 -    }
 167.151 -
 167.152 -    private static final class FixImpl implements Fix {
 167.153 -
 167.154 -        private final FileObject file;
 167.155 -        private final int start;
 167.156 -        private final int end;
 167.157 -
 167.158 -        public FixImpl(FileObject file, int start, int end) {
 167.159 -            this.file = file;
 167.160 -            this.start = start;
 167.161 -            this.end = end;
 167.162 -        }
 167.163 -
 167.164 -        public String getText() {
 167.165 -            return "Look for Duplicates in Opened Projects";
 167.166 -        }
 167.167 -
 167.168 -        public ChangeInfo implement() throws Exception {
 167.169 -            JavaSource.forFileObject(file).runUserActionTask(new Task<CompilationController>() {
 167.170 -                public void run(CompilationController cc) throws Exception {
 167.171 -                    cc.toPhase(Phase.RESOLVED);
 167.172 -
 167.173 -                    Tree generalized = resolveAndGeneralizePattern(cc, start, end);
 167.174 -
 167.175 -                    if (generalized == null) {
 167.176 -                        return ;
 167.177 -                    }
 167.178 -
 167.179 -                    final String pattern = generalized.toString(); //XXX
 167.180 -
 167.181 -                    SwingUtilities.invokeLater(new Runnable() {
 167.182 -                        public void run() {
 167.183 -                            UI.openRefactoringUI(new FindDuplicatesRefactoringUI(pattern, Scopes.allOpenedProjectsScope()));
 167.184 -                        }
 167.185 -                    });
 167.186 -                }
 167.187 -            }, true);
 167.188 -            
 167.189 -            return null;
 167.190 -        }
 167.191 -
 167.192 -    }
 167.193 -
 167.194 -    private static final Set<TypeKind> NOT_ACCEPTED_TYPES = EnumSet.of(TypeKind.NONE, TypeKind.OTHER);
 167.195 -    
 167.196 -    static TreePath selectionForExpressionHack(CompilationInfo info, int start, int end) {
 167.197 -        return validateSelection(info, start, end, NOT_ACCEPTED_TYPES);
 167.198 -    }
 167.199 -
 167.200 -    static TreePathHandle selectionForStatementsHack(CompilationInfo info, int start, int end, int[] outSpan)  {
 167.201 -        return validateSelectionForIntroduceMethod(info, start, end, outSpan);
 167.202 -    }
 167.203 -
 167.204 -    private static final Set<JavaTokenId> WHITESPACES = EnumSet.of(JavaTokenId.WHITESPACE, JavaTokenId.BLOCK_COMMENT, JavaTokenId.LINE_COMMENT, JavaTokenId.JAVADOC_COMMENT);
 167.205 -    static int[] ignoreWhitespaces(CompilationInfo ci, int start, int end) {
 167.206 -        TokenSequence<JavaTokenId> ts = ci.getTokenHierarchy().tokenSequence(JavaTokenId.language());
 167.207 -
 167.208 -        if (ts == null) {
 167.209 -            return new int[] {start, end};
 167.210 -        }
 167.211 -
 167.212 -        ts.move(start);
 167.213 -
 167.214 -        if (ts.moveNext()) {
 167.215 -            boolean wasMoveNext = true;
 167.216 -
 167.217 -            while (WHITESPACES.contains(ts.token().id()) && (wasMoveNext = ts.moveNext()))
 167.218 -                ;
 167.219 -
 167.220 -            if (wasMoveNext && ts.offset() > start)
 167.221 -                start = ts.offset();
 167.222 -        }
 167.223 -
 167.224 -        ts.move(end);
 167.225 -
 167.226 -        while (ts.movePrevious() && WHITESPACES.contains(ts.token().id()) && ts.offset() < end)
 167.227 -            end = ts.offset();
 167.228 -
 167.229 -        return new int[] {start, end};
 167.230 -    }
 167.231 -    
 167.232 -    private static boolean isInsideClass(TreePath tp) {
 167.233 -        while (tp != null) {
 167.234 -            if (tp.getLeaf().getKind() == Kind.CLASS)
 167.235 -                return true;
 167.236 -
 167.237 -            tp = tp.getParentPath();
 167.238 -        }
 167.239 -
 167.240 -        return false;
 167.241 -    }
 167.242 -    
 167.243 -    private static TreePath validateSelection(CompilationInfo ci, int start, int end, Set<TypeKind> ignoredTypes) {
 167.244 -        TreePath tp = ci.getTreeUtilities().pathFor((start + end) / 2 + 1);
 167.245 -
 167.246 -        for ( ; tp != null; tp = tp.getParentPath()) {
 167.247 -            Tree leaf = tp.getLeaf();
 167.248 -
 167.249 -            if (!ExpressionTree.class.isAssignableFrom(leaf.getKind().asInterface()))
 167.250 -               continue;
 167.251 -
 167.252 -            long treeStart = ci.getTrees().getSourcePositions().getStartPosition(ci.getCompilationUnit(), leaf);
 167.253 -            long treeEnd   = ci.getTrees().getSourcePositions().getEndPosition(ci.getCompilationUnit(), leaf);
 167.254 -
 167.255 -            if (treeStart != start || treeEnd != end) {
 167.256 -                continue;
 167.257 -            }
 167.258 -
 167.259 -            TypeMirror type = ci.getTrees().getTypeMirror(tp);
 167.260 -
 167.261 -            if (type != null && type.getKind() == TypeKind.ERROR) {
 167.262 -                type = ci.getTrees().getOriginalType((ErrorType) type);
 167.263 -            }
 167.264 -
 167.265 -            if (type == null || ignoredTypes.contains(type.getKind()))
 167.266 -                continue;
 167.267 -
 167.268 -            if(tp.getLeaf().getKind() == Kind.ASSIGNMENT)
 167.269 -                continue;
 167.270 -
 167.271 -            if (tp.getLeaf().getKind() == Kind.ANNOTATION)
 167.272 -                continue;
 167.273 -
 167.274 -            if (!isInsideClass(tp))
 167.275 -                return null;
 167.276 -
 167.277 -            TreePath candidate = tp;
 167.278 -
 167.279 -            tp = tp.getParentPath();
 167.280 -
 167.281 -            while (tp != null) {
 167.282 -                switch (tp.getLeaf().getKind()) {
 167.283 -                    case VARIABLE:
 167.284 -                        VariableTree vt = (VariableTree) tp.getLeaf();
 167.285 -                        if (vt.getInitializer() == leaf) {
 167.286 -                            return candidate;
 167.287 -                        } else {
 167.288 -                            return null;
 167.289 -                        }
 167.290 -                    case NEW_CLASS:
 167.291 -                        NewClassTree nct = (NewClassTree) tp.getLeaf();
 167.292 -
 167.293 -                        if (nct.getIdentifier().equals(candidate.getLeaf())) { //avoid disabling hint ie inside of anonymous class higher in treepath
 167.294 -                            for (Tree p : nct.getArguments()) {
 167.295 -                                if (p == leaf) {
 167.296 -                                    return candidate;
 167.297 -                                }
 167.298 -                            }
 167.299 -
 167.300 -                            return null;
 167.301 -                        }
 167.302 -                }
 167.303 -
 167.304 -                leaf = tp.getLeaf();
 167.305 -                tp = tp.getParentPath();
 167.306 -            }
 167.307 -
 167.308 -            return candidate;
 167.309 -        }
 167.310 -
 167.311 -        return null;
 167.312 -    }
 167.313 -
 167.314 -    private static TreePathHandle validateSelectionForIntroduceMethod(CompilationInfo ci, int start, int end, int[] statementsSpan) {
 167.315 -        int[] span = ignoreWhitespaces(ci, Math.min(start, end), Math.max(start, end));
 167.316 -
 167.317 -        start = span[0];
 167.318 -        end   = span[1];
 167.319 -
 167.320 -        if (start >= end)
 167.321 -            return null;
 167.322 -
 167.323 -        TreePath tpStart = ci.getTreeUtilities().pathFor(start);
 167.324 -        TreePath tpEnd = ci.getTreeUtilities().pathFor(end);
 167.325 -
 167.326 -        if (tpStart.getLeaf() != tpEnd.getLeaf() || tpStart.getLeaf().getKind() != Kind.BLOCK) {
 167.327 -            //??? not in the same block:
 167.328 -            return null;
 167.329 -        }
 167.330 -
 167.331 -        int from = -1;
 167.332 -        int to   = -1;
 167.333 -
 167.334 -        BlockTree block = (BlockTree) tpStart.getLeaf();
 167.335 -        int index = 0;
 167.336 -
 167.337 -        for (StatementTree s : block.getStatements()) {
 167.338 -            long sStart = ci.getTrees().getSourcePositions().getStartPosition(ci.getCompilationUnit(), s);
 167.339 -
 167.340 -            if (sStart == start) {
 167.341 -                from = index;
 167.342 -            }
 167.343 -
 167.344 -            if (end < sStart && to == (-1)) {
 167.345 -                to = index - 1;
 167.346 -            }
 167.347 -
 167.348 -            index++;
 167.349 -        }
 167.350 -
 167.351 -        if (from == (-1)) {
 167.352 -            return null;
 167.353 -        }
 167.354 -
 167.355 -        if (to == (-1))
 167.356 -            to = block.getStatements().size() - 1;
 167.357 -
 167.358 -        if (to < from) {
 167.359 -            return null;
 167.360 -        }
 167.361 -
 167.362 -        statementsSpan[0] = from;
 167.363 -        statementsSpan[1] = to;
 167.364 -
 167.365 -        return TreePathHandle.create(tpStart, ci);
 167.366 -    }
 167.367 -
 167.368 -    @ServiceProvider(service=JavaSourceTaskFactory.class)
 167.369 -    public static final class FactoryImpl extends SelectionAwareJavaSourceTaskFactory {
 167.370 -
 167.371 -        public FactoryImpl() {
 167.372 -            super(Phase.RESOLVED, Priority.LOW);
 167.373 -        }
 167.374 -
 167.375 -        @Override
 167.376 -        protected CancellableTask<CompilationInfo> createTask(FileObject file) {
 167.377 -            return new ExplicitFindDuplicates();
 167.378 -        }
 167.379 -        
 167.380 -    }
 167.381 -
 167.382 -}
   168.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   168.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   168.3 @@ -1,40 +0,0 @@
   168.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   168.5 -#
   168.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   168.7 -#
   168.8 -# The contents of this file are subject to the terms of either the GNU
   168.9 -# General Public License Version 2 only ("GPL") or the Common
  168.10 -# Development and Distribution License("CDDL") (collectively, the
  168.11 -# "License"). You may not use this file except in compliance with the
  168.12 -# License. You can obtain a copy of the License at
  168.13 -# http://www.netbeans.org/cddl-gplv2.html
  168.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  168.15 -# specific language governing permissions and limitations under the
  168.16 -# License.  When distributing the software, include this License Header
  168.17 -# Notice in each file and include the License file at
  168.18 -# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  168.19 -# particular file as subject to the "Classpath" exception as provided
  168.20 -# by Sun in the GPL Version 2 section of the License file that
  168.21 -# accompanied this code. If applicable, add the following below the
  168.22 -# License Header, with the fields enclosed by brackets [] replaced by
  168.23 -# your own identifying information:
  168.24 -# "Portions Copyrighted [year] [name of copyright owner]"
  168.25 -#
  168.26 -# If you wish your version of this file to be governed by only the CDDL
  168.27 -# or only the GPL Version 2, indicate your decision by adding
  168.28 -# "[Contributor] elects to include this software in this distribution
  168.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  168.30 -# single choice of license, a recipient has the option to distribute
  168.31 -# your version of this file under either the CDDL, the GPL Version 2 or
  168.32 -# to extend the choice of license to its licensees as provided above.
  168.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  168.34 -# Version 2 license, then the option applies only if the new code is
  168.35 -# made subject to such option by the copyright holder.
  168.36 -#
  168.37 -# Contributor(s):
  168.38 -#
  168.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
  168.40 -
  168.41 -Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.instance=Apply Pattern
  168.42 -Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.instance=Find Pattern Occurrences
  168.43 -OpenIDE-Module-Name=Jackpot 3.0 API
   169.1 Binary file sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/examples_icon.png has changed
   170.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/layer.xml	Sun Jan 08 20:10:08 2017 +0100
   170.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   170.3 @@ -1,111 +0,0 @@
   170.4 -<?xml version="1.0" encoding="UTF-8"?>
   170.5 -<!--
   170.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   170.7 -
   170.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   170.9 -
  170.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  170.11 -Other names may be trademarks of their respective owners.
  170.12 -
  170.13 -The contents of this file are subject to the terms of either the GNU
  170.14 -General Public License Version 2 only ("GPL") or the Common
  170.15 -Development and Distribution License("CDDL") (collectively, the
  170.16 -"License"). You may not use this file except in compliance with the
  170.17 -License. You can obtain a copy of the License at
  170.18 -http://www.netbeans.org/cddl-gplv2.html
  170.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  170.20 -specific language governing permissions and limitations under the
  170.21 -License.  When distributing the software, include this License Header
  170.22 -Notice in each file and include the License file at
  170.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  170.24 -particular file as subject to the "Classpath" exception as provided
  170.25 -by Oracle in the GPL Version 2 section of the License file that
  170.26 -accompanied this code. If applicable, add the following below the
  170.27 -License Header, with the fields enclosed by brackets [] replaced by
  170.28 -your own identifying information:
  170.29 -"Portions Copyrighted [year] [name of copyright owner]"
  170.30 -
  170.31 -Contributor(s):
  170.32 -
  170.33 -The Original Software is NetBeans. The Initial Developer of the Original
  170.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  170.35 -Microsystems, Inc. All Rights Reserved.
  170.36 -
  170.37 -If you wish your version of this file to be governed by only the CDDL
  170.38 -or only the GPL Version 2, indicate your decision by adding
  170.39 -"[Contributor] elects to include this software in this distribution
  170.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  170.41 -single choice of license, a recipient has the option to distribute
  170.42 -your version of this file under either the CDDL, the GPL Version 2 or
  170.43 -to extend the choice of license to its licensees as provided above.
  170.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  170.45 -Version 2 license, then the option applies only if the new code is
  170.46 -made subject to such option by the copyright holder.
  170.47 --->
  170.48 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
  170.49 -<filesystem>
  170.50 -    <folder name="Actions">
  170.51 -        <folder name="Refactoring">
  170.52 -            <file name="org-netbeans-modules-jackpot30-impl-duplicates-GlobalFindDuplicates.instance">
  170.53 -                <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.duplicates.GlobalFindDuplicates"/>
  170.54 -                <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.duplicates.Bundle#CTL_GlobalFindDuplicates"/>
  170.55 -                <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
  170.56 -                <attr name="noIconInMenu" boolvalue="false"/>
  170.57 -            </file>
  170.58 -            <file name="org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.instance">
  170.59 -                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.jackpot30.impl.resources.Bundle"/>
  170.60 -                <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.refactoring.ApplyPatternAction"/>
  170.61 -                <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.refactoring.Bundle#CTL_ApplyPatternAction"/>
  170.62 -                <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
  170.63 -                <attr name="noIconInMenu" boolvalue="false"/>
  170.64 -            </file>
  170.65 -            <file name="org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.instance">
  170.66 -                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.jackpot30.impl.resources.Bundle"/>
  170.67 -                <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.refactoring.FindOccurrencesAction"/>
  170.68 -                <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.refactoring.Bundle#CTL_FindOccurrencesAction"/>
  170.69 -                <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
  170.70 -                <attr name="noIconInMenu" boolvalue="false"/>
  170.71 -            </file>
  170.72 -            <file name="org-netbeans-modules-jackpot30-impl-refactoring-upgrade-UpgradeAction.instance">
  170.73 -                <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.refactoring.upgrade.UpgradeAction"/>
  170.74 -                <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.refactoring.upgrade.Bundle#CTL_UpgradeAction"/>
  170.75 -                <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
  170.76 -                <attr name="noIconInMenu" boolvalue="false"/>
  170.77 -            </file>
  170.78 -        </folder>
  170.79 -    </folder>
  170.80 -
  170.81 -    <!--XXX:-->
  170.82 -    <folder name="Menu">
  170.83 -        <folder name="Edit">
  170.84 -            <file name="org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.shadow">
  170.85 -                <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.instance"/>
  170.86 -                <attr name="position" intvalue="2250"/>
  170.87 -            </file>
  170.88 -        </folder>
  170.89 -        <folder name="Refactoring">
  170.90 -            <file name="org-netbeans-modules-jackpot30-impl-duplicates-GlobalFindDuplicates.shadow">
  170.91 -                <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-duplicates-GlobalFindDuplicates.instance"/>
  170.92 -                <attr name="position" intvalue="2300"/>
  170.93 -            </file>
  170.94 -            <file name="org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.shadow">
  170.95 -                <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.instance"/>
  170.96 -                <attr name="position" intvalue="2200"/>
  170.97 -            </file>
  170.98 -            <file name="org-netbeans-modules-jackpot30-impl-refactoring-upgrade-UpgradeAction.shadow">
  170.99 -                <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-upgrade-UpgradeAction.instance"/>
 170.100 -                <attr name="position" intvalue="2187"/>
 170.101 -            </file>
 170.102 -        </folder>
 170.103 -    </folder>
 170.104 -
 170.105 -    <folder name="Editors">
 170.106 -        <folder name="text">
 170.107 -            <folder name="x-java">
 170.108 -                <file name="org-netbeans-modules-jackpot30-impl-hints-HintsInvoker$FactoryImpl.instance"/>
 170.109 -                <file name="org-netbeans-modules-jackpot30-impl-indexing-CustomIndexerImpl$CustomIndexerFactoryImpl.instance"/>
 170.110 -                <file name="org-netbeans-modules-jackpot30-impl-duplicates-indexing-DuplicatesCustomIndexerImpl$FactoryImpl.instance"/>
 170.111 -            </folder>
 170.112 -        </folder>
 170.113 -    </folder>
 170.114 -</filesystem>
   171.1 Binary file sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/recent_icon.png has changed
   172.1 --- a/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/spi/Hacks.java	Sun Jan 08 20:10:08 2017 +0100
   172.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   172.3 @@ -1,89 +0,0 @@
   172.4 -/*
   172.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   172.6 - *
   172.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   172.8 - *
   172.9 - * The contents of this file are subject to the terms of either the GNU
  172.10 - * General Public License Version 2 only ("GPL") or the Common
  172.11 - * Development and Distribution License("CDDL") (collectively, the
  172.12 - * "License"). You may not use this file except in compliance with the
  172.13 - * License. You can obtain a copy of the License at
  172.14 - * http://www.netbeans.org/cddl-gplv2.html
  172.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  172.16 - * specific language governing permissions and limitations under the
  172.17 - * License.  When distributing the software, include this License Header
  172.18 - * Notice in each file and include the License file at
  172.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  172.20 - * particular file as subject to the "Classpath" exception as provided
  172.21 - * by Sun in the GPL Version 2 section of the License file that
  172.22 - * accompanied this code. If applicable, add the following below the
  172.23 - * License Header, with the fields enclosed by brackets [] replaced by
  172.24 - * your own identifying information:
  172.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  172.26 - *
  172.27 - * If you wish your version of this file to be governed by only the CDDL
  172.28 - * or only the GPL Version 2, indicate your decision by adding
  172.29 - * "[Contributor] elects to include this software in this distribution
  172.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  172.31 - * single choice of license, a recipient has the option to distribute
  172.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  172.33 - * to extend the choice of license to its licensees as provided above.
  172.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  172.35 - * Version 2 license, then the option applies only if the new code is
  172.36 - * made subject to such option by the copyright holder.
  172.37 - *
  172.38 - * Contributor(s):
  172.39 - *
  172.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
  172.41 - */
  172.42 -
  172.43 -package org.netbeans.modules.jackpot30.spi;
  172.44 -
  172.45 -import com.sun.source.util.TreePath;
  172.46 -import java.util.ArrayList;
  172.47 -import java.util.Collections;
  172.48 -import java.util.LinkedList;
  172.49 -import java.util.List;
  172.50 -import java.util.Set;
  172.51 -import java.util.concurrent.atomic.AtomicBoolean;
  172.52 -import java.util.prefs.Preferences;
  172.53 -import org.netbeans.api.java.source.WorkingCopy;
  172.54 -import org.netbeans.api.project.Project;
  172.55 -import org.netbeans.modules.java.hints.jackpot.impl.MessageImpl;
  172.56 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchUtilities;
  172.57 -import org.netbeans.modules.java.hints.jackpot.impl.hints.HintsInvoker;
  172.58 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
  172.59 -import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata;
  172.60 -import org.netbeans.spi.editor.hints.ErrorDescription;
  172.61 -import org.openide.util.Exceptions;
  172.62 -
  172.63 -/**
  172.64 - *
  172.65 - * @author lahvac
  172.66 - */
  172.67 -public class Hacks {
  172.68 -
  172.69 -    public static interface HintPreferencesProvider {
  172.70 -        public Preferences findPreferences(HintMetadata hm);
  172.71 -    }
  172.72 -
  172.73 -    public static void findHintsAndApplyFixes(WorkingCopy copy, Iterable<? extends HintDescription> hints, TreePath on, AtomicBoolean cancel) {
  172.74 -        HintsInvoker inv = new HintsInvoker(copy, cancel);
  172.75 -        List<ErrorDescription> errs = new ArrayList<ErrorDescription>(inv.computeHints(copy, hints));
  172.76 -        List<MessageImpl> problems = new LinkedList<MessageImpl>();
  172.77 -
  172.78 -        try {
  172.79 -            if (BatchUtilities.applyFixes(copy, Collections.<Project, Set<String>>emptyMap(), errs, problems)) {
  172.80 -                throw new IllegalStateException();
  172.81 -            }
  172.82 -        } catch (IllegalStateException ex) {
  172.83 -            Exceptions.printStackTrace(ex);
  172.84 -        } catch (Exception ex) {
  172.85 -            Exceptions.printStackTrace(ex);
  172.86 -        }
  172.87 -
  172.88 -        if (!problems.isEmpty()) {
  172.89 -            throw new IllegalStateException(problems.get(0).text);
  172.90 -        }
  172.91 -    }
  172.92 -}
   173.1 --- a/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/TestBase.java	Sun Jan 08 20:10:08 2017 +0100
   173.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   173.3 @@ -1,120 +0,0 @@
   173.4 -/*
   173.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   173.6 - *
   173.7 - * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
   173.8 - *
   173.9 - * The contents of this file are subject to the terms of either the GNU
  173.10 - * General Public License Version 2 only ("GPL") or the Common
  173.11 - * Development and Distribution License("CDDL") (collectively, the
  173.12 - * "License"). You may not use this file except in compliance with the
  173.13 - * License. You can obtain a copy of the License at
  173.14 - * http://www.netbeans.org/cddl-gplv2.html
  173.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  173.16 - * specific language governing permissions and limitations under the
  173.17 - * License.  When distributing the software, include this License Header
  173.18 - * Notice in each file and include the License file at
  173.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  173.20 - * particular file as subject to the "Classpath" exception as provided
  173.21 - * by Sun in the GPL Version 2 section of the License file that
  173.22 - * accompanied this code. If applicable, add the following below the
  173.23 - * License Header, with the fields enclosed by brackets [] replaced by
  173.24 - * your own identifying information:
  173.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  173.26 - *
  173.27 - * If you wish your version of this file to be governed by only the CDDL
  173.28 - * or only the GPL Version 2, indicate your decision by adding
  173.29 - * "[Contributor] elects to include this software in this distribution
  173.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  173.31 - * single choice of license, a recipient has the option to distribute
  173.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  173.33 - * to extend the choice of license to its licensees as provided above.
  173.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  173.35 - * Version 2 license, then the option applies only if the new code is
  173.36 - * made subject to such option by the copyright holder.
  173.37 - *
  173.38 - * Contributor(s):
  173.39 - *
  173.40 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
  173.41 - */
  173.42 -
  173.43 -package org.netbeans.modules.jackpot30.impl;
  173.44 -
  173.45 -import java.io.File;
  173.46 -import javax.swing.text.Document;
  173.47 -import org.netbeans.api.java.lexer.JavaTokenId;
  173.48 -import org.netbeans.api.java.source.CompilationInfo;
  173.49 -import org.netbeans.api.java.source.JavaSource;
  173.50 -import org.netbeans.api.java.source.JavaSource.Phase;
  173.51 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  173.52 -import org.netbeans.api.java.source.TestUtilities;
  173.53 -import org.netbeans.api.lexer.Language;
  173.54 -import org.netbeans.junit.NbTestCase;
  173.55 -import org.netbeans.modules.java.source.TreeLoader;
  173.56 -import org.openide.cookies.EditorCookie;
  173.57 -import org.openide.filesystems.FileObject;
  173.58 -import org.openide.filesystems.FileUtil;
  173.59 -import org.openide.loaders.DataObject;
  173.60 -
  173.61 -/**
  173.62 - *
  173.63 - * @author Jan Lahoda
  173.64 - */
  173.65 -public class TestBase extends NbTestCase {
  173.66 -
  173.67 -    public TestBase(String name) {
  173.68 -        super(name);
  173.69 -    }
  173.70 -
  173.71 -    @Override
  173.72 -    protected void setUp() throws Exception {
  173.73 -        super.setUp();
  173.74 -        SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
  173.75 -        TreeLoader.DISABLE_CONFINEMENT_TEST = true;
  173.76 -    }
  173.77 -
  173.78 -    protected void prepareTest(String fileName, String code) throws Exception {
  173.79 -        clearWorkDir();
  173.80 -
  173.81 -        FileUtil.refreshFor(File.listRoots());
  173.82 -
  173.83 -        FileObject workFO = FileUtil.toFileObject(getWorkDir());
  173.84 -
  173.85 -        assertNotNull(workFO);
  173.86 -
  173.87 -        workFO.refresh();
  173.88 -
  173.89 -        sourceRoot = workFO.createFolder("src");
  173.90 -        FileObject buildRoot  = workFO.createFolder("build");
  173.91 -        FileObject cache = workFO.createFolder("cache");
  173.92 -
  173.93 -        FileObject data = FileUtil.createData(sourceRoot, fileName);
  173.94 -        File dataFile = FileUtil.toFile(data);
  173.95 -
  173.96 -        assertNotNull(dataFile);
  173.97 -
  173.98 -        TestUtilities.copyStringToFile(dataFile, code);
  173.99 -
 173.100 -        SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache);
 173.101 -
 173.102 -        DataObject od = DataObject.find(data);
 173.103 -        EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
 173.104 -
 173.105 -        assertNotNull(ec);
 173.106 -
 173.107 -        doc = ec.openDocument();
 173.108 -        doc.putProperty(Language.class, JavaTokenId.language());
 173.109 -
 173.110 -        JavaSource js = JavaSource.forFileObject(data);
 173.111 -
 173.112 -        assertNotNull(js);
 173.113 -
 173.114 -        info = SourceUtilsTestUtil.getCompilationInfo(js, Phase.RESOLVED);
 173.115 -
 173.116 -        assertNotNull(info);
 173.117 -    }
 173.118 -
 173.119 -    protected FileObject sourceRoot;
 173.120 -    protected CompilationInfo info;
 173.121 -    protected Document doc;
 173.122 -
 173.123 -}
   174.1 --- a/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/LoadExamplesTest.java	Sun Jan 08 20:10:08 2017 +0100
   174.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   174.3 @@ -1,71 +0,0 @@
   174.4 -/*
   174.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   174.6 - *
   174.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   174.8 - *
   174.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  174.10 - * Other names may be trademarks of their respective owners.
  174.11 - *
  174.12 - * The contents of this file are subject to the terms of either the GNU
  174.13 - * General Public License Version 2 only ("GPL") or the Common
  174.14 - * Development and Distribution License("CDDL") (collectively, the
  174.15 - * "License"). You may not use this file except in compliance with the
  174.16 - * License. You can obtain a copy of the License at
  174.17 - * http://www.netbeans.org/cddl-gplv2.html
  174.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  174.19 - * specific language governing permissions and limitations under the
  174.20 - * License.  When distributing the software, include this License Header
  174.21 - * Notice in each file and include the License file at
  174.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  174.23 - * particular file as subject to the "Classpath" exception as provided
  174.24 - * by Oracle in the GPL Version 2 section of the License file that
  174.25 - * accompanied this code. If applicable, add the following below the
  174.26 - * License Header, with the fields enclosed by brackets [] replaced by
  174.27 - * your own identifying information:
  174.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  174.29 - *
  174.30 - * If you wish your version of this file to be governed by only the CDDL
  174.31 - * or only the GPL Version 2, indicate your decision by adding
  174.32 - * "[Contributor] elects to include this software in this distribution
  174.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  174.34 - * single choice of license, a recipient has the option to distribute
  174.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  174.36 - * to extend the choice of license to its licensees as provided above.
  174.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  174.38 - * Version 2 license, then the option applies only if the new code is
  174.39 - * made subject to such option by the copyright holder.
  174.40 - *
  174.41 - * Contributor(s):
  174.42 - *
  174.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  174.44 - */
  174.45 -
  174.46 -package org.netbeans.modules.jackpot30.impl.examples;
  174.47 -
  174.48 -import java.util.Arrays;
  174.49 -import java.util.LinkedList;
  174.50 -import java.util.List;
  174.51 -import org.netbeans.junit.NbTestCase;
  174.52 -import static org.junit.Assert.*;
  174.53 -
  174.54 -/**
  174.55 - *
  174.56 - * @author lahvac
  174.57 - */
  174.58 -public class LoadExamplesTest extends NbTestCase {
  174.59 -
  174.60 -    public LoadExamplesTest(String name) {
  174.61 -        super(name);
  174.62 -    }
  174.63 -
  174.64 -    public void testLoadExamples() {
  174.65 -        List<String> actual = new LinkedList<String>();
  174.66 -
  174.67 -        for (Example e : LoadExamples.loadExamples("test-examples.list")) {
  174.68 -            actual.add("" + e.getKey() + ":" + e.getOptions() + ":" + e.getCode());
  174.69 -        }
  174.70 -
  174.71 -        assertEquals(Arrays.asList("key1:[]:EX1\n", "key2:[VERIFY, FIX]:EX2\n", "key3:[FIX]:EX3\n"), actual);
  174.72 -    }
  174.73 -
  174.74 -}
  174.75 \ No newline at end of file
   175.1 --- a/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/test-example1.example	Sun Jan 08 20:10:08 2017 +0100
   175.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   175.3 @@ -1,6 +0,0 @@
   175.4 -%%example=key1
   175.5 -EX1
   175.6 -%%example=key2,verify,fix
   175.7 -EX2
   175.8 -%%example=key3,fix
   175.9 -EX3
   176.1 --- a/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/test-examples.list	Sun Jan 08 20:10:08 2017 +0100
   176.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   176.3 @@ -1,1 +0,0 @@
   176.4 -test-example1.example
   177.1 --- a/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/hints/ExplicitFindDuplicatesTest.java	Sun Jan 08 20:10:08 2017 +0100
   177.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   177.3 @@ -1,138 +0,0 @@
   177.4 -/*
   177.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   177.6 - *
   177.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   177.8 - *
   177.9 - * The contents of this file are subject to the terms of either the GNU
  177.10 - * General Public License Version 2 only ("GPL") or the Common
  177.11 - * Development and Distribution License("CDDL") (collectively, the
  177.12 - * "License"). You may not use this file except in compliance with the
  177.13 - * License. You can obtain a copy of the License at
  177.14 - * http://www.netbeans.org/cddl-gplv2.html
  177.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  177.16 - * specific language governing permissions and limitations under the
  177.17 - * License.  When distributing the software, include this License Header
  177.18 - * Notice in each file and include the License file at
  177.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  177.20 - * particular file as subject to the "Classpath" exception as provided
  177.21 - * by Sun in the GPL Version 2 section of the License file that
  177.22 - * accompanied this code. If applicable, add the following below the
  177.23 - * License Header, with the fields enclosed by brackets [] replaced by
  177.24 - * your own identifying information:
  177.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  177.26 - *
  177.27 - * If you wish your version of this file to be governed by only the CDDL
  177.28 - * or only the GPL Version 2, indicate your decision by adding
  177.29 - * "[Contributor] elects to include this software in this distribution
  177.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  177.31 - * single choice of license, a recipient has the option to distribute
  177.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  177.33 - * to extend the choice of license to its licensees as provided above.
  177.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  177.35 - * Version 2 license, then the option applies only if the new code is
  177.36 - * made subject to such option by the copyright holder.
  177.37 - *
  177.38 - * Contributor(s):
  177.39 - *
  177.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
  177.41 - */
  177.42 -
  177.43 -package org.netbeans.modules.jackpot30.impl.hints;
  177.44 -
  177.45 -import com.sun.source.tree.Tree;
  177.46 -import com.sun.tools.javac.tree.JCTree;
  177.47 -import java.util.regex.Pattern;
  177.48 -import org.netbeans.modules.jackpot30.impl.TestBase;
  177.49 -import org.netbeans.modules.java.source.pretty.VeryPretty;
  177.50 -import org.netbeans.modules.java.source.save.DiffContext;
  177.51 -
  177.52 -/**
  177.53 - *
  177.54 - * @author lahvac
  177.55 - */
  177.56 -public class ExplicitFindDuplicatesTest extends TestBase {
  177.57 -
  177.58 -    public ExplicitFindDuplicatesTest(String name) {
  177.59 -        super(name);
  177.60 -    }
  177.61 -
  177.62 -    public void testLocalVariablesGeneralization() throws Exception {
  177.63 -        performGeneralizationTest("package test;\n" +
  177.64 -                    "public class Test {\n" +
  177.65 -                    "    private void test() {\n" +
  177.66 -                    "        |int i = 0;\n" +
  177.67 -                    "        i++;\n" +
  177.68 -                    "        int j = i;|\n" +
  177.69 -                    "    }\n" +
  177.70 -                    "}\n" +
  177.71 -                    "",
  177.72 -                    "{\n" +
  177.73 -                    "    $s0$;\n" +
  177.74 -                    "    int $0 = 0;\n" +
  177.75 -                    "    $0++;\n" +
  177.76 -                    "    int $1 = $0;\n" +
  177.77 -                    "    $s1$;\n" +
  177.78 -                    "}");
  177.79 -    }
  177.80 -    
  177.81 -    public void testSingleStatementPattern() throws Exception {
  177.82 -        performGeneralizationTest("package test;\n" +
  177.83 -                    "public class Test {\n" +
  177.84 -                    "    private void test() {\n" +
  177.85 -                    "        int i = 0;\n" +
  177.86 -                    "        |i++;|\n" +
  177.87 -                    "        int j = i;\n" +
  177.88 -                    "    }\n" +
  177.89 -                    "}\n" +
  177.90 -                    "",
  177.91 -                    "$0++;");
  177.92 -    }
  177.93 -
  177.94 -    public void testExpressionPattern() throws Exception {
  177.95 -        performGeneralizationTest("package test;\n" +
  177.96 -                    "public class Test {\n" +
  177.97 -                    "    private void test() {\n" +
  177.98 -                    "        int i = 0;\n" +
  177.99 -                    "        i++;\n" +
 177.100 -                    "        int j = |i|;\n" +
 177.101 -                    "    }\n" +
 177.102 -                    "}\n" +
 177.103 -                    "",
 177.104 -                    "$0");
 177.105 -    }
 177.106 -
 177.107 -    public void testVoidMethod() throws Exception {
 177.108 -        performGeneralizationTest("package test;\n" +
 177.109 -                    "public class Test {\n" +
 177.110 -                    "    private void test() {\n" +
 177.111 -                    "        |System.err.println()|;\n" +
 177.112 -                    "    }\n" +
 177.113 -                    "}\n" +
 177.114 -                    "",
 177.115 -                    "System.err.println()");
 177.116 -    }
 177.117 -
 177.118 -    private void performGeneralizationTest(String code, String generalized) throws Exception {
 177.119 -        String[] split = code.split(Pattern.quote("|"));
 177.120 -
 177.121 -        assertEquals(3, split.length);
 177.122 -
 177.123 -        int start = split[0].length();
 177.124 -        int end   = split[1].length() + start;
 177.125 -        
 177.126 -        code = split[0] + split[1] + split[2];
 177.127 -
 177.128 -        prepareTest("test/Test.java", code);
 177.129 -
 177.130 -        Tree generalizedTree = ExplicitFindDuplicates.resolveAndGeneralizePattern(info, start, end);
 177.131 -        VeryPretty vp = new VeryPretty(new DiffContext(info));
 177.132 -
 177.133 -        vp.print((JCTree) generalizedTree);
 177.134 -        
 177.135 -        String repr = vp.toString();
 177.136 -        
 177.137 -        assertEquals(generalized.replaceAll("[ \n\t]+", " "),
 177.138 -                     repr.replaceAll("[ \n\t]+", " "));
 177.139 -    }
 177.140 -
 177.141 -}
 177.142 \ No newline at end of file
   178.1 --- a/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/pm/BulkSearchPerformance.java	Sun Jan 08 20:10:08 2017 +0100
   178.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   178.3 @@ -1,226 +0,0 @@
   178.4 -/*
   178.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   178.6 - *
   178.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   178.8 - *
   178.9 - * The contents of this file are subject to the terms of either the GNU
  178.10 - * General Public License Version 2 only ("GPL") or the Common
  178.11 - * Development and Distribution License("CDDL") (collectively, the
  178.12 - * "License"). You may not use this file except in compliance with the
  178.13 - * License. You can obtain a copy of the License at
  178.14 - * http://www.netbeans.org/cddl-gplv2.html
  178.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  178.16 - * specific language governing permissions and limitations under the
  178.17 - * License.  When distributing the software, include this License Header
  178.18 - * Notice in each file and include the License file at
  178.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  178.20 - * particular file as subject to the "Classpath" exception as provided
  178.21 - * by Sun in the GPL Version 2 section of the License file that
  178.22 - * accompanied this code. If applicable, add the following below the
  178.23 - * License Header, with the fields enclosed by brackets [] replaced by
  178.24 - * your own identifying information:
  178.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  178.26 - *
  178.27 - * If you wish your version of this file to be governed by only the CDDL
  178.28 - * or only the GPL Version 2, indicate your decision by adding
  178.29 - * "[Contributor] elects to include this software in this distribution
  178.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  178.31 - * single choice of license, a recipient has the option to distribute
  178.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  178.33 - * to extend the choice of license to its licensees as provided above.
  178.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  178.35 - * Version 2 license, then the option applies only if the new code is
  178.36 - * made subject to such option by the copyright holder.
  178.37 - *
  178.38 - * Contributor(s):
  178.39 - *
  178.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
  178.41 - */
  178.42 -
  178.43 -package org.netbeans.modules.jackpot30.impl.pm;
  178.44 -
  178.45 -import com.sun.source.util.TreePath;
  178.46 -import java.io.ByteArrayInputStream;
  178.47 -import java.io.ByteArrayOutputStream;
  178.48 -import java.io.File;
  178.49 -import java.io.IOException;
  178.50 -import java.util.LinkedList;
  178.51 -import java.util.List;
  178.52 -import org.netbeans.api.java.source.ClasspathInfo;
  178.53 -import org.netbeans.api.java.source.CompilationController;
  178.54 -import org.netbeans.api.java.source.JavaSource;
  178.55 -import org.netbeans.api.java.source.JavaSource.Phase;
  178.56 -import org.netbeans.api.java.source.Task;
  178.57 -import org.netbeans.junit.NbTestCase;
  178.58 -import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
  178.59 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
  178.60 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
  178.61 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.EncodingContext;
  178.62 -import org.netbeans.modules.java.hints.jackpot.impl.pm.CopyFinderBasedBulkSearch;
  178.63 -import org.netbeans.modules.java.hints.jackpot.impl.pm.NFABasedBulkSearch;
  178.64 -import org.openide.filesystems.FileObject;
  178.65 -import org.openide.filesystems.FileUtil;
  178.66 -
  178.67 -/**
  178.68 - *
  178.69 - * @author lahvac
  178.70 - */
  178.71 -public class BulkSearchPerformance extends NbTestCase {
  178.72 -
  178.73 -    public BulkSearchPerformance(String name) {
  178.74 -        super(name);
  178.75 -    }
  178.76 -
  178.77 -    public void testPerformance() throws Exception {
  178.78 -        File root = new File("/media/karta/space/src/nb-main/uml");
  178.79 -        List<FileObject> files = new LinkedList<FileObject>();
  178.80 -
  178.81 -        gatherFiles(FileUtil.toFileObject(root), files);
  178.82 -
  178.83 -        String[] patterns = new String[] {"$1.isDirectory()", "new ImageIcon()"};
  178.84 -
  178.85 -        for (int c = 0; c < 5; c++) {
  178.86 -            performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
  178.87 -            performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
  178.88 -        }
  178.89 -
  178.90 -        performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
  178.91 -        long nfa1 = performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
  178.92 -        performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
  178.93 -        long cf1 = performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
  178.94 -
  178.95 -        performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
  178.96 -        long nfa2 = performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
  178.97 -        performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
  178.98 -        long cf2 = performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
  178.99 -
 178.100 -        System.err.println("nfa1=" + nfa1);
 178.101 -        System.err.println("cf1=" + cf1);
 178.102 -        System.err.println("nfa2=" + nfa2);
 178.103 -        System.err.println("cf2=" + cf2);
 178.104 -
 178.105 -        System.err.println("perf (cf1/nfa1): " + ((1000 * cf1 / nfa1) /10.0) + "%");
 178.106 -        System.err.println("perf (cf2/nfa2): " + ((1000 * cf2 / nfa2) /10.0) + "%");
 178.107 -    }
 178.108 -
 178.109 -    public void testIndexingPerformance() throws Exception {
 178.110 -        File root = new File("/media/karta/space/src/nb-main/uml");
 178.111 -//        File root = new File("/media/karta/space/src/nb-main/contrib/javahints");
 178.112 -        List<FileObject> files = new LinkedList<FileObject>();
 178.113 -
 178.114 -        gatherFiles(FileUtil.toFileObject(root), files);
 178.115 -
 178.116 -        String[] patterns = new String[] {"$1.isDirectory()", "new ImageIcon()"};
 178.117 -
 178.118 -        for (int c = 0; c < 5; c++) {
 178.119 -            performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
 178.120 -//            performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
 178.121 -        }
 178.122 -
 178.123 -        performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
 178.124 -        long[] nfa1 = performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
 178.125 -//        performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
 178.126 -//        long cf1 = performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
 178.127 -
 178.128 -        performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
 178.129 -        long[] nfa2 = performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
 178.130 -//        performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
 178.131 -//        long cf2 = performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
 178.132 -
 178.133 -        System.err.println("i.nfa1=" + nfa1[0]);
 178.134 -        System.err.println("m.nfa1=" + nfa1[1]);
 178.135 -//        System.err.println("cf1=" + cf1);
 178.136 -        System.err.println("i.nfa2=" + nfa2[0]);
 178.137 -        System.err.println("m.nfa2=" + nfa2[1]);
 178.138 -//        System.err.println("cf2=" + cf2);
 178.139 -
 178.140 -//        System.err.println("perf i.(nfa1/regexp1): " + ((1000 * nfa1[0] / regexp1[0]) /10.0) + "%");
 178.141 -//        System.err.println("perf m.(nfa1/regexp1): " + ((1000 * nfa1[1] / regexp1[1]) /10.0) + "%");
 178.142 -//        System.err.println("perf i.(nfa2/regexp2): " + ((1000 * nfa2[0] / regexp2[0]) /10.0) + "%");
 178.143 -//        System.err.println("perf m.(nfa2/regexp2): " + ((1000 * nfa2[1] / regexp2[1]) /10.0) + "%");
 178.144 -//        System.err.println("perf (cf1/regexp1): " + ((1000 * cf1 / regexp1) /10.0) + "%");
 178.145 -//        System.err.println("perf (cf2/regexp2): " + ((1000 * cf2 / regexp2) /10.0) + "%");
 178.146 -    }
 178.147 -    
 178.148 -    private long performPerformanceTest(List<FileObject> files, final BulkSearch search, final String... pattern) throws IOException {
 178.149 -        ClasspathInfo cpInfo = Utilities.createUniversalCPInfo();
 178.150 -
 178.151 -        final BulkPattern[] bulkPattern = new BulkPattern[1];
 178.152 -        JavaSource.create(cpInfo).runUserActionTask(new Task<CompilationController>() {
 178.153 -
 178.154 -            public void run(CompilationController parameter) throws Exception {
 178.155 -                bulkPattern[0] = search.create(parameter, pattern);
 178.156 -            }
 178.157 -        }, true);
 178.158 -
 178.159 -        long start = System.currentTimeMillis();
 178.160 -        JavaSource.create(cpInfo, files).runUserActionTask(new Task<CompilationController>() {
 178.161 -
 178.162 -            public void run(CompilationController parameter) throws Exception {
 178.163 -                if (parameter.toPhase(Phase.PARSED).compareTo(Phase.PARSED) < 0)
 178.164 -                    return;
 178.165 -
 178.166 -                search.match(parameter, new TreePath(parameter.getCompilationUnit()), bulkPattern[0]);
 178.167 -            }
 178.168 -        }, true);
 178.169 -        long end = System.currentTimeMillis();
 178.170 -
 178.171 -        return end - start;
 178.172 -    }
 178.173 -
 178.174 -    private long[] performIndexingPerformanceTest(List<FileObject> files, final BulkSearch search, final String... pattern) throws IOException {
 178.175 -        final List<byte[]> index = new LinkedList<byte[]>();
 178.176 -        long[] result = new long[2];
 178.177 -        ClasspathInfo cpInfo = Utilities.createUniversalCPInfo();
 178.178 -
 178.179 -        final BulkPattern[] bulkPattern = new BulkPattern[1];
 178.180 -        JavaSource.create(cpInfo).runUserActionTask(new Task<CompilationController>() {
 178.181 -
 178.182 -            public void run(CompilationController parameter) throws Exception {
 178.183 -                bulkPattern[0] = search.create(parameter, pattern);
 178.184 -            }
 178.185 -        }, true);
 178.186 -
 178.187 -        long start = System.currentTimeMillis();
 178.188 -        JavaSource.create(cpInfo, files).runUserActionTask(new Task<CompilationController>() {
 178.189 -
 178.190 -            public void run(CompilationController parameter) throws Exception {
 178.191 -                if (parameter.toPhase(Phase.PARSED).compareTo(Phase.PARSED) < 0)
 178.192 -                    return;
 178.193 -
 178.194 -                ByteArrayOutputStream out = new ByteArrayOutputStream();
 178.195 -                EncodingContext ec = new EncodingContext(out, false);
 178.196 -                search.encode(parameter.getCompilationUnit(), ec);
 178.197 -
 178.198 -                index.add(out.toByteArray());
 178.199 -            }
 178.200 -        }, true);
 178.201 -        long end = System.currentTimeMillis();
 178.202 -
 178.203 -        result[0] = end - start;
 178.204 -
 178.205 -        start = System.currentTimeMillis();
 178.206 -
 178.207 -        for (byte[] data : index) {
 178.208 -            search.matches(new ByteArrayInputStream(data), bulkPattern[0]);
 178.209 -        }
 178.210 -
 178.211 -        end = System.currentTimeMillis();
 178.212 -
 178.213 -        result[1] = end - start;
 178.214 -
 178.215 -        return result;
 178.216 -    }
 178.217 -    
 178.218 -    private static void gatherFiles(FileObject root, List<FileObject> files) {
 178.219 -        if ("java".equals(root.getExt())) {
 178.220 -            files.add(root);
 178.221 -        }
 178.222 -        
 178.223 -        if (root.isFolder()) {
 178.224 -            for (FileObject c : root.getChildren()) {
 178.225 -                gatherFiles(c, files);
 178.226 -            }
 178.227 -        }
 178.228 -    }
 178.229 -}
   179.1 --- a/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/pm/IndexBulkTest.java	Sun Jan 08 20:10:08 2017 +0100
   179.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   179.3 @@ -1,182 +0,0 @@
   179.4 -/*
   179.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   179.6 - *
   179.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
   179.8 - *
   179.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  179.10 - * Other names may be trademarks of their respective owners.
  179.11 - *
  179.12 - * The contents of this file are subject to the terms of either the GNU
  179.13 - * General Public License Version 2 only ("GPL") or the Common
  179.14 - * Development and Distribution License("CDDL") (collectively, the
  179.15 - * "License"). You may not use this file except in compliance with the
  179.16 - * License. You can obtain a copy of the License at
  179.17 - * http://www.netbeans.org/cddl-gplv2.html
  179.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  179.19 - * specific language governing permissions and limitations under the
  179.20 - * License.  When distributing the software, include this License Header
  179.21 - * Notice in each file and include the License file at
  179.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  179.23 - * particular file as subject to the "Classpath" exception as provided
  179.24 - * by Oracle in the GPL Version 2 section of the License file that
  179.25 - * accompanied this code. If applicable, add the following below the
  179.26 - * License Header, with the fields enclosed by brackets [] replaced by
  179.27 - * your own identifying information:
  179.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  179.29 - *
  179.30 - * If you wish your version of this file to be governed by only the CDDL
  179.31 - * or only the GPL Version 2, indicate your decision by adding
  179.32 - * "[Contributor] elects to include this software in this distribution
  179.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  179.34 - * single choice of license, a recipient has the option to distribute
  179.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  179.36 - * to extend the choice of license to its licensees as provided above.
  179.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  179.38 - * Version 2 license, then the option applies only if the new code is
  179.39 - * made subject to such option by the copyright holder.
  179.40 - *
  179.41 - * Contributor(s):
  179.42 - *
  179.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  179.44 - */
  179.45 -
  179.46 -package org.netbeans.modules.jackpot30.impl.pm;
  179.47 -
  179.48 -import com.sun.source.tree.Tree;
  179.49 -import com.sun.source.util.TreePath;
  179.50 -import java.io.IOException;
  179.51 -import java.io.InputStream;
  179.52 -import java.io.Reader;
  179.53 -import java.util.Collection;
  179.54 -import java.util.Collections;
  179.55 -import java.util.Map;
  179.56 -import org.apache.lucene.analysis.Analyzer;
  179.57 -import org.apache.lucene.analysis.TokenStream;
  179.58 -import org.apache.lucene.index.IndexReader;
  179.59 -import org.apache.lucene.index.IndexWriter.MaxFieldLength;
  179.60 -import org.apache.lucene.store.Directory;
  179.61 -import org.apache.lucene.store.RAMDirectory;
  179.62 -import org.netbeans.api.java.source.CompilationInfo;
  179.63 -import org.netbeans.modules.jackpot30.impl.indexing.AbstractLuceneIndex;
  179.64 -import org.netbeans.modules.jackpot30.impl.indexing.Index.IndexWriter;
  179.65 -import org.netbeans.modules.jackpot30.impl.indexing.IndexInfo;
  179.66 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
  179.67 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
  179.68 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.EncodingContext;
  179.69 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearchTestPerformer;
  179.70 -import org.netbeans.modules.java.hints.jackpot.impl.pm.NFABasedBulkSearch;
  179.71 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.AdditionalQueryConstraints;
  179.72 -
  179.73 -/**
  179.74 - *
  179.75 - * @author lahvac
  179.76 - */
  179.77 -public class IndexBulkTest extends BulkSearchTestPerformer {
  179.78 -
  179.79 -    public IndexBulkTest(String name) {
  179.80 -        super(name);
  179.81 -    }
  179.82 -
  179.83 -//    public static TestSuite suite() {
  179.84 -//        NbTestSuite r = new NbTestSuite();
  179.85 -//
  179.86 -//        r.addTest(new NFABasedBulkSearchTest("testField1"));
  179.87 -//        r.addTest(new NFABasedBulkSearchTest("testField2"));
  179.88 -//
  179.89 -//        return r;
  179.90 -//    }
  179.91 -
  179.92 -    @Override
  179.93 -    protected BulkSearch createSearch() {
  179.94 -        return new BulkSearchImpl(false);
  179.95 -    }
  179.96 -
  179.97 -    private static class BulkSearchImpl extends BulkSearch {
  179.98 -
  179.99 -        public BulkSearchImpl(boolean requiresLightweightVerification) {
 179.100 -            super(requiresLightweightVerification);
 179.101 -        }
 179.102 -
 179.103 -        @Override
 179.104 -        public Map<String, Collection<TreePath>> match(CompilationInfo info, TreePath toSearch, BulkPattern pattern, Map<String, Long> timeLog) {
 179.105 -            try {
 179.106 -                IndexImpl ii = new IndexImpl();
 179.107 -                IndexWriter writer = ii.openForWriting();
 179.108 -
 179.109 -                writer.record(toSearch.getCompilationUnit().getSourceFile().toUri().toURL(), toSearch.getCompilationUnit(), null);
 179.110 -                writer.close();
 179.111 -
 179.112 -                if (!ii.findCandidates(pattern).isEmpty()) {
 179.113 -                    return new NFABasedBulkSearch().match(info, toSearch, pattern, timeLog);
 179.114 -                } else {
 179.115 -                    assertTrue(new NFABasedBulkSearch().match(info, toSearch, pattern, timeLog).isEmpty());
 179.116 -                    return Collections.emptyMap();
 179.117 -                }
 179.118 -            } catch (IOException ex) {
 179.119 -                throw new IllegalStateException(ex);
 179.120 -            }
 179.121 -        }
 179.122 -
 179.123 -        @Override
 179.124 -        public boolean matches(InputStream encoded, BulkPattern pattern) {
 179.125 -            return new NFABasedBulkSearch().matches(encoded, pattern);
 179.126 -        }
 179.127 -
 179.128 -        @Override
 179.129 -        public boolean matches(CompilationInfo info, TreePath toSearch, BulkPattern pattern) {
 179.130 -            return new NFABasedBulkSearch().matches(info, toSearch, pattern);
 179.131 -        }
 179.132 -
 179.133 -        @Override
 179.134 -        public void encode(Tree tree, EncodingContext ctx) {
 179.135 -            new NFABasedBulkSearch().encode(tree, ctx);
 179.136 -        }
 179.137 -
 179.138 -        @Override
 179.139 -        public BulkPattern create(Collection<? extends String> code, Collection<? extends Tree> patterns, Collection<? extends AdditionalQueryConstraints> additionalConstraints) {
 179.140 -            return new NFABasedBulkSearch().create(code, patterns, additionalConstraints);
 179.141 -        }
 179.142 -
 179.143 -        @Override
 179.144 -        public Map<String, Integer> matchesWithFrequencies(InputStream encoded, BulkPattern pattern) {
 179.145 -            return new NFABasedBulkSearch().matchesWithFrequencies(encoded, pattern);
 179.146 -        }
 179.147 -    }
 179.148 -
 179.149 -    private static final class IndexImpl extends AbstractLuceneIndex {
 179.150 -
 179.151 -        private final Directory dir = new RAMDirectory();
 179.152 -
 179.153 -        public IndexImpl() {
 179.154 -            super(0, false, true);
 179.155 -        }
 179.156 -
 179.157 -        @Override
 179.158 -        protected IndexReader createReader() throws IOException {
 179.159 -            return IndexReader.open(dir, true);
 179.160 -        }
 179.161 -
 179.162 -        @Override
 179.163 -        protected org.apache.lucene.index.IndexWriter createWriter() throws IOException {
 179.164 -            return new org.apache.lucene.index.IndexWriter(dir, new NoAnalyzer(), MaxFieldLength.UNLIMITED);
 179.165 -        }
 179.166 -
 179.167 -        @Override
 179.168 -        public IndexInfo getIndexInfo() {
 179.169 -            return IndexInfo.empty();
 179.170 -        }
 179.171 -
 179.172 -        @Override
 179.173 -        protected void storeIndexInfo(IndexInfo info) throws IOException {}
 179.174 -    }
 179.175 -
 179.176 -    private static final class NoAnalyzer extends Analyzer {
 179.177 -
 179.178 -        @Override
 179.179 -        public TokenStream tokenStream(String string, Reader reader) {
 179.180 -            throw new UnsupportedOperationException("Should not be called");
 179.181 -        }
 179.182 -
 179.183 -    }
 179.184 -
 179.185 -}
   180.1 --- a/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/spi/refactoring/JackpotBasedRefactoringTestBase.java	Sun Jan 08 20:10:08 2017 +0100
   180.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   180.3 @@ -1,198 +0,0 @@
   180.4 -/*
   180.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   180.6 - *
   180.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   180.8 - *
   180.9 - * The contents of this file are subject to the terms of either the GNU
  180.10 - * General Public License Version 2 only ("GPL") or the Common
  180.11 - * Development and Distribution License("CDDL") (collectively, the
  180.12 - * "License"). You may not use this file except in compliance with the
  180.13 - * License. You can obtain a copy of the License at
  180.14 - * http://www.netbeans.org/cddl-gplv2.html
  180.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  180.16 - * specific language governing permissions and limitations under the
  180.17 - * License.  When distributing the software, include this License Header
  180.18 - * Notice in each file and include the License file at
  180.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  180.20 - * particular file as subject to the "Classpath" exception as provided
  180.21 - * by Sun in the GPL Version 2 section of the License file that
  180.22 - * accompanied this code. If applicable, add the following below the
  180.23 - * License Header, with the fields enclosed by brackets [] replaced by
  180.24 - * your own identifying information:
  180.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  180.26 - *
  180.27 - * If you wish your version of this file to be governed by only the CDDL
  180.28 - * or only the GPL Version 2, indicate your decision by adding
  180.29 - * "[Contributor] elects to include this software in this distribution
  180.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  180.31 - * single choice of license, a recipient has the option to distribute
  180.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  180.33 - * to extend the choice of license to its licensees as provided above.
  180.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  180.35 - * Version 2 license, then the option applies only if the new code is
  180.36 - * made subject to such option by the copyright holder.
  180.37 - *
  180.38 - * Contributor(s):
  180.39 - *
  180.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  180.41 - */
  180.42 -
  180.43 -package org.netbeans.modules.jackpot30.spi.refactoring;
  180.44 -
  180.45 -import java.io.IOException;
  180.46 -import java.util.Collections;
  180.47 -import org.netbeans.api.editor.mimelookup.MimePath;
  180.48 -import org.netbeans.api.java.classpath.ClassPath;
  180.49 -import org.netbeans.api.java.classpath.GlobalPathRegistry;
  180.50 -import org.netbeans.api.java.source.SourceUtils;
  180.51 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  180.52 -import org.netbeans.api.java.source.TestUtilities;
  180.53 -import org.netbeans.api.project.Project;
  180.54 -import org.netbeans.api.project.ProjectManager;
  180.55 -import org.netbeans.core.startup.Main;
  180.56 -import org.netbeans.junit.NbTestCase;
  180.57 -import org.netbeans.modules.java.JavaDataLoader;
  180.58 -import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
  180.59 -import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
  180.60 -import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
  180.61 -import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
  180.62 -import org.netbeans.modules.parsing.impl.indexing.Util;
  180.63 -import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
  180.64 -import org.netbeans.spi.java.classpath.ClassPathProvider;
  180.65 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
  180.66 -import org.netbeans.spi.project.ProjectFactory;
  180.67 -import org.netbeans.spi.project.ProjectState;
  180.68 -import org.openide.filesystems.FileObject;
  180.69 -import org.openide.filesystems.FileUtil;
  180.70 -import org.openide.util.Lookup;
  180.71 -import org.openide.util.lookup.Lookups;
  180.72 -import org.openide.util.lookup.ServiceProvider;
  180.73 -
  180.74 -/**
  180.75 - *
  180.76 - * @author lahvac
  180.77 - */
  180.78 -public class JackpotBasedRefactoringTestBase extends NbTestCase {
  180.79 -
  180.80 -    public JackpotBasedRefactoringTestBase(String name) {
  180.81 -        super(name);
  180.82 -    }
  180.83 -
  180.84 -    protected static void writeFilesAndWaitForScan(FileObject sourceRoot, File... files) throws Exception {
  180.85 -        for (FileObject c : sourceRoot.getChildren()) {
  180.86 -            c.delete();
  180.87 -        }
  180.88 -
  180.89 -        for (File f : files) {
  180.90 -            FileObject fo = FileUtil.createData(sourceRoot, f.filename);
  180.91 -            TestUtilities.copyStringToFile(fo, f.content);
  180.92 -        }
  180.93 -
  180.94 -        SourceUtils.waitScanFinished();
  180.95 -    }
  180.96 -
  180.97 -    protected static void assertContent(FileObject sourceRoot, File... files) throws Exception {
  180.98 -        for (File f : files) {
  180.99 -            FileObject fo = sourceRoot.getFileObject(f.filename);
 180.100 -
 180.101 -            assertNotNull(f.filename, fo);
 180.102 -
 180.103 -            assertEquals(f.content.replaceAll("[ \t\n]+", " "), TestUtilities.copyFileToString(FileUtil.toFile(fo)).replaceAll("[ \t\n]+", " "));
 180.104 -        }
 180.105 -    }
 180.106 -
 180.107 -    protected static final class File {
 180.108 -        public final String filename;
 180.109 -        public final String content;
 180.110 -
 180.111 -        public File(String filename, String content) {
 180.112 -            this.filename = filename;
 180.113 -            this.content = content;
 180.114 -        }
 180.115 -    }
 180.116 -
 180.117 -    protected FileObject src;
 180.118 -    protected Project prj;
 180.119 -
 180.120 -    @Override
 180.121 -    protected void setUp() throws Exception {
 180.122 -        SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/editor/resources/layer.xml"}, new Object[] {
 180.123 -            new ClassPathProvider() {
 180.124 -                public ClassPath findClassPath(FileObject file, String type) {
 180.125 -                    if (src != null && (file == src || FileUtil.isParentOf(src, file))) {
 180.126 -                        if (ClassPath.BOOT.equals(type)) {
 180.127 -                            return ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path"));
 180.128 -                        }
 180.129 -                        if (ClassPath.COMPILE.equals(type)) {
 180.130 -                            return ClassPathSupport.createClassPath(new FileObject[0]);
 180.131 -                        }
 180.132 -                        if (ClassPath.SOURCE.equals(type)) {
 180.133 -                            return ClassPathSupport.createClassPath(src);
 180.134 -                        }
 180.135 -                    }
 180.136 -
 180.137 -                    return null;
 180.138 -                }
 180.139 -            },
 180.140 -            new ProjectFactory() {
 180.141 -            public boolean isProject(FileObject projectDirectory) {
 180.142 -                return src == projectDirectory;
 180.143 -            }
 180.144 -            public Project loadProject(final FileObject projectDirectory, ProjectState state) throws IOException {
 180.145 -                if (!isProject(projectDirectory)) return null;
 180.146 -                return new Project() {
 180.147 -                    public FileObject getProjectDirectory() {
 180.148 -                        return projectDirectory;
 180.149 -                    }
 180.150 -                    public Lookup getLookup() {
 180.151 -                        return Lookup.EMPTY;
 180.152 -                    }
 180.153 -                };
 180.154 -            }
 180.155 -            public void saveProject(Project project) throws IOException, ClassCastException {}
 180.156 -        },
 180.157 -        JavaDataLoader.getLoader(JavaDataLoader.class),
 180.158 -        });
 180.159 -        Main.initializeURLFactory();
 180.160 -        org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
 180.161 -        prepareTest();
 180.162 -        org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj = ProjectManager.getDefault().findProject(src)}, false);
 180.163 -        MimeTypes.setAllMimeTypes(Collections.singleton("text/x-java"));
 180.164 -        GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {ClassPathSupport.createClassPath(src)});
 180.165 -        RepositoryUpdater.getDefault().start(true);
 180.166 -        super.setUp();
 180.167 -    }
 180.168 -
 180.169 -    @Override
 180.170 -    protected void tearDown() throws Exception {
 180.171 -        super.tearDown();
 180.172 -        org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj}, false);
 180.173 -        prj = null;
 180.174 -    }
 180.175 -
 180.176 -    private void prepareTest() throws Exception {
 180.177 -        FileObject workdir = SourceUtilsTestUtil.makeScratchDir(this);
 180.178 -
 180.179 -        src = FileUtil.createFolder(workdir, "src");
 180.180 -
 180.181 -        FileObject cache = FileUtil.createFolder(workdir, "cache");
 180.182 -
 180.183 -        CacheFolder.setCacheFolder(cache);
 180.184 -    }
 180.185 -
 180.186 -    @ServiceProvider(service=MimeDataProvider.class)
 180.187 -    public static final class MimeDataProviderImpl implements MimeDataProvider {
 180.188 -
 180.189 -        private static final Lookup L = Lookups.singleton(new JavaCustomIndexer.Factory());
 180.190 -
 180.191 -        public Lookup getLookup(MimePath mimePath) {
 180.192 -            if ("text/x-java".equals(mimePath.getPath())) {
 180.193 -                return L;
 180.194 -            }
 180.195 -
 180.196 -            return null;
 180.197 -        }
 180.198 -
 180.199 -    }
 180.200 -
 180.201 -}
   181.1 --- a/sandbox/old-modules/bridges/refactoring/build.xml	Sun Jan 08 20:10:08 2017 +0100
   181.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   181.3 @@ -1,52 +0,0 @@
   181.4 -<?xml version="1.0" encoding="UTF-8"?>
   181.5 -<!--
   181.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   181.7 -
   181.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   181.9 -
  181.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  181.11 -Other names may be trademarks of their respective owners.
  181.12 -
  181.13 -The contents of this file are subject to the terms of either the GNU
  181.14 -General Public License Version 2 only ("GPL") or the Common
  181.15 -Development and Distribution License("CDDL") (collectively, the
  181.16 -"License"). You may not use this file except in compliance with the
  181.17 -License. You can obtain a copy of the License at
  181.18 -http://www.netbeans.org/cddl-gplv2.html
  181.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  181.20 -specific language governing permissions and limitations under the
  181.21 -License.  When distributing the software, include this License Header
  181.22 -Notice in each file and include the License file at
  181.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  181.24 -particular file as subject to the "Classpath" exception as provided
  181.25 -by Oracle in the GPL Version 2 section of the License file that
  181.26 -accompanied this code. If applicable, add the following below the
  181.27 -License Header, with the fields enclosed by brackets [] replaced by
  181.28 -your own identifying information:
  181.29 -"Portions Copyrighted [year] [name of copyright owner]"
  181.30 -
  181.31 -Contributor(s):
  181.32 -
  181.33 -The Original Software is NetBeans. The Initial Developer of the Original
  181.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  181.35 -Microsystems, Inc. All Rights Reserved.
  181.36 -
  181.37 -If you wish your version of this file to be governed by only the CDDL
  181.38 -or only the GPL Version 2, indicate your decision by adding
  181.39 -"[Contributor] elects to include this software in this distribution
  181.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  181.41 -single choice of license, a recipient has the option to distribute
  181.42 -your version of this file under either the CDDL, the GPL Version 2 or
  181.43 -to extend the choice of license to its licensees as provided above.
  181.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  181.45 -Version 2 license, then the option applies only if the new code is
  181.46 -made subject to such option by the copyright holder.
  181.47 --->
  181.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
  181.49 -<!-- for some information on what you could do (e.g. targets to override). -->
  181.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
  181.51 -<project name="org.netbeans.modules.jackpot30.refactoring" default="netbeans" basedir=".">
  181.52 -    <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.refactoring.</description>
  181.53 -    <import file="nbproject/build-impl.xml"/>
  181.54 -    <import file="${suite.dir}/findbugs-import.xml"/>
  181.55 -</project>
   182.1 --- a/sandbox/old-modules/bridges/refactoring/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
   182.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   182.3 @@ -1,6 +0,0 @@
   182.4 -Manifest-Version: 1.0
   182.5 -OpenIDE-Module: org.netbeans.modules.jackpot30.refactoring
   182.6 -OpenIDE-Module-Implementation-Version: 1
   182.7 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/refactoring/layer.xml
   182.8 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/refactoring/Bundle.properties
   182.9 -
   183.1 --- a/sandbox/old-modules/bridges/refactoring/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
   183.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   183.3 @@ -1,73 +0,0 @@
   183.4 -<?xml version="1.0" encoding="UTF-8"?>
   183.5 -<!--
   183.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   183.7 -
   183.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   183.9 -
  183.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  183.11 -Other names may be trademarks of their respective owners.
  183.12 -
  183.13 -The contents of this file are subject to the terms of either the GNU
  183.14 -General Public License Version 2 only ("GPL") or the Common
  183.15 -Development and Distribution License("CDDL") (collectively, the
  183.16 -"License"). You may not use this file except in compliance with the
  183.17 -License. You can obtain a copy of the License at
  183.18 -http://www.netbeans.org/cddl-gplv2.html
  183.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  183.20 -specific language governing permissions and limitations under the
  183.21 -License.  When distributing the software, include this License Header
  183.22 -Notice in each file and include the License file at
  183.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  183.24 -particular file as subject to the "Classpath" exception as provided
  183.25 -by Oracle in the GPL Version 2 section of the License file that
  183.26 -accompanied this code. If applicable, add the following below the
  183.27 -License Header, with the fields enclosed by brackets [] replaced by
  183.28 -your own identifying information:
  183.29 -"Portions Copyrighted [year] [name of copyright owner]"
  183.30 -
  183.31 -Contributor(s):
  183.32 -
  183.33 -The Original Software is NetBeans. The Initial Developer of the Original
  183.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  183.35 -Microsystems, Inc. All Rights Reserved.
  183.36 -
  183.37 -If you wish your version of this file to be governed by only the CDDL
  183.38 -or only the GPL Version 2, indicate your decision by adding
  183.39 -"[Contributor] elects to include this software in this distribution
  183.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  183.41 -single choice of license, a recipient has the option to distribute
  183.42 -your version of this file under either the CDDL, the GPL Version 2 or
  183.43 -to extend the choice of license to its licensees as provided above.
  183.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  183.45 -Version 2 license, then the option applies only if the new code is
  183.46 -made subject to such option by the copyright holder.
  183.47 --->
  183.48 -<!--
  183.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
  183.50 -***         EDIT ../build.xml INSTEAD         ***
  183.51 --->
  183.52 -<project name="org.netbeans.modules.jackpot30.refactoring-impl" basedir="..">
  183.53 -    <property file="nbproject/private/suite-private.properties"/>
  183.54 -    <property file="nbproject/suite.properties"/>
  183.55 -    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
  183.56 -    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
  183.57 -    <property file="${suite.dir}/nbproject/platform.properties"/>
  183.58 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
  183.59 -        <attribute name="name"/>
  183.60 -        <attribute name="value"/>
  183.61 -        <sequential>
  183.62 -            <property name="@{name}" value="${@{value}}"/>
  183.63 -        </sequential>
  183.64 -    </macrodef>
  183.65 -    <property file="${user.properties.file}"/>
  183.66 -    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  183.67 -    <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  183.68 -    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
  183.69 -        <condition>
  183.70 -            <not>
  183.71 -                <available file="${harness.dir}" type="dir"/>
  183.72 -            </not>
  183.73 -        </condition>
  183.74 -    </fail>
  183.75 -    <import file="${harness.dir}/build.xml"/>
  183.76 -</project>
   184.1 --- a/sandbox/old-modules/bridges/refactoring/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
   184.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   184.3 @@ -1,49 +0,0 @@
   184.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   184.5 -#
   184.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   184.7 -#
   184.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   184.9 -# Other names may be trademarks of their respective owners.
  184.10 -#
  184.11 -# The contents of this file are subject to the terms of either the GNU
  184.12 -# General Public License Version 2 only ("GPL") or the Common
  184.13 -# Development and Distribution License("CDDL") (collectively, the
  184.14 -# "License"). You may not use this file except in compliance with the
  184.15 -# License. You can obtain a copy of the License at
  184.16 -# http://www.netbeans.org/cddl-gplv2.html
  184.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  184.18 -# specific language governing permissions and limitations under the
  184.19 -# License.  When distributing the software, include this License Header
  184.20 -# Notice in each file and include the License file at
  184.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  184.22 -# particular file as subject to the "Classpath" exception as provided
  184.23 -# by Oracle in the GPL Version 2 section of the License file that
  184.24 -# accompanied this code. If applicable, add the following below the
  184.25 -# License Header, with the fields enclosed by brackets [] replaced by
  184.26 -# your own identifying information:
  184.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  184.28 -#
  184.29 -# Contributor(s):
  184.30 -#
  184.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  184.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  184.33 -# Microsystems, Inc. All Rights Reserved.
  184.34 -#
  184.35 -# If you wish your version of this file to be governed by only the CDDL
  184.36 -# or only the GPL Version 2, indicate your decision by adding
  184.37 -# "[Contributor] elects to include this software in this distribution
  184.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  184.39 -# single choice of license, a recipient has the option to distribute
  184.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  184.41 -# to extend the choice of license to its licensees as provided above.
  184.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  184.43 -# Version 2 license, then the option applies only if the new code is
  184.44 -# made subject to such option by the copyright holder.
  184.45 -build.xml.data.CRC32=46e4f14a
  184.46 -build.xml.script.CRC32=4a0f84c4
  184.47 -build.xml.stylesheet.CRC32=79c3b980@1.39
  184.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
  184.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
  184.50 -nbproject/build-impl.xml.data.CRC32=2e452477
  184.51 -nbproject/build-impl.xml.script.CRC32=9d1345ba
  184.52 -nbproject/build-impl.xml.stylesheet.CRC32=68e521fc@2.70
   185.1 --- a/sandbox/old-modules/bridges/refactoring/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
   185.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   185.3 @@ -1,45 +0,0 @@
   185.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   185.5 -#
   185.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   185.7 -#
   185.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   185.9 -# Other names may be trademarks of their respective owners.
  185.10 -#
  185.11 -# The contents of this file are subject to the terms of either the GNU
  185.12 -# General Public License Version 2 only ("GPL") or the Common
  185.13 -# Development and Distribution License("CDDL") (collectively, the
  185.14 -# "License"). You may not use this file except in compliance with the
  185.15 -# License. You can obtain a copy of the License at
  185.16 -# http://www.netbeans.org/cddl-gplv2.html
  185.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  185.18 -# specific language governing permissions and limitations under the
  185.19 -# License.  When distributing the software, include this License Header
  185.20 -# Notice in each file and include the License file at
  185.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  185.22 -# particular file as subject to the "Classpath" exception as provided
  185.23 -# by Oracle in the GPL Version 2 section of the License file that
  185.24 -# accompanied this code. If applicable, add the following below the
  185.25 -# License Header, with the fields enclosed by brackets [] replaced by
  185.26 -# your own identifying information:
  185.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  185.28 -#
  185.29 -# Contributor(s):
  185.30 -#
  185.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  185.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  185.33 -# Microsystems, Inc. All Rights Reserved.
  185.34 -#
  185.35 -# If you wish your version of this file to be governed by only the CDDL
  185.36 -# or only the GPL Version 2, indicate your decision by adding
  185.37 -# "[Contributor] elects to include this software in this distribution
  185.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  185.39 -# single choice of license, a recipient has the option to distribute
  185.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  185.41 -# to extend the choice of license to its licensees as provided above.
  185.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  185.43 -# Version 2 license, then the option applies only if the new code is
  185.44 -# made subject to such option by the copyright holder.
  185.45 -is.eager=true
  185.46 -javac.source=1.6
  185.47 -javac.compilerargs=-Xlint -Xlint:-serial
  185.48 -spec.version.base=1.16.0
   186.1 --- a/sandbox/old-modules/bridges/refactoring/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
   186.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   186.3 @@ -1,242 +0,0 @@
   186.4 -<?xml version="1.0" encoding="UTF-8"?>
   186.5 -<!--
   186.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   186.7 -
   186.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   186.9 -
  186.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  186.11 -Other names may be trademarks of their respective owners.
  186.12 -
  186.13 -The contents of this file are subject to the terms of either the GNU
  186.14 -General Public License Version 2 only ("GPL") or the Common
  186.15 -Development and Distribution License("CDDL") (collectively, the
  186.16 -"License"). You may not use this file except in compliance with the
  186.17 -License. You can obtain a copy of the License at
  186.18 -http://www.netbeans.org/cddl-gplv2.html
  186.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  186.20 -specific language governing permissions and limitations under the
  186.21 -License.  When distributing the software, include this License Header
  186.22 -Notice in each file and include the License file at
  186.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  186.24 -particular file as subject to the "Classpath" exception as provided
  186.25 -by Oracle in the GPL Version 2 section of the License file that
  186.26 -accompanied this code. If applicable, add the following below the
  186.27 -License Header, with the fields enclosed by brackets [] replaced by
  186.28 -your own identifying information:
  186.29 -"Portions Copyrighted [year] [name of copyright owner]"
  186.30 -
  186.31 -Contributor(s):
  186.32 -
  186.33 -The Original Software is NetBeans. The Initial Developer of the Original
  186.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  186.35 -Microsystems, Inc. All Rights Reserved.
  186.36 -
  186.37 -If you wish your version of this file to be governed by only the CDDL
  186.38 -or only the GPL Version 2, indicate your decision by adding
  186.39 -"[Contributor] elects to include this software in this distribution
  186.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  186.41 -single choice of license, a recipient has the option to distribute
  186.42 -your version of this file under either the CDDL, the GPL Version 2 or
  186.43 -to extend the choice of license to its licensees as provided above.
  186.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  186.45 -Version 2 license, then the option applies only if the new code is
  186.46 -made subject to such option by the copyright holder.
  186.47 --->
  186.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
  186.49 -    <type>org.netbeans.modules.apisupport.project</type>
  186.50 -    <configuration>
  186.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
  186.52 -            <code-name-base>org.netbeans.modules.jackpot30.refactoring</code-name-base>
  186.53 -            <suite-component/>
  186.54 -            <module-dependencies>
  186.55 -                <dependency>
  186.56 -                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
  186.57 -                    <build-prerequisite/>
  186.58 -                    <compile-dependency/>
  186.59 -                    <run-dependency>
  186.60 -                        <release-version>1</release-version>
  186.61 -                        <specification-version>1.4</specification-version>
  186.62 -                    </run-dependency>
  186.63 -                </dependency>
  186.64 -                <dependency>
  186.65 -                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
  186.66 -                    <build-prerequisite/>
  186.67 -                    <compile-dependency/>
  186.68 -                    <run-dependency>
  186.69 -                        <release-version>1</release-version>
  186.70 -                        <specification-version>1.24</specification-version>
  186.71 -                    </run-dependency>
  186.72 -                </dependency>
  186.73 -                <dependency>
  186.74 -                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
  186.75 -                    <build-prerequisite/>
  186.76 -                    <compile-dependency/>
  186.77 -                    <run-dependency>
  186.78 -                        <specification-version>0.12.0.1</specification-version>
  186.79 -                    </run-dependency>
  186.80 -                </dependency>
  186.81 -                <dependency>
  186.82 -                    <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
  186.83 -                    <build-prerequisite/>
  186.84 -                    <compile-dependency/>
  186.85 -                    <run-dependency>
  186.86 -                        <specification-version>1.12</specification-version>
  186.87 -                    </run-dependency>
  186.88 -                </dependency>
  186.89 -                <dependency>
  186.90 -                    <code-name-base>org.netbeans.modules.java.hints</code-name-base>
  186.91 -                    <build-prerequisite/>
  186.92 -                    <compile-dependency/>
  186.93 -                    <run-dependency>
  186.94 -                        <release-version>1</release-version>
  186.95 -                        <implementation-version/>
  186.96 -                    </run-dependency>
  186.97 -                </dependency>
  186.98 -                <dependency>
  186.99 -                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
 186.100 -                    <build-prerequisite/>
 186.101 -                    <compile-dependency/>
 186.102 -                    <run-dependency>
 186.103 -                        <specification-version>0.57.0.9.8.4</specification-version>
 186.104 -                    </run-dependency>
 186.105 -                </dependency>
 186.106 -                <dependency>
 186.107 -                    <code-name-base>org.netbeans.modules.java.sourceui</code-name-base>
 186.108 -                    <build-prerequisite/>
 186.109 -                    <compile-dependency/>
 186.110 -                    <run-dependency>
 186.111 -                        <release-version>1</release-version>
 186.112 -                        <specification-version>1.26.0.1.19</specification-version>
 186.113 -                    </run-dependency>
 186.114 -                </dependency>
 186.115 -                <dependency>
 186.116 -                    <code-name-base>org.netbeans.modules.queries</code-name-base>
 186.117 -                    <build-prerequisite/>
 186.118 -                    <compile-dependency/>
 186.119 -                    <run-dependency>
 186.120 -                        <release-version>1</release-version>
 186.121 -                        <specification-version>1.18</specification-version>
 186.122 -                    </run-dependency>
 186.123 -                </dependency>
 186.124 -                <dependency>
 186.125 -                    <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
 186.126 -                    <build-prerequisite/>
 186.127 -                    <compile-dependency/>
 186.128 -                    <run-dependency>
 186.129 -                        <specification-version>1.10</specification-version>
 186.130 -                    </run-dependency>
 186.131 -                </dependency>
 186.132 -                <dependency>
 186.133 -                    <code-name-base>org.netbeans.modules.refactoring.java</code-name-base>
 186.134 -                    <build-prerequisite/>
 186.135 -                    <compile-dependency/>
 186.136 -                    <run-dependency>
 186.137 -                        <release-version>1</release-version>
 186.138 -                        <implementation-version/>
 186.139 -                    </run-dependency>
 186.140 -                </dependency>
 186.141 -                <dependency>
 186.142 -                    <code-name-base>org.openide.awt</code-name-base>
 186.143 -                    <build-prerequisite/>
 186.144 -                    <compile-dependency/>
 186.145 -                    <run-dependency>
 186.146 -                        <specification-version>7.23</specification-version>
 186.147 -                    </run-dependency>
 186.148 -                </dependency>
 186.149 -                <dependency>
 186.150 -                    <code-name-base>org.openide.filesystems</code-name-base>
 186.151 -                    <build-prerequisite/>
 186.152 -                    <compile-dependency/>
 186.153 -                    <run-dependency>
 186.154 -                        <specification-version>7.36</specification-version>
 186.155 -                    </run-dependency>
 186.156 -                </dependency>
 186.157 -                <dependency>
 186.158 -                    <code-name-base>org.openide.loaders</code-name-base>
 186.159 -                    <build-prerequisite/>
 186.160 -                    <compile-dependency/>
 186.161 -                    <run-dependency>
 186.162 -                        <specification-version>7.16</specification-version>
 186.163 -                    </run-dependency>
 186.164 -                </dependency>
 186.165 -                <dependency>
 186.166 -                    <code-name-base>org.openide.nodes</code-name-base>
 186.167 -                    <build-prerequisite/>
 186.168 -                    <compile-dependency/>
 186.169 -                    <run-dependency>
 186.170 -                        <specification-version>7.16</specification-version>
 186.171 -                    </run-dependency>
 186.172 -                </dependency>
 186.173 -                <dependency>
 186.174 -                    <code-name-base>org.openide.text</code-name-base>
 186.175 -                    <build-prerequisite/>
 186.176 -                    <compile-dependency/>
 186.177 -                    <run-dependency>
 186.178 -                        <specification-version>6.29</specification-version>
 186.179 -                    </run-dependency>
 186.180 -                </dependency>
 186.181 -                <dependency>
 186.182 -                    <code-name-base>org.openide.util</code-name-base>
 186.183 -                    <build-prerequisite/>
 186.184 -                    <compile-dependency/>
 186.185 -                    <run-dependency>
 186.186 -                        <specification-version>8.2</specification-version>
 186.187 -                    </run-dependency>
 186.188 -                </dependency>
 186.189 -                <dependency>
 186.190 -                    <code-name-base>org.openide.util.lookup</code-name-base>
 186.191 -                    <build-prerequisite/>
 186.192 -                    <compile-dependency/>
 186.193 -                    <run-dependency>
 186.194 -                        <specification-version>8.2</specification-version>
 186.195 -                    </run-dependency>
 186.196 -                </dependency>
 186.197 -                <dependency>
 186.198 -                    <code-name-base>org.openide.windows</code-name-base>
 186.199 -                    <build-prerequisite/>
 186.200 -                    <compile-dependency/>
 186.201 -                    <run-dependency>
 186.202 -                        <specification-version>6.33</specification-version>
 186.203 -                    </run-dependency>
 186.204 -                </dependency>
 186.205 -            </module-dependencies>
 186.206 -            <test-dependencies>
 186.207 -                <test-type>
 186.208 -                    <name>unit</name>
 186.209 -                    <test-dependency>
 186.210 -                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
 186.211 -                        <compile-dependency/>
 186.212 -                    </test-dependency>
 186.213 -                    <test-dependency>
 186.214 -                        <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
 186.215 -                        <recursive/>
 186.216 -                        <compile-dependency/>
 186.217 -                        <test/>
 186.218 -                    </test-dependency>
 186.219 -                    <test-dependency>
 186.220 -                        <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
 186.221 -                        <compile-dependency/>
 186.222 -                    </test-dependency>
 186.223 -                    <test-dependency>
 186.224 -                        <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base>
 186.225 -                        <compile-dependency/>
 186.226 -                    </test-dependency>
 186.227 -                    <test-dependency>
 186.228 -                        <code-name-base>org.netbeans.modules.junit</code-name-base>
 186.229 -                        <compile-dependency/>
 186.230 -                    </test-dependency>
 186.231 -                    <test-dependency>
 186.232 -                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
 186.233 -                        <recursive/>
 186.234 -                        <compile-dependency/>
 186.235 -                    </test-dependency>
 186.236 -                    <test-dependency>
 186.237 -                        <code-name-base>org.netbeans.modules.projectui</code-name-base>
 186.238 -                        <compile-dependency/>
 186.239 -                    </test-dependency>
 186.240 -                </test-type>
 186.241 -            </test-dependencies>
 186.242 -            <public-packages/>
 186.243 -        </data>
 186.244 -    </configuration>
 186.245 -</project>
   187.1 --- a/sandbox/old-modules/bridges/refactoring/nbproject/suite.properties	Sun Jan 08 20:10:08 2017 +0100
   187.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   187.3 @@ -1,42 +0,0 @@
   187.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   187.5 -#
   187.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   187.7 -#
   187.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   187.9 -# Other names may be trademarks of their respective owners.
  187.10 -#
  187.11 -# The contents of this file are subject to the terms of either the GNU
  187.12 -# General Public License Version 2 only ("GPL") or the Common
  187.13 -# Development and Distribution License("CDDL") (collectively, the
  187.14 -# "License"). You may not use this file except in compliance with the
  187.15 -# License. You can obtain a copy of the License at
  187.16 -# http://www.netbeans.org/cddl-gplv2.html
  187.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  187.18 -# specific language governing permissions and limitations under the
  187.19 -# License.  When distributing the software, include this License Header
  187.20 -# Notice in each file and include the License file at
  187.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  187.22 -# particular file as subject to the "Classpath" exception as provided
  187.23 -# by Oracle in the GPL Version 2 section of the License file that
  187.24 -# accompanied this code. If applicable, add the following below the
  187.25 -# License Header, with the fields enclosed by brackets [] replaced by
  187.26 -# your own identifying information:
  187.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  187.28 -#
  187.29 -# Contributor(s):
  187.30 -#
  187.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  187.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  187.33 -# Microsystems, Inc. All Rights Reserved.
  187.34 -#
  187.35 -# If you wish your version of this file to be governed by only the CDDL
  187.36 -# or only the GPL Version 2, indicate your decision by adding
  187.37 -# "[Contributor] elects to include this software in this distribution
  187.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  187.39 -# single choice of license, a recipient has the option to distribute
  187.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  187.41 -# to extend the choice of license to its licensees as provided above.
  187.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  187.43 -# Version 2 license, then the option applies only if the new code is
  187.44 -# made subject to such option by the copyright holder.
  187.45 -suite.dir=${basedir}/../..
   188.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   188.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   188.3 @@ -1,45 +0,0 @@
   188.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   188.5 -#
   188.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   188.7 -#
   188.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   188.9 -# Other names may be trademarks of their respective owners.
  188.10 -#
  188.11 -# The contents of this file are subject to the terms of either the GNU
  188.12 -# General Public License Version 2 only ("GPL") or the Common
  188.13 -# Development and Distribution License("CDDL") (collectively, the
  188.14 -# "License"). You may not use this file except in compliance with the
  188.15 -# License. You can obtain a copy of the License at
  188.16 -# http://www.netbeans.org/cddl-gplv2.html
  188.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  188.18 -# specific language governing permissions and limitations under the
  188.19 -# License.  When distributing the software, include this License Header
  188.20 -# Notice in each file and include the License file at
  188.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  188.22 -# particular file as subject to the "Classpath" exception as provided
  188.23 -# by Oracle in the GPL Version 2 section of the License file that
  188.24 -# accompanied this code. If applicable, add the following below the
  188.25 -# License Header, with the fields enclosed by brackets [] replaced by
  188.26 -# your own identifying information:
  188.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  188.28 -#
  188.29 -# Contributor(s):
  188.30 -#
  188.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  188.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  188.33 -# Microsystems, Inc. All Rights Reserved.
  188.34 -#
  188.35 -# If you wish your version of this file to be governed by only the CDDL
  188.36 -# or only the GPL Version 2, indicate your decision by adding
  188.37 -# "[Contributor] elects to include this software in this distribution
  188.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  188.39 -# single choice of license, a recipient has the option to distribute
  188.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  188.41 -# to extend the choice of license to its licensees as provided above.
  188.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  188.43 -# Version 2 license, then the option applies only if the new code is
  188.44 -# made subject to such option by the copyright holder.
  188.45 -OpenIDE-Module-Name=Jackpot 3.0 Refactoring Bridge
  188.46 -GenerateScriptPanel.generate.text=Generate Jackpot script for automatic upgrade
  188.47 -GenerateScriptPanel.makePrivate.text=Make existing element private
  188.48 -GenerateScriptPanel.deprecate.text=Deprecate existing element
   189.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/ExtraData.java	Sun Jan 08 20:10:08 2017 +0100
   189.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   189.3 @@ -1,58 +0,0 @@
   189.4 -/*
   189.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   189.6 - *
   189.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   189.8 - *
   189.9 - * The contents of this file are subject to the terms of either the GNU
  189.10 - * General Public License Version 2 only ("GPL") or the Common
  189.11 - * Development and Distribution License("CDDL") (collectively, the
  189.12 - * "License"). You may not use this file except in compliance with the
  189.13 - * License. You can obtain a copy of the License at
  189.14 - * http://www.netbeans.org/cddl-gplv2.html
  189.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  189.16 - * specific language governing permissions and limitations under the
  189.17 - * License.  When distributing the software, include this License Header
  189.18 - * Notice in each file and include the License file at
  189.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  189.20 - * particular file as subject to the "Classpath" exception as provided
  189.21 - * by Sun in the GPL Version 2 section of the License file that
  189.22 - * accompanied this code. If applicable, add the following below the
  189.23 - * License Header, with the fields enclosed by brackets [] replaced by
  189.24 - * your own identifying information:
  189.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  189.26 - *
  189.27 - * If you wish your version of this file to be governed by only the CDDL
  189.28 - * or only the GPL Version 2, indicate your decision by adding
  189.29 - * "[Contributor] elects to include this software in this distribution
  189.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  189.31 - * single choice of license, a recipient has the option to distribute
  189.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  189.33 - * to extend the choice of license to its licensees as provided above.
  189.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  189.35 - * Version 2 license, then the option applies only if the new code is
  189.36 - * made subject to such option by the copyright holder.
  189.37 - *
  189.38 - * Contributor(s):
  189.39 - *
  189.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  189.41 - */
  189.42 -
  189.43 -package org.netbeans.modules.jackpot30.refactoring;
  189.44 -
  189.45 -/**
  189.46 - *
  189.47 - * @author lahvac
  189.48 - */
  189.49 -public final class ExtraData {
  189.50 -
  189.51 -    public final boolean generateUpgradeScript;
  189.52 -    public final boolean makeOriginalPrivate;
  189.53 -    public final boolean makeOriginalDeprecated;
  189.54 -
  189.55 -    public ExtraData(boolean generateUpgradeScript, boolean makeOriginalPrivate, boolean makeOriginalDeprecated) {
  189.56 -        this.generateUpgradeScript = generateUpgradeScript;
  189.57 -        this.makeOriginalPrivate = makeOriginalPrivate;
  189.58 -        this.makeOriginalDeprecated = makeOriginalDeprecated;
  189.59 -    }
  189.60 -
  189.61 -}
   190.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/GenerateScriptPanel.form	Sun Jan 08 20:10:08 2017 +0100
   190.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   190.3 @@ -1,77 +0,0 @@
   190.4 -<?xml version="1.0" encoding="UTF-8" ?>
   190.5 -
   190.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
   190.7 -  <AuxValues>
   190.8 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
   190.9 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
  190.10 -    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
  190.11 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
  190.12 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
  190.13 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
  190.14 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
  190.15 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
  190.16 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
  190.17 -  </AuxValues>
  190.18 -
  190.19 -  <Layout>
  190.20 -    <DimensionLayout dim="0">
  190.21 -      <Group type="103" groupAlignment="0" attributes="0">
  190.22 -          <Group type="102" attributes="0">
  190.23 -              <Group type="103" groupAlignment="0" attributes="0">
  190.24 -                  <Group type="102" alignment="0" attributes="0">
  190.25 -                      <EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
  190.26 -                      <Group type="103" groupAlignment="0" attributes="0">
  190.27 -                          <Component id="deprecate" alignment="0" min="-2" max="-2" attributes="0"/>
  190.28 -                          <Component id="makePrivate" alignment="0" min="-2" max="-2" attributes="0"/>
  190.29 -                      </Group>
  190.30 -                  </Group>
  190.31 -                  <Group type="102" alignment="0" attributes="0">
  190.32 -                      <EmptySpace max="-2" attributes="0"/>
  190.33 -                      <Component id="generate" min="-2" max="-2" attributes="0"/>
  190.34 -                  </Group>
  190.35 -              </Group>
  190.36 -              <EmptySpace pref="79" max="32767" attributes="0"/>
  190.37 -          </Group>
  190.38 -      </Group>
  190.39 -    </DimensionLayout>
  190.40 -    <DimensionLayout dim="1">
  190.41 -      <Group type="103" groupAlignment="0" attributes="0">
  190.42 -          <Group type="102" alignment="0" attributes="0">
  190.43 -              <EmptySpace max="-2" attributes="0"/>
  190.44 -              <Component id="generate" min="-2" max="-2" attributes="0"/>
  190.45 -              <EmptySpace max="-2" attributes="0"/>
  190.46 -              <Component id="makePrivate" min="-2" max="-2" attributes="0"/>
  190.47 -              <EmptySpace max="-2" attributes="0"/>
  190.48 -              <Component id="deprecate" min="-2" max="-2" attributes="0"/>
  190.49 -              <EmptySpace pref="223" max="32767" attributes="0"/>
  190.50 -          </Group>
  190.51 -      </Group>
  190.52 -    </DimensionLayout>
  190.53 -  </Layout>
  190.54 -  <SubComponents>
  190.55 -    <Component class="javax.swing.JCheckBox" name="generate">
  190.56 -      <Properties>
  190.57 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  190.58 -          <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/Bundle.properties" key="GenerateScriptPanel.generate.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  190.59 -        </Property>
  190.60 -      </Properties>
  190.61 -      <Events>
  190.62 -        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="generateActionPerformed"/>
  190.63 -      </Events>
  190.64 -    </Component>
  190.65 -    <Component class="javax.swing.JCheckBox" name="makePrivate">
  190.66 -      <Properties>
  190.67 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  190.68 -          <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/Bundle.properties" key="GenerateScriptPanel.makePrivate.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  190.69 -        </Property>
  190.70 -      </Properties>
  190.71 -    </Component>
  190.72 -    <Component class="javax.swing.JCheckBox" name="deprecate">
  190.73 -      <Properties>
  190.74 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  190.75 -          <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/Bundle.properties" key="GenerateScriptPanel.deprecate.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  190.76 -        </Property>
  190.77 -      </Properties>
  190.78 -    </Component>
  190.79 -  </SubComponents>
  190.80 -</Form>
   191.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/GenerateScriptPanel.java	Sun Jan 08 20:10:08 2017 +0100
   191.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   191.3 @@ -1,174 +0,0 @@
   191.4 -/*
   191.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   191.6 - *
   191.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   191.8 - *
   191.9 - * The contents of this file are subject to the terms of either the GNU
  191.10 - * General Public License Version 2 only ("GPL") or the Common
  191.11 - * Development and Distribution License("CDDL") (collectively, the
  191.12 - * "License"). You may not use this file except in compliance with the
  191.13 - * License. You can obtain a copy of the License at
  191.14 - * http://www.netbeans.org/cddl-gplv2.html
  191.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  191.16 - * specific language governing permissions and limitations under the
  191.17 - * License.  When distributing the software, include this License Header
  191.18 - * Notice in each file and include the License file at
  191.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  191.20 - * particular file as subject to the "Classpath" exception as provided
  191.21 - * by Sun in the GPL Version 2 section of the License file that
  191.22 - * accompanied this code. If applicable, add the following below the
  191.23 - * License Header, with the fields enclosed by brackets [] replaced by
  191.24 - * your own identifying information:
  191.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  191.26 - *
  191.27 - * If you wish your version of this file to be governed by only the CDDL
  191.28 - * or only the GPL Version 2, indicate your decision by adding
  191.29 - * "[Contributor] elects to include this software in this distribution
  191.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  191.31 - * single choice of license, a recipient has the option to distribute
  191.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  191.33 - * to extend the choice of license to its licensees as provided above.
  191.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  191.35 - * Version 2 license, then the option applies only if the new code is
  191.36 - * made subject to such option by the copyright holder.
  191.37 - *
  191.38 - * Contributor(s):
  191.39 - *
  191.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  191.41 - */
  191.42 -package org.netbeans.modules.jackpot30.refactoring;
  191.43 -
  191.44 -import java.util.prefs.Preferences;
  191.45 -import org.openide.util.NbPreferences;
  191.46 -
  191.47 -/**
  191.48 - *
  191.49 - * @author lahvac
  191.50 - */
  191.51 -public class GenerateScriptPanel extends javax.swing.JPanel {
  191.52 -
  191.53 -    private final boolean supported;
  191.54 -
  191.55 -    public GenerateScriptPanel(boolean supported) {
  191.56 -        this.supported = supported;
  191.57 -        initComponents();
  191.58 -        loadDefaults();
  191.59 -    }
  191.60 -
  191.61 -    /** This method is called from within the constructor to
  191.62 -     * initialize the form.
  191.63 -     * WARNING: Do NOT modify this code. The content of this method is
  191.64 -     * always regenerated by the Form Editor.
  191.65 -     */
  191.66 -    @SuppressWarnings("unchecked")
  191.67 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  191.68 -    private void initComponents() {
  191.69 -
  191.70 -        generate = new javax.swing.JCheckBox();
  191.71 -        makePrivate = new javax.swing.JCheckBox();
  191.72 -        deprecate = new javax.swing.JCheckBox();
  191.73 -
  191.74 -        generate.setText(org.openide.util.NbBundle.getMessage(GenerateScriptPanel.class, "GenerateScriptPanel.generate.text")); // NOI18N
  191.75 -        generate.addActionListener(new java.awt.event.ActionListener() {
  191.76 -            public void actionPerformed(java.awt.event.ActionEvent evt) {
  191.77 -                generateActionPerformed(evt);
  191.78 -            }
  191.79 -        });
  191.80 -
  191.81 -        makePrivate.setText(org.openide.util.NbBundle.getMessage(GenerateScriptPanel.class, "GenerateScriptPanel.makePrivate.text")); // NOI18N
  191.82 -
  191.83 -        deprecate.setText(org.openide.util.NbBundle.getMessage(GenerateScriptPanel.class, "GenerateScriptPanel.deprecate.text")); // NOI18N
  191.84 -
  191.85 -        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  191.86 -        this.setLayout(layout);
  191.87 -        layout.setHorizontalGroup(
  191.88 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  191.89 -            .addGroup(layout.createSequentialGroup()
  191.90 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  191.91 -                    .addGroup(layout.createSequentialGroup()
  191.92 -                        .addGap(29, 29, 29)
  191.93 -                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  191.94 -                            .addComponent(deprecate)
  191.95 -                            .addComponent(makePrivate)))
  191.96 -                    .addGroup(layout.createSequentialGroup()
  191.97 -                        .addContainerGap()
  191.98 -                        .addComponent(generate)))
  191.99 -                .addContainerGap(79, Short.MAX_VALUE))
 191.100 -        );
 191.101 -        layout.setVerticalGroup(
 191.102 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 191.103 -            .addGroup(layout.createSequentialGroup()
 191.104 -                .addContainerGap()
 191.105 -                .addComponent(generate)
 191.106 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 191.107 -                .addComponent(makePrivate)
 191.108 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 191.109 -                .addComponent(deprecate)
 191.110 -                .addContainerGap(223, Short.MAX_VALUE))
 191.111 -        );
 191.112 -    }// </editor-fold>//GEN-END:initComponents
 191.113 -
 191.114 -    private void generateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateActionPerformed
 191.115 -        updateState();
 191.116 -    }//GEN-LAST:event_generateActionPerformed
 191.117 -
 191.118 -    private static final String KEY_DO_GENERATE_SCRIPT = "generate-script";
 191.119 -    private static final boolean DEF_DO_GENERATE_SCRIPT = true;
 191.120 -    private static final String KEY_MAKE_PRIVATE = "make-private";
 191.121 -    private static final boolean DEF_MAKE_PRIVATE = true;
 191.122 -    private static final String KEY_DEPRECATE = "deprecate";
 191.123 -    private static final boolean DEF_DEPRECATE = false;
 191.124 -    
 191.125 -    private Preferences getPreferencesStorage() {
 191.126 -        return NbPreferences.forModule(GenerateScriptPanel.class).node(GenerateScriptPanel.class.getSimpleName());
 191.127 -    }
 191.128 -
 191.129 -    private void loadDefaults() {
 191.130 -        if (supported) {
 191.131 -            Preferences p = getPreferencesStorage();
 191.132 -            generate.setSelected(p.getBoolean(KEY_DO_GENERATE_SCRIPT, DEF_DO_GENERATE_SCRIPT));
 191.133 -            makePrivate.setSelected(p.getBoolean(KEY_MAKE_PRIVATE, DEF_MAKE_PRIVATE));
 191.134 -            deprecate.setSelected(p.getBoolean(KEY_DEPRECATE, DEF_DEPRECATE));
 191.135 -        } else {
 191.136 -            generate.setSelected(false);
 191.137 -            makePrivate.setSelected(false);
 191.138 -            deprecate.setSelected(false);
 191.139 -        }
 191.140 -        
 191.141 -        updateState();
 191.142 -    }
 191.143 -
 191.144 -    public void saveDefaults() {
 191.145 -        Preferences p = getPreferencesStorage();
 191.146 -        boolean doGenerate = generate.isSelected();
 191.147 -
 191.148 -        p.putBoolean(KEY_DO_GENERATE_SCRIPT, doGenerate);
 191.149 -
 191.150 -        if (doGenerate) {
 191.151 -            p.putBoolean(KEY_MAKE_PRIVATE, makePrivate.isSelected());
 191.152 -            p.putBoolean(KEY_DEPRECATE, deprecate.isSelected());
 191.153 -        }
 191.154 -    }
 191.155 -
 191.156 -    private void updateState() {
 191.157 -        if (supported) {
 191.158 -            generate.setEnabled(true);
 191.159 -            makePrivate.setEnabled(generate.isSelected());
 191.160 -            deprecate.setEnabled(generate.isSelected());
 191.161 -        } else {
 191.162 -            generate.setEnabled(false);
 191.163 -            makePrivate.setEnabled(false);
 191.164 -            deprecate.setEnabled(false);
 191.165 -        }
 191.166 -    }
 191.167 -
 191.168 -    // Variables declaration - do not modify//GEN-BEGIN:variables
 191.169 -    private javax.swing.JCheckBox deprecate;
 191.170 -    private javax.swing.JCheckBox generate;
 191.171 -    private javax.swing.JCheckBox makePrivate;
 191.172 -    // End of variables declaration//GEN-END:variables
 191.173 -
 191.174 -    public ExtraData getData() {
 191.175 -        return new ExtraData(generate.isSelected(), makePrivate.isSelected(), deprecate.isSelected());
 191.176 -    }
 191.177 -}
   192.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringActionsProviderExt.java	Sun Jan 08 20:10:08 2017 +0100
   192.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   192.3 @@ -1,238 +0,0 @@
   192.4 -/*
   192.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   192.6 - *
   192.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   192.8 - *
   192.9 - * The contents of this file are subject to the terms of either the GNU
  192.10 - * General Public License Version 2 only ("GPL") or the Common
  192.11 - * Development and Distribution License("CDDL") (collectively, the
  192.12 - * "License"). You may not use this file except in compliance with the
  192.13 - * License. You can obtain a copy of the License at
  192.14 - * http://www.netbeans.org/cddl-gplv2.html
  192.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  192.16 - * specific language governing permissions and limitations under the
  192.17 - * License.  When distributing the software, include this License Header
  192.18 - * Notice in each file and include the License file at
  192.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  192.20 - * particular file as subject to the "Classpath" exception as provided
  192.21 - * by Sun in the GPL Version 2 section of the License file that
  192.22 - * accompanied this code. If applicable, add the following below the
  192.23 - * License Header, with the fields enclosed by brackets [] replaced by
  192.24 - * your own identifying information:
  192.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  192.26 - *
  192.27 - * If you wish your version of this file to be governed by only the CDDL
  192.28 - * or only the GPL Version 2, indicate your decision by adding
  192.29 - * "[Contributor] elects to include this software in this distribution
  192.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  192.31 - * single choice of license, a recipient has the option to distribute
  192.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  192.33 - * to extend the choice of license to its licensees as provided above.
  192.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  192.35 - * Version 2 license, then the option applies only if the new code is
  192.36 - * made subject to such option by the copyright holder.
  192.37 - *
  192.38 - * Contributor(s):
  192.39 - *
  192.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  192.41 - */
  192.42 -package org.netbeans.modules.jackpot30.refactoring;
  192.43 -
  192.44 -import java.util.Collection;
  192.45 -import java.util.HashSet;
  192.46 -import java.util.logging.Logger;
  192.47 -import javax.lang.model.element.Element;
  192.48 -import javax.lang.model.element.ElementKind;
  192.49 -import javax.lang.model.element.ExecutableElement;
  192.50 -import javax.lang.model.element.VariableElement;
  192.51 -import javax.lang.model.type.TypeKind;
  192.52 -import org.netbeans.api.java.source.CompilationInfo;
  192.53 -import org.netbeans.api.java.source.TreePathHandle;
  192.54 -import org.netbeans.api.java.source.ui.ScanDialog;
  192.55 -import org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanRefactoringUI;
  192.56 -import org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorRefactoringUI;
  192.57 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
  192.58 -import org.netbeans.modules.refactoring.java.RefactoringUtils;
  192.59 -import org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider;
  192.60 -import org.netbeans.modules.refactoring.spi.ui.ActionsImplementationProvider;
  192.61 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
  192.62 -import org.openide.cookies.EditorCookie;
  192.63 -import org.openide.filesystems.FileObject;
  192.64 -import org.openide.loaders.DataObject;
  192.65 -import org.openide.nodes.Node;
  192.66 -import org.openide.text.CloneableEditorSupport;
  192.67 -import org.openide.util.Lookup;
  192.68 -import org.openide.util.lookup.ServiceProvider;
  192.69 -import org.openide.windows.TopComponent;
  192.70 -
  192.71 -
  192.72 -/**
  192.73 - *
  192.74 - * @author lahvac
  192.75 - */
  192.76 -@ServiceProvider(service=ActionsImplementationProvider.class, supersedes="org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider")
  192.77 -public class RefactoringActionsProviderExt extends RefactoringActionsProvider {
  192.78 -
  192.79 -    private static RefactoringUI doReplaceConstructorImpl(TreePathHandle selectedElement, CompilationInfo info) {
  192.80 -        Element selected = selectedElement.resolveElement(info);
  192.81 -        if (selected==null) {
  192.82 -//            logger().log(Level.INFO, "doRename: " + selectedElement, new NullPointerException("selected")); // NOI18N
  192.83 -            return null;
  192.84 -        }
  192.85 -        if (selected.getKind() == ElementKind.CONSTRUCTOR) {
  192.86 -            return new ReplaceConstructorRefactoringUI(selectedElement);
  192.87 -        }
  192.88 -
  192.89 -        return null;
  192.90 -    }
  192.91 -
  192.92 -    public static void doReplaceConstructor(final Lookup lookup) {
  192.93 -        Runnable task;
  192.94 -        EditorCookie ec = lookup.lookup(EditorCookie.class);
  192.95 -        if (isFromEditor(ec)) {
  192.96 -            task = new TextComponentTask(ec) {
  192.97 -                @Override
  192.98 -                protected RefactoringUI createRefactoringUI(TreePathHandle selectedElement,int startOffset,int endOffset, final CompilationInfo info) {
  192.99 -                    return doReplaceConstructorImpl(selectedElement, info);
 192.100 -                }
 192.101 -            };
 192.102 -        } else {
 192.103 -            task = new TreePathHandleTask(new HashSet<Node>(lookup.lookupAll(Node.class)), true) {
 192.104 -
 192.105 -                RefactoringUI ui;
 192.106 -
 192.107 -                @Override
 192.108 -                protected void treePathHandleResolved(TreePathHandle handle, CompilationInfo javac) {
 192.109 -                    ui = doReplaceConstructorImpl(handle, javac);
 192.110 -                }
 192.111 -
 192.112 -                @Override
 192.113 -                protected RefactoringUI createRefactoringUI(Collection<TreePathHandle> handles) {
 192.114 -                    return ui;
 192.115 -                }
 192.116 -
 192.117 -            };
 192.118 -        }
 192.119 -        
 192.120 -        ScanDialog.runWhenScanFinished(task, "Remove Constructor");//getActionName(RefactoringActionsFactory.renameAction()));
 192.121 -    }
 192.122 -
 192.123 -    private static RefactoringUI doInvertBooleanImpl(TreePathHandle selectedElement, CompilationInfo info) {
 192.124 -        Element selected = selectedElement.resolveElement(info);
 192.125 -        if (selected==null) {
 192.126 -//            logger().log(Level.INFO, "doRename: " + selectedElement, new NullPointerException("selected")); // NOI18N
 192.127 -            return null;
 192.128 -        }
 192.129 -        if (selected.getKind().isField() && ((VariableElement) selected).asType().getKind() == TypeKind.BOOLEAN) {
 192.130 -            return new InvertBooleanRefactoringUI(selectedElement, ((VariableElement) selected).getSimpleName().toString());
 192.131 -        }
 192.132 -        if (selected.getKind() == ElementKind.METHOD && ((ExecutableElement) selected).getReturnType().getKind() == TypeKind.BOOLEAN) {
 192.133 -            return new InvertBooleanRefactoringUI(selectedElement, ((ExecutableElement) selected).getSimpleName().toString());
 192.134 -        }
 192.135 -
 192.136 -        return null;
 192.137 -    }
 192.138 -
 192.139 -    public static void doInvertBoolean(final Lookup lookup) {
 192.140 -        Runnable task;
 192.141 -        EditorCookie ec = lookup.lookup(EditorCookie.class);
 192.142 -        if (isFromEditor(ec)) {
 192.143 -            task = new TextComponentTask(ec) {
 192.144 -                @Override
 192.145 -                protected RefactoringUI createRefactoringUI(TreePathHandle selectedElement,int startOffset,int endOffset, final CompilationInfo info) {
 192.146 -                    return doInvertBooleanImpl(selectedElement, info);
 192.147 -                }
 192.148 -            };
 192.149 -        } else {
 192.150 -            task = new TreePathHandleTask(new HashSet<Node>(lookup.lookupAll(Node.class)), true) {
 192.151 -
 192.152 -                RefactoringUI ui;
 192.153 -
 192.154 -                @Override
 192.155 -                protected void treePathHandleResolved(TreePathHandle handle, CompilationInfo javac) {
 192.156 -                    ui = doInvertBooleanImpl(handle, javac);
 192.157 -                }
 192.158 -
 192.159 -                @Override
 192.160 -                protected RefactoringUI createRefactoringUI(Collection<TreePathHandle> handles) {
 192.161 -                    return ui;
 192.162 -                }
 192.163 -
 192.164 -            };
 192.165 -        }
 192.166 -
 192.167 -        ScanDialog.runWhenScanFinished(task, "Remove Constructor");//getActionName(RefactoringActionsFactory.renameAction()));
 192.168 -    }
 192.169 -
 192.170 -//    static String getActionName(Action action) {
 192.171 -//        String arg = (String) action.getValue(Action.NAME);
 192.172 -//        arg = arg.replace("&", ""); // NOI18N
 192.173 -//        return arg.replace("...", ""); // NOI18N
 192.174 -//    }
 192.175 -
 192.176 -
 192.177 -    public static boolean canReplaceConstructor(Lookup lookup) {
 192.178 -        return canRefactor(lookup);
 192.179 -    }
 192.180 -
 192.181 -    public static boolean canInvertBoolean(Lookup lookup) {
 192.182 -        return canRefactor(lookup);
 192.183 -    }
 192.184 -
 192.185 -    private static boolean canRefactor(Lookup lookup) {
 192.186 -        Collection<? extends Node> nodes = new HashSet<Node>(lookup.lookupAll(Node.class));
 192.187 -        if(nodes.size() != 1)
 192.188 -            return false;
 192.189 -        Node node = nodes.iterator().next();
 192.190 -        TreePathHandle tph = node.getLookup().lookup(TreePathHandle.class);
 192.191 -        if (tph != null) {
 192.192 -            return RefactoringUtils.isRefactorable(tph.getFileObject());
 192.193 -        }
 192.194 -        DataObject dObj = node.getCookie(DataObject.class);
 192.195 -        if(null == dObj)
 192.196 -            return false;
 192.197 -        FileObject fileObj = dObj.getPrimaryFile();
 192.198 -        if(null == fileObj || !RefactoringUtils.isRefactorable(fileObj))
 192.199 -            return false;
 192.200 -
 192.201 -        EditorCookie ec = lookup.lookup(EditorCookie.class);
 192.202 -        if (isFromEditor(ec)) {
 192.203 -            return true;
 192.204 -        }
 192.205 -        return false;
 192.206 -    }
 192.207 -
 192.208 -    @Override
 192.209 -    protected RefactoringUI wrap(RefactoringUI orig) {
 192.210 -        if (orig.getRefactoring() instanceof RenameRefactoring) {
 192.211 -            return new RenameRefactoringWrapper(orig, ((RenameRefactoring) orig.getRefactoring()));
 192.212 -        }
 192.213 -        
 192.214 -        return super.wrap(orig);
 192.215 -    }
 192.216 -
 192.217 -
 192.218 -    //XXX: copied from RefactoringActionsProvider:\
 192.219 -    static boolean isFromEditor(EditorCookie ec) {
 192.220 -        if (ec != null && ec.getOpenedPanes() != null) {
 192.221 -            TopComponent activetc = TopComponent.getRegistry().getActivated();
 192.222 -            if (activetc instanceof CloneableEditorSupport.Pane) {
 192.223 -                return true;
 192.224 -            }
 192.225 -        }
 192.226 -        return false;
 192.227 -    }
 192.228 -
 192.229 -    static boolean nodeHandle(Lookup lookup) {
 192.230 -        Node n = lookup.lookup(Node.class);
 192.231 -        if (n!=null) {
 192.232 -            if (n.getLookup().lookup(TreePathHandle.class)!=null)
 192.233 -                return true;
 192.234 -        }
 192.235 -        return false;
 192.236 -    }
 192.237 -
 192.238 -    private static Logger logger() {
 192.239 -        return Logger.getLogger(RefactoringActionsProvider.class.getName());
 192.240 -    }
 192.241 -}
   193.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringElementImpl.java	Sun Jan 08 20:10:08 2017 +0100
   193.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   193.3 @@ -1,227 +0,0 @@
   193.4 -/*
   193.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   193.6 - *
   193.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   193.8 - *
   193.9 - * The contents of this file are subject to the terms of either the GNU
  193.10 - * General Public License Version 2 only ("GPL") or the Common
  193.11 - * Development and Distribution License("CDDL") (collectively, the
  193.12 - * "License"). You may not use this file except in compliance with the
  193.13 - * License. You can obtain a copy of the License at
  193.14 - * http://www.netbeans.org/cddl-gplv2.html
  193.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  193.16 - * specific language governing permissions and limitations under the
  193.17 - * License.  When distributing the software, include this License Header
  193.18 - * Notice in each file and include the License file at
  193.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  193.20 - * particular file as subject to the "Classpath" exception as provided
  193.21 - * by Sun in the GPL Version 2 section of the License file that
  193.22 - * accompanied this code. If applicable, add the following below the
  193.23 - * License Header, with the fields enclosed by brackets [] replaced by
  193.24 - * your own identifying information:
  193.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  193.26 - *
  193.27 - * If you wish your version of this file to be governed by only the CDDL
  193.28 - * or only the GPL Version 2, indicate your decision by adding
  193.29 - * "[Contributor] elects to include this software in this distribution
  193.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  193.31 - * single choice of license, a recipient has the option to distribute
  193.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  193.33 - * to extend the choice of license to its licensees as provided above.
  193.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  193.35 - * Version 2 license, then the option applies only if the new code is
  193.36 - * made subject to such option by the copyright holder.
  193.37 - *
  193.38 - * Contributor(s):
  193.39 - *
  193.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  193.41 - */
  193.42 -
  193.43 -package org.netbeans.modules.jackpot30.refactoring;
  193.44 -
  193.45 -import java.io.File;
  193.46 -import java.io.FileInputStream;
  193.47 -import java.io.IOException;
  193.48 -import java.io.InputStreamReader;
  193.49 -import java.io.OutputStreamWriter;
  193.50 -import java.io.Reader;
  193.51 -import java.io.Writer;
  193.52 -import java.nio.charset.Charset;
  193.53 -import org.netbeans.api.queries.FileEncodingQuery;
  193.54 -import org.netbeans.modules.refactoring.spi.BackupFacility;
  193.55 -import org.netbeans.modules.refactoring.spi.BackupFacility.Handle;
  193.56 -import org.netbeans.modules.refactoring.spi.SimpleRefactoringElementImplementation;
  193.57 -import org.openide.filesystems.FileObject;
  193.58 -import org.openide.filesystems.FileUtil;
  193.59 -import org.openide.text.PositionBounds;
  193.60 -import org.openide.util.Exceptions;
  193.61 -import org.openide.util.Lookup;
  193.62 -
  193.63 -/**
  193.64 - *
  193.65 - * @author lahvac
  193.66 - */
  193.67 -public class RefactoringElementImpl extends SimpleRefactoringElementImplementation {
  193.68 -
  193.69 -    private final File target;
  193.70 -    private final String rule;
  193.71 -
  193.72 -    public RefactoringElementImpl(File target, String rule) {
  193.73 -        this.target = target;
  193.74 -        this.rule = rule;
  193.75 -    }
  193.76 -
  193.77 -    @Override
  193.78 -    public String getText() {
  193.79 -        return "Jackpot 3.0 rule";
  193.80 -    }
  193.81 -
  193.82 -    @Override
  193.83 -    public String getDisplayText() {
  193.84 -        return "Jackpot 3.0 rule";
  193.85 -    }
  193.86 -
  193.87 -    private Handle backup;
  193.88 -
  193.89 -    @Override
  193.90 -    public void performChange() {
  193.91 -        try {
  193.92 -            FileObject fo = FileUtil.toFileObject(target);
  193.93 -            Charset encoding = FileEncodingQuery.getEncoding(getParentFile());
  193.94 -            String current;
  193.95 -
  193.96 -            if (fo != null) {
  193.97 -                backup = BackupFacility.getDefault().backup(fo);
  193.98 -                current = read(target, encoding).toString();
  193.99 -            } else {
 193.100 -                if (!target.exists()) {
 193.101 -                    backup = new Handle() {
 193.102 -                        @Override
 193.103 -                        public void restore() throws IOException {
 193.104 -                            FileObject fo = FileUtil.toFileObject(target);
 193.105 -
 193.106 -                            fo.delete();
 193.107 -                        }
 193.108 -                    };
 193.109 -                    current = "";
 193.110 -                } else {
 193.111 -                    //XXX: log
 193.112 -                    current = read(target, encoding).toString();
 193.113 -                }
 193.114 -            }
 193.115 -
 193.116 -            current += rule;
 193.117 -            current += "\n";
 193.118 -
 193.119 -            write(target, encoding, current);
 193.120 -        } catch (IOException ex) {
 193.121 -            Exceptions.printStackTrace(ex);
 193.122 -        }
 193.123 -    }
 193.124 -
 193.125 -    @Override
 193.126 -    public void undoChange() {
 193.127 -        if (backup != null) {
 193.128 -            try {
 193.129 -                backup.restore();
 193.130 -            } catch (IOException ex) {
 193.131 -                Exceptions.printStackTrace(ex);
 193.132 -            }
 193.133 -        }
 193.134 -        backup = null;
 193.135 -    }
 193.136 -
 193.137 -    @Override
 193.138 -    protected String getNewFileContent() {
 193.139 -        try {
 193.140 -            Charset encoding = FileEncodingQuery.getEncoding(getParentFile());
 193.141 -            String current;
 193.142 -
 193.143 -            if (!target.exists()) {
 193.144 -                current = "";
 193.145 -            } else {
 193.146 -                //XXX: log
 193.147 -                current = read(target, encoding).toString();
 193.148 -            }
 193.149 -
 193.150 -            current += rule;
 193.151 -            current += "\n";
 193.152 -
 193.153 -            return current;
 193.154 -        } catch (IOException ex) {
 193.155 -            Exceptions.printStackTrace(ex);
 193.156 -            return null;
 193.157 -        }
 193.158 -    }
 193.159 -
 193.160 -    @Override
 193.161 -    public Lookup getLookup() {
 193.162 -        return Lookup.EMPTY;
 193.163 -    }
 193.164 -
 193.165 -    @Override
 193.166 -    public FileObject getParentFile() {
 193.167 -        File f = target;
 193.168 -
 193.169 -        while (true) {
 193.170 -            FileObject fo = FileUtil.toFileObject(f);
 193.171 -
 193.172 -            if (fo != null) {
 193.173 -                return fo;
 193.174 -            }
 193.175 -
 193.176 -            f = f.getParentFile();
 193.177 -        }
 193.178 -    }
 193.179 -
 193.180 -    @Override
 193.181 -    public PositionBounds getPosition() {
 193.182 -        //XXX:
 193.183 -        return null;
 193.184 -    }
 193.185 -
 193.186 -    private CharSequence read(File f, Charset encoding) throws IOException {
 193.187 -        Reader in = null;
 193.188 -        StringBuilder result = new StringBuilder();
 193.189 -
 193.190 -        try {
 193.191 -            in = new InputStreamReader(new FileInputStream(f), encoding);
 193.192 -
 193.193 -            int r;
 193.194 -
 193.195 -            while ((r = in.read()) != (-1)) {
 193.196 -                result.append((char) r);
 193.197 -            }
 193.198 -        } finally {
 193.199 -            if (in != null) {
 193.200 -                try {
 193.201 -                    in.close();
 193.202 -                } catch (IOException ex) {
 193.203 -                    Exceptions.printStackTrace(ex);
 193.204 -                }
 193.205 -            }
 193.206 -        }
 193.207 -
 193.208 -        return result;
 193.209 -    }
 193.210 -
 193.211 -    private void write(File f, Charset encoding, CharSequence text) throws IOException {
 193.212 -        Writer out = null;
 193.213 -
 193.214 -        try {
 193.215 -            FileObject fo = FileUtil.createData(f);
 193.216 -            out = new OutputStreamWriter(fo.getOutputStream(), encoding);
 193.217 -
 193.218 -            out.write(text.toString());
 193.219 -        } finally {
 193.220 -            if (out != null) {
 193.221 -                try {
 193.222 -                    out.close();
 193.223 -                } catch (IOException ex) {
 193.224 -                    Exceptions.printStackTrace(ex);
 193.225 -                }
 193.226 -            }
 193.227 -        }
 193.228 -    }
 193.229 -
 193.230 -}
   194.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringPluginFactoryImpl.java	Sun Jan 08 20:10:08 2017 +0100
   194.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   194.3 @@ -1,75 +0,0 @@
   194.4 -/*
   194.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   194.6 - *
   194.7 - * Copyright 2008-2010 Sun Microsystems, Inc. All rights reserved.
   194.8 - *
   194.9 - * The contents of this file are subject to the terms of either the GNU
  194.10 - * General Public License Version 2 only ("GPL") or the Common
  194.11 - * Development and Distribution License("CDDL") (collectively, the
  194.12 - * "License"). You may not use this file except in compliance with the
  194.13 - * License. You can obtain a copy of the License at
  194.14 - * http://www.netbeans.org/cddl-gplv2.html
  194.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  194.16 - * specific language governing permissions and limitations under the
  194.17 - * License.  When distributing the software, include this License Header
  194.18 - * Notice in each file and include the License file at
  194.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  194.20 - * particular file as subject to the "Classpath" exception as provided
  194.21 - * by Sun in the GPL Version 2 section of the License file that
  194.22 - * accompanied this code. If applicable, add the following below the
  194.23 - * License Header, with the fields enclosed by brackets [] replaced by
  194.24 - * your own identifying information:
  194.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  194.26 - *
  194.27 - * If you wish your version of this file to be governed by only the CDDL
  194.28 - * or only the GPL Version 2, indicate your decision by adding
  194.29 - * "[Contributor] elects to include this software in this distribution
  194.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  194.31 - * single choice of license, a recipient has the option to distribute
  194.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  194.33 - * to extend the choice of license to its licensees as provided above.
  194.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  194.35 - * Version 2 license, then the option applies only if the new code is
  194.36 - * made subject to such option by the copyright holder.
  194.37 - *
  194.38 - * Contributor(s):
  194.39 - *
  194.40 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  194.41 - */
  194.42 -
  194.43 -package org.netbeans.modules.jackpot30.refactoring;
  194.44 -
  194.45 -import org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanRefactoring;
  194.46 -import org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanRefactoringPluginImpl;
  194.47 -import org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorRefactoring;
  194.48 -import org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorRefactoringPluginImpl;
  194.49 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
  194.50 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
  194.51 -import org.netbeans.modules.refactoring.spi.RefactoringPlugin;
  194.52 -import org.netbeans.modules.refactoring.spi.RefactoringPluginFactory;
  194.53 -import org.openide.util.lookup.ServiceProvider;
  194.54 -
  194.55 -/**
  194.56 - *
  194.57 - * @author Jan Lahoda
  194.58 - */
  194.59 -@ServiceProvider(service=RefactoringPluginFactory.class)
  194.60 -public class RefactoringPluginFactoryImpl implements RefactoringPluginFactory {
  194.61 -
  194.62 -    public RefactoringPlugin createInstance(AbstractRefactoring refactoring) {
  194.63 -        if (refactoring instanceof RenameRefactoring) {
  194.64 -            return new RenameRefactoringPluginImpl((RenameRefactoring) refactoring);
  194.65 -        }
  194.66 -
  194.67 -        if (refactoring instanceof ReplaceConstructorRefactoring) {
  194.68 -            return new ReplaceConstructorRefactoringPluginImpl((ReplaceConstructorRefactoring) refactoring);
  194.69 -        }
  194.70 -
  194.71 -        if (refactoring instanceof InvertBooleanRefactoring) {
  194.72 -            return new InvertBooleanRefactoringPluginImpl((InvertBooleanRefactoring) refactoring);
  194.73 -        }
  194.74 -
  194.75 -        return null;
  194.76 -    }
  194.77 -
  194.78 -}
   195.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringPluginImpl.java	Sun Jan 08 20:10:08 2017 +0100
   195.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   195.3 @@ -1,209 +0,0 @@
   195.4 -/*
   195.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   195.6 - *
   195.7 - * Copyright 2008-2010 Sun Microsystems, Inc. All rights reserved.
   195.8 - *
   195.9 - * The contents of this file are subject to the terms of either the GNU
  195.10 - * General Public License Version 2 only ("GPL") or the Common
  195.11 - * Development and Distribution License("CDDL") (collectively, the
  195.12 - * "License"). You may not use this file except in compliance with the
  195.13 - * License. You can obtain a copy of the License at
  195.14 - * http://www.netbeans.org/cddl-gplv2.html
  195.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  195.16 - * specific language governing permissions and limitations under the
  195.17 - * License.  When distributing the software, include this License Header
  195.18 - * Notice in each file and include the License file at
  195.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  195.20 - * particular file as subject to the "Classpath" exception as provided
  195.21 - * by Sun in the GPL Version 2 section of the License file that
  195.22 - * accompanied this code. If applicable, add the following below the
  195.23 - * License Header, with the fields enclosed by brackets [] replaced by
  195.24 - * your own identifying information:
  195.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  195.26 - *
  195.27 - * If you wish your version of this file to be governed by only the CDDL
  195.28 - * or only the GPL Version 2, indicate your decision by adding
  195.29 - * "[Contributor] elects to include this software in this distribution
  195.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  195.31 - * single choice of license, a recipient has the option to distribute
  195.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  195.33 - * to extend the choice of license to its licensees as provided above.
  195.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  195.35 - * Version 2 license, then the option applies only if the new code is
  195.36 - * made subject to such option by the copyright holder.
  195.37 - *
  195.38 - * Contributor(s):
  195.39 - *
  195.40 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
  195.41 - */
  195.42 -
  195.43 -package org.netbeans.modules.jackpot30.refactoring;
  195.44 -
  195.45 -import com.sun.source.tree.BlockTree;
  195.46 -import com.sun.source.tree.ClassTree;
  195.47 -import com.sun.source.tree.ExpressionTree;
  195.48 -import com.sun.source.tree.MethodInvocationTree;
  195.49 -import com.sun.source.tree.MethodTree;
  195.50 -import com.sun.source.tree.ModifiersTree;
  195.51 -import com.sun.source.tree.StatementTree;
  195.52 -import com.sun.source.tree.VariableTree;
  195.53 -import com.sun.source.util.TreePath;
  195.54 -import java.io.File;
  195.55 -import java.util.Collections;
  195.56 -import java.util.EnumSet;
  195.57 -import java.util.LinkedList;
  195.58 -import java.util.List;
  195.59 -import java.util.Set;
  195.60 -import javax.lang.model.element.Element;
  195.61 -import javax.lang.model.element.ElementKind;
  195.62 -import javax.lang.model.element.ExecutableElement;
  195.63 -import javax.lang.model.element.Modifier;
  195.64 -import javax.lang.model.element.TypeElement;
  195.65 -import javax.lang.model.type.TypeKind;
  195.66 -import org.netbeans.api.java.source.CancellableTask;
  195.67 -import org.netbeans.api.java.source.ClasspathInfo.PathKind;
  195.68 -import org.netbeans.api.java.source.JavaSource;
  195.69 -import org.netbeans.api.java.source.TreeMaker;
  195.70 -import org.netbeans.api.java.source.TreePathHandle;
  195.71 -import org.netbeans.api.java.source.WorkingCopy;
  195.72 -import org.netbeans.modules.refactoring.api.Problem;
  195.73 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
  195.74 -import org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin;
  195.75 -import org.netbeans.modules.refactoring.spi.RefactoringElementsBag;
  195.76 -import org.openide.filesystems.FileObject;
  195.77 -import org.openide.filesystems.FileUtil;
  195.78 -import org.openide.util.Lookup;
  195.79 -
  195.80 -/**
  195.81 - *
  195.82 - * @author Jan Lahoda
  195.83 - */
  195.84 -public class RenameRefactoringPluginImpl extends JavaRefactoringPlugin {
  195.85 -
  195.86 -    private final RenameRefactoring rr;
  195.87 -
  195.88 -    public RenameRefactoringPluginImpl(RenameRefactoring rr) {
  195.89 -        this.rr = rr;
  195.90 -    }
  195.91 -
  195.92 -    @Override
  195.93 -    public Problem preCheck() {
  195.94 -        return null;
  195.95 -    }
  195.96 -
  195.97 -    @Override
  195.98 -    public Problem checkParameters() {
  195.99 -        return null;
 195.100 -    }
 195.101 -
 195.102 -    @Override
 195.103 -    public Problem fastCheckParameters() {
 195.104 -        return null;
 195.105 -    }
 195.106 -
 195.107 -    @Override
 195.108 -    public void cancelRequest() {
 195.109 -    }
 195.110 -
 195.111 -    public Problem prepare(final RefactoringElementsBag refactoringElements) {
 195.112 -        final ExtraData data = rr.getContext().lookup(ExtraData.class);
 195.113 -
 195.114 -        if (data == null || !data.generateUpgradeScript) {
 195.115 -            return null;
 195.116 -        }
 195.117 -        
 195.118 -        Lookup source = rr.getRefactoringSource();
 195.119 -        final TreePathHandle toRename = source.lookup(TreePathHandle.class);
 195.120 -
 195.121 -        if (toRename == null) {
 195.122 -            return null;
 195.123 -        }
 195.124 -        
 195.125 -        JavaSource js = JavaSource.forFileObject(toRename.getFileObject());
 195.126 -
 195.127 -        if (js != null) {
 195.128 -            CancellableTask<WorkingCopy> work = new CancellableTask<WorkingCopy>() {
 195.129 -                public void run(WorkingCopy parameter) throws Exception {
 195.130 -                    parameter.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED);
 195.131 -                    TreePath tp = toRename.resolve(parameter);
 195.132 -
 195.133 -                    if (tp == null) {
 195.134 -                        return ;
 195.135 -                    }
 195.136 -
 195.137 -                    Element e = parameter.getTrees().getElement(tp);
 195.138 -
 195.139 -                    if (e == null || e.getKind() != ElementKind.METHOD) {
 195.140 -                        return ;
 195.141 -                    }
 195.142 -
 195.143 -                    MethodTree m = (MethodTree) tp.getLeaf();
 195.144 -                    ClassTree ct = (ClassTree) tp.getParentPath().getLeaf();
 195.145 -
 195.146 -                    TreeMaker make = parameter.getTreeMaker();
 195.147 -
 195.148 -                    List<ExpressionTree> args = new LinkedList<ExpressionTree>();
 195.149 -
 195.150 -                    for (VariableTree vt : m.getParameters()) {
 195.151 -                        args.add(make.Identifier(vt.getName()));
 195.152 -                    }
 195.153 -
 195.154 -                    MethodInvocationTree mit = make.MethodInvocation(Collections.<ExpressionTree>emptyList(), make.Identifier(rr.getNewName()), args);
 195.155 -
 195.156 -                    StatementTree invoke;
 195.157 -
 195.158 -                    if (((ExecutableElement) e).getReturnType().getKind() == TypeKind.VOID) {
 195.159 -                        invoke = make.ExpressionStatement(mit);
 195.160 -                    } else {
 195.161 -                        invoke = make.Return(mit);
 195.162 -                    }
 195.163 -                    
 195.164 -                    BlockTree body = make.Block(Collections.<StatementTree>singletonList(invoke), false);
 195.165 -//                    ModifiersTree mods = make.addModifiersAnnotation(m.getModifiers(), constructTransformation(parameter, make, rr.getNewName(), (ExecutableElement) e));
 195.166 -                    ModifiersTree mods = m.getModifiers();
 195.167 -
 195.168 -                    if (data.makeOriginalDeprecated) {
 195.169 -                        mods = make.addModifiersAnnotation(mods, make.Annotation(make.QualIdent(parameter.getElements().getTypeElement("java.lang.Deprecated")), Collections.<ExpressionTree>emptyList()));
 195.170 -                    }
 195.171 -
 195.172 -                    if (data.makeOriginalPrivate) {
 195.173 -                        Set<Modifier> modSet = EnumSet.noneOf(Modifier.class);
 195.174 -
 195.175 -                        modSet.addAll(mods.getFlags());
 195.176 -                        modSet.removeAll(EnumSet.of(Modifier.PUBLIC, Modifier.PROTECTED));
 195.177 -                        modSet.add(Modifier.PRIVATE);
 195.178 -
 195.179 -                        mods = make.Modifiers(modSet, mods.getAnnotations());
 195.180 -                    }
 195.181 -
 195.182 -                    MethodTree nue = make.Method(mods, m.getName(), m.getReturnType(), m.getTypeParameters(), m.getParameters(), m.getThrows(), body, null);
 195.183 -
 195.184 -                    ClassTree nueClass = make.insertClassMember(ct, ct.getMembers().indexOf(m), nue);
 195.185 -
 195.186 -                    parameter.rewrite(ct, nueClass);
 195.187 -
 195.188 -                    FileObject root = parameter.getClasspathInfo().getClassPath(PathKind.SOURCE).findOwnerRoot(parameter.getFileObject());
 195.189 -
 195.190 -                    if (root != null) {
 195.191 -                        File f = FileUtil.toFile(root);
 195.192 -                        String rule = ScriptGenerator.constructRenameRule(parameter, rr.getNewName(), e);
 195.193 -                        File ruleFile = new File(f, "META-INF/upgrade/" + ((TypeElement) e.getEnclosingElement()).getQualifiedName().toString() + ".hint");
 195.194 -                        
 195.195 -                        refactoringElements.add(rr, new RefactoringElementImpl( ruleFile, rule));
 195.196 -                    }
 195.197 -                }
 195.198 -                public void cancel() {}
 195.199 -            };
 195.200 -
 195.201 -            createAndAddElements(Collections.singleton(toRename.getFileObject()), work, refactoringElements, rr);
 195.202 -        }
 195.203 -
 195.204 -        return null;
 195.205 -    }
 195.206 -
 195.207 -    @Override
 195.208 -    protected JavaSource getJavaSource(Phase p) {
 195.209 -        return null;
 195.210 -    }
 195.211 -
 195.212 -}
   196.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringWrapper.java	Sun Jan 08 20:10:08 2017 +0100
   196.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   196.3 @@ -1,162 +0,0 @@
   196.4 -/*
   196.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   196.6 - *
   196.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   196.8 - *
   196.9 - * The contents of this file are subject to the terms of either the GNU
  196.10 - * General Public License Version 2 only ("GPL") or the Common
  196.11 - * Development and Distribution License("CDDL") (collectively, the
  196.12 - * "License"). You may not use this file except in compliance with the
  196.13 - * License. You can obtain a copy of the License at
  196.14 - * http://www.netbeans.org/cddl-gplv2.html
  196.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  196.16 - * specific language governing permissions and limitations under the
  196.17 - * License.  When distributing the software, include this License Header
  196.18 - * Notice in each file and include the License file at
  196.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  196.20 - * particular file as subject to the "Classpath" exception as provided
  196.21 - * by Sun in the GPL Version 2 section of the License file that
  196.22 - * accompanied this code. If applicable, add the following below the
  196.23 - * License Header, with the fields enclosed by brackets [] replaced by
  196.24 - * your own identifying information:
  196.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  196.26 - *
  196.27 - * If you wish your version of this file to be governed by only the CDDL
  196.28 - * or only the GPL Version 2, indicate your decision by adding
  196.29 - * "[Contributor] elects to include this software in this distribution
  196.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  196.31 - * single choice of license, a recipient has the option to distribute
  196.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  196.33 - * to extend the choice of license to its licensees as provided above.
  196.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  196.35 - * Version 2 license, then the option applies only if the new code is
  196.36 - * made subject to such option by the copyright holder.
  196.37 - *
  196.38 - * Contributor(s):
  196.39 - *
  196.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  196.41 - */
  196.42 -
  196.43 -package org.netbeans.modules.jackpot30.refactoring;
  196.44 -
  196.45 -import com.sun.source.tree.Tree.Kind;
  196.46 -import java.awt.BorderLayout;
  196.47 -import java.awt.Component;
  196.48 -import javax.swing.JComponent;
  196.49 -import javax.swing.JPanel;
  196.50 -import javax.swing.border.EmptyBorder;
  196.51 -import javax.swing.event.ChangeListener;
  196.52 -import org.netbeans.api.java.source.TreePathHandle;
  196.53 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
  196.54 -import org.netbeans.modules.refactoring.api.Problem;
  196.55 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
  196.56 -import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
  196.57 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
  196.58 -import org.openide.util.HelpCtx;
  196.59 -import org.openide.util.Lookup;
  196.60 -
  196.61 -/**
  196.62 - *
  196.63 - * @author lahvac
  196.64 - */
  196.65 -public class RenameRefactoringWrapper implements RefactoringUI {
  196.66 -
  196.67 -    private final RefactoringUI delegate;
  196.68 -    private final RenameRefactoring refactoring;
  196.69 -
  196.70 -    public RenameRefactoringWrapper(RefactoringUI delegate, RenameRefactoring refactoring) {
  196.71 -        this.delegate = delegate;
  196.72 -        this.refactoring = refactoring;
  196.73 -    }
  196.74 -
  196.75 -    @Override
  196.76 -    public String getName() {
  196.77 -        return delegate.getName();
  196.78 -    }
  196.79 -
  196.80 -    @Override
  196.81 -    public String getDescription() {
  196.82 -        return delegate.getDescription();
  196.83 -    }
  196.84 -
  196.85 -    @Override
  196.86 -    public boolean isQuery() {
  196.87 -        return delegate.isQuery();
  196.88 -    }
  196.89 -
  196.90 -    private GenerateScriptPanel gsp;
  196.91 -    private CustomRefactoringPanel crp;
  196.92 -
  196.93 -    @Override
  196.94 -    public CustomRefactoringPanel getPanel(ChangeListener parent) {
  196.95 -        if (crp == null) {
  196.96 -            Lookup source = refactoring.getRefactoringSource();
  196.97 -            TreePathHandle toRename = source.lookup(TreePathHandle.class);
  196.98 -
  196.99 -            gsp = new GenerateScriptPanel(toRename != null && toRename.getKind() == Kind.METHOD);
 196.100 -            crp = new CustomRefactoringPanelImpl(gsp, delegate.getPanel(parent));
 196.101 -        }
 196.102 -
 196.103 -        return crp;
 196.104 -    }
 196.105 -
 196.106 -    @Override
 196.107 -    public Problem setParameters() {
 196.108 -        gsp.saveDefaults();
 196.109 -        refactoring.getContext().add(gsp.getData());
 196.110 -        return delegate.setParameters();
 196.111 -    }
 196.112 -
 196.113 -    @Override
 196.114 -    public Problem checkParameters() {
 196.115 -        return delegate.checkParameters();
 196.116 -    }
 196.117 -
 196.118 -    @Override
 196.119 -    public boolean hasParameters() {
 196.120 -        return true;
 196.121 -    }
 196.122 -
 196.123 -    @Override
 196.124 -    public AbstractRefactoring getRefactoring() {
 196.125 -        return refactoring;
 196.126 -    }
 196.127 -
 196.128 -    @Override
 196.129 -    public HelpCtx getHelpCtx() {
 196.130 -        return delegate.getHelpCtx();
 196.131 -    }
 196.132 -
 196.133 -    private static final class CustomRefactoringPanelImpl implements CustomRefactoringPanel {
 196.134 -        private final CustomRefactoringPanel delegate;
 196.135 -        private final JComponent component;
 196.136 -        public CustomRefactoringPanelImpl(final GenerateScriptPanel panel, CustomRefactoringPanel delegate) {
 196.137 -            this.delegate = delegate;
 196.138 -            final Component delegateComponent = delegate.getComponent();
 196.139 -            this.component = new JPanel(new BorderLayout()) {
 196.140 -                {
 196.141 -                    add(delegateComponent, BorderLayout.CENTER);
 196.142 -                    panel.setBorder(new EmptyBorder(0, 5, 0, 0));
 196.143 -                    add(panel, BorderLayout.SOUTH);
 196.144 -                    delegateComponent.requestFocus();
 196.145 -                }
 196.146 -                @Override
 196.147 -                public void requestFocus() {
 196.148 -                    delegateComponent.requestFocus();
 196.149 -                }
 196.150 -            };
 196.151 -        }
 196.152 -
 196.153 -        @Override
 196.154 -        public void initialize() {
 196.155 -            delegate.initialize();
 196.156 -        }
 196.157 -
 196.158 -        @Override
 196.159 -        public Component getComponent() {
 196.160 -            return component;
 196.161 -        }
 196.162 -        
 196.163 -    }
 196.164 -
 196.165 -}
   197.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/ScriptGenerator.java	Sun Jan 08 20:10:08 2017 +0100
   197.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   197.3 @@ -1,113 +0,0 @@
   197.4 -/*
   197.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   197.6 - *
   197.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   197.8 - *
   197.9 - * The contents of this file are subject to the terms of either the GNU
  197.10 - * General Public License Version 2 only ("GPL") or the Common
  197.11 - * Development and Distribution License("CDDL") (collectively, the
  197.12 - * "License"). You may not use this file except in compliance with the
  197.13 - * License. You can obtain a copy of the License at
  197.14 - * http://www.netbeans.org/cddl-gplv2.html
  197.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  197.16 - * specific language governing permissions and limitations under the
  197.17 - * License.  When distributing the software, include this License Header
  197.18 - * Notice in each file and include the License file at
  197.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  197.20 - * particular file as subject to the "Classpath" exception as provided
  197.21 - * by Sun in the GPL Version 2 section of the License file that
  197.22 - * accompanied this code. If applicable, add the following below the
  197.23 - * License Header, with the fields enclosed by brackets [] replaced by
  197.24 - * your own identifying information:
  197.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  197.26 - *
  197.27 - * If you wish your version of this file to be governed by only the CDDL
  197.28 - * or only the GPL Version 2, indicate your decision by adding
  197.29 - * "[Contributor] elects to include this software in this distribution
  197.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  197.31 - * single choice of license, a recipient has the option to distribute
  197.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  197.33 - * to extend the choice of license to its licensees as provided above.
  197.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  197.35 - * Version 2 license, then the option applies only if the new code is
  197.36 - * made subject to such option by the copyright holder.
  197.37 - *
  197.38 - * Contributor(s):
  197.39 - *
  197.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  197.41 - */
  197.42 -
  197.43 -package org.netbeans.modules.jackpot30.refactoring;
  197.44 -
  197.45 -import javax.lang.model.element.Element;
  197.46 -import javax.lang.model.element.ExecutableElement;
  197.47 -import javax.lang.model.element.Modifier;
  197.48 -import javax.lang.model.element.TypeElement;
  197.49 -import javax.lang.model.element.VariableElement;
  197.50 -import org.netbeans.api.annotations.common.NonNull;
  197.51 -import org.netbeans.api.java.source.WorkingCopy;
  197.52 -
  197.53 -/**
  197.54 - *
  197.55 - * @author lahvac
  197.56 - */
  197.57 -public class ScriptGenerator {
  197.58 -
  197.59 -    public static @NonNull String constructRenameRule(@NonNull WorkingCopy wc, @NonNull String newName, @NonNull Element original) {
  197.60 -        switch (original.getKind()) {
  197.61 -            case METHOD: return constructRenameRule(wc, newName, (ExecutableElement) original);
  197.62 -            default: throw new UnsupportedOperationException();
  197.63 -        }
  197.64 -    }
  197.65 -
  197.66 -    private static String constructRenameRule(WorkingCopy wc, String newName, ExecutableElement method) {
  197.67 -        //XXX: type parameters?
  197.68 -        StringBuilder pattern = new StringBuilder();
  197.69 -        StringBuilder constraints = new StringBuilder();
  197.70 -        StringBuilder target = new StringBuilder();
  197.71 -
  197.72 -        TypeElement clazz = (TypeElement) method.getEnclosingElement();
  197.73 -
  197.74 -        if (method.getModifiers().contains(Modifier.STATIC)) {
  197.75 -            pattern.append(clazz.getQualifiedName().toString()).append(".");
  197.76 -            target.append(clazz.getQualifiedName().toString()).append(".");
  197.77 -        } else {
  197.78 -            pattern.append("$0.");
  197.79 -            constraints.append(" :: $0 instanceof " + clazz.getQualifiedName().toString());
  197.80 -            target.append("$0.");
  197.81 -        }
  197.82 -
  197.83 -        pattern.append(method.getSimpleName().toString());
  197.84 -        target.append(newName);
  197.85 -        pattern.append("(");
  197.86 -        target.append("(");
  197.87 -
  197.88 -        int count = 1;
  197.89 -
  197.90 -        for (VariableElement p : method.getParameters()) {
  197.91 -            if (count++ > 1) {
  197.92 -                pattern.append(", ");
  197.93 -                target.append(", ");
  197.94 -            }
  197.95 -
  197.96 -            String name = "$" + p.getSimpleName().toString();
  197.97 -
  197.98 -            pattern.append(name);
  197.99 -            target.append(name);
 197.100 -
 197.101 -            if (constraints.length() == 0) {
 197.102 -                constraints.append(" :: ");
 197.103 -            } else {
 197.104 -                constraints.append(" && ");
 197.105 -            }
 197.106 -            
 197.107 -            constraints.append(name).append(" instanceof ").append(p.asType());
 197.108 -        }
 197.109 -
 197.110 -        pattern.append(")");
 197.111 -        target.append(")");
 197.112 -
 197.113 -        return "   " + pattern + constraints + "\n=> " + target + "\n;;";
 197.114 -    }
 197.115 -
 197.116 -}
   198.1 --- a/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/layer.xml	Sun Jan 08 20:10:08 2017 +0100
   198.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   198.3 @@ -1,77 +0,0 @@
   198.4 -<?xml version="1.0" encoding="UTF-8"?>
   198.5 -<!--
   198.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   198.7 -
   198.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   198.9 -
  198.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  198.11 -Other names may be trademarks of their respective owners.
  198.12 -
  198.13 -The contents of this file are subject to the terms of either the GNU
  198.14 -General Public License Version 2 only ("GPL") or the Common
  198.15 -Development and Distribution License("CDDL") (collectively, the
  198.16 -"License"). You may not use this file except in compliance with the
  198.17 -License. You can obtain a copy of the License at
  198.18 -http://www.netbeans.org/cddl-gplv2.html
  198.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  198.20 -specific language governing permissions and limitations under the
  198.21 -License.  When distributing the software, include this License Header
  198.22 -Notice in each file and include the License file at
  198.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  198.24 -particular file as subject to the "Classpath" exception as provided
  198.25 -by Oracle in the GPL Version 2 section of the License file that
  198.26 -accompanied this code. If applicable, add the following below the
  198.27 -License Header, with the fields enclosed by brackets [] replaced by
  198.28 -your own identifying information:
  198.29 -"Portions Copyrighted [year] [name of copyright owner]"
  198.30 -
  198.31 -Contributor(s):
  198.32 -
  198.33 -The Original Software is NetBeans. The Initial Developer of the Original
  198.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  198.35 -Microsystems, Inc. All Rights Reserved.
  198.36 -
  198.37 -If you wish your version of this file to be governed by only the CDDL
  198.38 -or only the GPL Version 2, indicate your decision by adding
  198.39 -"[Contributor] elects to include this software in this distribution
  198.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  198.41 -single choice of license, a recipient has the option to distribute
  198.42 -your version of this file under either the CDDL, the GPL Version 2 or
  198.43 -to extend the choice of license to its licensees as provided above.
  198.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  198.45 -Version 2 license, then the option applies only if the new code is
  198.46 -made subject to such option by the copyright holder.
  198.47 --->
  198.48 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
  198.49 -<filesystem>
  198.50 -    <folder name="Actions">
  198.51 -        <folder name="Refactoring">
  198.52 -            <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction.instance">
  198.53 -                <attr name="instanceCreate" methodvalue="org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorAction.create"/>
  198.54 -            </file>
  198.55 -            <file name="org-netbeans-modules-jackpot30-refactoring-invertboolean-InvertBooleanAction.instance">
  198.56 -                <attr name="instanceCreate" methodvalue="org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanAction.create"/>
  198.57 -            </file>
  198.58 -        </folder>
  198.59 -    </folder>
  198.60 -    <folder name="Menu">
  198.61 -        <folder name="Refactoring">
  198.62 -            <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction-separatorAfter.instance">
  198.63 -                <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
  198.64 -                <attr name="position" intvalue="2175"/>
  198.65 -            </file>
  198.66 -            <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction-separatorBefore.instance">
  198.67 -                <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
  198.68 -                <attr name="position" intvalue="2125"/>
  198.69 -            </file>
  198.70 -            <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction.shadow">
  198.71 -                <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction.instance"/>
  198.72 -                <attr name="position" intvalue="2150"/>
  198.73 -            </file>
  198.74 -            <file name="org-netbeans-modules-jackpot30-refactoring-invertboolean-InvertBooleanAction.shadow">
  198.75 -                <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-refactoring-invertboolean-InvertBooleanAction.instance"/>
  198.76 -                <attr name="position" intvalue="2152"/>
  198.77 -            </file>
  198.78 -        </folder>
  198.79 -    </folder>
  198.80 -</filesystem>
   199.1 --- a/sandbox/old-modules/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/RefactoringTestBase.java	Sun Jan 08 20:10:08 2017 +0100
   199.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   199.3 @@ -1,251 +0,0 @@
   199.4 -/*
   199.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   199.6 - *
   199.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
   199.8 - *
   199.9 - * The contents of this file are subject to the terms of either the GNU
  199.10 - * General Public License Version 2 only ("GPL") or the Common
  199.11 - * Development and Distribution License("CDDL") (collectively, the
  199.12 - * "License"). You may not use this file except in compliance with the
  199.13 - * License. You can obtain a copy of the License at
  199.14 - * http://www.netbeans.org/cddl-gplv2.html
  199.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  199.16 - * specific language governing permissions and limitations under the
  199.17 - * License.  When distributing the software, include this License Header
  199.18 - * Notice in each file and include the License file at
  199.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  199.20 - * particular file as subject to the "Classpath" exception as provided
  199.21 - * by Sun in the GPL Version 2 section of the License file that
  199.22 - * accompanied this code. If applicable, add the following below the
  199.23 - * License Header, with the fields enclosed by brackets [] replaced by
  199.24 - * your own identifying information:
  199.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  199.26 - *
  199.27 - * If you wish your version of this file to be governed by only the CDDL
  199.28 - * or only the GPL Version 2, indicate your decision by adding
  199.29 - * "[Contributor] elects to include this software in this distribution
  199.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  199.31 - * single choice of license, a recipient has the option to distribute
  199.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  199.33 - * to extend the choice of license to its licensees as provided above.
  199.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  199.35 - * Version 2 license, then the option applies only if the new code is
  199.36 - * made subject to such option by the copyright holder.
  199.37 - *
  199.38 - * Contributor(s):
  199.39 - *
  199.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  199.41 - */
  199.42 -package org.netbeans.modules.jackpot30.refactoring;
  199.43 -
  199.44 -import java.io.IOException;
  199.45 -import java.util.Arrays;
  199.46 -import java.util.Collections;
  199.47 -import java.util.HashMap;
  199.48 -import java.util.HashSet;
  199.49 -import java.util.LinkedList;
  199.50 -import java.util.List;
  199.51 -import java.util.Map;
  199.52 -import java.util.Set;
  199.53 -import org.netbeans.api.editor.mimelookup.MimePath;
  199.54 -import org.netbeans.api.java.classpath.ClassPath;
  199.55 -import org.netbeans.api.java.classpath.GlobalPathRegistry;
  199.56 -import org.netbeans.api.java.source.SourceUtils;
  199.57 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  199.58 -import org.netbeans.api.java.source.TestUtilities;
  199.59 -import org.netbeans.api.project.Project;
  199.60 -import org.netbeans.api.project.ProjectManager;
  199.61 -import org.netbeans.core.startup.Main;
  199.62 -import org.netbeans.junit.NbTestCase;
  199.63 -import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
  199.64 -import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
  199.65 -import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
  199.66 -import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
  199.67 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
  199.68 -import org.netbeans.modules.refactoring.api.RefactoringSession;
  199.69 -import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
  199.70 -import org.netbeans.spi.java.classpath.ClassPathProvider;
  199.71 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
  199.72 -import org.netbeans.spi.project.ProjectFactory;
  199.73 -import org.netbeans.spi.project.ProjectState;
  199.74 -import org.openide.filesystems.FileObject;
  199.75 -import org.openide.filesystems.FileUtil;
  199.76 -import org.openide.util.Lookup;
  199.77 -import org.openide.util.lookup.Lookups;
  199.78 -import org.openide.util.lookup.ServiceProvider;
  199.79 -
  199.80 -public class RefactoringTestBase extends NbTestCase {
  199.81 -
  199.82 -    public RefactoringTestBase(String name) {
  199.83 -        super(name);
  199.84 -    }
  199.85 -
  199.86 -    protected static void writeFilesAndWaitForScan(FileObject sourceRoot, File... files) throws Exception {
  199.87 -        for (FileObject c : sourceRoot.getChildren()) {
  199.88 -            c.delete();
  199.89 -        }
  199.90 -
  199.91 -        for (File f : files) {
  199.92 -            FileObject fo = FileUtil.createData(sourceRoot, f.filename);
  199.93 -            TestUtilities.copyStringToFile(fo, f.content);
  199.94 -        }
  199.95 -
  199.96 -        SourceUtils.waitScanFinished();
  199.97 -    }
  199.98 -
  199.99 -    protected static final class File {
 199.100 -        public final String filename;
 199.101 -        public final String content;
 199.102 -
 199.103 -        public File(String filename, String content) {
 199.104 -            this.filename = filename;
 199.105 -            this.content = content;
 199.106 -        }
 199.107 -    }
 199.108 -
 199.109 -    protected FileObject src;
 199.110 -    protected Project prj;
 199.111 -
 199.112 -    @Override
 199.113 -    protected void setUp() throws Exception {
 199.114 -        SourceUtilsTestUtil.prepareTest(new String[0], new Object[] {
 199.115 -            new ClassPathProvider() {
 199.116 -                public ClassPath findClassPath(FileObject file, String type) {
 199.117 -                    if (src != null && (file == src || FileUtil.isParentOf(src, file))) {
 199.118 -                        if (ClassPath.BOOT.equals(type)) {
 199.119 -                            return ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path"));
 199.120 -                        }
 199.121 -                        if (ClassPath.COMPILE.equals(type)) {
 199.122 -                            return ClassPathSupport.createClassPath(new FileObject[0]);
 199.123 -                        }
 199.124 -                        if (ClassPath.SOURCE.equals(type)) {
 199.125 -                            return ClassPathSupport.createClassPath(src);
 199.126 -                        }
 199.127 -                    }
 199.128 -
 199.129 -                    return null;
 199.130 -                }
 199.131 -            },
 199.132 -            new ProjectFactory() {
 199.133 -                public boolean isProject(FileObject projectDirectory) {
 199.134 -                    return src == projectDirectory;
 199.135 -                }
 199.136 -                public Project loadProject(final FileObject projectDirectory, ProjectState state) throws IOException {
 199.137 -                    if (!isProject(projectDirectory)) return null;
 199.138 -                    return new Project() {
 199.139 -                        public FileObject getProjectDirectory() {
 199.140 -                            return projectDirectory;
 199.141 -                        }
 199.142 -                        public Lookup getLookup() {
 199.143 -                            return Lookup.EMPTY;
 199.144 -                        }
 199.145 -                    };
 199.146 -                }
 199.147 -                public void saveProject(Project project) throws IOException, ClassCastException {}
 199.148 -            }
 199.149 -        });
 199.150 -        Main.initializeURLFactory();
 199.151 -        org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
 199.152 -        prepareTest();
 199.153 -        org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj = ProjectManager.getDefault().findProject(src)}, false);
 199.154 -        MimeTypes.setAllMimeTypes(Collections.singleton("text/x-java"));
 199.155 -        GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {ClassPathSupport.createClassPath(src)});
 199.156 -        RepositoryUpdater.getDefault().start(true);
 199.157 -        super.setUp();
 199.158 -    }
 199.159 -
 199.160 -    @Override
 199.161 -    protected void tearDown() throws Exception {
 199.162 -        super.tearDown();
 199.163 -        org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj}, false);
 199.164 -        prj = null;
 199.165 -    }
 199.166 -
 199.167 -    private void prepareTest() throws Exception {
 199.168 -        FileObject workdir = SourceUtilsTestUtil.makeScratchDir(this);
 199.169 -
 199.170 -        src = FileUtil.createFolder(workdir, "src");
 199.171 -
 199.172 -        FileObject cache = FileUtil.createFolder(workdir, "cache");
 199.173 -
 199.174 -        CacheFolder.setCacheFolder(cache);
 199.175 -    }
 199.176 -
 199.177 -    protected void performRefactoring(AbstractRefactoring r, File... verify) throws IOException {
 199.178 -        Map<FileObject, String> originalContent = new HashMap<FileObject, String>();
 199.179 -
 199.180 -        for (FileObject file : recursive(src)) {
 199.181 -            originalContent.put(file, readFile(file));
 199.182 -        }
 199.183 -        
 199.184 -        RefactoringSession rs = RefactoringSession.create("Session");
 199.185 -        
 199.186 -        r.prepare(rs);
 199.187 -
 199.188 -        assertNull(rs.doRefactoring(true));
 199.189 -
 199.190 -//        IndexingManager.getDefault().refreshIndex(src.getURL(), null);
 199.191 -//        SourceUtils.waitScanFinished();
 199.192 -//        assertEquals(false, TaskCache.getDefault().isInError(src, true));
 199.193 -
 199.194 -        for (File v : verify) {
 199.195 -            FileObject file = src.getFileObject(v.filename);
 199.196 -
 199.197 -            assertNotNull(v.filename, file);
 199.198 -
 199.199 -            String content = readFile(file);
 199.200 -
 199.201 -            assertEquals(v.content.replaceAll("[ \n\t]+", " "), content.replaceAll("[ \n\t]+", " "));
 199.202 -        }
 199.203 -
 199.204 -        rs.undoRefactoring(true);
 199.205 -
 199.206 -        for (FileObject file : recursive(src)) {
 199.207 -            String content = originalContent.remove(file);
 199.208 -
 199.209 -            assertNotNull(FileUtil.getFileDisplayName(file), content);
 199.210 -            assertEquals(content, readFile(file));
 199.211 -        }
 199.212 -
 199.213 -        assertTrue(originalContent.toString(), originalContent.isEmpty());
 199.214 -    }
 199.215 -
 199.216 -    private String readFile(FileObject file) throws IOException {
 199.217 -        return TestUtilities.copyFileToString(FileUtil.toFile(file));
 199.218 -    }
 199.219 -
 199.220 -    private static Iterable<? extends FileObject> recursive(FileObject r) {
 199.221 -        Set<FileObject> result = new HashSet<FileObject>();
 199.222 -        List<FileObject> queue = new LinkedList<FileObject>();
 199.223 -
 199.224 -        queue.add(r);
 199.225 -
 199.226 -        while (!queue.isEmpty()) {
 199.227 -            FileObject c = queue.remove(0);
 199.228 -
 199.229 -            if (c.isData()) {
 199.230 -                result.add(c);
 199.231 -            } else {
 199.232 -                queue.addAll(Arrays.asList(c.getChildren()));
 199.233 -            }
 199.234 -        }
 199.235 -
 199.236 -        return result;
 199.237 -    }
 199.238 -    
 199.239 -    @ServiceProvider(service=MimeDataProvider.class)
 199.240 -    public static final class MimeDataProviderImpl implements MimeDataProvider {
 199.241 -
 199.242 -        private static final Lookup L = Lookups.singleton(new JavaCustomIndexer.Factory());
 199.243 -
 199.244 -        public Lookup getLookup(MimePath mimePath) {
 199.245 -            if ("text/x-java".equals(mimePath.getPath())) {
 199.246 -                return L;
 199.247 -            }
 199.248 -
 199.249 -            return null;
 199.250 -        }
 199.251 -
 199.252 -    }
 199.253 -
 199.254 -}
   200.1 --- a/sandbox/old-modules/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringPluginImplTest.java	Sun Jan 08 20:10:08 2017 +0100
   200.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   200.3 @@ -1,111 +0,0 @@
   200.4 -/*
   200.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   200.6 - *
   200.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
   200.8 - *
   200.9 - * The contents of this file are subject to the terms of either the GNU
  200.10 - * General Public License Version 2 only ("GPL") or the Common
  200.11 - * Development and Distribution License("CDDL") (collectively, the
  200.12 - * "License"). You may not use this file except in compliance with the
  200.13 - * License. You can obtain a copy of the License at
  200.14 - * http://www.netbeans.org/cddl-gplv2.html
  200.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  200.16 - * specific language governing permissions and limitations under the
  200.17 - * License.  When distributing the software, include this License Header
  200.18 - * Notice in each file and include the License file at
  200.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  200.20 - * particular file as subject to the "Classpath" exception as provided
  200.21 - * by Sun in the GPL Version 2 section of the License file that
  200.22 - * accompanied this code. If applicable, add the following below the
  200.23 - * License Header, with the fields enclosed by brackets [] replaced by
  200.24 - * your own identifying information:
  200.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  200.26 - *
  200.27 - * If you wish your version of this file to be governed by only the CDDL
  200.28 - * or only the GPL Version 2, indicate your decision by adding
  200.29 - * "[Contributor] elects to include this software in this distribution
  200.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  200.31 - * single choice of license, a recipient has the option to distribute
  200.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  200.33 - * to extend the choice of license to its licensees as provided above.
  200.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  200.35 - * Version 2 license, then the option applies only if the new code is
  200.36 - * made subject to such option by the copyright holder.
  200.37 - *
  200.38 - * Contributor(s):
  200.39 - *
  200.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  200.41 - */
  200.42 -package org.netbeans.modules.jackpot30.refactoring;
  200.43 -
  200.44 -import com.sun.source.tree.ClassTree;
  200.45 -import com.sun.source.tree.CompilationUnitTree;
  200.46 -import com.sun.source.tree.MethodTree;
  200.47 -import com.sun.source.util.TreePath;
  200.48 -import org.netbeans.api.java.source.CompilationController;
  200.49 -import org.netbeans.api.java.source.JavaSource;
  200.50 -import org.netbeans.api.java.source.Task;
  200.51 -import org.netbeans.api.java.source.TreePathHandle;
  200.52 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
  200.53 -import org.openide.util.lookup.Lookups;
  200.54 -
  200.55 -public class RenameRefactoringPluginImplTest extends RefactoringTestBase {
  200.56 -
  200.57 -    public RenameRefactoringPluginImplTest(String name) {
  200.58 -        super(name);
  200.59 -    }
  200.60 -
  200.61 -    public void testSimple1() throws Exception {
  200.62 -        writeFilesAndWaitForScan(src,
  200.63 -                                 new File("t/A.java", "package t; public class A {\n public void test() {\n}\n }"));
  200.64 -        final RenameRefactoring[] r = new RenameRefactoring[1];
  200.65 -
  200.66 -        JavaSource.forFileObject(src.getFileObject("t/A.java")).runUserActionTask(new Task<CompilationController>() {
  200.67 -
  200.68 -            public void run(CompilationController parameter) throws Exception {
  200.69 -                parameter.toPhase(JavaSource.Phase.RESOLVED);
  200.70 -                CompilationUnitTree cut = parameter.getCompilationUnit();
  200.71 -
  200.72 -                MethodTree var = (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(1);
  200.73 -
  200.74 -                TreePath tp = TreePath.getPath(cut, var);
  200.75 -                r[0] = new RenameRefactoring(Lookups.singleton(TreePathHandle.create(tp, parameter)));
  200.76 -            }
  200.77 -        }, true);
  200.78 -
  200.79 -        r[0].setNewName("foo");
  200.80 -        r[0].getContext().add(new ExtraData(true, true, true));
  200.81 -
  200.82 -        performRefactoring(r[0],
  200.83 -                           new File("t/A.java", "package t; public class A { @Deprecated private void test() { foo(); } public void foo() { } }"),
  200.84 -                           new File("META-INF/upgrade/t.A.hint", " $0.test() :: $0 instanceof t.A => $0.foo() ;; "));
  200.85 -    }
  200.86 -
  200.87 -    public void testSimple2() throws Exception {
  200.88 -        writeFilesAndWaitForScan(src,
  200.89 -                                 new File("t/A.java", "package t; public class A {\n public void test() {\n}\n }"),
  200.90 -                                 new File("META-INF/upgrade/t.A.hint", "$0.isDirectory();; "));
  200.91 -        final RenameRefactoring[] r = new RenameRefactoring[1];
  200.92 -
  200.93 -        JavaSource.forFileObject(src.getFileObject("t/A.java")).runUserActionTask(new Task<CompilationController>() {
  200.94 -
  200.95 -            public void run(CompilationController parameter) throws Exception {
  200.96 -                parameter.toPhase(JavaSource.Phase.RESOLVED);
  200.97 -                CompilationUnitTree cut = parameter.getCompilationUnit();
  200.98 -
  200.99 -                MethodTree var = (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(1);
 200.100 -
 200.101 -                TreePath tp = TreePath.getPath(cut, var);
 200.102 -                r[0] = new RenameRefactoring(Lookups.singleton(TreePathHandle.create(tp, parameter)));
 200.103 -            }
 200.104 -        }, true);
 200.105 -
 200.106 -        r[0].setNewName("foo");
 200.107 -        r[0].getContext().add(new ExtraData(true, /*XXX: false will fail badly here!!*/true, false));
 200.108 -
 200.109 -        performRefactoring(r[0],
 200.110 -                           new File("t/A.java", "package t; public class A { private void test() { foo(); } public void foo() { } }"),
 200.111 -                           new File("META-INF/upgrade/t.A.hint", "$0.isDirectory();; $0.test() :: $0 instanceof t.A => $0.foo() ;; "));
 200.112 -    }
 200.113 -
 200.114 -}
   201.1 --- a/sandbox/old-modules/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/ScriptGeneratorTest.java	Sun Jan 08 20:10:08 2017 +0100
   201.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   201.3 @@ -1,135 +0,0 @@
   201.4 -/*
   201.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   201.6 - *
   201.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   201.8 - *
   201.9 - * The contents of this file are subject to the terms of either the GNU
  201.10 - * General Public License Version 2 only ("GPL") or the Common
  201.11 - * Development and Distribution License("CDDL") (collectively, the
  201.12 - * "License"). You may not use this file except in compliance with the
  201.13 - * License. You can obtain a copy of the License at
  201.14 - * http://www.netbeans.org/cddl-gplv2.html
  201.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  201.16 - * specific language governing permissions and limitations under the
  201.17 - * License.  When distributing the software, include this License Header
  201.18 - * Notice in each file and include the License file at
  201.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  201.20 - * particular file as subject to the "Classpath" exception as provided
  201.21 - * by Sun in the GPL Version 2 section of the License file that
  201.22 - * accompanied this code. If applicable, add the following below the
  201.23 - * License Header, with the fields enclosed by brackets [] replaced by
  201.24 - * your own identifying information:
  201.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  201.26 - *
  201.27 - * If you wish your version of this file to be governed by only the CDDL
  201.28 - * or only the GPL Version 2, indicate your decision by adding
  201.29 - * "[Contributor] elects to include this software in this distribution
  201.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  201.31 - * single choice of license, a recipient has the option to distribute
  201.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  201.33 - * to extend the choice of license to its licensees as provided above.
  201.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  201.35 - * Version 2 license, then the option applies only if the new code is
  201.36 - * made subject to such option by the copyright holder.
  201.37 - *
  201.38 - * Contributor(s):
  201.39 - *
  201.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  201.41 - */
  201.42 -
  201.43 -package org.netbeans.modules.jackpot30.refactoring;
  201.44 -
  201.45 -import com.sun.source.util.TreePath;
  201.46 -import java.util.regex.Pattern;
  201.47 -import javax.lang.model.element.Element;
  201.48 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  201.49 -import org.netbeans.modules.jackpot30.impl.TestBase;
  201.50 -
  201.51 -/**
  201.52 - *
  201.53 - * @author lahvac
  201.54 - */
  201.55 -public class ScriptGeneratorTest extends TestBase {
  201.56 -    
  201.57 -    public ScriptGeneratorTest(String testName) {
  201.58 -        super(testName);
  201.59 -    }
  201.60 -
  201.61 -    @Override
  201.62 -    protected void setUp() throws Exception {
  201.63 -        SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
  201.64 -        super.setUp();
  201.65 -    }
  201.66 -
  201.67 -    public void testInstanceMethod() throws Exception {
  201.68 -        performTest("package test;\n" +
  201.69 -                    "public class Test {\n" +
  201.70 -                    "    public void te|st() {}" +
  201.71 -                    "}\n",
  201.72 -                    "foo",
  201.73 -                    "   $0.test() :: $0 instanceof test.Test\n" +
  201.74 -                    "=> $0.foo()\n" +
  201.75 -                    ";;");
  201.76 -    }
  201.77 -
  201.78 -    public void testInstanceMethodParam() throws Exception {
  201.79 -        performTest("package test;\n" +
  201.80 -                    "public class Test {\n" +
  201.81 -                    "    public void te|st(int i) {}" +
  201.82 -                    "}\n",
  201.83 -                    "foo",
  201.84 -                    "   $0.test($i) :: $0 instanceof test.Test && $i instanceof int\n" +
  201.85 -                    "=> $0.foo($i)\n" +
  201.86 -                    ";;");
  201.87 -    }
  201.88 -
  201.89 -    public void testStaticMethod() throws Exception {
  201.90 -        performTest("package test;\n" +
  201.91 -                    "public class Test {\n" +
  201.92 -                    "    public static void te|st() {}" +
  201.93 -                    "}\n",
  201.94 -                    "foo",
  201.95 -                    "   test.Test.test()\n" +
  201.96 -                    "=> test.Test.foo()\n" +
  201.97 -                    ";;");
  201.98 -    }
  201.99 -
 201.100 -    public void testStaticMethodParam() throws Exception {
 201.101 -        performTest("package test;\n" +
 201.102 -                    "public class Test {\n" +
 201.103 -                    "    public static void te|st(int i) {}" +
 201.104 -                    "}\n",
 201.105 -                    "foo",
 201.106 -                    "   test.Test.test($i) :: $i instanceof int\n" +
 201.107 -                    "=> test.Test.foo($i)\n" +
 201.108 -                    ";;");
 201.109 -    }
 201.110 -
 201.111 -    public void testMultipleParameters183659() throws Exception {
 201.112 -        performTest("package test;\n" +
 201.113 -                    "public class Test {\n" +
 201.114 -                    "    public void te|st(int i, int j) {}" +
 201.115 -                    "}\n",
 201.116 -                    "foo",
 201.117 -                    "   $0.test($i, $j) :: $0 instanceof test.Test && $i instanceof int && $j instanceof int\n" +
 201.118 -                    "=> $0.foo($i, $j)\n" +
 201.119 -                    ";;");
 201.120 -    }
 201.121 -
 201.122 -    private void performTest(String code, String newName, String script) throws Exception {
 201.123 -        assertEquals(2, code.split(Pattern.quote("|")).length);
 201.124 -
 201.125 -        int pos = code.indexOf('|');
 201.126 -
 201.127 -        code = code.substring(0, pos) + code.substring(pos + 1);
 201.128 -
 201.129 -        prepareTest("test/Test.java", code);
 201.130 -
 201.131 -        TreePath path = info.getTreeUtilities().pathFor(pos);
 201.132 -        Element el = info.getTrees().getElement(path);
 201.133 -
 201.134 -        assertNotNull(el);
 201.135 -
 201.136 -        assertEquals(script, ScriptGenerator.constructRenameRule(null, newName, el));
 201.137 -    }
 201.138 -}
   202.1 --- a/sandbox/old-modules/help/build.xml	Sun Jan 08 20:10:08 2017 +0100
   202.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   202.3 @@ -1,91 +0,0 @@
   202.4 -<?xml version="1.0" encoding="UTF-8"?>
   202.5 -<!--
   202.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   202.7 -
   202.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   202.9 -
  202.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  202.11 -Other names may be trademarks of their respective owners.
  202.12 -
  202.13 -The contents of this file are subject to the terms of either the GNU
  202.14 -General Public License Version 2 only ("GPL") or the Common
  202.15 -Development and Distribution License("CDDL") (collectively, the
  202.16 -"License"). You may not use this file except in compliance with the
  202.17 -License. You can obtain a copy of the License at
  202.18 -http://www.netbeans.org/cddl-gplv2.html
  202.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  202.20 -specific language governing permissions and limitations under the
  202.21 -License.  When distributing the software, include this License Header
  202.22 -Notice in each file and include the License file at
  202.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  202.24 -particular file as subject to the "Classpath" exception as provided
  202.25 -by Oracle in the GPL Version 2 section of the License file that
  202.26 -accompanied this code. If applicable, add the following below the
  202.27 -License Header, with the fields enclosed by brackets [] replaced by
  202.28 -your own identifying information:
  202.29 -"Portions Copyrighted [year] [name of copyright owner]"
  202.30 -
  202.31 -Contributor(s):
  202.32 -
  202.33 -The Original Software is NetBeans. The Initial Developer of the Original
  202.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  202.35 -Microsystems, Inc. All Rights Reserved.
  202.36 -
  202.37 -If you wish your version of this file to be governed by only the CDDL
  202.38 -or only the GPL Version 2, indicate your decision by adding
  202.39 -"[Contributor] elects to include this software in this distribution
  202.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  202.41 -single choice of license, a recipient has the option to distribute
  202.42 -your version of this file under either the CDDL, the GPL Version 2 or
  202.43 -to extend the choice of license to its licensees as provided above.
  202.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  202.45 -Version 2 license, then the option applies only if the new code is
  202.46 -made subject to such option by the copyright holder.
  202.47 --->
  202.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
  202.49 -<!-- for some information on what you could do (e.g. targets to override). -->
  202.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
  202.51 -<project name="org.netbeans.modules.jackpot30.help" default="netbeans" basedir=".">
  202.52 -    <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.help.</description>
  202.53 -    <import file="nbproject/build-impl.xml"/>
  202.54 -    <import file="${suite.dir}/findbugs-import.xml"/>
  202.55 -
  202.56 -    <target name="help-init">
  202.57 -        <property environment="ENV." />
  202.58 -        <condition property="hasLaTeX2HTML">
  202.59 -            <available file="latex2html" filepath="${ENV.PATH}" />
  202.60 -        </condition>
  202.61 -    </target>
  202.62 -
  202.63 -    <target name="compile-help" depends="help-init" if="hasLaTeX2HTML">
  202.64 -        <mkdir dir="${basedir}/build/help/org/netbeans/modules/jackpot30/help/docs" />
  202.65 -
  202.66 -        <copy file="jackpot30-helpset.xml" todir="${basedir}/build/help/org/netbeans/modules/jackpot30/help/docs" />
  202.67 -        
  202.68 -        <exec executable="latex2html">
  202.69 -            <arg value="-antialias" />
  202.70 -            <arg value="-antialias_text" />
  202.71 -            <arg value="-dir" />
  202.72 -            <arg value="build/help/org/netbeans/modules/jackpot30/help/docs" />
  202.73 -            <arg value="jackpot30-help.tex" />
  202.74 -        </exec>
  202.75 -
  202.76 -        <java classname="org.netbeans.modules.jackpot30.help.CreateMap"
  202.77 -              classpath="build/classes">
  202.78 -            <arg value="${basedir}/build/help/org/netbeans/modules/jackpot30/help/docs" />
  202.79 -        </java>
  202.80 -
  202.81 -        <mkdir dir="${suite.dir}/build/cluster/modules/docs" />
  202.82 -
  202.83 -        <jar destfile="${suite.dir}/build/cluster/modules/docs/org-netbeans-modules-jackpot30-help.jar" basedir="${basedir}/build/help">
  202.84 -
  202.85 -        </jar>
  202.86 -    </target>
  202.87 -
  202.88 -    <target name="compile" depends="projectized-common.compile,compile-help" />
  202.89 -
  202.90 -    <target name="test" />
  202.91 -    <target name="test-coverage" />
  202.92 -    <target name="coverage-report" />
  202.93 -
  202.94 -</project>
   203.1 --- a/sandbox/old-modules/help/jackpot30-help.tex	Sun Jan 08 20:10:08 2017 +0100
   203.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   203.3 @@ -1,119 +0,0 @@
   203.4 -\documentclass{article}
   203.5 -\usepackage{verbdef}
   203.6 -\usepackage{hyperref}
   203.7 -
   203.8 -\verbdef\simplevariable=$[0-9A-Za-z_]+=
   203.9 -\verbdef\statementvariable=$[0-9A-Za-z_]+;=
  203.10 -\verbdef\multipletreevariable=$[0-9A-Za-z_]+$=
  203.11 -\verbdef\multiplestatementvariable=$[0-9A-Za-z_]+$;=
  203.12 -\verbdef\wholepattern=$_=
  203.13 -\verbdef\reserved=$$[0-9A-Za-z_]+=
  203.14 -
  203.15 -\begin{document}
  203.16 -
  203.17 -\section{Rules Language}
  203.18 -
  203.19 -\subsection{Basic Structure}
  203.20 -
  203.21 -The rules file consists of any number of transformation rules.
  203.22 -The rule is defined as follows:
  203.23 -\begin{verbatim}
  203.24 -    <pattern>
  203.25 -=> <fix-pattern>
  203.26 -=> <fix-pattern>
  203.27 -;;
  203.28 -\end{verbatim}
  203.29 -
  203.30 -Each occurrence of \verb=<pattern>= in the source code can be rewritten to one
  203.31 -of the \verb=<fix-pattern>=s. For example, the following transformation rule:
  203.32 -\begin{verbatim}
  203.33 -   $1 == null
  203.34 -=> null == $1
  203.35 -;;
  203.36 -\end{verbatim}
  203.37 -
  203.38 -will rewrite the following code:
  203.39 -\begin{verbatim}
  203.40 -if (a == null) {
  203.41 -   System.err.println("a is null");
  203.42 -}
  203.43 -\end{verbatim}
  203.44 -to:
  203.45 -\begin{verbatim}
  203.46 -if (null == a) {
  203.47 -    System.err.println("a is null");
  203.48 -}
  203.49 -\end{verbatim}
  203.50 -
  203.51 -Note: \verb=$1$= is a variable, explained \hyperref{below}{in Section~}{variables}{}.
  203.52 -
  203.53 -Note: batch refactoring will typically use only the first applicable fix patterns
  203.54 -of each applicable rule.
  203.55 -
  203.56 -\subsection{Patterns}
  203.57 -
  203.58 -The pattern is a Java expression, statement or several statements.
  203.59 -All references to classes in the pattern need to be resolvable, i.e. either fully
  203.60 -qualified names need to be used, or the custom import section must be used
  203.61 -(see \hyperref{Custom Imports}{Section~}{custom-import}{}).
  203.62 -
  203.63 -TODO: equivalence - static elements are checked only against themselves, blocks with
  203.64 -one statement considered equivalent to single statement.
  203.65 -
  203.66 -Note: variable declaration is a Java statement.
  203.67 -
  203.68 -\subsection{Variables}
  203.69 -
  203.70 -Variables start with the dollar sign (\verb=$=). In the pattern, first occurrences
  203.71 -of a variable is bound to the actual sub-tree that appears in the code. Second and
  203.72 -following occurrences of the variable the actual sub-tree is verified against the subtree
  203.73 -bound to the variable. The pattern occurs in the text only if the actual sub-tree
  203.74 -matches the sub-tree bound to the variable. In the fix pattern, all occurrences of
  203.75 -the variables are replaced with the tree(s) bound to the respective variables.
  203.76 -
  203.77 -The forms of the variables are:
  203.78 -\begin{description}
  203.79 -\item[\simplevariable]{any expression}
  203.80 -\item[\statementvariable]{any statement}
  203.81 -\item[\multipletreevariable]{any number of sub-trees (except statements - see next definition)}
  203.82 -\item[\multiplestatementvariable]{any number of statements}
  203.83 -\item[\wholepattern]{for patterns undefined, for fixes and conditions automatically bound to the current matched region}
  203.84 -\item[\reserved]{reserved -- do not use}
  203.85 -\end{description}
  203.86 -
  203.87 -\subsection{Conditions}
  203.88 -
  203.89 -Both the search and fix patterns may specify additional conditions. These conditions
  203.90 -are specified after \verb=::=. Currently, the conditions have the following
  203.91 -limitations:
  203.92 -
  203.93 -\begin{verbatim}
  203.94 -   $1.isDirectory() :: $1 instanceof java.io.File
  203.95 -=> !$1.isFile()
  203.96 -;;
  203.97 -\end{verbatim}
  203.98 -
  203.99 -will rewrite the following code:
 203.100 -\begin{verbatim}
 203.101 -java.io.File testFile = new java.io.File("/tmp");
 203.102 -if (testFile.isDirectory()) {
 203.103 -    System.err.println("/tmp is a directory");
 203.104 -}
 203.105 -\end{verbatim}
 203.106 -to:
 203.107 -\begin{verbatim}
 203.108 -java.io.File testFile = new java.io.File("/tmp");
 203.109 -if (!testFile.isFile()) {
 203.110 -    System.err.println("/tmp is a directory");
 203.111 -}
 203.112 -\end{verbatim}
 203.113 -
 203.114 -\subsection{Display Names and Localization}
 203.115 -
 203.116 -\subsection{Custom Conditions}
 203.117 -
 203.118 -\subsection{Custom Import}
 203.119 -
 203.120 -\subsection{Options}
 203.121 -
 203.122 -\end{document}
   204.1 --- a/sandbox/old-modules/help/jackpot30-helpset.xml	Sun Jan 08 20:10:08 2017 +0100
   204.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   204.3 @@ -1,74 +0,0 @@
   204.4 -<?xml version="1.0" encoding="UTF-8"?>
   204.5 -<!--
   204.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   204.7 -
   204.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   204.9 -
  204.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  204.11 -Other names may be trademarks of their respective owners.
  204.12 -
  204.13 -The contents of this file are subject to the terms of either the GNU
  204.14 -General Public License Version 2 only ("GPL") or the Common
  204.15 -Development and Distribution License("CDDL") (collectively, the
  204.16 -"License"). You may not use this file except in compliance with the
  204.17 -License. You can obtain a copy of the License at
  204.18 -http://www.netbeans.org/cddl-gplv2.html
  204.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  204.20 -specific language governing permissions and limitations under the
  204.21 -License.  When distributing the software, include this License Header
  204.22 -Notice in each file and include the License file at
  204.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  204.24 -particular file as subject to the "Classpath" exception as provided
  204.25 -by Oracle in the GPL Version 2 section of the License file that
  204.26 -accompanied this code. If applicable, add the following below the
  204.27 -License Header, with the fields enclosed by brackets [] replaced by
  204.28 -your own identifying information:
  204.29 -"Portions Copyrighted [year] [name of copyright owner]"
  204.30 -
  204.31 -Contributor(s):
  204.32 -
  204.33 -The Original Software is NetBeans. The Initial Developer of the Original
  204.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  204.35 -Microsystems, Inc. All Rights Reserved.
  204.36 -
  204.37 -If you wish your version of this file to be governed by only the CDDL
  204.38 -or only the GPL Version 2, indicate your decision by adding
  204.39 -"[Contributor] elects to include this software in this distribution
  204.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  204.41 -single choice of license, a recipient has the option to distribute
  204.42 -your version of this file under either the CDDL, the GPL Version 2 or
  204.43 -to extend the choice of license to its licensees as provided above.
  204.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  204.45 -Version 2 license, then the option applies only if the new code is
  204.46 -made subject to such option by the copyright holder.
  204.47 --->
  204.48 -<!--
  204.49 -To change this template, choose Tools | Templates
  204.50 -and open the template in the editor.
  204.51 --->
  204.52 -<!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 2.0//EN" "http://java.sun.com/products/javahelp/helpset_2_0.dtd">
  204.53 -<helpset version="2.0">
  204.54 -    <title>Jackpot 3.0 Help</title>
  204.55 -    <maps>
  204.56 -        <homeID>jackpot30.about</homeID>
  204.57 -        <mapref location="jackpot30-map.xml"/>
  204.58 -    </maps>
  204.59 -    <view mergetype="javax.help.AppendMerge">
  204.60 -        <name>TOC</name>
  204.61 -        <label>Table of Contents</label>
  204.62 -        <type>javax.help.TOCView</type>
  204.63 -        <data>jackpot30-toc.xml</data>
  204.64 -    </view>
  204.65 -<!--    <view mergetype="javax.help.AppendMerge">
  204.66 -        <name>Index</name>
  204.67 -        <label>Index</label>
  204.68 -        <type>javax.help.IndexView</type>
  204.69 -        <data>dsaf-idx.xml</data>
  204.70 -    </view>-->
  204.71 -<!--    <view>
  204.72 -        <name>Search</name>
  204.73 -        <label>Search</label>
  204.74 -        <type>javax.help.SearchView</type>
  204.75 -        <data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
  204.76 -    </view>-->
  204.77 -</helpset>
   205.1 --- a/sandbox/old-modules/help/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
   205.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   205.3 @@ -1,7 +0,0 @@
   205.4 -Manifest-Version: 1.0
   205.5 -OpenIDE-Module: org.netbeans.modules.jackpot30.help
   205.6 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/help/layer.xml
   205.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/help/Bundle.properties
   205.8 -OpenIDE-Module-Specification-Version: 1.16
   205.9 -OpenIDE-Module-Requires: org.netbeans.api.javahelp.Help
  205.10 -Class-Path: docs/org-netbeans-modules-jackpot30-help.jar
   206.1 --- a/sandbox/old-modules/help/nbproject-help.tex/build-settings.properties	Sun Jan 08 20:10:08 2017 +0100
   206.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   206.3 @@ -1,44 +0,0 @@
   206.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   206.5 -#
   206.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   206.7 -#
   206.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   206.9 -# Other names may be trademarks of their respective owners.
  206.10 -#
  206.11 -# The contents of this file are subject to the terms of either the GNU
  206.12 -# General Public License Version 2 only ("GPL") or the Common
  206.13 -# Development and Distribution License("CDDL") (collectively, the
  206.14 -# "License"). You may not use this file except in compliance with the
  206.15 -# License. You can obtain a copy of the License at
  206.16 -# http://www.netbeans.org/cddl-gplv2.html
  206.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  206.18 -# specific language governing permissions and limitations under the
  206.19 -# License.  When distributing the software, include this License Header
  206.20 -# Notice in each file and include the License file at
  206.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  206.22 -# particular file as subject to the "Classpath" exception as provided
  206.23 -# by Oracle in the GPL Version 2 section of the License file that
  206.24 -# accompanied this code. If applicable, add the following below the
  206.25 -# License Header, with the fields enclosed by brackets [] replaced by
  206.26 -# your own identifying information:
  206.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  206.28 -#
  206.29 -# Contributor(s):
  206.30 -#
  206.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  206.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  206.33 -# Microsystems, Inc. All Rights Reserved.
  206.34 -#
  206.35 -# If you wish your version of this file to be governed by only the CDDL
  206.36 -# or only the GPL Version 2, indicate your decision by adding
  206.37 -# "[Contributor] elects to include this software in this distribution
  206.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  206.39 -# single choice of license, a recipient has the option to distribute
  206.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  206.41 -# to extend the choice of license to its licensees as provided above.
  206.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  206.43 -# Version 2 license, then the option applies only if the new code is
  206.44 -# made subject to such option by the copyright holder.
  206.45 -build-configuration-name=latexdvips
  206.46 -
  206.47 -mainfile=../jackpot30-help.tex
   207.1 --- a/sandbox/old-modules/help/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
   207.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   207.3 @@ -1,73 +0,0 @@
   207.4 -<?xml version="1.0" encoding="UTF-8"?>
   207.5 -<!--
   207.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   207.7 -
   207.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   207.9 -
  207.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  207.11 -Other names may be trademarks of their respective owners.
  207.12 -
  207.13 -The contents of this file are subject to the terms of either the GNU
  207.14 -General Public License Version 2 only ("GPL") or the Common
  207.15 -Development and Distribution License("CDDL") (collectively, the
  207.16 -"License"). You may not use this file except in compliance with the
  207.17 -License. You can obtain a copy of the License at
  207.18 -http://www.netbeans.org/cddl-gplv2.html
  207.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  207.20 -specific language governing permissions and limitations under the
  207.21 -License.  When distributing the software, include this License Header
  207.22 -Notice in each file and include the License file at
  207.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  207.24 -particular file as subject to the "Classpath" exception as provided
  207.25 -by Oracle in the GPL Version 2 section of the License file that
  207.26 -accompanied this code. If applicable, add the following below the
  207.27 -License Header, with the fields enclosed by brackets [] replaced by
  207.28 -your own identifying information:
  207.29 -"Portions Copyrighted [year] [name of copyright owner]"
  207.30 -
  207.31 -Contributor(s):
  207.32 -
  207.33 -The Original Software is NetBeans. The Initial Developer of the Original
  207.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  207.35 -Microsystems, Inc. All Rights Reserved.
  207.36 -
  207.37 -If you wish your version of this file to be governed by only the CDDL
  207.38 -or only the GPL Version 2, indicate your decision by adding
  207.39 -"[Contributor] elects to include this software in this distribution
  207.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  207.41 -single choice of license, a recipient has the option to distribute
  207.42 -your version of this file under either the CDDL, the GPL Version 2 or
  207.43 -to extend the choice of license to its licensees as provided above.
  207.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  207.45 -Version 2 license, then the option applies only if the new code is
  207.46 -made subject to such option by the copyright holder.
  207.47 --->
  207.48 -<!--
  207.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
  207.50 -***         EDIT ../build.xml INSTEAD         ***
  207.51 --->
  207.52 -<project name="org.netbeans.modules.jackpot30.help-impl" basedir="..">
  207.53 -    <property file="nbproject/private/suite-private.properties"/>
  207.54 -    <property file="nbproject/suite.properties"/>
  207.55 -    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
  207.56 -    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
  207.57 -    <property file="${suite.dir}/nbproject/platform.properties"/>
  207.58 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
  207.59 -        <attribute name="name"/>
  207.60 -        <attribute name="value"/>
  207.61 -        <sequential>
  207.62 -            <property name="@{name}" value="${@{value}}"/>
  207.63 -        </sequential>
  207.64 -    </macrodef>
  207.65 -    <property file="${user.properties.file}"/>
  207.66 -    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  207.67 -    <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  207.68 -    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
  207.69 -        <condition>
  207.70 -            <not>
  207.71 -                <available file="${harness.dir}" type="dir"/>
  207.72 -            </not>
  207.73 -        </condition>
  207.74 -    </fail>
  207.75 -    <import file="${harness.dir}/build.xml"/>
  207.76 -</project>
   208.1 --- a/sandbox/old-modules/help/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
   208.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   208.3 @@ -1,49 +0,0 @@
   208.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   208.5 -#
   208.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   208.7 -#
   208.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   208.9 -# Other names may be trademarks of their respective owners.
  208.10 -#
  208.11 -# The contents of this file are subject to the terms of either the GNU
  208.12 -# General Public License Version 2 only ("GPL") or the Common
  208.13 -# Development and Distribution License("CDDL") (collectively, the
  208.14 -# "License"). You may not use this file except in compliance with the
  208.15 -# License. You can obtain a copy of the License at
  208.16 -# http://www.netbeans.org/cddl-gplv2.html
  208.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  208.18 -# specific language governing permissions and limitations under the
  208.19 -# License.  When distributing the software, include this License Header
  208.20 -# Notice in each file and include the License file at
  208.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  208.22 -# particular file as subject to the "Classpath" exception as provided
  208.23 -# by Oracle in the GPL Version 2 section of the License file that
  208.24 -# accompanied this code. If applicable, add the following below the
  208.25 -# License Header, with the fields enclosed by brackets [] replaced by
  208.26 -# your own identifying information:
  208.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  208.28 -#
  208.29 -# Contributor(s):
  208.30 -#
  208.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  208.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  208.33 -# Microsystems, Inc. All Rights Reserved.
  208.34 -#
  208.35 -# If you wish your version of this file to be governed by only the CDDL
  208.36 -# or only the GPL Version 2, indicate your decision by adding
  208.37 -# "[Contributor] elects to include this software in this distribution
  208.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  208.39 -# single choice of license, a recipient has the option to distribute
  208.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  208.41 -# to extend the choice of license to its licensees as provided above.
  208.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  208.43 -# Version 2 license, then the option applies only if the new code is
  208.44 -# made subject to such option by the copyright holder.
  208.45 -build.xml.data.CRC32=ffaf56d3
  208.46 -build.xml.script.CRC32=12cad5e6
  208.47 -build.xml.stylesheet.CRC32=79c3b980@1.29.0.7
  208.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
  208.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
  208.50 -nbproject/build-impl.xml.data.CRC32=ffaf56d3
  208.51 -nbproject/build-impl.xml.script.CRC32=4673e324
  208.52 -nbproject/build-impl.xml.stylesheet.CRC32=68e521fc@2.70
   209.1 --- a/sandbox/old-modules/help/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
   209.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   209.3 @@ -1,43 +0,0 @@
   209.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   209.5 -#
   209.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   209.7 -#
   209.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   209.9 -# Other names may be trademarks of their respective owners.
  209.10 -#
  209.11 -# The contents of this file are subject to the terms of either the GNU
  209.12 -# General Public License Version 2 only ("GPL") or the Common
  209.13 -# Development and Distribution License("CDDL") (collectively, the
  209.14 -# "License"). You may not use this file except in compliance with the
  209.15 -# License. You can obtain a copy of the License at
  209.16 -# http://www.netbeans.org/cddl-gplv2.html
  209.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  209.18 -# specific language governing permissions and limitations under the
  209.19 -# License.  When distributing the software, include this License Header
  209.20 -# Notice in each file and include the License file at
  209.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  209.22 -# particular file as subject to the "Classpath" exception as provided
  209.23 -# by Oracle in the GPL Version 2 section of the License file that
  209.24 -# accompanied this code. If applicable, add the following below the
  209.25 -# License Header, with the fields enclosed by brackets [] replaced by
  209.26 -# your own identifying information:
  209.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  209.28 -#
  209.29 -# Contributor(s):
  209.30 -#
  209.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  209.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  209.33 -# Microsystems, Inc. All Rights Reserved.
  209.34 -#
  209.35 -# If you wish your version of this file to be governed by only the CDDL
  209.36 -# or only the GPL Version 2, indicate your decision by adding
  209.37 -# "[Contributor] elects to include this software in this distribution
  209.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  209.39 -# single choice of license, a recipient has the option to distribute
  209.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  209.41 -# to extend the choice of license to its licensees as provided above.
  209.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  209.43 -# Version 2 license, then the option applies only if the new code is
  209.44 -# made subject to such option by the copyright holder.
  209.45 -javac.source=1.5
  209.46 -javac.compilerargs=-Xlint -Xlint:-serial
   210.1 --- a/sandbox/old-modules/help/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
   210.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   210.3 @@ -1,55 +0,0 @@
   210.4 -<?xml version="1.0" encoding="UTF-8"?>
   210.5 -<!--
   210.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   210.7 -
   210.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   210.9 -
  210.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  210.11 -Other names may be trademarks of their respective owners.
  210.12 -
  210.13 -The contents of this file are subject to the terms of either the GNU
  210.14 -General Public License Version 2 only ("GPL") or the Common
  210.15 -Development and Distribution License("CDDL") (collectively, the
  210.16 -"License"). You may not use this file except in compliance with the
  210.17 -License. You can obtain a copy of the License at
  210.18 -http://www.netbeans.org/cddl-gplv2.html
  210.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  210.20 -specific language governing permissions and limitations under the
  210.21 -License.  When distributing the software, include this License Header
  210.22 -Notice in each file and include the License file at
  210.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  210.24 -particular file as subject to the "Classpath" exception as provided
  210.25 -by Oracle in the GPL Version 2 section of the License file that
  210.26 -accompanied this code. If applicable, add the following below the
  210.27 -License Header, with the fields enclosed by brackets [] replaced by
  210.28 -your own identifying information:
  210.29 -"Portions Copyrighted [year] [name of copyright owner]"
  210.30 -
  210.31 -Contributor(s):
  210.32 -
  210.33 -The Original Software is NetBeans. The Initial Developer of the Original
  210.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  210.35 -Microsystems, Inc. All Rights Reserved.
  210.36 -
  210.37 -If you wish your version of this file to be governed by only the CDDL
  210.38 -or only the GPL Version 2, indicate your decision by adding
  210.39 -"[Contributor] elects to include this software in this distribution
  210.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  210.41 -single choice of license, a recipient has the option to distribute
  210.42 -your version of this file under either the CDDL, the GPL Version 2 or
  210.43 -to extend the choice of license to its licensees as provided above.
  210.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  210.45 -Version 2 license, then the option applies only if the new code is
  210.46 -made subject to such option by the copyright holder.
  210.47 --->
  210.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
  210.49 -    <type>org.netbeans.modules.apisupport.project</type>
  210.50 -    <configuration>
  210.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
  210.52 -            <code-name-base>org.netbeans.modules.jackpot30.help</code-name-base>
  210.53 -            <suite-component/>
  210.54 -            <module-dependencies/>
  210.55 -            <public-packages/>
  210.56 -        </data>
  210.57 -    </configuration>
  210.58 -</project>
   211.1 --- a/sandbox/old-modules/help/nbproject/suite.properties	Sun Jan 08 20:10:08 2017 +0100
   211.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   211.3 @@ -1,42 +0,0 @@
   211.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   211.5 -#
   211.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   211.7 -#
   211.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   211.9 -# Other names may be trademarks of their respective owners.
  211.10 -#
  211.11 -# The contents of this file are subject to the terms of either the GNU
  211.12 -# General Public License Version 2 only ("GPL") or the Common
  211.13 -# Development and Distribution License("CDDL") (collectively, the
  211.14 -# "License"). You may not use this file except in compliance with the
  211.15 -# License. You can obtain a copy of the License at
  211.16 -# http://www.netbeans.org/cddl-gplv2.html
  211.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  211.18 -# specific language governing permissions and limitations under the
  211.19 -# License.  When distributing the software, include this License Header
  211.20 -# Notice in each file and include the License file at
  211.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  211.22 -# particular file as subject to the "Classpath" exception as provided
  211.23 -# by Oracle in the GPL Version 2 section of the License file that
  211.24 -# accompanied this code. If applicable, add the following below the
  211.25 -# License Header, with the fields enclosed by brackets [] replaced by
  211.26 -# your own identifying information:
  211.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  211.28 -#
  211.29 -# Contributor(s):
  211.30 -#
  211.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  211.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  211.33 -# Microsystems, Inc. All Rights Reserved.
  211.34 -#
  211.35 -# If you wish your version of this file to be governed by only the CDDL
  211.36 -# or only the GPL Version 2, indicate your decision by adding
  211.37 -# "[Contributor] elects to include this software in this distribution
  211.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  211.39 -# single choice of license, a recipient has the option to distribute
  211.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  211.41 -# to extend the choice of license to its licensees as provided above.
  211.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  211.43 -# Version 2 license, then the option applies only if the new code is
  211.44 -# made subject to such option by the copyright holder.
  211.45 -suite.dir=${basedir}/..
   212.1 --- a/sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   212.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   212.3 @@ -1,38 +0,0 @@
   212.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   212.5 -#
   212.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   212.7 -#
   212.8 -# The contents of this file are subject to the terms of either the GNU
   212.9 -# General Public License Version 2 only ("GPL") or the Common
  212.10 -# Development and Distribution License("CDDL") (collectively, the
  212.11 -# "License"). You may not use this file except in compliance with the
  212.12 -# License. You can obtain a copy of the License at
  212.13 -# http://www.netbeans.org/cddl-gplv2.html
  212.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  212.15 -# specific language governing permissions and limitations under the
  212.16 -# License.  When distributing the software, include this License Header
  212.17 -# Notice in each file and include the License file at
  212.18 -# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  212.19 -# particular file as subject to the "Classpath" exception as provided
  212.20 -# by Sun in the GPL Version 2 section of the License file that
  212.21 -# accompanied this code. If applicable, add the following below the
  212.22 -# License Header, with the fields enclosed by brackets [] replaced by
  212.23 -# your own identifying information:
  212.24 -# "Portions Copyrighted [year] [name of copyright owner]"
  212.25 -#
  212.26 -# If you wish your version of this file to be governed by only the CDDL
  212.27 -# or only the GPL Version 2, indicate your decision by adding
  212.28 -# "[Contributor] elects to include this software in this distribution
  212.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  212.30 -# single choice of license, a recipient has the option to distribute
  212.31 -# your version of this file under either the CDDL, the GPL Version 2 or
  212.32 -# to extend the choice of license to its licensees as provided above.
  212.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  212.34 -# Version 2 license, then the option applies only if the new code is
  212.35 -# made subject to such option by the copyright holder.
  212.36 -#
  212.37 -# Contributor(s):
  212.38 -#
  212.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
  212.40 -
  212.41 -OpenIDE-Module-Name=Jackpot 3.0 Help
   213.1 --- a/sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/CreateMap.java	Sun Jan 08 20:10:08 2017 +0100
   213.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   213.3 @@ -1,196 +0,0 @@
   213.4 -/*
   213.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   213.6 - *
   213.7 - * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
   213.8 - *
   213.9 - * The contents of this file are subject to the terms of either the GNU
  213.10 - * General Public License Version 2 only ("GPL") or the Common
  213.11 - * Development and Distribution License("CDDL") (collectively, the
  213.12 - * "License"). You may not use this file except in compliance with the
  213.13 - * License. You can obtain a copy of the License at
  213.14 - * http://www.netbeans.org/cddl-gplv2.html
  213.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  213.16 - * specific language governing permissions and limitations under the
  213.17 - * License.  When distributing the software, include this License Header
  213.18 - * Notice in each file and include the License file at
  213.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  213.20 - * particular file as subject to the "Classpath" exception as provided
  213.21 - * by Sun in the GPL Version 2 section of the License file that
  213.22 - * accompanied this code. If applicable, add the following below the
  213.23 - * License Header, with the fields enclosed by brackets [] replaced by
  213.24 - * your own identifying information:
  213.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  213.26 - *
  213.27 - * Contributor(s):
  213.28 - *
  213.29 - * The Original Software is the LaTeX module.
  213.30 - * The Initial Developer of the Original Software is Jan Lahoda.
  213.31 - * Portions created by Jan Lahoda_ are Copyright (C) 2002-2009.
  213.32 - * All Rights Reserved.
  213.33 - *
  213.34 - * If you wish your version of this file to be governed by only the CDDL
  213.35 - * or only the GPL Version 2, indicate your decision by adding
  213.36 - * "[Contributor] elects to include this software in this distribution
  213.37 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  213.38 - * single choice of license, a recipient has the option to distribute
  213.39 - * your version of this file under either the CDDL, the GPL Version 2 or
  213.40 - * to extend the choice of license to its licensees as provided above.
  213.41 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  213.42 - * Version 2 license, then the option applies only if the new code is
  213.43 - * made subject to such option by the copyright holder.
  213.44 - *
  213.45 - * Contributor(s): Jan Lahoda.
  213.46 - */
  213.47 -package org.netbeans.modules.jackpot30.help;
  213.48 -
  213.49 -import java.io.BufferedReader;
  213.50 -import java.io.File;
  213.51 -import java.io.FileReader;
  213.52 -import java.io.FileWriter;
  213.53 -import java.io.IOException;
  213.54 -import java.io.PrintWriter;
  213.55 -import java.util.HashMap;
  213.56 -import java.util.Map;
  213.57 -
  213.58 -/**
  213.59 - *
  213.60 - * @author Jan Lahoda
  213.61 - */
  213.62 -public class CreateMap {
  213.63 -
  213.64 -    public CreateMap() {}
  213.65 -
  213.66 -    /**
  213.67 -     * @param args the command line arguments
  213.68 -     */
  213.69 -    public static void main(String[] args) throws IOException {
  213.70 -        if (args.length != 1) {
  213.71 -	    System.err.println("Incorrect number of arguments, one argument containing the location of the base dir is required.");
  213.72 -	    return ;
  213.73 -	}
  213.74 -	
  213.75 -        File baseDir = new File(args[0]);
  213.76 -	
  213.77 -	if (!baseDir.exists()) {
  213.78 -	   System.err.println(baseDir.getAbsolutePath() + " does not exist.");
  213.79 -	   return ;
  213.80 -	}
  213.81 -        
  213.82 -	if (!baseDir.isDirectory()) {
  213.83 -	   System.err.println(baseDir.getAbsolutePath() + " is not a directory.");
  213.84 -	   return ;
  213.85 -	}
  213.86 -	
  213.87 -        File in  = new File(baseDir, "labels.pl");
  213.88 -        File out = new File(baseDir, "jackpot30-map.xml");
  213.89 -        
  213.90 -        Map<String, String> map = createMapFile(in, out);
  213.91 -        
  213.92 -        File outTOC = new File(baseDir, "jackpot30-toc.xml");
  213.93 -        File inTOC  = new File(baseDir, "jackpot30-help.html");
  213.94 -        
  213.95 -        createTOC(inTOC, outTOC, map);
  213.96 -    }
  213.97 -    
  213.98 -    private static Map<String, String> createMapFile(File in, File out) throws IOException {
  213.99 -        BufferedReader      input  = new BufferedReader(new FileReader(in));
 213.100 -        PrintWriter         output = new PrintWriter(new FileWriter(out));
 213.101 -        Map<String, String> map    = new HashMap<String, String>();
 213.102 -
 213.103 -        output.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
 213.104 -        output.println();
 213.105 -        output.println("<!DOCTYPE map");
 213.106 -        output.println("  PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN\"");
 213.107 -        output.println("         \"file:///home/lahvac/netbeans/netbeans/bin/nbuser/sampledir/javahelp/map_1_0.dtd\">");
 213.108 -        output.println("<!--This is the original DTD: \"http://java.sun.com/products/javahelp/map_1_0.dtd\"-->");
 213.109 -        output.println();
 213.110 -        output.println("<map version=\"1.0\">");
 213.111 -        
 213.112 -        output.println("<mapID target=\"jackpot30.default\" url=\"jackpot30-help.html\" />");
 213.113 -
 213.114 -        String line = null;
 213.115 -        String actualKey = null;
 213.116 -        
 213.117 -        while ((line = input.readLine()) != null) {
 213.118 -            if (line.startsWith("$key")) {
 213.119 -                actualKey = line.split("/")[1];
 213.120 -                actualKey = "jackpot30." + actualKey.replace(':', '.');
 213.121 -            }
 213.122 -            
 213.123 -            if (line.startsWith("$external_labels")) {
 213.124 -                String url = line.split("\\|")[1];
 213.125 -                
 213.126 -                output.print("<mapID target=\"");
 213.127 -                output.print(actualKey);
 213.128 -                output.print("\" url=\"");
 213.129 -                output.print(url);
 213.130 -                output.println("\"/>");
 213.131 -                
 213.132 -                map.put(url, actualKey);
 213.133 -                
 213.134 -                actualKey = null;
 213.135 -            }
 213.136 -        }
 213.137 -
 213.138 -        output.println("</map>");
 213.139 -        output.close();
 213.140 -        input.close();
 213.141 -        
 213.142 -        return map;
 213.143 -    }
 213.144 -
 213.145 -    private static void createTOC(File in, File out, Map<String, String> map) throws IOException {
 213.146 -        BufferedReader input  = new BufferedReader(new FileReader(in));
 213.147 -        PrintWriter    output = new PrintWriter(new FileWriter(out));
 213.148 -        
 213.149 -        String line  = null;
 213.150 -        boolean noStop = false;
 213.151 -        
 213.152 -        output.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
 213.153 -        output.println();
 213.154 -        output.println("<!DOCTYPE toc");
 213.155 -        output.println("  PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN\"");
 213.156 -        output.println("         \"file:///home/lahvac/netbeans/netbeans/bin/nbuser/sampledir/javahelp/toc_1_0.dtd\">");
 213.157 -        output.println("<!--This is the original DTD: \"http://java.sun.com/products/javahelp/toc_1_0.dtd\"-->");
 213.158 -        output.println();
 213.159 -        output.println("<toc version=\"1.0\">");
 213.160 -
 213.161 -        while ((line = input.readLine()) != null && line.indexOf("<!--Table of Child-Links-->") == (-1))
 213.162 -            ;
 213.163 -        
 213.164 -        output.println("<tocitem text=\"Jackpot 3.0 Support Help\" target=\"jackpot30.default\">");
 213.165 -        while ((line = input.readLine()) != null && line.indexOf("<!--End of Table of Child-Links-->") == (-1)) {
 213.166 -            if (line.startsWith("<UL ")) {
 213.167 -                noStop = true;
 213.168 -                continue;
 213.169 -            }
 213.170 -            
 213.171 -            if (line.indexOf("HREF=\"") != (-1)) {
 213.172 -                if (noStop) {
 213.173 -                    noStop = false;
 213.174 -                } else {
 213.175 -                    output.println("</tocitem>");
 213.176 -                }
 213.177 -                
 213.178 -                String file = line.split("\"")[1];
 213.179 -                String name = line.split(">")[1].split("<")[0];
 213.180 -                
 213.181 -                output.println("<tocitem text=\"" + name + "\" target=\"" + (map.get(file) != null ? map.get(file) : "test") + "\">");
 213.182 -                
 213.183 -                continue;
 213.184 -            }
 213.185 -            
 213.186 -            if (line.startsWith("</UL>") && !noStop) {
 213.187 -                output.println("</tocitem>");
 213.188 -                continue;
 213.189 -            }
 213.190 -        }
 213.191 -        
 213.192 -        output.println("</tocitem>");
 213.193 -        
 213.194 -        output.println("</toc>");
 213.195 -        
 213.196 -        output.close();
 213.197 -        input.close();
 213.198 -    }
 213.199 -}
   214.1 --- a/sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/jackpot30-helpset.xml	Sun Jan 08 20:10:08 2017 +0100
   214.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   214.3 @@ -1,46 +0,0 @@
   214.4 -<?xml version="1.0" encoding="UTF-8"?>
   214.5 -<!--
   214.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   214.7 -
   214.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   214.9 -
  214.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  214.11 -Other names may be trademarks of their respective owners.
  214.12 -
  214.13 -The contents of this file are subject to the terms of either the GNU
  214.14 -General Public License Version 2 only ("GPL") or the Common
  214.15 -Development and Distribution License("CDDL") (collectively, the
  214.16 -"License"). You may not use this file except in compliance with the
  214.17 -License. You can obtain a copy of the License at
  214.18 -http://www.netbeans.org/cddl-gplv2.html
  214.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  214.20 -specific language governing permissions and limitations under the
  214.21 -License.  When distributing the software, include this License Header
  214.22 -Notice in each file and include the License file at
  214.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  214.24 -particular file as subject to the "Classpath" exception as provided
  214.25 -by Oracle in the GPL Version 2 section of the License file that
  214.26 -accompanied this code. If applicable, add the following below the
  214.27 -License Header, with the fields enclosed by brackets [] replaced by
  214.28 -your own identifying information:
  214.29 -"Portions Copyrighted [year] [name of copyright owner]"
  214.30 -
  214.31 -Contributor(s):
  214.32 -
  214.33 -The Original Software is NetBeans. The Initial Developer of the Original
  214.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  214.35 -Microsystems, Inc. All Rights Reserved.
  214.36 -
  214.37 -If you wish your version of this file to be governed by only the CDDL
  214.38 -or only the GPL Version 2, indicate your decision by adding
  214.39 -"[Contributor] elects to include this software in this distribution
  214.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  214.41 -single choice of license, a recipient has the option to distribute
  214.42 -your version of this file under either the CDDL, the GPL Version 2 or
  214.43 -to extend the choice of license to its licensees as provided above.
  214.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  214.45 -Version 2 license, then the option applies only if the new code is
  214.46 -made subject to such option by the copyright holder.
  214.47 --->
  214.48 -<!DOCTYPE helpsetref PUBLIC "-//NetBeans//DTD JavaHelp Help Set Reference 1.0//EN" "http://www.netbeans.org/dtds/helpsetref-1_0.dtd">
  214.49 -<helpsetref url="nbdocs:/org/netbeans/modules/jackpot30/help/docs/jackpot30-helpset.xml" />
   215.1 --- a/sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/layer.xml	Sun Jan 08 20:10:08 2017 +0100
   215.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   215.3 @@ -1,54 +0,0 @@
   215.4 -<?xml version="1.0" encoding="UTF-8"?>
   215.5 -<!--
   215.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   215.7 -
   215.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   215.9 -
  215.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  215.11 -Other names may be trademarks of their respective owners.
  215.12 -
  215.13 -The contents of this file are subject to the terms of either the GNU
  215.14 -General Public License Version 2 only ("GPL") or the Common
  215.15 -Development and Distribution License("CDDL") (collectively, the
  215.16 -"License"). You may not use this file except in compliance with the
  215.17 -License. You can obtain a copy of the License at
  215.18 -http://www.netbeans.org/cddl-gplv2.html
  215.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  215.20 -specific language governing permissions and limitations under the
  215.21 -License.  When distributing the software, include this License Header
  215.22 -Notice in each file and include the License file at
  215.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  215.24 -particular file as subject to the "Classpath" exception as provided
  215.25 -by Oracle in the GPL Version 2 section of the License file that
  215.26 -accompanied this code. If applicable, add the following below the
  215.27 -License Header, with the fields enclosed by brackets [] replaced by
  215.28 -your own identifying information:
  215.29 -"Portions Copyrighted [year] [name of copyright owner]"
  215.30 -
  215.31 -Contributor(s):
  215.32 -
  215.33 -The Original Software is NetBeans. The Initial Developer of the Original
  215.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  215.35 -Microsystems, Inc. All Rights Reserved.
  215.36 -
  215.37 -If you wish your version of this file to be governed by only the CDDL
  215.38 -or only the GPL Version 2, indicate your decision by adding
  215.39 -"[Contributor] elects to include this software in this distribution
  215.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  215.41 -single choice of license, a recipient has the option to distribute
  215.42 -your version of this file under either the CDDL, the GPL Version 2 or
  215.43 -to extend the choice of license to its licensees as provided above.
  215.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  215.45 -Version 2 license, then the option applies only if the new code is
  215.46 -made subject to such option by the copyright holder.
  215.47 --->
  215.48 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
  215.49 -<filesystem>
  215.50 -    <folder name="Services">
  215.51 -        <folder name="JavaHelp">
  215.52 -            <file name="jackpot30-helpset.xml" url="jackpot30-helpset.xml">
  215.53 -                <attr name="position" intvalue="3456"/>
  215.54 -            </file>
  215.55 -        </folder>
  215.56 -    </folder>
  215.57 -</filesystem>
   216.1 --- a/sandbox/old-modules/hintsimpl/build.xml	Sun Jan 08 20:10:08 2017 +0100
   216.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   216.3 @@ -1,54 +0,0 @@
   216.4 -<?xml version="1.0" encoding="UTF-8"?>
   216.5 -<!--
   216.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   216.7 -
   216.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   216.9 -
  216.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  216.11 -Other names may be trademarks of their respective owners.
  216.12 -
  216.13 -The contents of this file are subject to the terms of either the GNU
  216.14 -General Public License Version 2 only ("GPL") or the Common
  216.15 -Development and Distribution License("CDDL") (collectively, the
  216.16 -"License"). You may not use this file except in compliance with the
  216.17 -License. You can obtain a copy of the License at
  216.18 -http://www.netbeans.org/cddl-gplv2.html
  216.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  216.20 -specific language governing permissions and limitations under the
  216.21 -License.  When distributing the software, include this License Header
  216.22 -Notice in each file and include the License file at
  216.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  216.24 -particular file as subject to the "Classpath" exception as provided
  216.25 -by Oracle in the GPL Version 2 section of the License file that
  216.26 -accompanied this code. If applicable, add the following below the
  216.27 -License Header, with the fields enclosed by brackets [] replaced by
  216.28 -your own identifying information:
  216.29 -"Portions Copyrighted [year] [name of copyright owner]"
  216.30 -
  216.31 -Contributor(s):
  216.32 -
  216.33 -The Original Software is NetBeans. The Initial Developer of the Original
  216.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  216.35 -Microsystems, Inc. All Rights Reserved.
  216.36 -
  216.37 -If you wish your version of this file to be governed by only the CDDL
  216.38 -or only the GPL Version 2, indicate your decision by adding
  216.39 -"[Contributor] elects to include this software in this distribution
  216.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  216.41 -single choice of license, a recipient has the option to distribute
  216.42 -your version of this file under either the CDDL, the GPL Version 2 or
  216.43 -to extend the choice of license to its licensees as provided above.
  216.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  216.45 -Version 2 license, then the option applies only if the new code is
  216.46 -made subject to such option by the copyright holder.
  216.47 --->
  216.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
  216.49 -<!-- for some information on what you could do (e.g. targets to override). -->
  216.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
  216.51 -<project name="org.netbeans.modules.jackpot30.hintsimpl" default="netbeans" basedir=".">
  216.52 -    <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.hintsimpl.</description>
  216.53 -    <import file="nbproject/build-impl.xml"/>
  216.54 -    <import file="${suite.dir}/findbugs-import.xml"/>
  216.55 -    <target name="test-coverage" />
  216.56 -    <target name="coverage-report" />
  216.57 -</project>
   217.1 --- a/sandbox/old-modules/hintsimpl/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
   217.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   217.3 @@ -1,7 +0,0 @@
   217.4 -Manifest-Version: 1.0
   217.5 -AutoUpdate-Show-In-Client: false
   217.6 -OpenIDE-Module: org.netbeans.modules.jackpot30.hintsimpl
   217.7 -OpenIDE-Module-Implementation-Version: 1
   217.8 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/hintsimpl/layer.xml
   217.9 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties
  217.10 -
   218.1 --- a/sandbox/old-modules/hintsimpl/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
   218.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   218.3 @@ -1,73 +0,0 @@
   218.4 -<?xml version="1.0" encoding="UTF-8"?>
   218.5 -<!--
   218.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   218.7 -
   218.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   218.9 -
  218.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  218.11 -Other names may be trademarks of their respective owners.
  218.12 -
  218.13 -The contents of this file are subject to the terms of either the GNU
  218.14 -General Public License Version 2 only ("GPL") or the Common
  218.15 -Development and Distribution License("CDDL") (collectively, the
  218.16 -"License"). You may not use this file except in compliance with the
  218.17 -License. You can obtain a copy of the License at
  218.18 -http://www.netbeans.org/cddl-gplv2.html
  218.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  218.20 -specific language governing permissions and limitations under the
  218.21 -License.  When distributing the software, include this License Header
  218.22 -Notice in each file and include the License file at
  218.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  218.24 -particular file as subject to the "Classpath" exception as provided
  218.25 -by Oracle in the GPL Version 2 section of the License file that
  218.26 -accompanied this code. If applicable, add the following below the
  218.27 -License Header, with the fields enclosed by brackets [] replaced by
  218.28 -your own identifying information:
  218.29 -"Portions Copyrighted [year] [name of copyright owner]"
  218.30 -
  218.31 -Contributor(s):
  218.32 -
  218.33 -The Original Software is NetBeans. The Initial Developer of the Original
  218.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  218.35 -Microsystems, Inc. All Rights Reserved.
  218.36 -
  218.37 -If you wish your version of this file to be governed by only the CDDL
  218.38 -or only the GPL Version 2, indicate your decision by adding
  218.39 -"[Contributor] elects to include this software in this distribution
  218.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  218.41 -single choice of license, a recipient has the option to distribute
  218.42 -your version of this file under either the CDDL, the GPL Version 2 or
  218.43 -to extend the choice of license to its licensees as provided above.
  218.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  218.45 -Version 2 license, then the option applies only if the new code is
  218.46 -made subject to such option by the copyright holder.
  218.47 --->
  218.48 -<!--
  218.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
  218.50 -***         EDIT ../build.xml INSTEAD         ***
  218.51 --->
  218.52 -<project name="org.netbeans.modules.jackpot30.hintsimpl-impl" basedir="..">
  218.53 -    <property file="nbproject/private/suite-private.properties"/>
  218.54 -    <property file="nbproject/suite.properties"/>
  218.55 -    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
  218.56 -    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
  218.57 -    <property file="${suite.dir}/nbproject/platform.properties"/>
  218.58 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
  218.59 -        <attribute name="name"/>
  218.60 -        <attribute name="value"/>
  218.61 -        <sequential>
  218.62 -            <property name="@{name}" value="${@{value}}"/>
  218.63 -        </sequential>
  218.64 -    </macrodef>
  218.65 -    <property file="${user.properties.file}"/>
  218.66 -    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  218.67 -    <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  218.68 -    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
  218.69 -        <condition>
  218.70 -            <not>
  218.71 -                <available file="${harness.dir}" type="dir"/>
  218.72 -            </not>
  218.73 -        </condition>
  218.74 -    </fail>
  218.75 -    <import file="${harness.dir}/build.xml"/>
  218.76 -</project>
   219.1 --- a/sandbox/old-modules/hintsimpl/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
   219.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   219.3 @@ -1,49 +0,0 @@
   219.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   219.5 -#
   219.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   219.7 -#
   219.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   219.9 -# Other names may be trademarks of their respective owners.
  219.10 -#
  219.11 -# The contents of this file are subject to the terms of either the GNU
  219.12 -# General Public License Version 2 only ("GPL") or the Common
  219.13 -# Development and Distribution License("CDDL") (collectively, the
  219.14 -# "License"). You may not use this file except in compliance with the
  219.15 -# License. You can obtain a copy of the License at
  219.16 -# http://www.netbeans.org/cddl-gplv2.html
  219.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  219.18 -# specific language governing permissions and limitations under the
  219.19 -# License.  When distributing the software, include this License Header
  219.20 -# Notice in each file and include the License file at
  219.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  219.22 -# particular file as subject to the "Classpath" exception as provided
  219.23 -# by Oracle in the GPL Version 2 section of the License file that
  219.24 -# accompanied this code. If applicable, add the following below the
  219.25 -# License Header, with the fields enclosed by brackets [] replaced by
  219.26 -# your own identifying information:
  219.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  219.28 -#
  219.29 -# Contributor(s):
  219.30 -#
  219.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  219.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  219.33 -# Microsystems, Inc. All Rights Reserved.
  219.34 -#
  219.35 -# If you wish your version of this file to be governed by only the CDDL
  219.36 -# or only the GPL Version 2, indicate your decision by adding
  219.37 -# "[Contributor] elects to include this software in this distribution
  219.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  219.39 -# single choice of license, a recipient has the option to distribute
  219.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  219.41 -# to extend the choice of license to its licensees as provided above.
  219.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  219.43 -# Version 2 license, then the option applies only if the new code is
  219.44 -# made subject to such option by the copyright holder.
  219.45 -build.xml.data.CRC32=772824b9
  219.46 -build.xml.script.CRC32=ef577a91
  219.47 -build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
  219.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
  219.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
  219.50 -nbproject/build-impl.xml.data.CRC32=2dfd5d11
  219.51 -nbproject/build-impl.xml.script.CRC32=af5d3c32
  219.52 -nbproject/build-impl.xml.stylesheet.CRC32=68e521fc@2.70
   220.1 --- a/sandbox/old-modules/hintsimpl/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
   220.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   220.3 @@ -1,45 +0,0 @@
   220.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   220.5 -#
   220.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   220.7 -#
   220.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   220.9 -# Other names may be trademarks of their respective owners.
  220.10 -#
  220.11 -# The contents of this file are subject to the terms of either the GNU
  220.12 -# General Public License Version 2 only ("GPL") or the Common
  220.13 -# Development and Distribution License("CDDL") (collectively, the
  220.14 -# "License"). You may not use this file except in compliance with the
  220.15 -# License. You can obtain a copy of the License at
  220.16 -# http://www.netbeans.org/cddl-gplv2.html
  220.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  220.18 -# specific language governing permissions and limitations under the
  220.19 -# License.  When distributing the software, include this License Header
  220.20 -# Notice in each file and include the License file at
  220.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  220.22 -# particular file as subject to the "Classpath" exception as provided
  220.23 -# by Oracle in the GPL Version 2 section of the License file that
  220.24 -# accompanied this code. If applicable, add the following below the
  220.25 -# License Header, with the fields enclosed by brackets [] replaced by
  220.26 -# your own identifying information:
  220.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  220.28 -#
  220.29 -# Contributor(s):
  220.30 -#
  220.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  220.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  220.33 -# Microsystems, Inc. All Rights Reserved.
  220.34 -#
  220.35 -# If you wish your version of this file to be governed by only the CDDL
  220.36 -# or only the GPL Version 2, indicate your decision by adding
  220.37 -# "[Contributor] elects to include this software in this distribution
  220.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  220.39 -# single choice of license, a recipient has the option to distribute
  220.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  220.41 -# to extend the choice of license to its licensees as provided above.
  220.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  220.43 -# Version 2 license, then the option applies only if the new code is
  220.44 -# made subject to such option by the copyright holder.
  220.45 -javac.source=1.5
  220.46 -javac.compilerargs=-Xlint -Xlint:-serial
  220.47 -project.license=cddl-netbeans-sun
  220.48 -spec.version.base=1.16.0
   221.1 --- a/sandbox/old-modules/hintsimpl/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
   221.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   221.3 @@ -1,319 +0,0 @@
   221.4 -<?xml version="1.0" encoding="UTF-8"?>
   221.5 -<!--
   221.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   221.7 -
   221.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   221.9 -
  221.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  221.11 -Other names may be trademarks of their respective owners.
  221.12 -
  221.13 -The contents of this file are subject to the terms of either the GNU
  221.14 -General Public License Version 2 only ("GPL") or the Common
  221.15 -Development and Distribution License("CDDL") (collectively, the
  221.16 -"License"). You may not use this file except in compliance with the
  221.17 -License. You can obtain a copy of the License at
  221.18 -http://www.netbeans.org/cddl-gplv2.html
  221.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  221.20 -specific language governing permissions and limitations under the
  221.21 -License.  When distributing the software, include this License Header
  221.22 -Notice in each file and include the License file at
  221.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  221.24 -particular file as subject to the "Classpath" exception as provided
  221.25 -by Oracle in the GPL Version 2 section of the License file that
  221.26 -accompanied this code. If applicable, add the following below the
  221.27 -License Header, with the fields enclosed by brackets [] replaced by
  221.28 -your own identifying information:
  221.29 -"Portions Copyrighted [year] [name of copyright owner]"
  221.30 -
  221.31 -Contributor(s):
  221.32 -
  221.33 -The Original Software is NetBeans. The Initial Developer of the Original
  221.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  221.35 -Microsystems, Inc. All Rights Reserved.
  221.36 -
  221.37 -If you wish your version of this file to be governed by only the CDDL
  221.38 -or only the GPL Version 2, indicate your decision by adding
  221.39 -"[Contributor] elects to include this software in this distribution
  221.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  221.41 -single choice of license, a recipient has the option to distribute
  221.42 -your version of this file under either the CDDL, the GPL Version 2 or
  221.43 -to extend the choice of license to its licensees as provided above.
  221.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  221.45 -Version 2 license, then the option applies only if the new code is
  221.46 -made subject to such option by the copyright holder.
  221.47 --->
  221.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
  221.49 -    <type>org.netbeans.modules.apisupport.project</type>
  221.50 -    <configuration>
  221.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
  221.52 -            <code-name-base>org.netbeans.modules.jackpot30.hintsimpl</code-name-base>
  221.53 -            <suite-component/>
  221.54 -            <module-dependencies>
  221.55 -                <dependency>
  221.56 -                    <code-name-base>org.jdesktop.layout</code-name-base>
  221.57 -                    <build-prerequisite/>
  221.58 -                    <compile-dependency/>
  221.59 -                    <run-dependency>
  221.60 -                        <release-version>1</release-version>
  221.61 -                        <specification-version>1.7.0.103</specification-version>
  221.62 -                    </run-dependency>
  221.63 -                </dependency>
  221.64 -                <dependency>
  221.65 -                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
  221.66 -                    <build-prerequisite/>
  221.67 -                    <compile-dependency/>
  221.68 -                    <run-dependency>
  221.69 -                        <release-version>1</release-version>
  221.70 -                        <specification-version>1.19</specification-version>
  221.71 -                    </run-dependency>
  221.72 -                </dependency>
  221.73 -                <dependency>
  221.74 -                    <code-name-base>org.netbeans.api.progress</code-name-base>
  221.75 -                    <build-prerequisite/>
  221.76 -                    <compile-dependency/>
  221.77 -                    <run-dependency>
  221.78 -                        <release-version>1</release-version>
  221.79 -                        <specification-version>1.13.0.1</specification-version>
  221.80 -                    </run-dependency>
  221.81 -                </dependency>
  221.82 -                <dependency>
  221.83 -                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
  221.84 -                    <build-prerequisite/>
  221.85 -                    <compile-dependency/>
  221.86 -                    <run-dependency>
  221.87 -                        <specification-version>0.8.0.1</specification-version>
  221.88 -                    </run-dependency>
  221.89 -                </dependency>
  221.90 -                <dependency>
  221.91 -                    <code-name-base>org.netbeans.modules.editor</code-name-base>
  221.92 -                    <build-prerequisite/>
  221.93 -                    <compile-dependency/>
  221.94 -                    <run-dependency>
  221.95 -                        <release-version>3</release-version>
  221.96 -                        <specification-version>1.42.0.3.9.2</specification-version>
  221.97 -                    </run-dependency>
  221.98 -                </dependency>
  221.99 -                <dependency>
 221.100 -                    <code-name-base>org.netbeans.modules.editor.guards</code-name-base>
 221.101 -                    <build-prerequisite/>
 221.102 -                    <compile-dependency/>
 221.103 -                    <run-dependency>
 221.104 -                        <release-version>1</release-version>
 221.105 -                        <specification-version>1.3</specification-version>
 221.106 -                    </run-dependency>
 221.107 -                </dependency>
 221.108 -                <dependency>
 221.109 -                    <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
 221.110 -                    <build-prerequisite/>
 221.111 -                    <compile-dependency/>
 221.112 -                    <run-dependency>
 221.113 -                        <release-version>1-3</release-version>
 221.114 -                        <specification-version>1.38.0.9.2</specification-version>
 221.115 -                    </run-dependency>
 221.116 -                </dependency>
 221.117 -                <dependency>
 221.118 -                    <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
 221.119 -                    <build-prerequisite/>
 221.120 -                    <compile-dependency/>
 221.121 -                    <run-dependency>
 221.122 -                        <specification-version>1.0</specification-version>
 221.123 -                    </run-dependency>
 221.124 -                </dependency>
 221.125 -                <dependency>
 221.126 -                    <code-name-base>org.netbeans.modules.java.editor</code-name-base>
 221.127 -                    <run-dependency>
 221.128 -                        <release-version>1</release-version>
 221.129 -                        <specification-version>2.22</specification-version>
 221.130 -                    </run-dependency>
 221.131 -                </dependency>
 221.132 -                <dependency>
 221.133 -                    <code-name-base>org.netbeans.modules.java.hints</code-name-base>
 221.134 -                    <build-prerequisite/>
 221.135 -                    <compile-dependency/>
 221.136 -                    <run-dependency>
 221.137 -                        <release-version>1</release-version>
 221.138 -                        <implementation-version/>
 221.139 -                    </run-dependency>
 221.140 -                </dependency>
 221.141 -                <dependency>
 221.142 -                    <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
 221.143 -                    <build-prerequisite/>
 221.144 -                    <compile-dependency/>
 221.145 -                    <run-dependency>
 221.146 -                        <release-version>1</release-version>
 221.147 -                        <specification-version>1.5</specification-version>
 221.148 -                    </run-dependency>
 221.149 -                </dependency>
 221.150 -                <dependency>
 221.151 -                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
 221.152 -                    <build-prerequisite/>
 221.153 -                    <compile-dependency/>
 221.154 -                    <run-dependency>
 221.155 -                        <specification-version>0.53</specification-version>
 221.156 -                    </run-dependency>
 221.157 -                </dependency>
 221.158 -                <dependency>
 221.159 -                    <code-name-base>org.netbeans.modules.lexer</code-name-base>
 221.160 -                    <build-prerequisite/>
 221.161 -                    <compile-dependency/>
 221.162 -                    <run-dependency>
 221.163 -                        <release-version>2</release-version>
 221.164 -                        <specification-version>1.30.0.1</specification-version>
 221.165 -                    </run-dependency>
 221.166 -                </dependency>
 221.167 -                <dependency>
 221.168 -                    <code-name-base>org.netbeans.modules.options.api</code-name-base>
 221.169 -                    <build-prerequisite/>
 221.170 -                    <compile-dependency/>
 221.171 -                    <run-dependency>
 221.172 -                        <release-version>1</release-version>
 221.173 -                        <specification-version>1.12</specification-version>
 221.174 -                    </run-dependency>
 221.175 -                </dependency>
 221.176 -                <dependency>
 221.177 -                    <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
 221.178 -                    <build-prerequisite/>
 221.179 -                    <compile-dependency/>
 221.180 -                    <run-dependency>
 221.181 -                        <release-version>1</release-version>
 221.182 -                        <specification-version>1.12.1</specification-version>
 221.183 -                    </run-dependency>
 221.184 -                </dependency>
 221.185 -                <dependency>
 221.186 -                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
 221.187 -                    <build-prerequisite/>
 221.188 -                    <compile-dependency/>
 221.189 -                    <run-dependency>
 221.190 -                        <release-version>1</release-version>
 221.191 -                        <specification-version>1.24</specification-version>
 221.192 -                    </run-dependency>
 221.193 -                </dependency>
 221.194 -                <dependency>
 221.195 -                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
 221.196 -                    <build-prerequisite/>
 221.197 -                    <compile-dependency/>
 221.198 -                    <run-dependency>
 221.199 -                        <release-version>1</release-version>
 221.200 -                        <specification-version>1.34.0.6</specification-version>
 221.201 -                    </run-dependency>
 221.202 -                </dependency>
 221.203 -                <dependency>
 221.204 -                    <code-name-base>org.netbeans.modules.sendopts</code-name-base>
 221.205 -                    <build-prerequisite/>
 221.206 -                    <compile-dependency/>
 221.207 -                    <run-dependency>
 221.208 -                        <release-version>2</release-version>
 221.209 -                        <specification-version>2.4</specification-version>
 221.210 -                    </run-dependency>
 221.211 -                </dependency>
 221.212 -                <dependency>
 221.213 -                    <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
 221.214 -                    <build-prerequisite/>
 221.215 -                    <compile-dependency/>
 221.216 -                    <run-dependency>
 221.217 -                        <release-version>0-1</release-version>
 221.218 -                        <specification-version>1.7.0.7.2</specification-version>
 221.219 -                    </run-dependency>
 221.220 -                </dependency>
 221.221 -                <dependency>
 221.222 -                    <code-name-base>org.netbeans.spi.tasklist</code-name-base>
 221.223 -                    <build-prerequisite/>
 221.224 -                    <compile-dependency/>
 221.225 -                    <run-dependency>
 221.226 -                        <release-version>1</release-version>
 221.227 -                        <specification-version>1.4.0.1</specification-version>
 221.228 -                    </run-dependency>
 221.229 -                </dependency>
 221.230 -                <dependency>
 221.231 -                    <code-name-base>org.openide.awt</code-name-base>
 221.232 -                    <build-prerequisite/>
 221.233 -                    <compile-dependency/>
 221.234 -                    <run-dependency>
 221.235 -                        <specification-version>7.7.0.1</specification-version>
 221.236 -                    </run-dependency>
 221.237 -                </dependency>
 221.238 -                <dependency>
 221.239 -                    <code-name-base>org.openide.dialogs</code-name-base>
 221.240 -                    <build-prerequisite/>
 221.241 -                    <compile-dependency/>
 221.242 -                    <run-dependency>
 221.243 -                        <specification-version>7.10</specification-version>
 221.244 -                    </run-dependency>
 221.245 -                </dependency>
 221.246 -                <dependency>
 221.247 -                    <code-name-base>org.openide.filesystems</code-name-base>
 221.248 -                    <build-prerequisite/>
 221.249 -                    <compile-dependency/>
 221.250 -                    <run-dependency>
 221.251 -                        <specification-version>7.21.0.1.1</specification-version>
 221.252 -                    </run-dependency>
 221.253 -                </dependency>
 221.254 -                <dependency>
 221.255 -                    <code-name-base>org.openide.loaders</code-name-base>
 221.256 -                    <build-prerequisite/>
 221.257 -                    <compile-dependency/>
 221.258 -                    <run-dependency>
 221.259 -                        <specification-version>7.5</specification-version>
 221.260 -                    </run-dependency>
 221.261 -                </dependency>
 221.262 -                <dependency>
 221.263 -                    <code-name-base>org.openide.nodes</code-name-base>
 221.264 -                    <build-prerequisite/>
 221.265 -                    <compile-dependency/>
 221.266 -                    <run-dependency>
 221.267 -                        <specification-version>7.9.0.1</specification-version>
 221.268 -                    </run-dependency>
 221.269 -                </dependency>
 221.270 -                <dependency>
 221.271 -                    <code-name-base>org.openide.text</code-name-base>
 221.272 -                    <build-prerequisite/>
 221.273 -                    <compile-dependency/>
 221.274 -                    <run-dependency>
 221.275 -                        <specification-version>6.22</specification-version>
 221.276 -                    </run-dependency>
 221.277 -                </dependency>
 221.278 -                <dependency>
 221.279 -                    <code-name-base>org.openide.util</code-name-base>
 221.280 -                    <build-prerequisite/>
 221.281 -                    <compile-dependency/>
 221.282 -                    <run-dependency>
 221.283 -                        <specification-version>7.22.0.1</specification-version>
 221.284 -                    </run-dependency>
 221.285 -                </dependency>
 221.286 -                <dependency>
 221.287 -                    <code-name-base>org.openide.windows</code-name-base>
 221.288 -                    <build-prerequisite/>
 221.289 -                    <compile-dependency/>
 221.290 -                    <run-dependency>
 221.291 -                        <specification-version>6.26</specification-version>
 221.292 -                    </run-dependency>
 221.293 -                </dependency>
 221.294 -            </module-dependencies>
 221.295 -            <test-dependencies>
 221.296 -                <test-type>
 221.297 -                    <name>unit</name>
 221.298 -                    <test-dependency>
 221.299 -                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
 221.300 -                        <compile-dependency/>
 221.301 -                    </test-dependency>
 221.302 -                    <test-dependency>
 221.303 -                        <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
 221.304 -                        <recursive/>
 221.305 -                        <compile-dependency/>
 221.306 -                    </test-dependency>
 221.307 -                    <test-dependency>
 221.308 -                        <code-name-base>org.netbeans.modules.java.hints.declarative.test</code-name-base>
 221.309 -                        <recursive/>
 221.310 -                        <compile-dependency/>
 221.311 -                    </test-dependency>
 221.312 -                    <test-dependency>
 221.313 -                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
 221.314 -                        <recursive/>
 221.315 -                        <compile-dependency/>
 221.316 -                    </test-dependency>
 221.317 -                </test-type>
 221.318 -            </test-dependencies>
 221.319 -            <public-packages/>
 221.320 -        </data>
 221.321 -    </configuration>
 221.322 -</project>
   222.1 --- a/sandbox/old-modules/hintsimpl/nbproject/suite.properties	Sun Jan 08 20:10:08 2017 +0100
   222.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   222.3 @@ -1,42 +0,0 @@
   222.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   222.5 -#
   222.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   222.7 -#
   222.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   222.9 -# Other names may be trademarks of their respective owners.
  222.10 -#
  222.11 -# The contents of this file are subject to the terms of either the GNU
  222.12 -# General Public License Version 2 only ("GPL") or the Common
  222.13 -# Development and Distribution License("CDDL") (collectively, the
  222.14 -# "License"). You may not use this file except in compliance with the
  222.15 -# License. You can obtain a copy of the License at
  222.16 -# http://www.netbeans.org/cddl-gplv2.html
  222.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  222.18 -# specific language governing permissions and limitations under the
  222.19 -# License.  When distributing the software, include this License Header
  222.20 -# Notice in each file and include the License file at
  222.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  222.22 -# particular file as subject to the "Classpath" exception as provided
  222.23 -# by Oracle in the GPL Version 2 section of the License file that
  222.24 -# accompanied this code. If applicable, add the following below the
  222.25 -# License Header, with the fields enclosed by brackets [] replaced by
  222.26 -# your own identifying information:
  222.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  222.28 -#
  222.29 -# Contributor(s):
  222.30 -#
  222.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  222.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  222.33 -# Microsystems, Inc. All Rights Reserved.
  222.34 -#
  222.35 -# If you wish your version of this file to be governed by only the CDDL
  222.36 -# or only the GPL Version 2, indicate your decision by adding
  222.37 -# "[Contributor] elects to include this software in this distribution
  222.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  222.39 -# single choice of license, a recipient has the option to distribute
  222.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  222.41 -# to extend the choice of license to its licensees as provided above.
  222.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  222.43 -# Version 2 license, then the option applies only if the new code is
  222.44 -# made subject to such option by the copyright holder.
  222.45 -suite.dir=${basedir}/..
   223.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   223.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   223.3 @@ -1,38 +0,0 @@
   223.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   223.5 -#
   223.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   223.7 -#
   223.8 -# The contents of this file are subject to the terms of either the GNU
   223.9 -# General Public License Version 2 only ("GPL") or the Common
  223.10 -# Development and Distribution License("CDDL") (collectively, the
  223.11 -# "License"). You may not use this file except in compliance with the
  223.12 -# License. You can obtain a copy of the License at
  223.13 -# http://www.netbeans.org/cddl-gplv2.html
  223.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  223.15 -# specific language governing permissions and limitations under the
  223.16 -# License.  When distributing the software, include this License Header
  223.17 -# Notice in each file and include the License file at
  223.18 -# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  223.19 -# particular file as subject to the "Classpath" exception as provided
  223.20 -# by Sun in the GPL Version 2 section of the License file that
  223.21 -# accompanied this code. If applicable, add the following below the
  223.22 -# License Header, with the fields enclosed by brackets [] replaced by
  223.23 -# your own identifying information:
  223.24 -# "Portions Copyrighted [year] [name of copyright owner]"
  223.25 -#
  223.26 -# If you wish your version of this file to be governed by only the CDDL
  223.27 -# or only the GPL Version 2, indicate your decision by adding
  223.28 -# "[Contributor] elects to include this software in this distribution
  223.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  223.30 -# single choice of license, a recipient has the option to distribute
  223.31 -# your version of this file under either the CDDL, the GPL Version 2 or
  223.32 -# to extend the choice of license to its licensees as provided above.
  223.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  223.34 -# Version 2 license, then the option applies only if the new code is
  223.35 -# made subject to such option by the copyright holder.
  223.36 -#
  223.37 -# Contributor(s):
  223.38 -#
  223.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
  223.40 -
  223.41 -OpenIDE-Module-Name=Hints Impl
   224.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/abstract-document.hint	Sun Jan 08 20:10:08 2017 +0100
   224.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   224.3 @@ -1,37 +0,0 @@
   224.4 -{ $1$;
   224.5 -$0.readLock();
   224.6 -$stmts$;
   224.7 -$0.readUnlock();
   224.8 -$2$;
   224.9 -}
  224.10 -:: $0 instanceof javax.swing.text.AbstractDocument
  224.11 -=>
  224.12 -{ $1$;
  224.13 -$0.readLock();
  224.14 -try {
  224.15 -    $stmts$;
  224.16 -} finally {
  224.17 -    $0.readUnlock();
  224.18 -}
  224.19 -$2$;
  224.20 -}
  224.21 -;;
  224.22 -
  224.23 -{ $1$;
  224.24 -$0.writeLock();
  224.25 -$stmts$;
  224.26 -$0.writeUnlock();
  224.27 -$2$;
  224.28 -}
  224.29 -:: $0 instanceof javax.swing.text.AbstractDocument
  224.30 -=>
  224.31 -{ $1$;
  224.32 -$0.writeLock();
  224.33 -try {
  224.34 -    $stmts$;
  224.35 -} finally {
  224.36 -    $0.writeUnlock();
  224.37 -}
  224.38 -$2$;
  224.39 -}
  224.40 -;;
   225.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/assert2if.hint	Sun Jan 08 20:10:08 2017 +0100
   225.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   225.3 @@ -1,4 +0,0 @@
   225.4 -'Use of assert':
   225.5 -assert $1 : $2; :: $1 instanceof boolean && $2 instanceof java.lang.Object
   225.6 -   => if (!$1) throw new IllegalStateException($2);
   225.7 -   ;;
   226.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/double-checked-locking.hint	Sun Jan 08 20:10:08 2017 +0100
   226.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   226.3 @@ -1,14 +0,0 @@
   226.4 -'Double checked locking':
   226.5 -if ($var == null) {
   226.6 -   synchronized ($lock) {
   226.7 -       if ($var == null) {
   226.8 -           $s2$;
   226.9 -       }
  226.10 -   }
  226.11 -} :: !hasModifier($var, Modifier.VOLATILE)
  226.12 -=>
  226.13 -synchronized ($lock) {
  226.14 -   if ($var == null) {
  226.15 -       $s2$;
  226.16 -   }
  226.17 -};;
   227.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/AddConditionals.hint	Sun Jan 08 20:10:08 2017 +0100
   227.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   227.3 @@ -1,7 +0,0 @@
   227.4 -if ($a) return $b; else return $c; => return $a ? $b : $c; ;;
   227.5 -if ($a) $ret = $b; else $ret = $c; => $ret = $a ? $b : $c; ;;
   227.6 -if ($a) $b=$c; else if ($a2) $b = $d; => $b = $a ? $c : $a2 ? $d : $b; ;;
   227.7 -$a ? ($T)$b : ($T)$c => ($T)($a ? $b : $c) ;;
   227.8 -//the following hint causes BulkSearch to be extremelly slow:
   227.9 -//{ $p$; $T $v; if($a) $v = $b; else $v = $c; $q$; } => { $p$; $T $v = $a ? $b : $c; $q$; }  ;;
  227.10 -
   228.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/EnhancedFor.hint	Sun Jan 08 20:10:08 2017 +0100
   228.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   228.3 @@ -1,43 +0,0 @@
   228.4 -'Convert to Enhanced For':
   228.5 -for(int $i = 0; $i < $array.length; $i++) {
   228.6 -    $T $var = ($T) $array[$i];
   228.7 -    $stmts$;
   228.8 -} :: !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
   228.9 -=>
  228.10 -for($T $var : $array) {
  228.11 -    $stmts$;
  228.12 -}
  228.13 -;;
  228.14 -
  228.15 -'Convert to Enhanced For':
  228.16 -for(int $i = 0; $i < $array.length; $i++) {
  228.17 -    $T $var = $array[$i];
  228.18 -    $stmts$;
  228.19 -} :: !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
  228.20 -=> 
  228.21 -for($T $var : $array) {
  228.22 -    $stmts$;
  228.23 -}
  228.24 -;;
  228.25 -
  228.26 -'Convert to Enhanced For':
  228.27 -for($I $i = $iterable.iterator(); $i.hasNext();) {
  228.28 -    $T $var = ($T)$i.next();
  228.29 -    $stmts$;
  228.30 -} :: $iterable instanceof java.lang.Iterable && !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
  228.31 -=>
  228.32 -for($T $var : $iterable) {
  228.33 -    $stmts$;
  228.34 -}
  228.35 -;;
  228.36 -
  228.37 -'Convert to Enhanced For':
  228.38 -for($I $i = $iterable.iterator(); $i.hasNext();) {
  228.39 -    $T $var = $i.next();
  228.40 -    $stmts$;
  228.41 -} :: $iterable instanceof java.lang.Iterable && !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
  228.42 -=>
  228.43 -for($T $var : $iterable) {
  228.44 -    $stmts$;
  228.45 -}
  228.46 -;;
   229.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   229.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   229.3 @@ -1,48 +0,0 @@
   229.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   229.5 -#
   229.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   229.7 -#
   229.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   229.9 -# Other names may be trademarks of their respective owners.
  229.10 -#
  229.11 -# The contents of this file are subject to the terms of either the GNU
  229.12 -# General Public License Version 2 only ("GPL") or the Common
  229.13 -# Development and Distribution License("CDDL") (collectively, the
  229.14 -# "License"). You may not use this file except in compliance with the
  229.15 -# License. You can obtain a copy of the License at
  229.16 -# http://www.netbeans.org/cddl-gplv2.html
  229.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  229.18 -# specific language governing permissions and limitations under the
  229.19 -# License.  When distributing the software, include this License Header
  229.20 -# Notice in each file and include the License file at
  229.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  229.22 -# particular file as subject to the "Classpath" exception as provided
  229.23 -# by Oracle in the GPL Version 2 section of the License file that
  229.24 -# accompanied this code. If applicable, add the following below the
  229.25 -# License Header, with the fields enclosed by brackets [] replaced by
  229.26 -# your own identifying information:
  229.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  229.28 -#
  229.29 -# Contributor(s):
  229.30 -#
  229.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  229.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  229.33 -# Microsystems, Inc. All Rights Reserved.
  229.34 -#
  229.35 -# If you wish your version of this file to be governed by only the CDDL
  229.36 -# or only the GPL Version 2, indicate your decision by adding
  229.37 -# "[Contributor] elects to include this software in this distribution
  229.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  229.39 -# single choice of license, a recipient has the option to distribute
  229.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  229.41 -# to extend the choice of license to its licensees as provided above.
  229.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  229.43 -# Version 2 license, then the option applies only if the new code is
  229.44 -# made subject to such option by the copyright holder.
  229.45 -DN_org.netbeans.modules.jackpot30.hintsimpl.jdk7.ConvertToDiamondBulkHint=Convert to diamond bulk hint
  229.46 -DESC_org.netbeans.modules.jackpot30.hintsimpl.jdk7.ConvertToDiamondBulkHint=Convert to diamond bulk hint
  229.47 -DN_jdk7_upgrade=To JDK7
  229.48 -DN_java.util.Objects=Convert to use java.util.Objects.{equals,hashCode}
  229.49 -DESC_java.util.Objects=Convert to use java.util.Objects.{equals,hashCode}
  229.50 -DN_org.netbeans.modules.jackpot30.hintsimpl.jdk7.SafeConvertToSwitchString=Convert to switch over Strings ignoring the eq operator
  229.51 -DESC_org.netbeans.modules.jackpot30.hintsimpl.jdk7.SafeConvertToSwitchString=Convert to switch over Strings, ignoring the == operator
   230.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/SafeConvertToSwitchString.java	Sun Jan 08 20:10:08 2017 +0100
   230.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   230.3 @@ -1,80 +0,0 @@
   230.4 -/*
   230.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   230.6 - *
   230.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
   230.8 - *
   230.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  230.10 - * Other names may be trademarks of their respective owners.
  230.11 - *
  230.12 - * The contents of this file are subject to the terms of either the GNU
  230.13 - * General Public License Version 2 only ("GPL") or the Common
  230.14 - * Development and Distribution License("CDDL") (collectively, the
  230.15 - * "License"). You may not use this file except in compliance with the
  230.16 - * License. You can obtain a copy of the License at
  230.17 - * http://www.netbeans.org/cddl-gplv2.html
  230.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  230.19 - * specific language governing permissions and limitations under the
  230.20 - * License.  When distributing the software, include this License Header
  230.21 - * Notice in each file and include the License file at
  230.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  230.23 - * particular file as subject to the "Classpath" exception as provided
  230.24 - * by Oracle in the GPL Version 2 section of the License file that
  230.25 - * accompanied this code. If applicable, add the following below the
  230.26 - * License Header, with the fields enclosed by brackets [] replaced by
  230.27 - * your own identifying information:
  230.28 - * "Portions Copyrighted [year] [name of copyright owner]"
  230.29 - *
  230.30 - * If you wish your version of this file to be governed by only the CDDL
  230.31 - * or only the GPL Version 2, indicate your decision by adding
  230.32 - * "[Contributor] elects to include this software in this distribution
  230.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  230.34 - * single choice of license, a recipient has the option to distribute
  230.35 - * your version of this file under either the CDDL, the GPL Version 2 or
  230.36 - * to extend the choice of license to its licensees as provided above.
  230.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  230.38 - * Version 2 license, then the option applies only if the new code is
  230.39 - * made subject to such option by the copyright holder.
  230.40 - *
  230.41 - * Contributor(s):
  230.42 - *
  230.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  230.44 - */
  230.45 -
  230.46 -package org.netbeans.modules.jackpot30.hintsimpl.jdk7;
  230.47 -
  230.48 -import java.util.List;
  230.49 -import java.util.prefs.Preferences;
  230.50 -import org.netbeans.modules.java.hints.jackpot.code.spi.Hint;
  230.51 -import org.netbeans.modules.java.hints.jackpot.code.spi.TriggerPattern;
  230.52 -import org.netbeans.modules.java.hints.jackpot.impl.RulesManager;
  230.53 -import org.netbeans.modules.java.hints.jackpot.spi.HintContext;
  230.54 -import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata.Options;
  230.55 -import org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch;
  230.56 -import org.netbeans.modules.java.hints.options.HintsSettings;
  230.57 -import org.netbeans.spi.editor.hints.ErrorDescription;
  230.58 -
  230.59 -/**
  230.60 - *
  230.61 - * @author lahvac
  230.62 - */
  230.63 -@Hint(category="rules15",enabled=false, options=Options.NON_GUI)
  230.64 -public class SafeConvertToSwitchString {
  230.65 -
  230.66 -    static final String KEY_ALSO_EQ = "also-equals";
  230.67 -    static final boolean DEF_ALSO_EQ = true;
  230.68 -
  230.69 -    @TriggerPattern(value="if ($cond) $body; else $else;")
  230.70 -    public static List<ErrorDescription> hint(HintContext ctx) {
  230.71 -        Preferences prefs = RulesManager.getPreferences("org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch", HintsSettings.getCurrentProfileId());
  230.72 -        boolean old = prefs.getBoolean(KEY_ALSO_EQ, DEF_ALSO_EQ);
  230.73 -
  230.74 -        prefs.putBoolean(KEY_ALSO_EQ, false);
  230.75 -
  230.76 -        try {
  230.77 -            return ConvertToStringSwitch.hint(ctx);
  230.78 -        } finally {
  230.79 -            prefs.putBoolean(KEY_ALSO_EQ, old);
  230.80 -        }
  230.81 -    }
  230.82 -
  230.83 -}
   231.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/java.util.Objects.hint	Sun Jan 08 20:10:08 2017 +0100
   231.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   231.3 @@ -1,99 +0,0 @@
   231.4 -<!hint="java.util.Objects">
   231.5 -//java.util.Objects.equals:
   231.6 -($1 == null) ? ($2 != null) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
   231.7 -=>java.util.Objects.equals($1, $2)
   231.8 -;;
   231.9 -
  231.10 -(null == $1) ? ($2 != null) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.11 -=>java.util.Objects.equals($1, $2)
  231.12 -;;
  231.13 -
  231.14 -($1 == null) ? (null != $2) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.15 -=>java.util.Objects.equals($1, $2)
  231.16 -;;
  231.17 -
  231.18 -(null == $1) ? (null != $2) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.19 -=>java.util.Objects.equals($1, $2)
  231.20 -;;
  231.21 -
  231.22 -$1 != $2 && ($1 == null || !$1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.23 -=>java.util.Objects.equals($1, $2)
  231.24 -;;
  231.25 -
  231.26 -$1 != $2 && (null == $1 || !$1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.27 -=>java.util.Objects.equals($1, $2)
  231.28 -;;
  231.29 -
  231.30 -($1 == null) ? ($2 == null) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.31 -=>java.util.Objects.equals($1, $2)
  231.32 -;;
  231.33 -
  231.34 -(null == $1) ? ($2 == null) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.35 -=>java.util.Objects.equals($1, $2)
  231.36 -;;
  231.37 -
  231.38 -($1 == null) ? (null == $2) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.39 -=>java.util.Objects.equals($1, $2)
  231.40 -;;
  231.41 -
  231.42 -(null == $1) ? (null == $2) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.43 -=>java.util.Objects.equals($1, $2)
  231.44 -;;
  231.45 -
  231.46 -($1 != null) ? $1.equals($2) : ($2 == null) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.47 -=>java.util.Objects.equals($1, $2)
  231.48 -;;
  231.49 -
  231.50 -(null != $1) ? $1.equals($2) : ($2 == null) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.51 -=>java.util.Objects.equals($1, $2)
  231.52 -;;
  231.53 -
  231.54 -($1 != null) ? $1.equals($2) : (null == $2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.55 -=>java.util.Objects.equals($1, $2)
  231.56 -;;
  231.57 -
  231.58 -(null != $1) ? $1.equals($2) : (null == $2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.59 -=>java.util.Objects.equals($1, $2)
  231.60 -;;
  231.61 -
  231.62 -$1 == $2 && ($1 == null || $1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.63 -=>java.util.Objects.equals($1, $2)
  231.64 -;;
  231.65 -
  231.66 -$1 == $2 && (null == $1 || $1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
  231.67 -=>java.util.Objects.equals($1, $2)
  231.68 -;;
  231.69 -
  231.70 -//java.util.Objects.hashCode:
  231.71 -$1 != null ? $1.hashCode() : 0 :: $1 instanceof java.lang.Object
  231.72 -=>java.util.Objects.hashCode($1)
  231.73 -;;
  231.74 -
  231.75 -null != $1 ? $1.hashCode() : 0 :: $1 instanceof java.lang.Object
  231.76 -=>java.util.Objects.hashCode($1)
  231.77 -;;
  231.78 -
  231.79 -$1 == null ? 0 : $1.hashCode() :: $1 instanceof java.lang.Object
  231.80 -=>java.util.Objects.hashCode($1)
  231.81 -;;
  231.82 -
  231.83 -null == $1 ? 0 : $1.hashCode() :: $1 instanceof java.lang.Object
  231.84 -=>java.util.Objects.hashCode($1)
  231.85 -;;
  231.86 -
  231.87 -//java.util.Objects.toString:
  231.88 -$1 != null ? $1.toString() : $def :: $1 instanceof java.lang.Object
  231.89 -=>java.util.Objects.toString($1, $def)
  231.90 -;;
  231.91 -
  231.92 -null != $1 ? $1.toString() : $def :: $1 instanceof java.lang.Object
  231.93 -=>java.util.Objects.toString($1, $def)
  231.94 -;;
  231.95 -
  231.96 -$1 == null ? $def : $1.hashCode() :: $1 instanceof java.lang.Object
  231.97 -=>java.util.Objects.hashCode($1, $def)
  231.98 -;;
  231.99 -
 231.100 -null == $1 ? $def : $1.hashCode() :: $1 instanceof java.lang.Object
 231.101 -=>java.util.Objects.hashCode($1, $def)
 231.102 -;;
   232.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/jdk7.upgrade	Sun Jan 08 20:10:08 2017 +0100
   232.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   232.3 @@ -1,12 +0,0 @@
   232.4 -{
   232.5 -    "upgradeName" : "jdk7_upgrade",
   232.6 -    "bundle" : "org/netbeans/modules/jackpot30/hintsimpl/jdk7/Bundle",
   232.7 -    "hints" : [
   232.8 -        "org.netbeans.modules.jackpot30.hintsimpl.jdk7.ConvertToDiamondBulkHint",
   232.9 -        "org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch",
  232.10 -        "org.netbeans.modules.java.hints.jdk.ConvertToARM",
  232.11 -        "org.netbeans.modules.java.hints.jdk.JoinCatches",
  232.12 -        "org.netbeans.modules.java.hints.jdk.UseSpecificCatch",
  232.13 -        "java.util.Objects"
  232.14 -    ]
  232.15 -}
   233.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/layer.xml	Sun Jan 08 20:10:08 2017 +0100
   233.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   233.3 @@ -1,63 +0,0 @@
   233.4 -<?xml version="1.0" encoding="UTF-8"?>
   233.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" "http://www.netbeans.org/dtds/filesystem-1_0.dtd">
   233.6 -<!--
   233.7 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   233.8 -
   233.9 -Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
  233.10 -
  233.11 -
  233.12 -The contents of this file are subject to the terms of either the GNU
  233.13 -General Public License Version 2 only ("GPL") or the Common
  233.14 -Development and Distribution License("CDDL") (collectively, the
  233.15 -"License"). You may not use this file except in compliance with the
  233.16 -License. You can obtain a copy of the License at
  233.17 -http://www.netbeans.org/cddl-gplv2.html
  233.18 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  233.19 -specific language governing permissions and limitations under the
  233.20 -License.  When distributing the software, include this License Header
  233.21 -Notice in each file and include the License file at
  233.22 -nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  233.23 -particular file as subject to the "Classpath" exception as provided
  233.24 -by Sun in the GPL Version 2 section of the License file that
  233.25 -accompanied this code. If applicable, add the following below the
  233.26 -License Header, with the fields enclosed by brackets [] replaced by
  233.27 -your own identifying information:
  233.28 -"Portions Copyrighted [year] [name of copyright owner]"
  233.29 -
  233.30 -Contributor(s):
  233.31 -
  233.32 -The Original Software is NetBeans. The Initial Developer of the Original
  233.33 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  233.34 -Microsystems, Inc. All Rights Reserved.
  233.35 -
  233.36 -If you wish your version of this file to be governed by only the CDDL
  233.37 -or only the GPL Version 2, indicate your decision by adding
  233.38 -"[Contributor] elects to include this software in this distribution
  233.39 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  233.40 -single choice of license, a recipient has the option to distribute
  233.41 -your version of this file under either the CDDL, the GPL Version 2 or
  233.42 -to extend the choice of license to its licensees as provided above.
  233.43 -However, if you add GPL Version 2 code and therefore, elected the GPL
  233.44 -Version 2 license, then the option applies only if the new code is
  233.45 -made subject to such option by the copyright holder.
  233.46 --->
  233.47 -<filesystem>
  233.48 -
  233.49 -    <folder name="org-netbeans-modules-java-hints">
  233.50 -        <folder name="declarative">
  233.51 -            <file name="Bundle.properties" url="jdk7/Bundle.properties" /> <!--XXX-->
  233.52 -            <file name="assert2if.hint" url="assert2if.hint" />
  233.53 -            <file name="variable-decl-assignment.hint" url="variable-decl-assignment.hint" />
  233.54 -            <file name="double-checked-locking.hint" url="double-checked-locking.hint" />
  233.55 -            <file name="sync-on-non-final.hint" url="sync-on-non-final.hint" />
  233.56 -            <file name="abstract-document.hint" url="abstract-document.hint" />
  233.57 -            <file name="AddConditionals.hint" url="jackpot/AddConditionals.hint" />
  233.58 -            <file name="EnhancedFor.hint" url="jackpot/EnhancedFor.hint" />
  233.59 -            <file name="java.util.Objects.hint" url="jdk7/java.util.Objects.hint" />
  233.60 -        </folder>
  233.61 -        <folder name="upgrades">
  233.62 -            <file name="jdk7.upgrade" url="jdk7/jdk7.upgrade" />
  233.63 -        </folder>
  233.64 -    </folder>
  233.65 -
  233.66 -</filesystem>
   234.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/sync-on-non-final.hint	Sun Jan 08 20:10:08 2017 +0100
   234.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   234.3 @@ -1,5 +0,0 @@
   234.4 -'Synchronizing on non-final field':
   234.5 -synchronized($var) {
   234.6 -    $stmts$;
   234.7 -} :: !hasModifier($var, Modifier.FINAL) && elementKindMatches($var, ElementKind.FIELD)
   234.8 -;;
   235.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/variable-decl-assignment.hint	Sun Jan 08 20:10:08 2017 +0100
   235.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   235.3 @@ -1,4 +0,0 @@
   235.4 -'Separated variable declaration and assignment':
   235.5 -{ $1 $2; $2 = $3; }
   235.6 -   => { $1 $2 = $3; }
   235.7 -   ;;
   236.1 --- a/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/wrong-string-comparison.hint	Sun Jan 08 20:10:08 2017 +0100
   236.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   236.3 @@ -1,31 +0,0 @@
   236.4 -'Wrong string comparison':
   236.5 -$left == $right ::    $left instanceof java.lang.String
   236.6 -                   && $right instanceof java.lang.String
   236.7 -                   && !isNullLiteral($left)
   236.8 -                   && !isNullLiteral($right)
   236.9 -=>$left == null ? $right == null : $left.equals($right)
  236.10 -=>$left.equals($right)
  236.11 -;;
  236.12 -
  236.13 -'Wrong string comparison':
  236.14 -$left != $right ::    $left instanceof java.lang.String
  236.15 -                   && $right instanceof java.lang.String
  236.16 -                   && !isNullLiteral($left)
  236.17 -                   && !isNullLiteral($right)
  236.18 -                   && !acceptGenerated($left, $right)
  236.19 -=>!($left == null ? $right == null : $left.equals($right))
  236.20 -=>!$left.equals($right)
  236.21 -;;
  236.22 -
  236.23 -<?
  236.24 -private boolean acceptGenerated(Variable left, Variable right) {
  236.25 -    Variable parent = left;
  236.26 -
  236.27 -    while ((parent = context.parent(parent)) != null) {
  236.28 -        if (matcher.matches(parent, "$left != $right && ($left == null || $left.equals($right))"))
  236.29 -            return true;
  236.30 -    }
  236.31 -
  236.32 -    return false;
  236.33 -}
  236.34 -?>
   237.1 --- a/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/HintsTest.java	Sun Jan 08 20:10:08 2017 +0100
   237.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   237.3 @@ -1,55 +0,0 @@
   237.4 -/*
   237.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   237.6 - *
   237.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   237.8 - *
   237.9 - * The contents of this file are subject to the terms of either the GNU
  237.10 - * General Public License Version 2 only ("GPL") or the Common
  237.11 - * Development and Distribution License("CDDL") (collectively, the
  237.12 - * "License"). You may not use this file except in compliance with the
  237.13 - * License. You can obtain a copy of the License at
  237.14 - * http://www.netbeans.org/cddl-gplv2.html
  237.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  237.16 - * specific language governing permissions and limitations under the
  237.17 - * License.  When distributing the software, include this License Header
  237.18 - * Notice in each file and include the License file at
  237.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  237.20 - * particular file as subject to the "Classpath" exception as provided
  237.21 - * by Sun in the GPL Version 2 section of the License file that
  237.22 - * accompanied this code. If applicable, add the following below the
  237.23 - * License Header, with the fields enclosed by brackets [] replaced by
  237.24 - * your own identifying information:
  237.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  237.26 - *
  237.27 - * If you wish your version of this file to be governed by only the CDDL
  237.28 - * or only the GPL Version 2, indicate your decision by adding
  237.29 - * "[Contributor] elects to include this software in this distribution
  237.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  237.31 - * single choice of license, a recipient has the option to distribute
  237.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  237.33 - * to extend the choice of license to its licensees as provided above.
  237.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  237.35 - * Version 2 license, then the option applies only if the new code is
  237.36 - * made subject to such option by the copyright holder.
  237.37 - *
  237.38 - * Contributor(s):
  237.39 - *
  237.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
  237.41 - */
  237.42 -
  237.43 -package org.netbeans.modules.jackpot30.hintsimpl;
  237.44 -
  237.45 -import junit.framework.TestSuite;
  237.46 -import org.netbeans.modules.java.hints.declarative.test.api.DeclarativeHintsTestBase;
  237.47 -
  237.48 -/**
  237.49 - *
  237.50 - * @author lahvac
  237.51 - */
  237.52 -public class HintsTest extends DeclarativeHintsTestBase {
  237.53 -
  237.54 -    public static TestSuite suite() {
  237.55 -        return suite(HintsTest.class);
  237.56 -    }
  237.57 -
  237.58 -}
   238.1 --- a/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/abstract-document.test	Sun Jan 08 20:10:08 2017 +0100
   238.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   238.3 @@ -1,46 +0,0 @@
   238.4 -%%TestCase simple-readlock
   238.5 -package test;
   238.6 -import javax.swing.text.AbstractDocument;
   238.7 -public class Test {
   238.8 -    private void test(AbstractDocument d) {
   238.9 -        d.readLock();
  238.10 -        System.err.println(d.getText(0, d.getLength()));
  238.11 -        d.readUnlock();
  238.12 -    }
  238.13 -}
  238.14 -%%=>
  238.15 -package test;
  238.16 -import javax.swing.text.AbstractDocument;
  238.17 -public class Test {
  238.18 -    private void test(AbstractDocument d) {
  238.19 -        d.readLock();
  238.20 -        try {
  238.21 -            System.err.println(d.getText(0, d.getLength()));
  238.22 -        } finally {
  238.23 -            d.readUnlock();
  238.24 -        }
  238.25 -    }
  238.26 -}
  238.27 -%%TestCase simple-writelock
  238.28 -package test;
  238.29 -import javax.swing.text.AbstractDocument;
  238.30 -public class Test {
  238.31 -    private void test(AbstractDocument d) {
  238.32 -        d.writeLock();
  238.33 -        System.err.println(d.getText(0, d.getLength()));
  238.34 -        d.writeUnlock();
  238.35 -    }
  238.36 -}
  238.37 -%%=>
  238.38 -package test;
  238.39 -import javax.swing.text.AbstractDocument;
  238.40 -public class Test {
  238.41 -    private void test(AbstractDocument d) {
  238.42 -        d.writeLock();
  238.43 -        try {
  238.44 -            System.err.println(d.getText(0, d.getLength()));
  238.45 -        } finally {
  238.46 -            d.writeUnlock();
  238.47 -        }
  238.48 -    }
  238.49 -}
   239.1 --- a/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/double-checked-locking.test	Sun Jan 08 20:10:08 2017 +0100
   239.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   239.3 @@ -1,46 +0,0 @@
   239.4 -%%TestCase simple
   239.5 -package test;
   239.6 -public class Test {
   239.7 -    private static Object TEST;
   239.8 -    public static Object get() {
   239.9 -        if (TEST == null) {
  239.10 -            synchronized (Test.class) {
  239.11 -                if (TEST == null) {
  239.12 -                    TEST = new Object();
  239.13 -                }
  239.14 -            }
  239.15 -        }
  239.16 -
  239.17 -        return TEST;
  239.18 -    }
  239.19 -}
  239.20 -%%=>
  239.21 -package test;
  239.22 -public class Test {
  239.23 -    private static Object TEST;
  239.24 -    public static Object get() {
  239.25 -        synchronized (Test.class) {
  239.26 -            if (TEST == null) {
  239.27 -                TEST = new Object();
  239.28 -            }
  239.29 -        }
  239.30 -
  239.31 -        return TEST;
  239.32 -    }
  239.33 -}
  239.34 -%%TestCase volatile
  239.35 -package test;
  239.36 -public class Test {
  239.37 -    private static volatile Object TEST;
  239.38 -    public static Object get() {
  239.39 -        if (TEST == null) {
  239.40 -            synchronized (Test.class) {
  239.41 -                if (TEST == null) {
  239.42 -                    TEST = new Object();
  239.43 -                }
  239.44 -            }
  239.45 -        }
  239.46 -
  239.47 -        return TEST;
  239.48 -    }
  239.49 -}
   240.1 --- a/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/AddConditionals.test	Sun Jan 08 20:10:08 2017 +0100
   240.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   240.3 @@ -1,87 +0,0 @@
   240.4 -%%TestCase simple-return
   240.5 -package test;
   240.6 -public class Test {
   240.7 -    public int test(boolean b) {
   240.8 -        if (b)
   240.9 -            return 1;
  240.10 -        else
  240.11 -            return 2;
  240.12 -    }
  240.13 -}
  240.14 -%%=>
  240.15 -package test;
  240.16 -public class Test {
  240.17 -    public int test(boolean b) {
  240.18 -        return b ? 1 : 2;
  240.19 -    }
  240.20 -}
  240.21 -%%TestCase blocks-return
  240.22 -package test;
  240.23 -public class Test {
  240.24 -    public int test(boolean b) {
  240.25 -        if (b) {
  240.26 -            return 1;
  240.27 -        } else {
  240.28 -            return 2;
  240.29 -        }
  240.30 -    }
  240.31 -}
  240.32 -%%=>
  240.33 -package test;
  240.34 -public class Test {
  240.35 -    public int test(boolean b) {
  240.36 -        return b ? 1 : 2;
  240.37 -    }
  240.38 -}
  240.39 -%%TestCase simple-assignment
  240.40 -package test;
  240.41 -public class Test {
  240.42 -    public void test(boolean b) {
  240.43 -        int q = 3;
  240.44 -        if (b)
  240.45 -            q = 1;
  240.46 -        else
  240.47 -            q = 2;
  240.48 -    }
  240.49 -}
  240.50 -%%=>
  240.51 -package test;
  240.52 -public class Test {
  240.53 -    public void test(boolean b) {
  240.54 -        int q = 3;
  240.55 -        q = b ? 1 : 2;
  240.56 -    }
  240.57 -}
  240.58 -%%TestCase simplify-conditional-with-casts
  240.59 -package test;
  240.60 -public class Test {
  240.61 -    public void test(boolean b, Object o1, Object o2) {
  240.62 -        String s = b ? (String) o1 : (String) o2;
  240.63 -    }
  240.64 -}
  240.65 -%%=>
  240.66 -package test;
  240.67 -public class Test {
  240.68 -    public void test(boolean b, Object o1, Object o2) {
  240.69 -        String s = (String) (b ? o1 : o2);
  240.70 -    }
  240.71 -}
  240.72 -%%TestCase simplify-with-declaration
  240.73 -package test;
  240.74 -public class Test {
  240.75 -    public void test(boolean b) {
  240.76 -        int q;
  240.77 -        if (b)
  240.78 -            q = 1;
  240.79 -        else
  240.80 -            q = 2;
  240.81 -    }
  240.82 -}
  240.83 -%%=>
  240.84 -package test;
  240.85 -public class Test {
  240.86 -    public void test(boolean b) {
  240.87 -        int q;
  240.88 -        q = b ? 1 : 2;
  240.89 -    }
  240.90 -}
   241.1 --- a/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/EnhancedFor.test	Sun Jan 08 20:10:08 2017 +0100
   241.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   241.3 @@ -1,64 +0,0 @@
   241.4 -%%TestCase simple-array
   241.5 -package test;
   241.6 -public class Test {
   241.7 -    private void test() {
   241.8 -        String[] a = new String[2];
   241.9 -
  241.10 -        for (int c = 0; c < a.length; c++) {
  241.11 -            String s = a[c];
  241.12 -            System.err.println(s);
  241.13 -        }
  241.14 -    }
  241.15 -}
  241.16 -%%=>
  241.17 -package test;
  241.18 -public class Test {
  241.19 -    private void test() {
  241.20 -        String[] a = new String[2];
  241.21 -        for (String s : a) {
  241.22 -            System.err.println(s);
  241.23 -        }
  241.24 -    }
  241.25 -}
  241.26 -%%TestCase simple-iterable
  241.27 -package test;
  241.28 -import java.util.Iterator;
  241.29 -public class Test {
  241.30 -    private void test(Iterable iterable) {
  241.31 -        for (Iterator it = iterable.iterator(); it.hasNext();) {
  241.32 -            String s = (String) it.next();
  241.33 -            System.err.println(s);
  241.34 -        }
  241.35 -    }
  241.36 -}
  241.37 -%%=>
  241.38 -package test;
  241.39 -import java.util.Iterator;
  241.40 -public class Test {
  241.41 -    private void test(Iterable iterable) {
  241.42 -        for (String s : iterable) {
  241.43 -            System.err.println(s);
  241.44 -        }
  241.45 -    }
  241.46 -}
  241.47 -%%TestCase generified-iterable
  241.48 -package test;
  241.49 -import java.util.Iterator;
  241.50 -public class Test {
  241.51 -    private void test(Iterable<? extends String> iterable) {
  241.52 -        for (Iterator<? extends String> it = iterable.iterator(); it.hasNext();) {
  241.53 -            String s = it.next();
  241.54 -            System.err.println(s);
  241.55 -        }
  241.56 -    }
  241.57 -}
  241.58 -%%=>
  241.59 -package test;
  241.60 -import java.util.Iterator;
  241.61 -public class Test {
  241.62 -    private void test(Iterable<? extends String> iterable) {
  241.63 -        for (String s : iterable) {
  241.64 -            System.err.println(s);
  241.65 -        }
  241.66 -    }
  241.67 -}
   242.1 --- a/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/java.util.Objects.test	Sun Jan 08 20:10:08 2017 +0100
   242.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   242.3 @@ -1,68 +0,0 @@
   242.4 -%%TestCase positive-equals-1 DISABLED
   242.5 -package test;
   242.6 -public class Test {
   242.7 -    private boolean test(Object o1, Object o2) {
   242.8 -        return (o1 == null) ? (o2 != null) : !o1.equals(o2);
   242.9 -    }
  242.10 -}
  242.11 -%%=>
  242.12 -package test;
  242.13 -
  242.14 -import java.util.Objects;
  242.15 -
  242.16 -public class Test {
  242.17 -    private boolean test(Object o1, Object o2) {
  242.18 -        return Objects.equals(o1, o2);
  242.19 -    }
  242.20 -}
  242.21 -%%TestCase positive-equals-2 DISABLED
  242.22 -package test;
  242.23 -public class Test {
  242.24 -    private boolean test(Object o1, Object o2) {
  242.25 -        return o1 != o2 && (o1 == null || !o1.equals(o2));
  242.26 -    }
  242.27 -}
  242.28 -%%=>
  242.29 -package test;
  242.30 -
  242.31 -import java.util.Objects;
  242.32 -
  242.33 -public class Test {
  242.34 -    private boolean test(Object o1, Object o2) {
  242.35 -        return Objects.equals(o1, o2);
  242.36 -    }
  242.37 -}
  242.38 -%%TestCase positive-hashcode-1 DISABLED
  242.39 -package test;
  242.40 -public class Test {
  242.41 -    private boolean test(Object o1) {
  242.42 -        return (o1 != null ? o1.hashCode() : 0);
  242.43 -    }
  242.44 -}
  242.45 -%%=>
  242.46 -package test;
  242.47 -
  242.48 -import java.util.Objects;
  242.49 -
  242.50 -public class Test {
  242.51 -    private boolean test(Object o1) {
  242.52 -        return Objects.hashCode(o1);
  242.53 -    }
  242.54 -}
  242.55 -%%TestCase positive-hashcode-2 DISABLED
  242.56 -package test;
  242.57 -public class Test {
  242.58 -    private boolean test(Object o1) {
  242.59 -        return o1 != null ? o1.hashCode() : 0;
  242.60 -    }
  242.61 -}
  242.62 -%%=>
  242.63 -package test;
  242.64 -
  242.65 -import java.util.Objects;
  242.66 -
  242.67 -public class Test {
  242.68 -    private boolean test(Object o1) {
  242.69 -        return Objects.hashCode(o1);
  242.70 -    }
  242.71 -}
   243.1 --- a/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/wrong-string-comparison.test	Sun Jan 08 20:10:08 2017 +0100
   243.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   243.3 @@ -1,56 +0,0 @@
   243.4 -%%TestCase simple
   243.5 -package test;
   243.6 -public class Test {
   243.7 -    public static boolean get(String s1, String s2) {
   243.8 -        return s1 == s2;
   243.9 -    }
  243.10 -}
  243.11 -%%=>
  243.12 -package test;
  243.13 -public class Test {
  243.14 -    public static boolean get(String s1, String s2) {
  243.15 -        return s1 == null ? s2 == null : s1.equals(s2);
  243.16 -    }
  243.17 -}
  243.18 -%%=>
  243.19 -package test;
  243.20 -public class Test {
  243.21 -    public static boolean get(String s1, String s2) {
  243.22 -        return s1.equals(s2);
  243.23 -    }
  243.24 -}
  243.25 -%%TestCase neg
  243.26 -package test;
  243.27 -public class Test {
  243.28 -    public static boolean get(String s1, String s2) {
  243.29 -        return s1 != s2;
  243.30 -    }
  243.31 -}
  243.32 -%%=>
  243.33 -package test;
  243.34 -public class Test {
  243.35 -    public static boolean get(String s1, String s2) {
  243.36 -        return !(s1 == null ? s2 == null : s1.equals(s2));
  243.37 -    }
  243.38 -}
  243.39 -%%=>
  243.40 -package test;
  243.41 -public class Test {
  243.42 -    public static boolean get(String s1, String s2) {
  243.43 -        return !s1.equals(s2);
  243.44 -    }
  243.45 -}
  243.46 -%%TestCase neg-accept
  243.47 -package test;
  243.48 -public class Test {
  243.49 -    public static boolean get(String s1, String s2) {
  243.50 -        return s1 != s2 && (s1 == null || s1.equals(s2));
  243.51 -    }
  243.52 -}
  243.53 -%%TestCase null
  243.54 -package test;
  243.55 -public class Test {
  243.56 -    public static boolean get(String s1, String s2) {
  243.57 -        return s1 == null;
  243.58 -    }
  243.59 -}
   244.1 --- a/sandbox/old-modules/kit/build.xml	Sun Jan 08 20:10:08 2017 +0100
   244.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   244.3 @@ -1,56 +0,0 @@
   244.4 -<?xml version="1.0" encoding="UTF-8"?>
   244.5 -<!--
   244.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   244.7 -
   244.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   244.9 -
  244.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  244.11 -Other names may be trademarks of their respective owners.
  244.12 -
  244.13 -The contents of this file are subject to the terms of either the GNU
  244.14 -General Public License Version 2 only ("GPL") or the Common
  244.15 -Development and Distribution License("CDDL") (collectively, the
  244.16 -"License"). You may not use this file except in compliance with the
  244.17 -License. You can obtain a copy of the License at
  244.18 -http://www.netbeans.org/cddl-gplv2.html
  244.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  244.20 -specific language governing permissions and limitations under the
  244.21 -License.  When distributing the software, include this License Header
  244.22 -Notice in each file and include the License file at
  244.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  244.24 -particular file as subject to the "Classpath" exception as provided
  244.25 -by Oracle in the GPL Version 2 section of the License file that
  244.26 -accompanied this code. If applicable, add the following below the
  244.27 -License Header, with the fields enclosed by brackets [] replaced by
  244.28 -your own identifying information:
  244.29 -"Portions Copyrighted [year] [name of copyright owner]"
  244.30 -
  244.31 -Contributor(s):
  244.32 -
  244.33 -The Original Software is NetBeans. The Initial Developer of the Original
  244.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  244.35 -Microsystems, Inc. All Rights Reserved.
  244.36 -
  244.37 -If you wish your version of this file to be governed by only the CDDL
  244.38 -or only the GPL Version 2, indicate your decision by adding
  244.39 -"[Contributor] elects to include this software in this distribution
  244.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  244.41 -single choice of license, a recipient has the option to distribute
  244.42 -your version of this file under either the CDDL, the GPL Version 2 or
  244.43 -to extend the choice of license to its licensees as provided above.
  244.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  244.45 -Version 2 license, then the option applies only if the new code is
  244.46 -made subject to such option by the copyright holder.
  244.47 --->
  244.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
  244.49 -<!-- for some information on what you could do (e.g. targets to override). -->
  244.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
  244.51 -<project name="org.netbeans.modules.jackpot30.kit" default="netbeans" basedir=".">
  244.52 -    <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.kit.</description>
  244.53 -    <import file="nbproject/build-impl.xml"/>
  244.54 -    
  244.55 -    <target name="test" />
  244.56 -    <target name="test-coverage" />
  244.57 -    <target name="coverage-report" />
  244.58 -    <target name="findbugs" />
  244.59 -</project>
   245.1 --- a/sandbox/old-modules/kit/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
   245.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   245.3 @@ -1,5 +0,0 @@
   245.4 -Manifest-Version: 1.0
   245.5 -OpenIDE-Module: org.netbeans.modules.jackpot30.kit
   245.6 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/kit/Bundle.properties
   245.7 -OpenIDE-Module-Specification-Version: 1.16
   245.8 -
   246.1 --- a/sandbox/old-modules/kit/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
   246.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   246.3 @@ -1,73 +0,0 @@
   246.4 -<?xml version="1.0" encoding="UTF-8"?>
   246.5 -<!--
   246.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   246.7 -
   246.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   246.9 -
  246.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  246.11 -Other names may be trademarks of their respective owners.
  246.12 -
  246.13 -The contents of this file are subject to the terms of either the GNU
  246.14 -General Public License Version 2 only ("GPL") or the Common
  246.15 -Development and Distribution License("CDDL") (collectively, the
  246.16 -"License"). You may not use this file except in compliance with the
  246.17 -License. You can obtain a copy of the License at
  246.18 -http://www.netbeans.org/cddl-gplv2.html
  246.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  246.20 -specific language governing permissions and limitations under the
  246.21 -License.  When distributing the software, include this License Header
  246.22 -Notice in each file and include the License file at
  246.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  246.24 -particular file as subject to the "Classpath" exception as provided
  246.25 -by Oracle in the GPL Version 2 section of the License file that
  246.26 -accompanied this code. If applicable, add the following below the
  246.27 -License Header, with the fields enclosed by brackets [] replaced by
  246.28 -your own identifying information:
  246.29 -"Portions Copyrighted [year] [name of copyright owner]"
  246.30 -
  246.31 -Contributor(s):
  246.32 -
  246.33 -The Original Software is NetBeans. The Initial Developer of the Original
  246.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  246.35 -Microsystems, Inc. All Rights Reserved.
  246.36 -
  246.37 -If you wish your version of this file to be governed by only the CDDL
  246.38 -or only the GPL Version 2, indicate your decision by adding
  246.39 -"[Contributor] elects to include this software in this distribution
  246.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  246.41 -single choice of license, a recipient has the option to distribute
  246.42 -your version of this file under either the CDDL, the GPL Version 2 or
  246.43 -to extend the choice of license to its licensees as provided above.
  246.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  246.45 -Version 2 license, then the option applies only if the new code is
  246.46 -made subject to such option by the copyright holder.
  246.47 --->
  246.48 -<!--
  246.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
  246.50 -***         EDIT ../build.xml INSTEAD         ***
  246.51 --->
  246.52 -<project name="org.netbeans.modules.jackpot30.kit-impl" basedir="..">
  246.53 -    <property file="nbproject/private/suite-private.properties"/>
  246.54 -    <property file="nbproject/suite.properties"/>
  246.55 -    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
  246.56 -    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
  246.57 -    <property file="${suite.dir}/nbproject/platform.properties"/>
  246.58 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
  246.59 -        <attribute name="name"/>
  246.60 -        <attribute name="value"/>
  246.61 -        <sequential>
  246.62 -            <property name="@{name}" value="${@{value}}"/>
  246.63 -        </sequential>
  246.64 -    </macrodef>
  246.65 -    <property file="${user.properties.file}"/>
  246.66 -    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  246.67 -    <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  246.68 -    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
  246.69 -        <condition>
  246.70 -            <not>
  246.71 -                <available file="${harness.dir}" type="dir"/>
  246.72 -            </not>
  246.73 -        </condition>
  246.74 -    </fail>
  246.75 -    <import file="${harness.dir}/build.xml"/>
  246.76 -</project>
   247.1 --- a/sandbox/old-modules/kit/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
   247.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   247.3 @@ -1,49 +0,0 @@
   247.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   247.5 -#
   247.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   247.7 -#
   247.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   247.9 -# Other names may be trademarks of their respective owners.
  247.10 -#
  247.11 -# The contents of this file are subject to the terms of either the GNU
  247.12 -# General Public License Version 2 only ("GPL") or the Common
  247.13 -# Development and Distribution License("CDDL") (collectively, the
  247.14 -# "License"). You may not use this file except in compliance with the
  247.15 -# License. You can obtain a copy of the License at
  247.16 -# http://www.netbeans.org/cddl-gplv2.html
  247.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  247.18 -# specific language governing permissions and limitations under the
  247.19 -# License.  When distributing the software, include this License Header
  247.20 -# Notice in each file and include the License file at
  247.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  247.22 -# particular file as subject to the "Classpath" exception as provided
  247.23 -# by Oracle in the GPL Version 2 section of the License file that
  247.24 -# accompanied this code. If applicable, add the following below the
  247.25 -# License Header, with the fields enclosed by brackets [] replaced by
  247.26 -# your own identifying information:
  247.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  247.28 -#
  247.29 -# Contributor(s):
  247.30 -#
  247.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  247.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  247.33 -# Microsystems, Inc. All Rights Reserved.
  247.34 -#
  247.35 -# If you wish your version of this file to be governed by only the CDDL
  247.36 -# or only the GPL Version 2, indicate your decision by adding
  247.37 -# "[Contributor] elects to include this software in this distribution
  247.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  247.39 -# single choice of license, a recipient has the option to distribute
  247.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  247.41 -# to extend the choice of license to its licensees as provided above.
  247.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  247.43 -# Version 2 license, then the option applies only if the new code is
  247.44 -# made subject to such option by the copyright holder.
  247.45 -build.xml.data.CRC32=719584a7
  247.46 -build.xml.script.CRC32=6c4da9a3
  247.47 -build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
  247.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
  247.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
  247.50 -nbproject/build-impl.xml.data.CRC32=ff5fa2e9
  247.51 -nbproject/build-impl.xml.script.CRC32=e68b5d3e
  247.52 -nbproject/build-impl.xml.stylesheet.CRC32=68e521fc@2.70
   248.1 --- a/sandbox/old-modules/kit/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
   248.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   248.3 @@ -1,43 +0,0 @@
   248.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   248.5 -#
   248.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   248.7 -#
   248.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   248.9 -# Other names may be trademarks of their respective owners.
  248.10 -#
  248.11 -# The contents of this file are subject to the terms of either the GNU
  248.12 -# General Public License Version 2 only ("GPL") or the Common
  248.13 -# Development and Distribution License("CDDL") (collectively, the
  248.14 -# "License"). You may not use this file except in compliance with the
  248.15 -# License. You can obtain a copy of the License at
  248.16 -# http://www.netbeans.org/cddl-gplv2.html
  248.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  248.18 -# specific language governing permissions and limitations under the
  248.19 -# License.  When distributing the software, include this License Header
  248.20 -# Notice in each file and include the License file at
  248.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  248.22 -# particular file as subject to the "Classpath" exception as provided
  248.23 -# by Oracle in the GPL Version 2 section of the License file that
  248.24 -# accompanied this code. If applicable, add the following below the
  248.25 -# License Header, with the fields enclosed by brackets [] replaced by
  248.26 -# your own identifying information:
  248.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  248.28 -#
  248.29 -# Contributor(s):
  248.30 -#
  248.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  248.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  248.33 -# Microsystems, Inc. All Rights Reserved.
  248.34 -#
  248.35 -# If you wish your version of this file to be governed by only the CDDL
  248.36 -# or only the GPL Version 2, indicate your decision by adding
  248.37 -# "[Contributor] elects to include this software in this distribution
  248.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  248.39 -# single choice of license, a recipient has the option to distribute
  248.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  248.41 -# to extend the choice of license to its licensees as provided above.
  248.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  248.43 -# Version 2 license, then the option applies only if the new code is
  248.44 -# made subject to such option by the copyright holder.
  248.45 -javac.source=1.5
  248.46 -javac.compilerargs=-Xlint -Xlint:-serial
   249.1 --- a/sandbox/old-modules/kit/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
   249.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   249.3 @@ -1,76 +0,0 @@
   249.4 -<?xml version="1.0" encoding="UTF-8"?>
   249.5 -<!--
   249.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   249.7 -
   249.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   249.9 -
  249.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  249.11 -Other names may be trademarks of their respective owners.
  249.12 -
  249.13 -The contents of this file are subject to the terms of either the GNU
  249.14 -General Public License Version 2 only ("GPL") or the Common
  249.15 -Development and Distribution License("CDDL") (collectively, the
  249.16 -"License"). You may not use this file except in compliance with the
  249.17 -License. You can obtain a copy of the License at
  249.18 -http://www.netbeans.org/cddl-gplv2.html
  249.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  249.20 -specific language governing permissions and limitations under the
  249.21 -License.  When distributing the software, include this License Header
  249.22 -Notice in each file and include the License file at
  249.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  249.24 -particular file as subject to the "Classpath" exception as provided
  249.25 -by Oracle in the GPL Version 2 section of the License file that
  249.26 -accompanied this code. If applicable, add the following below the
  249.27 -License Header, with the fields enclosed by brackets [] replaced by
  249.28 -your own identifying information:
  249.29 -"Portions Copyrighted [year] [name of copyright owner]"
  249.30 -
  249.31 -Contributor(s):
  249.32 -
  249.33 -The Original Software is NetBeans. The Initial Developer of the Original
  249.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  249.35 -Microsystems, Inc. All Rights Reserved.
  249.36 -
  249.37 -If you wish your version of this file to be governed by only the CDDL
  249.38 -or only the GPL Version 2, indicate your decision by adding
  249.39 -"[Contributor] elects to include this software in this distribution
  249.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  249.41 -single choice of license, a recipient has the option to distribute
  249.42 -your version of this file under either the CDDL, the GPL Version 2 or
  249.43 -to extend the choice of license to its licensees as provided above.
  249.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  249.45 -Version 2 license, then the option applies only if the new code is
  249.46 -made subject to such option by the copyright holder.
  249.47 --->
  249.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
  249.49 -    <type>org.netbeans.modules.apisupport.project</type>
  249.50 -    <configuration>
  249.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
  249.52 -            <code-name-base>org.netbeans.modules.jackpot30.kit</code-name-base>
  249.53 -            <suite-component/>
  249.54 -            <module-dependencies>
  249.55 -                <dependency>
  249.56 -                    <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
  249.57 -                    <build-prerequisite/>
  249.58 -                    <compile-dependency/>
  249.59 -                    <run-dependency>
  249.60 -                        <specification-version>1.16</specification-version>
  249.61 -                    </run-dependency>
  249.62 -                </dependency>
  249.63 -                <dependency>
  249.64 -                    <code-name-base>org.netbeans.modules.jackpot30.hintsimpl</code-name-base>
  249.65 -                    <run-dependency>
  249.66 -                        <specification-version>1.16</specification-version>
  249.67 -                    </run-dependency>
  249.68 -                </dependency>
  249.69 -                <dependency>
  249.70 -                    <code-name-base>org.netbeans.modules.jackpot30.transformers</code-name-base>
  249.71 -                    <run-dependency>
  249.72 -                        <specification-version>1.16</specification-version>
  249.73 -                    </run-dependency>
  249.74 -                </dependency>
  249.75 -            </module-dependencies>
  249.76 -            <public-packages/>
  249.77 -        </data>
  249.78 -    </configuration>
  249.79 -</project>
   250.1 --- a/sandbox/old-modules/kit/nbproject/suite.properties	Sun Jan 08 20:10:08 2017 +0100
   250.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   250.3 @@ -1,42 +0,0 @@
   250.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   250.5 -#
   250.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   250.7 -#
   250.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   250.9 -# Other names may be trademarks of their respective owners.
  250.10 -#
  250.11 -# The contents of this file are subject to the terms of either the GNU
  250.12 -# General Public License Version 2 only ("GPL") or the Common
  250.13 -# Development and Distribution License("CDDL") (collectively, the
  250.14 -# "License"). You may not use this file except in compliance with the
  250.15 -# License. You can obtain a copy of the License at
  250.16 -# http://www.netbeans.org/cddl-gplv2.html
  250.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  250.18 -# specific language governing permissions and limitations under the
  250.19 -# License.  When distributing the software, include this License Header
  250.20 -# Notice in each file and include the License file at
  250.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  250.22 -# particular file as subject to the "Classpath" exception as provided
  250.23 -# by Oracle in the GPL Version 2 section of the License file that
  250.24 -# accompanied this code. If applicable, add the following below the
  250.25 -# License Header, with the fields enclosed by brackets [] replaced by
  250.26 -# your own identifying information:
  250.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  250.28 -#
  250.29 -# Contributor(s):
  250.30 -#
  250.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  250.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  250.33 -# Microsystems, Inc. All Rights Reserved.
  250.34 -#
  250.35 -# If you wish your version of this file to be governed by only the CDDL
  250.36 -# or only the GPL Version 2, indicate your decision by adding
  250.37 -# "[Contributor] elects to include this software in this distribution
  250.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  250.39 -# single choice of license, a recipient has the option to distribute
  250.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  250.41 -# to extend the choice of license to its licensees as provided above.
  250.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  250.43 -# Version 2 license, then the option applies only if the new code is
  250.44 -# made subject to such option by the copyright holder.
  250.45 -suite.dir=${basedir}/..
   251.1 --- a/sandbox/old-modules/kit/src/org/netbeans/modules/jackpot30/kit/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   251.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   251.3 @@ -1,38 +0,0 @@
   251.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   251.5 -#
   251.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   251.7 -#
   251.8 -# The contents of this file are subject to the terms of either the GNU
   251.9 -# General Public License Version 2 only ("GPL") or the Common
  251.10 -# Development and Distribution License("CDDL") (collectively, the
  251.11 -# "License"). You may not use this file except in compliance with the
  251.12 -# License. You can obtain a copy of the License at
  251.13 -# http://www.netbeans.org/cddl-gplv2.html
  251.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  251.15 -# specific language governing permissions and limitations under the
  251.16 -# License.  When distributing the software, include this License Header
  251.17 -# Notice in each file and include the License file at
  251.18 -# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  251.19 -# particular file as subject to the "Classpath" exception as provided
  251.20 -# by Sun in the GPL Version 2 section of the License file that
  251.21 -# accompanied this code. If applicable, add the following below the
  251.22 -# License Header, with the fields enclosed by brackets [] replaced by
  251.23 -# your own identifying information:
  251.24 -# "Portions Copyrighted [year] [name of copyright owner]"
  251.25 -#
  251.26 -# If you wish your version of this file to be governed by only the CDDL
  251.27 -# or only the GPL Version 2, indicate your decision by adding
  251.28 -# "[Contributor] elects to include this software in this distribution
  251.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  251.30 -# single choice of license, a recipient has the option to distribute
  251.31 -# your version of this file under either the CDDL, the GPL Version 2 or
  251.32 -# to extend the choice of license to its licensees as provided above.
  251.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  251.34 -# Version 2 license, then the option applies only if the new code is
  251.35 -# made subject to such option by the copyright holder.
  251.36 -#
  251.37 -# Contributor(s):
  251.38 -#
  251.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
  251.40 -
  251.41 -OpenIDE-Module-Name=Jackpot 3.0
   252.1 --- a/sandbox/old-modules/overlays/netbeans	Sun Jan 08 20:10:08 2017 +0100
   252.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   252.3 @@ -1,307 +0,0 @@
   252.4 -diff --git a/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint b/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint
   252.5 -new file mode 100644
   252.6 ---- /dev/null
   252.7 -+++ b/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint
   252.8 -@@ -0,0 +1,23 @@
   252.9 -+'FileObject.getPackageNameExt(char, char) is deprecated':
  252.10 -+   $0.getPackageNameExt('/', '.') :: $0 instanceof org.openide.FileObject
  252.11 -+=> $0.getPath()
  252.12 -+;;
  252.13 -+'FileObject.getPackageNameExt(char, char) is deprecated':
  252.14 -+   $0.getPackageNameExt($1, '.') :: $0 instanceof org.openide.FileObject && $1 instanceof char
  252.15 -+=> $0.getPath().replace('/', $1)
  252.16 -+;;
  252.17 -+
  252.18 -+'FileObject.isReadOnly() is deprecated':
  252.19 -+    $0.isReadOnly() :: $0 instanceof org.openide.FileObject
  252.20 -+=> !$0.canWrite()
  252.21 -+;;
  252.22 -+
  252.23 -+'Repository.getDefaultFileSystem()':
  252.24 -+   org.openide.filesystems.Repository.getDefault.getDefaultFileSystem()
  252.25 -+=> org.openide.filesystems.FileUtil.getConfigRoot()
  252.26 -+;;
  252.27 -+
  252.28 -+'Repository.getDefaultFileSystem()':
  252.29 -+   org.openide.filesystems.Repository.getDefault.getDefaultFileSystem().findResource($path) :: $path instanceof java.lang.String
  252.30 -+=> org.openide.filesystems.FileUtil.getConfigFile($path)
  252.31 -+;;
  252.32 -diff --git a/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint b/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint
  252.33 -new file mode 100644
  252.34 ---- /dev/null
  252.35 -+++ b/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint
  252.36 -@@ -0,0 +1,3 @@
  252.37 -+'DataObject.getCookie is obsolette':
  252.38 -+$this.getCookie($1) :: $this instanceof org.openide.loaders.DataObject && $1 instanceof java.lang.Class
  252.39 -+   => $this.getLookup().lookup($1) ;;
  252.40 -diff --git a/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint b/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint
  252.41 -new file mode 100644
  252.42 ---- /dev/null
  252.43 -+++ b/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint
  252.44 -@@ -0,0 +1,3 @@
  252.45 -+'Node.getCookie is obsolette':
  252.46 -+$this.getCookie($1) :: $this instanceof org.openide.loaders.DataObject && $1 instanceof java.lang.Class
  252.47 -+   => $this.getLookup().lookup($1) ;;
  252.48 -diff --git a/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint b/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint
  252.49 -new file mode 100644
  252.50 ---- /dev/null
  252.51 -+++ b/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint
  252.52 -@@ -0,0 +1,12 @@
  252.53 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TRY_SHOW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.NONE, org.openide.text.Line.ShowVisibilityType.NONE, $1) ;;
  252.54 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_SHOW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.NONE, $1) ;;
  252.55 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_GOTO, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
  252.56 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TOFRONT, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FRONT, $1) ;;
  252.57 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
  252.58 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE_NEW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE_NEW, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
  252.59 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TRY_SHOW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.NONE, org.openide.text.Line.ShowVisibilityType.NONE) ;;
  252.60 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_SHOW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.NONE) ;;
  252.61 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_GOTO) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
  252.62 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TOFRONT) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FRONT) ;;
  252.63 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
  252.64 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE_NEW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE_NEW, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
  252.65 -diff --git a/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint b/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint
  252.66 -new file mode 100644
  252.67 ---- /dev/null
  252.68 -+++ b/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint
  252.69 -@@ -0,0 +1,104 @@
  252.70 -+'ErrorManager.notify is deprecated':
  252.71 -+$this.notify(org.openide.ErrorManager.UNKNOWN, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
  252.72 -+   =>org.openide.util.Exceptions.printStackTrace($1)
  252.73 -+   ;;
  252.74 -+
  252.75 -+'ErrorManager.notify is deprecated':
  252.76 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
  252.77 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
  252.78 -+   ;;
  252.79 -+
  252.80 -+'ErrorManager.notify is deprecated':
  252.81 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
  252.82 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
  252.83 -+   ;;
  252.84 -+
  252.85 -+'ErrorManager.notify is deprecated':
  252.86 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
  252.87 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.INFO, null, $1)
  252.88 -+   ;;
  252.89 -+
  252.90 -+'ErrorManager.notify is deprecated':
  252.91 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.USER, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
  252.92 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
  252.93 -+   ;;
  252.94 -+
  252.95 -+'ErrorManager.notify is deprecated':
  252.96 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.WARNING, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
  252.97 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
  252.98 -+   ;;
  252.99 -+
 252.100 -+'ErrorManager.notify is deprecated':
 252.101 -+$this.notify($1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
 252.102 -+   =>org.openide.util.Exceptions.printStackTrace($1)
 252.103 -+   ;;
 252.104 -+
 252.105 -+'ErrorManager.log is deprecated':
 252.106 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.UNKNOWN, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
 252.107 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.INFO, $1)
 252.108 -+   ;;
 252.109 -+
 252.110 -+'ErrorManager.log is deprecated':
 252.111 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.ERROR, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
 252.112 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, $1)
 252.113 -+   ;;
 252.114 -+
 252.115 -+'ErrorManager.log is deprecated':
 252.116 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
 252.117 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, $1)
 252.118 -+   ;;
 252.119 -+
 252.120 -+'ErrorManager.log is deprecated':
 252.121 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.INFORMATIONAL, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
 252.122 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.FINE, $1)
 252.123 -+   ;;
 252.124 -+
 252.125 -+'ErrorManager.log is deprecated':
 252.126 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.USER, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
 252.127 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, $1)
 252.128 -+   ;;
 252.129 -+
 252.130 -+'ErrorManager.log is deprecated':
 252.131 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.WARNING, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
 252.132 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, $1)
 252.133 -+   ;;
 252.134 -+
 252.135 -+'ErrorManager.log is deprecated':
 252.136 -+org.openide.ErrorManager.getDefault().log($1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
 252.137 -+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.FINE, $1)
 252.138 -+   ;;
 252.139 -+
 252.140 -+'ErrorManager.isLoggable is deprecated':
 252.141 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.UNKNOWN) :: $this instanceof org.openide.ErrorManager
 252.142 -+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.INFO)
 252.143 -+   ;;
 252.144 -+
 252.145 -+'ErrorManager.isLoggable is deprecated':
 252.146 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.ERROR) :: $this instanceof org.openide.ErrorManager
 252.147 -+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.SEVERE)
 252.148 -+   ;;
 252.149 -+
 252.150 -+'ErrorManager.isLoggable is deprecated':
 252.151 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.EXCEPTION) :: $this instanceof org.openide.ErrorManager
 252.152 -+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.SEVERE)
 252.153 -+   ;;
 252.154 -+
 252.155 -+'ErrorManager.isLoggable is deprecated':
 252.156 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.INFORMATIONAL) :: $this instanceof org.openide.ErrorManager
 252.157 -+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.FINE)
 252.158 -+   ;;
 252.159 -+
 252.160 -+'ErrorManager.isLoggable is deprecated':
 252.161 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.USER) :: $this instanceof org.openide.ErrorManager
 252.162 -+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.WARNING)
 252.163 -+   ;;
 252.164 -+
 252.165 -+'ErrorManager.isLoggable is deprecated':
 252.166 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.WARNING) :: $this instanceof org.openide.ErrorManager
 252.167 -+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.WARNING)
 252.168 -+   ;;
 252.169 -+
 252.170 -+'ErrorManager.annotate is deprecated':
 252.171 -+$this.annotate($1, $2) :: $1 instanceof java.lang.Throwable && $2 instanceof java.lang.String  && $this instanceof org.openide.ErrorManager
 252.172 -+   =>org.openide.util.Exceptions.attachLocalizedMessage($1, $2)
 252.173 -+   ;;
 252.174 -diff --git a/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint b/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint
 252.175 -new file mode 100644
 252.176 ---- /dev/null
 252.177 -+++ b/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint
 252.178 -@@ -0,0 +1,17 @@
 252.179 -+'Lookup.lookupAll can be used instead':
 252.180 -+$0.lookup(new org.openide.util.Lookup.Template($1)).allInstances() :: $0 instanceof org.openide.util.Lookup && $1 instanceof java.lang.Class
 252.181 -+=>
 252.182 -+$0.lookupAll($1)
 252.183 -+;;
 252.184 -+
 252.185 -+'Lookup.lookupResult can be used instead':
 252.186 -+$0.lookup(new org.openide.util.Lookup.Template($1)) :: $0 instanceof org.openide.util.Lookup && $1 instanceof java.lang.Class && !parentMatches("$_.allInstances()")
 252.187 -+=>
 252.188 -+$0.lookupResult($1)
 252.189 -+;;
 252.190 -+
 252.191 -+'Lookup.Template() is deprecated':
 252.192 -+new org.openide.util.Lookup.Template()
 252.193 -+=>
 252.194 -+new org.openide.util.Lookup.Template(java.lang.Object.class)
 252.195 -+;;
 252.196 -diff --git a/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint b/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint
 252.197 -new file mode 100644
 252.198 ---- /dev/null
 252.199 -+++ b/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint
 252.200 -@@ -0,0 +1,19 @@
 252.201 -+'Utilities.mergeImages is deprecated':
 252.202 -+   org.openide.util.Utilities.mergeImages($1, $2, $3, $4) :: $1 instanceof java.awt.Image && $2 instanceof java.awt.Image && $3 instanceof int && $4 instanceof int
 252.203 -+=> org.openide.util.ImageUtilities.mergeImages($1, $2, $3, $4)
 252.204 -+;;
 252.205 -+
 252.206 -+'Utilities.loadImage is deprecated':
 252.207 -+   org.openide.util.Utilities.loadImage($1) :: $1 instanceof String
 252.208 -+=> org.openide.util.ImageUtilities.loadImage($1)
 252.209 -+;;
 252.210 -+
 252.211 -+'Utilities.icon2Image is deprecated':
 252.212 -+   org.openide.util.Utilities.icon2Image($1) :: $1 instanceof javax.swing.Icon
 252.213 -+=> org.openide.util.ImageUtilities.icon2Image($1)
 252.214 -+;;
 252.215 -+
 252.216 -+'Utilities.image2Icon can be used instead of new ImageIcon':
 252.217 -+   new javax.swing.ImageIcon($1) :: $1 instanceof java.awt.Image
 252.218 -+=> org.openide.util.ImageUtilities.image2Icon($1)
 252.219 -+;;
 252.220 -diff --git a/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test b/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test
 252.221 -new file mode 100644
 252.222 ---- /dev/null
 252.223 -+++ b/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test
 252.224 -@@ -0,0 +1,86 @@
 252.225 -+%%TestCase mergeImages1
 252.226 -+package test;
 252.227 -+import java.awt.Image;
 252.228 -+import org.openide.util.Utilities;
 252.229 -+public class Test {
 252.230 -+    private void test() {
 252.231 -+        Image i1 = null, i2 = null;
 252.232 -+        Utilities.mergeImages(i1, i2, -9, 34);
 252.233 -+    }
 252.234 -+}
 252.235 -+%%=>
 252.236 -+package test;
 252.237 -+import java.awt.Image;
 252.238 -+import org.openide.util.ImageUtilities;
 252.239 -+import org.openide.util.Utilities;
 252.240 -+public class Test {
 252.241 -+    private void test() {
 252.242 -+        Image i1 = null, i2 = null;
 252.243 -+        ImageUtilities.mergeImages(i1, i2, -9, 34);
 252.244 -+    }
 252.245 -+}
 252.246 -+%%TestCase loadImage1
 252.247 -+package test;
 252.248 -+import java.awt.Image;
 252.249 -+import org.openide.util.Utilities;
 252.250 -+public class Test {
 252.251 -+    private void test() {
 252.252 -+        Utilities.loadImage("foobar");
 252.253 -+    }
 252.254 -+}
 252.255 -+%%=>
 252.256 -+package test;
 252.257 -+import java.awt.Image;
 252.258 -+import org.openide.util.ImageUtilities;
 252.259 -+import org.openide.util.Utilities;
 252.260 -+public class Test {
 252.261 -+    private void test() {
 252.262 -+        ImageUtilities.loadImage("foobar");
 252.263 -+    }
 252.264 -+}
 252.265 -+%%TestCase icon2Image1
 252.266 -+package test;
 252.267 -+import javax.swing.Icon;
 252.268 -+import org.openide.util.Utilities;
 252.269 -+public class Test {
 252.270 -+    private void test() {
 252.271 -+        Icon i = null;
 252.272 -+        Utilities.icon2Image(i);
 252.273 -+    }
 252.274 -+}
 252.275 -+%%=>
 252.276 -+package test;
 252.277 -+import javax.swing.Icon;
 252.278 -+import org.openide.util.ImageUtilities;
 252.279 -+import org.openide.util.Utilities;
 252.280 -+public class Test {
 252.281 -+    private void test() {
 252.282 -+        Icon i = null;
 252.283 -+        ImageUtilities.icon2Image(i);
 252.284 -+    }
 252.285 -+}
 252.286 -+%%TestCase image2Icon1
 252.287 -+package test;
 252.288 -+import java.awt.Image;
 252.289 -+import javax.swing.Icon;
 252.290 -+import javax.swing.ImageIcon;
 252.291 -+import org.openide.util.Utilities;
 252.292 -+public class Test {
 252.293 -+    private void test() {
 252.294 -+        Image img = null;
 252.295 -+        Icon i = new ImageIcon(img);
 252.296 -+    }
 252.297 -+}
 252.298 -+%%=>
 252.299 -+package test;
 252.300 -+import java.awt.Image;
 252.301 -+import javax.swing.Icon;
 252.302 -+import javax.swing.ImageIcon;
 252.303 -+import org.openide.util.ImageUtilities;
 252.304 -+import org.openide.util.Utilities;
 252.305 -+public class Test {
 252.306 -+    private void test() {
 252.307 -+        Image img = null;
 252.308 -+        Icon i = ImageUtilities.image2Icon(img);
 252.309 -+    }
 252.310 -+}
   253.1 --- a/sandbox/old-modules/server/do-indexing	Sun Jan 08 20:10:08 2017 +0100
   253.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   253.3 @@ -1,27 +0,0 @@
   253.4 -#!/bin/bash -x
   253.5 -
   253.6 -performIndexing() {
   253.7 -    name=`basename $1`;
   253.8 -    if [ -d $name ] ; then
   253.9 -        HG_OUT=$(tempfile) || exit
  253.10 -        trap "rm -f -- '$HG_OUT'" EXIT
  253.11 -        MODIFIED=$(tempfile) || exit
  253.12 -        trap "rm -f -- '$HG_OUT' '$MODIFIED'" EXIT
  253.13 -        REMOVED=$(tempfile) || exit
  253.14 -        trap "rm -f -- '$HG_OUT' '$MODIFIED' '$REMOVED'" EXIT
  253.15 -
  253.16 -        (cd $name; hg pull; hg --verbose up >$HG_OUT; grep <$HG_OUT "^getting " | cut -d ' ' -f 2- >$MODIFIED; grep <$HG_OUT "^removing " | cut -d ' ' -f 2- >$REMOVED;)
  253.17 -        java -Xbootclasspath/p:lib/javac-api-nb-7.0-b07.jar -jar indexer.jar $ADDITIONAL_INDEXING_PARAMS $name $2 "$MODIFIED" "$REMOVED"
  253.18 -    else
  253.19 -        hg clone $1
  253.20 -        java -Xbootclasspath/p:lib/javac-api-nb-7.0-b07.jar -jar indexer.jar $ADDITIONAL_INDEXING_PARAMS $name $2
  253.21 -    fi;
  253.22 -}
  253.23 -
  253.24 -mkdir -p cache
  253.25 -
  253.26 -for f in `echo $1 | tr ',' '\n'`; do
  253.27 -    performIndexing $f cache
  253.28 -done
  253.29 -
  253.30 -exit
   254.1 --- a/sandbox/old-modules/server/indexer/build.xml	Sun Jan 08 20:10:08 2017 +0100
   254.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   254.3 @@ -1,129 +0,0 @@
   254.4 -<?xml version="1.0" encoding="UTF-8"?>
   254.5 -<!--
   254.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   254.7 -
   254.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   254.9 -
  254.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  254.11 -Other names may be trademarks of their respective owners.
  254.12 -
  254.13 -The contents of this file are subject to the terms of either the GNU
  254.14 -General Public License Version 2 only ("GPL") or the Common
  254.15 -Development and Distribution License("CDDL") (collectively, the
  254.16 -"License"). You may not use this file except in compliance with the
  254.17 -License. You can obtain a copy of the License at
  254.18 -http://www.netbeans.org/cddl-gplv2.html
  254.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  254.20 -specific language governing permissions and limitations under the
  254.21 -License.  When distributing the software, include this License Header
  254.22 -Notice in each file and include the License file at
  254.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  254.24 -particular file as subject to the "Classpath" exception as provided
  254.25 -by Oracle in the GPL Version 2 section of the License file that
  254.26 -accompanied this code. If applicable, add the following below the
  254.27 -License Header, with the fields enclosed by brackets [] replaced by
  254.28 -your own identifying information:
  254.29 -"Portions Copyrighted [year] [name of copyright owner]"
  254.30 -
  254.31 -Contributor(s):
  254.32 -
  254.33 -The Original Software is NetBeans. The Initial Developer of the Original
  254.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  254.35 -Microsystems, Inc. All Rights Reserved.
  254.36 -
  254.37 -If you wish your version of this file to be governed by only the CDDL
  254.38 -or only the GPL Version 2, indicate your decision by adding
  254.39 -"[Contributor] elects to include this software in this distribution
  254.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  254.41 -single choice of license, a recipient has the option to distribute
  254.42 -your version of this file under either the CDDL, the GPL Version 2 or
  254.43 -to extend the choice of license to its licensees as provided above.
  254.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  254.45 -Version 2 license, then the option applies only if the new code is
  254.46 -made subject to such option by the copyright holder.
  254.47 --->
  254.48 -<!-- You may freely edit this file. See commented blocks below for -->
  254.49 -<!-- some examples of how to customize the build. -->
  254.50 -<!-- (If you delete it and reopen the project it will be recreated.) -->
  254.51 -<!-- By default, only the Clean and Build commands use this build script. -->
  254.52 -<!-- Commands such as Run, Debug, and Test only use this build script if -->
  254.53 -<!-- the Compile on Save feature is turned off for the project. -->
  254.54 -<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
  254.55 -<!-- in the project's Project Properties dialog box.-->
  254.56 -<project name="indexer" default="default" basedir=".">
  254.57 -    <description>Builds, tests, and runs the project indexer.</description>
  254.58 -    <import file="../download.xml"/>
  254.59 -    <import file="nbproject/build-impl.xml"/>
  254.60 -    <!--
  254.61 -
  254.62 -    There exist several targets which are by default empty and which can be 
  254.63 -    used for execution of your tasks. These targets are usually executed 
  254.64 -    before and after some main targets. They are: 
  254.65 -
  254.66 -      -pre-init:                 called before initialization of project properties
  254.67 -      -post-init:                called after initialization of project properties
  254.68 -      -pre-compile:              called before javac compilation
  254.69 -      -post-compile:             called after javac compilation
  254.70 -      -pre-compile-single:       called before javac compilation of single file
  254.71 -      -post-compile-single:      called after javac compilation of single file
  254.72 -      -pre-compile-test:         called before javac compilation of JUnit tests
  254.73 -      -post-compile-test:        called after javac compilation of JUnit tests
  254.74 -      -pre-compile-test-single:  called before javac compilation of single JUnit test
  254.75 -      -post-compile-test-single: called after javac compilation of single JUunit test
  254.76 -      -pre-jar:                  called before JAR building
  254.77 -      -post-jar:                 called after JAR building
  254.78 -      -post-clean:               called after cleaning build products
  254.79 -
  254.80 -    (Targets beginning with '-' are not intended to be called on their own.)
  254.81 -
  254.82 -    Example of inserting an obfuscator after compilation could look like this:
  254.83 -
  254.84 -        <target name="-post-compile">
  254.85 -            <obfuscate>
  254.86 -                <fileset dir="${build.classes.dir}"/>
  254.87 -            </obfuscate>
  254.88 -        </target>
  254.89 -
  254.90 -    For list of available properties check the imported 
  254.91 -    nbproject/build-impl.xml file. 
  254.92 -
  254.93 -
  254.94 -    Another way to customize the build is by overriding existing main targets.
  254.95 -    The targets of interest are: 
  254.96 -
  254.97 -      -init-macrodef-javac:     defines macro for javac compilation
  254.98 -      -init-macrodef-junit:     defines macro for junit execution
  254.99 -      -init-macrodef-debug:     defines macro for class debugging
 254.100 -      -init-macrodef-java:      defines macro for class execution
 254.101 -      -do-jar-with-manifest:    JAR building (if you are using a manifest)
 254.102 -      -do-jar-without-manifest: JAR building (if you are not using a manifest)
 254.103 -      run:                      execution of project 
 254.104 -      -javadoc-build:           Javadoc generation
 254.105 -      test-report:              JUnit report generation
 254.106 -
 254.107 -    An example of overriding the target for project execution could look like this:
 254.108 -
 254.109 -        <target name="run" depends="indexer-impl.jar">
 254.110 -            <exec dir="bin" executable="launcher.exe">
 254.111 -                <arg file="${dist.jar}"/>
 254.112 -            </exec>
 254.113 -        </target>
 254.114 -
 254.115 -    Notice that the overridden target depends on the jar target and not only on 
 254.116 -    the compile target as the regular run target does. Again, for a list of available 
 254.117 -    properties which you can use, check the target you are overriding in the
 254.118 -    nbproject/build-impl.xml file. 
 254.119 -
 254.120 -    -->
 254.121 -
 254.122 -    <target name="copy-to-hudson" depends="jar">
 254.123 -        <mkdir dir="${hudson.compiler.dir}" /> <!--only to be sure, should exist-->
 254.124 -        <copy todir="${hudson.compiler.dir}/indexer">
 254.125 -            <fileset dir="${dist.dir}"/>
 254.126 -        </copy>
 254.127 -    </target>
 254.128 -
 254.129 -    <target name="-post-clean">
 254.130 -        <delete dir="${hudson.compiler.dir}/indexer"/>
 254.131 -    </target>
 254.132 -</project>
   255.1 --- a/sandbox/old-modules/server/indexer/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
   255.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   255.3 @@ -1,3 +0,0 @@
   255.4 -Manifest-Version: 1.0
   255.5 -X-COMMENT: Main-Class will be added automatically by build
   255.6 -
   256.1 --- a/sandbox/old-modules/server/indexer/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
   256.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   256.3 @@ -1,957 +0,0 @@
   256.4 -<?xml version="1.0" encoding="UTF-8"?>
   256.5 -<!--
   256.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   256.7 -
   256.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   256.9 -
  256.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  256.11 -Other names may be trademarks of their respective owners.
  256.12 -
  256.13 -The contents of this file are subject to the terms of either the GNU
  256.14 -General Public License Version 2 only ("GPL") or the Common
  256.15 -Development and Distribution License("CDDL") (collectively, the
  256.16 -"License"). You may not use this file except in compliance with the
  256.17 -License. You can obtain a copy of the License at
  256.18 -http://www.netbeans.org/cddl-gplv2.html
  256.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  256.20 -specific language governing permissions and limitations under the
  256.21 -License.  When distributing the software, include this License Header
  256.22 -Notice in each file and include the License file at
  256.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  256.24 -particular file as subject to the "Classpath" exception as provided
  256.25 -by Oracle in the GPL Version 2 section of the License file that
  256.26 -accompanied this code. If applicable, add the following below the
  256.27 -License Header, with the fields enclosed by brackets [] replaced by
  256.28 -your own identifying information:
  256.29 -"Portions Copyrighted [year] [name of copyright owner]"
  256.30 -
  256.31 -Contributor(s):
  256.32 -
  256.33 -The Original Software is NetBeans. The Initial Developer of the Original
  256.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  256.35 -Microsystems, Inc. All Rights Reserved.
  256.36 -
  256.37 -If you wish your version of this file to be governed by only the CDDL
  256.38 -or only the GPL Version 2, indicate your decision by adding
  256.39 -"[Contributor] elects to include this software in this distribution
  256.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  256.41 -single choice of license, a recipient has the option to distribute
  256.42 -your version of this file under either the CDDL, the GPL Version 2 or
  256.43 -to extend the choice of license to its licensees as provided above.
  256.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  256.45 -Version 2 license, then the option applies only if the new code is
  256.46 -made subject to such option by the copyright holder.
  256.47 --->
  256.48 -<!--
  256.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
  256.50 -***         EDIT ../build.xml INSTEAD         ***
  256.51 -
  256.52 -For the purpose of easier reading the script
  256.53 -is divided into following sections:
  256.54 -
  256.55 -  - initialization
  256.56 -  - compilation
  256.57 -  - jar
  256.58 -  - execution
  256.59 -  - debugging
  256.60 -  - javadoc
  256.61 -  - junit compilation
  256.62 -  - junit execution
  256.63 -  - junit debugging
  256.64 -  - applet
  256.65 -  - cleanup
  256.66 -
  256.67 -        -->
  256.68 -<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="indexer-impl">
  256.69 -    <fail message="Please build using Ant 1.7.1 or higher.">
  256.70 -        <condition>
  256.71 -            <not>
  256.72 -                <antversion atleast="1.7.1"/>
  256.73 -            </not>
  256.74 -        </condition>
  256.75 -    </fail>
  256.76 -    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
  256.77 -    <!-- 
  256.78 -                ======================
  256.79 -                INITIALIZATION SECTION 
  256.80 -                ======================
  256.81 -            -->
  256.82 -    <target name="-pre-init">
  256.83 -        <!-- Empty placeholder for easier customization. -->
  256.84 -        <!-- You can override this target in the ../build.xml file. -->
  256.85 -    </target>
  256.86 -    <target depends="-pre-init" name="-init-private">
  256.87 -        <property file="nbproject/private/config.properties"/>
  256.88 -        <property file="nbproject/private/configs/${config}.properties"/>
  256.89 -        <property file="nbproject/private/private.properties"/>
  256.90 -    </target>
  256.91 -    <target name="-pre-init-libraries">
  256.92 -        <property location="../lib/nblibraries.properties" name="libraries.path"/>
  256.93 -        <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
  256.94 -        <pathconvert dirsep="/" property="libraries.dir">
  256.95 -            <path path="${libraries.dir.nativedirsep}"/>
  256.96 -        </pathconvert>
  256.97 -        <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/>
  256.98 -        <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/>
  256.99 -    </target>
 256.100 -    <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries">
 256.101 -        <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties">
 256.102 -            <filterchain>
 256.103 -                <replacestring from="$${base}" to="${libraries.dir}"/>
 256.104 -                <escapeunicode/>
 256.105 -            </filterchain>
 256.106 -        </loadproperties>
 256.107 -    </target>
 256.108 -    <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries">
 256.109 -        <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}">
 256.110 -            <filterchain>
 256.111 -                <replacestring from="$${base}" to="${libraries.dir}"/>
 256.112 -                <escapeunicode/>
 256.113 -            </filterchain>
 256.114 -        </loadproperties>
 256.115 -    </target>
 256.116 -    <target depends="-pre-init,-init-private,-init-libraries" name="-init-user">
 256.117 -        <property file="${user.properties.file}"/>
 256.118 -        <!-- The two properties below are usually overridden -->
 256.119 -        <!-- by the active platform. Just a fallback. -->
 256.120 -        <property name="default.javac.source" value="1.4"/>
 256.121 -        <property name="default.javac.target" value="1.4"/>
 256.122 -    </target>
 256.123 -    <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project">
 256.124 -        <property file="nbproject/configs/${config}.properties"/>
 256.125 -        <property file="nbproject/project.properties"/>
 256.126 -    </target>
 256.127 -    <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init">
 256.128 -        <available file="${manifest.file}" property="manifest.available"/>
 256.129 -        <condition property="main.class.available">
 256.130 -            <and>
 256.131 -                <isset property="main.class"/>
 256.132 -                <not>
 256.133 -                    <equals arg1="${main.class}" arg2="" trim="true"/>
 256.134 -                </not>
 256.135 -            </and>
 256.136 -        </condition>
 256.137 -        <condition property="manifest.available+main.class">
 256.138 -            <and>
 256.139 -                <isset property="manifest.available"/>
 256.140 -                <isset property="main.class.available"/>
 256.141 -            </and>
 256.142 -        </condition>
 256.143 -        <condition property="do.mkdist">
 256.144 -            <and>
 256.145 -                <isset property="libs.CopyLibs.classpath"/>
 256.146 -                <not>
 256.147 -                    <istrue value="${mkdist.disabled}"/>
 256.148 -                </not>
 256.149 -            </and>
 256.150 -        </condition>
 256.151 -        <condition property="manifest.available+main.class+mkdist.available">
 256.152 -            <and>
 256.153 -                <istrue value="${manifest.available+main.class}"/>
 256.154 -                <isset property="do.mkdist"/>
 256.155 -            </and>
 256.156 -        </condition>
 256.157 -        <condition property="manifest.available+mkdist.available">
 256.158 -            <and>
 256.159 -                <istrue value="${manifest.available}"/>
 256.160 -                <isset property="do.mkdist"/>
 256.161 -            </and>
 256.162 -        </condition>
 256.163 -        <condition property="manifest.available-mkdist.available">
 256.164 -            <or>
 256.165 -                <istrue value="${manifest.available}"/>
 256.166 -                <isset property="do.mkdist"/>
 256.167 -            </or>
 256.168 -        </condition>
 256.169 -        <condition property="manifest.available+main.class-mkdist.available">
 256.170 -            <or>
 256.171 -                <istrue value="${manifest.available+main.class}"/>
 256.172 -                <isset property="do.mkdist"/>
 256.173 -            </or>
 256.174 -        </condition>
 256.175 -        <condition property="have.tests">
 256.176 -            <or>
 256.177 -                <available file="${test.src.dir}"/>
 256.178 -            </or>
 256.179 -        </condition>
 256.180 -        <condition property="have.sources">
 256.181 -            <or>
 256.182 -                <available file="${src.dir}"/>
 256.183 -            </or>
 256.184 -        </condition>
 256.185 -        <condition property="netbeans.home+have.tests">
 256.186 -            <and>
 256.187 -                <isset property="netbeans.home"/>
 256.188 -                <isset property="have.tests"/>
 256.189 -            </and>
 256.190 -        </condition>
 256.191 -        <condition property="no.javadoc.preview">
 256.192 -            <and>
 256.193 -                <isset property="javadoc.preview"/>
 256.194 -                <isfalse value="${javadoc.preview}"/>
 256.195 -            </and>
 256.196 -        </condition>
 256.197 -        <property name="run.jvmargs" value=""/>
 256.198 -        <property name="javac.compilerargs" value=""/>
 256.199 -        <property name="work.dir" value="${basedir}"/>
 256.200 -        <condition property="no.deps">
 256.201 -            <and>
 256.202 -                <istrue value="${no.dependencies}"/>
 256.203 -            </and>
 256.204 -        </condition>
 256.205 -        <property name="javac.debug" value="true"/>
 256.206 -        <property name="javadoc.preview" value="true"/>
 256.207 -        <property name="application.args" value=""/>
 256.208 -        <property name="source.encoding" value="${file.encoding}"/>
 256.209 -        <property name="runtime.encoding" value="${source.encoding}"/>
 256.210 -        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
 256.211 -            <and>
 256.212 -                <isset property="javadoc.encoding"/>
 256.213 -                <not>
 256.214 -                    <equals arg1="${javadoc.encoding}" arg2=""/>
 256.215 -                </not>
 256.216 -            </and>
 256.217 -        </condition>
 256.218 -        <property name="javadoc.encoding.used" value="${source.encoding}"/>
 256.219 -        <property name="includes" value="**"/>
 256.220 -        <property name="excludes" value=""/>
 256.221 -        <property name="do.depend" value="false"/>
 256.222 -        <condition property="do.depend.true">
 256.223 -            <istrue value="${do.depend}"/>
 256.224 -        </condition>
 256.225 -        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
 256.226 -        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
 256.227 -            <length length="0" string="${endorsed.classpath}" when="greater"/>
 256.228 -        </condition>
 256.229 -        <property name="javac.fork" value="false"/>
 256.230 -    </target>
 256.231 -    <target name="-post-init">
 256.232 -        <!-- Empty placeholder for easier customization. -->
 256.233 -        <!-- You can override this target in the ../build.xml file. -->
 256.234 -    </target>
 256.235 -    <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check">
 256.236 -        <fail unless="src.dir">Must set src.dir</fail>
 256.237 -        <fail unless="test.src.dir">Must set test.src.dir</fail>
 256.238 -        <fail unless="build.dir">Must set build.dir</fail>
 256.239 -        <fail unless="dist.dir">Must set dist.dir</fail>
 256.240 -        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 256.241 -        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 256.242 -        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 256.243 -        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 256.244 -        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 256.245 -        <fail unless="dist.jar">Must set dist.jar</fail>
 256.246 -    </target>
 256.247 -    <target name="-init-macrodef-property">
 256.248 -        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
 256.249 -            <attribute name="name"/>
 256.250 -            <attribute name="value"/>
 256.251 -            <sequential>
 256.252 -                <property name="@{name}" value="${@{value}}"/>
 256.253 -            </sequential>
 256.254 -        </macrodef>
 256.255 -    </target>
 256.256 -    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
 256.257 -        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 256.258 -            <attribute default="${src.dir}" name="srcdir"/>
 256.259 -            <attribute default="${build.classes.dir}" name="destdir"/>
 256.260 -            <attribute default="${javac.classpath}" name="classpath"/>
 256.261 -            <attribute default="${javac.processorpath}" name="processorpath"/>
 256.262 -            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
 256.263 -            <attribute default="${includes}" name="includes"/>
 256.264 -            <attribute default="${excludes}" name="excludes"/>
 256.265 -            <attribute default="${javac.debug}" name="debug"/>
 256.266 -            <attribute default="${empty.dir}" name="sourcepath"/>
 256.267 -            <attribute default="${empty.dir}" name="gensrcdir"/>
 256.268 -            <element name="customize" optional="true"/>
 256.269 -            <sequential>
 256.270 -                <property location="${build.dir}/empty" name="empty.dir"/>
 256.271 -                <mkdir dir="${empty.dir}"/>
 256.272 -                <mkdir dir="@{apgeneratedsrcdir}"/>
 256.273 -                <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}">
 256.274 -                    <src>
 256.275 -                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
 256.276 -                            <include name="*"/>
 256.277 -                        </dirset>
 256.278 -                    </src>
 256.279 -                    <classpath>
 256.280 -                        <path path="@{classpath}"/>
 256.281 -                    </classpath>
 256.282 -                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
 256.283 -                    <compilerarg line="${javac.compilerargs}"/>
 256.284 -                    <compilerarg value="-processorpath"/>
 256.285 -                    <compilerarg path="@{processorpath}"/>
 256.286 -                    <compilerarg line="${ap.processors.internal}"/>
 256.287 -                    <compilerarg value="-s"/>
 256.288 -                    <compilerarg path="@{apgeneratedsrcdir}"/>
 256.289 -                    <compilerarg line="${ap.proc.none.internal}"/>
 256.290 -                    <customize/>
 256.291 -                </javac>
 256.292 -            </sequential>
 256.293 -        </macrodef>
 256.294 -    </target>
 256.295 -    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
 256.296 -        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 256.297 -            <attribute default="${src.dir}" name="srcdir"/>
 256.298 -            <attribute default="${build.classes.dir}" name="destdir"/>
 256.299 -            <attribute default="${javac.classpath}" name="classpath"/>
 256.300 -            <attribute default="${javac.processorpath}" name="processorpath"/>
 256.301 -            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
 256.302 -            <attribute default="${includes}" name="includes"/>
 256.303 -            <attribute default="${excludes}" name="excludes"/>
 256.304 -            <attribute default="${javac.debug}" name="debug"/>
 256.305 -            <attribute default="${empty.dir}" name="sourcepath"/>
 256.306 -            <attribute default="${empty.dir}" name="gensrcdir"/>
 256.307 -            <element name="customize" optional="true"/>
 256.308 -            <sequential>
 256.309 -                <property location="${build.dir}/empty" name="empty.dir"/>
 256.310 -                <mkdir dir="${empty.dir}"/>
 256.311 -                <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}">
 256.312 -                    <src>
 256.313 -                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
 256.314 -                            <include name="*"/>
 256.315 -                        </dirset>
 256.316 -                    </src>
 256.317 -                    <classpath>
 256.318 -                        <path path="@{classpath}"/>
 256.319 -                    </classpath>
 256.320 -                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
 256.321 -                    <compilerarg line="${javac.compilerargs}"/>
 256.322 -                    <customize/>
 256.323 -                </javac>
 256.324 -            </sequential>
 256.325 -        </macrodef>
 256.326 -    </target>
 256.327 -    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
 256.328 -        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
 256.329 -            <attribute default="${src.dir}" name="srcdir"/>
 256.330 -            <attribute default="${build.classes.dir}" name="destdir"/>
 256.331 -            <attribute default="${javac.classpath}" name="classpath"/>
 256.332 -            <sequential>
 256.333 -                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
 256.334 -                    <classpath>
 256.335 -                        <path path="@{classpath}"/>
 256.336 -                    </classpath>
 256.337 -                </depend>
 256.338 -            </sequential>
 256.339 -        </macrodef>
 256.340 -        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
 256.341 -            <attribute default="${build.classes.dir}" name="destdir"/>
 256.342 -            <sequential>
 256.343 -                <fail unless="javac.includes">Must set javac.includes</fail>
 256.344 -                <pathconvert pathsep="," property="javac.includes.binary">
 256.345 -                    <path>
 256.346 -                        <filelist dir="@{destdir}" files="${javac.includes}"/>
 256.347 -                    </path>
 256.348 -                    <globmapper from="*.java" to="*.class"/>
 256.349 -                </pathconvert>
 256.350 -                <delete>
 256.351 -                    <files includes="${javac.includes.binary}"/>
 256.352 -                </delete>
 256.353 -            </sequential>
 256.354 -        </macrodef>
 256.355 -    </target>
 256.356 -    <target name="-init-macrodef-junit">
 256.357 -        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 256.358 -            <attribute default="${includes}" name="includes"/>
 256.359 -            <attribute default="${excludes}" name="excludes"/>
 256.360 -            <attribute default="**" name="testincludes"/>
 256.361 -            <sequential>
 256.362 -                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
 256.363 -                    <batchtest todir="${build.test.results.dir}">
 256.364 -                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
 256.365 -                            <filename name="@{testincludes}"/>
 256.366 -                        </fileset>
 256.367 -                    </batchtest>
 256.368 -                    <classpath>
 256.369 -                        <path path="${run.test.classpath}"/>
 256.370 -                    </classpath>
 256.371 -                    <syspropertyset>
 256.372 -                        <propertyref prefix="test-sys-prop."/>
 256.373 -                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
 256.374 -                    </syspropertyset>
 256.375 -                    <formatter type="brief" usefile="false"/>
 256.376 -                    <formatter type="xml"/>
 256.377 -                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
 256.378 -                    <jvmarg line="${run.jvmargs}"/>
 256.379 -                </junit>
 256.380 -            </sequential>
 256.381 -        </macrodef>
 256.382 -    </target>
 256.383 -    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
 256.384 -        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
 256.385 -            <attribute default="${main.class}" name="name"/>
 256.386 -            <attribute default="${debug.classpath}" name="classpath"/>
 256.387 -            <attribute default="" name="stopclassname"/>
 256.388 -            <sequential>
 256.389 -                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
 256.390 -                    <classpath>
 256.391 -                        <path path="@{classpath}"/>
 256.392 -                    </classpath>
 256.393 -                </nbjpdastart>
 256.394 -            </sequential>
 256.395 -        </macrodef>
 256.396 -        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
 256.397 -            <attribute default="${build.classes.dir}" name="dir"/>
 256.398 -            <sequential>
 256.399 -                <nbjpdareload>
 256.400 -                    <fileset dir="@{dir}" includes="${fix.classes}">
 256.401 -                        <include name="${fix.includes}*.class"/>
 256.402 -                    </fileset>
 256.403 -                </nbjpdareload>
 256.404 -            </sequential>
 256.405 -        </macrodef>
 256.406 -    </target>
 256.407 -    <target name="-init-debug-args">
 256.408 -        <property name="version-output" value="java version &quot;${ant.java.version}"/>
 256.409 -        <condition property="have-jdk-older-than-1.4">
 256.410 -            <or>
 256.411 -                <contains string="${version-output}" substring="java version &quot;1.0"/>
 256.412 -                <contains string="${version-output}" substring="java version &quot;1.1"/>
 256.413 -                <contains string="${version-output}" substring="java version &quot;1.2"/>
 256.414 -                <contains string="${version-output}" substring="java version &quot;1.3"/>
 256.415 -            </or>
 256.416 -        </condition>
 256.417 -        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
 256.418 -            <istrue value="${have-jdk-older-than-1.4}"/>
 256.419 -        </condition>
 256.420 -        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
 256.421 -            <os family="windows"/>
 256.422 -        </condition>
 256.423 -        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
 256.424 -            <isset property="debug.transport"/>
 256.425 -        </condition>
 256.426 -    </target>
 256.427 -    <target depends="-init-debug-args" name="-init-macrodef-debug">
 256.428 -        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
 256.429 -            <attribute default="${main.class}" name="classname"/>
 256.430 -            <attribute default="${debug.classpath}" name="classpath"/>
 256.431 -            <element name="customize" optional="true"/>
 256.432 -            <sequential>
 256.433 -                <java classname="@{classname}" dir="${work.dir}" fork="true">
 256.434 -                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
 256.435 -                    <jvmarg line="${debug-args-line}"/>
 256.436 -                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
 256.437 -                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
 256.438 -                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
 256.439 -                    <jvmarg line="${run.jvmargs}"/>
 256.440 -                    <classpath>
 256.441 -                        <path path="@{classpath}"/>
 256.442 -                    </classpath>
 256.443 -                    <syspropertyset>
 256.444 -                        <propertyref prefix="run-sys-prop."/>
 256.445 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 256.446 -                    </syspropertyset>
 256.447 -                    <customize/>
 256.448 -                </java>
 256.449 -            </sequential>
 256.450 -        </macrodef>
 256.451 -    </target>
 256.452 -    <target name="-init-macrodef-java">
 256.453 -        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
 256.454 -            <attribute default="${main.class}" name="classname"/>
 256.455 -            <attribute default="${run.classpath}" name="classpath"/>
 256.456 -            <element name="customize" optional="true"/>
 256.457 -            <sequential>
 256.458 -                <java classname="@{classname}" dir="${work.dir}" fork="true">
 256.459 -                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
 256.460 -                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
 256.461 -                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
 256.462 -                    <jvmarg line="${run.jvmargs}"/>
 256.463 -                    <classpath>
 256.464 -                        <path path="@{classpath}"/>
 256.465 -                    </classpath>
 256.466 -                    <syspropertyset>
 256.467 -                        <propertyref prefix="run-sys-prop."/>
 256.468 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 256.469 -                    </syspropertyset>
 256.470 -                    <customize/>
 256.471 -                </java>
 256.472 -            </sequential>
 256.473 -        </macrodef>
 256.474 -    </target>
 256.475 -    <target name="-init-presetdef-jar">
 256.476 -        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
 256.477 -            <jar compress="${jar.compress}" jarfile="${dist.jar}">
 256.478 -                <j2seproject1:fileset dir="${build.classes.dir}"/>
 256.479 -            </jar>
 256.480 -        </presetdef>
 256.481 -    </target>
 256.482 -    <target name="-init-ap-cmdline-properties">
 256.483 -        <property name="annotation.processing.enabled" value="true"/>
 256.484 -        <property name="annotation.processing.processors.list" value=""/>
 256.485 -        <property name="annotation.processing.run.all.processors" value="true"/>
 256.486 -        <property name="javac.processorpath" value="${javac.classpath}"/>
 256.487 -        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
 256.488 -        <condition property="ap.supported.internal" value="true">
 256.489 -            <not>
 256.490 -                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
 256.491 -            </not>
 256.492 -        </condition>
 256.493 -    </target>
 256.494 -    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
 256.495 -        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
 256.496 -            <isfalse value="${annotation.processing.run.all.processors}"/>
 256.497 -        </condition>
 256.498 -        <condition else="" property="ap.proc.none.internal" value="-proc:none">
 256.499 -            <isfalse value="${annotation.processing.enabled}"/>
 256.500 -        </condition>
 256.501 -    </target>
 256.502 -    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
 256.503 -        <property name="ap.cmd.line.internal" value=""/>
 256.504 -    </target>
 256.505 -    <target depends="-pre-init,-init-private,-init-libraries,-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,-init-ap-cmdline" name="init"/>
 256.506 -    <!--
 256.507 -                ===================
 256.508 -                COMPILATION SECTION
 256.509 -                ===================
 256.510 -            -->
 256.511 -    <target name="-deps-jar-init" unless="built-jar.properties">
 256.512 -        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
 256.513 -        <delete file="${built-jar.properties}" quiet="true"/>
 256.514 -    </target>
 256.515 -    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
 256.516 -        <echo level="warn" message="Cycle detected: indexer was already built"/>
 256.517 -    </target>
 256.518 -    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
 256.519 -        <mkdir dir="${build.dir}"/>
 256.520 -        <touch file="${built-jar.properties}" verbose="false"/>
 256.521 -        <property file="${built-jar.properties}" prefix="already.built.jar."/>
 256.522 -        <antcall target="-warn-already-built-jar"/>
 256.523 -        <propertyfile file="${built-jar.properties}">
 256.524 -            <entry key="${basedir}" value=""/>
 256.525 -        </propertyfile>
 256.526 -        <antcall target="-maybe-call-dep">
 256.527 -            <param name="call.built.properties" value="${built-jar.properties}"/>
 256.528 -            <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
 256.529 -            <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
 256.530 -            <param name="call.target" value="netbeans"/>
 256.531 -            <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
 256.532 -        </antcall>
 256.533 -    </target>
 256.534 -    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
 256.535 -    <target depends="init" name="-check-automatic-build">
 256.536 -        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
 256.537 -    </target>
 256.538 -    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
 256.539 -        <antcall target="clean"/>
 256.540 -    </target>
 256.541 -    <target depends="init,deps-jar" name="-pre-pre-compile">
 256.542 -        <mkdir dir="${build.classes.dir}"/>
 256.543 -    </target>
 256.544 -    <target name="-pre-compile">
 256.545 -        <!-- Empty placeholder for easier customization. -->
 256.546 -        <!-- You can override this target in the ../build.xml file. -->
 256.547 -    </target>
 256.548 -    <target if="do.depend.true" name="-compile-depend">
 256.549 -        <pathconvert property="build.generated.subdirs">
 256.550 -            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
 256.551 -                <include name="*"/>
 256.552 -            </dirset>
 256.553 -        </pathconvert>
 256.554 -        <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
 256.555 -    </target>
 256.556 -    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
 256.557 -        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
 256.558 -        <copy todir="${build.classes.dir}">
 256.559 -            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 256.560 -        </copy>
 256.561 -    </target>
 256.562 -    <target name="-post-compile">
 256.563 -        <!-- Empty placeholder for easier customization. -->
 256.564 -        <!-- You can override this target in the ../build.xml file. -->
 256.565 -    </target>
 256.566 -    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
 256.567 -    <target name="-pre-compile-single">
 256.568 -        <!-- Empty placeholder for easier customization. -->
 256.569 -        <!-- You can override this target in the ../build.xml file. -->
 256.570 -    </target>
 256.571 -    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
 256.572 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 256.573 -        <j2seproject3:force-recompile/>
 256.574 -        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
 256.575 -    </target>
 256.576 -    <target name="-post-compile-single">
 256.577 -        <!-- Empty placeholder for easier customization. -->
 256.578 -        <!-- You can override this target in the ../build.xml file. -->
 256.579 -    </target>
 256.580 -    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
 256.581 -    <!--
 256.582 -                ====================
 256.583 -                JAR BUILDING SECTION
 256.584 -                ====================
 256.585 -            -->
 256.586 -    <target depends="init" name="-pre-pre-jar">
 256.587 -        <dirname file="${dist.jar}" property="dist.jar.dir"/>
 256.588 -        <mkdir dir="${dist.jar.dir}"/>
 256.589 -    </target>
 256.590 -    <target name="-pre-jar">
 256.591 -        <!-- Empty placeholder for easier customization. -->
 256.592 -        <!-- You can override this target in the ../build.xml file. -->
 256.593 -    </target>
 256.594 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
 256.595 -        <j2seproject1:jar/>
 256.596 -    </target>
 256.597 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
 256.598 -        <j2seproject1:jar manifest="${manifest.file}"/>
 256.599 -    </target>
 256.600 -    <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">
 256.601 -        <j2seproject1:jar manifest="${manifest.file}">
 256.602 -            <j2seproject1:manifest>
 256.603 -                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
 256.604 -            </j2seproject1:manifest>
 256.605 -        </j2seproject1:jar>
 256.606 -        <echo>To run this application from the command line without Ant, try:</echo>
 256.607 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 256.608 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
 256.609 -        <pathconvert property="run.classpath.with.dist.jar">
 256.610 -            <path path="${run.classpath}"/>
 256.611 -            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 256.612 -        </pathconvert>
 256.613 -        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 256.614 -    </target>
 256.615 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
 256.616 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 256.617 -        <pathconvert property="run.classpath.without.build.classes.dir">
 256.618 -            <path path="${run.classpath}"/>
 256.619 -            <map from="${build.classes.dir.resolved}" to=""/>
 256.620 -        </pathconvert>
 256.621 -        <pathconvert pathsep=" " property="jar.classpath">
 256.622 -            <path path="${run.classpath.without.build.classes.dir}"/>
 256.623 -            <chainedmapper>
 256.624 -                <flattenmapper/>
 256.625 -                <globmapper from="*" to="lib/*"/>
 256.626 -            </chainedmapper>
 256.627 -        </pathconvert>
 256.628 -        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 256.629 -        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 256.630 -            <fileset dir="${build.classes.dir}"/>
 256.631 -            <manifest>
 256.632 -                <attribute name="Main-Class" value="${main.class}"/>
 256.633 -                <attribute name="Class-Path" value="${jar.classpath}"/>
 256.634 -            </manifest>
 256.635 -        </copylibs>
 256.636 -        <echo>To run this application from the command line without Ant, try:</echo>
 256.637 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
 256.638 -        <echo>java -jar "${dist.jar.resolved}"</echo>
 256.639 -    </target>
 256.640 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
 256.641 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 256.642 -        <pathconvert property="run.classpath.without.build.classes.dir">
 256.643 -            <path path="${run.classpath}"/>
 256.644 -            <map from="${build.classes.dir.resolved}" to=""/>
 256.645 -        </pathconvert>
 256.646 -        <pathconvert pathsep=" " property="jar.classpath">
 256.647 -            <path path="${run.classpath.without.build.classes.dir}"/>
 256.648 -            <chainedmapper>
 256.649 -                <flattenmapper/>
 256.650 -                <globmapper from="*" to="lib/*"/>
 256.651 -            </chainedmapper>
 256.652 -        </pathconvert>
 256.653 -        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 256.654 -        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 256.655 -            <fileset dir="${build.classes.dir}"/>
 256.656 -            <manifest>
 256.657 -                <attribute name="Class-Path" value="${jar.classpath}"/>
 256.658 -            </manifest>
 256.659 -        </copylibs>
 256.660 -    </target>
 256.661 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
 256.662 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 256.663 -        <pathconvert property="run.classpath.without.build.classes.dir">
 256.664 -            <path path="${run.classpath}"/>
 256.665 -            <map from="${build.classes.dir.resolved}" to=""/>
 256.666 -        </pathconvert>
 256.667 -        <pathconvert pathsep=" " property="jar.classpath">
 256.668 -            <path path="${run.classpath.without.build.classes.dir}"/>
 256.669 -            <chainedmapper>
 256.670 -                <flattenmapper/>
 256.671 -                <globmapper from="*" to="lib/*"/>
 256.672 -            </chainedmapper>
 256.673 -        </pathconvert>
 256.674 -        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 256.675 -        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 256.676 -            <fileset dir="${build.classes.dir}"/>
 256.677 -            <manifest>
 256.678 -                <attribute name="Class-Path" value="${jar.classpath}"/>
 256.679 -            </manifest>
 256.680 -        </copylibs>
 256.681 -    </target>
 256.682 -    <target name="-post-jar">
 256.683 -        <!-- Empty placeholder for easier customization. -->
 256.684 -        <!-- You can override this target in the ../build.xml file. -->
 256.685 -    </target>
 256.686 -    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
 256.687 -    <!--
 256.688 -                =================
 256.689 -                EXECUTION SECTION
 256.690 -                =================
 256.691 -            -->
 256.692 -    <target depends="init,compile" description="Run a main class." name="run">
 256.693 -        <j2seproject1:java>
 256.694 -            <customize>
 256.695 -                <arg line="${application.args}"/>
 256.696 -            </customize>
 256.697 -        </j2seproject1:java>
 256.698 -    </target>
 256.699 -    <target name="-do-not-recompile">
 256.700 -        <property name="javac.includes.binary" value=""/>
 256.701 -    </target>
 256.702 -    <target depends="init,compile-single" name="run-single">
 256.703 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 256.704 -        <j2seproject1:java classname="${run.class}"/>
 256.705 -    </target>
 256.706 -    <target depends="init,compile-test-single" name="run-test-with-main">
 256.707 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 256.708 -        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
 256.709 -    </target>
 256.710 -    <!--
 256.711 -                =================
 256.712 -                DEBUGGING SECTION
 256.713 -                =================
 256.714 -            -->
 256.715 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
 256.716 -        <j2seproject1:nbjpdastart name="${debug.class}"/>
 256.717 -    </target>
 256.718 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
 256.719 -        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
 256.720 -    </target>
 256.721 -    <target depends="init,compile" name="-debug-start-debuggee">
 256.722 -        <j2seproject3:debug>
 256.723 -            <customize>
 256.724 -                <arg line="${application.args}"/>
 256.725 -            </customize>
 256.726 -        </j2seproject3:debug>
 256.727 -    </target>
 256.728 -    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
 256.729 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
 256.730 -        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 256.731 -    </target>
 256.732 -    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
 256.733 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
 256.734 -        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 256.735 -        <j2seproject3:debug classname="${debug.class}"/>
 256.736 -    </target>
 256.737 -    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
 256.738 -    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
 256.739 -        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 256.740 -        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
 256.741 -    </target>
 256.742 -    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
 256.743 -    <target depends="init" name="-pre-debug-fix">
 256.744 -        <fail unless="fix.includes">Must set fix.includes</fail>
 256.745 -        <property name="javac.includes" value="${fix.includes}.java"/>
 256.746 -    </target>
 256.747 -    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
 256.748 -        <j2seproject1:nbjpdareload/>
 256.749 -    </target>
 256.750 -    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
 256.751 -    <!--
 256.752 -                ===============
 256.753 -                JAVADOC SECTION
 256.754 -                ===============
 256.755 -            -->
 256.756 -    <target depends="init" name="-javadoc-build">
 256.757 -        <mkdir dir="${dist.javadoc.dir}"/>
 256.758 -        <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}">
 256.759 -            <classpath>
 256.760 -                <path path="${javac.classpath}"/>
 256.761 -            </classpath>
 256.762 -            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
 256.763 -                <filename name="**/*.java"/>
 256.764 -            </fileset>
 256.765 -            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
 256.766 -                <include name="**/*.java"/>
 256.767 -            </fileset>
 256.768 -        </javadoc>
 256.769 -    </target>
 256.770 -    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
 256.771 -        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 256.772 -    </target>
 256.773 -    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
 256.774 -    <!--
 256.775 -                =========================
 256.776 -                JUNIT COMPILATION SECTION
 256.777 -                =========================
 256.778 -            -->
 256.779 -    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
 256.780 -        <mkdir dir="${build.test.classes.dir}"/>
 256.781 -    </target>
 256.782 -    <target name="-pre-compile-test">
 256.783 -        <!-- Empty placeholder for easier customization. -->
 256.784 -        <!-- You can override this target in the ../build.xml file. -->
 256.785 -    </target>
 256.786 -    <target if="do.depend.true" name="-compile-test-depend">
 256.787 -        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 256.788 -    </target>
 256.789 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
 256.790 -        <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}"/>
 256.791 -        <copy todir="${build.test.classes.dir}">
 256.792 -            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 256.793 -        </copy>
 256.794 -    </target>
 256.795 -    <target name="-post-compile-test">
 256.796 -        <!-- Empty placeholder for easier customization. -->
 256.797 -        <!-- You can override this target in the ../build.xml file. -->
 256.798 -    </target>
 256.799 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
 256.800 -    <target name="-pre-compile-test-single">
 256.801 -        <!-- Empty placeholder for easier customization. -->
 256.802 -        <!-- You can override this target in the ../build.xml file. -->
 256.803 -    </target>
 256.804 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
 256.805 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 256.806 -        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
 256.807 -        <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}"/>
 256.808 -        <copy todir="${build.test.classes.dir}">
 256.809 -            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 256.810 -        </copy>
 256.811 -    </target>
 256.812 -    <target name="-post-compile-test-single">
 256.813 -        <!-- Empty placeholder for easier customization. -->
 256.814 -        <!-- You can override this target in the ../build.xml file. -->
 256.815 -    </target>
 256.816 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
 256.817 -    <!--
 256.818 -                =======================
 256.819 -                JUNIT EXECUTION SECTION
 256.820 -                =======================
 256.821 -            -->
 256.822 -    <target depends="init" if="have.tests" name="-pre-test-run">
 256.823 -        <mkdir dir="${build.test.results.dir}"/>
 256.824 -    </target>
 256.825 -    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
 256.826 -        <j2seproject3:junit testincludes="**/*Test.java"/>
 256.827 -    </target>
 256.828 -    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
 256.829 -        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
 256.830 -    </target>
 256.831 -    <target depends="init" if="have.tests" name="test-report"/>
 256.832 -    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
 256.833 -    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
 256.834 -    <target depends="init" if="have.tests" name="-pre-test-run-single">
 256.835 -        <mkdir dir="${build.test.results.dir}"/>
 256.836 -    </target>
 256.837 -    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
 256.838 -        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 256.839 -        <j2seproject3:junit excludes="" includes="${test.includes}"/>
 256.840 -    </target>
 256.841 -    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
 256.842 -        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
 256.843 -    </target>
 256.844 -    <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"/>
 256.845 -    <!--
 256.846 -                =======================
 256.847 -                JUNIT DEBUGGING SECTION
 256.848 -                =======================
 256.849 -            -->
 256.850 -    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
 256.851 -        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 256.852 -        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
 256.853 -        <delete file="${test.report.file}"/>
 256.854 -        <mkdir dir="${build.test.results.dir}"/>
 256.855 -        <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}">
 256.856 -            <customize>
 256.857 -                <syspropertyset>
 256.858 -                    <propertyref prefix="test-sys-prop."/>
 256.859 -                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
 256.860 -                </syspropertyset>
 256.861 -                <arg value="${test.class}"/>
 256.862 -                <arg value="showoutput=true"/>
 256.863 -                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
 256.864 -                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
 256.865 -            </customize>
 256.866 -        </j2seproject3:debug>
 256.867 -    </target>
 256.868 -    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
 256.869 -        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
 256.870 -    </target>
 256.871 -    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
 256.872 -    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
 256.873 -        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 256.874 -    </target>
 256.875 -    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
 256.876 -    <!--
 256.877 -                =========================
 256.878 -                APPLET EXECUTION SECTION
 256.879 -                =========================
 256.880 -            -->
 256.881 -    <target depends="init,compile-single" name="run-applet">
 256.882 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 256.883 -        <j2seproject1:java classname="sun.applet.AppletViewer">
 256.884 -            <customize>
 256.885 -                <arg value="${applet.url}"/>
 256.886 -            </customize>
 256.887 -        </j2seproject1:java>
 256.888 -    </target>
 256.889 -    <!--
 256.890 -                =========================
 256.891 -                APPLET DEBUGGING  SECTION
 256.892 -                =========================
 256.893 -            -->
 256.894 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
 256.895 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 256.896 -        <j2seproject3:debug classname="sun.applet.AppletViewer">
 256.897 -            <customize>
 256.898 -                <arg value="${applet.url}"/>
 256.899 -            </customize>
 256.900 -        </j2seproject3:debug>
 256.901 -    </target>
 256.902 -    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
 256.903 -    <!--
 256.904 -                ===============
 256.905 -                CLEANUP SECTION
 256.906 -                ===============
 256.907 -            -->
 256.908 -    <target name="-deps-clean-init" unless="built-clean.properties">
 256.909 -        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
 256.910 -        <delete file="${built-clean.properties}" quiet="true"/>
 256.911 -    </target>
 256.912 -    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
 256.913 -        <echo level="warn" message="Cycle detected: indexer was already built"/>
 256.914 -    </target>
 256.915 -    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
 256.916 -        <mkdir dir="${build.dir}"/>
 256.917 -        <touch file="${built-clean.properties}" verbose="false"/>
 256.918 -        <property file="${built-clean.properties}" prefix="already.built.clean."/>
 256.919 -        <antcall target="-warn-already-built-clean"/>
 256.920 -        <propertyfile file="${built-clean.properties}">
 256.921 -            <entry key="${basedir}" value=""/>
 256.922 -        </propertyfile>
 256.923 -        <antcall target="-maybe-call-dep">
 256.924 -            <param name="call.built.properties" value="${built-clean.properties}"/>
 256.925 -            <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
 256.926 -            <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
 256.927 -            <param name="call.target" value="clean"/>
 256.928 -            <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
 256.929 -        </antcall>
 256.930 -    </target>
 256.931 -    <target depends="init" name="-do-clean">
 256.932 -        <delete dir="${build.dir}"/>
 256.933 -        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
 256.934 -    </target>
 256.935 -    <target name="-post-clean">
 256.936 -        <!-- Empty placeholder for easier customization. -->
 256.937 -        <!-- You can override this target in the ../build.xml file. -->
 256.938 -    </target>
 256.939 -    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
 256.940 -    <target name="-check-call-dep">
 256.941 -        <property file="${call.built.properties}" prefix="already.built."/>
 256.942 -        <condition property="should.call.dep">
 256.943 -            <not>
 256.944 -                <isset property="already.built.${call.subproject}"/>
 256.945 -            </not>
 256.946 -        </condition>
 256.947 -        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
 256.948 -        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:${toString:endorsed.classpath.path}">
 256.949 -            <length length="0" string="${endorsed.classpath}" when="greater"/>
 256.950 -        </condition>
 256.951 -    </target>
 256.952 -    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
 256.953 -        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
 256.954 -            <propertyset>
 256.955 -                <propertyref prefix="transfer."/>
 256.956 -                <mapper from="transfer.*" to="*" type="glob"/>
 256.957 -            </propertyset>
 256.958 -        </ant>
 256.959 -    </target>
 256.960 -</project>
   257.1 --- a/sandbox/old-modules/server/indexer/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
   257.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   257.3 @@ -1,49 +0,0 @@
   257.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   257.5 -#
   257.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   257.7 -#
   257.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   257.9 -# Other names may be trademarks of their respective owners.
  257.10 -#
  257.11 -# The contents of this file are subject to the terms of either the GNU
  257.12 -# General Public License Version 2 only ("GPL") or the Common
  257.13 -# Development and Distribution License("CDDL") (collectively, the
  257.14 -# "License"). You may not use this file except in compliance with the
  257.15 -# License. You can obtain a copy of the License at
  257.16 -# http://www.netbeans.org/cddl-gplv2.html
  257.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  257.18 -# specific language governing permissions and limitations under the
  257.19 -# License.  When distributing the software, include this License Header
  257.20 -# Notice in each file and include the License file at
  257.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  257.22 -# particular file as subject to the "Classpath" exception as provided
  257.23 -# by Oracle in the GPL Version 2 section of the License file that
  257.24 -# accompanied this code. If applicable, add the following below the
  257.25 -# License Header, with the fields enclosed by brackets [] replaced by
  257.26 -# your own identifying information:
  257.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  257.28 -#
  257.29 -# Contributor(s):
  257.30 -#
  257.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  257.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  257.33 -# Microsystems, Inc. All Rights Reserved.
  257.34 -#
  257.35 -# If you wish your version of this file to be governed by only the CDDL
  257.36 -# or only the GPL Version 2, indicate your decision by adding
  257.37 -# "[Contributor] elects to include this software in this distribution
  257.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  257.39 -# single choice of license, a recipient has the option to distribute
  257.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  257.41 -# to extend the choice of license to its licensees as provided above.
  257.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  257.43 -# Version 2 license, then the option applies only if the new code is
  257.44 -# made subject to such option by the copyright holder.
  257.45 -build.xml.data.CRC32=8f49f787
  257.46 -build.xml.script.CRC32=48d52495
  257.47 -build.xml.stylesheet.CRC32=958a1d3e@1.27.0.45
  257.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
  257.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
  257.50 -nbproject/build-impl.xml.data.CRC32=8f49f787
  257.51 -nbproject/build-impl.xml.script.CRC32=81f22719
  257.52 -nbproject/build-impl.xml.stylesheet.CRC32=1cdc5be9@1.35.0.45
   258.1 --- a/sandbox/old-modules/server/indexer/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
   258.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   258.3 @@ -1,136 +0,0 @@
   258.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   258.5 -#
   258.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   258.7 -#
   258.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   258.9 -# Other names may be trademarks of their respective owners.
  258.10 -#
  258.11 -# The contents of this file are subject to the terms of either the GNU
  258.12 -# General Public License Version 2 only ("GPL") or the Common
  258.13 -# Development and Distribution License("CDDL") (collectively, the
  258.14 -# "License"). You may not use this file except in compliance with the
  258.15 -# License. You can obtain a copy of the License at
  258.16 -# http://www.netbeans.org/cddl-gplv2.html
  258.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  258.18 -# specific language governing permissions and limitations under the
  258.19 -# License.  When distributing the software, include this License Header
  258.20 -# Notice in each file and include the License file at
  258.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  258.22 -# particular file as subject to the "Classpath" exception as provided
  258.23 -# by Oracle in the GPL Version 2 section of the License file that
  258.24 -# accompanied this code. If applicable, add the following below the
  258.25 -# License Header, with the fields enclosed by brackets [] replaced by
  258.26 -# your own identifying information:
  258.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  258.28 -#
  258.29 -# Contributor(s):
  258.30 -#
  258.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  258.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  258.33 -# Microsystems, Inc. All Rights Reserved.
  258.34 -#
  258.35 -# If you wish your version of this file to be governed by only the CDDL
  258.36 -# or only the GPL Version 2, indicate your decision by adding
  258.37 -# "[Contributor] elects to include this software in this distribution
  258.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  258.39 -# single choice of license, a recipient has the option to distribute
  258.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  258.41 -# to extend the choice of license to its licensees as provided above.
  258.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  258.43 -# Version 2 license, then the option applies only if the new code is
  258.44 -# made subject to such option by the copyright holder.
  258.45 -annotation.processing.enabled=true
  258.46 -annotation.processing.enabled.in.editor=false
  258.47 -annotation.processing.run.all.processors=true
  258.48 -application.title=indexer
  258.49 -application.vendor=lahvac
  258.50 -build.classes.dir=${build.dir}/classes
  258.51 -build.classes.excludes=**/*.java,**/*.form
  258.52 -# This directory is removed when the project is cleaned:
  258.53 -build.dir=build
  258.54 -build.generated.dir=${build.dir}/generated
  258.55 -build.generated.sources.dir=${build.dir}/generated-sources
  258.56 -# Only compile against the classpath explicitly listed here:
  258.57 -build.sysclasspath=ignore
  258.58 -build.test.classes.dir=${build.dir}/test/classes
  258.59 -build.test.results.dir=${build.dir}/test/results
  258.60 -# Uncomment to specify the preferred debugger connection transport:
  258.61 -#debug.transport=dt_socket
  258.62 -debug.classpath=\
  258.63 -    ${run.classpath}
  258.64 -debug.test.classpath=\
  258.65 -    ${run.test.classpath}
  258.66 -# This directory is removed when the project is cleaned:
  258.67 -dist.dir=dist
  258.68 -dist.jar=${dist.dir}/indexer.jar
  258.69 -dist.javadoc.dir=${dist.dir}/javadoc
  258.70 -endorsed.classpath=\
  258.71 -    ${libs.javac.classpath}
  258.72 -excludes=
  258.73 -file.reference.org-netbeans-modules-java-hints.jar=../lib/org-netbeans-modules-java-hints.jar
  258.74 -file.reference.org-netbeans-modules-java-source.jar=../lib/org-netbeans-modules-java-source.jar
  258.75 -file.reference.org-netbeans-spi-editor-hints.jar=../lib/org-netbeans-spi-editor-hints.jar
  258.76 -file.reference.org-openide-filesystems.jar=../lib/org-openide-filesystems.jar
  258.77 -file.reference.org-openide-util-lookup.jar=../lib/org-openide-util-lookup.jar
  258.78 -file.reference.org-openide-util.jar=../lib/org-openide-util.jar
  258.79 -file.reference.util-commons.jar-1=../../remoting/ide/api/external/util-commons.jar
  258.80 -file.reference.util-pojson.jar-1=../../remoting/ide/api/external/util-pojson.jar
  258.81 -includes=**
  258.82 -jar.compress=false
  258.83 -javac.classpath=\
  258.84 -    ${reference.org_netbeans_modules_jackpot30_api.module}:\
  258.85 -    ${libs.lucene.classpath}:\
  258.86 -    ${libs.javac.classpath}:\
  258.87 -    ${file.reference.org-netbeans-modules-java-source.jar}:\
  258.88 -    ${file.reference.org-openide-filesystems.jar}:\
  258.89 -    ${file.reference.org-openide-util.jar}:\
  258.90 -    ${file.reference.org-openide-util-lookup.jar}:\
  258.91 -    ${file.reference.org-netbeans-spi-editor-hints.jar}:\
  258.92 -    ${file.reference.org-netbeans-modules-java-hints.jar}:\
  258.93 -    ${file.reference.util-commons.jar-1}:\
  258.94 -    ${file.reference.util-pojson.jar-1}
  258.95 -# Space-separated list of extra javac options
  258.96 -javac.compilerargs=
  258.97 -javac.deprecation=false
  258.98 -javac.processorpath=\
  258.99 -    ${javac.classpath}
 258.100 -javac.source=1.5
 258.101 -javac.target=1.5
 258.102 -javac.test.classpath=\
 258.103 -    ${javac.classpath}:\
 258.104 -    ${build.classes.dir}:\
 258.105 -    ${libs.junit_4.classpath}
 258.106 -javadoc.additionalparam=
 258.107 -javadoc.author=false
 258.108 -javadoc.encoding=${source.encoding}
 258.109 -javadoc.noindex=false
 258.110 -javadoc.nonavbar=false
 258.111 -javadoc.notree=false
 258.112 -javadoc.private=false
 258.113 -javadoc.splitindex=true
 258.114 -javadoc.use=true
 258.115 -javadoc.version=false
 258.116 -javadoc.windowtitle=
 258.117 -jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
 258.118 -main.class=org.netbeans.modules.jackpot30.server.indexer.Index
 258.119 -manifest.file=manifest.mf
 258.120 -meta.inf.dir=${src.dir}/META-INF
 258.121 -mkdist.disabled=false
 258.122 -platform.active=default_platform
 258.123 -project.org_netbeans_modules_jackpot30_api=../../api
 258.124 -reference.org_netbeans_modules_jackpot30_api.module=${project.org_netbeans_modules_jackpot30_api}/../build/cluster/modules/org-netbeans-modules-jackpot30-api.jar
 258.125 -run.classpath=\
 258.126 -    ${javac.classpath}:\
 258.127 -    ${build.classes.dir}
 258.128 -# Space-separated list of JVM arguments used when running the project
 258.129 -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
 258.130 -# or test-sys-prop.name=value to set system properties for unit tests):
 258.131 -run.jvmargs=
 258.132 -run.test.classpath=\
 258.133 -    ${javac.test.classpath}:\
 258.134 -    ${build.test.classes.dir}
 258.135 -source.encoding=UTF-8
 258.136 -src.dir=src
 258.137 -test.src.dir=test
 258.138 -
 258.139 -hudson.compiler.dir=../hudson/data/compiler
   259.1 --- a/sandbox/old-modules/server/indexer/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
   259.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   259.3 @@ -1,71 +0,0 @@
   259.4 -<?xml version="1.0" encoding="UTF-8"?>
   259.5 -<!--
   259.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   259.7 -
   259.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   259.9 -
  259.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  259.11 -Other names may be trademarks of their respective owners.
  259.12 -
  259.13 -The contents of this file are subject to the terms of either the GNU
  259.14 -General Public License Version 2 only ("GPL") or the Common
  259.15 -Development and Distribution License("CDDL") (collectively, the
  259.16 -"License"). You may not use this file except in compliance with the
  259.17 -License. You can obtain a copy of the License at
  259.18 -http://www.netbeans.org/cddl-gplv2.html
  259.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  259.20 -specific language governing permissions and limitations under the
  259.21 -License.  When distributing the software, include this License Header
  259.22 -Notice in each file and include the License file at
  259.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  259.24 -particular file as subject to the "Classpath" exception as provided
  259.25 -by Oracle in the GPL Version 2 section of the License file that
  259.26 -accompanied this code. If applicable, add the following below the
  259.27 -License Header, with the fields enclosed by brackets [] replaced by
  259.28 -your own identifying information:
  259.29 -"Portions Copyrighted [year] [name of copyright owner]"
  259.30 -
  259.31 -Contributor(s):
  259.32 -
  259.33 -The Original Software is NetBeans. The Initial Developer of the Original
  259.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  259.35 -Microsystems, Inc. All Rights Reserved.
  259.36 -
  259.37 -If you wish your version of this file to be governed by only the CDDL
  259.38 -or only the GPL Version 2, indicate your decision by adding
  259.39 -"[Contributor] elects to include this software in this distribution
  259.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  259.41 -single choice of license, a recipient has the option to distribute
  259.42 -your version of this file under either the CDDL, the GPL Version 2 or
  259.43 -to extend the choice of license to its licensees as provided above.
  259.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  259.45 -Version 2 license, then the option applies only if the new code is
  259.46 -made subject to such option by the copyright holder.
  259.47 --->
  259.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
  259.49 -    <type>org.netbeans.modules.java.j2seproject</type>
  259.50 -    <configuration>
  259.51 -        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
  259.52 -            <name>indexer</name>
  259.53 -            <source-roots>
  259.54 -                <root id="src.dir"/>
  259.55 -            </source-roots>
  259.56 -            <test-roots>
  259.57 -                <root id="test.src.dir"/>
  259.58 -            </test-roots>
  259.59 -        </data>
  259.60 -        <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
  259.61 -            <definitions>../lib/nblibraries.properties</definitions>
  259.62 -        </libraries>
  259.63 -        <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
  259.64 -            <reference>
  259.65 -                <foreign-project>org_netbeans_modules_jackpot30_api</foreign-project>
  259.66 -                <artifact-type>jar</artifact-type>
  259.67 -                <script>build.xml</script>
  259.68 -                <target>netbeans</target>
  259.69 -                <clean-target>clean</clean-target>
  259.70 -                <id>module</id>
  259.71 -            </reference>
  259.72 -        </references>
  259.73 -    </configuration>
  259.74 -</project>
   260.1 --- a/sandbox/old-modules/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/Index.java	Sun Jan 08 20:10:08 2017 +0100
   260.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   260.3 @@ -1,106 +0,0 @@
   260.4 -/*
   260.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   260.6 - *
   260.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
   260.8 - *
   260.9 - * The contents of this file are subject to the terms of either the GNU
  260.10 - * General Public License Version 2 only ("GPL") or the Common
  260.11 - * Development and Distribution License("CDDL") (collectively, the
  260.12 - * "License"). You may not use this file except in compliance with the
  260.13 - * License. You can obtain a copy of the License at
  260.14 - * http://www.netbeans.org/cddl-gplv2.html
  260.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  260.16 - * specific language governing permissions and limitations under the
  260.17 - * License.  When distributing the software, include this License Header
  260.18 - * Notice in each file and include the License file at
  260.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  260.20 - * particular file as subject to the "Classpath" exception as provided
  260.21 - * by Sun in the GPL Version 2 section of the License file that
  260.22 - * accompanied this code. If applicable, add the following below the
  260.23 - * License Header, with the fields enclosed by brackets [] replaced by
  260.24 - * your own identifying information:
  260.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  260.26 - *
  260.27 - * If you wish your version of this file to be governed by only the CDDL
  260.28 - * or only the GPL Version 2, indicate your decision by adding
  260.29 - * "[Contributor] elects to include this software in this distribution
  260.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  260.31 - * single choice of license, a recipient has the option to distribute
  260.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  260.33 - * to extend the choice of license to its licensees as provided above.
  260.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  260.35 - * Version 2 license, then the option applies only if the new code is
  260.36 - * made subject to such option by the copyright holder.
  260.37 - *
  260.38 - * Contributor(s):
  260.39 - *
  260.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  260.41 - */
  260.42 -
  260.43 -package org.netbeans.modules.jackpot30.server.indexer;
  260.44 -
  260.45 -import java.io.File;
  260.46 -import java.io.IOException;
  260.47 -import java.util.ArrayList;
  260.48 -import java.util.Arrays;
  260.49 -import java.util.List;
  260.50 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
  260.51 -import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
  260.52 -
  260.53 -/**
  260.54 - *
  260.55 - * @author lahvac
  260.56 - */
  260.57 -public class Index {
  260.58 -
  260.59 -    static final String PARAM_CONSTRUCT_DUPLICATES_INDEX = "-construct-duplicates-index";
  260.60 -    static final String PARAM_STORE_SOURCES = "-store-sources";
  260.61 -    
  260.62 -    /**
  260.63 -     * @param args the command line arguments
  260.64 -     */
  260.65 -    public static void main(String[] args) throws IOException {
  260.66 -        new Index().index(args);
  260.67 -    }
  260.68 -
  260.69 -    void index(String[] args) throws IOException {
  260.70 -        List<String> argsList = new ArrayList<String>(Arrays.asList(args));
  260.71 -        boolean constructDuplicatesIndex = !argsList.isEmpty() && PARAM_CONSTRUCT_DUPLICATES_INDEX.equals(argsList.get(0));
  260.72 -
  260.73 -        if (constructDuplicatesIndex) argsList.remove(0);
  260.74 -
  260.75 -        boolean storeSources = !argsList.isEmpty() && PARAM_STORE_SOURCES.equals(argsList.get(0));
  260.76 -
  260.77 -        if (storeSources) argsList.remove(0);
  260.78 -        
  260.79 -        String modified = null;
  260.80 -        String removed  = null;
  260.81 -
  260.82 -        if (argsList.size() != 2 && argsList.size() != 4) {
  260.83 -            printHelp();
  260.84 -            return ;
  260.85 -        }
  260.86 -
  260.87 -        if (argsList.size() == 4) {
  260.88 -            modified = argsList.get(2);
  260.89 -            removed = argsList.get(3);
  260.90 -        }
  260.91 -
  260.92 -        long startTime = System.currentTimeMillis();
  260.93 -
  260.94 -        Cache.setStandaloneCacheRoot(new File(argsList.get(1)));
  260.95 -        invokeIndexer(new File(argsList.get(0)), constructDuplicatesIndex, storeSources, modified, removed);
  260.96 -
  260.97 -        long endTime = System.currentTimeMillis();
  260.98 -
  260.99 -        System.out.println("indexing took: " + Utilities.toHumanReadableTime(endTime - startTime));
 260.100 -    }
 260.101 -
 260.102 -    protected void invokeIndexer(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
 260.103 -        StandaloneIndexer.index(root, duplicatesIndex, storeSources, modified, removed);
 260.104 -    }
 260.105 -
 260.106 -    protected void printHelp() {
 260.107 -        System.err.println("Usage: java -jar " + Index.class.getProtectionDomain().getCodeSource().getLocation().getPath() + " [" + PARAM_CONSTRUCT_DUPLICATES_INDEX + "] [" + PARAM_STORE_SOURCES + "] <source-root> <cache> [<modified-files> <removed-files>]");
 260.108 -    }
 260.109 -}
   261.1 --- a/sandbox/old-modules/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/StandaloneFinder.java	Sun Jan 08 20:10:08 2017 +0100
   261.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   261.3 @@ -1,202 +0,0 @@
   261.4 -/*
   261.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   261.6 - *
   261.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
   261.8 - *
   261.9 - * The contents of this file are subject to the terms of either the GNU
  261.10 - * General Public License Version 2 only ("GPL") or the Common
  261.11 - * Development and Distribution License("CDDL") (collectively, the
  261.12 - * "License"). You may not use this file except in compliance with the
  261.13 - * License. You can obtain a copy of the License at
  261.14 - * http://www.netbeans.org/cddl-gplv2.html
  261.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  261.16 - * specific language governing permissions and limitations under the
  261.17 - * License.  When distributing the software, include this License Header
  261.18 - * Notice in each file and include the License file at
  261.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  261.20 - * particular file as subject to the "Classpath" exception as provided
  261.21 - * by Sun in the GPL Version 2 section of the License file that
  261.22 - * accompanied this code. If applicable, add the following below the
  261.23 - * License Header, with the fields enclosed by brackets [] replaced by
  261.24 - * your own identifying information:
  261.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  261.26 - *
  261.27 - * If you wish your version of this file to be governed by only the CDDL
  261.28 - * or only the GPL Version 2, indicate your decision by adding
  261.29 - * "[Contributor] elects to include this software in this distribution
  261.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  261.31 - * single choice of license, a recipient has the option to distribute
  261.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  261.33 - * to extend the choice of license to its licensees as provided above.
  261.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  261.35 - * Version 2 license, then the option applies only if the new code is
  261.36 - * made subject to such option by the copyright holder.
  261.37 - *
  261.38 - * Contributor(s):
  261.39 - *
  261.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  261.41 - */
  261.42 -
  261.43 -package org.netbeans.modules.jackpot30.server.indexer;
  261.44 -
  261.45 -import com.sun.source.tree.CompilationUnitTree;
  261.46 -import com.sun.source.tree.Tree;
  261.47 -import com.sun.source.util.TreePath;
  261.48 -import com.sun.source.util.Trees;
  261.49 -import com.sun.tools.javac.api.JavacTaskImpl;
  261.50 -import java.io.File;
  261.51 -import java.io.IOException;
  261.52 -import java.net.URI;
  261.53 -import java.util.Arrays;
  261.54 -import java.util.BitSet;
  261.55 -import java.util.Collection;
  261.56 -import java.util.Collections;
  261.57 -import java.util.HashMap;
  261.58 -import java.util.LinkedList;
  261.59 -import java.util.Map;
  261.60 -import javax.tools.Diagnostic;
  261.61 -import javax.tools.JavaCompiler;
  261.62 -import javax.tools.JavaFileObject;
  261.63 -import javax.tools.SimpleJavaFileObject;
  261.64 -import javax.tools.ToolProvider;
  261.65 -import org.apache.lucene.document.Document;
  261.66 -import org.apache.lucene.index.IndexReader;
  261.67 -import org.apache.lucene.index.Term;
  261.68 -import org.apache.lucene.search.Collector;
  261.69 -import org.apache.lucene.search.IndexSearcher;
  261.70 -import org.apache.lucene.search.Query;
  261.71 -import org.apache.lucene.search.Searcher;
  261.72 -import org.apache.lucene.search.TermQuery;
  261.73 -import org.apache.lucene.store.FSDirectory;
  261.74 -import org.netbeans.modules.jackpot30.impl.duplicates.indexing.DuplicatesIndex;
  261.75 -import org.netbeans.modules.jackpot30.impl.indexing.AbstractLuceneIndex.BitSetCollector;
  261.76 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
  261.77 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
  261.78 -import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
  261.79 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
  261.80 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
  261.81 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
  261.82 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.AdditionalQueryConstraints;
  261.83 -import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
  261.84 -import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
  261.85 -
  261.86 -/**
  261.87 - *
  261.88 - * @author lahvac
  261.89 - */
  261.90 -public class StandaloneFinder {
  261.91 -
  261.92 -    public static Collection<? extends String> findCandidates(File sourceRoot, String pattern) throws IOException {
  261.93 -        BulkPattern bulkPattern = preparePattern(pattern, null);
  261.94 -        
  261.95 -        return FileBasedIndex.get(sourceRoot.toURI().toURL()).findCandidates(bulkPattern);
  261.96 -    }
  261.97 -
  261.98 -    public static int[] findCandidateOccurrenceSpans(File sourceRoot, String relativePath, String pattern) throws IOException {
  261.99 -        BulkPattern bulkPattern = preparePattern(pattern, null);
 261.100 -        CharSequence source = FileBasedIndex.get(sourceRoot.toURI().toURL()).getSourceCode(relativePath).toString().replaceAll("\r\n", "\n");
 261.101 -        JavacTaskImpl jti = prepareJavacTaskImpl();
 261.102 -        CompilationUnitTree cut = jti.parse(new JFOImpl(source)).iterator().next();
 261.103 -        Collection<TreePath> paths = new LinkedList<TreePath>();
 261.104 -        
 261.105 -        for (Collection<TreePath> c : BulkSearch.getDefault().match(null, new TreePath(cut), bulkPattern).values()) {
 261.106 -            paths.addAll(c);
 261.107 -        }
 261.108 -
 261.109 -        Trees t = Trees.instance(jti);
 261.110 -        int[] result = new int[2 * paths.size()];
 261.111 -        int i = 0;
 261.112 -
 261.113 -        for (TreePath tp : paths) {
 261.114 -            result[i++] = (int) t.getSourcePositions().getStartPosition(cut, tp.getLeaf());
 261.115 -            result[i++] = (int) t.getSourcePositions().getEndPosition(cut, tp.getLeaf());
 261.116 -        }
 261.117 -
 261.118 -        return result;
 261.119 -    }
 261.120 -
 261.121 -    public static Collection<Diagnostic<? extends JavaFileObject>> parseAndReportErrors(String pattern) {
 261.122 -        Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
 261.123 -
 261.124 -        preparePattern(pattern, errors);
 261.125 -
 261.126 -        return errors;
 261.127 -    }
 261.128 -
 261.129 -    public static Map<String, Collection<? extends String>> containsHash(File sourceRoot, Iterable<? extends String> hashes) throws IOException {
 261.130 -        File cacheRoot = Cache.findCache(DuplicatesIndex.NAME, DuplicatesIndex.VERSION).findCacheRoot(sourceRoot.toURI().toURL());
 261.131 -        File dir = new File(cacheRoot, "fulltext");
 261.132 -
 261.133 -        if (dir.listFiles() != null && dir.listFiles().length > 0) {
 261.134 -            IndexReader reader = IndexReader.open(FSDirectory.open(dir), true);
 261.135 -            Map<String, Collection<? extends String>> result = new HashMap<String, Collection<? extends String>>();
 261.136 -
 261.137 -            for (String hash : hashes) {
 261.138 -                Collection<String> found = new LinkedList<String>();
 261.139 -                Query query = new TermQuery(new Term("generalized", hash));
 261.140 -                Searcher s = new IndexSearcher(reader);
 261.141 -                BitSet matchingDocuments = new BitSet(reader.maxDoc());
 261.142 -                Collector c = new BitSetCollector(matchingDocuments);
 261.143 -
 261.144 -                s.search(query, c);
 261.145 -
 261.146 -                for (int docNum = matchingDocuments.nextSetBit(0); docNum >= 0; docNum = matchingDocuments.nextSetBit(docNum + 1)) {
 261.147 -                    final Document doc = reader.document(docNum);
 261.148 -
 261.149 -                    found.add(doc.getField("path").stringValue());
 261.150 -                }
 261.151 -
 261.152 -                result.put(hash, found);
 261.153 -            }
 261.154 -            
 261.155 -            return result;
 261.156 -        }
 261.157 -
 261.158 -        return Collections.emptyMap();
 261.159 -    }
 261.160 -    
 261.161 -    private static BulkPattern preparePattern(String pattern, Collection<Diagnostic<? extends JavaFileObject>> errors) {
 261.162 -        return preparePattern(PatternConvertor.create(pattern), errors);
 261.163 -    }
 261.164 -
 261.165 -    //XXX: copied from BatchSearch, may be possible to merge once CompilationInfo is accessible in server mode
 261.166 -    private static BulkPattern preparePattern(final Iterable<? extends HintDescription> patterns, Collection<Diagnostic<? extends JavaFileObject>> errors) {
 261.167 -        JavacTaskImpl javac = prepareJavacTaskImpl();
 261.168 -        Collection<String> code = new LinkedList<String>();
 261.169 -        Collection<Tree> trees = new LinkedList<Tree>();
 261.170 -        Collection<AdditionalQueryConstraints> additionalConstraints = new LinkedList<AdditionalQueryConstraints>();
 261.171 -
 261.172 -        for (HintDescription pattern : patterns) {
 261.173 -            String textPattern = ((PatternDescription) pattern.getTrigger()).getPattern();
 261.174 -
 261.175 -            code.add(textPattern);
 261.176 -            trees.add(Utilities.parseAndAttribute(javac, textPattern, errors));
 261.177 -            additionalConstraints.add(pattern.getAdditionalConstraints());
 261.178 -        }
 261.179 -
 261.180 -        return BulkSearch.getDefault().create(code, trees, additionalConstraints);
 261.181 -    }
 261.182 -
 261.183 -    private static JavacTaskImpl prepareJavacTaskImpl() {
 261.184 -        final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
 261.185 -        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
 261.186 -
 261.187 -        assert tool != null;
 261.188 -
 261.189 -        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, Arrays.asList("-bootclasspath",  bootPath, "-Xjcov"), null, Collections.<JavaFileObject>emptyList());
 261.190 -        
 261.191 -        return ct;
 261.192 -    }
 261.193 -
 261.194 -    private static final class JFOImpl extends SimpleJavaFileObject {
 261.195 -        private final CharSequence code;
 261.196 -        public JFOImpl(CharSequence code) {
 261.197 -            super(URI.create(""), Kind.SOURCE);
 261.198 -            this.code = code;
 261.199 -        }
 261.200 -        @Override
 261.201 -        public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
 261.202 -            return code;
 261.203 -        }
 261.204 -    }
 261.205 -}
   262.1 --- a/sandbox/old-modules/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/StandaloneIndexer.java	Sun Jan 08 20:10:08 2017 +0100
   262.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   262.3 @@ -1,169 +0,0 @@
   262.4 -/*
   262.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   262.6 - *
   262.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
   262.8 - *
   262.9 - * The contents of this file are subject to the terms of either the GNU
  262.10 - * General Public License Version 2 only ("GPL") or the Common
  262.11 - * Development and Distribution License("CDDL") (collectively, the
  262.12 - * "License"). You may not use this file except in compliance with the
  262.13 - * License. You can obtain a copy of the License at
  262.14 - * http://www.netbeans.org/cddl-gplv2.html
  262.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  262.16 - * specific language governing permissions and limitations under the
  262.17 - * License.  When distributing the software, include this License Header
  262.18 - * Notice in each file and include the License file at
  262.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  262.20 - * particular file as subject to the "Classpath" exception as provided
  262.21 - * by Sun in the GPL Version 2 section of the License file that
  262.22 - * accompanied this code. If applicable, add the following below the
  262.23 - * License Header, with the fields enclosed by brackets [] replaced by
  262.24 - * your own identifying information:
  262.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  262.26 - *
  262.27 - * If you wish your version of this file to be governed by only the CDDL
  262.28 - * or only the GPL Version 2, indicate your decision by adding
  262.29 - * "[Contributor] elects to include this software in this distribution
  262.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  262.31 - * single choice of license, a recipient has the option to distribute
  262.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  262.33 - * to extend the choice of license to its licensees as provided above.
  262.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  262.35 - * Version 2 license, then the option applies only if the new code is
  262.36 - * made subject to such option by the copyright holder.
  262.37 - *
  262.38 - * Contributor(s):
  262.39 - *
  262.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  262.41 - */
  262.42 -
  262.43 -package org.netbeans.modules.jackpot30.server.indexer;
  262.44 -
  262.45 -import com.sun.source.tree.CompilationUnitTree;
  262.46 -import com.sun.tools.javac.api.JavacTaskImpl;
  262.47 -import java.io.BufferedReader;
  262.48 -import java.io.File;
  262.49 -import java.io.FileReader;
  262.50 -import java.io.IOException;
  262.51 -import java.util.Arrays;
  262.52 -import java.util.Collection;
  262.53 -import java.util.Collections;
  262.54 -import java.util.LinkedList;
  262.55 -import java.util.logging.Level;
  262.56 -import java.util.logging.Logger;
  262.57 -import javax.tools.Diagnostic;
  262.58 -import javax.tools.DiagnosticListener;
  262.59 -import javax.tools.JavaCompiler;
  262.60 -import javax.tools.JavaFileObject;
  262.61 -import javax.tools.StandardJavaFileManager;
  262.62 -import javax.tools.StandardLocation;
  262.63 -import javax.tools.ToolProvider;
  262.64 -import org.netbeans.modules.jackpot30.impl.duplicates.indexing.DuplicatesIndex;
  262.65 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
  262.66 -import org.netbeans.modules.jackpot30.impl.indexing.Index;
  262.67 -import org.netbeans.modules.jackpot30.impl.indexing.Index.IndexWriter;
  262.68 -import org.netbeans.modules.jackpot30.impl.indexing.IndexInfo;
  262.69 -
  262.70 -/**
  262.71 - *
  262.72 - * @author lahvac
  262.73 - */
  262.74 -public class StandaloneIndexer {
  262.75 -
  262.76 -    public static void index(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
  262.77 -        Index index = FileBasedIndex.create(root.toURI().toURL(), storeSources);
  262.78 -        IndexInfo ii = index.getIndexInfo();
  262.79 -        boolean clearIndexing = ii.totalFiles < 0 || ii.majorVersion != FileBasedIndex.MAJOR_VERSION || ii.minorVersion != FileBasedIndex.MINOR_VERSION;
  262.80 -        IndexWriter w = index.openForWriting();
  262.81 -        DuplicatesIndex.IndexWriter dw = duplicatesIndex ? DuplicatesIndex.get(root.toURI().toURL()).openForWriting() : null;
  262.82 -
  262.83 -        try {
  262.84 -            StandaloneIndexer i = new StandaloneIndexer();
  262.85 -
  262.86 -            if (!clearIndexing && modified != null && removed != null) {
  262.87 -                i.doIndex(w, dw, root, modified, removed);
  262.88 -            } else {
  262.89 -                w.clear();
  262.90 -                i.doIndex(w, dw, root);
  262.91 -            }
  262.92 -        } finally {
  262.93 -            w.close();
  262.94 -            if (dw != null) {
  262.95 -                dw.close();
  262.96 -            }
  262.97 -        }
  262.98 -    }
  262.99 -
 262.100 -    private void doIndex(IndexWriter w, DuplicatesIndex.IndexWriter dw, File fileOrDir) throws IOException {
 262.101 -        if (fileOrDir.isDirectory()) {
 262.102 -            for (File f : fileOrDir.listFiles()) {
 262.103 -                doIndex(w, dw, f);
 262.104 -            }
 262.105 -        } else {
 262.106 -            indexFile(w, dw, fileOrDir);
 262.107 -        }
 262.108 -    }
 262.109 -
 262.110 -    private void doIndex(IndexWriter w, DuplicatesIndex.IndexWriter dw, File root, String modified, String removed) throws IOException {
 262.111 -        for (String r : read(removed)) {
 262.112 -            w.remove(r);
 262.113 -            if (dw != null) dw.remove(r);
 262.114 -        }
 262.115 -
 262.116 -        for (String m : read(modified)) {
 262.117 -            indexFile(w, dw, new File(root, m));
 262.118 -        }
 262.119 -    }
 262.120 -
 262.121 -    private void indexFile(IndexWriter w, DuplicatesIndex.IndexWriter dw, File source) throws IOException {
 262.122 -        if (!source.getName().endsWith(".java"))
 262.123 -            return ;
 262.124 -        
 262.125 -        final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
 262.126 -        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
 262.127 -        assert tool != null;
 262.128 -
 262.129 -        DiagnosticListener<JavaFileObject> devNull = new DiagnosticListener<JavaFileObject>() {
 262.130 -            public void report(Diagnostic<? extends JavaFileObject> diagnostic) {}
 262.131 -        };
 262.132 -        StandardJavaFileManager m = tool.getStandardFileManager(devNull, null, null);
 262.133 -
 262.134 -        m.setLocation(StandardLocation.CLASS_PATH, Collections.<File>emptyList());
 262.135 -        m.setLocation(StandardLocation.SOURCE_PATH, Collections.<File>emptyList());
 262.136 -        
 262.137 -        Iterable<? extends JavaFileObject> fos = m.getJavaFileObjects(source);
 262.138 -        JavacTaskImpl ct = (JavacTaskImpl)tool.getTask(null, null, devNull, Arrays.asList("-bootclasspath",  bootPath), null, fos);
 262.139 -        CompilationUnitTree cut = ct.parse().iterator().next();
 262.140 -
 262.141 -        w.record(source.toURI().toURL(), cut, null);
 262.142 -
 262.143 -        if (dw != null) {
 262.144 -            ct.analyze(ct.enter(Collections.singletonList(cut)));
 262.145 -
 262.146 -            dw.record(ct, source.toURI().toURL(), cut);
 262.147 -        }
 262.148 -    }
 262.149 -
 262.150 -    private static Iterable<? extends String> read(String file) throws IOException {
 262.151 -        Collection<String> result = new LinkedList<String>();
 262.152 -        BufferedReader r = new BufferedReader(new FileReader(file));
 262.153 -
 262.154 -        try {
 262.155 -            String line;
 262.156 -
 262.157 -            while ((line = r.readLine()) != null) {
 262.158 -                if (!line.isEmpty()) {
 262.159 -                    result.add(line);
 262.160 -                }
 262.161 -            }
 262.162 -        } finally {
 262.163 -            try {
 262.164 -                r.close();
 262.165 -            } catch (IOException ex) {
 262.166 -                Logger.getLogger(StandaloneIndexer.class.getName()).log(Level.SEVERE, null, ex);
 262.167 -            }
 262.168 -        }
 262.169 -
 262.170 -        return result;
 262.171 -    }
 262.172 -}
   263.1 --- a/sandbox/old-modules/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/IndexTest.java	Sun Jan 08 20:10:08 2017 +0100
   263.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   263.3 @@ -1,96 +0,0 @@
   263.4 -/*
   263.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   263.6 - *
   263.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   263.8 - *
   263.9 - * The contents of this file are subject to the terms of either the GNU
  263.10 - * General Public License Version 2 only ("GPL") or the Common
  263.11 - * Development and Distribution License("CDDL") (collectively, the
  263.12 - * "License"). You may not use this file except in compliance with the
  263.13 - * License. You can obtain a copy of the License at
  263.14 - * http://www.netbeans.org/cddl-gplv2.html
  263.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  263.16 - * specific language governing permissions and limitations under the
  263.17 - * License.  When distributing the software, include this License Header
  263.18 - * Notice in each file and include the License file at
  263.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  263.20 - * particular file as subject to the "Classpath" exception as provided
  263.21 - * by Sun in the GPL Version 2 section of the License file that
  263.22 - * accompanied this code. If applicable, add the following below the
  263.23 - * License Header, with the fields enclosed by brackets [] replaced by
  263.24 - * your own identifying information:
  263.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  263.26 - *
  263.27 - * If you wish your version of this file to be governed by only the CDDL
  263.28 - * or only the GPL Version 2, indicate your decision by adding
  263.29 - * "[Contributor] elects to include this software in this distribution
  263.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  263.31 - * single choice of license, a recipient has the option to distribute
  263.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  263.33 - * to extend the choice of license to its licensees as provided above.
  263.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  263.35 - * Version 2 license, then the option applies only if the new code is
  263.36 - * made subject to such option by the copyright holder.
  263.37 - *
  263.38 - * Contributor(s):
  263.39 - *
  263.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  263.41 - */
  263.42 -
  263.43 -package org.netbeans.modules.jackpot30.server.indexer;
  263.44 -
  263.45 -import java.io.File;
  263.46 -import java.io.IOException;
  263.47 -import junit.framework.TestCase;
  263.48 -
  263.49 -/**
  263.50 - *
  263.51 - * @author lahvac
  263.52 - */
  263.53 -public class IndexTest extends TestCase {
  263.54 -
  263.55 -    public IndexTest(String name) {
  263.56 -        super(name);
  263.57 -    }
  263.58 -
  263.59 -    public void testCmdLine() throws IOException {
  263.60 -        assertCmdLineOk("/foo", false, false, null, null, "/foo", "/cache");
  263.61 -        assertCmdLineOk("/foo", false, false, "/modified.list", "/removed.list", "/foo", "/cache", "/modified.list", "/removed.list");
  263.62 -        assertCmdLineOk("/foo", true, false, null, null, Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, "/foo", "/cache");
  263.63 -        assertCmdLineOk("/foo", true, false, "/modified.list", "/removed.list", Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, "/foo", "/cache", "/modified.list", "/removed.list");
  263.64 -        assertCmdLineOk("/foo", false, true, null, null, Index.PARAM_STORE_SOURCES, "/foo", "/cache");
  263.65 -        assertCmdLineOk("/foo", false, true, "/modified.list", "/removed.list", Index.PARAM_STORE_SOURCES, "/foo", "/cache", "/modified.list", "/removed.list");
  263.66 -        assertCmdLineOk("/foo", true, true, null, null, Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, Index.PARAM_STORE_SOURCES, "/foo", "/cache");
  263.67 -        assertCmdLineOk("/foo", true, true, "/modified.list", "/removed.list", Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, Index.PARAM_STORE_SOURCES, "/foo", "/cache", "/modified.list", "/removed.list");
  263.68 -        assertCmdLineFailed();
  263.69 -        assertCmdLineFailed("/foo");
  263.70 -    }
  263.71 -
  263.72 -    private static void assertCmdLineOk(final String rootGolden, final boolean duplicatesIndexGolden, final boolean storeSourcesGolden, final String modifiedGolden, final String removedGolden, String... cmdLine) throws IOException {
  263.73 -        new Index() {
  263.74 -            @Override
  263.75 -            protected void invokeIndexer(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
  263.76 -                assertEquals(rootGolden, root.getPath());
  263.77 -                assertEquals(duplicatesIndexGolden, duplicatesIndex);
  263.78 -                assertEquals(storeSourcesGolden, storeSources);
  263.79 -                assertEquals(modifiedGolden, modified);
  263.80 -                assertEquals(removedGolden, removed);
  263.81 -            }
  263.82 -            @Override
  263.83 -            protected void printHelp() {
  263.84 -                fail();
  263.85 -            }
  263.86 -        }.index(cmdLine);
  263.87 -    }
  263.88 -
  263.89 -    private static void assertCmdLineFailed(String... cmdLine) throws IOException {
  263.90 -        new Index() {
  263.91 -            @Override
  263.92 -            protected void invokeIndexer(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
  263.93 -                fail();
  263.94 -            }
  263.95 -            @Override
  263.96 -            protected void printHelp() {}
  263.97 -        }.index(cmdLine);
  263.98 -    }
  263.99 -}
 263.100 \ No newline at end of file
   264.1 --- a/sandbox/old-modules/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/LargeScaleTester.java	Sun Jan 08 20:10:08 2017 +0100
   264.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   264.3 @@ -1,147 +0,0 @@
   264.4 -/*
   264.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   264.6 - *
   264.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   264.8 - *
   264.9 - * The contents of this file are subject to the terms of either the GNU
  264.10 - * General Public License Version 2 only ("GPL") or the Common
  264.11 - * Development and Distribution License("CDDL") (collectively, the
  264.12 - * "License"). You may not use this file except in compliance with the
  264.13 - * License. You can obtain a copy of the License at
  264.14 - * http://www.netbeans.org/cddl-gplv2.html
  264.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  264.16 - * specific language governing permissions and limitations under the
  264.17 - * License.  When distributing the software, include this License Header
  264.18 - * Notice in each file and include the License file at
  264.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  264.20 - * particular file as subject to the "Classpath" exception as provided
  264.21 - * by Sun in the GPL Version 2 section of the License file that
  264.22 - * accompanied this code. If applicable, add the following below the
  264.23 - * License Header, with the fields enclosed by brackets [] replaced by
  264.24 - * your own identifying information:
  264.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  264.26 - *
  264.27 - * If you wish your version of this file to be governed by only the CDDL
  264.28 - * or only the GPL Version 2, indicate your decision by adding
  264.29 - * "[Contributor] elects to include this software in this distribution
  264.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  264.31 - * single choice of license, a recipient has the option to distribute
  264.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  264.33 - * to extend the choice of license to its licensees as provided above.
  264.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  264.35 - * Version 2 license, then the option applies only if the new code is
  264.36 - * made subject to such option by the copyright holder.
  264.37 - *
  264.38 - * Contributor(s):
  264.39 - *
  264.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  264.41 - */
  264.42 -
  264.43 -package org.netbeans.modules.jackpot30.server.indexer;
  264.44 -
  264.45 -import java.io.File;
  264.46 -import java.io.IOException;
  264.47 -import java.util.logging.Handler;
  264.48 -import java.util.logging.Level;
  264.49 -import java.util.logging.LogRecord;
  264.50 -import java.util.logging.Logger;
  264.51 -import java.util.logging.SimpleFormatter;
  264.52 -import junit.framework.TestCase;
  264.53 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
  264.54 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
  264.55 -
  264.56 -/**
  264.57 - *
  264.58 - * @author lahvac
  264.59 - */
  264.60 -public class LargeScaleTester extends TestCase {
  264.61 -    
  264.62 -    public LargeScaleTester(String name) {
  264.63 -        super(name);
  264.64 -    }
  264.65 -
  264.66 -    private static final boolean createIndex = true;
  264.67 -
  264.68 -    private File src;
  264.69 -
  264.70 -    public void setUp() throws Exception {
  264.71 -        Logger.getLogger(FileBasedIndex.class.getName()).setLevel(Level.ALL);
  264.72 -        Logger.getLogger(FileBasedIndex.class.getName()).addHandler(new Handler() {
  264.73 -            @Override
  264.74 -            public void publish(LogRecord record) {
  264.75 -                System.err.println(new SimpleFormatter().formatMessage(record));
  264.76 -            }
  264.77 -            @Override
  264.78 -            public void flush() {
  264.79 -                System.err.flush();
  264.80 -            }
  264.81 -            @Override
  264.82 -            public void close() throws SecurityException {}
  264.83 -        });
  264.84 -        
  264.85 -        File source = new File(LargeScaleTester.class.getProtectionDomain().getCodeSource().getLocation().getPath());
  264.86 -        File workingDirectory = new File(new File(source.getParentFile(), "wd"), this.getName());
  264.87 -
  264.88 -        if (createIndex)
  264.89 -            deleteRecursively(workingDirectory);
  264.90 -        
  264.91 -        File cache = new File(workingDirectory, "cache");
  264.92 -        String toIndex = System.getProperty("index-folder");
  264.93 -        
  264.94 -        if (toIndex == null || !(src = new File(toIndex)).isDirectory()) {
  264.95 -            throw new IllegalStateException("Directory to index not correctly specified - add 'test-sys-prop.index-folder=<directory>' to private.properties");
  264.96 -        }
  264.97 -
  264.98 -        Cache.setStandaloneCacheRoot(cache);
  264.99 -
 264.100 -        if (createIndex) {
 264.101 -            long start = System.currentTimeMillis();
 264.102 -            StandaloneIndexer.index(src, false, false, null, null);
 264.103 -            long end = System.currentTimeMillis();
 264.104 -            System.err.println("indexing took: " + (end - start));
 264.105 -            System.err.println("cache size total: " + totalSize(cache) + ", lucene=" + totalSize(new File(cache, "s1/jackpot30/fulltext")));
 264.106 -        }
 264.107 -    }
 264.108 -
 264.109 -    private static void deleteRecursively(File d) throws IOException {
 264.110 -        if (!d.exists()) return;
 264.111 -        
 264.112 -        if (d.isDirectory()) {
 264.113 -            for (File c : d.listFiles()) {
 264.114 -                deleteRecursively(c);
 264.115 -            }
 264.116 -        }
 264.117 -
 264.118 -        if (!d.delete()) throw new IOException();
 264.119 -    }
 264.120 -
 264.121 -    private static long totalSize(File d) throws IOException {
 264.122 -        if (!d.exists()) return 0;
 264.123 -
 264.124 -        if (d.isDirectory()) {
 264.125 -            long total = 0;
 264.126 -
 264.127 -            for (File c : d.listFiles()) {
 264.128 -                total += totalSize(c);
 264.129 -            }
 264.130 -
 264.131 -            return total;
 264.132 -        } else {
 264.133 -            return d.length();
 264.134 -        }
 264.135 -    }
 264.136 -    
 264.137 -    public void testFind() throws Exception {
 264.138 -        performTest("new $type() { $mods$ $resultType $methodName($args$) { $statements$; } }");
 264.139 -        performTest("$1.isDirectory()");
 264.140 -    }
 264.141 -
 264.142 -    private void performTest(String code) throws Exception {
 264.143 -        System.err.println("searching for " + code);
 264.144 -        long start = System.currentTimeMillis();
 264.145 -        System.err.println("Found occurrences: " + StandaloneFinder.findCandidates(src, code).size());
 264.146 -        long end = System.currentTimeMillis();
 264.147 -
 264.148 -        System.err.println("total search time: " + (end - start));
 264.149 -    }
 264.150 -}
   265.1 --- a/sandbox/old-modules/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/StandaloneFinderTest.java	Sun Jan 08 20:10:08 2017 +0100
   265.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   265.3 @@ -1,154 +0,0 @@
   265.4 -/*
   265.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   265.6 - *
   265.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
   265.8 - *
   265.9 - * The contents of this file are subject to the terms of either the GNU
  265.10 - * General Public License Version 2 only ("GPL") or the Common
  265.11 - * Development and Distribution License("CDDL") (collectively, the
  265.12 - * "License"). You may not use this file except in compliance with the
  265.13 - * License. You can obtain a copy of the License at
  265.14 - * http://www.netbeans.org/cddl-gplv2.html
  265.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  265.16 - * specific language governing permissions and limitations under the
  265.17 - * License.  When distributing the software, include this License Header
  265.18 - * Notice in each file and include the License file at
  265.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  265.20 - * particular file as subject to the "Classpath" exception as provided
  265.21 - * by Sun in the GPL Version 2 section of the License file that
  265.22 - * accompanied this code. If applicable, add the following below the
  265.23 - * License Header, with the fields enclosed by brackets [] replaced by
  265.24 - * your own identifying information:
  265.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  265.26 - *
  265.27 - * If you wish your version of this file to be governed by only the CDDL
  265.28 - * or only the GPL Version 2, indicate your decision by adding
  265.29 - * "[Contributor] elects to include this software in this distribution
  265.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  265.31 - * single choice of license, a recipient has the option to distribute
  265.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  265.33 - * to extend the choice of license to its licensees as provided above.
  265.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  265.35 - * Version 2 license, then the option applies only if the new code is
  265.36 - * made subject to such option by the copyright holder.
  265.37 - *
  265.38 - * Contributor(s):
  265.39 - *
  265.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
  265.41 - */
  265.42 -
  265.43 -package org.netbeans.modules.jackpot30.server.indexer;
  265.44 -
  265.45 -import java.io.ByteArrayInputStream;
  265.46 -import java.io.File;
  265.47 -import java.io.FileOutputStream;
  265.48 -import java.io.IOException;
  265.49 -import java.io.InputStream;
  265.50 -import java.util.ArrayList;
  265.51 -import java.util.Arrays;
  265.52 -import java.util.HashSet;
  265.53 -import java.util.LinkedList;
  265.54 -import java.util.List;
  265.55 -import junit.framework.Assert;
  265.56 -import junit.framework.TestCase;
  265.57 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
  265.58 -
  265.59 -/**
  265.60 - *
  265.61 - * @author lahvac
  265.62 - */
  265.63 -public class StandaloneFinderTest extends TestCase {
  265.64 -    
  265.65 -    public StandaloneFinderTest(String name) {
  265.66 -        super(name);
  265.67 -    }
  265.68 -
  265.69 -    private File src;
  265.70 -
  265.71 -    public void setUp() throws Exception {
  265.72 -        File source = new File(StandaloneFinderTest.class.getProtectionDomain().getCodeSource().getLocation().getPath());
  265.73 -        File workingDirectory = new File(new File(source.getParentFile(), "wd"), this.getName());
  265.74 -
  265.75 -        deleteRecursively(workingDirectory);
  265.76 -        
  265.77 -        File cache = new File(workingDirectory, "cache");
  265.78 -
  265.79 -        src = new File(workingDirectory, "src");
  265.80 -
  265.81 -        Cache.setStandaloneCacheRoot(cache);
  265.82 -
  265.83 -        copyStringToFile(new File(src, "test/Test1.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
  265.84 -        copyStringToFile(new File(src, "test/TestLambda.java"), "package test; public class Test1 { private void test() { Runnable r = new Runnable() { public void run() { System.err.println(); } }; } }");
  265.85 -
  265.86 -        StandaloneIndexer.index(src, false, false, null, null);
  265.87 -    }
  265.88 -
  265.89 -    public final static void copyStringToFile (File f, String content) throws Exception {
  265.90 -        f.getParentFile().mkdirs();
  265.91 -
  265.92 -        FileOutputStream os = new FileOutputStream(f);
  265.93 -        InputStream is = new ByteArrayInputStream(content.getBytes("UTF-8"));
  265.94 -        int read;
  265.95 -        while ((read = is.read()) != (-1)) {
  265.96 -            os.write(read);
  265.97 -        }
  265.98 -        os.close ();
  265.99 -        is.close();
 265.100 -    }
 265.101 -
 265.102 -    private static List<Integer> toIntegerList(int[] arr) {
 265.103 -        List<Integer> res = new ArrayList<Integer>(arr.length);
 265.104 -
 265.105 -        for (int e : arr) {
 265.106 -            res.add(e);
 265.107 -        }
 265.108 -
 265.109 -        return res;
 265.110 -    }
 265.111 -
 265.112 -    private static void deleteRecursively(File d) throws IOException {
 265.113 -        if (!d.exists()) return;
 265.114 -        
 265.115 -        if (d.isDirectory()) {
 265.116 -            for (File c : d.listFiles()) {
 265.117 -                deleteRecursively(c);
 265.118 -            }
 265.119 -        }
 265.120 -
 265.121 -        if (!d.delete()) throw new IOException();
 265.122 -    }
 265.123 -    
 265.124 -    public void testFindSpans() throws Exception {
 265.125 -        Assert.assertEquals(Arrays.asList(55, 89), toIntegerList(StandaloneFinder.findCandidateOccurrenceSpans(src, "test/Test1.java", "$1.isDirectory()")));
 265.126 -    }
 265.127 -
 265.128 -    public void testMultiplePatterns() throws Exception {
 265.129 -        String patterns = "$1.isDirectory();; new java.io.File($1);;";
 265.130 -        Assert.assertEquals(Arrays.asList("test/Test1.java"), new LinkedList<String>(StandaloneFinder.findCandidates(src, patterns)));
 265.131 -        Assert.assertEquals(Arrays.asList(55, 75, 55, 89), toIntegerList(StandaloneFinder.findCandidateOccurrenceSpans(src, "test/Test1.java", patterns)));
 265.132 -    }
 265.133 -
 265.134 -    public void testUpdate() throws Exception {
 265.135 -        File modified = new File(src.getParentFile(), "modified");
 265.136 -        File removed  = new File(src.getParentFile(), "removed");
 265.137 -
 265.138 -        copyStringToFile(removed, "test/Test1.java");
 265.139 -        copyStringToFile(modified, "test/Test2.java\ntest/Test3.java");
 265.140 -
 265.141 -        new File(src, "test/Test1.java").delete();
 265.142 -
 265.143 -        copyStringToFile(new File(src, "test/Test2.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
 265.144 -        copyStringToFile(new File(src, "test/Test3.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
 265.145 -
 265.146 -        StandaloneIndexer.index(src, false, false, modified.getAbsolutePath(), removed.getAbsolutePath());
 265.147 -
 265.148 -        String patterns = "$1.isDirectory();; new java.io.File($1);;";
 265.149 -        Assert.assertEquals(new HashSet<String>(Arrays.asList("test/Test2.java", "test/Test3.java")), new HashSet<String>(StandaloneFinder.findCandidates(src, patterns)));
 265.150 -    }
 265.151 -    
 265.152 -    public void testLambdaPattern() throws Exception {
 265.153 -        String patterns = "new $type() {\n $mods$ $resultType $methodName($args$) {\n $statements$;\n }\n }\n";
 265.154 -        Assert.assertEquals(Arrays.asList("test/TestLambda.java"), new LinkedList<String>(StandaloneFinder.findCandidates(src, patterns)));
 265.155 -        Assert.assertEquals(Arrays.asList(70, 132), toIntegerList(StandaloneFinder.findCandidateOccurrenceSpans(src, "test/TestLambda.java", patterns)));
 265.156 -    }
 265.157 -}
   266.1 --- a/sandbox/old-modules/server/web.api/build.xml	Sun Jan 08 20:10:08 2017 +0100
   266.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   266.3 @@ -1,118 +0,0 @@
   266.4 -<?xml version="1.0" encoding="UTF-8"?>
   266.5 -<!--
   266.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   266.7 -
   266.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   266.9 -
  266.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  266.11 -Other names may be trademarks of their respective owners.
  266.12 -
  266.13 -The contents of this file are subject to the terms of either the GNU
  266.14 -General Public License Version 2 only ("GPL") or the Common
  266.15 -Development and Distribution License("CDDL") (collectively, the
  266.16 -"License"). You may not use this file except in compliance with the
  266.17 -License. You can obtain a copy of the License at
  266.18 -http://www.netbeans.org/cddl-gplv2.html
  266.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  266.20 -specific language governing permissions and limitations under the
  266.21 -License.  When distributing the software, include this License Header
  266.22 -Notice in each file and include the License file at
  266.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  266.24 -particular file as subject to the "Classpath" exception as provided
  266.25 -by Oracle in the GPL Version 2 section of the License file that
  266.26 -accompanied this code. If applicable, add the following below the
  266.27 -License Header, with the fields enclosed by brackets [] replaced by
  266.28 -your own identifying information:
  266.29 -"Portions Copyrighted [year] [name of copyright owner]"
  266.30 -
  266.31 -Contributor(s):
  266.32 -
  266.33 -The Original Software is NetBeans. The Initial Developer of the Original
  266.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  266.35 -Microsystems, Inc. All Rights Reserved.
  266.36 -
  266.37 -If you wish your version of this file to be governed by only the CDDL
  266.38 -or only the GPL Version 2, indicate your decision by adding
  266.39 -"[Contributor] elects to include this software in this distribution
  266.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  266.41 -single choice of license, a recipient has the option to distribute
  266.42 -your version of this file under either the CDDL, the GPL Version 2 or
  266.43 -to extend the choice of license to its licensees as provided above.
  266.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  266.45 -Version 2 license, then the option applies only if the new code is
  266.46 -made subject to such option by the copyright holder.
  266.47 --->
  266.48 -<!-- You may freely edit this file. See commented blocks below for -->
  266.49 -<!-- some examples of how to customize the build. -->
  266.50 -<!-- (If you delete it and reopen the project it will be recreated.) -->
  266.51 -<!-- By default, only the Clean and Build commands use this build script. -->
  266.52 -<!-- Commands such as Run, Debug, and Test only use this build script if -->
  266.53 -<!-- the Compile on Save feature is turned off for the project. -->
  266.54 -<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
  266.55 -<!-- in the project's Project Properties dialog box.-->
  266.56 -<project name="web.api" default="default" basedir=".">
  266.57 -    <description>Builds, tests, and runs the project web.api.</description>
  266.58 -    <import file="../download.xml"/>
  266.59 -    <import file="nbproject/build-impl.xml"/>
  266.60 -    <!--
  266.61 -
  266.62 -    There exist several targets which are by default empty and which can be 
  266.63 -    used for execution of your tasks. These targets are usually executed 
  266.64 -    before and after some main targets. They are: 
  266.65 -
  266.66 -      -pre-init:                 called before initialization of project properties
  266.67 -      -post-init:                called after initialization of project properties
  266.68 -      -pre-compile:              called before javac compilation
  266.69 -      -post-compile:             called after javac compilation
  266.70 -      -pre-compile-single:       called before javac compilation of single file
  266.71 -      -post-compile-single:      called after javac compilation of single file
  266.72 -      -pre-compile-test:         called before javac compilation of JUnit tests
  266.73 -      -post-compile-test:        called after javac compilation of JUnit tests
  266.74 -      -pre-compile-test-single:  called before javac compilation of single JUnit test
  266.75 -      -post-compile-test-single: called after javac compilation of single JUunit test
  266.76 -      -pre-jar:                  called before JAR building
  266.77 -      -post-jar:                 called after JAR building
  266.78 -      -post-clean:               called after cleaning build products
  266.79 -
  266.80 -    (Targets beginning with '-' are not intended to be called on their own.)
  266.81 -
  266.82 -    Example of inserting an obfuscator after compilation could look like this:
  266.83 -
  266.84 -        <target name="-post-compile">
  266.85 -            <obfuscate>
  266.86 -                <fileset dir="${build.classes.dir}"/>
  266.87 -            </obfuscate>
  266.88 -        </target>
  266.89 -
  266.90 -    For list of available properties check the imported 
  266.91 -    nbproject/build-impl.xml file. 
  266.92 -
  266.93 -
  266.94 -    Another way to customize the build is by overriding existing main targets.
  266.95 -    The targets of interest are: 
  266.96 -
  266.97 -      -init-macrodef-javac:     defines macro for javac compilation
  266.98 -      -init-macrodef-junit:     defines macro for junit execution
  266.99 -      -init-macrodef-debug:     defines macro for class debugging
 266.100 -      -init-macrodef-java:      defines macro for class execution
 266.101 -      -do-jar-with-manifest:    JAR building (if you are using a manifest)
 266.102 -      -do-jar-without-manifest: JAR building (if you are not using a manifest)
 266.103 -      run:                      execution of project 
 266.104 -      -javadoc-build:           Javadoc generation
 266.105 -      test-report:              JUnit report generation
 266.106 -
 266.107 -    An example of overriding the target for project execution could look like this:
 266.108 -
 266.109 -        <target name="run" depends="web.api-impl.jar">
 266.110 -            <exec dir="bin" executable="launcher.exe">
 266.111 -                <arg file="${dist.jar}"/>
 266.112 -            </exec>
 266.113 -        </target>
 266.114 -
 266.115 -    Notice that the overridden target depends on the jar target and not only on 
 266.116 -    the compile target as the regular run target does. Again, for a list of available 
 266.117 -    properties which you can use, check the target you are overriding in the
 266.118 -    nbproject/build-impl.xml file. 
 266.119 -
 266.120 -    -->
 266.121 -</project>
   267.1 --- a/sandbox/old-modules/server/web.api/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
   267.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   267.3 @@ -1,3 +0,0 @@
   267.4 -Manifest-Version: 1.0
   267.5 -X-COMMENT: Main-Class will be added automatically by build
   267.6 -
   268.1 --- a/sandbox/old-modules/server/web.api/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
   268.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   268.3 @@ -1,1009 +0,0 @@
   268.4 -<?xml version="1.0" encoding="UTF-8"?>
   268.5 -<!--
   268.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   268.7 -
   268.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   268.9 -
  268.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  268.11 -Other names may be trademarks of their respective owners.
  268.12 -
  268.13 -The contents of this file are subject to the terms of either the GNU
  268.14 -General Public License Version 2 only ("GPL") or the Common
  268.15 -Development and Distribution License("CDDL") (collectively, the
  268.16 -"License"). You may not use this file except in compliance with the
  268.17 -License. You can obtain a copy of the License at
  268.18 -http://www.netbeans.org/cddl-gplv2.html
  268.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  268.20 -specific language governing permissions and limitations under the
  268.21 -License.  When distributing the software, include this License Header
  268.22 -Notice in each file and include the License file at
  268.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  268.24 -particular file as subject to the "Classpath" exception as provided
  268.25 -by Oracle in the GPL Version 2 section of the License file that
  268.26 -accompanied this code. If applicable, add the following below the
  268.27 -License Header, with the fields enclosed by brackets [] replaced by
  268.28 -your own identifying information:
  268.29 -"Portions Copyrighted [year] [name of copyright owner]"
  268.30 -
  268.31 -Contributor(s):
  268.32 -
  268.33 -The Original Software is NetBeans. The Initial Developer of the Original
  268.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  268.35 -Microsystems, Inc. All Rights Reserved.
  268.36 -
  268.37 -If you wish your version of this file to be governed by only the CDDL
  268.38 -or only the GPL Version 2, indicate your decision by adding
  268.39 -"[Contributor] elects to include this software in this distribution
  268.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  268.41 -single choice of license, a recipient has the option to distribute
  268.42 -your version of this file under either the CDDL, the GPL Version 2 or
  268.43 -to extend the choice of license to its licensees as provided above.
  268.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  268.45 -Version 2 license, then the option applies only if the new code is
  268.46 -made subject to such option by the copyright holder.
  268.47 --->
  268.48 -<!--
  268.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
  268.50 -***         EDIT ../build.xml INSTEAD         ***
  268.51 -
  268.52 -For the purpose of easier reading the script
  268.53 -is divided into following sections:
  268.54 -
  268.55 -  - initialization
  268.56 -  - compilation
  268.57 -  - jar
  268.58 -  - execution
  268.59 -  - debugging
  268.60 -  - javadoc
  268.61 -  - junit compilation
  268.62 -  - junit execution
  268.63 -  - junit debugging
  268.64 -  - applet
  268.65 -  - cleanup
  268.66 -
  268.67 -        -->
  268.68 -<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="web.api-impl">
  268.69 -    <fail message="Please build using Ant 1.7.1 or higher.">
  268.70 -        <condition>
  268.71 -            <not>
  268.72 -                <antversion atleast="1.7.1"/>
  268.73 -            </not>
  268.74 -        </condition>
  268.75 -    </fail>
  268.76 -    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
  268.77 -    <!-- 
  268.78 -                ======================
  268.79 -                INITIALIZATION SECTION 
  268.80 -                ======================
  268.81 -            -->
  268.82 -    <target name="-pre-init">
  268.83 -        <!-- Empty placeholder for easier customization. -->
  268.84 -        <!-- You can override this target in the ../build.xml file. -->
  268.85 -    </target>
  268.86 -    <target depends="-pre-init" name="-init-private">
  268.87 -        <property file="nbproject/private/config.properties"/>
  268.88 -        <property file="nbproject/private/configs/${config}.properties"/>
  268.89 -        <property file="nbproject/private/private.properties"/>
  268.90 -    </target>
  268.91 -    <target name="-pre-init-libraries">
  268.92 -        <property location="../lib/nblibraries.properties" name="libraries.path"/>
  268.93 -        <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
  268.94 -        <pathconvert dirsep="/" property="libraries.dir">
  268.95 -            <path path="${libraries.dir.nativedirsep}"/>
  268.96 -        </pathconvert>
  268.97 -        <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/>
  268.98 -        <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/>
  268.99 -    </target>
 268.100 -    <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries">
 268.101 -        <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties">
 268.102 -            <filterchain>
 268.103 -                <replacestring from="$${base}" to="${libraries.dir}"/>
 268.104 -                <escapeunicode/>
 268.105 -            </filterchain>
 268.106 -        </loadproperties>
 268.107 -    </target>
 268.108 -    <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries">
 268.109 -        <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}">
 268.110 -            <filterchain>
 268.111 -                <replacestring from="$${base}" to="${libraries.dir}"/>
 268.112 -                <escapeunicode/>
 268.113 -            </filterchain>
 268.114 -        </loadproperties>
 268.115 -    </target>
 268.116 -    <target depends="-pre-init,-init-private,-init-libraries" name="-init-user">
 268.117 -        <property file="${user.properties.file}"/>
 268.118 -        <!-- The two properties below are usually overridden -->
 268.119 -        <!-- by the active platform. Just a fallback. -->
 268.120 -        <property name="default.javac.source" value="1.4"/>
 268.121 -        <property name="default.javac.target" value="1.4"/>
 268.122 -    </target>
 268.123 -    <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project">
 268.124 -        <property file="nbproject/configs/${config}.properties"/>
 268.125 -        <property file="nbproject/project.properties"/>
 268.126 -    </target>
 268.127 -    <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init">
 268.128 -        <available file="${manifest.file}" property="manifest.available"/>
 268.129 -        <available file="${application.splash}" property="splashscreen.available"/>
 268.130 -        <condition property="main.class.available">
 268.131 -            <and>
 268.132 -                <isset property="main.class"/>
 268.133 -                <not>
 268.134 -                    <equals arg1="${main.class}" arg2="" trim="true"/>
 268.135 -                </not>
 268.136 -            </and>
 268.137 -        </condition>
 268.138 -        <condition property="manifest.available+main.class">
 268.139 -            <and>
 268.140 -                <isset property="manifest.available"/>
 268.141 -                <isset property="main.class.available"/>
 268.142 -            </and>
 268.143 -        </condition>
 268.144 -        <condition property="do.mkdist">
 268.145 -            <and>
 268.146 -                <isset property="libs.CopyLibs.classpath"/>
 268.147 -                <not>
 268.148 -                    <istrue value="${mkdist.disabled}"/>
 268.149 -                </not>
 268.150 -            </and>
 268.151 -        </condition>
 268.152 -        <condition property="manifest.available+main.class+mkdist.available">
 268.153 -            <and>
 268.154 -                <istrue value="${manifest.available+main.class}"/>
 268.155 -                <isset property="do.mkdist"/>
 268.156 -            </and>
 268.157 -        </condition>
 268.158 -        <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
 268.159 -            <and>
 268.160 -                <istrue value="${manifest.available+main.class+mkdist.available}"/>
 268.161 -                <istrue value="${splashscreen.available}"/>
 268.162 -            </and>
 268.163 -        </condition>
 268.164 -        <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
 268.165 -            <and>
 268.166 -                <istrue value="${manifest.available+main.class+mkdist.available}"/>
 268.167 -                <istrue value="${splashscreen.available}"/>
 268.168 -            </and>
 268.169 -        </condition>
 268.170 -        <condition property="manifest.available+mkdist.available">
 268.171 -            <and>
 268.172 -                <istrue value="${manifest.available}"/>
 268.173 -                <isset property="do.mkdist"/>
 268.174 -            </and>
 268.175 -        </condition>
 268.176 -        <condition property="manifest.available-mkdist.available">
 268.177 -            <or>
 268.178 -                <istrue value="${manifest.available}"/>
 268.179 -                <isset property="do.mkdist"/>
 268.180 -            </or>
 268.181 -        </condition>
 268.182 -        <condition property="manifest.available+main.class-mkdist.available">
 268.183 -            <or>
 268.184 -                <istrue value="${manifest.available+main.class}"/>
 268.185 -                <isset property="do.mkdist"/>
 268.186 -            </or>
 268.187 -        </condition>
 268.188 -        <condition property="have.tests">
 268.189 -            <or>
 268.190 -                <available file="${test.src.dir}"/>
 268.191 -            </or>
 268.192 -        </condition>
 268.193 -        <condition property="have.sources">
 268.194 -            <or>
 268.195 -                <available file="${src.dir}"/>
 268.196 -            </or>
 268.197 -        </condition>
 268.198 -        <condition property="netbeans.home+have.tests">
 268.199 -            <and>
 268.200 -                <isset property="netbeans.home"/>
 268.201 -                <isset property="have.tests"/>
 268.202 -            </and>
 268.203 -        </condition>
 268.204 -        <condition property="no.javadoc.preview">
 268.205 -            <and>
 268.206 -                <isset property="javadoc.preview"/>
 268.207 -                <isfalse value="${javadoc.preview}"/>
 268.208 -            </and>
 268.209 -        </condition>
 268.210 -        <property name="run.jvmargs" value=""/>
 268.211 -        <property name="javac.compilerargs" value=""/>
 268.212 -        <property name="work.dir" value="${basedir}"/>
 268.213 -        <condition property="no.deps">
 268.214 -            <and>
 268.215 -                <istrue value="${no.dependencies}"/>
 268.216 -            </and>
 268.217 -        </condition>
 268.218 -        <property name="javac.debug" value="true"/>
 268.219 -        <property name="javadoc.preview" value="true"/>
 268.220 -        <property name="application.args" value=""/>
 268.221 -        <property name="source.encoding" value="${file.encoding}"/>
 268.222 -        <property name="runtime.encoding" value="${source.encoding}"/>
 268.223 -        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
 268.224 -            <and>
 268.225 -                <isset property="javadoc.encoding"/>
 268.226 -                <not>
 268.227 -                    <equals arg1="${javadoc.encoding}" arg2=""/>
 268.228 -                </not>
 268.229 -            </and>
 268.230 -        </condition>
 268.231 -        <property name="javadoc.encoding.used" value="${source.encoding}"/>
 268.232 -        <property name="includes" value="**"/>
 268.233 -        <property name="excludes" value=""/>
 268.234 -        <property name="do.depend" value="false"/>
 268.235 -        <condition property="do.depend.true">
 268.236 -            <istrue value="${do.depend}"/>
 268.237 -        </condition>
 268.238 -        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
 268.239 -        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
 268.240 -            <length length="0" string="${endorsed.classpath}" when="greater"/>
 268.241 -        </condition>
 268.242 -        <property name="javac.fork" value="false"/>
 268.243 -    </target>
 268.244 -    <target name="-post-init">
 268.245 -        <!-- Empty placeholder for easier customization. -->
 268.246 -        <!-- You can override this target in the ../build.xml file. -->
 268.247 -    </target>
 268.248 -    <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check">
 268.249 -        <fail unless="src.dir">Must set src.dir</fail>
 268.250 -        <fail unless="test.src.dir">Must set test.src.dir</fail>
 268.251 -        <fail unless="build.dir">Must set build.dir</fail>
 268.252 -        <fail unless="dist.dir">Must set dist.dir</fail>
 268.253 -        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 268.254 -        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 268.255 -        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 268.256 -        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 268.257 -        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 268.258 -        <fail unless="dist.jar">Must set dist.jar</fail>
 268.259 -    </target>
 268.260 -    <target name="-init-macrodef-property">
 268.261 -        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
 268.262 -            <attribute name="name"/>
 268.263 -            <attribute name="value"/>
 268.264 -            <sequential>
 268.265 -                <property name="@{name}" value="${@{value}}"/>
 268.266 -            </sequential>
 268.267 -        </macrodef>
 268.268 -    </target>
 268.269 -    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
 268.270 -        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 268.271 -            <attribute default="${src.dir}" name="srcdir"/>
 268.272 -            <attribute default="${build.classes.dir}" name="destdir"/>
 268.273 -            <attribute default="${javac.classpath}" name="classpath"/>
 268.274 -            <attribute default="${javac.processorpath}" name="processorpath"/>
 268.275 -            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
 268.276 -            <attribute default="${includes}" name="includes"/>
 268.277 -            <attribute default="${excludes}" name="excludes"/>
 268.278 -            <attribute default="${javac.debug}" name="debug"/>
 268.279 -            <attribute default="${empty.dir}" name="sourcepath"/>
 268.280 -            <attribute default="${empty.dir}" name="gensrcdir"/>
 268.281 -            <element name="customize" optional="true"/>
 268.282 -            <sequential>
 268.283 -                <property location="${build.dir}/empty" name="empty.dir"/>
 268.284 -                <mkdir dir="${empty.dir}"/>
 268.285 -                <mkdir dir="@{apgeneratedsrcdir}"/>
 268.286 -                <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}">
 268.287 -                    <src>
 268.288 -                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
 268.289 -                            <include name="*"/>
 268.290 -                        </dirset>
 268.291 -                    </src>
 268.292 -                    <classpath>
 268.293 -                        <path path="@{classpath}"/>
 268.294 -                    </classpath>
 268.295 -                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
 268.296 -                    <compilerarg line="${javac.compilerargs}"/>
 268.297 -                    <compilerarg value="-processorpath"/>
 268.298 -                    <compilerarg path="@{processorpath}"/>
 268.299 -                    <compilerarg line="${ap.processors.internal}"/>
 268.300 -                    <compilerarg value="-s"/>
 268.301 -                    <compilerarg path="@{apgeneratedsrcdir}"/>
 268.302 -                    <compilerarg line="${ap.proc.none.internal}"/>
 268.303 -                    <customize/>
 268.304 -                </javac>
 268.305 -            </sequential>
 268.306 -        </macrodef>
 268.307 -    </target>
 268.308 -    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
 268.309 -        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 268.310 -            <attribute default="${src.dir}" name="srcdir"/>
 268.311 -            <attribute default="${build.classes.dir}" name="destdir"/>
 268.312 -            <attribute default="${javac.classpath}" name="classpath"/>
 268.313 -            <attribute default="${javac.processorpath}" name="processorpath"/>
 268.314 -            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
 268.315 -            <attribute default="${includes}" name="includes"/>
 268.316 -            <attribute default="${excludes}" name="excludes"/>
 268.317 -            <attribute default="${javac.debug}" name="debug"/>
 268.318 -            <attribute default="${empty.dir}" name="sourcepath"/>
 268.319 -            <attribute default="${empty.dir}" name="gensrcdir"/>
 268.320 -            <element name="customize" optional="true"/>
 268.321 -            <sequential>
 268.322 -                <property location="${build.dir}/empty" name="empty.dir"/>
 268.323 -                <mkdir dir="${empty.dir}"/>
 268.324 -                <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}">
 268.325 -                    <src>
 268.326 -                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
 268.327 -                            <include name="*"/>
 268.328 -                        </dirset>
 268.329 -                    </src>
 268.330 -                    <classpath>
 268.331 -                        <path path="@{classpath}"/>
 268.332 -                    </classpath>
 268.333 -                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
 268.334 -                    <compilerarg line="${javac.compilerargs}"/>
 268.335 -                    <customize/>
 268.336 -                </javac>
 268.337 -            </sequential>
 268.338 -        </macrodef>
 268.339 -    </target>
 268.340 -    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
 268.341 -        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
 268.342 -            <attribute default="${src.dir}" name="srcdir"/>
 268.343 -            <attribute default="${build.classes.dir}" name="destdir"/>
 268.344 -            <attribute default="${javac.classpath}" name="classpath"/>
 268.345 -            <sequential>
 268.346 -                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
 268.347 -                    <classpath>
 268.348 -                        <path path="@{classpath}"/>
 268.349 -                    </classpath>
 268.350 -                </depend>
 268.351 -            </sequential>
 268.352 -        </macrodef>
 268.353 -        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
 268.354 -            <attribute default="${build.classes.dir}" name="destdir"/>
 268.355 -            <sequential>
 268.356 -                <fail unless="javac.includes">Must set javac.includes</fail>
 268.357 -                <pathconvert pathsep="," property="javac.includes.binary">
 268.358 -                    <path>
 268.359 -                        <filelist dir="@{destdir}" files="${javac.includes}"/>
 268.360 -                    </path>
 268.361 -                    <globmapper from="*.java" to="*.class"/>
 268.362 -                </pathconvert>
 268.363 -                <delete>
 268.364 -                    <files includes="${javac.includes.binary}"/>
 268.365 -                </delete>
 268.366 -            </sequential>
 268.367 -        </macrodef>
 268.368 -    </target>
 268.369 -    <target name="-init-macrodef-junit">
 268.370 -        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 268.371 -            <attribute default="${includes}" name="includes"/>
 268.372 -            <attribute default="${excludes}" name="excludes"/>
 268.373 -            <attribute default="**" name="testincludes"/>
 268.374 -            <sequential>
 268.375 -                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
 268.376 -                    <batchtest todir="${build.test.results.dir}">
 268.377 -                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
 268.378 -                            <filename name="@{testincludes}"/>
 268.379 -                        </fileset>
 268.380 -                    </batchtest>
 268.381 -                    <classpath>
 268.382 -                        <path path="${run.test.classpath}"/>
 268.383 -                    </classpath>
 268.384 -                    <syspropertyset>
 268.385 -                        <propertyref prefix="test-sys-prop."/>
 268.386 -                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
 268.387 -                    </syspropertyset>
 268.388 -                    <formatter type="brief" usefile="false"/>
 268.389 -                    <formatter type="xml"/>
 268.390 -                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
 268.391 -                    <jvmarg line="${run.jvmargs}"/>
 268.392 -                </junit>
 268.393 -            </sequential>
 268.394 -        </macrodef>
 268.395 -    </target>
 268.396 -    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
 268.397 -        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
 268.398 -            <attribute default="${main.class}" name="name"/>
 268.399 -            <attribute default="${debug.classpath}" name="classpath"/>
 268.400 -            <attribute default="" name="stopclassname"/>
 268.401 -            <sequential>
 268.402 -                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
 268.403 -                    <classpath>
 268.404 -                        <path path="@{classpath}"/>
 268.405 -                    </classpath>
 268.406 -                </nbjpdastart>
 268.407 -            </sequential>
 268.408 -        </macrodef>
 268.409 -        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
 268.410 -            <attribute default="${build.classes.dir}" name="dir"/>
 268.411 -            <sequential>
 268.412 -                <nbjpdareload>
 268.413 -                    <fileset dir="@{dir}" includes="${fix.classes}">
 268.414 -                        <include name="${fix.includes}*.class"/>
 268.415 -                    </fileset>
 268.416 -                </nbjpdareload>
 268.417 -            </sequential>
 268.418 -        </macrodef>
 268.419 -    </target>
 268.420 -    <target name="-init-debug-args">
 268.421 -        <property name="version-output" value="java version &quot;${ant.java.version}"/>
 268.422 -        <condition property="have-jdk-older-than-1.4">
 268.423 -            <or>
 268.424 -                <contains string="${version-output}" substring="java version &quot;1.0"/>
 268.425 -                <contains string="${version-output}" substring="java version &quot;1.1"/>
 268.426 -                <contains string="${version-output}" substring="java version &quot;1.2"/>
 268.427 -                <contains string="${version-output}" substring="java version &quot;1.3"/>
 268.428 -            </or>
 268.429 -        </condition>
 268.430 -        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
 268.431 -            <istrue value="${have-jdk-older-than-1.4}"/>
 268.432 -        </condition>
 268.433 -        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
 268.434 -            <os family="windows"/>
 268.435 -        </condition>
 268.436 -        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
 268.437 -            <isset property="debug.transport"/>
 268.438 -        </condition>
 268.439 -    </target>
 268.440 -    <target depends="-init-debug-args" name="-init-macrodef-debug">
 268.441 -        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
 268.442 -            <attribute default="${main.class}" name="classname"/>
 268.443 -            <attribute default="${debug.classpath}" name="classpath"/>
 268.444 -            <element name="customize" optional="true"/>
 268.445 -            <sequential>
 268.446 -                <java classname="@{classname}" dir="${work.dir}" fork="true">
 268.447 -                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
 268.448 -                    <jvmarg line="${debug-args-line}"/>
 268.449 -                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
 268.450 -                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
 268.451 -                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
 268.452 -                    <jvmarg line="${run.jvmargs}"/>
 268.453 -                    <classpath>
 268.454 -                        <path path="@{classpath}"/>
 268.455 -                    </classpath>
 268.456 -                    <syspropertyset>
 268.457 -                        <propertyref prefix="run-sys-prop."/>
 268.458 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 268.459 -                    </syspropertyset>
 268.460 -                    <customize/>
 268.461 -                </java>
 268.462 -            </sequential>
 268.463 -        </macrodef>
 268.464 -    </target>
 268.465 -    <target name="-init-macrodef-java">
 268.466 -        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
 268.467 -            <attribute default="${main.class}" name="classname"/>
 268.468 -            <attribute default="${run.classpath}" name="classpath"/>
 268.469 -            <element name="customize" optional="true"/>
 268.470 -            <sequential>
 268.471 -                <java classname="@{classname}" dir="${work.dir}" fork="true">
 268.472 -                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
 268.473 -                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
 268.474 -                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
 268.475 -                    <jvmarg line="${run.jvmargs}"/>
 268.476 -                    <classpath>
 268.477 -                        <path path="@{classpath}"/>
 268.478 -                    </classpath>
 268.479 -                    <syspropertyset>
 268.480 -                        <propertyref prefix="run-sys-prop."/>
 268.481 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 268.482 -                    </syspropertyset>
 268.483 -                    <customize/>
 268.484 -                </java>
 268.485 -            </sequential>
 268.486 -        </macrodef>
 268.487 -    </target>
 268.488 -    <target name="-init-presetdef-jar">
 268.489 -        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
 268.490 -            <jar compress="${jar.compress}" jarfile="${dist.jar}">
 268.491 -                <j2seproject1:fileset dir="${build.classes.dir}"/>
 268.492 -            </jar>
 268.493 -        </presetdef>
 268.494 -    </target>
 268.495 -    <target name="-init-ap-cmdline-properties">
 268.496 -        <property name="annotation.processing.enabled" value="true"/>
 268.497 -        <property name="annotation.processing.processors.list" value=""/>
 268.498 -        <property name="annotation.processing.run.all.processors" value="true"/>
 268.499 -        <property name="javac.processorpath" value="${javac.classpath}"/>
 268.500 -        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
 268.501 -        <condition property="ap.supported.internal" value="true">
 268.502 -            <not>
 268.503 -                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
 268.504 -            </not>
 268.505 -        </condition>
 268.506 -    </target>
 268.507 -    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
 268.508 -        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
 268.509 -            <isfalse value="${annotation.processing.run.all.processors}"/>
 268.510 -        </condition>
 268.511 -        <condition else="" property="ap.proc.none.internal" value="-proc:none">
 268.512 -            <isfalse value="${annotation.processing.enabled}"/>
 268.513 -        </condition>
 268.514 -    </target>
 268.515 -    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
 268.516 -        <property name="ap.cmd.line.internal" value=""/>
 268.517 -    </target>
 268.518 -    <target depends="-pre-init,-init-private,-init-libraries,-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,-init-ap-cmdline" name="init"/>
 268.519 -    <!--
 268.520 -                ===================
 268.521 -                COMPILATION SECTION
 268.522 -                ===================
 268.523 -            -->
 268.524 -    <target name="-deps-jar-init" unless="built-jar.properties">
 268.525 -        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
 268.526 -        <delete file="${built-jar.properties}" quiet="true"/>
 268.527 -    </target>
 268.528 -    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
 268.529 -        <echo level="warn" message="Cycle detected: web.api was already built"/>
 268.530 -    </target>
 268.531 -    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
 268.532 -        <mkdir dir="${build.dir}"/>
 268.533 -        <touch file="${built-jar.properties}" verbose="false"/>
 268.534 -        <property file="${built-jar.properties}" prefix="already.built.jar."/>
 268.535 -        <antcall target="-warn-already-built-jar"/>
 268.536 -        <propertyfile file="${built-jar.properties}">
 268.537 -            <entry key="${basedir}" value=""/>
 268.538 -        </propertyfile>
 268.539 -        <antcall target="-maybe-call-dep">
 268.540 -            <param name="call.built.properties" value="${built-jar.properties}"/>
 268.541 -            <param location="${project.indexer}" name="call.subproject"/>
 268.542 -            <param location="${project.indexer}/build.xml" name="call.script"/>
 268.543 -            <param name="call.target" value="jar"/>
 268.544 -            <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
 268.545 -        </antcall>
 268.546 -        <antcall target="-maybe-call-dep">
 268.547 -            <param name="call.built.properties" value="${built-jar.properties}"/>
 268.548 -            <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
 268.549 -            <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
 268.550 -            <param name="call.target" value="netbeans"/>
 268.551 -            <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
 268.552 -        </antcall>
 268.553 -    </target>
 268.554 -    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
 268.555 -    <target depends="init" name="-check-automatic-build">
 268.556 -        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
 268.557 -    </target>
 268.558 -    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
 268.559 -        <antcall target="clean"/>
 268.560 -    </target>
 268.561 -    <target depends="init,deps-jar" name="-pre-pre-compile">
 268.562 -        <mkdir dir="${build.classes.dir}"/>
 268.563 -    </target>
 268.564 -    <target name="-pre-compile">
 268.565 -        <!-- Empty placeholder for easier customization. -->
 268.566 -        <!-- You can override this target in the ../build.xml file. -->
 268.567 -    </target>
 268.568 -    <target if="do.depend.true" name="-compile-depend">
 268.569 -        <pathconvert property="build.generated.subdirs">
 268.570 -            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
 268.571 -                <include name="*"/>
 268.572 -            </dirset>
 268.573 -        </pathconvert>
 268.574 -        <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
 268.575 -    </target>
 268.576 -    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
 268.577 -        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
 268.578 -        <copy todir="${build.classes.dir}">
 268.579 -            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 268.580 -        </copy>
 268.581 -    </target>
 268.582 -    <target name="-post-compile">
 268.583 -        <!-- Empty placeholder for easier customization. -->
 268.584 -        <!-- You can override this target in the ../build.xml file. -->
 268.585 -    </target>
 268.586 -    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
 268.587 -    <target name="-pre-compile-single">
 268.588 -        <!-- Empty placeholder for easier customization. -->
 268.589 -        <!-- You can override this target in the ../build.xml file. -->
 268.590 -    </target>
 268.591 -    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
 268.592 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 268.593 -        <j2seproject3:force-recompile/>
 268.594 -        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
 268.595 -    </target>
 268.596 -    <target name="-post-compile-single">
 268.597 -        <!-- Empty placeholder for easier customization. -->
 268.598 -        <!-- You can override this target in the ../build.xml file. -->
 268.599 -    </target>
 268.600 -    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
 268.601 -    <!--
 268.602 -                ====================
 268.603 -                JAR BUILDING SECTION
 268.604 -                ====================
 268.605 -            -->
 268.606 -    <target depends="init" name="-pre-pre-jar">
 268.607 -        <dirname file="${dist.jar}" property="dist.jar.dir"/>
 268.608 -        <mkdir dir="${dist.jar.dir}"/>
 268.609 -    </target>
 268.610 -    <target name="-pre-jar">
 268.611 -        <!-- Empty placeholder for easier customization. -->
 268.612 -        <!-- You can override this target in the ../build.xml file. -->
 268.613 -    </target>
 268.614 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
 268.615 -        <j2seproject1:jar/>
 268.616 -    </target>
 268.617 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
 268.618 -        <j2seproject1:jar manifest="${manifest.file}"/>
 268.619 -    </target>
 268.620 -    <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">
 268.621 -        <j2seproject1:jar manifest="${manifest.file}">
 268.622 -            <j2seproject1:manifest>
 268.623 -                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
 268.624 -            </j2seproject1:manifest>
 268.625 -        </j2seproject1:jar>
 268.626 -        <echo>To run this application from the command line without Ant, try:</echo>
 268.627 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 268.628 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
 268.629 -        <pathconvert property="run.classpath.with.dist.jar">
 268.630 -            <path path="${run.classpath}"/>
 268.631 -            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 268.632 -        </pathconvert>
 268.633 -        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 268.634 -    </target>
 268.635 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen">
 268.636 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 268.637 -        <pathconvert property="run.classpath.without.build.classes.dir">
 268.638 -            <path path="${run.classpath}"/>
 268.639 -            <map from="${build.classes.dir.resolved}" to=""/>
 268.640 -        </pathconvert>
 268.641 -        <pathconvert pathsep=" " property="jar.classpath">
 268.642 -            <path path="${run.classpath.without.build.classes.dir}"/>
 268.643 -            <chainedmapper>
 268.644 -                <flattenmapper/>
 268.645 -                <globmapper from="*" to="lib/*"/>
 268.646 -            </chainedmapper>
 268.647 -        </pathconvert>
 268.648 -        <basename file="${application.splash}" property="splashscreen.basename"/>
 268.649 -        <mkdir dir="${build.classes.dir}/META-INF"/>
 268.650 -        <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
 268.651 -        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 268.652 -        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 268.653 -            <fileset dir="${build.classes.dir}"/>
 268.654 -            <manifest>
 268.655 -                <attribute name="Main-Class" value="${main.class}"/>
 268.656 -                <attribute name="Class-Path" value="${jar.classpath}"/>
 268.657 -                <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
 268.658 -            </manifest>
 268.659 -        </copylibs>
 268.660 -        <echo>To run this application from the command line without Ant, try:</echo>
 268.661 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
 268.662 -        <echo>java -jar "${dist.jar.resolved}"</echo>
 268.663 -    </target>
 268.664 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available">
 268.665 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 268.666 -        <pathconvert property="run.classpath.without.build.classes.dir">
 268.667 -            <path path="${run.classpath}"/>
 268.668 -            <map from="${build.classes.dir.resolved}" to=""/>
 268.669 -        </pathconvert>
 268.670 -        <pathconvert pathsep=" " property="jar.classpath">
 268.671 -            <path path="${run.classpath.without.build.classes.dir}"/>
 268.672 -            <chainedmapper>
 268.673 -                <flattenmapper/>
 268.674 -                <globmapper from="*" to="lib/*"/>
 268.675 -            </chainedmapper>
 268.676 -        </pathconvert>
 268.677 -        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 268.678 -        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 268.679 -            <fileset dir="${build.classes.dir}"/>
 268.680 -            <manifest>
 268.681 -                <attribute name="Main-Class" value="${main.class}"/>
 268.682 -                <attribute name="Class-Path" value="${jar.classpath}"/>
 268.683 -            </manifest>
 268.684 -        </copylibs>
 268.685 -        <echo>To run this application from the command line without Ant, try:</echo>
 268.686 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
 268.687 -        <echo>java -jar "${dist.jar.resolved}"</echo>
 268.688 -    </target>
 268.689 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
 268.690 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 268.691 -        <pathconvert property="run.classpath.without.build.classes.dir">
 268.692 -            <path path="${run.classpath}"/>
 268.693 -            <map from="${build.classes.dir.resolved}" to=""/>
 268.694 -        </pathconvert>
 268.695 -        <pathconvert pathsep=" " property="jar.classpath">
 268.696 -            <path path="${run.classpath.without.build.classes.dir}"/>
 268.697 -            <chainedmapper>
 268.698 -                <flattenmapper/>
 268.699 -                <globmapper from="*" to="lib/*"/>
 268.700 -            </chainedmapper>
 268.701 -        </pathconvert>
 268.702 -        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 268.703 -        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 268.704 -            <fileset dir="${build.classes.dir}"/>
 268.705 -            <manifest>
 268.706 -                <attribute name="Class-Path" value="${jar.classpath}"/>
 268.707 -            </manifest>
 268.708 -        </copylibs>
 268.709 -    </target>
 268.710 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
 268.711 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 268.712 -        <pathconvert property="run.classpath.without.build.classes.dir">
 268.713 -            <path path="${run.classpath}"/>
 268.714 -            <map from="${build.classes.dir.resolved}" to=""/>
 268.715 -        </pathconvert>
 268.716 -        <pathconvert pathsep=" " property="jar.classpath">
 268.717 -            <path path="${run.classpath.without.build.classes.dir}"/>
 268.718 -            <chainedmapper>
 268.719 -                <flattenmapper/>
 268.720 -                <globmapper from="*" to="lib/*"/>
 268.721 -            </chainedmapper>
 268.722 -        </pathconvert>
 268.723 -        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 268.724 -        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 268.725 -            <fileset dir="${build.classes.dir}"/>
 268.726 -            <manifest>
 268.727 -                <attribute name="Class-Path" value="${jar.classpath}"/>
 268.728 -            </manifest>
 268.729 -        </copylibs>
 268.730 -    </target>
 268.731 -    <target name="-post-jar">
 268.732 -        <!-- Empty placeholder for easier customization. -->
 268.733 -        <!-- You can override this target in the ../build.xml file. -->
 268.734 -    </target>
 268.735 -    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
 268.736 -    <!--
 268.737 -                =================
 268.738 -                EXECUTION SECTION
 268.739 -                =================
 268.740 -            -->
 268.741 -    <target depends="init,compile" description="Run a main class." name="run">
 268.742 -        <j2seproject1:java>
 268.743 -            <customize>
 268.744 -                <arg line="${application.args}"/>
 268.745 -            </customize>
 268.746 -        </j2seproject1:java>
 268.747 -    </target>
 268.748 -    <target name="-do-not-recompile">
 268.749 -        <property name="javac.includes.binary" value=""/>
 268.750 -    </target>
 268.751 -    <target depends="init,compile-single" name="run-single">
 268.752 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 268.753 -        <j2seproject1:java classname="${run.class}"/>
 268.754 -    </target>
 268.755 -    <target depends="init,compile-test-single" name="run-test-with-main">
 268.756 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 268.757 -        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
 268.758 -    </target>
 268.759 -    <!--
 268.760 -                =================
 268.761 -                DEBUGGING SECTION
 268.762 -                =================
 268.763 -            -->
 268.764 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
 268.765 -        <j2seproject1:nbjpdastart name="${debug.class}"/>
 268.766 -    </target>
 268.767 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
 268.768 -        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
 268.769 -    </target>
 268.770 -    <target depends="init,compile" name="-debug-start-debuggee">
 268.771 -        <j2seproject3:debug>
 268.772 -            <customize>
 268.773 -                <arg line="${application.args}"/>
 268.774 -            </customize>
 268.775 -        </j2seproject3:debug>
 268.776 -    </target>
 268.777 -    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
 268.778 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
 268.779 -        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 268.780 -    </target>
 268.781 -    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
 268.782 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
 268.783 -        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 268.784 -        <j2seproject3:debug classname="${debug.class}"/>
 268.785 -    </target>
 268.786 -    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
 268.787 -    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
 268.788 -        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 268.789 -        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
 268.790 -    </target>
 268.791 -    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
 268.792 -    <target depends="init" name="-pre-debug-fix">
 268.793 -        <fail unless="fix.includes">Must set fix.includes</fail>
 268.794 -        <property name="javac.includes" value="${fix.includes}.java"/>
 268.795 -    </target>
 268.796 -    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
 268.797 -        <j2seproject1:nbjpdareload/>
 268.798 -    </target>
 268.799 -    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
 268.800 -    <!--
 268.801 -                ===============
 268.802 -                JAVADOC SECTION
 268.803 -                ===============
 268.804 -            -->
 268.805 -    <target depends="init" if="have.sources" name="-javadoc-build">
 268.806 -        <mkdir dir="${dist.javadoc.dir}"/>
 268.807 -        <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}">
 268.808 -            <classpath>
 268.809 -                <path path="${javac.classpath}"/>
 268.810 -            </classpath>
 268.811 -            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
 268.812 -                <filename name="**/*.java"/>
 268.813 -            </fileset>
 268.814 -            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
 268.815 -                <include name="**/*.java"/>
 268.816 -            </fileset>
 268.817 -        </javadoc>
 268.818 -    </target>
 268.819 -    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
 268.820 -        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 268.821 -    </target>
 268.822 -    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
 268.823 -    <!--
 268.824 -                =========================
 268.825 -                JUNIT COMPILATION SECTION
 268.826 -                =========================
 268.827 -            -->
 268.828 -    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
 268.829 -        <mkdir dir="${build.test.classes.dir}"/>
 268.830 -    </target>
 268.831 -    <target name="-pre-compile-test">
 268.832 -        <!-- Empty placeholder for easier customization. -->
 268.833 -        <!-- You can override this target in the ../build.xml file. -->
 268.834 -    </target>
 268.835 -    <target if="do.depend.true" name="-compile-test-depend">
 268.836 -        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 268.837 -    </target>
 268.838 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
 268.839 -        <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}"/>
 268.840 -        <copy todir="${build.test.classes.dir}">
 268.841 -            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 268.842 -        </copy>
 268.843 -    </target>
 268.844 -    <target name="-post-compile-test">
 268.845 -        <!-- Empty placeholder for easier customization. -->
 268.846 -        <!-- You can override this target in the ../build.xml file. -->
 268.847 -    </target>
 268.848 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
 268.849 -    <target name="-pre-compile-test-single">
 268.850 -        <!-- Empty placeholder for easier customization. -->
 268.851 -        <!-- You can override this target in the ../build.xml file. -->
 268.852 -    </target>
 268.853 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
 268.854 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 268.855 -        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
 268.856 -        <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}"/>
 268.857 -        <copy todir="${build.test.classes.dir}">
 268.858 -            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 268.859 -        </copy>
 268.860 -    </target>
 268.861 -    <target name="-post-compile-test-single">
 268.862 -        <!-- Empty placeholder for easier customization. -->
 268.863 -        <!-- You can override this target in the ../build.xml file. -->
 268.864 -    </target>
 268.865 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
 268.866 -    <!--
 268.867 -                =======================
 268.868 -                JUNIT EXECUTION SECTION
 268.869 -                =======================
 268.870 -            -->
 268.871 -    <target depends="init" if="have.tests" name="-pre-test-run">
 268.872 -        <mkdir dir="${build.test.results.dir}"/>
 268.873 -    </target>
 268.874 -    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
 268.875 -        <j2seproject3:junit testincludes="**/*Test.java"/>
 268.876 -    </target>
 268.877 -    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
 268.878 -        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
 268.879 -    </target>
 268.880 -    <target depends="init" if="have.tests" name="test-report"/>
 268.881 -    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
 268.882 -    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
 268.883 -    <target depends="init" if="have.tests" name="-pre-test-run-single">
 268.884 -        <mkdir dir="${build.test.results.dir}"/>
 268.885 -    </target>
 268.886 -    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
 268.887 -        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 268.888 -        <j2seproject3:junit excludes="" includes="${test.includes}"/>
 268.889 -    </target>
 268.890 -    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
 268.891 -        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
 268.892 -    </target>
 268.893 -    <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"/>
 268.894 -    <!--
 268.895 -                =======================
 268.896 -                JUNIT DEBUGGING SECTION
 268.897 -                =======================
 268.898 -            -->
 268.899 -    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
 268.900 -        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 268.901 -        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
 268.902 -        <delete file="${test.report.file}"/>
 268.903 -        <mkdir dir="${build.test.results.dir}"/>
 268.904 -        <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}">
 268.905 -            <customize>
 268.906 -                <syspropertyset>
 268.907 -                    <propertyref prefix="test-sys-prop."/>
 268.908 -                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
 268.909 -                </syspropertyset>
 268.910 -                <arg value="${test.class}"/>
 268.911 -                <arg value="showoutput=true"/>
 268.912 -                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
 268.913 -                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
 268.914 -            </customize>
 268.915 -        </j2seproject3:debug>
 268.916 -    </target>
 268.917 -    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
 268.918 -        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
 268.919 -    </target>
 268.920 -    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
 268.921 -    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
 268.922 -        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 268.923 -    </target>
 268.924 -    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
 268.925 -    <!--
 268.926 -                =========================
 268.927 -                APPLET EXECUTION SECTION
 268.928 -                =========================
 268.929 -            -->
 268.930 -    <target depends="init,compile-single" name="run-applet">
 268.931 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 268.932 -        <j2seproject1:java classname="sun.applet.AppletViewer">
 268.933 -            <customize>
 268.934 -                <arg value="${applet.url}"/>
 268.935 -            </customize>
 268.936 -        </j2seproject1:java>
 268.937 -    </target>
 268.938 -    <!--
 268.939 -                =========================
 268.940 -                APPLET DEBUGGING  SECTION
 268.941 -                =========================
 268.942 -            -->
 268.943 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
 268.944 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 268.945 -        <j2seproject3:debug classname="sun.applet.AppletViewer">
 268.946 -            <customize>
 268.947 -                <arg value="${applet.url}"/>
 268.948 -            </customize>
 268.949 -        </j2seproject3:debug>
 268.950 -    </target>
 268.951 -    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
 268.952 -    <!--
 268.953 -                ===============
 268.954 -                CLEANUP SECTION
 268.955 -                ===============
 268.956 -            -->
 268.957 -    <target name="-deps-clean-init" unless="built-clean.properties">
 268.958 -        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
 268.959 -        <delete file="${built-clean.properties}" quiet="true"/>
 268.960 -    </target>
 268.961 -    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
 268.962 -        <echo level="warn" message="Cycle detected: web.api was already built"/>
 268.963 -    </target>
 268.964 -    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
 268.965 -        <mkdir dir="${build.dir}"/>
 268.966 -        <touch file="${built-clean.properties}" verbose="false"/>
 268.967 -        <property file="${built-clean.properties}" prefix="already.built.clean."/>
 268.968 -        <antcall target="-warn-already-built-clean"/>
 268.969 -        <propertyfile file="${built-clean.properties}">
 268.970 -            <entry key="${basedir}" value=""/>
 268.971 -        </propertyfile>
 268.972 -        <antcall target="-maybe-call-dep">
 268.973 -            <param name="call.built.properties" value="${built-clean.properties}"/>
 268.974 -            <param location="${project.indexer}" name="call.subproject"/>
 268.975 -            <param location="${project.indexer}/build.xml" name="call.script"/>
 268.976 -            <param name="call.target" value="clean"/>
 268.977 -            <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
 268.978 -        </antcall>
 268.979 -        <antcall target="-maybe-call-dep">
 268.980 -            <param name="call.built.properties" value="${built-clean.properties}"/>
 268.981 -            <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
 268.982 -            <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
 268.983 -            <param name="call.target" value="clean"/>
 268.984 -            <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
 268.985 -        </antcall>
 268.986 -    </target>
 268.987 -    <target depends="init" name="-do-clean">
 268.988 -        <delete dir="${build.dir}"/>
 268.989 -        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
 268.990 -    </target>
 268.991 -    <target name="-post-clean">
 268.992 -        <!-- Empty placeholder for easier customization. -->
 268.993 -        <!-- You can override this target in the ../build.xml file. -->
 268.994 -    </target>
 268.995 -    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
 268.996 -    <target name="-check-call-dep">
 268.997 -        <property file="${call.built.properties}" prefix="already.built."/>
 268.998 -        <condition property="should.call.dep">
 268.999 -            <not>
268.1000 -                <isset property="already.built.${call.subproject}"/>
268.1001 -            </not>
268.1002 -        </condition>
268.1003 -    </target>
268.1004 -    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
268.1005 -        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
268.1006 -            <propertyset>
268.1007 -                <propertyref prefix="transfer."/>
268.1008 -                <mapper from="transfer.*" to="*" type="glob"/>
268.1009 -            </propertyset>
268.1010 -        </ant>
268.1011 -    </target>
268.1012 -</project>
   269.1 --- a/sandbox/old-modules/server/web.api/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
   269.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   269.3 @@ -1,49 +0,0 @@
   269.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   269.5 -#
   269.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   269.7 -#
   269.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   269.9 -# Other names may be trademarks of their respective owners.
  269.10 -#
  269.11 -# The contents of this file are subject to the terms of either the GNU
  269.12 -# General Public License Version 2 only ("GPL") or the Common
  269.13 -# Development and Distribution License("CDDL") (collectively, the
  269.14 -# "License"). You may not use this file except in compliance with the
  269.15 -# License. You can obtain a copy of the License at
  269.16 -# http://www.netbeans.org/cddl-gplv2.html
  269.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  269.18 -# specific language governing permissions and limitations under the
  269.19 -# License.  When distributing the software, include this License Header
  269.20 -# Notice in each file and include the License file at
  269.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  269.22 -# particular file as subject to the "Classpath" exception as provided
  269.23 -# by Oracle in the GPL Version 2 section of the License file that
  269.24 -# accompanied this code. If applicable, add the following below the
  269.25 -# License Header, with the fields enclosed by brackets [] replaced by
  269.26 -# your own identifying information:
  269.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  269.28 -#
  269.29 -# Contributor(s):
  269.30 -#
  269.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  269.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  269.33 -# Microsystems, Inc. All Rights Reserved.
  269.34 -#
  269.35 -# If you wish your version of this file to be governed by only the CDDL
  269.36 -# or only the GPL Version 2, indicate your decision by adding
  269.37 -# "[Contributor] elects to include this software in this distribution
  269.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  269.39 -# single choice of license, a recipient has the option to distribute
  269.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  269.41 -# to extend the choice of license to its licensees as provided above.
  269.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  269.43 -# Version 2 license, then the option applies only if the new code is
  269.44 -# made subject to such option by the copyright holder.
  269.45 -build.xml.data.CRC32=2d84667c
  269.46 -build.xml.script.CRC32=0d0c4a18
  269.47 -build.xml.stylesheet.CRC32=958a1d3e@1.27.0.45
  269.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
  269.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
  269.50 -nbproject/build-impl.xml.data.CRC32=2d84667c
  269.51 -nbproject/build-impl.xml.script.CRC32=8250004f
  269.52 -nbproject/build-impl.xml.stylesheet.CRC32=ff4aa3ed@1.35.0.45
   270.1 --- a/sandbox/old-modules/server/web.api/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
   270.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   270.3 @@ -1,140 +0,0 @@
   270.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   270.5 -#
   270.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   270.7 -#
   270.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   270.9 -# Other names may be trademarks of their respective owners.
  270.10 -#
  270.11 -# The contents of this file are subject to the terms of either the GNU
  270.12 -# General Public License Version 2 only ("GPL") or the Common
  270.13 -# Development and Distribution License("CDDL") (collectively, the
  270.14 -# "License"). You may not use this file except in compliance with the
  270.15 -# License. You can obtain a copy of the License at
  270.16 -# http://www.netbeans.org/cddl-gplv2.html
  270.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  270.18 -# specific language governing permissions and limitations under the
  270.19 -# License.  When distributing the software, include this License Header
  270.20 -# Notice in each file and include the License file at
  270.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  270.22 -# particular file as subject to the "Classpath" exception as provided
  270.23 -# by Oracle in the GPL Version 2 section of the License file that
  270.24 -# accompanied this code. If applicable, add the following below the
  270.25 -# License Header, with the fields enclosed by brackets [] replaced by
  270.26 -# your own identifying information:
  270.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  270.28 -#
  270.29 -# Contributor(s):
  270.30 -#
  270.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  270.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  270.33 -# Microsystems, Inc. All Rights Reserved.
  270.34 -#
  270.35 -# If you wish your version of this file to be governed by only the CDDL
  270.36 -# or only the GPL Version 2, indicate your decision by adding
  270.37 -# "[Contributor] elects to include this software in this distribution
  270.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  270.39 -# single choice of license, a recipient has the option to distribute
  270.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  270.41 -# to extend the choice of license to its licensees as provided above.
  270.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  270.43 -# Version 2 license, then the option applies only if the new code is
  270.44 -# made subject to such option by the copyright holder.
  270.45 -annotation.processing.enabled=true
  270.46 -annotation.processing.enabled.in.editor=false
  270.47 -annotation.processing.run.all.processors=true
  270.48 -application.title=web.api
  270.49 -application.vendor=lahvac
  270.50 -build.classes.dir=${build.dir}/classes
  270.51 -build.classes.excludes=**/*.java,**/*.form
  270.52 -# This directory is removed when the project is cleaned:
  270.53 -build.dir=build
  270.54 -build.generated.dir=${build.dir}/generated
  270.55 -build.generated.sources.dir=${build.dir}/generated-sources
  270.56 -# Only compile against the classpath explicitly listed here:
  270.57 -build.sysclasspath=ignore
  270.58 -build.test.classes.dir=${build.dir}/test/classes
  270.59 -build.test.results.dir=${build.dir}/test/results
  270.60 -# Uncomment to specify the preferred debugger connection transport:
  270.61 -#debug.transport=dt_socket
  270.62 -debug.classpath=\
  270.63 -    ${run.classpath}
  270.64 -debug.test.classpath=\
  270.65 -    ${run.test.classpath}
  270.66 -# This directory is removed when the project is cleaned:
  270.67 -dist.dir=dist
  270.68 -dist.jar=${dist.dir}/web.api.jar
  270.69 -dist.javadoc.dir=${dist.dir}/javadoc
  270.70 -endorsed.classpath=\
  270.71 -    ${libs.javac.classpath}
  270.72 -excludes=
  270.73 -file.reference.org-netbeans-modules-java-source.jar=../lib/org-netbeans-modules-java-source.jar
  270.74 -file.reference.org-netbeans-spi-editor-hints.jar=../lib/org-netbeans-spi-editor-hints.jar
  270.75 -file.reference.org-openide-filesystems.jar=../lib/org-openide-filesystems.jar
  270.76 -file.reference.org-openide-util-lookup.jar=../lib/org-openide-util-lookup.jar
  270.77 -file.reference.org-openide-util.jar=../lib/org-openide-util.jar
  270.78 -file.reference.util-commons.jar=../../remoting/ide/api/external/util-commons.jar
  270.79 -file.reference.util-pojson.jar=../../remoting/ide/api/external/util-pojson.jar
  270.80 -includes=**
  270.81 -jar.compress=false
  270.82 -javac.classpath=\
  270.83 -    ${reference.org_netbeans_modules_jackpot30_api.module}:\
  270.84 -    ${libs.jersey.classpath}:\
  270.85 -    ${libs.lucene.classpath}:\
  270.86 -    ${libs.javac.classpath}:\
  270.87 -    ${reference.indexer.jar}:\
  270.88 -    ${file.reference.org-netbeans-modules-java-source.jar}:\
  270.89 -    ${file.reference.org-openide-filesystems.jar}:\
  270.90 -    ${file.reference.util-commons.jar}:\
  270.91 -    ${file.reference.util-pojson.jar}:\
  270.92 -    ${libs.freemarker.classpath}:\
  270.93 -    ${file.reference.org-openide-util.jar}:\
  270.94 -    ${file.reference.org-openide-util-lookup.jar}:\
  270.95 -    ${file.reference.org-netbeans-spi-editor-hints.jar}:\
  270.96 -    ${reference.org_netbeans_modules_jackpot30_remoting_api.module}
  270.97 -# Space-separated list of extra javac options
  270.98 -javac.compilerargs=
  270.99 -javac.deprecation=false
 270.100 -javac.processorpath=\
 270.101 -    ${javac.classpath}
 270.102 -javac.source=1.5
 270.103 -javac.target=1.5
 270.104 -javac.test.classpath=\
 270.105 -    ${javac.classpath}:\
 270.106 -    ${build.classes.dir}:\
 270.107 -    ${libs.junit_4.classpath}
 270.108 -javadoc.additionalparam=
 270.109 -javadoc.author=false
 270.110 -javadoc.encoding=${source.encoding}
 270.111 -javadoc.noindex=false
 270.112 -javadoc.nonavbar=false
 270.113 -javadoc.notree=false
 270.114 -javadoc.private=false
 270.115 -javadoc.splitindex=true
 270.116 -javadoc.use=true
 270.117 -javadoc.version=false
 270.118 -javadoc.windowtitle=
 270.119 -jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
 270.120 -main.class=org.netbeans.modules.jackpot30.server.webapi.Main
 270.121 -manifest.file=manifest.mf
 270.122 -meta.inf.dir=${src.dir}/META-INF
 270.123 -mkdist.disabled=false
 270.124 -platform.active=default_platform
 270.125 -project.indexer=../indexer
 270.126 -project.org_netbeans_modules_jackpot30_api=../../api
 270.127 -project.org_netbeans_modules_jackpot30_remoting_api=../../remoting/ide/api
 270.128 -reference.indexer.jar=${project.indexer}/dist/indexer.jar
 270.129 -reference.org_netbeans_modules_jackpot30_api.module=${project.org_netbeans_modules_jackpot30_api}/../build/cluster/modules/org-netbeans-modules-jackpot30-api.jar
 270.130 -reference.org_netbeans_modules_jackpot30_remoting_api.module=${project.org_netbeans_modules_jackpot30_remoting_api}/../build/cluster/modules/org-netbeans-modules-jackpot30-remoting-api.jar
 270.131 -run.classpath=\
 270.132 -    ${javac.classpath}:\
 270.133 -    ${build.classes.dir}
 270.134 -# Space-separated list of JVM arguments used when running the project
 270.135 -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
 270.136 -# or test-sys-prop.name=value to set system properties for unit tests):
 270.137 -run.jvmargs=-Xbootclasspath/p:${libs.javac.classpath}
 270.138 -run.test.classpath=\
 270.139 -    ${javac.test.classpath}:\
 270.140 -    ${build.test.classes.dir}
 270.141 -source.encoding=UTF-8
 270.142 -src.dir=src
 270.143 -test.src.dir=test
   271.1 --- a/sandbox/old-modules/server/web.api/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
   271.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   271.3 @@ -1,87 +0,0 @@
   271.4 -<?xml version="1.0" encoding="UTF-8"?>
   271.5 -<!--
   271.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   271.7 -
   271.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   271.9 -
  271.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  271.11 -Other names may be trademarks of their respective owners.
  271.12 -
  271.13 -The contents of this file are subject to the terms of either the GNU
  271.14 -General Public License Version 2 only ("GPL") or the Common
  271.15 -Development and Distribution License("CDDL") (collectively, the
  271.16 -"License"). You may not use this file except in compliance with the
  271.17 -License. You can obtain a copy of the License at
  271.18 -http://www.netbeans.org/cddl-gplv2.html
  271.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  271.20 -specific language governing permissions and limitations under the
  271.21 -License.  When distributing the software, include this License Header
  271.22 -Notice in each file and include the License file at
  271.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  271.24 -particular file as subject to the "Classpath" exception as provided
  271.25 -by Oracle in the GPL Version 2 section of the License file that
  271.26 -accompanied this code. If applicable, add the following below the
  271.27 -License Header, with the fields enclosed by brackets [] replaced by
  271.28 -your own identifying information:
  271.29 -"Portions Copyrighted [year] [name of copyright owner]"
  271.30 -
  271.31 -Contributor(s):
  271.32 -
  271.33 -The Original Software is NetBeans. The Initial Developer of the Original
  271.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  271.35 -Microsystems, Inc. All Rights Reserved.
  271.36 -
  271.37 -If you wish your version of this file to be governed by only the CDDL
  271.38 -or only the GPL Version 2, indicate your decision by adding
  271.39 -"[Contributor] elects to include this software in this distribution
  271.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  271.41 -single choice of license, a recipient has the option to distribute
  271.42 -your version of this file under either the CDDL, the GPL Version 2 or
  271.43 -to extend the choice of license to its licensees as provided above.
  271.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  271.45 -Version 2 license, then the option applies only if the new code is
  271.46 -made subject to such option by the copyright holder.
  271.47 --->
  271.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
  271.49 -    <type>org.netbeans.modules.java.j2seproject</type>
  271.50 -    <configuration>
  271.51 -        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
  271.52 -            <name>web.api</name>
  271.53 -            <source-roots>
  271.54 -                <root id="src.dir"/>
  271.55 -            </source-roots>
  271.56 -            <test-roots>
  271.57 -                <root id="test.src.dir"/>
  271.58 -            </test-roots>
  271.59 -        </data>
  271.60 -        <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
  271.61 -            <definitions>../lib/nblibraries.properties</definitions>
  271.62 -        </libraries>
  271.63 -        <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
  271.64 -            <reference>
  271.65 -                <foreign-project>indexer</foreign-project>
  271.66 -                <artifact-type>jar</artifact-type>
  271.67 -                <script>build.xml</script>
  271.68 -                <target>jar</target>
  271.69 -                <clean-target>clean</clean-target>
  271.70 -                <id>jar</id>
  271.71 -            </reference>
  271.72 -            <reference>
  271.73 -                <foreign-project>org_netbeans_modules_jackpot30_api</foreign-project>
  271.74 -                <artifact-type>jar</artifact-type>
  271.75 -                <script>build.xml</script>
  271.76 -                <target>netbeans</target>
  271.77 -                <clean-target>clean</clean-target>
  271.78 -                <id>module</id>
  271.79 -            </reference>
  271.80 -            <reference>
  271.81 -                <foreign-project>org_netbeans_modules_jackpot30_remoting_api</foreign-project>
  271.82 -                <artifact-type>jar</artifact-type>
  271.83 -                <script>build.xml</script>
  271.84 -                <target>netbeans</target>
  271.85 -                <clean-target>clean</clean-target>
  271.86 -                <id>module</id>
  271.87 -            </reference>
  271.88 -        </references>
  271.89 -    </configuration>
  271.90 -</project>
   272.1 --- a/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/API.java	Sun Jan 08 20:10:08 2017 +0100
   272.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   272.3 @@ -1,233 +0,0 @@
   272.4 -/*
   272.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   272.6 - *
   272.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
   272.8 - *
   272.9 - * The contents of this file are subject to the terms of either the GNU
  272.10 - * General Public License Version 2 only ("GPL") or the Common
  272.11 - * Development and Distribution License("CDDL") (collectively, the
  272.12 - * "License"). You may not use this file except in compliance with the
  272.13 - * License. You can obtain a copy of the License at
  272.14 - * http://www.netbeans.org/cddl-gplv2.html
  272.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  272.16 - * specific language governing permissions and limitations under the
  272.17 - * License.  When distributing the software, include this License Header
  272.18 - * Notice in each file and include the License file at
  272.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  272.20 - * particular file as subject to the "Classpath" exception as provided
  272.21 - * by Sun in the GPL Version 2 section of the License file that
  272.22 - * accompanied this code. If applicable, add the following below the
  272.23 - * License Header, with the fields enclosed by brackets [] replaced by
  272.24 - * your own identifying information:
  272.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  272.26 - *
  272.27 - * If you wish your version of this file to be governed by only the CDDL
  272.28 - * or only the GPL Version 2, indicate your decision by adding
  272.29 - * "[Contributor] elects to include this software in this distribution
  272.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  272.31 - * single choice of license, a recipient has the option to distribute
  272.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  272.33 - * to extend the choice of license to its licensees as provided above.
  272.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  272.35 - * Version 2 license, then the option applies only if the new code is
  272.36 - * made subject to such option by the copyright holder.
  272.37 - *
  272.38 - * Contributor(s):
  272.39 - *
  272.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  272.41 - */
  272.42 -
  272.43 -package org.netbeans.modules.jackpot30.server.webapi;
  272.44 -
  272.45 -import java.io.IOException;
  272.46 -import java.net.URL;
  272.47 -import java.util.Arrays;
  272.48 -import java.util.Collection;
  272.49 -import java.util.HashMap;
  272.50 -import java.util.LinkedList;
  272.51 -import java.util.List;
  272.52 -import java.util.Map;
  272.53 -import java.util.Map.Entry;
  272.54 -import javax.tools.Diagnostic;
  272.55 -import javax.tools.JavaFileObject;
  272.56 -import javax.ws.rs.DefaultValue;
  272.57 -import javax.ws.rs.GET;
  272.58 -import javax.ws.rs.Path;
  272.59 -import javax.ws.rs.Produces;
  272.60 -import javax.ws.rs.QueryParam;
  272.61 -import org.codeviation.pojson.Pojson;
  272.62 -import org.netbeans.modules.jackpot30.impl.examples.Example;
  272.63 -import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
  272.64 -import org.netbeans.modules.jackpot30.impl.examples.LoadExamples;
  272.65 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
  272.66 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
  272.67 -import org.netbeans.modules.jackpot30.impl.indexing.Index;
  272.68 -import org.netbeans.modules.jackpot30.server.indexer.StandaloneFinder;
  272.69 -
  272.70 -/**
  272.71 - *
  272.72 - * @author lahvac
  272.73 - */
  272.74 -@Path("/")
  272.75 -public class API {
  272.76 -
  272.77 -    @GET
  272.78 -    @Path("/find")
  272.79 -    @Produces("text/plain")
  272.80 -    public String find(@QueryParam("path") String segment, @QueryParam("pattern") String pattern) throws IOException {
  272.81 -        StringBuilder sb = new StringBuilder();
  272.82 -
  272.83 -        for (String candidate : StandaloneFinder.findCandidates(Cache.sourceRootForKey(segment), pattern)) {
  272.84 -            sb.append(candidate);
  272.85 -            sb.append("\n");
  272.86 -        }
  272.87 -
  272.88 -        return sb.toString();
  272.89 -    }
  272.90 -
  272.91 -    @GET
  272.92 -    @Path("/findSpans")
  272.93 -    @Produces("text/plain")
  272.94 -    public String findSpans(@QueryParam("path") String segment, @QueryParam("relativePath") String relativePath, @QueryParam("pattern") String pattern) throws IOException {
  272.95 -        StringBuilder sb = new StringBuilder();
  272.96 -
  272.97 -        for (int o : StandaloneFinder.findCandidateOccurrenceSpans(Cache.sourceRootForKey(segment), relativePath, pattern)) {
  272.98 -            sb.append(o);
  272.99 -            sb.append(":");
 272.100 -        }
 272.101 -
 272.102 -        if (sb.length() > 0) {
 272.103 -            sb.delete(sb.length() - 1, sb.length());
 272.104 -        }
 272.105 -
 272.106 -        return sb.toString();
 272.107 -    }
 272.108 -
 272.109 -    @GET
 272.110 -    @Path("/list")
 272.111 -    @Produces("text/plain")
 272.112 -    public String list() throws IOException {
 272.113 -        StringBuilder sb = new StringBuilder();
 272.114 -
 272.115 -        for (String root : Cache.knownSourceRoots()) {
 272.116 -            URL sourceRoot = Cache.sourceRootForKey(root).toURI().toURL();
 272.117 -            Index index = FileBasedIndex.get(sourceRoot);
 272.118 -            String displayName;
 272.119 -
 272.120 -            if (index != null && index.getIndexInfo().displayName != null) {
 272.121 -                displayName = index.getIndexInfo().displayName;
 272.122 -            } else {
 272.123 -                String path = sourceRoot.getPath().replaceFirst("/$", "");
 272.124 -                
 272.125 -                displayName = path.substring(path.lastIndexOf('/') + 1);
 272.126 -            }
 272.127 -
 272.128 -            sb.append(root);
 272.129 -            sb.append(":");
 272.130 -            sb.append(displayName);
 272.131 -            sb.append("\n");
 272.132 -        }
 272.133 -
 272.134 -        return sb.toString();
 272.135 -    }
 272.136 -
 272.137 -    @GET
 272.138 -    @Path("/cat")
 272.139 -    @Produces("text/plain")
 272.140 -    public String cat(@QueryParam("path") String segment, @QueryParam("relative") String relative) throws IOException {
 272.141 -        URL sourceRoot = Cache.sourceRootForKey(segment).toURI().toURL();
 272.142 -        Index index = FileBasedIndex.get(sourceRoot);
 272.143 -
 272.144 -        if (index == null) {
 272.145 -            throw new IOException("No index");
 272.146 -        }
 272.147 -
 272.148 -        CharSequence source = index.getSourceCode(relative);
 272.149 -
 272.150 -        if (source == null) {
 272.151 -            throw new IOException("Source code not found");
 272.152 -        }
 272.153 -        
 272.154 -        return source.toString().replaceAll("\r\n", "\n");
 272.155 -    }
 272.156 -
 272.157 -    @GET
 272.158 -    @Path("/info")
 272.159 -    @Produces("text/plain")
 272.160 -    public String info(@QueryParam("path") String segment) throws IOException {
 272.161 -        URL sourceRoot = Cache.sourceRootForKey(segment).toURI().toURL();
 272.162 -        Index index = FileBasedIndex.get(sourceRoot);
 272.163 -
 272.164 -        if (index == null) {
 272.165 -            throw new IOException("No index");
 272.166 -        }
 272.167 -
 272.168 -        return Pojson.save(index.getIndexInfo());
 272.169 -    }
 272.170 -
 272.171 -    @GET
 272.172 -    @Path("/examples")
 272.173 -    @Produces("text/plain")
 272.174 -    public String examples() throws IOException {
 272.175 -        List<Map<String, String>> examples = new LinkedList<Map<String, String>>();
 272.176 -
 272.177 -        for (Example ex : LoadExamples.loadExamples()) {
 272.178 -            if (ex.getOptions().contains(Option.VERIFY) || ex.getOptions().contains(Option.FIX)) continue;
 272.179 -            Map<String, String> desc = new HashMap<String, String>();
 272.180 -
 272.181 -            desc.put("displayName", ex.getDisplayName());
 272.182 -            desc.put("pattern", ex.getCode());
 272.183 -
 272.184 -            examples.add(desc);
 272.185 -        }
 272.186 -
 272.187 -        return Pojson.save(examples);
 272.188 -    }
 272.189 -
 272.190 -    @GET
 272.191 -    @Path("/errors")
 272.192 -    @Produces("text/plain")
 272.193 -    public String errors(@QueryParam("pattern") String pattern) throws IOException {
 272.194 -        StringBuilder sb = new StringBuilder();
 272.195 -
 272.196 -        for (Diagnostic<? extends JavaFileObject> d : StandaloneFinder.parseAndReportErrors(pattern)) {
 272.197 -            sb.append(d.getMessage(null));
 272.198 -            sb.append("\n");
 272.199 -        }
 272.200 -
 272.201 -        return sb.toString();
 272.202 -    }
 272.203 -
 272.204 -    @GET
 272.205 -    @Path("/findDuplicates")
 272.206 -    @Produces("text/plain")
 272.207 -    public String findDuplicates(@QueryParam("path") String segment, @QueryParam("hashes") String hashes) throws IOException {
 272.208 -        Map<String, Map<String, Collection<? extends String>>> hash2Segment2Contains = new HashMap<String, Map<String, Collection<? extends String>>>();
 272.209 -        Collection<String> segments = new LinkedList<String>();
 272.210 -
 272.211 -        if (segment != null) segments.add(segment);
 272.212 -        else {
 272.213 -            for (String key : Cache.knownSourceRoots()) {
 272.214 -                segments.add(key);
 272.215 -            }
 272.216 -        }
 272.217 -
 272.218 -        Iterable<? extends String> hashesList = Arrays.asList(Pojson.load(String[].class, hashes));
 272.219 -
 272.220 -        for (String key : segments) {
 272.221 -            Map<String, Collection<? extends String>> found = StandaloneFinder.containsHash(Cache.sourceRootForKey(key), hashesList);
 272.222 -
 272.223 -            for (Entry<String, Collection<? extends String>> e : found.entrySet()) {
 272.224 -                Map<String, Collection<? extends String>> perRoot = hash2Segment2Contains.get(e.getKey());
 272.225 -
 272.226 -                if (perRoot == null) {
 272.227 -                    hash2Segment2Contains.put(e.getKey(), perRoot = new HashMap<String, Collection<? extends String>>());
 272.228 -                }
 272.229 -
 272.230 -                perRoot.put(key, e.getValue());
 272.231 -            }
 272.232 -        }
 272.233 -
 272.234 -        return Pojson.save(hash2Segment2Contains);
 272.235 -    }
 272.236 -}
   273.1 --- a/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/Main.java	Sun Jan 08 20:10:08 2017 +0100
   273.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   273.3 @@ -1,93 +0,0 @@
   273.4 -/*
   273.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   273.6 - *
   273.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
   273.8 - *
   273.9 - * The contents of this file are subject to the terms of either the GNU
  273.10 - * General Public License Version 2 only ("GPL") or the Common
  273.11 - * Development and Distribution License("CDDL") (collectively, the
  273.12 - * "License"). You may not use this file except in compliance with the
  273.13 - * License. You can obtain a copy of the License at
  273.14 - * http://www.netbeans.org/cddl-gplv2.html
  273.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  273.16 - * specific language governing permissions and limitations under the
  273.17 - * License.  When distributing the software, include this License Header
  273.18 - * Notice in each file and include the License file at
  273.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  273.20 - * particular file as subject to the "Classpath" exception as provided
  273.21 - * by Sun in the GPL Version 2 section of the License file that
  273.22 - * accompanied this code. If applicable, add the following below the
  273.23 - * License Header, with the fields enclosed by brackets [] replaced by
  273.24 - * your own identifying information:
  273.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  273.26 - *
  273.27 - * If you wish your version of this file to be governed by only the CDDL
  273.28 - * or only the GPL Version 2, indicate your decision by adding
  273.29 - * "[Contributor] elects to include this software in this distribution
  273.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  273.31 - * single choice of license, a recipient has the option to distribute
  273.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  273.33 - * to extend the choice of license to its licensees as provided above.
  273.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  273.35 - * Version 2 license, then the option applies only if the new code is
  273.36 - * made subject to such option by the copyright holder.
  273.37 - *
  273.38 - * Contributor(s):
  273.39 - *
  273.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  273.41 - */
  273.42 -
  273.43 -package org.netbeans.modules.jackpot30.server.webapi;
  273.44 -
  273.45 -import com.sun.grizzly.http.embed.GrizzlyWebServer;
  273.46 -import com.sun.grizzly.http.servlet.ServletAdapter;
  273.47 -import com.sun.grizzly.tcp.http11.GrizzlyAdapter;
  273.48 -import com.sun.grizzly.tcp.http11.GrizzlyRequest;
  273.49 -import com.sun.grizzly.tcp.http11.GrizzlyResponse;
  273.50 -import com.sun.jersey.spi.container.servlet.ServletContainer;
  273.51 -import java.io.File;
  273.52 -import java.io.IOException;
  273.53 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
  273.54 -
  273.55 -/**
  273.56 - *
  273.57 - * @author lahvac
  273.58 - */
  273.59 -public class Main {
  273.60 -
  273.61 -    /**
  273.62 -     * @param args the command line arguments
  273.63 -     */
  273.64 -    public static void main(String[] args) throws IOException {
  273.65 -        if (args.length != 1 && args.length != 2) {
  273.66 -            System.err.println("Usage: java -jar " + Main.class.getProtectionDomain().getCodeSource().getLocation().getPath() + " <cache> [<static-content>]");
  273.67 -            return ;
  273.68 -        }
  273.69 -        
  273.70 -        Cache.setStandaloneCacheRoot(new File(args[0]));
  273.71 -
  273.72 -        GrizzlyWebServer gws;
  273.73 -        
  273.74 -        if (args.length == 2) {
  273.75 -            gws = new GrizzlyWebServer(9998, args[1]);
  273.76 -        } else {
  273.77 -            gws = new GrizzlyWebServer(9998);
  273.78 -        }
  273.79 -
  273.80 -        // Jersey web resources
  273.81 -        ServletAdapter jerseyAdapter = new ServletAdapter();
  273.82 -        jerseyAdapter.addInitParameter("com.sun.jersey.config.property.packages", "org.netbeans.modules.jackpot30.server.webapi");
  273.83 -        jerseyAdapter.setContextPath("/index");
  273.84 -        jerseyAdapter.setServletInstance(new ServletContainer());
  273.85 -
  273.86 -        // register all above defined adapters
  273.87 -        gws.addGrizzlyAdapter(jerseyAdapter);
  273.88 -        gws.addGrizzlyAdapter(new GrizzlyAdapter(){
  273.89 -            public void service(GrizzlyRequest request, GrizzlyResponse response){}
  273.90 -        });
  273.91 -
  273.92 -        // let Grizzly run
  273.93 -        gws.start();
  273.94 -    }
  273.95 -
  273.96 -}
   274.1 --- a/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/UI.java	Sun Jan 08 20:10:08 2017 +0100
   274.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   274.3 @@ -1,274 +0,0 @@
   274.4 -/*
   274.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   274.6 - *
   274.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
   274.8 - *
   274.9 - * The contents of this file are subject to the terms of either the GNU
  274.10 - * General Public License Version 2 only ("GPL") or the Common
  274.11 - * Development and Distribution License("CDDL") (collectively, the
  274.12 - * "License"). You may not use this file except in compliance with the
  274.13 - * License. You can obtain a copy of the License at
  274.14 - * http://www.netbeans.org/cddl-gplv2.html
  274.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  274.16 - * specific language governing permissions and limitations under the
  274.17 - * License.  When distributing the software, include this License Header
  274.18 - * Notice in each file and include the License file at
  274.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  274.20 - * particular file as subject to the "Classpath" exception as provided
  274.21 - * by Sun in the GPL Version 2 section of the License file that
  274.22 - * accompanied this code. If applicable, add the following below the
  274.23 - * License Header, with the fields enclosed by brackets [] replaced by
  274.24 - * your own identifying information:
  274.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  274.26 - *
  274.27 - * If you wish your version of this file to be governed by only the CDDL
  274.28 - * or only the GPL Version 2, indicate your decision by adding
  274.29 - * "[Contributor] elects to include this software in this distribution
  274.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  274.31 - * single choice of license, a recipient has the option to distribute
  274.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  274.33 - * to extend the choice of license to its licensees as provided above.
  274.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  274.35 - * Version 2 license, then the option applies only if the new code is
  274.36 - * made subject to such option by the copyright holder.
  274.37 - *
  274.38 - * Contributor(s):
  274.39 - *
  274.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
  274.41 - */
  274.42 -
  274.43 -package org.netbeans.modules.jackpot30.server.webapi;
  274.44 -
  274.45 -import freemarker.cache.TemplateLoader;
  274.46 -import freemarker.template.Configuration;
  274.47 -import freemarker.template.Template;
  274.48 -import freemarker.template.TemplateException;
  274.49 -import java.io.IOException;
  274.50 -import java.io.InputStream;
  274.51 -import java.io.InputStreamReader;
  274.52 -import java.io.Reader;
  274.53 -import java.io.StringWriter;
  274.54 -import java.net.URI;
  274.55 -import java.net.URISyntaxException;
  274.56 -import java.util.ArrayList;
  274.57 -import java.util.Collections;
  274.58 -import java.util.HashMap;
  274.59 -import java.util.LinkedList;
  274.60 -import java.util.List;
  274.61 -import java.util.Map;
  274.62 -import javax.ws.rs.GET;
  274.63 -import javax.ws.rs.Path;
  274.64 -import javax.ws.rs.Produces;
  274.65 -import javax.ws.rs.QueryParam;
  274.66 -import org.codeviation.pojson.Pojson;
  274.67 -import org.netbeans.modules.jackpot30.remoting.api.WebUtilities;
  274.68 -import static org.netbeans.modules.jackpot30.remoting.api.WebUtilities.escapeForQuery;
  274.69 -
  274.70 -/**
  274.71 - *
  274.72 - * @author lahvac
  274.73 - */
  274.74 -@Path("/ui")
  274.75 -public class UI {
  274.76 -
  274.77 -    @GET
  274.78 -    @Path("/search")
  274.79 -    @Produces("text/html")
  274.80 -    public String search(@QueryParam("path") String path, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
  274.81 -        Map<String, Object> configurationData = new HashMap<String, Object>();
  274.82 -
  274.83 -        configurationData.put("paths", list());
  274.84 -        configurationData.put("selectedPath", path);
  274.85 -        configurationData.put("pattern", pattern);
  274.86 -        configurationData.put("patternEscaped", escapeForQuery(pattern));
  274.87 -        configurationData.put("examples", loadExamples());
  274.88 -
  274.89 -        if (pattern != null && path != null) {
  274.90 -            URI u = new URI("http://localhost:9998/index/find?path=" + escapeForQuery(path) + "&pattern=" + escapeForQuery(pattern));
  274.91 -            List<Map<String, Object>> results = new LinkedList<Map<String, Object>>();
  274.92 -            long queryTime = System.currentTimeMillis();
  274.93 -            List<String> candidates = new ArrayList<String>(WebUtilities.requestStringArrayResponse(u));
  274.94 -
  274.95 -            queryTime = System.currentTimeMillis() - queryTime;
  274.96 -
  274.97 -            Collections.sort(candidates);
  274.98 -
  274.99 -            for (String c : candidates) {
 274.100 -                Map<String, Object> found = new HashMap<String, Object>(3);
 274.101 -
 274.102 -                found.put("relativePath", c);
 274.103 -
 274.104 -                results.add(found);
 274.105 -            }
 274.106 -
 274.107 -            configurationData.put("results", results);
 274.108 -
 274.109 -            Map<String, Object> statistics = new HashMap<String, Object>();
 274.110 -
 274.111 -            statistics.put("files", candidates.size());
 274.112 -            statistics.put("queryTime", queryTime);
 274.113 -
 274.114 -            configurationData.put("statistics", statistics);
 274.115 -        }
 274.116 -
 274.117 -        return processTemplate("/org/netbeans/modules/jackpot30/server/webapi/ui-search.html", configurationData);
 274.118 -    }
 274.119 -
 274.120 -    @GET
 274.121 -    @Path("/show")
 274.122 -    @Produces("text/html")
 274.123 -    public String show(@QueryParam("path") String path, @QueryParam("relative") String relativePath, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
 274.124 -        Map<String, Object> configurationData = new HashMap<String, Object>();
 274.125 -        List<Map<String, String>> occurrences = new LinkedList<Map<String, String>>();
 274.126 -
 274.127 -        configurationData.put("occurrences", occurrences);
 274.128 -
 274.129 -        URI codeURL = new URI("http://localhost:9998/index/cat?path=" + escapeForQuery(path) + "&relative=" + escapeForQuery(relativePath));
 274.130 -        String code = WebUtilities.requestStringResponse(codeURL);
 274.131 -        URI spansURL = new URI("http://localhost:9998/index/findSpans?path=" + escapeForQuery(path) + "&relativePath=" + escapeForQuery(relativePath) + "&pattern=" + escapeForQuery(pattern));
 274.132 -        int currentCodePos = 0;
 274.133 -        for (int[] span : parseSpans(WebUtilities.requestStringResponse(spansURL))) { //XXX: sorted!
 274.134 -            Map<String, String> occ = new HashMap<String, String>();
 274.135 -            occ.put("prefix", WebUtilities.escapeForHTMLElement(code.substring(currentCodePos, span[0])));
 274.136 -            occ.put("occurrence", WebUtilities.escapeForHTMLElement(code.substring(span[0], span[1])));
 274.137 -            occurrences.add(occ);
 274.138 -            currentCodePos = span[1];
 274.139 -        }
 274.140 -
 274.141 -        configurationData.put("suffix", WebUtilities.escapeForHTMLElement(code.substring(currentCodePos, code.length())));
 274.142 -
 274.143 -        return processTemplate("/org/netbeans/modules/jackpot30/server/webapi/ui-cat.html", configurationData);
 274.144 -    }
 274.145 -    
 274.146 -    @GET
 274.147 -    @Path("/snippet")
 274.148 -    @Produces("text/html")
 274.149 -    public String snippet(@QueryParam("path") String path, @QueryParam("relative") String relativePath, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
 274.150 -        List<Map<String, String>> snippets = new LinkedList<Map<String, String>>();
 274.151 -
 274.152 -        URI codeURL = new URI("http://localhost:9998/index/cat?path=" + escapeForQuery(path) + "&relative=" + escapeForQuery(relativePath));
 274.153 -        String code = WebUtilities.requestStringResponse(codeURL);
 274.154 -        URI spansURL = new URI("http://localhost:9998/index/findSpans?path=" + escapeForQuery(path) + "&relativePath=" + escapeForQuery(relativePath) + "&pattern=" + escapeForQuery(pattern));
 274.155 -
 274.156 -        for (int[] span : parseSpans(WebUtilities.requestStringResponse(spansURL))) {
 274.157 -            snippets.add(prepareSnippet(code, span));
 274.158 -        }
 274.159 -
 274.160 -        return processTemplate("/org/netbeans/modules/jackpot30/server/webapi/ui-snippet.html", Collections.<String, Object>singletonMap("snippets", snippets));
 274.161 -    }
 274.162 -
 274.163 -    private static List<Map<String, String>> list() throws URISyntaxException {
 274.164 -        List<Map<String, String>> result = new LinkedList<Map<String, String>>();
 274.165 -
 274.166 -        for (String enc : WebUtilities.requestStringArrayResponse(new URI("http://localhost:9998/index/list"))) {
 274.167 -            Map<String, String> rootDesc = new HashMap<String, String>();
 274.168 -            String[] col = enc.split(":", 2);
 274.169 -
 274.170 -            rootDesc.put("segment", col[0]);
 274.171 -            rootDesc.put("displayName", col[1]);
 274.172 -            result.add(rootDesc);
 274.173 -        }
 274.174 -
 274.175 -        return result;
 274.176 -    }
 274.177 -    
 274.178 -    private static Iterable<int[]> parseSpans(String from) {
 274.179 -        if (from.isEmpty()) {
 274.180 -            return Collections.emptyList();
 274.181 -        }
 274.182 -        String[] split = from.split(":");
 274.183 -        List<int[]> result = new LinkedList<int[]>();
 274.184 -
 274.185 -        for (int i = 0; i < split.length; i += 2) {
 274.186 -            result.add(new int[] {
 274.187 -                Integer.parseInt(split[i + 0].trim()),
 274.188 -                Integer.parseInt(split[i + 1].trim())
 274.189 -            });
 274.190 -        }
 274.191 -
 274.192 -        return result;
 274.193 -    }
 274.194 -
 274.195 -    private static final int DESIRED_CONTEXT = 2;
 274.196 -
 274.197 -    private static Map<String, String> prepareSnippet(String code, int[] span) {
 274.198 -        int grandStart = span[0];
 274.199 -        int firstLineStart = grandStart = lineStart(code, grandStart);
 274.200 -
 274.201 -        while (grandStart > 0 && contextLength(code.substring(grandStart, firstLineStart)) < DESIRED_CONTEXT)
 274.202 -            grandStart = lineStart(code, grandStart - 1);
 274.203 -
 274.204 -        int grandEnd = span[1];
 274.205 -        int firstLineEnd = grandEnd = lineEnd(code, grandEnd);
 274.206 -        
 274.207 -        while (grandEnd < code.length() - 1 && contextLength(code.substring(firstLineEnd, grandEnd)) < DESIRED_CONTEXT)
 274.208 -            grandEnd = lineEnd(code, grandEnd + 1);
 274.209 -
 274.210 -        Map<String, String> result = new HashMap<String, String>();
 274.211 -        
 274.212 -        result.put("prefix", WebUtilities.escapeForHTMLElement(code.substring(grandStart, span[0])));
 274.213 -        result.put("occurrence", WebUtilities.escapeForHTMLElement(code.substring(span[0], span[1])));
 274.214 -        result.put("suffix", WebUtilities.escapeForHTMLElement(code.substring(span[1], grandEnd)));
 274.215 -
 274.216 -        return result;
 274.217 -    }
 274.218 -
 274.219 -    private static int lineStart(String code, int o) {
 274.220 -        while (o > 0 && code.charAt(o) != '\n') {
 274.221 -            o--;
 274.222 -        }
 274.223 -
 274.224 -        return o;
 274.225 -    }
 274.226 -
 274.227 -    private static int lineEnd(String code, int o) {
 274.228 -        while (o < code.length() - 1 && code.charAt(o) != '\n') {
 274.229 -            o++;
 274.230 -        }
 274.231 -
 274.232 -        return o;
 274.233 -    }
 274.234 -
 274.235 -    private static int contextLength(String in) {
 274.236 -        return in.replaceAll("\n[ \t]*\n", "\n").trim().split("\n").length;
 274.237 -    }
 274.238 -
 274.239 -    @SuppressWarnings("unchecked")
 274.240 -    private List<Map<String, String>> loadExamples() throws IOException, URISyntaxException {
 274.241 -        return Pojson.load(LinkedList.class, new URI("http://localhost:9998/index/examples"));
 274.242 -    }
 274.243 -
 274.244 -    private static String processTemplate(String template, Map<String, Object> configurationData) throws TemplateException, IOException {
 274.245 -        Configuration conf = new Configuration();
 274.246 -
 274.247 -        conf.setTemplateLoader(new TemplateLoaderImpl());
 274.248 -
 274.249 -        Template templ = conf.getTemplate(template);
 274.250 -        StringWriter out = new StringWriter();
 274.251 -
 274.252 -        templ.process(configurationData, out);
 274.253 -
 274.254 -        return out.toString();
 274.255 -    }
 274.256 -
 274.257 -    private static final class TemplateLoaderImpl implements TemplateLoader {
 274.258 -
 274.259 -        public Object findTemplateSource(String name) throws IOException {
 274.260 -            return TemplateLoaderImpl.class.getResourceAsStream("/" + name);
 274.261 -        }
 274.262 -
 274.263 -        public long getLastModified(Object templateSource) {
 274.264 -            return 0L;
 274.265 -        }
 274.266 -
 274.267 -        public Reader getReader(Object templateSource, String encoding) throws IOException {
 274.268 -            InputStream in = (InputStream) templateSource;
 274.269 -
 274.270 -            return new InputStreamReader(in);
 274.271 -        }
 274.272 -
 274.273 -        public void closeTemplateSource(Object templateSource) throws IOException {
 274.274 -        }
 274.275 -    }
 274.276 -
 274.277 -}
   275.1 --- a/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-cat.html	Sun Jan 08 20:10:08 2017 +0100
   275.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   275.3 @@ -1,10 +0,0 @@
   275.4 -<html>
   275.5 -<head>
   275.6 -    <style type="text/css">
   275.7 -        .occurrence {BACKGROUND: #DDDD00;}
   275.8 -    </style>
   275.9 -</head>
  275.10 -<body>
  275.11 -<pre><#list occurrences as occurrence>${occurrence.prefix}<span class="occurrence">${occurrence.occurrence}</span></#list>${suffix}</pre>
  275.12 -</body>
  275.13 -</html>
   276.1 --- a/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-search.html	Sun Jan 08 20:10:08 2017 +0100
   276.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   276.3 @@ -1,70 +0,0 @@
   276.4 -<html>
   276.5 -<head>
   276.6 -    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
   276.7 -<#if results??>
   276.8 -    <script type="text/javascript">
   276.9 -        $(document).ready(function() {
  276.10 -            $('#list').find('dd').hide().end().find('dt').click(function() {
  276.11 -                current_dd=$(this).next();
  276.12 -                //XXX: will do the AJAX call for both show and hide!
  276.13 -                $.get("snippet?path=${selectedPath}&relative=" + current_dd.attr("id") + "&pattern=${patternEscaped}",function(data) {
  276.14 -                    current_dd.html(data).slideToggle();
  276.15 -                })
  276.16 -            });
  276.17 -        });
  276.18 -    </script>
  276.19 -</#if>
  276.20 -    <style type="text/css">
  276.21 -        .occurrence {BACKGROUND: #DDDD00;}
  276.22 -    </style>
  276.23 -</head>
  276.24 -<body>
  276.25 -<form method="get">
  276.26 -
  276.27 -<label for="path">Project:</label>
  276.28 -<select size="1" name="path">");
  276.29 -    <#list paths as path>
  276.30 -        <option <#if selectedPath?? && path.segment == selectedPath>selected</#if> value="${path.segment}">
  276.31 -            ${path.displayName}
  276.32 -        </option>
  276.33 -    </#list>
  276.34 -</select>
  276.35 -<br>
  276.36 -<label for="pattern">Pattern:</label><br>
  276.37 -<textarea rows="10" cols="40" name="pattern">
  276.38 -<#if pattern??>
  276.39 -${pattern}
  276.40 -</#if>
  276.41 -</textarea><br>
  276.42 -<input type="submit" name="Find Candidates"/>
  276.43 -</form>
  276.44 -
  276.45 -<div class="examples">
  276.46 -<#if examples??>
  276.47 -    Examples:
  276.48 -    <dl id="examples-list">
  276.49 -        <#list examples as example>
  276.50 -            <dt>${example.displayName}</dt>
  276.51 -            <dd><pre>${example.pattern}</pre>
  276.52 -            </dd>
  276.53 -        </#list>
  276.54 -    </dl>
  276.55 -</#if>
  276.56 -</div>
  276.57 -
  276.58 -<#if results??>
  276.59 -    Found candidates for pattern: ${pattern}
  276.60 -    <dl id="list">
  276.61 -        <#list results as result>
  276.62 -            <dt>${result.relativePath}<a href="/index/ui/show?path=${selectedPath}&relative=${result.relativePath}&pattern=${patternEscaped}">show</a></dt>
  276.63 -            <dd id="${result.relativePath}">
  276.64 -            </dd>
  276.65 -        </#list>
  276.66 -    </dl>
  276.67 -</#if>
  276.68 -
  276.69 -<#if statistics??>
  276.70 -     Query time: ${statistics.queryTime}ms, matching files: ${statistics.files}.
  276.71 -</#if>
  276.72 -</body>
  276.73 -</html>
   277.1 --- a/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-snippet.html	Sun Jan 08 20:10:08 2017 +0100
   277.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   277.3 @@ -1,7 +0,0 @@
   277.4 -<#if snippets??>
   277.5 -    <#list snippets as snippet>
   277.6 -        <pre>${snippet.prefix}<span class="occurrence">${snippet.occurrence}</span>${snippet.suffix}</pre><br>
   277.7 -    </#list>
   277.8 -<#else>
   277.9 -    No occurrences.
  277.10 -</#if>
   278.1 --- a/sandbox/old-modules/server/web.api/test/org/netbeans/modules/jackpot30/server/webapi/APITest.java	Sun Jan 08 20:10:08 2017 +0100
   278.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   278.3 @@ -1,107 +0,0 @@
   278.4 -/*
   278.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   278.6 - *
   278.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   278.8 - *
   278.9 - * The contents of this file are subject to the terms of either the GNU
  278.10 - * General Public License Version 2 only ("GPL") or the Common
  278.11 - * Development and Distribution License("CDDL") (collectively, the
  278.12 - * "License"). You may not use this file except in compliance with the
  278.13 - * License. You can obtain a copy of the License at
  278.14 - * http://www.netbeans.org/cddl-gplv2.html
  278.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  278.16 - * specific language governing permissions and limitations under the
  278.17 - * License.  When distributing the software, include this License Header
  278.18 - * Notice in each file and include the License file at
  278.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  278.20 - * particular file as subject to the "Classpath" exception as provided
  278.21 - * by Sun in the GPL Version 2 section of the License file that
  278.22 - * accompanied this code. If applicable, add the following below the
  278.23 - * License Header, with the fields enclosed by brackets [] replaced by
  278.24 - * your own identifying information:
  278.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  278.26 - *
  278.27 - * If you wish your version of this file to be governed by only the CDDL
  278.28 - * or only the GPL Version 2, indicate your decision by adding
  278.29 - * "[Contributor] elects to include this software in this distribution
  278.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  278.31 - * single choice of license, a recipient has the option to distribute
  278.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  278.33 - * to extend the choice of license to its licensees as provided above.
  278.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  278.35 - * Version 2 license, then the option applies only if the new code is
  278.36 - * made subject to such option by the copyright holder.
  278.37 - *
  278.38 - * Contributor(s):
  278.39 - *
  278.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
  278.41 - */
  278.42 -
  278.43 -package org.netbeans.modules.jackpot30.server.webapi;
  278.44 -
  278.45 -import java.io.ByteArrayInputStream;
  278.46 -import java.io.File;
  278.47 -import java.io.FileOutputStream;
  278.48 -import java.io.InputStream;
  278.49 -import org.junit.Assert;
  278.50 -import org.junit.Before;
  278.51 -import org.junit.Test;
  278.52 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
  278.53 -import org.netbeans.modules.jackpot30.server.indexer.StandaloneIndexer;
  278.54 -
  278.55 -/**
  278.56 - *
  278.57 - * @author lahvac
  278.58 - */
  278.59 -public class APITest {
  278.60 -
  278.61 -    public APITest() {
  278.62 -    }
  278.63 -
  278.64 -    private File src;
  278.65 -
  278.66 -    @Before
  278.67 -    public void setUp() throws Exception {
  278.68 -        File source = new File(APITest.class.getProtectionDomain().getCodeSource().getLocation().getPath());
  278.69 -        File workingDirectory = new File(source.getParentFile(), "wd");
  278.70 -        File cache = new File(workingDirectory, "cache");
  278.71 -
  278.72 -        src = new File(workingDirectory, "src");
  278.73 -
  278.74 -        Cache.setStandaloneCacheRoot(cache);
  278.75 -
  278.76 -        copyStringToFile(new File(src, "test/Test1.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
  278.77 -
  278.78 -        StandaloneIndexer.index(src, false, false, null, null);
  278.79 -    }
  278.80 -
  278.81 -    public final static void copyStringToFile (File f, String content) throws Exception {
  278.82 -        f.getParentFile().mkdirs();
  278.83 -        
  278.84 -        FileOutputStream os = new FileOutputStream(f);
  278.85 -        InputStream is = new ByteArrayInputStream(content.getBytes("UTF-8"));
  278.86 -        int read;
  278.87 -        while ((read = is.read()) != (-1)) {
  278.88 -            os.write(read);
  278.89 -        }
  278.90 -        os.close ();
  278.91 -        is.close();
  278.92 -    }
  278.93 -
  278.94 -    @Test
  278.95 -    public void testFind() throws Exception {
  278.96 -        String cacheKey = null;
  278.97 -
  278.98 -        for (String key : Cache.knownSourceRoots()) {
  278.99 -            if (src.getAbsolutePath().equals(Cache.sourceRootForKey(key).getAbsolutePath())) {
 278.100 -                cacheKey = key;
 278.101 -                break;
 278.102 -            }
 278.103 -        }
 278.104 -
 278.105 -        Assert.assertNotNull(cacheKey);
 278.106 -
 278.107 -        Assert.assertEquals("test/Test1.java\n", new API().find(cacheKey, "$1.isDirectory()"));
 278.108 -    }
 278.109 -
 278.110 -}
 278.111 \ No newline at end of file
   279.1 --- a/sandbox/old-modules/transformer/build.xml	Sun Jan 08 20:10:08 2017 +0100
   279.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   279.3 @@ -1,52 +0,0 @@
   279.4 -<?xml version="1.0" encoding="UTF-8"?>
   279.5 -<!--
   279.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   279.7 -
   279.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   279.9 -
  279.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  279.11 -Other names may be trademarks of their respective owners.
  279.12 -
  279.13 -The contents of this file are subject to the terms of either the GNU
  279.14 -General Public License Version 2 only ("GPL") or the Common
  279.15 -Development and Distribution License("CDDL") (collectively, the
  279.16 -"License"). You may not use this file except in compliance with the
  279.17 -License. You can obtain a copy of the License at
  279.18 -http://www.netbeans.org/cddl-gplv2.html
  279.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  279.20 -specific language governing permissions and limitations under the
  279.21 -License.  When distributing the software, include this License Header
  279.22 -Notice in each file and include the License file at
  279.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  279.24 -particular file as subject to the "Classpath" exception as provided
  279.25 -by Oracle in the GPL Version 2 section of the License file that
  279.26 -accompanied this code. If applicable, add the following below the
  279.27 -License Header, with the fields enclosed by brackets [] replaced by
  279.28 -your own identifying information:
  279.29 -"Portions Copyrighted [year] [name of copyright owner]"
  279.30 -
  279.31 -Contributor(s):
  279.32 -
  279.33 -The Original Software is NetBeans. The Initial Developer of the Original
  279.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  279.35 -Microsystems, Inc. All Rights Reserved.
  279.36 -
  279.37 -If you wish your version of this file to be governed by only the CDDL
  279.38 -or only the GPL Version 2, indicate your decision by adding
  279.39 -"[Contributor] elects to include this software in this distribution
  279.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  279.41 -single choice of license, a recipient has the option to distribute
  279.42 -your version of this file under either the CDDL, the GPL Version 2 or
  279.43 -to extend the choice of license to its licensees as provided above.
  279.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  279.45 -Version 2 license, then the option applies only if the new code is
  279.46 -made subject to such option by the copyright holder.
  279.47 --->
  279.48 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
  279.49 -<!-- for some information on what you could do (e.g. targets to override). -->
  279.50 -<!-- If you delete this file and reopen the project it will be recreated. -->
  279.51 -<project name="org.netbeans.modules.jackpot30.transformers" default="netbeans" basedir=".">
  279.52 -    <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.transformers.</description>
  279.53 -    <import file="nbproject/build-impl.xml"/>
  279.54 -    <import file="${suite.dir}/findbugs-import.xml"/>
  279.55 -</project>
   280.1 --- a/sandbox/old-modules/transformer/manifest.mf	Sun Jan 08 20:10:08 2017 +0100
   280.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   280.3 @@ -1,7 +0,0 @@
   280.4 -Manifest-Version: 1.0
   280.5 -AutoUpdate-Show-In-Client: false
   280.6 -OpenIDE-Module: org.netbeans.modules.jackpot30.transformers
   280.7 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/transformers/resources/layer.xml
   280.8 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/transformers/resources/Bundle.properties
   280.9 -OpenIDE-Module-Specification-Version: 1.16
  280.10 -
   281.1 --- a/sandbox/old-modules/transformer/nbproject/build-impl.xml	Sun Jan 08 20:10:08 2017 +0100
   281.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   281.3 @@ -1,73 +0,0 @@
   281.4 -<?xml version="1.0" encoding="UTF-8"?>
   281.5 -<!--
   281.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   281.7 -
   281.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   281.9 -
  281.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  281.11 -Other names may be trademarks of their respective owners.
  281.12 -
  281.13 -The contents of this file are subject to the terms of either the GNU
  281.14 -General Public License Version 2 only ("GPL") or the Common
  281.15 -Development and Distribution License("CDDL") (collectively, the
  281.16 -"License"). You may not use this file except in compliance with the
  281.17 -License. You can obtain a copy of the License at
  281.18 -http://www.netbeans.org/cddl-gplv2.html
  281.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  281.20 -specific language governing permissions and limitations under the
  281.21 -License.  When distributing the software, include this License Header
  281.22 -Notice in each file and include the License file at
  281.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  281.24 -particular file as subject to the "Classpath" exception as provided
  281.25 -by Oracle in the GPL Version 2 section of the License file that
  281.26 -accompanied this code. If applicable, add the following below the
  281.27 -License Header, with the fields enclosed by brackets [] replaced by
  281.28 -your own identifying information:
  281.29 -"Portions Copyrighted [year] [name of copyright owner]"
  281.30 -
  281.31 -Contributor(s):
  281.32 -
  281.33 -The Original Software is NetBeans. The Initial Developer of the Original
  281.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  281.35 -Microsystems, Inc. All Rights Reserved.
  281.36 -
  281.37 -If you wish your version of this file to be governed by only the CDDL
  281.38 -or only the GPL Version 2, indicate your decision by adding
  281.39 -"[Contributor] elects to include this software in this distribution
  281.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  281.41 -single choice of license, a recipient has the option to distribute
  281.42 -your version of this file under either the CDDL, the GPL Version 2 or
  281.43 -to extend the choice of license to its licensees as provided above.
  281.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  281.45 -Version 2 license, then the option applies only if the new code is
  281.46 -made subject to such option by the copyright holder.
  281.47 --->
  281.48 -<!--
  281.49 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
  281.50 -***         EDIT ../build.xml INSTEAD         ***
  281.51 --->
  281.52 -<project name="org.netbeans.modules.jackpot30.transformers-impl" basedir="..">
  281.53 -    <property file="nbproject/private/suite-private.properties"/>
  281.54 -    <property file="nbproject/suite.properties"/>
  281.55 -    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
  281.56 -    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
  281.57 -    <property file="${suite.dir}/nbproject/platform.properties"/>
  281.58 -    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
  281.59 -        <attribute name="name"/>
  281.60 -        <attribute name="value"/>
  281.61 -        <sequential>
  281.62 -            <property name="@{name}" value="${@{value}}"/>
  281.63 -        </sequential>
  281.64 -    </macrodef>
  281.65 -    <property file="${user.properties.file}"/>
  281.66 -    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  281.67 -    <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
  281.68 -    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
  281.69 -        <condition>
  281.70 -            <not>
  281.71 -                <available file="${harness.dir}" type="dir"/>
  281.72 -            </not>
  281.73 -        </condition>
  281.74 -    </fail>
  281.75 -    <import file="${harness.dir}/build.xml"/>
  281.76 -</project>
   282.1 --- a/sandbox/old-modules/transformer/nbproject/genfiles.properties	Sun Jan 08 20:10:08 2017 +0100
   282.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   282.3 @@ -1,49 +0,0 @@
   282.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   282.5 -#
   282.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   282.7 -#
   282.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   282.9 -# Other names may be trademarks of their respective owners.
  282.10 -#
  282.11 -# The contents of this file are subject to the terms of either the GNU
  282.12 -# General Public License Version 2 only ("GPL") or the Common
  282.13 -# Development and Distribution License("CDDL") (collectively, the
  282.14 -# "License"). You may not use this file except in compliance with the
  282.15 -# License. You can obtain a copy of the License at
  282.16 -# http://www.netbeans.org/cddl-gplv2.html
  282.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  282.18 -# specific language governing permissions and limitations under the
  282.19 -# License.  When distributing the software, include this License Header
  282.20 -# Notice in each file and include the License file at
  282.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  282.22 -# particular file as subject to the "Classpath" exception as provided
  282.23 -# by Oracle in the GPL Version 2 section of the License file that
  282.24 -# accompanied this code. If applicable, add the following below the
  282.25 -# License Header, with the fields enclosed by brackets [] replaced by
  282.26 -# your own identifying information:
  282.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  282.28 -#
  282.29 -# Contributor(s):
  282.30 -#
  282.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  282.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  282.33 -# Microsystems, Inc. All Rights Reserved.
  282.34 -#
  282.35 -# If you wish your version of this file to be governed by only the CDDL
  282.36 -# or only the GPL Version 2, indicate your decision by adding
  282.37 -# "[Contributor] elects to include this software in this distribution
  282.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  282.39 -# single choice of license, a recipient has the option to distribute
  282.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  282.41 -# to extend the choice of license to its licensees as provided above.
  282.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  282.43 -# Version 2 license, then the option applies only if the new code is
  282.44 -# made subject to such option by the copyright holder.
  282.45 -build.xml.data.CRC32=ec1a83f8
  282.46 -build.xml.script.CRC32=14b2fe09
  282.47 -build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
  282.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
  282.49 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
  282.50 -nbproject/build-impl.xml.data.CRC32=9e6fb388
  282.51 -nbproject/build-impl.xml.script.CRC32=99a123ad
  282.52 -nbproject/build-impl.xml.stylesheet.CRC32=68e521fc@2.70
   283.1 --- a/sandbox/old-modules/transformer/nbproject/project.properties	Sun Jan 08 20:10:08 2017 +0100
   283.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   283.3 @@ -1,43 +0,0 @@
   283.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   283.5 -#
   283.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   283.7 -#
   283.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   283.9 -# Other names may be trademarks of their respective owners.
  283.10 -#
  283.11 -# The contents of this file are subject to the terms of either the GNU
  283.12 -# General Public License Version 2 only ("GPL") or the Common
  283.13 -# Development and Distribution License("CDDL") (collectively, the
  283.14 -# "License"). You may not use this file except in compliance with the
  283.15 -# License. You can obtain a copy of the License at
  283.16 -# http://www.netbeans.org/cddl-gplv2.html
  283.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  283.18 -# specific language governing permissions and limitations under the
  283.19 -# License.  When distributing the software, include this License Header
  283.20 -# Notice in each file and include the License file at
  283.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  283.22 -# particular file as subject to the "Classpath" exception as provided
  283.23 -# by Oracle in the GPL Version 2 section of the License file that
  283.24 -# accompanied this code. If applicable, add the following below the
  283.25 -# License Header, with the fields enclosed by brackets [] replaced by
  283.26 -# your own identifying information:
  283.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  283.28 -#
  283.29 -# Contributor(s):
  283.30 -#
  283.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  283.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  283.33 -# Microsystems, Inc. All Rights Reserved.
  283.34 -#
  283.35 -# If you wish your version of this file to be governed by only the CDDL
  283.36 -# or only the GPL Version 2, indicate your decision by adding
  283.37 -# "[Contributor] elects to include this software in this distribution
  283.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  283.39 -# single choice of license, a recipient has the option to distribute
  283.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  283.41 -# to extend the choice of license to its licensees as provided above.
  283.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  283.43 -# Version 2 license, then the option applies only if the new code is
  283.44 -# made subject to such option by the copyright holder.
  283.45 -javac.source=1.5
  283.46 -javac.compilerargs=-Xlint -Xlint:-serial
   284.1 --- a/sandbox/old-modules/transformer/nbproject/project.xml	Sun Jan 08 20:10:08 2017 +0100
   284.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   284.3 @@ -1,200 +0,0 @@
   284.4 -<?xml version="1.0" encoding="UTF-8"?>
   284.5 -<!--
   284.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   284.7 -
   284.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   284.9 -
  284.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  284.11 -Other names may be trademarks of their respective owners.
  284.12 -
  284.13 -The contents of this file are subject to the terms of either the GNU
  284.14 -General Public License Version 2 only ("GPL") or the Common
  284.15 -Development and Distribution License("CDDL") (collectively, the
  284.16 -"License"). You may not use this file except in compliance with the
  284.17 -License. You can obtain a copy of the License at
  284.18 -http://www.netbeans.org/cddl-gplv2.html
  284.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  284.20 -specific language governing permissions and limitations under the
  284.21 -License.  When distributing the software, include this License Header
  284.22 -Notice in each file and include the License file at
  284.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  284.24 -particular file as subject to the "Classpath" exception as provided
  284.25 -by Oracle in the GPL Version 2 section of the License file that
  284.26 -accompanied this code. If applicable, add the following below the
  284.27 -License Header, with the fields enclosed by brackets [] replaced by
  284.28 -your own identifying information:
  284.29 -"Portions Copyrighted [year] [name of copyright owner]"
  284.30 -
  284.31 -Contributor(s):
  284.32 -
  284.33 -The Original Software is NetBeans. The Initial Developer of the Original
  284.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  284.35 -Microsystems, Inc. All Rights Reserved.
  284.36 -
  284.37 -If you wish your version of this file to be governed by only the CDDL
  284.38 -or only the GPL Version 2, indicate your decision by adding
  284.39 -"[Contributor] elects to include this software in this distribution
  284.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  284.41 -single choice of license, a recipient has the option to distribute
  284.42 -your version of this file under either the CDDL, the GPL Version 2 or
  284.43 -to extend the choice of license to its licensees as provided above.
  284.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  284.45 -Version 2 license, then the option applies only if the new code is
  284.46 -made subject to such option by the copyright holder.
  284.47 --->
  284.48 -<project xmlns="http://www.netbeans.org/ns/project/1">
  284.49 -    <type>org.netbeans.modules.apisupport.project</type>
  284.50 -    <configuration>
  284.51 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
  284.52 -            <code-name-base>org.netbeans.modules.jackpot30.transformers</code-name-base>
  284.53 -            <suite-component/>
  284.54 -            <module-dependencies>
  284.55 -                <dependency>
  284.56 -                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
  284.57 -                    <build-prerequisite/>
  284.58 -                    <compile-dependency/>
  284.59 -                    <run-dependency>
  284.60 -                        <release-version>1</release-version>
  284.61 -                        <specification-version>1.19</specification-version>
  284.62 -                    </run-dependency>
  284.63 -                </dependency>
  284.64 -                <dependency>
  284.65 -                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
  284.66 -                    <build-prerequisite/>
  284.67 -                    <compile-dependency/>
  284.68 -                    <run-dependency>
  284.69 -                        <specification-version>0.8.0.1</specification-version>
  284.70 -                    </run-dependency>
  284.71 -                </dependency>
  284.72 -                <dependency>
  284.73 -                    <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
  284.74 -                    <build-prerequisite/>
  284.75 -                    <compile-dependency/>
  284.76 -                    <run-dependency>
  284.77 -                        <specification-version>1.0</specification-version>
  284.78 -                    </run-dependency>
  284.79 -                </dependency>
  284.80 -                <dependency>
  284.81 -                    <code-name-base>org.netbeans.modules.java.hints</code-name-base>
  284.82 -                    <build-prerequisite/>
  284.83 -                    <compile-dependency/>
  284.84 -                    <run-dependency>
  284.85 -                        <release-version>1</release-version>
  284.86 -                        <implementation-version/>
  284.87 -                    </run-dependency>
  284.88 -                </dependency>
  284.89 -                <dependency>
  284.90 -                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
  284.91 -                    <build-prerequisite/>
  284.92 -                    <compile-dependency/>
  284.93 -                    <run-dependency>
  284.94 -                        <specification-version>0.43.0.7.7.1</specification-version>
  284.95 -                    </run-dependency>
  284.96 -                </dependency>
  284.97 -                <dependency>
  284.98 -                    <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
  284.99 -                    <build-prerequisite/>
 284.100 -                    <compile-dependency/>
 284.101 -                    <run-dependency>
 284.102 -                        <release-version>0-1</release-version>
 284.103 -                        <specification-version>1.7.0.7.2</specification-version>
 284.104 -                    </run-dependency>
 284.105 -                </dependency>
 284.106 -                <dependency>
 284.107 -                    <code-name-base>org.openide.filesystems</code-name-base>
 284.108 -                    <build-prerequisite/>
 284.109 -                    <compile-dependency/>
 284.110 -                    <run-dependency>
 284.111 -                        <specification-version>7.21.0.1.1</specification-version>
 284.112 -                    </run-dependency>
 284.113 -                </dependency>
 284.114 -                <dependency>
 284.115 -                    <code-name-base>org.openide.modules</code-name-base>
 284.116 -                    <build-prerequisite/>
 284.117 -                    <compile-dependency/>
 284.118 -                    <run-dependency>
 284.119 -                        <specification-version>7.10</specification-version>
 284.120 -                    </run-dependency>
 284.121 -                </dependency>
 284.122 -                <dependency>
 284.123 -                    <code-name-base>org.openide.util</code-name-base>
 284.124 -                    <build-prerequisite/>
 284.125 -                    <compile-dependency/>
 284.126 -                    <run-dependency>
 284.127 -                        <specification-version>7.22.0.1</specification-version>
 284.128 -                    </run-dependency>
 284.129 -                </dependency>
 284.130 -                <dependency>
 284.131 -                    <code-name-base>org.openide.util.lookup</code-name-base>
 284.132 -                    <build-prerequisite/>
 284.133 -                    <compile-dependency/>
 284.134 -                    <run-dependency>
 284.135 -                        <specification-version>8.0.0.1</specification-version>
 284.136 -                    </run-dependency>
 284.137 -                </dependency>
 284.138 -            </module-dependencies>
 284.139 -            <test-dependencies>
 284.140 -                <test-type>
 284.141 -                    <name>unit</name>
 284.142 -                    <test-dependency>
 284.143 -                        <code-name-base>org.netbeans.bootstrap</code-name-base>
 284.144 -                    </test-dependency>
 284.145 -                    <test-dependency>
 284.146 -                        <code-name-base>org.netbeans.core.startup</code-name-base>
 284.147 -                    </test-dependency>
 284.148 -                    <test-dependency>
 284.149 -                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
 284.150 -                        <compile-dependency/>
 284.151 -                    </test-dependency>
 284.152 -                    <test-dependency>
 284.153 -                        <code-name-base>org.netbeans.modules.classfile</code-name-base>
 284.154 -                    </test-dependency>
 284.155 -                    <test-dependency>
 284.156 -                        <code-name-base>org.netbeans.modules.defaults</code-name-base>
 284.157 -                    </test-dependency>
 284.158 -                    <test-dependency>
 284.159 -                        <code-name-base>org.netbeans.modules.editor</code-name-base>
 284.160 -                    </test-dependency>
 284.161 -                    <test-dependency>
 284.162 -                        <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
 284.163 -                    </test-dependency>
 284.164 -                    <test-dependency>
 284.165 -                        <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
 284.166 -                    </test-dependency>
 284.167 -                    <test-dependency>
 284.168 -                        <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base>
 284.169 -                    </test-dependency>
 284.170 -                    <test-dependency>
 284.171 -                        <code-name-base>org.netbeans.modules.editor.util</code-name-base>
 284.172 -                    </test-dependency>
 284.173 -                    <test-dependency>
 284.174 -                        <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
 284.175 -                        <recursive/>
 284.176 -                        <compile-dependency/>
 284.177 -                    </test-dependency>
 284.178 -                    <test-dependency>
 284.179 -                        <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
 284.180 -                    </test-dependency>
 284.181 -                    <test-dependency>
 284.182 -                        <code-name-base>org.netbeans.modules.masterfs</code-name-base>
 284.183 -                    </test-dependency>
 284.184 -                    <test-dependency>
 284.185 -                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
 284.186 -                        <recursive/>
 284.187 -                        <compile-dependency/>
 284.188 -                    </test-dependency>
 284.189 -                    <test-dependency>
 284.190 -                        <code-name-base>org.netbeans.modules.progress.ui</code-name-base>
 284.191 -                    </test-dependency>
 284.192 -                    <test-dependency>
 284.193 -                        <code-name-base>org.netbeans.modules.projectui</code-name-base>
 284.194 -                    </test-dependency>
 284.195 -                    <test-dependency>
 284.196 -                        <code-name-base>org.openidex.util</code-name-base>
 284.197 -                    </test-dependency>
 284.198 -                </test-type>
 284.199 -            </test-dependencies>
 284.200 -            <public-packages/>
 284.201 -        </data>
 284.202 -    </configuration>
 284.203 -</project>
   285.1 --- a/sandbox/old-modules/transformer/nbproject/suite.properties	Sun Jan 08 20:10:08 2017 +0100
   285.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   285.3 @@ -1,42 +0,0 @@
   285.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   285.5 -#
   285.6 -# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   285.7 -#
   285.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   285.9 -# Other names may be trademarks of their respective owners.
  285.10 -#
  285.11 -# The contents of this file are subject to the terms of either the GNU
  285.12 -# General Public License Version 2 only ("GPL") or the Common
  285.13 -# Development and Distribution License("CDDL") (collectively, the
  285.14 -# "License"). You may not use this file except in compliance with the
  285.15 -# License. You can obtain a copy of the License at
  285.16 -# http://www.netbeans.org/cddl-gplv2.html
  285.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  285.18 -# specific language governing permissions and limitations under the
  285.19 -# License.  When distributing the software, include this License Header
  285.20 -# Notice in each file and include the License file at
  285.21 -# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  285.22 -# particular file as subject to the "Classpath" exception as provided
  285.23 -# by Oracle in the GPL Version 2 section of the License file that
  285.24 -# accompanied this code. If applicable, add the following below the
  285.25 -# License Header, with the fields enclosed by brackets [] replaced by
  285.26 -# your own identifying information:
  285.27 -# "Portions Copyrighted [year] [name of copyright owner]"
  285.28 -#
  285.29 -# Contributor(s):
  285.30 -#
  285.31 -# The Original Software is NetBeans. The Initial Developer of the Original
  285.32 -# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  285.33 -# Microsystems, Inc. All Rights Reserved.
  285.34 -#
  285.35 -# If you wish your version of this file to be governed by only the CDDL
  285.36 -# or only the GPL Version 2, indicate your decision by adding
  285.37 -# "[Contributor] elects to include this software in this distribution
  285.38 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  285.39 -# single choice of license, a recipient has the option to distribute
  285.40 -# your version of this file under either the CDDL, the GPL Version 2 or
  285.41 -# to extend the choice of license to its licensees as provided above.
  285.42 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  285.43 -# Version 2 license, then the option applies only if the new code is
  285.44 -# made subject to such option by the copyright holder.
  285.45 -suite.dir=${basedir}/..
   286.1 Binary file sandbox/old-modules/transformer/release/libs/annotations.jar has changed
   287.1 --- a/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/Annotations.java	Sun Jan 08 20:10:08 2017 +0100
   287.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   287.3 @@ -1,70 +0,0 @@
   287.4 -/*
   287.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   287.6 - *
   287.7 - * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
   287.8 - *
   287.9 - * The contents of this file are subject to the terms of either the GNU
  287.10 - * General Public License Version 2 only ("GPL") or the Common
  287.11 - * Development and Distribution License("CDDL") (collectively, the
  287.12 - * "License"). You may not use this file except in compliance with the
  287.13 - * License. You can obtain a copy of the License at
  287.14 - * http://www.netbeans.org/cddl-gplv2.html
  287.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  287.16 - * specific language governing permissions and limitations under the
  287.17 - * License.  When distributing the software, include this License Header
  287.18 - * Notice in each file and include the License file at
  287.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  287.20 - * particular file as subject to the "Classpath" exception as provided
  287.21 - * by Sun in the GPL Version 2 section of the License file that
  287.22 - * accompanied this code. If applicable, add the following below the
  287.23 - * License Header, with the fields enclosed by brackets [] replaced by
  287.24 - * your own identifying information:
  287.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  287.26 - *
  287.27 - * If you wish your version of this file to be governed by only the CDDL
  287.28 - * or only the GPL Version 2, indicate your decision by adding
  287.29 - * "[Contributor] elects to include this software in this distribution
  287.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  287.31 - * single choice of license, a recipient has the option to distribute
  287.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  287.33 - * to extend the choice of license to its licensees as provided above.
  287.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  287.35 - * Version 2 license, then the option applies only if the new code is
  287.36 - * made subject to such option by the copyright holder.
  287.37 - *
  287.38 - * Contributor(s):
  287.39 - *
  287.40 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
  287.41 - */
  287.42 -
  287.43 -package org.netbeans.modules.jackpot30.transformers;
  287.44 -
  287.45 -/**
  287.46 - *
  287.47 - * @author Jan Lahoda
  287.48 - */
  287.49 -public enum Annotations {
  287.50 -
  287.51 -    TRANSFORMATION_SET("TransformationSet"),
  287.52 -    TRANSFORMATION,
  287.53 -    FIX,
  287.54 -    PATTERN,
  287.55 -    CONSTRAINT;
  287.56 -
  287.57 -    private static final String PACKAGE_NAME = "net.java.lang.annotations.";
  287.58 -    
  287.59 -    private final String specialName;
  287.60 -
  287.61 -    private Annotations() {
  287.62 -        this(null);
  287.63 -    }
  287.64 -
  287.65 -    private Annotations(String specialName) {
  287.66 -        this.specialName = specialName;
  287.67 -    }
  287.68 -    
  287.69 -    public String toFQN() {
  287.70 -        return PACKAGE_NAME + (specialName != null ? specialName : name().charAt(0) + name().substring(1).toLowerCase());
  287.71 -    }
  287.72 -
  287.73 -}
   288.1 --- a/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/TransformationHintProviderImpl.java	Sun Jan 08 20:10:08 2017 +0100
   288.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   288.3 @@ -1,508 +0,0 @@
   288.4 -/*
   288.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   288.6 - *
   288.7 - * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
   288.8 - *
   288.9 - * The contents of this file are subject to the terms of either the GNU
  288.10 - * General Public License Version 2 only ("GPL") or the Common
  288.11 - * Development and Distribution License("CDDL") (collectively, the
  288.12 - * "License"). You may not use this file except in compliance with the
  288.13 - * License. You can obtain a copy of the License at
  288.14 - * http://www.netbeans.org/cddl-gplv2.html
  288.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  288.16 - * specific language governing permissions and limitations under the
  288.17 - * License.  When distributing the software, include this License Header
  288.18 - * Notice in each file and include the License file at
  288.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  288.20 - * particular file as subject to the "Classpath" exception as provided
  288.21 - * by Sun in the GPL Version 2 section of the License file that
  288.22 - * accompanied this code. If applicable, add the following below the
  288.23 - * License Header, with the fields enclosed by brackets [] replaced bysanno
  288.24 - * your own identifying information:
  288.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  288.26 - *
  288.27 - * If you wish your version of this file to be governed by only the CDDL
  288.28 - * or only the GPL Version 2, indicate your decision by adding
  288.29 - * "[Contributor] elects to include this software in this distribution
  288.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  288.31 - * single choice of license, a recipient has the option to distribute
  288.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  288.33 - * to extend the choice of license to its licensees as provided above.
  288.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  288.35 - * Version 2 license, then the option applies only if the new code is
  288.36 - * made subject to such option by the copyright holder.
  288.37 - *
  288.38 - * Contributor(s):
  288.39 - *
  288.40 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
  288.41 - */
  288.42 -
  288.43 -package org.netbeans.modules.jackpot30.transformers;
  288.44 -
  288.45 -import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
  288.46 -import org.netbeans.modules.java.hints.spi.AbstractHint.HintSeverity;
  288.47 -import org.netbeans.modules.java.hints.jackpot.spi.support.ErrorDescriptionFactory;
  288.48 -import org.netbeans.modules.java.hints.jackpot.spi.ElementBasedHintProvider;
  288.49 -import org.netbeans.modules.java.hints.jackpot.spi.HintContext;
  288.50 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
  288.51 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.Worker;
  288.52 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescriptionFactory;
  288.53 -import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata;
  288.54 -import org.netbeans.modules.java.hints.jackpot.spi.JavaFix;
  288.55 -import com.sun.source.tree.Tree;
  288.56 -import com.sun.source.util.SourcePositions;
  288.57 -import com.sun.source.util.TreePath;
  288.58 -import java.io.File;
  288.59 -import java.io.IOException;
  288.60 -import java.net.URL;
  288.61 -import java.util.Collection;
  288.62 -import java.util.Collections;
  288.63 -import java.util.EnumSet;
  288.64 -import java.util.HashMap;
  288.65 -import java.util.HashSet;
  288.66 -import java.util.LinkedList;
  288.67 -import java.util.List;
  288.68 -import java.util.Map;
  288.69 -import java.util.Map.Entry;
  288.70 -import java.util.Set;
  288.71 -import java.util.concurrent.atomic.AtomicBoolean;
  288.72 -import java.util.regex.Matcher;
  288.73 -import javax.lang.model.element.AnnotationMirror;
  288.74 -import javax.lang.model.element.AnnotationValue;
  288.75 -import javax.lang.model.element.Element;
  288.76 -import javax.lang.model.element.ElementKind;
  288.77 -import javax.lang.model.element.ExecutableElement;
  288.78 -import javax.lang.model.element.Modifier;
  288.79 -import javax.lang.model.element.PackageElement;
  288.80 -import javax.lang.model.element.TypeElement;
  288.81 -import javax.lang.model.type.DeclaredType;
  288.82 -import javax.lang.model.type.TypeMirror;
  288.83 -import javax.lang.model.util.ElementFilter;
  288.84 -import org.netbeans.api.java.classpath.ClassPath;
  288.85 -import org.netbeans.api.java.source.ClasspathInfo;
  288.86 -import org.netbeans.api.java.source.ClasspathInfo.PathKind;
  288.87 -import org.netbeans.api.java.source.CompilationController;
  288.88 -import org.netbeans.api.java.source.CompilationInfo;
  288.89 -import org.netbeans.api.java.source.ElementHandle;
  288.90 -import org.netbeans.api.java.source.JavaSource;
  288.91 -import org.netbeans.api.java.source.Task;
  288.92 -import org.netbeans.api.java.source.TypeMirrorHandle;
  288.93 -import org.netbeans.api.java.source.support.CancellableTreePathScanner;
  288.94 -import org.netbeans.spi.editor.hints.ErrorDescription;
  288.95 -import org.netbeans.spi.editor.hints.Fix;
  288.96 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
  288.97 -import org.openide.filesystems.FileUtil;
  288.98 -import org.openide.modules.InstalledFileLocator;
  288.99 -import org.openide.util.Exceptions;
 288.100 -
 288.101 -import org.openide.util.lookup.ServiceProvider;
 288.102 -import static org.netbeans.modules.jackpot30.transformers.Annotations.*;
 288.103 -
 288.104 -/**
 288.105 - *
 288.106 - * @author Jan Lahoda
 288.107 - */
 288.108 -@ServiceProvider(service=ElementBasedHintProvider.class)
 288.109 -public class TransformationHintProviderImpl implements ElementBasedHintProvider {
 288.110 -
 288.111 -    private JavaSource prepareJavaSource(CompilationInfo info) {
 288.112 -        ClasspathInfo currentCP = info.getClasspathInfo();
 288.113 -        ClassPath overlayCompileCP = prepareOverlayCompileCP();
 288.114 -        ClassPath extendedCompileCP = ClassPathSupport.createProxyClassPath(overlayCompileCP, currentCP.getClassPath(PathKind.COMPILE));
 288.115 -        ClassPath overlayBootCP = prepareOverlayBootCP();
 288.116 -        ClassPath extendedBootCP = ClassPathSupport.createProxyClassPath(overlayBootCP, currentCP.getClassPath(PathKind.BOOT));
 288.117 -        ClasspathInfo extendedCPInfo = ClasspathInfo.create(extendedBootCP, extendedCompileCP, currentCP.getClassPath(PathKind.SOURCE));
 288.118 -
 288.119 -        return JavaSource.create(extendedCPInfo);
 288.120 -    }
 288.121 -    
 288.122 -    public Collection<? extends HintDescription> computeHints(final CompilationInfo info) {
 288.123 -        final List<HintDescription> hints = new LinkedList<HintDescription>();
 288.124 -
 288.125 -        if (ANNOTATIONS_JAR != null && (JDK_OVERLAY_JAR != null || NB_OVERLAY_JAR != null)) {
 288.126 -            try {
 288.127 -                prepareJavaSource(info).runUserActionTask(new Task<CompilationController>() {
 288.128 -                    public void run(final CompilationController overlayInfo) throws Exception {
 288.129 -                        List<HintDescription> w = doComputeHints(info, overlayInfo);
 288.130 -
 288.131 -                        if (w != null) {
 288.132 -                            hints.addAll(w);
 288.133 -                        }
 288.134 -                    }
 288.135 -                }, true);
 288.136 -            } catch (IOException ex) {
 288.137 -                Exceptions.printStackTrace(ex);
 288.138 -            }
 288.139 -        } else {
 288.140 -            List<HintDescription> w = doComputeHints(info, null);
 288.141 -
 288.142 -            if (w != null) {
 288.143 -                hints.addAll(w);
 288.144 -            }
 288.145 -        }
 288.146 -
 288.147 -        return hints;
 288.148 -    }
 288.149 -
 288.150 -    private static final Set<ElementKind> KINDS_FOR_ELEMENT_HANDLE = EnumSet.of(
 288.151 -            ElementKind.PACKAGE, ElementKind.CLASS, ElementKind.INTERFACE, ElementKind.ENUM,
 288.152 -            ElementKind.ANNOTATION_TYPE, ElementKind.METHOD, ElementKind.CONSTRUCTOR,
 288.153 -            ElementKind.INSTANCE_INIT, ElementKind.STATIC_INIT, ElementKind.FIELD,
 288.154 -            ElementKind.ENUM_CONSTANT);
 288.155 -    
 288.156 -    private  List<HintDescription> doComputeHints(CompilationInfo info,
 288.157 -                                                  CompilationInfo overlayInfo) {
 288.158 -
 288.159 -        FindAnnotation ann = new FindAnnotation(info, overlayInfo, /*XXX*/new AtomicBoolean());
 288.160 -
 288.161 -        ann.scan(info.getCompilationUnit(), null);
 288.162 -
 288.163 -        return ann.hints;
 288.164 -    }
 288.165 -
 288.166 -    private final class FindAnnotation extends CancellableTreePathScanner<Void, Void> {
 288.167 -
 288.168 -        private final CompilationInfo info;
 288.169 -        private final CompilationInfo overlayInfo;
 288.170 -        private final List<HintDescription> hints = new LinkedList<HintDescription>();
 288.171 -
 288.172 -        public FindAnnotation(CompilationInfo info, CompilationInfo overlayInfo, AtomicBoolean cancel) {
 288.173 -            super(cancel);
 288.174 -            this.info = info;
 288.175 -            this.overlayInfo = overlayInfo;
 288.176 -        }
 288.177 -
 288.178 -        private final Set<Element> handledElements = new HashSet<Element>();
 288.179 -        
 288.180 -        private void handleElementImpl(Element el) {
 288.181 -            if (!handledElements.add(el)) return ;
 288.182 -
 288.183 -            List<HintDescription> currentHints = processAnnotations(el, el.getEnclosingElement(), info, info);
 288.184 -
 288.185 -            if (overlayInfo != null && currentHints.isEmpty() && KINDS_FOR_ELEMENT_HANDLE.contains(el.getKind())) {
 288.186 -                Element overlay = ElementHandle.create(el).resolve(overlayInfo);
 288.187 -
 288.188 -                if (overlay != null) {
 288.189 -                    currentHints = processAnnotations(overlay, overlay.getEnclosingElement(), info, overlayInfo);
 288.190 -                }
 288.191 -            }
 288.192 -
 288.193 -            this.hints.addAll(currentHints);
 288.194 -        }
 288.195 -
 288.196 -        private void handleElement(Element el) {
 288.197 -            PackageElement p = info.getElements().getPackageOf(el);
 288.198 -
 288.199 -            while (p != el) {
 288.200 -                handleElementImpl(el);
 288.201 -                el = el.getEnclosingElement();
 288.202 -            }
 288.203 -
 288.204 -            handleElementImpl(p);
 288.205 -        }
 288.206 -
 288.207 -        @Override
 288.208 -        public Void scan(Tree tree, Void p) {
 288.209 -            if (tree == null) return null;
 288.210 -
 288.211 -            TreePath tp = new TreePath(getCurrentPath(), tree);
 288.212 -            Element el = info.getTrees().getElement(tp);
 288.213 -
 288.214 -            if (el != null) {
 288.215 -                handleElement(el);
 288.216 -            }
 288.217 -
 288.218 -            return super.scan(tree, p);
 288.219 -        }
 288.220 -    }
 288.221 -
 288.222 -    private static final class WorkerImpl implements Worker {
 288.223 -        
 288.224 -        private final String displayName;
 288.225 -        private final List<FixDescription> fixDescriptions;
 288.226 -
 288.227 -        public WorkerImpl(String displayName, List<FixDescription> fixDescriptions) {
 288.228 -            this.displayName = displayName;
 288.229 -            this.fixDescriptions = fixDescriptions;
 288.230 -        }
 288.231 -
 288.232 -        public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
 288.233 -            //XXX: antipatterns not supported by the current infrastructure
 288.234 -//            TreePath tp = treePath;
 288.235 -//
 288.236 -//            while (tp != null) {
 288.237 -//                if (!pd.getPattern().checkAntipatterns(tp)) {
 288.238 -//                    return null;
 288.239 -//                }
 288.240 -//
 288.241 -//                tp = tp.getParentPath();
 288.242 -//            }
 288.243 -
 288.244 -            List<Fix> fixes = new LinkedList<Fix>();
 288.245 -
 288.246 -            for (FixDescription d : fixDescriptions) {
 288.247 -                String dn = d.getDisplayName();
 288.248 -
 288.249 -                if (dn.length() == 0) {
 288.250 -                    dn = defaultFixDisplayName(ctx.getInfo(), ctx.getVariables(), d);
 288.251 -                }
 288.252 -
 288.253 -                fixes.add(JavaFix.rewriteFix(ctx.getInfo(), dn, ctx.getPath(), d.getPattern(), ctx.getVariables(), ctx.getMultiVariables(), ctx.getVariableNames(), Collections.<String, TypeMirror>emptyMap()/*XXX: pd.pattern.getConstraints()*/));
 288.254 -            }
 288.255 -
 288.256 -            return Collections.singletonList(ErrorDescriptionFactory.forName(ctx, ctx.getPath(), displayName, fixes.toArray(new Fix[0])));
 288.257 -        }
 288.258 -    }
 288.259 -
 288.260 -    private static <T> T findValue(AnnotationMirror m, String name, Class<T> clazz) {
 288.261 -        for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e : m.getElementValues().entrySet()) {
 288.262 -            if (name.equals(e.getKey().getSimpleName().toString())) {
 288.263 -                return clazz.cast(e.getValue().getValue());
 288.264 -            }
 288.265 -        }
 288.266 -
 288.267 -        TypeElement te = (TypeElement) m.getAnnotationType().asElement();
 288.268 -
 288.269 -        for (ExecutableElement ee : ElementFilter.methodsIn(te.getEnclosedElements())) {
 288.270 -            if (name.equals(ee.getSimpleName().toString())) {
 288.271 -                if (ee.getDefaultValue() == null) {
 288.272 -                    return null;
 288.273 -                }
 288.274 -                return clazz.cast(ee.getDefaultValue().getValue());
 288.275 -            }
 288.276 -        }
 288.277 -
 288.278 -        return null;
 288.279 -    }
 288.280 -
 288.281 -    private static HintDescription create(CompilationInfo info, Element el, AnnotationMirror transformation, String id, CompilationInfo fake) {
 288.282 -        Collection rawPatterns = findValue(transformation, "pattern", Collection.class);
 288.283 -
 288.284 -        if (rawPatterns == null || rawPatterns.isEmpty()) {
 288.285 -            return null;
 288.286 -        }
 288.287 -
 288.288 -        Iterable<AnnotationMirror> patterns = Utilities.checkedIterableByFilter(rawPatterns, AnnotationMirror.class, true);
 288.289 -
 288.290 -        String patternString = findValue(patterns.iterator().next(), "value", String.class);
 288.291 -
 288.292 -        if (patternString == null) {
 288.293 -            return null;
 288.294 -        }
 288.295 -
 288.296 -        Collection rawConstraints = findValue(transformation, "constraint", Collection.class);
 288.297 -
 288.298 -        if (rawConstraints == null) {
 288.299 -            return null;
 288.300 -        }
 288.301 -
 288.302 -        Iterable<AnnotationMirror> constraints = Utilities.checkedIterableByFilter(rawConstraints, AnnotationMirror.class, true);
 288.303 -        Map<String, String> variableTypes = new HashMap<String, String>();
 288.304 -
 288.305 -        for (AnnotationMirror m : constraints) {
 288.306 -            String var = findValue(m, "variable", String.class);
 288.307 -            TypeMirror tm = findValue(m, "type", TypeMirror.class);
 288.308 -
 288.309 -            if (var == null || tm == null) {
 288.310 -                return null;
 288.311 -            }
 288.312 -
 288.313 -            variableTypes.put(var, tm.toString()); //XXX: toString()
 288.314 -        }
 288.315 -
 288.316 -        if (!el.getModifiers().contains(Modifier.STATIC) && !variableTypes.containsKey("$this")) {
 288.317 -            TypeMirror parent = el.getEnclosingElement().asType();
 288.318 -
 288.319 -            variableTypes.put("$this", TypeMirrorHandle.create(fake.getTypes().erasure(parent)).resolve(info).toString()); //XXX: toString()
 288.320 -        }
 288.321 -
 288.322 -        List<String> aps = new LinkedList<String>();
 288.323 -
 288.324 -        for (AnnotationMirror ap : Utilities.checkedIterableByFilter(findValue(transformation, "antipattern", Collection.class), AnnotationMirror.class, true)) {
 288.325 -            aps.add(findValue(ap, "value", String.class));
 288.326 -        }
 288.327 -
 288.328 -        List<FixDescription> fixes = new LinkedList<FixDescription>();
 288.329 -        Collection rawFixes = findValue(transformation, "fix", Collection.class);
 288.330 -
 288.331 -        if (rawFixes == null) {
 288.332 -            return null;
 288.333 -        }
 288.334 -
 288.335 -        for (AnnotationMirror f : Utilities.checkedIterableByFilter(rawFixes, AnnotationMirror.class, true)) {
 288.336 -            String dn = findValue(f, "displayName", String.class);
 288.337 -            String to = findValue(f, "value", String.class);
 288.338 -
 288.339 -            if (dn == null || to == null) {
 288.340 -                return null;
 288.341 -            }
 288.342 -
 288.343 -            fixes.add(new FixDescription(dn, to));
 288.344 -        }
 288.345 -
 288.346 -        String displayName = findValue(transformation, "displayName", String.class);
 288.347 -
 288.348 -        if (displayName == null) {
 288.349 -            return null;//XXX
 288.350 -        }
 288.351 -
 288.352 -        HintMetadata hm = HintMetadata.Builder.create(id).setDescription(displayName, displayName).setCategory(CATEGORY).build();
 288.353 -
 288.354 -        return HintDescriptionFactory.create()
 288.355 -                                     .setMetadata(hm)
 288.356 -                                     .setTrigger(PatternDescription.create(patternString, variableTypes))
 288.357 -                                     .setWorker(new WorkerImpl(displayName, fixes))
 288.358 -                                     .produce();
 288.359 -    }
 288.360 -
 288.361 -    private static final String CATEGORY = "Transformations";
 288.362 -
 288.363 -    private static final class FixDescription {
 288.364 -        private final String displayName;
 288.365 -        private final String pattern;
 288.366 -
 288.367 -        public FixDescription(String displayName, String pattern) {
 288.368 -            this.displayName = displayName;
 288.369 -            this.pattern = pattern;
 288.370 -        }
 288.371 -
 288.372 -        public String getDisplayName() {
 288.373 -            return displayName;
 288.374 -        }
 288.375 -
 288.376 -        public String getPattern() {
 288.377 -            return pattern;
 288.378 -        }
 288.379 -
 288.380 -    }
 288.381 -
 288.382 -    private static final File ANNOTATIONS_JAR;
 288.383 -    private static final File NB_OVERLAY_JAR;
 288.384 -    private static final File JDK_OVERLAY_JAR;
 288.385 -
 288.386 -    static {
 288.387 -        ANNOTATIONS_JAR = InstalledFileLocator.getDefault().locate("libs/annotations.jar", null, false);
 288.388 -        NB_OVERLAY_JAR = InstalledFileLocator.getDefault().locate("overlay/org-netbeans-nboverlay.jar", null, false);
 288.389 -        JDK_OVERLAY_JAR = InstalledFileLocator.getDefault().locate("overlay/jdk.jar", null, false);
 288.390 -    }
 288.391 -    
 288.392 -    private ClassPath prepareOverlayCompileCP() throws IllegalArgumentException {
 288.393 -        if (NB_OVERLAY_JAR ==null) {
 288.394 -            return ClassPathSupport.createClassPath(new URL[0]);
 288.395 -        }
 288.396 -        
 288.397 -        return ClassPathSupport.createClassPath(FileUtil.urlForArchiveOrDir(NB_OVERLAY_JAR));
 288.398 -    }
 288.399 -
 288.400 -    private ClassPath prepareOverlayBootCP() throws IllegalArgumentException {
 288.401 -        if (ANNOTATIONS_JAR == null) {
 288.402 -            return ClassPathSupport.createClassPath(new URL[0]);
 288.403 -        }
 288.404 -
 288.405 -        if (JDK_OVERLAY_JAR == null) {
 288.406 -            return ClassPathSupport.createClassPath(FileUtil.urlForArchiveOrDir(ANNOTATIONS_JAR));
 288.407 -        }
 288.408 -
 288.409 -        return ClassPathSupport.createClassPath(FileUtil.urlForArchiveOrDir(ANNOTATIONS_JAR), FileUtil.urlForArchiveOrDir(JDK_OVERLAY_JAR));
 288.410 -    }
 288.411 -
 288.412 -    private List<HintDescription> processAnnotations(Element e, Element enclosing, CompilationInfo info, CompilationInfo fake) {
 288.413 -        boolean foundTransformations = false;
 288.414 -        List<HintDescription> result = new LinkedList<HintDescription>();
 288.415 -        String id;
 288.416 -        switch (e.getKind()) {
 288.417 -            case ANNOTATION_TYPE:
 288.418 -            case CLASS:
 288.419 -            case ENUM:
 288.420 -            case INTERFACE:
 288.421 -                id = fake.getElements().getBinaryName((TypeElement) e).toString();
 288.422 -                break;
 288.423 -            case FIELD:
 288.424 -            case ENUM_CONSTANT:
 288.425 -                id = fake.getElements().getBinaryName((TypeElement) enclosing).toString() + e.getSimpleName().toString();
 288.426 -                break;
 288.427 -            case CONSTRUCTOR:
 288.428 -            case METHOD:
 288.429 -                //XXX: parameters!
 288.430 -                id = fake.getElements().getBinaryName((TypeElement) enclosing).toString() + e.getSimpleName().toString();
 288.431 -                break;
 288.432 -            default:
 288.433 -                id = "no-id";
 288.434 -                break;
 288.435 -        }
 288.436 -
 288.437 -        int index = 0;
 288.438 -        
 288.439 -        for (AnnotationMirror am : e.getAnnotationMirrors()) {
 288.440 -            String fqn = ((TypeElement) am.getAnnotationType().asElement()).getQualifiedName().toString();
 288.441 -            List<AnnotationMirror> transformations = new LinkedList<AnnotationMirror>();
 288.442 -            if (TRANSFORMATION.toFQN().equals(fqn)) {
 288.443 -                transformations.add(am);
 288.444 -                foundTransformations = true;
 288.445 -            }
 288.446 -            if (TRANSFORMATION_SET.toFQN().equals(fqn)) {
 288.447 -                for (AnnotationMirror m : Utilities.checkedIterableByFilter(findValue(am, "value", Collection.class), AnnotationMirror.class, true)) {
 288.448 -                    transformations.add(m);
 288.449 -                }
 288.450 -                foundTransformations = true;
 288.451 -            }
 288.452 -            
 288.453 -            for (AnnotationMirror t : transformations) {
 288.454 -                HintDescription pd = create(info, e, t, id + "-" + (index++), fake);
 288.455 -
 288.456 -                if (pd != null) {
 288.457 -                    result.add(pd);
 288.458 -                }
 288.459 -            }
 288.460 -        }
 288.461 -
 288.462 -        if (!foundTransformations && e.getKind() == ElementKind.METHOD) {
 288.463 -            TypeElement owner = (TypeElement) e.getEnclosingElement();
 288.464 -
 288.465 -            for (TypeMirror tm : fake.getTypes().directSupertypes(owner.asType())) {
 288.466 -                DeclaredType dt     = (DeclaredType) tm;
 288.467 -                TypeElement  parent = (TypeElement)  dt.asElement();
 288.468 -
 288.469 -                for (ExecutableElement ee : ElementFilter.methodsIn(parent.getEnclosedElements())) {
 288.470 -                    if (!fake.getElements().overrides((ExecutableElement) e, ee, (TypeElement) enclosing)) {
 288.471 -                        continue;
 288.472 -                    }
 288.473 -                    List<HintDescription> r = processAnnotations(ee, enclosing, info, fake);
 288.474 -
 288.475 -                    result.addAll(r);
 288.476 -                }
 288.477 -
 288.478 -            }
 288.479 -        }
 288.480 -
 288.481 -        return result;
 288.482 -    }
 288.483 -
 288.484 -    private static String defaultFixDisplayName(CompilationInfo info, Map<String, TreePath> variables, FixDescription d) {
 288.485 -        Map<String, String> stringsForVariables = new HashMap<String, String>();
 288.486 -
 288.487 -        for (Entry<String, TreePath> e : variables.entrySet()) {
 288.488 -            Tree t = e.getValue().getLeaf();
 288.489 -            SourcePositions sp = info.getTrees().getSourcePositions();
 288.490 -            int startPos = (int) sp.getStartPosition(info.getCompilationUnit(), t);
 288.491 -            int endPos = (int) sp.getEndPosition(info.getCompilationUnit(), t);
 288.492 -            
 288.493 -            stringsForVariables.put(e.getKey(), info.getText().substring(startPos, endPos));
 288.494 -        }
 288.495 -
 288.496 -        if (!stringsForVariables.containsKey("$this")) {
 288.497 -            stringsForVariables.put("$this", "this");
 288.498 -        }
 288.499 -
 288.500 -        String replaceTarget = d.getPattern();
 288.501 -
 288.502 -        for (Entry<String, String> e : stringsForVariables.entrySet()) {
 288.503 -            String quotedVariable = java.util.regex.Pattern.quote(e.getKey());
 288.504 -            String quotedTarget = Matcher.quoteReplacement(e.getValue());
 288.505 -            replaceTarget = replaceTarget.replaceAll(quotedVariable, quotedTarget);
 288.506 -        }
 288.507 -
 288.508 -        return "Rewrite to " + replaceTarget;
 288.509 -    }
 288.510 -
 288.511 -}
   289.1 --- a/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/Utilities.java	Sun Jan 08 20:10:08 2017 +0100
   289.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   289.3 @@ -1,138 +0,0 @@
   289.4 -/*
   289.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   289.6 - *
   289.7 - * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
   289.8 - *
   289.9 - * The contents of this file are subject to the terms of either the GNU
  289.10 - * General Public License Version 2 only ("GPL") or the Common
  289.11 - * Development and Distribution License("CDDL") (collectively, the
  289.12 - * "License"). You may not use this file except in compliance with the
  289.13 - * License. You can obtain a copy of the License at
  289.14 - * http://www.netbeans.org/cddl-gplv2.html
  289.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  289.16 - * specific language governing permissions and limitations under the
  289.17 - * License.  When distributing the software, include this License Header
  289.18 - * Notice in each file and include the License file at
  289.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  289.20 - * particular file as subject to the "Classpath" exception as provided
  289.21 - * by Sun in the GPL Version 2 section of the License file that
  289.22 - * accompanied this code. If applicable, add the following below the
  289.23 - * License Header, with the fields enclosed by brackets [] replaced by
  289.24 - * your own identifying information:
  289.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  289.26 - *
  289.27 - * If you wish your version of this file to be governed by only the CDDL
  289.28 - * or only the GPL Version 2, indicate your decision by adding
  289.29 - * "[Contributor] elects to include this software in this distribution
  289.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  289.31 - * single choice of license, a recipient has the option to distribute
  289.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  289.33 - * to extend the choice of license to its licensees as provided above.
  289.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  289.35 - * Version 2 license, then the option applies only if the new code is
  289.36 - * made subject to such option by the copyright holder.
  289.37 - *
  289.38 - * Contributor(s):
  289.39 - *
  289.40 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
  289.41 - */
  289.42 -
  289.43 -package org.netbeans.modules.jackpot30.transformers;
  289.44 -
  289.45 -import com.sun.source.tree.AnnotationTree;
  289.46 -import com.sun.source.tree.AssignmentTree;
  289.47 -import com.sun.source.tree.ExpressionTree;
  289.48 -import com.sun.source.tree.IdentifierTree;
  289.49 -import com.sun.source.tree.LiteralTree;
  289.50 -import com.sun.source.tree.MemberSelectTree;
  289.51 -import com.sun.source.tree.NewArrayTree;
  289.52 -import com.sun.source.tree.Tree;
  289.53 -import com.sun.source.tree.Tree.Kind;
  289.54 -import java.util.Arrays;
  289.55 -import java.util.Iterator;
  289.56 -import java.util.LinkedList;
  289.57 -import java.util.List;
  289.58 -import javax.lang.model.element.TypeElement;
  289.59 -import javax.lang.model.type.TypeMirror;
  289.60 -import org.netbeans.api.java.source.TreeMaker;
  289.61 -import org.netbeans.api.java.source.WorkingCopy;
  289.62 -import org.openide.util.NbCollections;
  289.63 -
  289.64 -/**
  289.65 - *
  289.66 - * @author Jan Lahoda
  289.67 - */
  289.68 -public class Utilities {
  289.69 -
  289.70 -    private Utilities() {}
  289.71 -
  289.72 -    public static <E> Iterable<E> checkedIterableByFilter(final Iterable raw, final Class<E> type, final boolean strict) {
  289.73 -        return new Iterable<E>() {
  289.74 -            public Iterator<E> iterator() {
  289.75 -                return NbCollections.checkedIteratorByFilter(raw.iterator(), type, strict);
  289.76 -            }
  289.77 -        };
  289.78 -    }
  289.79 -    
  289.80 -//    public static AnnotationTree constructConstraint(WorkingCopy wc, String name, TypeMirror tm) {
  289.81 -//        TreeMaker make = wc.getTreeMaker();
  289.82 -//        ExpressionTree variable = prepareAssignment(make, "variable", make.Literal(name));
  289.83 -//        ExpressionTree type     = prepareAssignment(make, "type", make.MemberSelect((ExpressionTree) make.Type(wc.getTypes().erasure(tm)), "class"));
  289.84 -//        TypeElement constraint  = wc.getElements().getTypeElement(Annotations.CONSTRAINT.toFQN());
  289.85 -//
  289.86 -//        return make.Annotation(make.QualIdent(constraint), Arrays.asList(variable, type));
  289.87 -//    }
  289.88 -
  289.89 -    public static ExpressionTree prepareAssignment(TreeMaker make, String name, ExpressionTree value) {
  289.90 -        return make.Assignment(make.Identifier(name), value);
  289.91 -    }
  289.92 -
  289.93 -    public static ExpressionTree findValue(AnnotationTree m, String name) {
  289.94 -        for (ExpressionTree et : m.getArguments()) {
  289.95 -            if (et.getKind() == Kind.ASSIGNMENT) {
  289.96 -                AssignmentTree at = (AssignmentTree) et;
  289.97 -                String varName = ((IdentifierTree) at.getVariable()).getName().toString();
  289.98 -
  289.99 -                if (varName.equals(name)) {
 289.100 -                    return at.getExpression();
 289.101 -                }
 289.102 -            }
 289.103 -
 289.104 -            if (et instanceof LiteralTree/*XXX*/ && "value".equals(name)) {
 289.105 -                return et;
 289.106 -            }
 289.107 -        }
 289.108 -
 289.109 -        return null;
 289.110 -    }
 289.111 -
 289.112 -    public static List<AnnotationTree> findArrayValue(AnnotationTree at, String name) {
 289.113 -        ExpressionTree fixesArray = findValue(at, name);
 289.114 -        List<AnnotationTree> fixes = new LinkedList<AnnotationTree>();
 289.115 -
 289.116 -        if (fixesArray != null && fixesArray.getKind() == Kind.NEW_ARRAY) {
 289.117 -            NewArrayTree trees = (NewArrayTree) fixesArray;
 289.118 -
 289.119 -            for (ExpressionTree fix : trees.getInitializers()) {
 289.120 -                if (fix.getKind() == Kind.ANNOTATION) {
 289.121 -                    fixes.add((AnnotationTree) fix);
 289.122 -                }
 289.123 -            }
 289.124 -        }
 289.125 -
 289.126 -        if (fixesArray != null && fixesArray.getKind() == Kind.ANNOTATION) {
 289.127 -            fixes.add((AnnotationTree) fixesArray);
 289.128 -        }
 289.129 -        
 289.130 -        return fixes;
 289.131 -    }
 289.132 -
 289.133 -    public static boolean isPureMemberSelect(Tree mst, boolean allowVariables) {
 289.134 -        switch (mst.getKind()) {
 289.135 -            case IDENTIFIER: return allowVariables || ((IdentifierTree) mst).getName().charAt(0) != '$';
 289.136 -            case MEMBER_SELECT: return isPureMemberSelect(((MemberSelectTree) mst).getExpression(), allowVariables);
 289.137 -            default: return false;
 289.138 -        }
 289.139 -    }
 289.140 -
 289.141 -}
   290.1 --- a/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/resources/Bundle.properties	Sun Jan 08 20:10:08 2017 +0100
   290.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   290.3 @@ -1,38 +0,0 @@
   290.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   290.5 -#
   290.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   290.7 -#
   290.8 -# The contents of this file are subject to the terms of either the GNU
   290.9 -# General Public License Version 2 only ("GPL") or the Common
  290.10 -# Development and Distribution License("CDDL") (collectively, the
  290.11 -# "License"). You may not use this file except in compliance with the
  290.12 -# License. You can obtain a copy of the License at
  290.13 -# http://www.netbeans.org/cddl-gplv2.html
  290.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  290.15 -# specific language governing permissions and limitations under the
  290.16 -# License.  When distributing the software, include this License Header
  290.17 -# Notice in each file and include the License file at
  290.18 -# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  290.19 -# particular file as subject to the "Classpath" exception as provided
  290.20 -# by Sun in the GPL Version 2 section of the License file that
  290.21 -# accompanied this code. If applicable, add the following below the
  290.22 -# License Header, with the fields enclosed by brackets [] replaced by
  290.23 -# your own identifying information:
  290.24 -# "Portions Copyrighted [year] [name of copyright owner]"
  290.25 -#
  290.26 -# If you wish your version of this file to be governed by only the CDDL
  290.27 -# or only the GPL Version 2, indicate your decision by adding
  290.28 -# "[Contributor] elects to include this software in this distribution
  290.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
  290.30 -# single choice of license, a recipient has the option to distribute
  290.31 -# your version of this file under either the CDDL, the GPL Version 2 or
  290.32 -# to extend the choice of license to its licensees as provided above.
  290.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
  290.34 -# Version 2 license, then the option applies only if the new code is
  290.35 -# made subject to such option by the copyright holder.
  290.36 -#
  290.37 -# Contributor(s):
  290.38 -#
  290.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
  290.40 -
  290.41 -OpenIDE-Module-Name=Jackpot 3.0 Transformations
   291.1 --- a/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/resources/layer.xml	Sun Jan 08 20:10:08 2017 +0100
   291.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   291.3 @@ -1,47 +0,0 @@
   291.4 -<?xml version="1.0" encoding="UTF-8"?>
   291.5 -<!--
   291.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   291.7 -
   291.8 -Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
   291.9 -
  291.10 -Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  291.11 -Other names may be trademarks of their respective owners.
  291.12 -
  291.13 -The contents of this file are subject to the terms of either the GNU
  291.14 -General Public License Version 2 only ("GPL") or the Common
  291.15 -Development and Distribution License("CDDL") (collectively, the
  291.16 -"License"). You may not use this file except in compliance with the
  291.17 -License. You can obtain a copy of the License at
  291.18 -http://www.netbeans.org/cddl-gplv2.html
  291.19 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  291.20 -specific language governing permissions and limitations under the
  291.21 -License.  When distributing the software, include this License Header
  291.22 -Notice in each file and include the License file at
  291.23 -nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
  291.24 -particular file as subject to the "Classpath" exception as provided
  291.25 -by Oracle in the GPL Version 2 section of the License file that
  291.26 -accompanied this code. If applicable, add the following below the
  291.27 -License Header, with the fields enclosed by brackets [] replaced by
  291.28 -your own identifying information:
  291.29 -"Portions Copyrighted [year] [name of copyright owner]"
  291.30 -
  291.31 -Contributor(s):
  291.32 -
  291.33 -The Original Software is NetBeans. The Initial Developer of the Original
  291.34 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
  291.35 -Microsystems, Inc. All Rights Reserved.
  291.36 -
  291.37 -If you wish your version of this file to be governed by only the CDDL
  291.38 -or only the GPL Version 2, indicate your decision by adding
  291.39 -"[Contributor] elects to include this software in this distribution
  291.40 -under the [CDDL or GPL Version 2] license." If you do not indicate a
  291.41 -single choice of license, a recipient has the option to distribute
  291.42 -your version of this file under either the CDDL, the GPL Version 2 or
  291.43 -to extend the choice of license to its licensees as provided above.
  291.44 -However, if you add GPL Version 2 code and therefore, elected the GPL
  291.45 -Version 2 license, then the option applies only if the new code is
  291.46 -made subject to such option by the copyright holder.
  291.47 --->
  291.48 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
  291.49 -<filesystem>
  291.50 -</filesystem>
   292.1 --- a/sandbox/old-modules/transformer/test/unit/src/org/netbeans/modules/jackpot30/transformers/TransformationHintProviderImplTest.java	Sun Jan 08 20:10:08 2017 +0100
   292.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   292.3 @@ -1,555 +0,0 @@
   292.4 -/*
   292.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   292.6 - *
   292.7 - * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
   292.8 - *
   292.9 - * The contents of this file are subject to the terms of either the GNU
  292.10 - * General Public License Version 2 only ("GPL") or the Common
  292.11 - * Development and Distribution License("CDDL") (collectively, the
  292.12 - * "License"). You may not use this file except in compliance with the
  292.13 - * License. You can obtain a copy of the License at
  292.14 - * http://www.netbeans.org/cddl-gplv2.html
  292.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  292.16 - * specific language governing permissions and limitations under the
  292.17 - * License.  When distributing the software, include this License Header
  292.18 - * Notice in each file and include the License file at
  292.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
  292.20 - * particular file as subject to the "Classpath" exception as provided
  292.21 - * by Sun in the GPL Version 2 section of the License file that
  292.22 - * accompanied this code. If applicable, add the following below the
  292.23 - * License Header, with the fields enclosed by brackets [] replaced by
  292.24 - * your own identifying information:
  292.25 - * "Portions Copyrighted [year] [name of copyright owner]"
  292.26 - *
  292.27 - * If you wish your version of this file to be governed by only the CDDL
  292.28 - * or only the GPL Version 2, indicate your decision by adding
  292.29 - * "[Contributor] elects to include this software in this distribution
  292.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
  292.31 - * single choice of license, a recipient has the option to distribute
  292.32 - * your version of this file under either the CDDL, the GPL Version 2 or
  292.33 - * to extend the choice of license to its licensees as provided above.
  292.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
  292.35 - * Version 2 license, then the option applies only if the new code is
  292.36 - * made subject to such option by the copyright holder.
  292.37 - *
  292.38 - * Contributor(s):
  292.39 - *
  292.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
  292.41 - */
  292.42 -
  292.43 -package org.netbeans.modules.jackpot30.transformers;
  292.44 -
  292.45 -import com.sun.source.tree.Tree.Kind;
  292.46 -import java.io.File;
  292.47 -import java.io.IOException;
  292.48 -import java.util.ArrayList;
  292.49 -import java.util.Arrays;
  292.50 -import java.util.Collections;
  292.51 -import java.util.HashMap;
  292.52 -import java.util.LinkedList;
  292.53 -import java.util.List;
  292.54 -import java.util.Map;
  292.55 -import java.util.concurrent.atomic.AtomicBoolean;
  292.56 -import javax.swing.text.Document;
  292.57 -import org.netbeans.api.java.lexer.JavaTokenId;
  292.58 -import org.netbeans.api.java.source.CompilationInfo;
  292.59 -import org.netbeans.api.java.source.JavaSource;
  292.60 -import org.netbeans.api.java.source.JavaSource.Phase;
  292.61 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
  292.62 -import org.netbeans.api.java.source.TestUtilities;
  292.63 -import org.netbeans.api.lexer.Language;
  292.64 -import org.netbeans.junit.NbTestCase;
  292.65 -import org.netbeans.modules.java.hints.jackpot.impl.RulesManager;
  292.66 -import org.netbeans.modules.java.hints.jackpot.impl.hints.HintsInvoker;
  292.67 -import org.netbeans.modules.java.hints.jackpot.spi.ClassPathBasedHintProvider;
  292.68 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
  292.69 -import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
  292.70 -import org.netbeans.modules.java.source.TreeLoader;
  292.71 -import org.netbeans.spi.editor.hints.ErrorDescription;
  292.72 -import org.netbeans.spi.editor.hints.Fix;
  292.73 -import org.openide.LifecycleManager;
  292.74 -import org.openide.cookies.EditorCookie;
  292.75 -import org.openide.filesystems.FileObject;
  292.76 -import org.openide.filesystems.FileUtil;
  292.77 -import org.openide.loaders.DataObject;
  292.78 -import org.openide.modules.InstalledFileLocator;
  292.79 -
  292.80 -/**
  292.81 - *
  292.82 - * @author Jan Lahoda
  292.83 - */
  292.84 -public class TransformationHintProviderImplTest extends NbTestCase {
  292.85 -
  292.86 -    public TransformationHintProviderImplTest(String name) {
  292.87 -        super(name);
  292.88 -    }
  292.89 -
  292.90 -    public void testSimpleAnalysis() throws Exception {
  292.91 -        performAnalysisTest("package test;\n" +
  292.92 -                            "import net.java.lang.annotations.Constraint;\n" +
  292.93 -                            "import net.java.lang.annotations.Fix;\n" +
  292.94 -                            "import net.java.lang.annotations.Pattern;\n" +
  292.95 -                            "import net.java.lang.annotations.Transformation;\n" +
  292.96 -                            "public class Test {\n" +
  292.97 -                            "    @Transformation(\n" +
  292.98 -                            "        displayName=\"O\",\n" +
  292.99 -                            "        pattern=@Pattern(\"$0.getCookie($1)\"),\n" +
 292.100 -                            "        constraint={\n" +
 292.101 -                            "            @Constraint(variable=\"$0\", type=Test.class),\n" +
 292.102 -                            "            @Constraint(variable=\"$1\", type=Class.class)\n" +
 292.103 -                            "        },\n" +
 292.104 -                            "        fix=@Fix(\"$0.lookup($1)\")\n" +
 292.105 -                            "    )\n" +
 292.106 -                            "    public void getCookie(Class c) {}\n" +
 292.107 -                            "    private void test() {\n" +
 292.108 -                            "         getCookie(null);\n" +
 292.109 -                            "    }\n" +
 292.110 -                            "}\n",
 292.111 -                            "17:9-17:18:verifier:O");
 292.112 -    }
 292.113 -
 292.114 -    public void testCanGoUp() throws Exception {
 292.115 -        performAnalysisTest("package test;\n" +
 292.116 -                            "import net.java.lang.annotations.Constraint;\n" +
 292.117 -                            "import net.java.lang.annotations.Fix;\n" +
 292.118 -                            "import net.java.lang.annotations.Pattern;\n" +
 292.119 -                            "import net.java.lang.annotations.Transformation;\n" +
 292.120 -                            "public abstract class Test {\n" +
 292.121 -                            "    @Transformation(\n" +
 292.122 -                            "        displayName=\"O\",\n" +
 292.123 -                            "        pattern=@Pattern(\"$0.getCookie().toString()\"),\n" +
 292.124 -                            "        constraint={\n" +
 292.125 -                            "            @Constraint(variable=\"$0\", type=Test.class)\n" +
 292.126 -                            "        },\n" +
 292.127 -                            "        fix=@Fix(\"$0.lookup($1)\")\n" +
 292.128 -                            "    )\n" +
 292.129 -                            "    public abstract String getCookie();\n" +
 292.130 -                            "    private void test() {\n" +
 292.131 -                            "         getCookie().toString();\n" +
 292.132 -                            "    }\n" +
 292.133 -                            "}\n",
 292.134 -                            "16:21-16:29:verifier:O");
 292.135 -    }
 292.136 -
 292.137 -    public void testForConstructor() throws Exception {
 292.138 -        performAnalysisTest("package test;\n" +
 292.139 -                            "import net.java.lang.annotations.Constraint;\n" +
 292.140 -                            "import net.java.lang.annotations.Fix;\n" +
 292.141 -                            "import net.java.lang.annotations.Pattern;\n" +
 292.142 -                            "import net.java.lang.annotations.Transformation;\n" +
 292.143 -                            "public class Test {\n" +
 292.144 -                            "    @Transformation(\n" +
 292.145 -                            "        displayName=\"O\",\n" +
 292.146 -                            "        pattern=@Pattern(\"new test.Test()\"),\n" +
 292.147 -                            "        fix={}\n" +
 292.148 -                            "    )\n" +
 292.149 -                            "    public Test() {}\n" +
 292.150 -                            "    private void test() {\n" +
 292.151 -                            "         new Test();\n" +
 292.152 -                            "    }\n" +
 292.153 -                            "}\n",
 292.154 -                            "13:9-13:19:verifier:O");
 292.155 -    }
 292.156 -
 292.157 -    public void testMoreWarnings() throws Exception {
 292.158 -        performAnalysisTest("package test;\n" +
 292.159 -                            "import net.java.lang.annotations.Constraint;\n" +
 292.160 -                            "import net.java.lang.annotations.Fix;\n" +
 292.161 -                            "import net.java.lang.annotations.Pattern;\n" +
 292.162 -                            "import net.java.lang.annotations.Transformation;\n" +
 292.163 -                            "public class Test {\n" +
 292.164 -                            "    @Transformation(\n" +
 292.165 -                            "        displayName=\"O\",\n" +
 292.166 -                            "        pattern=@Pattern(\"new test.Test()\"),\n" +
 292.167 -                            "        fix={}\n" +
 292.168 -                            "    )\n" +
 292.169 -                            "    public Test() {}\n" +
 292.170 -                            "    private void test() {\n" +
 292.171 -                            "         new Test();\n" +
 292.172 -                            "         new Test();\n" +
 292.173 -                            "    }\n" +
 292.174 -                            "}\n",
 292.175 -                            "13:9-13:19:verifier:O",
 292.176 -                            "14:9-14:19:verifier:O");
 292.177 -    }
 292.178 -
 292.179 -    public void testCorrectImports() throws Exception {
 292.180 -        performFixTest("test/Test.java",
 292.181 -                            "package test;\n" +
 292.182 -                            "import net.java.lang.annotations.Constraint;\n" +
 292.183 -                            "import net.java.lang.annotations.Fix;\n" +
 292.184 -                            "import net.java.lang.annotations.Pattern;\n" +
 292.185 -                            "import net.java.lang.annotations.Transformation;\n" +
 292.186 -                            "public abstract class Test {\n" +
 292.187 -                            "    @Transformation(\n" +
 292.188 -                            "        displayName=\"O\",\n" +
 292.189 -                            "        pattern=@Pattern(\"$this.test()\"),\n" +
 292.190 -                            "        fix=@Fix(\"test.Test.test1().toString()\")\n" +
 292.191 -                            "    )\n" +
 292.192 -                            "    private void test() {\n" +
 292.193 -                            "         test();\n" +
 292.194 -                            "    }" +
 292.195 -                            "    static String test1() {return null;}\n" +
 292.196 -                            "}\n",
 292.197 -                            "12:9-12:13:verifier:O",
 292.198 -                            "FixImpl",
 292.199 -                            "package test;\n" +
 292.200 -                            "import net.java.lang.annotations.Constraint;\n" +
 292.201 -                            "import net.java.lang.annotations.Fix;\n" +
 292.202 -                            "import net.java.lang.annotations.Pattern;\n" +
 292.203 -                            "import net.java.lang.annotations.Transformation;\n" +
 292.204 -                            "public abstract class Test {\n" +
 292.205 -                            "    @Transformation(\n" +
 292.206 -                            "        displayName=\"O\",\n" +
 292.207 -                            "        pattern=@Pattern(\"$this.test()\"),\n" +
 292.208 -                            "        fix=@Fix(\"test.Test.test1().toString()\")\n" +
 292.209 -                            "    )\n" +
 292.210 -                            "    private void test() {\n" +
 292.211 -                            "         Test.test1().toString();\n" +
 292.212 -                            "    }" +
 292.213 -                            "    static String test1() {return null;}\n" +
 292.214 -                            "}\n");
 292.215 -    }
 292.216 -
 292.217 -    public void testNoExceptions1() throws Exception {
 292.218 -        performNoExceptionsTest("package test;\n" +
 292.219 -                                "import net.java.lang.annotations.Constraint;\n" +
 292.220 -                                "import net.java.lang.annotations.Fix;\n" +
 292.221 -                                "import net.java.lang.annotations.Pattern;\n" +
 292.222 -                                "import net.java.lang.annotations.Transformation;\n" +
 292.223 -                                "public abstract class Test {\n" +
 292.224 -                                "    |public abstract String getCookie();\n" +
 292.225 -                                "    private void test() {\n" +
 292.226 -                                "         getCookie().toString();\n" +
 292.227 -                                "    }\n" +
 292.228 -                                "}\n",
 292.229 -                                "    @Transformation(\n" +
 292.230 -                                "        displayName=\"O\",\n" +
 292.231 -                                "        pattern=@Pattern(\"$0.getCookie().toString()\"),\n" +
 292.232 -                                "        constraint={\n" +
 292.233 -                                "            @Constraint(variable=\"$0\", type=Test.class)\n" +
 292.234 -                                "        },\n" +
 292.235 -                                "        fix={@Fix(\"$0.lookup($1)\")}\n" +
 292.236 -                                "    )\n".replaceAll("[ \n]+", " "));
 292.237 -    }
 292.238 -
 292.239 -    public void testNoExceptions2() throws Exception {
 292.240 -        performNoExceptionsTest("package test;\n" +
 292.241 -                                "import net.java.lang.annotations.Constraint;\n" +
 292.242 -                                "import net.java.lang.annotations.Fix;\n" +
 292.243 -                                "import net.java.lang.annotations.Pattern;\n" +
 292.244 -                                "import net.java.lang.annotations.Transformation;\n" +
 292.245 -                                "public abstract class Test {\n" +
 292.246 -                                "    |public abstract String getCookie();\n" +
 292.247 -                                "    private void test() {\n" +
 292.248 -                                "         getCookie().toString();\n" +
 292.249 -                                "    }\n" +
 292.250 -                                "}\n",
 292.251 -                                "    @Transformation(\n" +
 292.252 -                                "        displayName=\"O\",\n" +
 292.253 -                                "        pattern=@Pattern(\"$0.getCookie().toString()\"),\n" +
 292.254 -                                "        constraint=\n" +
 292.255 -                                "            @Constraint(variable=\"$0\", type=Test.class)\n" +
 292.256 -                                "        ,\n" +
 292.257 -                                "        fix=@Fix(\"$0.lookup($1)\")\n" +
 292.258 -                                "    )\n".replaceAll("[ \n]+", " "));
 292.259 -    }
 292.260 -
 292.261 -    public void testType1() throws Exception {
 292.262 -        performFixTest("test/Test.java",
 292.263 -                            "package test;\n" +
 292.264 -                            "import net.java.lang.annotations.Constraint;\n" +
 292.265 -                            "import net.java.lang.annotations.Fix;\n" +
 292.266 -                            "import net.java.lang.annotations.Pattern;\n" +
 292.267 -                            "import net.java.lang.annotations.Transformation;\n" +
 292.268 -                            "public abstract class Test {\n" +
 292.269 -                            "    @Transformation(\n" +
 292.270 -                            "        displayName=\"O\",\n" +
 292.271 -                            "        pattern=@Pattern(\"test.Test.Bad\"),\n" +
 292.272 -                            "        fix=@Fix(\"test.Test.Good\")\n" +
 292.273 -                            "    )\n" +
 292.274 -                            "    public static class Bad {}\n" +
 292.275 -                            "    public static class Good {}\n" +
 292.276 -                            "    static void test1() { Bad b; }\n" +
 292.277 -                            "}\n",
 292.278 -                            "13:26-13:29:verifier:O",
 292.279 -                            "FixImpl",
 292.280 -                            "package test;\n" +
 292.281 -                            "import net.java.lang.annotations.Constraint;\n" +
 292.282 -                            "import net.java.lang.annotations.Fix;\n" +
 292.283 -                            "import net.java.lang.annotations.Pattern;\n" +
 292.284 -                            "import net.java.lang.annotations.Transformation;\n" +
 292.285 -                            "public abstract class Test {\n" +
 292.286 -                            "    @Transformation(\n" +
 292.287 -                            "        displayName=\"O\",\n" +
 292.288 -                            "        pattern=@Pattern(\"test.Test.Bad\"),\n" +
 292.289 -                            "        fix=@Fix(\"test.Test.Good\")\n" +
 292.290 -                            "    )\n" +
 292.291 -                            "    public static class Bad {}\n" +
 292.292 -                            "    public static class Good {}\n" +
 292.293 -                            "    static void test1() { Good b; }\n" +
 292.294 -                            "}\n".replaceAll("[ \n]+", " "));
 292.295 -    }
 292.296 -
 292.297 -    public void testCorrectReplace() throws Exception {
 292.298 -        performFixTest("test/Test.java",
 292.299 -                            "package test;\n" +
 292.300 -                            "import net.java.lang.annotations.Constraint;\n" +
 292.301 -                            "import net.java.lang.annotations.Fix;\n" +
 292.302 -                            "import net.java.lang.annotations.Pattern;\n" +
 292.303 -                            "import net.java.lang.annotations.Transformation;\n" +
 292.304 -                            "public class Test {\n" +
 292.305 -                            "    @Transformation(\n" +
 292.306 -                            "        displayName=\"O\",\n" +
 292.307 -                            "        pattern=@Pattern(\"$this.test()\"),\n" +
 292.308 -                            "        fix=@Fix(\"$this.test()\")\n" +
 292.309 -                            "    )\n" +
 292.310 -                            "    private void test() {\n" +
 292.311 -                            "         new Test().test();\n" +
 292.312 -                            "    }\n" +
 292.313 -                            "}\n",
 292.314 -                            "12:20-12:24:verifier:O",
 292.315 -                            "FixImpl",
 292.316 -                            "package test;\n" +
 292.317 -                            "import net.java.lang.annotations.Constraint;\n" +
 292.318 -                            "import net.java.lang.annotations.Fix;\n" +
 292.319 -                            "import net.java.lang.annotations.Pattern;\n" +
 292.320 -                            "import net.java.lang.annotations.Transformation;\n" +
 292.321 -                            "public class Test {\n" +
 292.322 -                            "    @Transformation(\n" +
 292.323 -                            "        displayName=\"O\",\n" +
 292.324 -                            "        pattern=@Pattern(\"$this.test()\"),\n" +
 292.325 -                            "        fix=@Fix(\"$this.test()\")\n" +
 292.326 -                            "    )\n" +
 292.327 -                            "    private void test() {\n" +
 292.328 -                            "         new Test().test();\n" +
 292.329 -                            "    }\n" +
 292.330 -                            "}\n");
 292.331 -    }
 292.332 -
 292.333 -    @Override
 292.334 -    protected void setUp() throws Exception {
 292.335 -        super.setUp();
 292.336 -        
 292.337 -        File jar = FileUtil.archiveOrDirForURL(TransformationHintProviderImpl.class.getProtectionDomain().getCodeSource().getLocation());
 292.338 -
 292.339 -        assertNotNull(jar);
 292.340 -
 292.341 -        String nbHome = jar.getParentFile().getParentFile().getAbsolutePath();
 292.342 -
 292.343 -        System.setProperty("netbeans.home",nbHome);
 292.344 -
 292.345 -        SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/editor/resources/layer.xml"}, new Object[0]);
 292.346 -        TreeLoader.DISABLE_CONFINEMENT_TEST = true;
 292.347 -    }
 292.348 -
 292.349 -    private List<ErrorDescription> computeWarnings() {
 292.350 -        List<HintDescription> hints = new ArrayList<HintDescription>();
 292.351 -
 292.352 -        RulesManager.computeElementBasedHintsXXX(info, new AtomicBoolean(), Collections.singletonList(new TransformationHintProviderImpl()), Collections.<ClassPathBasedHintProvider>emptyList(), hints);
 292.353 -
 292.354 -        List<ErrorDescription> warnings = new HintsInvoker(info, new AtomicBoolean()).computeHints(info, hints);
 292.355 -
 292.356 -        return warnings;
 292.357 -    }
 292.358 -
 292.359 -    private void prepareTest(String fileName, String code) throws Exception {
 292.360 -        prepareTest(fileName, code, false);
 292.361 -    }
 292.362 -
 292.363 -    private void prepareTest(String fileName, String code, boolean ignoreErrors) throws Exception {
 292.364 -        clearWorkDir();
 292.365 -
 292.366 -        FileUtil.refreshFor(File.listRoots());
 292.367 -
 292.368 -        FileObject workFO = FileUtil.toFileObject(getWorkDir());
 292.369 -
 292.370 -        assertNotNull(workFO);
 292.371 -
 292.372 -        workFO.refresh();
 292.373 -
 292.374 -        sourceRoot = workFO.createFolder("src");
 292.375 -        FileObject buildRoot  = workFO.createFolder("build");
 292.376 -        FileObject cache = workFO.createFolder("cache");
 292.377 -
 292.378 -        FileObject data = FileUtil.createData(sourceRoot, fileName);
 292.379 -        File dataFile = FileUtil.toFile(data);
 292.380 -
 292.381 -        assertNotNull(dataFile);
 292.382 -
 292.383 -        TestUtilities.copyStringToFile(dataFile, code);
 292.384 -
 292.385 -        File ann = InstalledFileLocator.getDefault().locate("libs/annotations.jar", null, false);
 292.386 -
 292.387 -        if (ann == null) {
 292.388 -            ann = InstalledFileLocator.getDefault().locate("release/libs/annotations.jar", null, false);
 292.389 -        }
 292.390 -
 292.391 -        assertNotNull(System.getProperty("netbeans.home"), ann);
 292.392 -
 292.393 -        FileObject annFO = FileUtil.toFileObject(ann);
 292.394 -
 292.395 -        assertNotNull(annFO);
 292.396 -
 292.397 -        SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache, new FileObject[] {FileUtil.getArchiveRoot(annFO)});
 292.398 -
 292.399 -        DataObject od = DataObject.find(data);
 292.400 -        EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
 292.401 -
 292.402 -        assertNotNull(ec);
 292.403 -
 292.404 -        doc = ec.openDocument();
 292.405 -        doc.putProperty(Language.class, JavaTokenId.language());
 292.406 -
 292.407 -        JavaSource js = JavaSource.forFileObject(data);
 292.408 -
 292.409 -        assertNotNull(js);
 292.410 -
 292.411 -        info = SourceUtilsTestUtil.getCompilationInfo(js, Phase.RESOLVED);
 292.412 -
 292.413 -        assertNotNull(info);
 292.414 -
 292.415 -        if (!ignoreErrors) {
 292.416 -            assertEquals(info.getDiagnostics().toString(), 0, info.getDiagnostics().size());
 292.417 -        }
 292.418 -    }
 292.419 -
 292.420 -    private FileObject sourceRoot;
 292.421 -    private CompilationInfo info;
 292.422 -    private Document doc;
 292.423 -    private String wordDirPath;
 292.424 -    
 292.425 -    protected void performNoExceptionsTest(String code, String type) throws Exception {
 292.426 -        String wDP = getWorkDirPath();
 292.427 -        
 292.428 -        int offset = code.indexOf('|');
 292.429 -
 292.430 -        code = code.replace("|", "");
 292.431 -
 292.432 -        File prev = null;
 292.433 -
 292.434 -        for (int i = 0; i < type.length(); i++) {
 292.435 -            StringBuilder nueCode = new StringBuilder();
 292.436 -
 292.437 -            nueCode.append(code);
 292.438 -            nueCode.insert(offset, type.substring(0, i + 1));
 292.439 -
 292.440 -            this.wordDirPath = wDP + File.separatorChar + i;
 292.441 -            
 292.442 -            performAnalysisTest(nueCode.toString(), null, true);
 292.443 -
 292.444 -            if (prev != null) {
 292.445 -                deleteFile(prev);
 292.446 -                FileUtil.refreshFor(File.listRoots());
 292.447 -            }
 292.448 -
 292.449 -            prev = getWorkDir();
 292.450 -        }
 292.451 -    }
 292.452 -
 292.453 -    protected void performAnalysisTest(String code, String... golden) throws Exception {
 292.454 -        performAnalysisTest(code, golden, false);
 292.455 -    }
 292.456 -
 292.457 -    protected void performAnalysisTest(String code, String[] golden, boolean ignoreErrors) throws Exception {
 292.458 -        prepareTest("test/Test.java", code, ignoreErrors);
 292.459 -
 292.460 -        List<ErrorDescription> warnings = computeWarnings();
 292.461 -        List<String> dns = new LinkedList<String>();
 292.462 -
 292.463 -        for (ErrorDescription ed : warnings) {
 292.464 -            dns.add(ed.toString());
 292.465 -        }
 292.466 -
 292.467 -        if (golden != null) {
 292.468 -            assertEquals(Arrays.asList(golden), dns);
 292.469 -        }
 292.470 -    }
 292.471 -
 292.472 -    protected String performFixTest(String fileName, String code, String errorDescriptionToString, String fixDebugString, String golden) throws Exception {
 292.473 -        prepareTest(fileName, code);
 292.474 -
 292.475 -        List<ErrorDescription> errors = computeWarnings();
 292.476 -
 292.477 -        ErrorDescription toFix = null;
 292.478 -
 292.479 -        for (ErrorDescription d : errors) {
 292.480 -            if (errorDescriptionToString.equals(d.toString())) {
 292.481 -                toFix = d;
 292.482 -                break;
 292.483 -            }
 292.484 -        }
 292.485 -
 292.486 -        assertNotNull("Error: \"" + errorDescriptionToString + "\" not found. All ErrorDescriptions: " + errors.toString(), toFix);
 292.487 -
 292.488 -        assertTrue("Must be computed", toFix.getFixes().isComputed());
 292.489 -
 292.490 -        List<Fix> fixes = toFix.getFixes().getFixes();
 292.491 -        List<String> fixNames = new LinkedList<String>();
 292.492 -        Fix toApply = null;
 292.493 -
 292.494 -        for (Fix f : fixes) {
 292.495 -            if (fixDebugString.equals(toDebugString(info, f))) {
 292.496 -                toApply = f;
 292.497 -            }
 292.498 -
 292.499 -            fixNames.add(toDebugString(info, f));
 292.500 -        }
 292.501 -
 292.502 -        assertNotNull("Cannot find fix to invoke: " + fixNames.toString(), toApply);
 292.503 -
 292.504 -        toApply.implement();
 292.505 -
 292.506 -        FileObject toCheck = sourceRoot.getFileObject(fileName);
 292.507 -
 292.508 -        assertNotNull(toCheck);
 292.509 -
 292.510 -        DataObject toCheckDO = DataObject.find(toCheck);
 292.511 -        EditorCookie ec = toCheckDO.getCookie(EditorCookie.class);
 292.512 -        Document toCheckDocument = ec.openDocument();
 292.513 -
 292.514 -        String realCode = toCheckDocument.getText(0, toCheckDocument.getLength());
 292.515 -
 292.516 -        //ignore whitespaces:
 292.517 -        realCode = realCode.replaceAll("[ \t\n]+", " ");
 292.518 -
 292.519 -        if (golden != null) {
 292.520 -            golden = golden.replaceAll("[ \t\n]+", " ");
 292.521 -            assertEquals("The output code does not match the expected code.", golden, realCode);
 292.522 -        }
 292.523 -
 292.524 -        LifecycleManager.getDefault().saveAll();
 292.525 -
 292.526 -        return realCode;
 292.527 -    }
 292.528 -
 292.529 -    private String toDebugString(CompilationInfo info, Fix f) {
 292.530 -        return "FixImpl";
 292.531 -    }
 292.532 -
 292.533 -    @Override
 292.534 -    public String getWorkDirPath() {
 292.535 -        if (this.wordDirPath != null) {
 292.536 -            return this.wordDirPath;
 292.537 -        }
 292.538 -        
 292.539 -        return super.getWorkDirPath();
 292.540 -    }
 292.541 -
 292.542 -    private static void deleteFile(File file) throws IOException {
 292.543 -        if (file.isDirectory()) {
 292.544 -            // file is a directory - delete sub files first
 292.545 -            File files[] = file.listFiles();
 292.546 -            for (int i = 0; i < files.length; i++) {
 292.547 -                deleteFile(files[i]);
 292.548 -            }
 292.549 -
 292.550 -        }
 292.551 -        // file is a File :-)
 292.552 -        boolean result = file.delete();
 292.553 -        if (result == false ) {
 292.554 -            // a problem has appeared
 292.555 -            throw new IOException("Cannot delete file, file = "+file.getPath());
 292.556 -        }
 292.557 -    }
 292.558 -}