Compare commits

...

150 Commits

Author SHA1 Message Date
Vyacheslav Gerasimov
d9dac3e89e Revert "Update to ASM 6-alpha from intellij 171"
This reverts commit 15502b4153.

# Conflicts:
#	.idea/libraries/idea_full.xml
#	.idea/libraries/intellij_core.xml
#	ultimate/.idea/libraries/idea_full.xml
#	ultimate/.idea/libraries/intellij_core.xml
2017-04-05 20:39:13 +03:00
Vyacheslav Gerasimov
11ba2ee3eb Fix tests compilation 2017-04-05 19:24:16 +03:00
Vyacheslav Gerasimov
50eb1e6067 Fix compilation KotlinFacetSettingsProviderImpl 2017-04-05 19:23:48 +03:00
Vyacheslav Gerasimov
a9fdef8d1a Fix compilation: Set sdk to Jdk8 for some modules 2017-04-05 19:21:05 +03:00
Vyacheslav Gerasimov
4eb31f305a Revert "Minor: remove warnings in KotlinDebuggerTestBase"
This reverts commit 5405c81106.
2017-04-05 19:07:42 +03:00
Vyacheslav Gerasimov
fd83406099 Revert "fix compilation against branch 163"
This reverts commit a2b0b3d6eb.
2017-04-05 18:59:10 +03:00
Vyacheslav Gerasimov
c35aef559b Revert "LightQuickFixTestCase.parseActionHint() method was removed"
This reverts commit 4f079d2768.
2017-04-05 18:58:56 +03:00
Vyacheslav Gerasimov
8ebef3a32e Revert "AbstractQuickFixTest: rename to .kt"
This reverts commit ad59a122ac.
2017-04-05 18:58:48 +03:00
Vyacheslav Gerasimov
4d7445e95a Revert "AbstractQuickFixTest: J2K"
This reverts commit 34ad19a912.
2017-04-05 18:58:40 +03:00
Vyacheslav Gerasimov
02f1d9d4ef Revert "Rewrite AbstractQuickFixTest based on light fixture test case"
This reverts commit e2f75463d7.

# Conflicts:
#	idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt
2017-04-05 18:58:32 +03:00
Vyacheslav Gerasimov
14cf379d98 Revert "AbstractQuickFixMultiFileTest: rename to .kt"
This reverts commit d11ea64f00.
2017-04-05 18:58:13 +03:00
Vyacheslav Gerasimov
1e8379654a Revert "AbstractQuickFixMultiFileTest: J2K"
This reverts commit 387dbdf3bb.
2017-04-05 18:57:59 +03:00
Vyacheslav Gerasimov
26df1e717e Revert "Convert AbstractQuickFixMultiFileTest to light fixture test case"
This reverts commit 4f229c3fdc.
2017-04-05 18:57:50 +03:00
Vyacheslav Gerasimov
3aad37aba4 Revert "Convert AddOpenToClassDeclarationTest to regular multifile quickfix test"
This reverts commit 79c814636e.
2017-04-05 18:57:40 +03:00
Vyacheslav Gerasimov
38fc80b787 Fix compilation KotlinCliJavaFileManagerImpl 2017-04-05 18:53:46 +03:00
Vyacheslav Gerasimov
13008f8bf9 Fix compilation J2kPostProcessor 2017-04-05 18:52:52 +03:00
Vyacheslav Gerasimov
35812d90ea Revert "Replace CompilingEvaluatorUtils methods with ClassLoadingUtils"
This reverts commit 2aa1b19ec9.
2017-04-05 18:52:30 +03:00
Vyacheslav Gerasimov
5615cee639 Fix compilation KotlinInlineFunctionDialog 2017-04-05 18:51:02 +03:00
Vyacheslav Gerasimov
988cdd6f3f Fix compilation MovePropertyToConstructorIntention 2017-04-05 18:47:36 +03:00
Mikhail Glukhikh
6387e64d11 Fix compilation (ResourceFoldingBuilder) 2017-04-05 18:40:45 +03:00
Mikhail Glukhikh
1f26e4e77c Fix compilation (KotlinGradleAndroidModuleModel...) 2017-04-05 18:40:45 +03:00
Alexey Sedunov
3ddf89f79f Kotlin Facet: Configure facet on Gradle project sync in Android Studio 2.2
#KT-15909 Fixed
2017-04-05 18:40:45 +03:00
Yan Zhulanow
1ac355b141 Remove Maven parts from all-open and no-arg
(cherry picked from commit 4ca2e8a)
2017-04-05 18:40:44 +03:00
Yan Zhulanow
94daf4602e Remove Maven plugin dependency in plugin.xml cause we don't have proper Maven support in plugins for AS anyway
(cherry picked from commit f9dd57c)
2017-04-05 18:40:44 +03:00
Yan Zhulanow
6bd1a07022 Remove generated tests with changes
(cherry picked from commit b535f45)
2017-04-05 18:40:44 +03:00
Yan Zhulanow
4e168a4ce9 CreateFileResourceQuickFix now accepts ResourceFolderType instead of ResourceType
(cherry picked from commit 1c12e9a)

(cherry picked from commit bd13d20)

(cherry picked from commit 0a49462)
2017-04-05 18:40:44 +03:00
Yan Zhulanow
78e99f2678 Disable Maven and JPS modules which is not available in AS
(cherry picked from commit c00cc57)

# Conflicts:
#	.idea/modules.xml
#	jps-plugin/bare-plugin/bare-plugin.iml
2017-04-05 18:40:44 +03:00
Vyacheslav Gerasimov
c851ad42ed Fixed KotlinAndroidResourceQuickFixProvider for AS 2.2 2017-04-05 18:40:44 +03:00
Dmitry Jemerov
a7b5f65e67 fix build: don't use same property name for two different things 2017-04-05 18:40:44 +03:00
Dmitry Jemerov
4511948927 use AS 2.2 page to download AS 2.2 2017-04-05 18:40:44 +03:00
Dmitry Jemerov
a48dc2498d fix compilation 2017-04-05 18:40:44 +03:00
Dmitry Jemerov
179e923e7f Fix compilation of AS 2.2 linters against AS 2.2 2017-04-05 18:40:43 +03:00
Dmitry Jemerov
8690ff7048 update path to Android common jar 2017-04-05 18:40:43 +03:00
Pavel V. Talanov
3a812ea1ef Add step to patch plugin xml so that it only works in Android Studio
(cherry picked from commit fcee4eb)
2017-04-05 18:40:43 +03:00
Yan Zhulanow
467a6570c1 Compile test files to jars with the unique names
(cherry picked from commit 3cffd85)
2017-04-05 18:40:43 +03:00
Yan Zhulanow
fc97c93006 Workaround for duplicate ProductivityFeaturesRegistry.xml file (in idea.jar and resources.jar)
(cherry picked from commit cef48ca)
2017-04-05 18:40:43 +03:00
Yan Zhulanow
93826a2414 Disable Maven and JPS modules which is not available in AS
(cherry picked from commit c00cc57)
2017-04-05 18:40:42 +03:00
Yan Zhulanow
9fe0af518c Migrate IDEA plugin code to Android Studio 2.2 (br 145)
(cherry picked from commit 162357e)
2017-04-05 18:40:28 +03:00
Dmitry Jemerov
3a8966e7a4 always update Android Studio 2017-04-05 18:40:28 +03:00
Stanislav Erokhin
4d40e0e566 Update "update_android_studio" task.
update_android_studio now downloads Android Studio (2.2) into ideaSDK instead of android-studio.
Launch this task instead of "update" (all third-party dependencies will be downloaded as well).
(cherry picked from commit 39170944c5)

# Conflicts:
#	update_dependencies.xml
2017-04-05 18:40:28 +03:00
Dmitry Jemerov
db1523c4f2 Revert: Problem: workaround thread leaking problem 2017-04-05 18:38:06 +03:00
Dmitry Jemerov
76b2895fd6 Revert: Patch ThreadTracker during Kotlin plugin init 2017-04-05 18:38:06 +03:00
Dmitry Jemerov
14c2c2cc5b Revert "Push Down: Support moving members from Java to Kotlin class"
This reverts commit f9e877ce96.
2017-04-05 18:38:05 +03:00
Mikhail Glukhikh
7905e4e91c Fix compilation in 161 branch (KtLightClassForLocalDeclaration) 2017-04-05 18:38:05 +03:00
Mikhail Glukhikh
988f56a8b0 Fix compilation (AbstractAndroidFoldingTest) 2017-04-05 18:38:05 +03:00
Mikhail Glukhikh
9515e981c1 Revert startInWriteAction in quick-fix for EqualsOrHashCodeInspection (no such thing in 161) 2017-04-05 18:38:05 +03:00
mglukhikh
66fedeeeee Quick doc provider test fix (2016.1 platform specific) 2017-04-05 18:38:05 +03:00
mglukhikh
8a82613122 Debugger test fix (161 branch specific) 2017-04-05 18:38:05 +03:00
Mikhail Glukhikh
be11eee3f0 Revert commit d13c342 to fix KotlinConsoleKeeper in 161 / AS22 2017-04-05 18:38:05 +03:00
Mikhail Glukhikh
1b5b097304 Fix 161 branch IDE tests by removing "compatible build" 2017-04-05 18:38:05 +03:00
mglukhikh
b6ae2c1479 Fix compilation (KotlinLineMarkerProvider) 2017-04-05 18:38:05 +03:00
mglukhikh
8f1926f417 Fix compilation (KotlinSuspendCallLineMarkerProvider) 2017-04-05 18:38:05 +03:00
Ilya Chernikov
4953bdb906 Fix compilation 2017-04-05 18:38:05 +03:00
Yan Zhulanow
052bec95f5 Revert "Rename: Fix exceptions on moving file with facade class to another package"
This reverts commit f8513abfa1.

(cherry picked from commit e53914d)
2017-04-05 18:38:05 +03:00
Ilya Chernikov
a80f31c8f4 Fix test code after KotlinTestUtils api changes 2017-04-05 18:38:04 +03:00
Ilya Chernikov
da50dd045d Fix missing api problem by copying functions from newer IOUtil 2017-04-05 18:38:04 +03:00
Dmitry Jemerov
afa6689b7b revert Snappy version 2017-04-05 18:38:04 +03:00
Dmitry Jemerov
0ddc5bf4cc Revert: Get rid of deprecated (as of IDEA 2016.2) method calls 2017-04-05 18:38:03 +03:00
Dmitry Jemerov
f92546095b Fix compilation of AS 2.2 linters against IJ 2016.1 2017-04-05 18:38:03 +03:00
Dmitry Jemerov
7babe6fbf6 fix compilation under 161 2017-04-05 18:38:03 +03:00
Dmitry Jemerov
0b8c6fa757 delete postfix template test from 161 branch 2017-04-05 18:38:03 +03:00
Dmitry Jemerov
e531612026 compilation fix 2017-04-05 18:38:03 +03:00
Dmitry Jemerov
55416ca33f set plugins compatible build to a version which is compatible with the Kotlin plugin 2017-04-05 18:38:03 +03:00
Dmitry Jemerov
ca5c6aa2b3 Revert: Problem: fix thread leaking check fail on teamcity for ultimate rename tests 2017-04-05 18:38:03 +03:00
Dmitry Jemerov
9b778be71f fix compilation against 161 (KotlinSteppingCommandProvider) 2017-04-05 18:38:03 +03:00
Dmitry Jemerov
3707b8a90a Revert "Add TransactionGuard application service to KotlinCoreEnvironment"
This reverts commit 3e0b79e40a.
2017-04-05 18:38:03 +03:00
Dmitry Jemerov
9f6302dc73 Revert "Push Down: Support moving members from Java to Kotlin class"
This reverts commit f9e877ce96.
2017-04-05 18:38:03 +03:00
Dmitry Jemerov
a04c2e5437 until build for 2016.1 version of the plugin 2017-04-05 18:38:02 +03:00
Dmitry Jemerov
8342f5aabe do not register Kotlin postfix template provider 2017-04-05 18:38:02 +03:00
Dmitry Jemerov
3de6fecd92 Revert: Fix goto implementation tests - deffered task should be executed 2017-04-05 18:38:02 +03:00
Dmitry Jemerov
10c1a0d7f9 Revert: Fix goto implementation tests - deffered task should be executed 2017-04-05 18:38:02 +03:00
Dmitry Jemerov
c002e4f838 Revert: Test only: method signature changed 2017-04-05 18:38:02 +03:00
Dmitry Jemerov
557e9ab9e7 Revert: Problem: workaround thread leaking problem 2017-04-05 18:38:02 +03:00
Dmitry Jemerov
25d4249f3f Revert: Register TypeAnnotationModifier EP in environment for web demo converter 2017-04-05 18:36:47 +03:00
Dmitry Jemerov
51b0f247d8 Revert: Tests only: codeCleanup() method signature was changed 2017-04-05 18:36:47 +03:00
Dmitry Jemerov
18bd24a8a4 Revert: Tests only: Constructor for XWatchesViewImpl was changed 2017-04-05 18:36:47 +03:00
Dmitry Jemerov
c40e414102 Revert: Tests only: add new method in MockPsiManager.java 2017-04-05 18:36:46 +03:00
Dmitry Jemerov
26c4575ef9 Revert: Tests only: reparseRange parameters changed 2017-04-05 18:36:46 +03:00
Dmitry Jemerov
8656f69245 Revert: Tests only: implement new method 2017-04-05 18:36:46 +03:00
Dmitry Jemerov
de753fda58 Revert: Register TypeAnnotationModifier as extension point 2017-04-05 18:36:46 +03:00
Dmitry Jemerov
f7247c2820 Revert: More write action requirement remove 2017-04-05 18:36:46 +03:00
Dmitry Jemerov
89139d9fdf Revert: API Change: Implement new method isSuppressAll() 2017-04-05 18:36:46 +03:00
Dmitry Jemerov
de295c8730 Revert startInWriteAction() methods 2017-04-05 18:36:46 +03:00
Dmitry Jemerov
acca579e5c Revert: registerUnresolvedError is in base class in idea from br146 2017-04-05 18:36:46 +03:00
Dmitry Jemerov
07067eaf75 Revert: Patch ThreadTracker during Kotlin plugin init 2017-04-05 18:36:46 +03:00
Dmitry Jemerov
05b74313dd revert IDEA version to 2016.1.2 2017-04-05 18:36:46 +03:00
Mikhail Zarechenskiy
85b1bbda27 Revert "Update IDEA to 171.2613.7"
This reverts commit 99af2a809b.
2017-04-05 18:36:45 +03:00
Mikhail Zarechenskiy
d7de19208c Revert "Migrate IDEA plugin code to Android Studio 2.2 (br 145)"
This reverts commit 24c9b6e171.
2017-04-05 18:36:44 +03:00
Mikhail Zarechenskiy
ba0251086a Revert "fix compilation against branch 163"
This reverts commit a2b0b3d6eb.
2017-04-05 18:36:44 +03:00
Mikhail Zarechenskiy
db4e3ee05e Revert "Update compatible build number range"
This reverts commit aced2e7eb4.
2017-04-05 18:36:33 +03:00
Mikhail Zarechenskiy
1129b291c3 Revert "update Kotlin icons according to new IntelliJ style"
This reverts commit fcdd5e0a19.
2017-04-05 18:36:33 +03:00
Mikhail Zarechenskiy
40cee7c423 Revert "Add resources_en.jar to properties plugin classpath"
This reverts commit 036bfed984.
2017-04-05 18:36:33 +03:00
Mikhail Zarechenskiy
ecbe9eafbb Revert "register PsiElementFinder extensions before JavaPsiFacade is registered"
This reverts commit e51018406f.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
f3a660dd8e Revert "Advance idea.plugins.compatible.build"
This reverts commit b101550cae.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
4400211ca6 Revert "Fix dist by ignoring some library classes during compiler shrinking"
This reverts commit 6d958eb32b.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
d1ba810d57 Revert "JPS: implement tracking of null annotations"
This reverts commit 05f278ce20.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
313c64808e Revert "fix compilation of new lint checks against IDEA 163"
This reverts commit b10073465c.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
2a50c74fe6 Revert "remove write action around closeAndDeleteProject()"
This reverts commit ab5067a0d3.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
838b38508e Revert "fix compilation"
This reverts commit 594e2b6a77.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
d51725e088 Revert "Fixed KotlinAndroidResourceQuickFixProvider for AS 2.2"
This reverts commit 180ae070ee.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
ae020d237b Revert "Fix test code after UsefulTestCase api changes"
This reverts commit 4be5fcc14a.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
9705b88415 Revert "CreateFileResourceQuickFix now accepts ResourceFolderType instead of ResourceType"
This reverts commit 59055e28ee.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
31733629a4 Revert "doMoveFile() now accepts not-null PsiDirectory"
This reverts commit 0995f2700e.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
3c1397a05c Revert "Fix compilation"
This reverts commit 60a2151a33.
2017-04-05 18:36:32 +03:00
Mikhail Zarechenskiy
d832cd1095 Revert "Workaround for hanging test"
This reverts commit 715410a9bc.
2017-04-05 18:36:31 +03:00
Mikhail Zarechenskiy
774c19d5b0 Revert "Move android modules to Java 8 SDK"
This reverts commit 2eb6c393a4.
2017-04-05 18:36:31 +03:00
Mikhail Zarechenskiy
16ee80b105 Revert "Fix ConfigureProjectTestGenerated / GradleConfigureProject ... for branch 163 (jre7->jre8)"
This reverts commit 83a8b041ad.
2017-04-05 18:36:31 +03:00
Mikhail Zarechenskiy
b2b347fb56 Revert "Fix imports vs 2016.3 (ResourceFoldingBuilder)"
This reverts commit e6cefba98b.
2017-04-05 18:36:31 +03:00
Mikhail Zarechenskiy
006b9f1b0f Revert "Remove unused import"
This reverts commit ed9e083008.
2017-04-05 18:36:31 +03:00
Mikhail Zarechenskiy
dbefbdcdbb Revert "Update guava 19.0 sources jar"
This reverts commit 9f51b12193.
2017-04-05 18:36:31 +03:00
Mikhail Zarechenskiy
3f7aa5ccf6 Revert "LightQuickFixTestCase.parseActionHint() method was removed"
This reverts commit 4f079d2768.
2017-04-05 18:34:39 +03:00
Mikhail Zarechenskiy
9466b0efe5 Revert "Updated nullability in RunLineMarkerContributor"
This reverts commit 3e6f57b684.
2017-04-05 18:34:33 +03:00
Mikhail Zarechenskiy
6155deae45 Revert "Update after separating JPS builders into two modules"
This reverts commit 95061885b0.
2017-04-05 18:34:33 +03:00
Mikhail Zarechenskiy
7f83242b8e Revert "Do not wrap analyze into write action priority in tests"
This reverts commit 82a2a705fb.
2017-04-05 18:34:33 +03:00
Mikhail Zarechenskiy
eae520c498 Revert "Run tests in read action and not in EDT thread"
This reverts commit bcf29e6fbf.
2017-04-05 18:34:33 +03:00
Mikhail Zarechenskiy
53acfa3f08 Revert "Use new api from idea 171 in KotlinStepOverInlinedLinesHint"
This reverts commit eb8415a1f3.
2017-04-05 18:34:32 +03:00
Mikhail Zarechenskiy
c1b537ecb6 Revert "Try to avoid exception in getOffset() call"
This reverts commit 615f9d3a1f.
2017-04-05 18:34:32 +03:00
Mikhail Zarechenskiy
8828917226 Revert "Replace removed method in LibraryPresentationProviders"
This reverts commit e57b3651c2.
2017-04-05 18:34:32 +03:00
Mikhail Zarechenskiy
cd59a90131 Revert "Port setInPerformanceTest -> setInStressTest"
This reverts commit 7da424d53f.
2017-04-05 18:34:32 +03:00
Mikhail Zarechenskiy
6d6a3c5840 Revert "! (TODO) Update build test data in 171"
This reverts commit 1d29c81346.
2017-04-05 18:34:32 +03:00
Mikhail Zarechenskiy
569baedf54 Revert "Update to 171.SNAPSHOT to pick up fix for IDEA-169570; fix compilation"
This reverts commit 12fc89f35d.
2017-04-05 18:34:31 +03:00
Mikhail Zarechenskiy
d272a03ca0 Revert "Fix testdata: Android projects use kotlin-stdlib-jre7"
This reverts commit 49a4625368.
2017-04-05 18:33:54 +03:00
Mikhail Zarechenskiy
8362b549a6 Revert "Fix GradleFacetImportTest: run write action only in EDT"
This reverts commit 3d98237304.
2017-04-05 18:33:54 +03:00
Mikhail Zarechenskiy
7859bed1d5 Revert "Don't try to create "add modifier" fix for read-only elements"
This reverts commit 374cf517e1.
2017-04-05 18:33:54 +03:00
Mikhail Zarechenskiy
ead1190c68 Revert "Fix testdata according to changes in automatic renaming rules in 17.1"
This reverts commit d6709b726e.
2017-04-05 18:33:54 +03:00
Mikhail Zarechenskiy
75fb665146 Revert "Fix testdata according to comment selection changes in 2017.1"
This reverts commit ad821e83bd.
2017-04-05 18:33:54 +03:00
Mikhail Zarechenskiy
122c714e27 Revert "Fix testdata according to contract inference changes in 2017.1"
This reverts commit a539939388.
2017-04-05 18:33:54 +03:00
Mikhail Zarechenskiy
47180d7ec5 Revert "Fix service and EP registration according to changes in 2017.1"
This reverts commit 097ba45783.
2017-04-05 18:33:53 +03:00
Mikhail Zarechenskiy
8c9c687694 Revert "Register MetaLanguage extension point in ParsingTestCase"
This reverts commit b9f326bfa1.
2017-04-05 18:33:53 +03:00
Mikhail Zarechenskiy
e221d67e66 Revert "Remove write action around finishLookup(), according to IJ 2017.1 req"
This reverts commit 61f157e89d.
2017-04-05 18:33:53 +03:00
Mikhail Zarechenskiy
d8e8e23c5b Revert "Register MetaLanguage.EP_NAME in J2K test"
This reverts commit a8bd529871.
2017-04-05 18:33:53 +03:00
Mikhail Zarechenskiy
e345e2ed9a Revert "Remove Java 6/7 warning from expected output of the compiler"
This reverts commit 0d86bdd216.
2017-04-05 18:33:53 +03:00
Mikhail Zarechenskiy
b08a8bbb9c Revert "Fix NPE in tests when ProjectFileIndex is not available"
This reverts commit 0638106bf3.
2017-04-05 18:33:53 +03:00
Mikhail Zarechenskiy
023271c388 Revert "Don't warn about ElementTraversal"
This reverts commit 4cae0538a8.
2017-04-05 18:33:53 +03:00
Mikhail Zarechenskiy
d17afd6bf7 Revert "Keep class file version during shrinking; generate Java 8 bytecode"
This reverts commit 3a8cf68541.
2017-04-05 18:33:53 +03:00
Mikhail Zarechenskiy
90fba2a2d2 Revert "JPS tests: avoid using deprecated API"
This reverts commit 40574d31ac.
2017-04-05 18:33:52 +03:00
Mikhail Zarechenskiy
0776133464 Revert "Black box update"
This reverts commit 496a21254b.
2017-04-05 18:33:34 +03:00
Mikhail Zarechenskiy
3940c8d944 Revert "Move: Fix tests in IDEA 2017.1"
This reverts commit b65460c12f.
2017-04-05 18:33:33 +03:00
Mikhail Zarechenskiy
a859123305 Revert "Safe Delete: Fix tests in IDEA 2017.1"
This reverts commit ecd56c6a40.
2017-04-05 18:33:33 +03:00
Mikhail Zarechenskiy
73bf7aef34 Revert "Move getting source position to manager thread in tests"
This reverts commit 4edfd0d960.
2017-04-05 18:33:33 +03:00
Mikhail Zarechenskiy
c7bec6143c Revert "Fix compileJavaAgainstKotlin tests"
This reverts commit 3c96099f7c.
2017-04-05 18:33:33 +03:00
Mikhail Zarechenskiy
5c8d9cc340 Revert "Fix JvmRuntimeDescriptorLoaderTestGenerated"
This reverts commit 33e9e660c4.
2017-04-05 18:32:48 +03:00
Mikhail Zarechenskiy
d52bef960a Revert "Fix KotlinVersionsTest, use SAX parser instead of DOM"
This reverts commit 449d1f6ad2.
2017-04-05 18:32:47 +03:00
Mikhail Zarechenskiy
4ae49f1c7a Revert "Update test data for ant task tests"
This reverts commit 999e1061b8.
2017-04-05 18:32:47 +03:00
Mikhail Zarechenskiy
c34f4856cd Revert "Adjust test data for IDEA 2017.1"
This reverts commit 10aedaf0f4.
2017-04-05 18:32:47 +03:00
Mikhail Zarechenskiy
c60859f8d8 Revert "kt1770.kt test rewrote during migration to 171 platform"
This reverts commit 211b58ac6e.
2017-04-05 18:32:47 +03:00
Mikhail Zarechenskiy
ebd2f0eaf6 Revert "Use LinkedHashSet instead of HashSet in DataFlowInfo.getCollectedTypes"
This reverts commit 555b3f12ee.
2017-04-05 18:32:47 +03:00
Mikhail Zarechenskiy
9e187e5555 Revert "Fix test: check highlighting only in one direction"
This reverts commit cf18c2243f.
2017-04-05 18:32:46 +03:00
Mikhail Zarechenskiy
2988de6e75 Revert "Fix regression of completion inside string templates"
This reverts commit 2804264289.
2017-04-05 18:32:46 +03:00
Mikhail Zarechenskiy
18d55287ea Revert "Spring Support: Fix tests in IDEA 2017.1"
This reverts commit 2e3617adbb.
2017-04-05 18:32:46 +03:00
502 changed files with 2403 additions and 3698 deletions

View File

@@ -1,30 +0,0 @@
<component name="ArtifactManager">
<artifact type="jar" name="KotlinJpsPlugin">
<output-path>$PROJECT_DIR$/out/artifacts/KotlinJpsPlugin</output-path>
<properties id="ant-postprocessing">
<options enabled="true">
<file>file://$PROJECT_DIR$/idea-runner/runner.xml</file>
<target>copy-runtime-for-jps-plugin</target>
</options>
</properties>
<root id="archive" name="kotlin-jps-plugin.jar">
<element id="directory" name="META-INF">
<element id="dir-copy" path="$PROJECT_DIR$/jps-plugin/src/META-INF" />
</element>
<element id="module-output" name="cli-common" />
<element id="module-output" name="idea-jps-common" />
<element id="module-output" name="jps-plugin" />
<element id="module-output" name="preloader" />
<element id="module-output" name="util" />
<element id="module-output" name="util.runtime" />
<element id="file-copy" path="$PROJECT_DIR$/resources/kotlinManifest.properties" />
<element id="module-output" name="daemon-client" />
<element id="module-output" name="daemon-common" />
<element id="module-output" name="deserialization" />
<element id="extracted-dir" path="$PROJECT_DIR$/dependencies/native-platform-uberjar.jar" path-in-jar="/" />
<element id="module-output" name="android-extensions-jps" />
<element id="module-output" name="build-common" />
<element id="module-output" name="compiler-runner" />
</root>
</artifact>
</component>

View File

@@ -51,9 +51,7 @@
<element id="module-output" name="idea-live-templates" />
<element id="module-output" name="resolution" />
<element id="module-output" name="plugin-api" />
<element id="module-output" name="idea-ultimate" />
<element id="module-output" name="formatter" />
<element id="module-output" name="idea-maven" />
<element id="extracted-dir" path="$PROJECT_DIR$/dependencies/protobuf-2.6.1.jar" path-in-jar="/" />
<element id="module-output" name="backend.common" />
<element id="module-output" name="ir.tree" />
@@ -62,9 +60,6 @@
<element id="module-output" name="annotation-based-compiler-plugins-ide-support" />
</element>
<element id="library" level="project" name="javax.inject" />
<element id="directory" name="jps">
<element id="artifact" artifact-name="KotlinJpsPlugin" />
</element>
<element id="library" level="project" name="markdown" />
<element id="archive" name="kotlin-android-extensions-plugin.jar">
<element id="module-output" name="android-extensions-idea" />

View File

@@ -6,7 +6,7 @@
<CLASSES>
<root url="file://$PROJECT_DIR$/ideaSDK/plugins/android/lib" />
<root url="file://$PROJECT_DIR$/ideaSDK/plugins/android/lib/jps" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/android-common.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/android-base-common.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>

View File

@@ -8,7 +8,7 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/asm-src.zip!/" />
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
</SOURCES>
</library>
</component>

View File

@@ -4,11 +4,11 @@
<root url="file://$PROJECT_DIR$/annotations" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/guava-19.0.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/guava-17.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/guava-19.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -9,9 +9,9 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/guava-19.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/asm-src.zip!/" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/lib" recursive="false" />
</library>

View File

@@ -9,9 +9,9 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/guava-19.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/asm-src.zip!/" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/core" recursive="false" />
</library>

View File

@@ -5,7 +5,6 @@
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/properties/lib/properties.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/properties/lib/resources_en.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>

1
.idea/misc.xml generated
View File

@@ -6,6 +6,7 @@
</properties>
</component>
<component name="EntryPointsManager">
<entry_points version="2.0" />
<list size="1">
<item index="0" class="java.lang.String" itemvalue="javax.inject.Inject" />
</list>

5
.idea/modules.xml generated
View File

@@ -8,7 +8,6 @@
<module fileurl="file://$PROJECT_DIR$/plugins/lint/android-annotations/android-annotations.iml" filepath="$PROJECT_DIR$/plugins/lint/android-annotations/android-annotations.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/android-extensions/android-extensions-compiler/android-extensions-compiler.iml" filepath="$PROJECT_DIR$/plugins/android-extensions/android-extensions-compiler/android-extensions-compiler.iml" group="plugins/android-extensions" />
<module fileurl="file://$PROJECT_DIR$/plugins/android-extensions/android-extensions-idea/android-extensions-idea.iml" filepath="$PROJECT_DIR$/plugins/android-extensions/android-extensions-idea/android-extensions-idea.iml" group="plugins/android-extensions" />
<module fileurl="file://$PROJECT_DIR$/plugins/android-extensions/android-extensions-jps/android-extensions-jps.iml" filepath="$PROJECT_DIR$/plugins/android-extensions/android-extensions-jps/android-extensions-jps.iml" group="plugins/android-extensions" />
<module fileurl="file://$PROJECT_DIR$/android-studio/android-studio.iml" filepath="$PROJECT_DIR$/android-studio/android-studio.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/compiler/android-tests/android-tests.iml" filepath="$PROJECT_DIR$/compiler/android-tests/android-tests.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/plugins/annotation-based-compiler-plugins-ide-support/annotation-based-compiler-plugins-ide-support.iml" filepath="$PROJECT_DIR$/plugins/annotation-based-compiler-plugins-ide-support/annotation-based-compiler-plugins-ide-support.iml" group="plugins" />
@@ -52,7 +51,6 @@
<module fileurl="file://$PROJECT_DIR$/idea/idea-core/idea-core.iml" filepath="$PROJECT_DIR$/idea/idea-core/idea-core.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-jps-common/idea-jps-common.iml" filepath="$PROJECT_DIR$/idea/idea-jps-common/idea-jps-common.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-live-templates/idea-live-templates.iml" filepath="$PROJECT_DIR$/idea/idea-live-templates/idea-live-templates.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-maven/idea-maven.iml" filepath="$PROJECT_DIR$/idea/idea-maven/idea-maven.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-repl/idea-repl.iml" filepath="$PROJECT_DIR$/idea/idea-repl/idea-repl.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea-runner/idea-runner.iml" filepath="$PROJECT_DIR$/idea-runner/idea-runner.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-test-framework/idea-test-framework.iml" filepath="$PROJECT_DIR$/idea/idea-test-framework/idea-test-framework.iml" group="ide" />
@@ -63,8 +61,6 @@
<module fileurl="file://$PROJECT_DIR$/compiler/ir/ir.tree/ir.tree.iml" filepath="$PROJECT_DIR$/compiler/ir/ir.tree/ir.tree.iml" group="compiler/ir" />
<module fileurl="file://$PROJECT_DIR$/j2k/j2k.iml" filepath="$PROJECT_DIR$/j2k/j2k.iml" group="j2k" />
<module fileurl="file://$PROJECT_DIR$/plugins/java-model-wrappers/java-model-wrappers.iml" filepath="$PROJECT_DIR$/plugins/java-model-wrappers/java-model-wrappers.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/jps-plugin/jps-plugin.iml" filepath="$PROJECT_DIR$/jps-plugin/jps-plugin.iml" group="ide/jps" />
<module fileurl="file://$PROJECT_DIR$/jps-plugin/jps-tests/jps-tests.iml" filepath="$PROJECT_DIR$/jps-plugin/jps-tests/jps-tests.iml" group="ide/jps" />
<module fileurl="file://$PROJECT_DIR$/js/js.ast/js.ast.iml" filepath="$PROJECT_DIR$/js/js.ast/js.ast.iml" group="compiler/js" />
<module fileurl="file://$PROJECT_DIR$/js/js.frontend/js.frontend.iml" filepath="$PROJECT_DIR$/js/js.frontend/js.frontend.iml" group="compiler/js" />
<module fileurl="file://$PROJECT_DIR$/js/js.inliner/js.inliner.iml" filepath="$PROJECT_DIR$/js/js.inliner/js.inliner.iml" group="compiler/js" />
@@ -72,7 +68,6 @@
<module fileurl="file://$PROJECT_DIR$/js/js.serializer/js.serializer.iml" filepath="$PROJECT_DIR$/js/js.serializer/js.serializer.iml" group="compiler/js" />
<module fileurl="file://$PROJECT_DIR$/js/js.tests/js.tests.iml" filepath="$PROJECT_DIR$/js/js.tests/js.tests.iml" group="compiler/js" />
<module fileurl="file://$PROJECT_DIR$/js/js.translator/js.translator.iml" filepath="$PROJECT_DIR$/js/js.translator/js.translator.iml" group="compiler/js" />
<module fileurl="file://$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml" filepath="$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml" group="ide/jps" />
<module fileurl="file://$PROJECT_DIR$/plugins/kapt3/kapt3.iml" filepath="$PROJECT_DIR$/plugins/kapt3/kapt3.iml" />
<module fileurl="file://$PROJECT_DIR$/idea/kotlin-gradle-tooling/kotlin-gradle-tooling.iml" filepath="$PROJECT_DIR$/idea/kotlin-gradle-tooling/kotlin-gradle-tooling.iml" />
<module fileurl="file://$PROJECT_DIR$/compiler/light-classes/light-classes.iml" filepath="$PROJECT_DIR$/compiler/light-classes/light-classes.iml" group="compiler/java" />

View File

@@ -154,7 +154,7 @@
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="${compiled.stdlib.js}"/>
</target>
<target name="post_build" depends="zipArtifacts, revertTemplateFiles, printStatistics, remove_internal_artifacts, dont_remove_internal_artifacts"/>
<target name="post_build" depends="patchXmlForAndroidStudio, zipArtifacts, revertTemplateFiles, printStatistics, remove_internal_artifacts, dont_remove_internal_artifacts"/>
<target name="none">
<fail message="Either specify pre_build or post_build"/>
@@ -192,4 +192,28 @@
<target name="dont_remove_internal_artifacts" unless="need.remove.artifacts">
<echo message="Internal artifacts left untouched"/>
</target>
<macrodef name="patch_plugin_xml">
<attribute name="plugin.xml" />
<sequential>
<replace file="@{plugin.xml}" token="&lt;!-- DEPENDS-ON-AS-PLACEHOLDER --&gt;" value="&lt;depends&gt;com.intellij.modules.androidstudio&lt;/depends&gt;"/>
</sequential>
</macrodef>
<target name="patchXmlForAndroidStudio">
<unzip src="${artifact.output.path}/Kotlin/lib/kotlin-plugin.jar" dest="tmpAndroidStudio">
<patternset>
<include name="META-INF/plugin.xml"/>
</patternset>
</unzip>
<patch_plugin_xml plugin.xml="tmpAndroidStudio/META-INF/plugin.xml"/>
<jar destfile="${artifact.output.path}/Kotlin/lib/kotlin-plugin.jar" update="true">
<fileset dir="tmpAndroidStudio"/>
<file file="META-INF/plugin.xml"/>
</jar>
<delete file="tmpAndroidStudio"/>
</target>
</project>

View File

@@ -28,8 +28,7 @@
<property name="protobuf-lite.jar" value="${basedir}/dependencies/protobuf-2.6.1-lite.jar"/>
<property name="javax.inject.jar" value="${basedir}/lib/javax.inject.jar"/>
<property name="java.target" value="1.8"/>
<property name="java.target.1.6" value="1.6"/>
<property name="java.target" value="1.6"/>
<condition property="bootstrap.or.local.build" value="true">
<or>
@@ -1073,7 +1072,7 @@
</java>
<javac2 srcdir="${toString:src.dirset}" destdir="@{output}" debug="true" debuglevel="lines,vars,source"
includeAntRuntime="false" source="${java.target.1.6}" target="${java.target.1.6}">
includeAntRuntime="false" source="${java.target}" target="${java.target}">
<skip pattern="kotlin/Metadata"/>
<classpath>
<path refid="classpath.path"/>

View File

@@ -1,60 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.android.tests;
import org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase;
import java.io.File;
import java.io.IOException;
public class AndroidJpsBuildTestCase extends BaseKotlinJpsBuildTestCase {
private static final String PROJECT_NAME = "android-module";
private static final String SDK_NAME = "Android_SDK";
private final File workDir = new File(AndroidRunner.getPathManager().getTmpFolder());
public void doTest() {
initProject();
rebuildAllModules();
buildAllModules().assertSuccessful();
}
@Override
protected String getProjectName() {
return "android-module";
}
@Override
protected void runTest() throws Throwable {
doTest();
}
@Override
public String getName() {
return "AndroidJpsTest";
}
@Override
protected File doGetProjectDir() throws IOException {
return workDir;
}
private void initProject() {
addJdk(SDK_NAME, AndroidRunner.getPathManager().getPlatformFolderInAndroidSdk() + "/android.jar");
loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr");
}
}

View File

@@ -1,71 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.android.tests;
import com.google.common.io.Files;
import com.intellij.openapi.util.io.FileUtil;
import junit.framework.TestSuite;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class AndroidRunner extends TestSuite {
private static PathManager pathManager;
@NotNull
public static PathManager getPathManager() {
if (pathManager == null) {
File tmpFolder = Files.createTempDir();
System.out.println("Created temporary folder for running android tests: " + tmpFolder.getAbsolutePath());
File rootFolder = new File("");
pathManager = new PathManager(rootFolder.getAbsolutePath(), tmpFolder.getAbsolutePath());
}
return pathManager;
}
public static TestSuite suite() throws Throwable {
PathManager pathManager = getPathManager();
FileUtil.copyDir(new File(pathManager.getAndroidModuleRoot()), new File(pathManager.getTmpFolder()));
writeAndroidSkdToLocalProperties();
CodegenTestsOnAndroidGenerator.generate(pathManager);
System.out.println("Run tests on android...");
TestSuite suite = CodegenTestsOnAndroidRunner.getTestSuite(pathManager);
//AndroidJpsBuildTestCase indirectly depends on UsefulTestCase which compiled against java 8
//TODO: Need add separate run configuration for AndroidJpsBuildTestCase
//suite.addTest(new AndroidJpsBuildTestCase());
return suite;
}
public void tearDown() throws Exception {
// Clear tmp folder where we run android tests
FileUtil.delete(new File(pathManager.getTmpFolder()));
}
private static void writeAndroidSkdToLocalProperties() throws IOException {
System.out.println("Writing android sdk to local.properties: " + pathManager.getAndroidSdkRoot());
File file = new File(pathManager.getTmpFolder() + "/local.properties");
try (FileWriter fw = new FileWriter(file)) {
fw.write("sdk.dir=" + pathManager.getAndroidSdkRoot());
}
}
}

View File

@@ -158,11 +158,6 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
return result
}
override fun findModules(moduleName: String, scope: GlobalSearchScope): Collection<PsiJavaModule> {
// TODO
return emptySet()
}
override fun getNonTrivialPackagePrefixes(): Collection<String> = emptyList()
companion object {

View File

@@ -25,13 +25,10 @@ import com.intellij.core.CoreApplicationEnvironment
import com.intellij.core.CoreJavaFileManager
import com.intellij.core.JavaCoreApplicationEnvironment
import com.intellij.core.JavaCoreProjectEnvironment
import com.intellij.lang.MetaLanguage
import com.intellij.lang.java.JavaParserDefinition
import com.intellij.mock.MockApplication
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.TransactionGuard
import com.intellij.openapi.application.TransactionGuardImpl
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.extensions.Extensions
import com.intellij.openapi.extensions.ExtensionsArea
@@ -48,7 +45,6 @@ import com.intellij.openapi.vfs.impl.ZipHandler
import com.intellij.psi.FileContextProvider
import com.intellij.psi.PsiElementFinder
import com.intellij.psi.augment.PsiAugmentProvider
import com.intellij.psi.augment.TypeAnnotationModifier
import com.intellij.psi.compiled.ClassFileDecompilers
import com.intellij.psi.impl.JavaClassSupersImpl
import com.intellij.psi.impl.PsiElementFinderImpl
@@ -119,28 +115,6 @@ class KotlinCoreEnvironment private constructor(
override fun preregisterServices() {
registerProjectExtensionPoints(Extensions.getArea(project))
}
override fun registerJavaPsiFacade() {
with (project) {
registerService(CoreJavaFileManager::class.java, ServiceManager.getService(this, JavaFileManager::class.java) as CoreJavaFileManager)
val cliLightClassGenerationSupport = CliLightClassGenerationSupport(this)
registerService(LightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
registerService(CliLightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
registerService(CodeAnalyzerInitializer::class.java, cliLightClassGenerationSupport)
registerService(ExternalAnnotationsManager::class.java, MockExternalAnnotationsManager())
registerService(InferredAnnotationsManager::class.java, MockInferredAnnotationsManager())
val area = Extensions.getArea(this)
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(JavaElementFinder(this, cliLightClassGenerationSupport))
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(
PsiElementFinderImpl(this, ServiceManager.getService(this, JavaFileManager::class.java)))
}
super.registerJavaPsiFacade()
}
}
private val sourceFiles = ArrayList<KtFile>()
private val rootsIndex: JvmDependenciesDynamicCompoundIndex
@@ -366,7 +340,7 @@ class KotlinCoreEnvironment private constructor(
@JvmStatic
private fun setCompatibleBuild() {
System.getProperties().setProperty("idea.plugins.compatible.build", "171.9999")
//System.getProperties().setProperty("idea.plugins.compatible.build", "161.9999")
}
@TestOnly
@@ -432,9 +406,6 @@ class KotlinCoreEnvironment private constructor(
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ContainerProvider.EP_NAME, ContainerProvider::class.java)
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClsCustomNavigationPolicy.EP_NAME, ClsCustomNavigationPolicy::class.java)
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler::class.java)
//
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier::class.java)
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), MetaLanguage.EP_NAME, MetaLanguage::class.java)
}
private fun registerApplicationExtensionPointsAndExtensionsFrom(configuration: CompilerConfiguration, configFilePath: String) {
@@ -468,7 +439,6 @@ class KotlinCoreEnvironment private constructor(
registerParserDefinition(KotlinParserDefinition())
application.registerService(KotlinBinaryClassCache::class.java, KotlinBinaryClassCache())
application.registerService(JavaClassSupers::class.java, JavaClassSupersImpl::class.java)
application.registerService(TransactionGuard::class.java, TransactionGuardImpl::class.java)
}
}
@@ -489,11 +459,23 @@ class KotlinCoreEnvironment private constructor(
}
private fun registerProjectServicesForCLI(projectEnvironment: JavaCoreProjectEnvironment) {
/**
* Note that Kapt may restart code analysis process, and CLI services should be aware of that.
* Use PsiManager.getModificationTracker() to ensure that all the data you cached is still valid.
*/
with (projectEnvironment.project) {
registerService(CoreJavaFileManager::class.java, ServiceManager.getService(this, JavaFileManager::class.java) as CoreJavaFileManager)
val cliLightClassGenerationSupport = CliLightClassGenerationSupport(this)
registerService(LightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
registerService(CliLightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
registerService(CodeAnalyzerInitializer::class.java, cliLightClassGenerationSupport)
registerService(ExternalAnnotationsManager::class.java, MockExternalAnnotationsManager())
registerService(InferredAnnotationsManager::class.java, MockInferredAnnotationsManager())
val area = Extensions.getArea(this)
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(JavaElementFinder(this, cliLightClassGenerationSupport))
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(
PsiElementFinderImpl(this, ServiceManager.getService(this, JavaFileManager::class.java)))
}
}
}
}

View File

@@ -26,5 +26,11 @@ open class KotlinCoreProjectEnvironment(
disposable: Disposable,
applicationEnvironment: JavaCoreApplicationEnvironment
) : JavaCoreProjectEnvironment(disposable, applicationEnvironment) {
init {
myProject.registerService<ControlFlowFactory>(ControlFlowFactory::class.java,
ControlFlowFactory(myPsiManager))
}
override fun createCoreFileManager() = KotlinCliJavaFileManagerImpl(PsiManager.getInstance(project))
}

View File

@@ -45,10 +45,6 @@ messages/**)
-dontwarn com.google.j2objc.annotations.Weak
-dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionInputStream
-dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionOutputStream
-dontwarn com.google.common.util.concurrent.*
-dontwarn org.apache.xerces.dom.**
-dontwarn org.apache.xerces.util.**
-dontwarn org.w3c.dom.ElementTraversal
-libraryjars '<rtjar>'
-libraryjars '<jssejar>'
@@ -56,6 +52,7 @@ messages/**)
-libraryjars '<bootstrap.reflect>'
-libraryjars '<bootstrap.script.runtime>'
-target 1.6
-dontoptimize
-dontobfuscate

View File

@@ -20,14 +20,15 @@ import com.google.common.collect.*
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability.NOT_NULL
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.isFlexible
import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf
import org.jetbrains.kotlin.utils.newLinkedHashSetWithExpectedSize
import org.jetbrains.kotlin.types.typeUtil.*
import java.util.*
import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability.NOT_NULL
internal class DelegatingDataFlowInfo private constructor(
private val parent: DataFlowInfo?,
private val nullabilityInfo: ImmutableMap<DataFlowValue, Nullability>,
@@ -120,7 +121,7 @@ internal class DelegatingDataFlowInfo private constructor(
return types
}
val enrichedTypes = newLinkedHashSetWithExpectedSize<KotlinType>(types.size + 1)
val enrichedTypes = Sets.newHashSetWithExpectedSize<KotlinType>(types.size + 1)
val originalType = key.type
for (type in types) {
enrichedTypes.add(TypeUtils.makeNotNullable(type))

View File

@@ -61,7 +61,7 @@ open class KtLightClassForLocalDeclaration(
if (createWrapper) {
return object : LightMethod(myManager, method, containingClass!!, KotlinLanguage.INSTANCE) {
override fun getParent(): PsiElement {
return getContainingClass()
return getContainingClass()!!
}
override fun getName(): String {

View File

@@ -23,7 +23,6 @@ import com.intellij.psi.PsiElementVisitor
import com.intellij.psi.impl.compiled.ClsFileImpl
import com.intellij.psi.stubs.PsiClassHolderFileStub
import org.jetbrains.kotlin.asJava.classes.KtLightClass
import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
@@ -70,13 +69,4 @@ open class FakeFileForLightClass(
}
override fun isEquivalentTo(another: PsiElement?) = this == another
override fun setPackageName(packageName: String) {
if (lightClass() is KtLightClassForFacade) {
ktFile.packageDirective?.fqName = FqName(packageName)
}
else {
super.setPackageName(packageName)
}
}
}

View File

@@ -1,2 +1,3 @@
info: Kotlin Compiler version $VERSION$
warning: running the Kotlin compiler under Java 6 or 7 is unsupported and will no longer be possible in a future update.
OK

View File

@@ -1,4 +1,5 @@
warning: flag is not supported by this version of the compiler: -Xabcdefghijklm
warning: flag is not supported by this version of the compiler: -Xnopqrstuvwxyz
warning: flag is not supported by this version of the compiler: -XXxxxxxxxxxxxx
warning: running the Kotlin compiler under Java 6 or 7 is unsupported and will no longer be possible in a future update.
OK

View File

@@ -1,2 +1,3 @@
info: Kotlin Compiler version $VERSION$
warning: running the Kotlin compiler under Java 6 or 7 is unsupported and will no longer be possible in a future update.
OK

View File

@@ -2,16 +2,21 @@
// IGNORE_BACKEND: JS, NATIVE
// FULL_JDK
// WITH_RUNTIME
//This front-end problem test added to box ones only cause of FULL_JDK support
import org.w3c.dom.Element
import org.xml.sax.InputSource
import javax.xml.parsers.DocumentBuilderFactory
import java.io.StringReader
class MyElement(e: Element): Element by e {
fun bar() = "OK"
}
fun box() : String {
val touch = MyElement::class.java
return "OK"
val factory = DocumentBuilderFactory.newInstance()!!;
val builder = factory.newDocumentBuilder()!!;
val source = InputSource(StringReader("<OK></OK>"));
val doc = builder.parse(source)!!;
val myElement = MyElement(doc.getDocumentElement()!!)
return myElement.getTagName()!!
}

View File

@@ -25,10 +25,8 @@ fun box(): String {
// Java class without nested classes
assertEquals(emptyList<String>(), nestedNames(Error::class))
// Java interface with nested classes
assertEquals(listOf("Entry"), nestedNames(java.util.Map::class))
// Java class with nested classes
assertEquals(listOf("SimpleEntry", "SimpleImmutableEntry"), nestedNames(java.util.AbstractMap::class))
assertEquals(listOf("State", "UncaughtExceptionHandler"), nestedNames(Thread::class))
// Built-ins
assertEquals(emptyList<String>(), nestedNames(Array<Any>::class))

View File

@@ -1,5 +1,5 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JS, NATIVE, JVM
// WITH_REFLECT
// FULL_JDK

View File

@@ -16,10 +16,10 @@ open class TypeLiteral<T> {
inline fun <reified T> typeLiteral(): TypeLiteral<T> = object : TypeLiteral<T>() {}
fun box(): String {
assertEquals("java.lang.String", (typeLiteral<String>().type as Class<*>).canonicalName)
assertEquals("class java.lang.String", typeLiteral<String>().type.toString())
assertEquals("java.util.List<?>", typeLiteral<List<*>>().type.toString())
assertEquals("java.lang.String[]", (typeLiteral<Array<String>>().type as Class<*>).canonicalName)
assertEquals("java.lang.Integer[]", (typeLiteral<Array<Int>>().type as Class<*>).canonicalName)
assertEquals("java.lang.String[][]", (typeLiteral<Array<Array<String>>>().type as Class<*>).canonicalName)
assertEquals("java.lang.String[]", typeLiteral<Array<String>>().type.toString())
assertEquals("java.lang.Integer[]", typeLiteral<Array<Int>>().type.toString())
assertEquals("java.lang.String[][]", typeLiteral<Array<Array<String>>>().type.toString())
return "OK"
}
}

View File

@@ -1,26 +0,0 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_REFLECT
// FULL_JDK
// See KT-11258 Incorrect resolution sequence for Java field
//SHOULD BE deleted after KT-16616 fix
import java.util.*
fun box(): String {
listOf(
ArrayList::class,
LinkedList::class,
AbstractList::class,
HashSet::class,
TreeSet::class,
HashMap::class,
TreeMap::class,
AbstractMap::class,
AbstractMap.SimpleEntry::class
).map {
it.members.map(Any::toString)
}
return "OK"
}

View File

@@ -1,53 +0,0 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// FULL_JDK
// WITH_RUNTIME
interface ImmutableCollection<out E> : Collection<E> {
fun add(element: @UnsafeVariance E): ImmutableCollection<E>
fun addAll(elements: Collection<@UnsafeVariance E>): ImmutableCollection<E>
fun remove(element: @UnsafeVariance E): ImmutableCollection<E>
}
class ImmutableCollectionmpl<E> : ImmutableCollection<E> {
override val size: Int
get() = throw UnsupportedOperationException()
override fun contains(element: E): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun containsAll(elements: Collection<E>): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun isEmpty(): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun iterator(): Iterator<E> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun add(element: E): ImmutableCollection<E> = this
override fun addAll(elements: Collection<E>): ImmutableCollection<E> = this
override fun remove(element: E): ImmutableCollection<E> = this
}
fun box(): String {
val c = ImmutableCollectionmpl<String>()
if (c.remove("") !== c) return "fail 1"
if (c.add("") !== c) return "fail 2"
if (c.addAll(java.util.ArrayList()) !== c) return "fail 3"
val method = c.javaClass.methods.single { it.name == "remove" && it.returnType == Boolean::class.javaPrimitiveType }
try {
method.invoke(c, "")
return "fail 4"
} catch (e: java.lang.reflect.InvocationTargetException) {
if (e.cause!!.message != "Operation is not supported for read-only collection") return "fail 5: ${e.cause!!.message}"
}
return "OK"
}

View File

@@ -1,22 +0,0 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_REFLECT
// FILE: J.java
public class J {
void foo(String s, int i) {}
static void bar(J j) {}
}
// FILE: K.kt
import kotlin.test.assertEquals
fun box(): String {
assertEquals(listOf(null, "arg0", "arg1"), J::foo.parameters.map { it.name })
assertEquals(listOf("arg0"), J::bar.parameters.map { it.name })
return "OK"
}

View File

@@ -0,0 +1,33 @@
@kotlin.Metadata
public interface ImmutableCollection {
public abstract @org.jetbrains.annotations.NotNull method add(p0: java.lang.Object): ImmutableCollection
public abstract @org.jetbrains.annotations.NotNull method addAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): ImmutableCollection
public abstract @org.jetbrains.annotations.NotNull method remove(p0: java.lang.Object): ImmutableCollection
}
@kotlin.Metadata
public final class ImmutableCollectionmpl {
public method <init>(): void
public @org.jetbrains.annotations.NotNull method add(p0: java.lang.Object): ImmutableCollection
public method add(p0: java.lang.Object): boolean
public @org.jetbrains.annotations.NotNull method addAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): ImmutableCollection
public method addAll(p0: java.util.Collection): boolean
public method clear(): void
public method contains(p0: java.lang.Object): boolean
public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
public method getSize(): int
public method isEmpty(): boolean
public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator
public @org.jetbrains.annotations.NotNull method remove(p0: java.lang.Object): ImmutableCollection
public method remove(p0: java.lang.Object): boolean
public method removeAll(p0: java.util.Collection): boolean
public method retainAll(p0: java.util.Collection): boolean
public final method size(): int
public method toArray(): java.lang.Object[]
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
}
@kotlin.Metadata
public final class ImmutableRemoveKt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}

View File

@@ -0,0 +1,4 @@
@kotlin.Metadata
public final class KKt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}

View File

@@ -0,0 +1,13 @@
package test
public sealed class Season {
private constructor Season()
public final class Cold : test.Season {
public constructor Cold()
}
public final class Warm : test.Season {
public constructor Warm()
}
}

View File

@@ -0,0 +1,13 @@
package test
public sealed class Season {
private constructor Season()
public final class Cold : test.Season {
public constructor Cold()
}
public final class Warm : test.Season {
public constructor Warm()
}
}

View File

@@ -0,0 +1,9 @@
package test
@test.meta public/*package*/ final annotation class MyAnn : kotlin.Annotation {
public/*package*/ constructor MyAnn()
}
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS}) public final annotation class meta : kotlin.Annotation {
public constructor meta()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) public final annotation class classifier : kotlin.Annotation {
public constructor classifier()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CONSTRUCTOR}) public final annotation class constructor : kotlin.Annotation {
public constructor constructor()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {}) public final annotation class empty : kotlin.Annotation {
public constructor empty()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FIELD}) public final annotation class field : kotlin.Annotation {
public constructor field()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class function : kotlin.Annotation {
public constructor function()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY_GETTER}) public final annotation class getter : kotlin.Annotation {
public constructor getter()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.LOCAL_VARIABLE}) public final annotation class local : kotlin.Annotation {
public constructor local()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) public final annotation class multiple : kotlin.Annotation {
public constructor multiple()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) public final annotation class parameter : kotlin.Annotation {
public constructor parameter()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY}) public final annotation class property : kotlin.Annotation {
public constructor property()
}

View File

@@ -0,0 +1,5 @@
package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY_SETTER}) public final annotation class setter : kotlin.Annotation {
public constructor setter()
}

View File

@@ -5,11 +5,11 @@ build:
[mkdir] Created dir: [Temp]/classes
[javac] Compiling 1 source file to [Temp]/classes
[javac] Running javac...
[javac] [TestData]/J.java:3: error: cannot find symbol
[javac] [TestData]/J.java:3: cannot find symbol
[javac] symbol : class KClassesKt
[javac] location: package kotlin.reflect
[javac] import kotlin.reflect.KClassesKt;
[javac] ^
[javac] symbol: class KClassesKt
[javac] location: package kotlin.reflect
[javac] 1 error
ERR:

View File

@@ -5,7 +5,7 @@ build:
[mkdir] Created dir: [Temp]/classes
[javac] Compiling 1 source file to [Temp]/classes
[javac] Running javac...
[javac] [TestData]/J.java:3: error: package kotlin does not exist
[javac] [TestData]/J.java:3: package kotlin does not exist
[javac] import kotlin.Unit;
[javac] ^
[javac] 1 error

View File

@@ -1,5 +1,3 @@
// FULL_JDK
package test;
public abstract class ClassDoesNotOverrideMethod extends java.util.Date {

View File

@@ -1,5 +1,3 @@
// FULL_JDK
package test;
public abstract class ClassWithTypePExtendsIterableP<P> implements java.lang.Iterable<P> {

View File

@@ -0,0 +1,14 @@
package test
public open class InnerClassesInGeneric</*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!> {
public constructor InnerClassesInGeneric</*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!>()
public open inner class Inner /*captured type parameters: /*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!*/ {
public constructor Inner()
}
public open inner class Inner2 /*captured type parameters: /*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!*/ : test.InnerClassesInGeneric<kotlin.Any!, kotlin.Any!>.Inner {
public constructor Inner2()
public open operator fun iterator(): kotlin.collections.(Mutable)Iterator<P!>!
}
}

View File

@@ -0,0 +1,28 @@
package test
public open class InnerOfGeneric {
public constructor InnerOfGeneric()
public abstract inner class A</*0*/ K : kotlin.Any!> {
public constructor A</*0*/ K : kotlin.Any!>()
public abstract inner class Inner /*captured type parameters: /*0*/ K : kotlin.Any!*/ : test.InnerOfGeneric.S<K!> {
public constructor Inner()
public open override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.(Mutable)Iterator<K!>!
}
}
public open inner class B</*0*/ L : kotlin.Any!> : test.InnerOfGeneric.A<L!> {
public constructor B</*0*/ L : kotlin.Any!>()
public open inner class SubInner /*captured type parameters: /*0*/ L : kotlin.Any!*/ : test.InnerOfGeneric.A<kotlin.Any!>.Inner {
public constructor SubInner()
public open override /*1*/ fun iterator(): kotlin.collections.(Mutable)Iterator<L!>!
}
}
public open inner class S</*0*/ E : kotlin.Any!> {
public constructor S</*0*/ E : kotlin.Any!>()
public open operator fun iterator(): kotlin.collections.(Mutable)Iterator<E!>!
}
}

View File

@@ -0,0 +1,22 @@
package test
public interface ReturnInnerSubclassOfSupersInner {
public open class Sub</*0*/ B : kotlin.Any!> : test.ReturnInnerSubclassOfSupersInner.Super<B!> {
public constructor Sub</*0*/ B : kotlin.Any!>()
public/*package*/ open inner class Inner /*captured type parameters: /*0*/ B : kotlin.Any!*/ : test.ReturnInnerSubclassOfSupersInner.Super<kotlin.Any!>.Inner {
public/*package*/ constructor Inner()
public/*package*/ open override /*1*/ fun get(): test.ReturnInnerSubclassOfSupersInner.Sub<B!>!
}
}
public open class Super</*0*/ A : kotlin.Any!> {
public constructor Super</*0*/ A : kotlin.Any!>()
public/*package*/ open inner class Inner /*captured type parameters: /*0*/ A : kotlin.Any!*/ {
public/*package*/ constructor Inner()
public/*package*/ open fun get(): test.ReturnInnerSubclassOfSupersInner.Super<A!>!
}
}
}

View File

@@ -2,10 +2,8 @@
package test
import java.io.Serializable
annotation class A
interface Foo<T : @A Number> : @A Serializable {
interface Foo<T : @A Number> : @A CharSequence {
fun <E, F : @A E> bar()
}

View File

@@ -4,6 +4,10 @@ public final annotation class A : kotlin.Annotation {
/*primary*/ public constructor A()
}
public interface Foo</*0*/ T : @test.A kotlin.Number> : @test.A java.io.Serializable {
public interface Foo</*0*/ T : @test.A kotlin.Number> : @test.A kotlin.CharSequence {
public abstract override /*1*/ /*fake_override*/ val length: kotlin.Int
public abstract override /*1*/ /*fake_override*/ fun <get-length>(): kotlin.Int
public abstract fun </*0*/ E, /*1*/ F : @test.A E> bar(): kotlin.Unit
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Char
public abstract override /*1*/ /*fake_override*/ fun subSequence(/*0*/ startIndex: kotlin.Int, /*1*/ endIndex: kotlin.Int): kotlin.CharSequence
}

View File

@@ -1,5 +1,3 @@
// FULL_JDK
package test
public abstract class ClassDoesNotOverrideMethod() : java.util.Date() {

View File

@@ -1,5 +1,3 @@
// FULL_JDK
package test
public abstract class ClassWithTypePExtendsIterableP<P>() : kotlin.collections.MutableIterable<P> {

View File

@@ -1,5 +1,3 @@
// FULL_JDK
package test
public interface HalfSubstitutedTypeParameters {

View File

@@ -1,5 +1,3 @@
// FULL_JDK
package test
public interface SubclassOfCollection<E>: MutableCollection<E> {

View File

@@ -30,6 +30,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.options.SchemesManagerFactory;
import com.intellij.openapi.progress.EmptyProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.impl.CoreProgressManager;
@@ -103,6 +104,7 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture {
myFileFactory = new PsiFileFactoryImpl(myPsiManager);
MutablePicoContainer appContainer = getApplication().getPicoContainer();
registerComponentInstance(appContainer, MessageBus.class, MessageBusFactory.newMessageBus(getApplication()));
registerComponentInstance(appContainer, SchemesManagerFactory.class, new MockSchemesManagerFactory());
final MockEditorFactory editorFactory = new MockEditorFactory();
registerComponentInstance(appContainer, EditorFactory.class, editorFactory);
registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(new Function<CharSequence, Document>() {
@@ -122,7 +124,6 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture {
myProject.registerService(PsiManager.class, myPsiManager);
this.registerExtensionPoint(FileTypeFactory.FILE_TYPE_FACTORY_EP, FileTypeFactory.class);
registerExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class);
for (ParserDefinition definition : myDefinitions) {
addExplicitExtension(LanguageParserDefinitions.INSTANCE, definition.getFileNodeType().getLanguage(), definition);
@@ -331,8 +332,7 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture {
public static void ensureCorrectReparse(@NotNull PsiFile file) {
String psiToStringDefault = DebugUtil.psiToString(file, false, false);
String fileText = file.getText();
DiffLog diffLog = (new BlockSupportImpl(file.getProject())).reparseRange(
file, file.getNode(), TextRange.allOf(fileText), fileText, new EmptyProgressIndicator(), fileText);
DiffLog diffLog = (new BlockSupportImpl(file.getProject())).reparseRange(file, TextRange.allOf(fileText), fileText, new EmptyProgressIndicator(), fileText);
diffLog.performActualPsiChange(file);
TestCase.assertEquals(psiToStringDefault, DebugUtil.psiToString(file, false, false));

View File

@@ -37,7 +37,6 @@ import junit.framework.TestCase;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import org.junit.Assert;
@@ -95,10 +94,10 @@ public abstract class KtUsefulTestCase extends TestCase {
testName = new File(testName).getName(); // in case the test name contains file separators
myTempDir = new File(ORIGINAL_TEMP_DIR, TEMP_DIR_MARKER + testName).getPath();
FileUtil.resetCanonicalTempPathCache(myTempDir);
boolean isStressTest = isStressTest();
ApplicationInfoImpl.setInStressTest(isStressTest);
boolean isPerformanceTest = isPerformanceTest();
ApplicationInfoImpl.setInPerformanceTest(isPerformanceTest);
// turn off Disposer debugging for performance tests
oldDisposerDebug = Disposer.setDebugMode(Disposer.isDebugMode() && !isStressTest);
oldDisposerDebug = Disposer.setDebugMode(Disposer.isDebugMode() && !isPerformanceTest);
}
@Override
@@ -450,29 +449,8 @@ public abstract class KtUsefulTestCase extends TestCase {
}
}
private static boolean isPerformanceTest(@Nullable String testName, @Nullable String className) {
return testName != null && testName.contains("Performance") ||
className != null && className.contains("Performance");
}
/**
* @return true for a test which performs A LOT of computations.
* Such test should typically avoid performing expensive checks, e.g. data structure consistency complex validations.
* If you want your test to be treated as "Stress", please mention one of these words in its name: "Stress", "Slow".
* For example: {@code public void testStressPSIFromDifferentThreads()}
*/
private boolean isStressTest() {
return isStressTest(getName(), getClass().getName());
}
private static boolean isStressTest(String testName, String className) {
return isPerformanceTest(testName, className) ||
containsStressWords(testName) ||
containsStressWords(className);
}
private static boolean containsStressWords(@Nullable String name) {
return name != null && (name.contains("Stress") || name.contains("Slow"));
private boolean isPerformanceTest() {
String name = getName();
return name != null && name.contains("Performance") || getClass().getName().contains("Performance");
}
}

View File

@@ -15,7 +15,6 @@
*/
package org.jetbrains.kotlin.test.testFramework.mock;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.util.Computable;
@@ -140,18 +139,8 @@ public class MockPsiDocumentManager extends PsiDocumentManager {
throw new UnsupportedOperationException();
}
@Override
public void performLaterWhenAllCommitted(@NotNull Runnable runnable) {
throw new UnsupportedOperationException();
}
@Override
public void reparseFiles(@NotNull Collection<VirtualFile> files, boolean includeOpenFiles) {
throw new UnsupportedOperationException();
}
@Override
public void performLaterWhenAllCommitted(@NotNull Runnable runnable, ModalityState modalityState) {
throw new UnsupportedOperationException();
}
}

View File

@@ -21,7 +21,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.psi.impl.PsiModificationTrackerImpl;
@@ -139,9 +138,6 @@ public class MockPsiManager extends PsiManagerEx {
return false;
}
@Override
public void setAssertOnFileLoadingFilter(@NotNull VirtualFileFilter filter, @NotNull Disposable parentDisposable) {}
@Override
public boolean isAssertOnFileLoading(@NotNull VirtualFile file) {
return false;

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.test.testFramework.mock;
import com.intellij.openapi.components.RoamingType;
import com.intellij.openapi.options.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class MockSchemesManagerFactory extends SchemesManagerFactory {
private static final SchemesManager EMPTY = new EmptySchemesManager();
@Override
protected <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> create(@NotNull String directoryName,
@NotNull SchemeProcessor<E> processor,
@NotNull RoamingType roamingType,
@Nullable String presentableName) {
//noinspection unchecked
return EMPTY;
}
}

View File

@@ -1391,6 +1391,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
doTest(fileName);
}
@TestMetadata("immutableRemove.kt")
public void testImmutableRemove() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt");
doTest(fileName);
}
@TestMetadata("implementationInTrait.kt")
public void testImplementationInTrait() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt");
@@ -15013,6 +15019,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
doTest(fileName);
}
@TestMetadata("javaParametersHaveNoNames.kt")
public void testJavaParametersHaveNoNames() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/javaParametersHaveNoNames.kt");
doTest(fileName);
}
@TestMetadata("kinds.kt")
public void testKinds() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/kinds.kt");

View File

@@ -138,21 +138,6 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/java8/box/builtinStubMethods")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BuiltinStubMethods extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInBuiltinStubMethods() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/builtinStubMethods"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("immutableRemove.kt")
public void testImmutableRemove() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/builtinStubMethods/immutableRemove.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/java8/box/delegationBy")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -607,20 +592,5 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/synthesizedParameterNames.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/java8/box/reflection/parameters")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Parameters extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInParameters() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/reflection/parameters"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("javaParametersHaveDefaultNames.kt")
public void testJavaParametersHaveDefaultNames() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/parameters/javaParametersHaveDefaultNames.kt");
doTest(fileName);
}
}
}
}

View File

@@ -1,92 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.jvm.compiler;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@RunWith(JUnit3RunnerWithInners.class)
public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
@TestMetadata("compiler/testData/loadJava8/compiledJava")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CompiledJava extends AbstractLoadJava8Test {
public void testAllFilesPresentInCompiledJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true);
}
@TestMetadata("InnerClassTypeAnnotation.java")
public void testInnerClassTypeAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/InnerClassTypeAnnotation.java");
doTestCompiledJava(fileName);
}
@TestMetadata("MapRemove.java")
public void testMapRemove() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
doTestCompiledJava(fileName);
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
doTestCompiledJava(fileName);
}
@TestMetadata("TypeParameterAnnotations.java")
public void testTypeParameterAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeParameterAnnotations.java");
doTestCompiledJava(fileName);
}
}
@TestMetadata("compiler/testData/loadJava8/sourceJava")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SourceJava extends AbstractLoadJava8Test {
public void testAllFilesPresentInSourceJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/sourceJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true);
}
@TestMetadata("MapRemove.java")
public void testMapRemove() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/sourceJava/MapRemove.java");
doTestSourceJava(fileName);
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/sourceJava/TypeAnnotations.java");
doTestSourceJava(fileName);
}
@TestMetadata("TypeParameterAnnotations.java")
public void testTypeParameterAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/sourceJava/TypeParameterAnnotations.java");
doTestSourceJava(fileName);
}
}
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.jvm.runtime;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/loadJava8/compiledJava")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class Jvm8RuntimeDescriptorLoaderTestGenerated extends AbstractJvm8RuntimeDescriptorLoaderTest {
public void testAllFilesPresentInCompiledJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true, "sam", "kotlinSignature/propagation");
}
@TestMetadata("InnerClassTypeAnnotation.java")
public void testInnerClassTypeAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/InnerClassTypeAnnotation.java");
doTest(fileName);
}
@TestMetadata("MapRemove.java")
public void testMapRemove() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
doTest(fileName);
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
doTest(fileName);
}
@TestMetadata("TypeParameterAnnotations.java")
public void testTypeParameterAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeParameterAnnotations.java");
doTest(fileName);
}
}

View File

@@ -1391,6 +1391,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("immutableRemove.kt")
public void testImmutableRemove() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt");
doTest(fileName);
}
@TestMetadata("implementationInTrait.kt")
public void testImplementationInTrait() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt");
@@ -15013,6 +15019,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("javaParametersHaveNoNames.kt")
public void testJavaParametersHaveNoNames() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/javaParametersHaveNoNames.kt");
doTest(fileName);
}
@TestMetadata("kinds.kt")
public void testKinds() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/kinds.kt");

View File

@@ -64,13 +64,12 @@ public abstract class AbstractCompileJavaAgainstKotlinTest extends TestCaseWithT
Assert.assertTrue(ktFilePath.endsWith(".kt"));
File ktFile = new File(ktFilePath);
File javaFile = new File(ktFilePath.replaceFirst("\\.kt$", ".java"));
File expectedFile = new File(ktFilePath.replaceFirst("\\.kt$", ".txt"));
File javaErrorFile = new File(ktFilePath.replaceFirst("\\.kt$", ".javaerr.txt"));
File out = new File(tmpdir, "out");
boolean compiledSuccessfully =
compileKotlinWithJava(Collections.singletonList(javaFile), Collections.singletonList(ktFile),
out, getTestRootDisposable(), javaErrorFile);
if (!compiledSuccessfully) return;
compileKotlinWithJava(Collections.singletonList(javaFile), Collections.singletonList(ktFile),
out, getTestRootDisposable(), javaErrorFile);
KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests(
getTestRootDisposable(),
@@ -82,7 +81,6 @@ public abstract class AbstractCompileJavaAgainstKotlinTest extends TestCaseWithT
PackageViewDescriptor packageView = analysisResult.getModuleDescriptor().getPackage(LoadDescriptorUtil.TEST_PACKAGE_FQNAME);
assertFalse("Nothing found in package " + LoadDescriptorUtil.TEST_PACKAGE_FQNAME, packageView.isEmpty());
File expectedFile = new File(ktFilePath.replaceFirst("\\.kt$", ".txt"));
validateAndCompareDescriptorWithFile(packageView, CONFIGURATION, expectedFile);
}
}

View File

@@ -24,11 +24,10 @@ import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
import org.jetbrains.kotlin.utils.addIfNotNull
import org.junit.Assert
import org.xml.sax.Attributes
import org.xml.sax.helpers.DefaultHandler
import org.w3c.dom.Element
import java.io.File
import java.util.*
import javax.xml.parsers.SAXParserFactory
import javax.xml.parsers.DocumentBuilderFactory
class KotlinVersionsTest : KtUsefulTestCase() {
fun testVersionsAreConsistent() {
@@ -73,13 +72,13 @@ class KotlinVersionsTest : KtUsefulTestCase() {
)
versions.add(
loadValueFromPomXml("libraries/pom.xml", listOf("project", "properties", "kotlin.language.version"))
loadValueFromPomXml("libraries/pom.xml", listOf("properties", "kotlin.language.version"))
?.toVersion("kotlin.language.version in pom.xml")
?: error("No kotlin.language.version in libraries/pom.xml")
)
versions.add(
loadValueFromPomXml("libraries/pom.xml", listOf("project", "version"))
loadValueFromPomXml("libraries/pom.xml", listOf("version"))
?.toVersion("version in pom.xml")
?: error("No version in libraries/pom.xml")
)
@@ -103,8 +102,8 @@ class KotlinVersionsTest : KtUsefulTestCase() {
FileUtil.processFilesRecursively(File("libraries"), Processor { file ->
if (file.name == "pom.xml") {
if (loadValueFromPomXml(file.path, listOf("project", "parent", "artifactId")) == "kotlin-project") {
val version = loadValueFromPomXml(file.path, listOf("project", "parent", "version"))
if (loadValueFromPomXml(file.path, listOf("parent", "artifactId")) == "kotlin-project") {
val version = loadValueFromPomXml(file.path, listOf("version"))
?: error("No version found in pom.xml at $file")
poms.add(Pom(file.path, version))
}
@@ -128,29 +127,12 @@ class KotlinVersionsTest : KtUsefulTestCase() {
private fun loadValueFromPomXml(filePath: String, query: List<String>): String? {
assert(filePath.endsWith("pom.xml")) { filePath }
var result: String? = null
val docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
val input = docBuilder.parse(File(filePath).inputStream())
SAXParserFactory.newInstance().newSAXParser().parse(File(filePath), object : DefaultHandler() {
val currentPath = mutableListOf<String>()
override fun startElement(uri: String, localName: String, qName: String, attributes: Attributes) {
currentPath.add(qName)
}
override fun endElement(uri: String, localName: String, qName: String) {
assert(currentPath.lastOrNull() == qName) { "Invalid XML at $filePath: mismatched tag '$qName'" }
currentPath.removeAt(currentPath.lastIndex)
}
override fun characters(ch: CharArray, start: Int, length: Int) {
if (currentPath == query) {
assert(result == null) { "More than one value found for $query in $filePath" }
result = String(ch, start, length).trim()
}
}
})
return result
return query.fold(input.documentElement) { element, tagName ->
element?.getElementsByTagName(tagName)?.item(0) as? Element
}?.textContent
}
private fun Collection<Any>.areEqual(): Boolean = all(first()::equals)

View File

@@ -20,7 +20,6 @@
<orderEntry type="module" module-name="descriptor.loader.java" scope="TEST" />
<orderEntry type="module" module-name="descriptors.runtime" scope="TEST" />
<orderEntry type="module" module-name="js.tests" scope="TEST" />
<orderEntry type="module" module-name="jps-tests" scope="TEST" />
<orderEntry type="module" module-name="j2k" scope="TEST" />
<orderEntry type="library" scope="TEST" name="jps-test" level="project" />
<orderEntry type="module" module-name="js.ast" scope="TEST" />
@@ -28,7 +27,6 @@
<orderEntry type="module" module-name="util" scope="TEST" />
<orderEntry type="module" module-name="android-extensions-compiler" scope="TEST" />
<orderEntry type="module" module-name="android-extensions-idea" scope="TEST" />
<orderEntry type="module" module-name="android-extensions-jps" scope="TEST" />
<orderEntry type="module" module-name="idea-test-framework" scope="TEST" />
<orderEntry type="module" module-name="idea-completion" scope="TEST" />
<orderEntry type="module" module-name="annotation-collector" scope="TEST" />
@@ -38,7 +36,6 @@
<orderEntry type="module" module-name="plugins-tests" scope="TEST" />
<orderEntry type="module" module-name="idea-android" scope="TEST" />
<orderEntry type="module" module-name="idea-android-output-parser" scope="TEST" />
<orderEntry type="module" module-name="idea-maven" scope="TEST" />
<orderEntry type="module" module-name="uast-kotlin" scope="TEST" />
<orderEntry type="module" module-name="kapt3" scope="TEST" />
</component>

View File

@@ -102,8 +102,6 @@ import org.jetbrains.kotlin.idea.intentions.declarations.AbstractJoinLinesTest
import org.jetbrains.kotlin.idea.internal.AbstractBytecodeToolWindowTest
import org.jetbrains.kotlin.idea.kdoc.AbstractKDocHighlightingTest
import org.jetbrains.kotlin.idea.kdoc.AbstractKDocTypingTest
import org.jetbrains.kotlin.idea.maven.AbstractKotlinMavenInspectionTest
import org.jetbrains.kotlin.idea.maven.configuration.AbstractMavenConfigureProjectByChangingFileTest
import org.jetbrains.kotlin.idea.navigation.*
import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest
import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest
@@ -133,9 +131,6 @@ import org.jetbrains.kotlin.ir.AbstractIrTextTestCase
import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterForWebDemoTest
import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterMultiFileTest
import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterSingleFileTest
import org.jetbrains.kotlin.jps.build.*
import org.jetbrains.kotlin.jps.build.android.AbstractAndroidJpsTestCase
import org.jetbrains.kotlin.jps.incremental.AbstractProtoComparisonTest
import org.jetbrains.kotlin.js.test.semantics.*
import org.jetbrains.kotlin.jvm.compiler.*
import org.jetbrains.kotlin.jvm.runtime.AbstractJvm8RuntimeDescriptorLoaderTest
@@ -893,10 +888,8 @@ fun main(args: Array<String>) {
model("refactoring/pullUp/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest")
}
testClass<AbstractPushDownTest> {
model("refactoring/pushDown/k2k", extension = "kt", singleClass = true, testClassName = "K2K", testMethod = "doKotlinTest")
model("refactoring/pushDown/k2j", extension = "kt", singleClass = true, testClassName = "K2J", testMethod = "doKotlinTest")
model("refactoring/pushDown/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest")
testClass<AbstractPushDownTest>() {
model("refactoring/pushDown", extension = "kt", singleClass = true)
}
testClass<AbstractSelectExpressionForDebuggerTest> {
@@ -961,17 +954,6 @@ fun main(args: Array<String>) {
}
}
testGroup("idea/idea-maven/test", "idea/idea-maven/testData") {
testClass<AbstractMavenConfigureProjectByChangingFileTest> {
model("configurator/jvm", extension = null, recursive = false, testMethod = "doTestWithMaven")
model("configurator/js", extension = null, recursive = false, testMethod = "doTestWithJSMaven")
}
testClass<AbstractKotlinMavenInspectionTest> {
model("maven-inspections", pattern = "^([\\w\\-]+).xml$", singleClass = true)
}
}
testGroup("idea/tests", "compiler/testData") {
testClass<AbstractResolveByStubTest> {
model("loadJava/compiledKotlin")
@@ -1087,62 +1069,6 @@ fun main(args: Array<String>) {
}
}
testGroup("jps-plugin/jps-tests/test", "jps-plugin/testData") {
testClass<AbstractIncrementalJpsTest> {
model("incremental/multiModule", extension = null, excludeParentDirs = true)
model("incremental/pureKotlin", extension = null, recursive = false)
model("incremental/withJava", extension = null, excludeParentDirs = true)
model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true)
}
testClass<AbstractLookupTrackerTest> {
model("incremental/lookupTracker", extension = null, recursive = false)
}
testClass(AbstractIncrementalLazyCachesTest::class.java) {
model("incremental/lazyKotlinCaches", extension = null, excludeParentDirs = true)
}
testClass(AbstractIncrementalCacheVersionChangedTest::class.java) {
model("incremental/cacheVersionChanged", extension = null, excludeParentDirs = true)
}
}
testGroup("jps-plugin/jps-tests/test", "jps-plugin/testData") {
testClass<AbstractExperimentalIncrementalJpsTest> {
model("incremental/multiModule", extension = null, excludeParentDirs = true)
model("incremental/pureKotlin", extension = null, recursive = false)
model("incremental/withJava", extension = null, excludeParentDirs = true)
model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true)
model("incremental/classHierarchyAffected", extension = null, excludeParentDirs = true)
}
testClass<AbstractExperimentalIncrementalLazyCachesTest> {
model("incremental/lazyKotlinCaches", extension = null, excludeParentDirs = true)
}
testClass<AbstractExperimentalIncrementalCacheVersionChangedTest> {
model("incremental/cacheVersionChanged", extension = null, excludeParentDirs = true)
}
testClass<AbstractDataContainerVersionChangedTest> {
model("incremental/cacheVersionChanged", extension = null, excludeParentDirs = true)
}
testClass<AbstractExperimentalChangeIncrementalOptionTest> {
model("incremental/changeIncrementalOption", extension = null, excludeParentDirs = true)
}
}
testGroup("jps-plugin/jps-tests/test", "jps-plugin/testData") {
testClass<AbstractProtoComparisonTest> {
model("comparison/classSignatureChange", extension = null, excludeParentDirs = true)
model("comparison/classPrivateOnlyChange", extension = null, excludeParentDirs = true)
model("comparison/classMembersOnlyChanged", extension = null, excludeParentDirs = true)
model("comparison/packageMembers", extension = null, excludeParentDirs = true)
model("comparison/unchanged", extension = null, excludeParentDirs = true)
}
}
testGroup("plugins/plugins-tests/tests", "plugins/android-extensions/android-extensions-compiler/testData") {
testClass<AbstractAndroidSyntheticPropertyDescriptorTest> {
model("descriptors", recursive = false, extension = null)
@@ -1253,14 +1179,7 @@ fun main(args: Array<String>) {
}
}
testGroup("plugins/plugins-tests/tests", "plugins/android-extensions/android-extensions-jps/testData") {
testClass<AbstractAndroidJpsTestCase> {
model("android", recursive = false, extension = null)
}
}
// TODO: repair these tests
//generateTestDataForReservedWords()
generateTestDataForReservedWords()
testGroup("js/js.tests/test", "js/js.translator/testData") {
testClass<AbstractBoxJsTest> {

View File

@@ -145,9 +145,4 @@ val KtElement.languageVersionSettings: LanguageVersionSettings
}
val KtElement.jvmTarget: JvmTarget
get() {
if (ServiceManager.getService(containingKtFile.project, ProjectFileIndex::class.java) == null) {
return JvmTarget.DEFAULT
}
return ModuleUtilCore.findModuleForPsiElement(this)?.targetPlatform?.version as? JvmTarget ?: JvmTarget.DEFAULT
}
get() = ModuleUtilCore.findModuleForPsiElement(this)?.targetPlatform?.version as? JvmTarget ?: JvmTarget.DEFAULT

View File

@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea.vfilefinder
import com.intellij.util.indexing.*
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.DataInputOutputUtil
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
@@ -25,6 +26,24 @@ import org.jetbrains.kotlin.load.kotlin.PackageParts
import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfiguration
import java.io.DataInput
import java.io.DataOutput
import java.io.IOException
import java.util.*
private fun writeStringList(out: DataOutput, list: Collection<String>) {
DataInputOutputUtil.writeINT(out, list.size)
for (s in list) {
IOUtil.writeUTF(out, s)
}
}
private fun readStringList(`in`: DataInput): List<String> {
val size = DataInputOutputUtil.readINT(`in`)
val strings = ArrayList<String>(size)
for (i in 0..size - 1) {
strings.add(IOUtil.readUTF(`in`))
}
return strings
}
object KotlinModuleMappingIndex : FileBasedIndexExtension<String, PackageParts>() {
@@ -43,19 +62,19 @@ object KotlinModuleMappingIndex : FileBasedIndexExtension<String, PackageParts>(
private val VALUE_EXTERNALIZER = object : DataExternalizer<PackageParts> {
override fun read(input: DataInput): PackageParts? =
PackageParts(IOUtil.readUTF(input)).apply {
val shortPartNames = IOUtil.readStringList(input)
val shortFacadeNames = IOUtil.readStringList(input)
val shortPartNames = readStringList(input)
val shortFacadeNames = readStringList(input)
for ((partName, facadeName) in shortPartNames zip shortFacadeNames) {
addPart(partName, if (facadeName.isNotEmpty()) facadeName else null)
}
IOUtil.readStringList(input).forEach(this::addMetadataPart)
readStringList(input).forEach(this::addMetadataPart)
}
override fun save(out: DataOutput, value: PackageParts) {
IOUtil.writeUTF(out, value.packageFqName)
IOUtil.writeStringList(out, value.parts)
IOUtil.writeStringList(out, value.parts.map { value.getMultifileFacadeName(it).orEmpty() })
IOUtil.writeStringList(out, value.metadataParts)
writeStringList(out, value.parts)
writeStringList(out, value.parts.map { value.getMultifileFacadeName(it).orEmpty() })
writeStringList(out, value.metadataParts)
}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.android.configure
import com.android.tools.idea.gradle.AndroidGradleModel
import com.intellij.openapi.externalSystem.model.DataNode
import com.intellij.openapi.externalSystem.model.Key
import com.intellij.openapi.externalSystem.model.ProjectKeys
import com.intellij.openapi.externalSystem.model.project.ProjectData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider
import com.intellij.openapi.externalSystem.service.project.manage.AbstractProjectDataService
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.idea.configuration.GradleProjectImportHandler
import org.jetbrains.kotlin.idea.configuration.configureFacetByGradleModule
class KotlinGradleAndroidModuleModelProjectDataService : AbstractProjectDataService<AndroidGradleModel, Void>() {
companion object {
val KEY = Key<AndroidGradleModel>(AndroidGradleModel::class.qualifiedName!!, 0)
}
override fun getTargetDataKey() = KEY
override fun postProcess(
toImport: MutableCollection<DataNode<AndroidGradleModel>>,
projectData: ProjectData?,
project: Project,
modelsProvider: IdeModifiableModelsProvider
) {
super.postProcess(toImport, projectData, project, modelsProvider)
for (moduleModelNode in toImport) {
val moduleNode = ExternalSystemApiUtil.findParent(moduleModelNode, ProjectKeys.MODULE) ?: continue
val moduleData = moduleNode.data
val ideModule = modelsProvider.findIdeModule(moduleData) ?: continue
val kotlinFacet = configureFacetByGradleModule(moduleNode, null, ideModule, modelsProvider) ?: continue
GradleProjectImportHandler.getInstances(project).forEach { it.importByModule(kotlinFacet, moduleNode) }
}
}
}

View File

@@ -75,8 +75,6 @@ class IllegalIdentifierInspection : AbstractKotlinInspection() {
override fun getName() = "Rename"
override fun getFamilyName() = name
override fun startInWriteAction(): Boolean = false
override fun applyFix(project: Project, descriptor: ProblemDescriptor) {
val element = descriptor.psiElement ?: return
val file = element.containingFile ?: return

View File

@@ -72,7 +72,7 @@ public abstract class KotlinAndroidTestCaseBase extends UsefulTestCase {
@Override
protected void tearDown() throws Exception {
TestUtilsKt.doKotlinTearDown(getProject(), new RunnableWithException() {
TestUtilsKt.unInvalidateBuiltinsAndStdLib(getProject(), new RunnableWithException() {
@Override
public void run() throws Exception {
KotlinAndroidTestCaseBase.super.tearDown();

View File

@@ -25,7 +25,7 @@ abstract class AbstractAndroidResourceFoldingTest : KotlinAndroidTestCase() {
fun doTest(path: String) {
myFixture.copyFileToProject("values.xml", "res/values/values.xml")
myFixture.copyFileToProject("R.java", "gen/com/myapp/R.java")
myFixture.testFoldingWithCollapseStatus(path, "${myFixture.tempDirPath}/src/main.kt")
myFixture.testFoldingWithCollapseStatus("${myFixture.tempDirPath}/src/main.kt")
}
override fun createManifest() {

View File

@@ -29,14 +29,14 @@ import org.jetbrains.kotlin.idea.test.KotlinTestImportFilter;
public abstract class AbstractAndroidQuickFixMultiFileTest extends AbstractQuickFixMultiFileTest {
@Override
protected void setUp() {
protected void setUp() throws Exception {
super.setUp();
addAndroidFacet();
Extensions.getRootArea().getExtensionPoint(ImportFilter.EP_NAME).registerExtension(KotlinTestImportFilter.INSTANCE);
}
@Override
protected void tearDown() {
protected void tearDown() throws Exception {
Extensions.getRootArea().getExtensionPoint(ImportFilter.EP_NAME).unregisterExtension(KotlinTestImportFilter.INSTANCE);
AndroidFacet facet = FacetManager.getInstance(myModule).getFacetByType(AndroidFacet.getFacetType().getId());
FacetUtil.deleteFacet(facet);
@@ -49,6 +49,12 @@ public abstract class AbstractAndroidQuickFixMultiFileTest extends AbstractQuick
super.doTestWithExtraFile(beforeFileName);
}
@Override
protected void doTestWithoutExtraFile(String beforeFileName) throws Exception {
addManifest();
super.doTestWithoutExtraFile(beforeFileName);
}
private void addAndroidFacet() {
FacetManager facetManager = FacetManager.getInstance(myModule);
AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), "Android", null);
@@ -64,6 +70,6 @@ public abstract class AbstractAndroidQuickFixMultiFileTest extends AbstractQuick
}
private void addManifest() throws Exception {
myFixture.configureByFile("idea/testData/android/AndroidManifest.xml");
configureByFile("idea/testData/android/AndroidManifest.xml");
}
}

View File

@@ -412,7 +412,6 @@ fun ImportableFqNameClassifier.isImportableDescriptorImported(descriptor: Declar
fun OffsetMap.tryGetOffset(key: OffsetKey): Int? {
try {
if (!containsOffset(key)) return null
return getOffset(key).takeIf { it != -1 } // prior to IDEA 2016.3 getOffset() returned -1 if not found, now it throws exception
}
catch(e: Exception) {

View File

@@ -50,6 +50,8 @@ class KotlinCompletionContributor : CompletionContributor() {
companion object {
val DEFAULT_DUMMY_IDENTIFIER: String = CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED + "$" // add '$' to ignore context after the caret
private val STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET = OffsetKey.create("STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET")
}
init {
@@ -80,6 +82,7 @@ class KotlinCompletionContributor : CompletionContributor() {
val prefix = tokenBefore.text.substring(0, offset - tokenBefore.startOffset)
context.dummyIdentifier = "{" + expression.text + prefix + CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED + "}"
context.offsetMap.addOffset(CompletionInitializationContext.START_OFFSET, expression.startOffset)
context.offsetMap.addOffset(STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET, offset + 1)
return
}
}
@@ -238,13 +241,8 @@ class KotlinCompletionContributor : CompletionContributor() {
val expression = (position.parent as KtBlockStringTemplateEntry).expression
if (expression is KtDotQualifiedExpression) {
val correctedPosition = (expression.selectorExpression as KtNameReferenceExpression).firstChild
// Workaround for KT-16848
// ex:
// expression: some.IntellijIdeaRulezzz
// correctedOffset: ^
// expression: some.funcIntellijIdeaRulezzz
// correctedOffset ^
val correctedOffset = correctedPosition.endOffset - CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED.length
val context = position.getUserData(CompletionContext.COMPLETION_CONTEXT_KEY)!!
val correctedOffset = context.offsetMap.getOffset(STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET)
val correctedParameters = parameters.withPosition(correctedPosition, correctedOffset)
doComplete(correctedParameters, toFromOriginalFileMapper, result,
lookupElementPostProcessor = { wrapLookupElementForStringTemplateAfterDotCompletion(it) })

View File

@@ -68,7 +68,7 @@ public class KotlinConfidenceTest extends LightCompletionTestCase {
@Override
protected void tearDown() throws Exception {
TestUtilsKt.doKotlinTearDown(getProject(), new RunnableWithException() {
TestUtilsKt.unInvalidateBuiltinsAndStdLib(getProject(), new RunnableWithException() {
@Override
public void run() throws Exception {
KotlinConfidenceTest.super.tearDown();

View File

@@ -22,6 +22,8 @@ import com.intellij.codeInsight.lookup.LookupElementPresentation
import com.intellij.codeInsight.lookup.LookupEvent
import com.intellij.codeInsight.lookup.LookupManager
import com.intellij.codeInsight.lookup.impl.LookupImpl
import com.intellij.openapi.application.Result
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
import org.jetbrains.kotlin.idea.completion.test.ExpectedCompletionUtils
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
@@ -115,7 +117,14 @@ abstract class CompletionHandlerTestBase() : KotlinLightCodeInsightFixtureTestCa
}
lookup.focusDegree = LookupImpl.FocusDegree.FOCUSED
if (LookupEvent.isSpecialCompletionChar(completionChar)) {
lookup.finishLookup(completionChar)
(object : WriteCommandAction.Simple<Any>(project) {
override fun run(result: Result<Any>) {
run()
}
override fun run() {
lookup.finishLookup(completionChar)
}
}).execute().throwException()
}
else {
fixture.type(completionChar)

View File

@@ -57,10 +57,11 @@ class KotlinConsoleKeeper(val project: Project) {
private fun createCommandLine(module: Module): GeneralCommandLine? {
val javaParameters = createJavaParametersWithSdk(module)
val sdk = javaParameters.jdk ?: return null
val sdkType = sdk.sdkType
val exePath = (sdkType as JavaSdkType).getVMExecutablePath(sdk)
javaParameters.mainClass = "dummy"
val commandLine = javaParameters.toCommandLine()
val commandLine = JdkUtil.setupJVMCommandLine(exePath, javaParameters, true)
val paramList = commandLine.parametersList
paramList.clearAll()

View File

@@ -60,7 +60,10 @@ public class JdkAndMockLibraryProjectDescriptor extends KotlinLightProjectDescri
@Override
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model) {
File libraryJar = MockLibraryUtil.compileLibraryToJar(sourcesPath, LIBRARY_NAME, withSources, isJsLibrary, allowKotlinPackage, classpath);
String libraryHash = sourcesPath + withSources + isJsLibrary + allowKotlinPackage;
String libraryFileName = LIBRARY_NAME + "_" + Integer.toHexString(libraryHash.hashCode());
File libraryJar = MockLibraryUtil.compileLibraryToJar(sourcesPath, libraryFileName, withSources, isJsLibrary, allowKotlinPackage, classpath);
String jarUrl = getJarUrl(libraryJar);
Library.ModifiableModel libraryModel = model.getModuleLibraryTable().getModifiableModel().createLibrary(LIBRARY_NAME).getModifiableModel();

View File

@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.idea.test
import com.intellij.codeInsight.CodeInsightTestCase
import com.intellij.codeInsight.daemon.impl.EditorTracker
import com.intellij.ide.startup.impl.StartupManagerImpl
import com.intellij.openapi.actionSystem.ActionPlaces
@@ -50,8 +49,6 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
protected val module: Module get() = myFixture.module
protected open val captureExceptions = true
override fun setUp() {
super.setUp()
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivities()
@@ -64,15 +61,12 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
invalidateLibraryCache(project)
if (captureExceptions) {
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
exceptions.addIfNotNull(t)
super.processError(message, t, details, logger)
}
})
}
CodeInsightTestCase.fixTemplates()
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
exceptions.addIfNotNull(t)
super.processError(message, t, details, logger)
}
})
}
override fun tearDown() {
@@ -81,7 +75,7 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
KotlinInternalMode.enabled = kotlinInternalModeOriginalValue
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
doKotlinTearDown(project) {
unInvalidateBuiltinsAndStdLib(project) {
super.tearDown()
}
@@ -122,9 +116,6 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_KOTLIN_TEST")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_WITH_KOTLIN_TEST
}
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_FULL_JDK")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK
}
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME") ||
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE

View File

@@ -40,7 +40,7 @@ abstract class KotlinLightPlatformCodeInsightFixtureTestCase: LightPlatformCodeI
KotlinInternalMode.enabled = kotlinInternalModeOriginalValue
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
doKotlinTearDown(project) {
unInvalidateBuiltinsAndStdLib(project) {
super.tearDown()
}
}

View File

@@ -42,9 +42,7 @@ abstract class KotlinMultiFileTestCase : MultiFileTestCase() {
object : VirtualFileVisitor<Any>() {
override fun visitFile(file: VirtualFile): Boolean {
if (!file.isDirectory && file.name.endsWith(ModuleFileType.DOT_DEFAULT_EXTENSION)) {
val module = createModule(File(file.path), StdModuleTypes.JAVA)
val contentRoot = file.parent.findChild("src")!!
PsiTestUtil.addSourceContentToRoots(module, contentRoot)
createModule(File(file.path), StdModuleTypes.JAVA)
return false
}

View File

@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.idea.decompiler.KotlinDecompiledFileViewProvider
import org.jetbrains.kotlin.idea.decompiler.KtDecompiledFile
import org.jetbrains.kotlin.idea.util.application.runWriteAction
import org.jetbrains.kotlin.psi.KtFile
import java.lang.IllegalArgumentException
import java.util.*
enum class ModuleKind {
@@ -48,16 +47,18 @@ enum class ModuleKind {
fun Module.configureAs(descriptor: KotlinLightProjectDescriptor) {
val module = this
updateModel(module, Consumer<ModifiableRootModel> { model ->
if (descriptor.sdk != null) {
model.sdk = descriptor.sdk
}
val entries = model.contentEntries
if (entries.isEmpty()) {
descriptor.configureModule(module, model)
}
else {
descriptor.configureModule(module, model, entries[0])
updateModel(module, object : Consumer<ModifiableRootModel> {
override fun consume(model: ModifiableRootModel) {
if (descriptor.sdk != null) {
model.sdk = descriptor.sdk
}
val entries = model.contentEntries
if (entries.isEmpty()) {
descriptor.configureModule(module, model)
}
else {
descriptor.configureModule(module, model, entries[0])
}
}
})
}
@@ -75,26 +76,17 @@ fun Module.configureAs(kind: ModuleKind) {
}
fun KtFile.dumpTextWithErrors(): String {
val diagnostics = analyzeFullyAndGetResult().bindingContext.diagnostics
val errors = diagnostics.filter { it.severity == Severity.ERROR }
val diagnostics = analyzeFullyAndGetResult().bindingContext.getDiagnostics()
val errors = diagnostics.filter { it.getSeverity() == Severity.ERROR }
if (errors.isEmpty()) return text
val header = errors.map { "// ERROR: " + DefaultErrorMessages.render(it).replace('\n', ' ') }.joinToString("\n", postfix = "\n")
return header + text
}
fun closeAndDeleteProject() = LightPlatformTestCase.closeAndDeleteProject()
fun closeAndDeleteProject(): Unit =
ApplicationManager.getApplication().runWriteAction() { LightPlatformTestCase.closeAndDeleteProject() }
fun doKotlinTearDown(project: Project, runnable: RunnableWithException) {
doKotlinTearDown(project) { runnable.run() }
}
fun doKotlinTearDown(project: Project, runnable: () -> Unit) {
unInvalidateBuiltinsAndStdLib(project) {
runnable()
}
}
fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: RunnableWithException) {
val stdLibViewProviders = HashSet<KotlinDecompiledFileViewProvider>()
val vFileToViewProviderMap = ((PsiManager.getInstance(project) as PsiManagerEx).fileManager as FileManagerImpl).vFileToViewProviderMap
for ((file, viewProvider) in vFileToViewProviderMap) {
@@ -103,7 +95,7 @@ fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
}
}
runnable()
runnable.run()
// Base tearDown() invalidates builtins and std-lib files. Restore them with brute force.
fun unInvalidateFile(file: PsiFileImpl) {
@@ -114,12 +106,16 @@ fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
stdLibViewProviders.forEach {
it.allFiles.forEach { unInvalidateFile(it as KtDecompiledFile) }
vFileToViewProviderMap[it.virtualFile] = it
vFileToViewProviderMap.set(it.virtualFile, it)
}
}
private val VirtualFile.isStdLibFile: Boolean get() = presentableUrl.contains("kotlin-runtime.jar")
fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
unInvalidateBuiltinsAndStdLib(project, RunnableWithException { runnable() })
}
fun invalidateLibraryCache(project: Project) {
LibraryModificationTracker.getInstance(project).incModificationCount()
}
@@ -132,7 +128,7 @@ fun Document.extractMultipleMarkerOffsets(project: Project, caretMarker: String
val offsets = ArrayList<Int>()
runWriteAction {
val text = StringBuilder(text)
val text = StringBuilder(getText())
while (true) {
val offset = text.indexOf(caretMarker)
if (offset >= 0) {
@@ -149,4 +145,4 @@ fun Document.extractMultipleMarkerOffsets(project: Project, caretMarker: String
PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(this)
return offsets
}
}

View File

@@ -17,12 +17,12 @@
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="idea-full" level="project" />
<orderEntry type="module" module-name="backend" />
<orderEntry type="module" module-name="frontend" />
<orderEntry type="module" module-name="frontend.java" />
<orderEntry type="module" module-name="light-classes" />
<orderEntry type="module" module-name="cli-common" />
<orderEntry type="library" name="idea-full" level="project" />
<orderEntry type="library" scope="PROVIDED" name="intellilang-plugin" level="project" />
<orderEntry type="library" scope="PROVIDED" name="junit-plugin" level="project" />
<orderEntry type="library" scope="PROVIDED" name="testng-plugin" level="project" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Some files were not shown because too many files have changed in this diff Show More