Compare commits

...

1405 Commits

Author SHA1 Message Date
Andrey Breslav
31b722f4bf Simple (not thread-safe) memoized functions supported 2013-04-11 18:13:54 +04:00
Andrey Breslav
af2f2637cc Reuse a package fragment provider created by injector 2013-04-11 16:10:38 +04:00
Andrey Breslav
e1ae245dca Debug names for package fragments 2013-04-11 16:09:44 +04:00
Andrey Breslav
b0bbb2b28a File scopes are owned by package fragments, not package views 2013-04-10 14:47:40 +04:00
Andrey Breslav
adfc6e1c57 Use lazy package fragment providers in lazy resolve tests 2013-04-10 14:47:16 +04:00
Andrey Breslav
004539552e ++ forceResolveAll() fixed 2013-04-10 13:46:55 +04:00
Andrey Breslav
1e4635d6ec ++ forceResolveAll() fixed 2013-04-10 12:57:04 +04:00
Andrey Breslav
a5a9c06a48 Lazy resolve tests fixed 2013-04-10 12:55:35 +04:00
Andrey Breslav
9520fa235c forceResolveAll() fixed 2013-04-10 12:29:16 +04:00
Andrey Breslav
6575a6dff4 Usages of resolveNamespace() removed from tests 2013-04-09 22:02:57 +04:00
Andrey Breslav
c568218cf8 Migrate tests to TestCoreEnvironment 2013-04-09 22:02:39 +04:00
Andrey Breslav
be4ad9c5a5 ++ JetTestUtils.createFile() 2013-04-08 20:24:07 +04:00
Andrey Breslav
17888f64a0 ++ to Write reference targets for names in package headers 2013-04-08 20:07:38 +04:00
Andrey Breslav
0157a753ec Assertion added 2013-04-08 18:51:35 +04:00
Andrey Breslav
41b157d92f Fix environments/jetFile creation in LineNumberTest 2013-04-08 18:51:35 +04:00
Andrey Breslav
3fd9ce1a27 Better diagnostics in CompilationException 2013-04-08 18:51:34 +04:00
Andrey Breslav
2015712e57 Fix multifile/singlefile packages 2013-04-08 18:51:34 +04:00
Andrey Breslav
5e14630874 Package private fixed by providing equals() on package views 2013-04-08 18:51:34 +04:00
Andrey Breslav
09776c12c8 Abstract class mrged with its only subclass 2013-04-08 18:15:45 +04:00
Andrey Breslav
32b74d9731 Unused constructor removed 2013-04-08 18:00:17 +04:00
Andrey Breslav
c1b069bd46 When resolving dependencies by name, use scopes, not PSI 2013-03-28 20:51:09 +04:00
Andrey Breslav
630ea703da getRootPackage() method extracted 2013-03-28 20:21:31 +04:00
Andrey Breslav
e95f172879 Method renamed 2013-03-28 19:54:16 +04:00
Andrey Breslav
4ed4d66f15 Rendering unknown diagnostics in THROW_EXCEPTION mode 2013-03-28 17:58:43 +04:00
Andrey Breslav
3deaf49d1c Properly write diagnostic factory names 2013-03-28 17:37:47 +04:00
Andrey Breslav
dc82293012 Better error reporting in codegen tests:
an exception gtom generateToText() used to mask the one from the original run
2013-03-28 17:17:27 +04:00
Andrey Breslav
6ba018df3d ++ Properly use package view 2013-03-28 17:14:21 +04:00
Andrey Breslav
8cb630e6b2 Passing project explicitly instead of obtaining it from a scope
(the old way used to cause null projects)
2013-03-28 15:54:56 +04:00
Andrey Breslav
a8982f24e5 Run tests only from the appropriate module 2013-03-28 15:54:55 +04:00
Andrey Breslav
917a0fe534 Using the right trace in tests 2013-03-28 15:54:55 +04:00
Andrey Breslav
78f81fddf2 Test-only methods moved under a test root 2013-03-28 15:25:12 +04:00
Andrey Breslav
c1f15ee758 ++ PackageViewDescriptors processed correctly 2013-03-28 15:25:12 +04:00
Andrey Breslav
4066af1013 MutablePackageFragmentProvider's logic relaxed:
it now allows to add package fragments even after it was queried
2013-03-28 14:02:10 +04:00
Andrey Breslav
ced6232deb @AssertInvisibleInResolver removed: things should be sorted out by placing the binaries in the right position on the class path 2013-03-28 12:42:52 +04:00
Andrey Breslav
cb80f853ec ++ Correct the order of package fragments in package views 2013-03-28 12:36:08 +04:00
Andrey Breslav
42a1da1a70 @NotNull added 2013-03-28 12:09:28 +04:00
Andrey Breslav
593dda4f0d ++Parent class corrected 2013-03-28 12:09:15 +04:00
Andrey Breslav
320eef5ce0 ++ Accidental error fixed 2013-03-28 12:08:17 +04:00
Andrey Breslav
9850f7dd45 Computing qualified names for packages from PsiClasses,
if the package is constituted by static members of a Java class
2013-03-27 22:31:56 +04:00
Andrey Breslav
7152cec8f2 Passing a sub-module to NamespaceCodegen 2013-03-26 21:31:18 +04:00
Andrey Breslav
b4b2506bb2 Using special MutableModuleSourcesManager in tests 2013-03-26 21:05:50 +04:00
Andrey Breslav
fa43edd9ea Change signature: project now goes first 2013-03-26 21:00:40 +04:00
Andrey Breslav
a5f30a520f MOck module logic moved from AnalyzerFacadeForJVM to SimpleKotlinModuleManager 2013-03-26 20:50:46 +04:00
Andrey Breslav
2f12434a26 ++ Using TraceBasedLightClassResolver 2013-03-26 20:47:07 +04:00
Andrey Breslav
ab44f9ceaa Creating physical kt-files in diagnostics tests (to make light classes work properly) 2013-03-26 14:19:38 +04:00
Andrey Breslav
f5d55c1589 Using TraceBasedLightClassResolver everywhere 2013-03-26 14:18:27 +04:00
Andrey Breslav
673d8c007a VirtualFileSystem exposed from JetCoreEnvironment 2013-03-26 14:17:46 +04:00
Andrey Breslav
bc46062499 .jet -> .kt 2013-03-25 17:13:20 +04:00
Andrey Breslav
08108491e3 TestFile instances and PSI files separated 2013-03-25 17:07:33 +04:00
Andrey Breslav
cd269718ee An unfortunate design decision removed from tests 2013-03-25 16:05:35 +04:00
Andrey Breslav
06544f3b87 KotlinLightClass moved to frontend.java 2013-03-25 14:19:13 +04:00
Andrey Breslav
9aa55bad22 KotlinLightClass moved to frontend.java 2013-03-25 14:16:20 +04:00
Andrey Breslav
85d087ddc5 Package declarations fixed in test data 2013-03-25 14:02:34 +04:00
Andrey Breslav
9845bfcf81 Commented code deleted 2013-03-25 13:19:10 +04:00
Andrey Breslav
8eaf6a1c79 isInSamePackage() fixed 2013-03-22 19:39:52 +04:00
Andrey Breslav
cd059fb705 Account for packages that have no files, like "a" in "package a.b" 2013-03-22 19:32:50 +04:00
Andrey Breslav
bdabd12cca Basic Java resolve supported 2013-03-22 19:01:13 +04:00
Andrey Breslav
63194fa115 Topologically sort fields according to constructor dependencies 2013-03-22 19:01:12 +04:00
Andrey Breslav
fb9f419165 TraceBasedLightClassResolver extracted 2013-03-22 18:15:28 +04:00
Andrey Breslav
d1a4a8c02d Importing toplevel packages into every file 2013-03-22 18:03:09 +04:00
Andrey Breslav
ea118fc51b Rendering package fragments to differ from packages 2013-03-22 18:01:40 +04:00
Andrey Breslav
a21be544ab ++ File scope derives from the containing package 2013-03-22 16:35:33 +04:00
Andrey Breslav
fd0d3aafc5 Better assertion messages in Visibilities 2013-03-22 16:34:34 +04:00
Andrey Breslav
b500a76795 !!! temporary fix, duplicates changes in master 2013-03-22 16:33:02 +04:00
Andrey Breslav
73713e06fe ++ to Mutable implementations for packages and modules
wrong @NotNull removed
2013-03-22 14:22:46 +04:00
Andrey Breslav
b5cfdec464 ++ An accidentally removed field returned 2013-03-22 14:19:41 +04:00
Andrey Breslav
f2564b6efa ++ Using the right module sources manager 2013-03-22 14:19:14 +04:00
Andrey Breslav
a2c2e12f19 ++ ImportResolver: no need for outer scope 2013-03-22 14:18:45 +04:00
Andrey Breslav
79cb9a209d Create modules lazily to be able to add a dependency on built-ins 2013-03-21 21:51:44 +04:00
Andrey Breslav
4dcf9ebdab Resolve imports in the scope of the root package as seen from the current submodule 2013-03-21 21:50:43 +04:00
Andrey Breslav
6ac9123b39 ++ DescriptorRenderer understands modules, submodules and package fragments 2013-03-20 16:40:52 +04:00
Andrey Breslav
ab226ff79f ++ Write reference targets for names in package headers 2013-03-20 16:10:55 +04:00
Andrey Breslav
a05d7bdf1b ++ Unused class removed 2013-03-20 16:05:47 +04:00
Andrey Breslav
240676c08e Write reference targets for names in package headers 2013-03-20 16:05:35 +04:00
Andrey Breslav
4a861d6775 ++ Replacing namespace model by package fragment/package view model 2013-03-20 14:56:20 +04:00
Andrey Breslav
aced529afe isTopLevelDeclaration() fixed 2013-03-20 14:14:06 +04:00
Andrey Breslav
615264720d Remove redundant annotation 2013-03-20 14:11:29 +04:00
Andrey Breslav
1d43c6ea36 Take the proper fqName 2013-03-20 14:11:15 +04:00
Andrey Breslav
cc2ecc8c96 Include built-ins into dependencies 2013-03-20 14:09:34 +04:00
Andrey Breslav
c96a03da57 NamespaceComparator renders package views 2013-03-20 14:09:07 +04:00
Andrey Breslav
e717eeefaf Raise lock level 2013-03-20 14:07:08 +04:00
Andrey Breslav
e54582fbbe Remove obsolete methods from visitors 2013-03-20 13:32:59 +04:00
Andrey Breslav
e542279f99 Properly compute subpackages for package views 2013-03-19 20:02:23 +04:00
Andrey Breslav
5957cb278b ++ package index 2013-03-19 20:01:56 +04:00
Andrey Breslav
de276b6a44 SubModuleDescriptor contains a PackageFragmentProvider 2013-03-19 19:56:05 +04:00
Andrey Breslav
f9677dabb3 PackageFragmentProvider returns fqNames of subpackages 2013-03-19 19:19:39 +04:00
Andrey Breslav
f3901f3095 ++Tracking sliced map: NPE fixed 2013-03-19 18:40:01 +04:00
Andrey Breslav
77f6f9e539 PackageLikeDescriptorBase: account for the root package name 2013-03-19 17:41:07 +04:00
Andrey Breslav
35c2b8592c LazyCodeAnalyzer: memoize package fragments 2013-03-19 17:39:46 +04:00
Andrey Breslav
3e7af08524 KotlinBuiltIns: add lazy package fragment provider to the submodule 2013-03-19 17:39:07 +04:00
Andrey Breslav
eedb6e99dd Tracking sliced map for debugging "Rewrite at slice..." 2013-03-19 17:15:48 +04:00
Andrey Breslav
e7eaac9d98 Compiler tests compile, most of them fail 2013-03-19 14:28:28 +04:00
Andrey Breslav
48aaf94221 Injectors fixed 2013-03-19 13:36:20 +04:00
Andrey Breslav
ff48e79348 CliIndexManager handles queries about packages defined in Kotlin 2013-03-18 19:47:19 +04:00
Andrey Breslav
5408d8c4d4 Creating a simple module manager inside JetCoreEnvironment
This is a temporary solution that mimics the existing behavior. We have to support multiple (strongly connected) modules
2013-03-18 16:51:19 +04:00
Andrey Breslav
1c618002ae Make JS modules compile 2013-03-18 15:19:21 +04:00
Andrey Breslav
5293234160 Assert that no real declaration is declared in a PackageViewDescriptor 2013-03-18 14:59:15 +04:00
Andrey Breslav
a23603b276 Properly creating JavaPackageFragmentProviders 2013-03-18 14:18:25 +04:00
Andrey Breslav
c458e7f4f6 Better reporting of ambiguous dependencies 2013-03-18 14:08:28 +04:00
Andrey Breslav
d3d1f94539 Register java package providers with the resolution facade 2013-03-15 17:57:59 +04:00
Andrey Breslav
3832d29643 Resolving light classes to descriptors 2013-03-15 17:54:42 +04:00
Andrey Breslav
07ede42745 Expose the source element from KotlinLightClass 2013-03-15 17:29:23 +04:00
Andrey Breslav
c19a8df9f1 Eagerly resolve all files in submodules being built 2013-03-15 17:18:42 +04:00
Andrey Breslav
b5090d8a9d LazyCodeAnalyzer now produces a package fragment provider 2013-03-15 14:42:08 +04:00
Andrey Breslav
e36963bd1d Getting rid of ModuleConfiguration in favor of ModuleSourcesManager 2013-03-13 18:50:35 +04:00
Andrey Breslav
961126724d Getting rid of ModuleConfiguration and unneeded Java-related dependencies 2013-03-13 18:31:26 +04:00
Andrey Breslav
cc21c1ea3c ModuleSourcesManager exposed from LazyCodeAnalyzer 2013-03-13 18:27:17 +04:00
Andrey Breslav
61b700ece4 New injectors used 2013-03-13 17:30:57 +04:00
Andrey Breslav
112c6d9abf TypeResolver and Imports resolver depend on modules/class maps rather than ModuleConfiguration 2013-03-13 17:30:01 +04:00
Andrey Breslav
e371905fac Mock module creation at the entry point to the analyzer 2013-03-13 17:28:33 +04:00
Andrey Breslav
c36d0722b2 Module manager exposes a ModuleSourcesManager 2013-03-13 17:27:41 +04:00
Andrey Breslav
85d709af83 More convenient return type 2013-03-13 17:27:05 +04:00
Andrey Breslav
67aae4ec91 Unused parameters removed 2013-03-13 14:07:12 +04:00
Andrey Breslav
c2e6daa5ad Reporting unused parameters 2013-03-13 13:40:44 +04:00
Andrey Breslav
ac3285bc3f Injectors generated 2013-03-12 20:03:43 +04:00
Andrey Breslav
4d8632e0a0 ++ Track the whole chain of dependencies 2013-03-12 19:20:18 +04:00
Andrey Breslav
66f7e28d33 ++ Dependency tracking 2013-03-12 19:17:33 +04:00
Andrey Breslav
6c9a12bf25 Making jet.as.java.psi compile 2013-03-12 19:10:23 +04:00
Andrey Breslav
e5d9b38703 Better error reporting 2013-03-12 18:30:10 +04:00
Andrey Breslav
3877bf5bfa Make backend compile 2013-03-12 17:44:08 +04:00
Andrey Breslav
aa1d25339c Make frontend.java compile: JavaNamespaceResolver removed 2013-03-12 16:28:33 +04:00
Andrey Breslav
20eb5a266a Skeletal implementation of analyzing modules in topological order 2013-03-12 14:36:17 +04:00
Andrey Breslav
fa664966d2 Allow more than one package fragment provider in MutableSubModuleDescriptor 2013-03-12 14:34:53 +04:00
Andrey Breslav
6c492f2f7e ++ IDEModuleManager: methods extracted + basic injection added 2013-03-11 20:10:34 +04:00
Andrey Breslav
0f81437251 ++ IdeModuleManager 2013-03-11 19:56:37 +04:00
Andrey Breslav
4acd0fdb2c KotlinModuleManager and its initial implementation for IDE 2013-03-11 18:31:53 +04:00
Andrey Breslav
5b9a6c6cf9 MY_SOURCES constant introduced for dependencies 2013-03-11 18:31:14 +04:00
Andrey Breslav
2a0acefcdb Method pulled up 2013-03-11 17:18:21 +04:00
Andrey Breslav
f6f9922d24 PackageFragmentProvider returns a List 2013-03-11 15:41:25 +04:00
Andrey Breslav
22bf559807 ++ Use module descriptors explicitly 2013-03-07 15:47:31 +04:00
Andrey Breslav
baaa8eb457 ++ Make injectors compile 2013-03-07 15:47:04 +04:00
Andrey Breslav
84358b0ea1 Legacy class removed 2013-03-06 18:29:17 +04:00
Andrey Breslav
5d02b61c61 Class name typo fixed 2013-03-06 18:26:11 +04:00
Andrey Breslav
55809c53fd JavaSemanticServices removed (mostly replaced by JavaClassResolutionFacade) 2013-03-06 18:25:27 +04:00
Andrey Breslav
f4446b8279 JavaClassClassResolutionFacade introduced, getting ready to remove JavaSemanticServices 2013-03-06 17:48:17 +04:00
Andrey Breslav
09757aaf11 JavaClassClassResolutionFacade introduced 2013-03-06 17:47:36 +04:00
Andrey Breslav
d55dd28f39 ++ Migrated to DependencyClassByQualifiedNameResolver 2013-03-06 17:31:53 +04:00
Andrey Breslav
e78e12c993 Injectors now compile 2013-03-06 16:41:15 +04:00
Andrey Breslav
3d17bed746 JavaTypeTransformer resolved classes through JavaSemanticServices 2013-03-06 16:40:59 +04:00
Andrey Breslav
0c69cbc41a JavaSemanticServices simplified 2013-03-06 16:40:58 +04:00
Andrey Breslav
f9ef8e9353 Scopes get JavaDescriptorResolver injected 2013-03-06 16:36:40 +04:00
Andrey Breslav
27c059b3c0 Component to resolve classes by qualified name 2013-03-06 15:25:20 +04:00
Andrey Breslav
d71857fd35 Package declaration providers now return psiClasses by simple name 2013-03-06 14:48:58 +04:00
Andrey Breslav
7d9ab70317 Resolving default supertype (java.lang.Object) by looking the PsiClass up in the appropriate scope 2013-03-06 14:48:58 +04:00
Andrey Breslav
303b0d456c Migrating FqName->PsiClass 2013-03-06 14:48:57 +04:00
Andrey Breslav
6ebd2e5fc9 ++ Unused method removed 2013-03-06 14:48:57 +04:00
Andrey Breslav
f99c00ae1c ++ Resolving annotation by PsiClass 2013-03-06 14:48:57 +04:00
Andrey Breslav
b27a19dbf7 Injecting JavaTypeTransformer directly into resolvers 2013-03-06 14:48:56 +04:00
Andrey Breslav
0e22fd8682 Unused methods/field removed 2013-03-06 14:48:56 +04:00
Andrey Breslav
2311305ed7 JavaPackageScope.computeAllDescriptors() (moved from ScopeUtils)
* KotlinNamespacePsiDeclarationProvider -> KotlinPackagePsiDeclarationProvider
 * getClassDescriptor() made @Nullable
 * ScopeUtils removed
2013-03-06 14:48:55 +04:00
Andrey Breslav
a2dc0ef333 @Deprecated 2013-03-06 14:48:55 +04:00
Andrey Breslav
c68b352522 getClassDescriptor(PsiClass) implemented in JavaPackageFragmentProvider 2013-03-06 14:48:55 +04:00
Andrey Breslav
a8ddb79f66 Using PsiClassFinder instead of bare GlobalSearchScope 2013-03-06 14:48:55 +04:00
Andrey Breslav
fba07bc9a6 JavaPackageFragmentProvider returns a single package fragment for an fqName 2013-03-06 14:48:54 +04:00
Andrey Breslav
eb7f6dd76f Unused code removed 2013-03-06 14:48:54 +04:00
Andrey Breslav
4f7b42bb3f Getting PsiClass for PsiAnnotation 2013-03-06 14:48:54 +04:00
Andrey Breslav
9cc28a49c1 JavaClassResolver rewritten to resolve PsiClasses, not fqNames 2013-03-06 14:48:53 +04:00
Andrey Breslav
6079062c83 isKotlinLightClass() and isInvisibleRuntimeClass() introduced 2013-03-06 14:48:53 +04:00
Andrey Breslav
dfb997b44a Got rid of PostponedTasks 2013-03-06 14:48:52 +04:00
Andrey Breslav
3680edea69 PsiClassFinder properly wraps a GlobalSearchScope 2013-03-06 14:48:52 +04:00
Andrey Breslav
37214d6d16 JavaSemanticServices: interface extracted + new logic for psiClass resolve added 2013-03-06 14:48:52 +04:00
Andrey Breslav
86d4e57275 JavaPackageFragmentProvider 2013-03-06 14:48:52 +04:00
Andrey Breslav
19adb228bf INCOMPATIBLE_ABI_VERSION is a diagnostic now 2013-03-06 14:48:51 +04:00
Andrey Breslav
e7e39bad2d Method moved to KotlinBuiltIns 2013-03-06 14:48:51 +04:00
Andrey Breslav
481e143e19 PackageFragmentDescriptor extends ClassOrPackageDescriptor 2013-03-06 14:48:51 +04:00
Andrey Breslav
4ed80fe21d resolveNamespace() removed from the interface 2013-03-06 14:48:50 +04:00
Andrey Breslav
b29fa0528d Java-based scopes use PackageFragmentDescriptor's 2013-03-06 14:48:50 +04:00
Andrey Breslav
0809de398b ClassOrNamespaceDescriptor -> ClassOrPackageDescriptor 2013-03-06 14:48:50 +04:00
Andrey Breslav
e80a4a437a RootBasedFileMap 2013-03-06 14:48:50 +04:00
Andrey Breslav
5da468fc29 PackageFragmentProvider introduced 2013-03-06 14:48:49 +04:00
Andrey Breslav
5cd2cac09b Constant made final 2013-03-06 14:48:49 +04:00
Andrey Breslav
46ff0f549e "Namespace"-related classes removed
OldModuleDescriptor -> ModuleDescriptor
2013-03-06 14:48:49 +04:00
Andrey Breslav
b54ed0a41e NamespaceDescriptor replaced by PackageViewDescriptor 2013-03-06 14:48:32 +04:00
Andrey Breslav
bb28e82a38 KotlinBuiltIns uses proper modules 2013-03-06 14:48:32 +04:00
Andrey Breslav
4bc79c442a ++ Refactoring everything: migrating onto packages/modules 2013-03-06 14:48:32 +04:00
Andrey Breslav
563aab331a Lazy analyzer migrated to modules 2013-03-06 14:48:31 +04:00
Andrey Breslav
6671d04c74 ++Refactoring everything 2013-03-06 14:48:31 +04:00
Andrey Breslav
70ffd1a45e ~ Refactoring in progress 2013-03-06 14:48:30 +04:00
Andrey Breslav
a0c35ebbc8 ~ Module manager 2013-03-06 14:48:30 +04:00
Andrey Breslav
b83caea63a Builder class extracted 2013-03-06 14:48:30 +04:00
Andrey Breslav
583732fcdc Mutable implementations for packages and modules 2013-03-06 14:48:29 +04:00
Andrey Breslav
0f5a7fa04f Initial interfaces for modules and packages 2013-03-06 14:48:29 +04:00
Andrey Breslav
ce8ca9f62f ModuleDescriptor -> OldModuleDescriptor 2013-03-06 14:48:29 +04:00
Andrey Breslav
7e5794cc7f A common method extracted 2013-03-06 12:53:14 +04:00
Andrey Breslav
7107288f88 Injectors regenerated 2013-03-06 12:53:14 +04:00
Andrey Breslav
deda45135e Generating imports after all usages were generated 2013-03-06 12:53:13 +04:00
Andrey Breslav
47d1ea2770 Migrated to Printer 2013-03-06 12:53:13 +04:00
Andrey Breslav
ac981915a1 Imports are tracked when types are used 2013-03-06 12:53:10 +04:00
Andrey Breslav
f7de41ea1b The rudimentary support for lazy injection removed 2013-03-06 12:52:49 +04:00
Andrey Breslav
7df84101d4 Parts of DependencyInjectorGenerator moved out 2013-03-06 12:52:48 +04:00
Andrey Breslav
3920028fe5 Initial support for factory methods 2013-03-06 12:52:44 +04:00
Andrey Breslav
84ff885f72 Constructor body generation extracted as a method (+ migrated to Printer for convenience) 2013-03-06 12:51:02 +04:00
Andrey Breslav
e26efb4e4d Printer now supports any appendable + separated lists 2013-03-06 12:51:02 +04:00
Andrey Breslav
70f44244f9 Refactoring: dependency computations isolated in a separate class 2013-03-06 12:50:50 +04:00
Evgeny Gerashchenko
89407fdcb2 Cleanup in quickfix code. 2013-03-06 00:04:22 +04:00
Jack Zhou
738a874334 Added quickfix for PLATFORM_CLASS_MAPPED_TO_KOTLIN. 2013-03-06 00:04:22 +04:00
Wojciech Lopata
cee45f6a0a QuickFix for OVERRIDING_FINAL_MEMBER 2013-03-05 23:32:52 +04:00
Wojciech Lopata
08ce27e97e Fix typo in JetBundle.properties 2013-03-05 23:32:38 +04:00
Evgeny Gerashchenko
0f83c8297e Added corner case test for int range iteration. 2013-03-05 14:58:43 +04:00
Wojciech Lopata
237be539b3 QuickFix for RETURN_TYPE_MISMATCH_ON_OVERRIDE and PROPERTY_TYPE_MISMATCH_ON_OVERRIDE. 2013-03-05 14:52:43 +04:00
Wojciech Lopata
a880b2a699 Add removeTypeAnnotation(JetFunction function) utility. 2013-03-05 14:52:42 +04:00
Evgeny Gerashchenko
3ec9cd817f Regenerated test data. 2013-03-05 13:56:04 +04:00
Andrey Breslav
bb9c6b7b88 Logging fqNames in exception messages 2013-03-05 13:36:35 +04:00
Evgeny Gerashchenko
20fa0a3cd1 Added test with class referencing self in upper bound. 2013-03-05 13:33:11 +04:00
Evgeny Gerashchenko
578503c4cd EA-41980 - assert: SignaturesPropagationData.getSuperFunctionsForMethod 2013-03-05 13:33:11 +04:00
Zalim Bashorov
61217a36e7 Merge pull request #145 from tomhal/maps.js-changes
Prevent infinite loop when HashMap is empty and values() method is called
#KT-3035 Fixed
2013-03-05 00:59:51 -08:00
Evgeny Gerashchenko
c93df9fd9d Got rid of deprecated method. 2013-03-04 18:54:06 +04:00
Evgeny Gerashchenko
e2a13da325 Disabled part of IoTest.listFiles on Windows. 2013-03-04 18:54:05 +04:00
Evgeny Gerashchenko
2ac218e084 Made addToClasspath not public and removed redundant field. 2013-03-04 17:33:59 +04:00
Evgeny Gerashchenko
1d6836f6aa Added CLI tests with non-existing paths. 2013-03-04 17:33:59 +04:00
Evgeny Gerashchenko
4213eec2a5 Warning in compiler if annotations path does not exist. 2013-03-04 17:33:59 +04:00
Evgeny Gerashchenko
0e85fdd2cf KT-3290 File.recurse NPE
#KT-3290 fixed
2013-03-04 17:33:58 +04:00
Evgeny Gerashchenko
bfd80e7855 Reformatted. 2013-03-04 17:33:58 +04:00
Evgeny Gerashchenko
8df2f83de0 Fixed typo. 2013-03-04 17:33:58 +04:00
Evgeny Gerashchenko
e67e992bb0 Loading from Java: inner subclass of super's inner. 2013-03-04 17:33:58 +04:00
Evgeny Gerashchenko
3c7d413456 Disabled super functions checking on error types. 2013-03-04 17:33:58 +04:00
Mikhael Bogdanov
b3ec87f956 ClassObject instance field refactoring 2013-03-04 16:42:55 +04:00
Kevin F. Chen
5db0f2132c remove useless nullable qfix and test done 2013-03-02 21:39:27 +04:00
Evgeny Gerashchenko
5d33f779be Replaced "argument list" with "arguments" in quick fix text. 2013-03-02 21:16:17 +04:00
Michał Sapalski
64321dce56 Quickfix for CANNOT_CHECK_FOR_ERASED. 2013-03-02 21:09:25 +04:00
Wojciech Lopata
1f3739415a QuickFix for UNCHECKED_CAST 2013-03-02 21:08:08 +04:00
Andrey Breslav
db99492b9c Merge pull request #215 from lopekpl/KT-1019
KT-1019 recover from missing parentheses in function declaration
2013-03-01 01:24:26 -08:00
Andrey Breslav
89017fbc89 hello.namespace -> hello.HelloPackage 2013-03-01 13:14:06 +04:00
Wojciech Lopata
a887175f1a Common fix for FINAL_SUPERTYPE and FINAL_UPPER_BOUND errors 2013-02-28 16:46:19 +04:00
Mikhael Bogdanov
6e1e495397 KT-3374 Wrong this@method receiver 2013-02-28 15:22:35 +04:00
Wojciech Lopata
bc59ed75ca KT-1019 parser should recover from missing parentheses in function declaration
#KT-1019 Fixed
2013-02-28 12:00:33 +01:00
Wojciech Lopata
6020fc216b Minor fix in JetNamedFunction
This caused NullPointerException while running JetParsingTest when I changed some test.
2013-02-27 17:45:18 +01:00
Natalia.Ukhorskaya
bd4d939089 Android tests: refactor RunUtils 2013-02-27 17:23:05 +04:00
Natalia.Ukhorskaya
efe74a3b88 Android tests: start adb server before emulator start, print emulator log to console 2013-02-27 17:23:04 +04:00
Natalia.Ukhorskaya
ab792a587c Android tests: do not call adb emu kill (throws exception if there are more than 1 emulator) 2013-02-27 17:23:02 +04:00
Natalia.Ukhorskaya
4ba4ac7e4e Android tests: print all exceptions 2013-02-27 17:23:01 +04:00
Natalia.Ukhorskaya
39e5115102 Update android sdk in Android Tests to API 16 2013-02-27 17:22:59 +04:00
Mikhael Bogdanov
1e4536a914 For expression recovery 2013-02-26 18:34:43 +04:00
Mikhael Bogdanov
49bbbe1a0b Test update after 'Specify explicitly type' action refactoring 2013-02-26 18:34:43 +04:00
Mikhael Bogdanov
5460f984e9 'Specify explicit type' action refactoring 2013-02-26 18:34:43 +04:00
Mikhael Bogdanov
d8ea6a3a59 New util method for anonymous type 2013-02-26 18:34:43 +04:00
Evgeny Gerashchenko
a3eae3d5c1 Added quick fix which removes val/var from parameters all over the project. 2013-02-26 17:32:40 +04:00
Svetlana Isakova
998b74aa0a Merge pull request #211 from ponomandr/KT3368
KT-3368 J2K: converted enums contain name() method
2013-02-26 03:03:12 -08:00
Andrey Ponomarev
e4a172946b KT-3368 J2K: converted enums contain name() method
#KT-3368 Fixed
2013-02-25 16:15:53 +01:00
Svetlana Isakova
8ef067be77 KT-3344 InternalError in compiler when type arguments are not specified
#KT-3344 fixed
2013-02-25 18:19:52 +04:00
Svetlana Isakova
6739f7ca24 refactoring: invocation 'getArgumentTypeInfo' changed to 'getFunctionLiteralTypeInfo'
for function literals
2013-02-25 18:19:52 +04:00
Svetlana Isakova
6e51b83afc replaced namespaceAllowed flag with ExpressionPosition enum 2013-02-25 18:19:52 +04:00
Svetlana Isakova
8206af0834 inlined method recordContextForExpressionCall 2013-02-25 18:19:52 +04:00
Svetlana Isakova
3512ad9c30 use stub delegating trace while copy resolved call 2013-02-25 18:19:52 +04:00
Svetlana Isakova
a2c74c14a1 UnsupportedOperationException replaced with IllegalStateException 2013-02-25 18:19:52 +04:00
Andrey Breslav
c5d1e04d41 EA-36903 - ISE: JavaTypeTransformer$.visitClassType
Using error types as type arguments when there's an error in a type instantiation in Java code
2013-02-25 16:14:07 +04:00
Andrey Breslav
9b9fa26713 Additional diagnostic messages for EA-44149 - ISE: KotlinLightClassForExplicitDeclaration.getDelegate 2013-02-25 12:26:52 +04:00
Leonid Shalupov
34d218fad0 k2js: fix debug logging 2013-02-24 18:11:46 +04:00
Leonid Shalupov
04bf51d20e js-tests: cleanup 2013-02-24 17:22:43 +04:00
Leonid Shalupov
293aca2648 js-library: cleanup before build 2013-02-24 17:22:13 +04:00
Leonid Shalupov
7b97e2535a k2js: fix debug logging 2013-02-24 17:21:31 +04:00
Leonid Shalupov
1b7739178e iml: exclude maven target directories 2013-02-24 14:32:28 +04:00
Kevin F. Chen
23e8fe338f Quickfix NON_VARARG_SPREAD completed. 2013-02-23 16:10:44 +04:00
Leonid Shalupov
c6456d04f2 no more publish-maven-artifacts script 2013-02-22 19:33:08 +04:00
Leonid Shalupov
0e6e9af34d maven: local repository for maven plugin integration test moved out of target/ 2013-02-22 19:13:12 +04:00
Leonid Shalupov
7c3307cd60 maven: explicitly set maven-javadoc-plugin version 2013-02-22 19:04:47 +04:00
Leonid Shalupov
1c62818220 fix maven build if generate.javadoc is false 2013-02-22 18:07:06 +04:00
Leonid Shalupov
6daf41e66a git rid of jarjar 2013-02-22 17:57:59 +04:00
Leonid Shalupov
632d12021f maven-plugin: compiler messages to maven log 2013-02-22 17:57:58 +04:00
Nikolay Krasko
5e96ec22e8 Remove deprecated method 2013-02-22 12:40:36 +04:00
Andrey Ponomarev
c91cd9b962 New formatter option: Align in columns 'case' branches 2013-02-22 12:40:35 +04:00
Andrey Ponomarev
6a7e72bfc5 Refactoring: build subblocks of JetBlock in one pass 2013-02-22 12:40:34 +04:00
Natalia Ukhorskaya
7245b05426 Merge pull request #205 from lopekpl/SUPERTYPE_NOT_INITIALIZED
SUPERTYPE_NOT_INITIALIZED_DEFAULT error removed
2013-02-21 23:06:06 -08:00
Wojciech Lopata
23ce144f9d SUPERTYPE_NOT_INITIALIZED_DEFAULT error removed
It was merged with SUPERTYPE_NOT_INITIALIZED.
2013-02-21 17:50:52 +01:00
Natalia Ukhorskaya
c53b88cc00 Merge pull request #206 from ponomandr/j2k
Small improvements in Java to Kotlin converter
2013-02-21 07:27:56 -08:00
Natalia Ukhorskaya
707957e8c1 Merge pull request #201 from lopekpl/DANGLING_FUNCTION_LITERAL_ARGUMENT_SUSPECTED
QuickFix for DANGLING_FUNCTION_LITERAL_ARGUMENT_SUSPECTED
2013-02-21 07:25:14 -08:00
Wojciech Lopata
58a8c0ed08 QuickFix for DANGLING_FUNCTION_LITERAL_ARGUMENT_SUSPECTED 2013-02-21 16:00:24 +01:00
Andrey Ponomarev
34c227b8ed J2K: enum constants are non-nullable 2013-02-21 14:24:26 +01:00
Andrey Ponomarev
e4df4059d1 J2K: Detect @NotNull references in call chains 2013-02-21 14:24:25 +01:00
Andrey Ponomarev
514c7b553f J2K: Detect @NotNull fields 2013-02-21 14:24:25 +01:00
Natalia.Ukhorskaya
3d4a5256e6 Surround with: move declaration out from block 2013-02-21 15:30:26 +04:00
Natalia.Ukhorskaya
62266a64ee Move method: showErrorHint 2013-02-21 15:29:37 +04:00
Natalia.Ukhorskaya
6b6c349a47 Move method: defaultInitializer 2013-02-21 15:29:36 +04:00
develar
bcbb87783c findRtJar - support Oracle JDK 1.7 Mac OS X 2013-02-21 14:15:07 +04:00
Michał Sapalski
bb9c65de4a Quickfix for UNUSED_VARIABLE 2013-02-21 13:09:26 +04:00
Evgeny Gerashchenko
881de132f7 Restored quick fix (it had been removed accidentally when merging). 2013-02-20 16:48:18 +04:00
Evgeny Gerashchenko
c345ee27d8 Got rid of getText() when reporting unresolved reference. 2013-02-20 16:44:04 +04:00
Evgeny Gerashchenko
f8b45f4480 Replaced list with immutable set. 2013-02-20 16:34:00 +04:00
Evgeny Gerashchenko
9de03c68dd Replaced constructors with factory methods. 2013-02-20 16:34:00 +04:00
Evgeny Gerashchenko
6c1e1b6f7f Renamed SimpleDiagnosticFactory -> DiagnosticFactory0. 2013-02-20 16:34:00 +04:00
Evgeny Gerashchenko
3190cf1526 Removed UnresolvedReferenceDiagnosticFactory. 2013-02-20 16:33:59 +04:00
Evgeny Gerashchenko
27a8e16f97 Removed RedeclarationDiagnosticFactory. 2013-02-20 16:33:59 +04:00
Evgeny Gerashchenko
a0f2e2d878 Removed UnusedElementDiagnosticFactory. 2013-02-20 16:33:58 +04:00
Evgeny Gerashchenko
f1572580ac Replaced instanceof checks for particular diagnostic factory classes with using factory sets. 2013-02-20 16:33:58 +04:00
Evgeny Gerashchenko
436619a0d8 Removed AmbiguousDescriptorDiagnosticFactory. 2013-02-20 16:04:21 +04:00
Michał Sapalski
4209430fe6 Quickfix for INACCESSIBLE_BACKING_FIELD 2013-02-20 15:59:21 +04:00
Mikhael Bogdanov
8b4fac7665 Test fix 2013-02-20 11:25:52 +04:00
Michał Sapalski
c2f5743cf0 Quickfix for UNSAFE_INFIX_CALL 2013-02-19 21:10:26 +04:00
Evgeny Gerashchenko
69de91aa88 Changed case of quick fix families to Title Case. 2013-02-19 21:10:26 +04:00
Michał Sapalski
102f49b251 Quickfix for NO_BACKING_FIELD_CUSTOM_ACCESSORS 2013-02-19 20:56:27 +04:00
Mikhael Bogdanov
d1a443d952 Update to Idea 12.0.4 2013-02-19 19:46:00 +04:00
Mikhael Bogdanov
026b833ba0 Test fix 2013-02-19 19:45:54 +04:00
Andrey Breslav
cc569fe0ba Compilation fixed 2013-02-19 19:06:49 +04:00
Andrey Breslav
ec33f90f89 Rename getQualifiedName() -> getFqName() 2013-02-19 18:52:12 +04:00
Mikhael Bogdanov
029b2d9770 Test fixes for 'New diagnostic error for ambiguous object expression type' 2013-02-19 17:56:56 +04:00
Mikhael Bogdanov
1662c5cb75 New diagnostic error for ambiguous object expression type 2013-02-19 17:56:55 +04:00
Mikhael Bogdanov
1b2da6b558 Write proper enclosingMethod/enclosingClass information to bytecode 2013-02-19 17:56:55 +04:00
Evgeny Gerashchenko
1a54e42eb7 Minor. Fixed method name. 2013-02-19 17:45:16 +04:00
Evgeny Gerashchenko
2c13b6b63d Operation mode. 2013-02-19 17:45:16 +04:00
Evgeny Gerashchenko
bb64e43ee1 Better error logging. 2013-02-19 17:45:16 +04:00
Evgeny Gerashchenko
626d9f988c Logging error instead of throwing exception. 2013-02-19 17:45:16 +04:00
Evgeny Gerashchenko
543a2821e4 Disabled assertion when return types are incompatible (incomplete/invalid Java code).
EA-43482 - ISE: JavaFunctionResolver.checkFunctionsOverrideCorrectly
2013-02-19 17:45:15 +04:00
Evgeny Gerashchenko
50bc94bafc Not compiling @ExpectLoadError annotation all the time. 2013-02-19 17:25:36 +04:00
Evgeny Gerashchenko
70030b208d Extracted PropagationHeuristics utility class. 2013-02-19 17:25:36 +04:00
Evgeny Gerashchenko
b1c13a25be Added test with overriding Object[] with T[]
EA-43482 - ISE: JavaFunctionResolver.checkFunctionsOverrideCorrectly
2013-02-19 17:25:36 +04:00
Evgeny Gerashchenko
eb20fb8b39 Removed redundant parameter. 2013-02-19 17:25:36 +04:00
Evgeny Gerashchenko
8d101ad5fa Substituted super functions from mapped classes. 2013-02-19 17:25:35 +04:00
Evgeny Gerashchenko
30afc99ccf Extracted method. 2013-02-19 17:25:35 +04:00
Evgeny Gerashchenko
48113f036f Fixing signature when overriding with erased signature.
EA-43482 - ISE: JavaFunctionResolver.checkFunctionsOverrideCorrectly
2013-02-19 17:25:35 +04:00
Evgeny Gerashchenko
cd06bdedfe Added propagation error message when array of subtype is used in return type of sub method.
EA-43482 - ISE: JavaFunctionResolver.checkFunctionsOverrideCorrectly
2013-02-19 17:25:34 +04:00
Evgeny Gerashchenko
1de5da1e8a Fixed misused "variance" word. 2013-02-19 17:24:14 +04:00
Evgeny Gerashchenko
19bc28b29d Environment with Kotlin descriptors in marker provider.
EA-41980 - assert: SignaturesPropagationData.getSuperFunctionsForMethod
2013-02-19 17:24:14 +04:00
Andrey Breslav
326aeddbd5 NamespaceDescriptorParent moved to impl 2013-02-19 14:40:32 +04:00
Andrey Breslav
afd764c27f Implementations of descriptors moved to a separate package 2013-02-19 14:32:06 +04:00
Natalia.Ukhorskaya
c11be77aa1 Do not apply ExpressionSurrounders for expressions with Unit type and for call expressions inside qualified expression 2013-02-18 17:30:52 +04:00
Natalia.Ukhorskaya
98306c1c54 Add InTextDirectivesUtils.findStringWithPrefix() 2013-02-18 17:21:30 +04:00
Natalia.Ukhorskaya
9bbfc788ea Generate all surround with tests to one file 2013-02-18 17:21:26 +04:00
Natalia.Ukhorskaya
7c360a0ede Add surround with function literal 2013-02-18 17:21:16 +04:00
Natalia.Ukhorskaya
7789062c7c Add try-catch, try-finally, try-catch-finally surrounders 2013-02-18 17:12:47 +04:00
Natalia.Ukhorskaya
ae6a2d3820 Base class for surrounders for statements 2013-02-18 17:00:40 +04:00
Natalia.Ukhorskaya
654fa09fff Add when surrounder 2013-02-18 17:00:39 +04:00
Natalia.Ukhorskaya
af0b6df2b4 Move getExpressionType method to utils 2013-02-18 17:00:35 +04:00
Natalia.Ukhorskaya
814ca0385a Add string template surrounder 2013-02-18 17:00:34 +04:00
Natalia.Ukhorskaya
856bffb324 Add parentheses surrounder 2013-02-18 17:00:03 +04:00
Natalia.Ukhorskaya
eeb158a5c8 Check that found expression has correct start and end offset 2013-02-18 17:00:02 +04:00
Natalia.Ukhorskaya
eef0e554d9 Add base class for expression surrounders 2013-02-18 17:00:01 +04:00
Natalia.Ukhorskaya
68c3b3981b Create packages for surrounders for expression and for statements 2013-02-18 17:00:00 +04:00
Andrey Breslav
bf62bc0261 PsiJetStubWithFqName interface extracted 2013-02-18 16:05:41 +04:00
Andrey Breslav
179456cd0b Tests for Java name resolution in the IDE
#KT-3337 In Progress
LightClasses: class object's property getter unresolved in Java, but compiles OK
2013-02-18 16:05:41 +04:00
Andrey Breslav
15938e3d28 Class object FqNames indexed properly
#KT-3337 In Progress
LightClasses: class object's property getter unresolved in Java, but compiles OK
2013-02-18 16:05:41 +04:00
Andrey Breslav
53b2bbad68 Discover class objects for light class generation in the compiler
#KT-3337 In Progress
LightClasses: class object's property getter unresolved in Java, but compiles OK
2013-02-18 16:05:41 +04:00
Wojciech Lopata
c3d5350315 QuickFix for NOT_AN_ANNOTATION_CLASS error. 2013-02-15 19:14:51 +04:00
Wojciech Lopata
8fad23691f QuickFix for USELESS_HIDDEN_IMPORT. 2013-02-15 19:14:51 +04:00
Michał Sapalski
6cd8779126 Quickfix for NO_BACKING_FIELD_ABSTRACT_PROPERTY. 2013-02-15 19:07:51 +04:00
Nikolay Krasko
1aee735775 Search rt.jar even if compiler was run with jre
#KT-2599 Fixed
2013-02-15 17:19:53 +04:00
Andrey Breslav
33fa065162 Splitting PrintingMessageCollector into Grouping and Printing collectors 2013-02-13 19:06:22 +04:00
Alexey Sedunov
1f8d42ab49 Fix nullability check (in case of explicitly nullable types constructed from ype variables) 2013-02-13 18:23:37 +04:00
Evgeny Gerashchenko
fc62a7dfa0 Project settings. 2013-02-13 18:08:37 +04:00
Evgeny Gerashchenko
f55c3befb3 Disposal on error when processing module script. 2013-02-13 18:08:37 +04:00
Evgeny Gerashchenko
b9e5704057 Updated test data and stdlib sources. 2013-02-13 18:08:37 +04:00
Evgeny Gerashchenko
105d2d72de Extracted method. 2013-02-13 18:08:37 +04:00
Evgeny Gerashchenko
18d6e86e60 KT-3341 Prohibit val/var keywords for catch parameters
#KT-3341
2013-02-13 18:08:36 +04:00
Evgeny Gerashchenko
b1cb8edd18 KT-3181 Prohibit val/var keywords for function parameters
#KT-3181
2013-02-13 18:08:36 +04:00
Evgeny Gerashchenko
808dbd160c KT-3182 Prohibit val/var keywords at for-loop counter.
#KT-3182 fixed
2013-02-13 18:08:36 +04:00
Evgeny Gerashchenko
882c2cb28d Added tests with NaN ends to codegen tests. 2013-02-13 18:08:36 +04:00
Evgeny Gerashchenko
ccab19b2a1 Added range/progression tests with NaN ends. 2013-02-13 18:08:36 +04:00
Evgeny Gerashchenko
021496c07d Prohibited NaN steps. 2013-02-13 18:08:36 +04:00
Evgeny Gerashchenko
4043491ad2 Got rid of code duplication. 2013-02-13 18:08:36 +04:00
Evgeny Gerashchenko
b66025811f Merged after body and after leave variable tasks. 2013-02-13 18:08:35 +04:00
Evgeny Gerashchenko
64c89836fd KT-933 Optimized iteration over progressions.
#KT-933 fixed
2013-02-13 18:08:35 +04:00
Evgeny Gerashchenko
14f3144533 Generating map instead of initializing manually. 2013-02-13 18:08:35 +04:00
Evgeny Gerashchenko
522530ec4a Extracted util method. 2013-02-13 18:08:35 +04:00
Evgeny Gerashchenko
db6fb43d22 Removed unused enum. 2013-02-13 18:08:35 +04:00
Evgeny Gerashchenko
80b21524f4 Optimized iteration over primitive range expression. 2013-02-13 18:08:35 +04:00
Evgeny Gerashchenko
44e14c0a1c Extracted super class. 2013-02-13 18:08:35 +04:00
Evgeny Gerashchenko
b5f820cf69 Prepared for extracting superclass. 2013-02-13 18:08:35 +04:00
Evgeny Gerashchenko
ab99856c16 Got rid of calculating element type twice. 2013-02-13 18:08:34 +04:00
Evgeny Gerashchenko
ca344d93cd Got rid of super calls. 2013-02-13 18:08:34 +04:00
Evgeny Gerashchenko
cc2930b0b6 Got rid of stupid reassigning when iterating ranges. 2013-02-13 18:08:34 +04:00
Evgeny Gerashchenko
e1bc78da72 Simplified scheduling leaving temp variables: added create method. 2013-02-13 18:08:34 +04:00
Evgeny Gerashchenko
fd97bbcbd5 Simplified afterLoop(): no overriding. 2013-02-13 18:08:34 +04:00
Evgeny Gerashchenko
d6bc5a8782 Added util methods. 2013-02-13 18:08:34 +04:00
Evgeny Gerashchenko
da48a11374 Creating loop parameter var once. 2013-02-13 18:08:34 +04:00
Evgeny Gerashchenko
83fa1e95e6 Extracted field (instead of passing parameter. 2013-02-13 18:08:34 +04:00
Evgeny Gerashchenko
c753ac06b1 KT-2707 Optimize for loops for range literals
#KT-2707
2013-02-13 18:08:33 +04:00
Evgeny Gerashchenko
5a4ae00970 Added range iteration test with non-literal ranges. 2013-02-13 18:08:33 +04:00
Evgeny Gerashchenko
814cb6e255 Got rid of harmful asserts.
EA-43300 - assert: KotlinSignatureInJavaMarkerProvider.getScopeForMember
EA-43353 - assert: KotlinSignatureInJavaMarkerProvider.getDescriptorForMember
2013-02-13 18:08:33 +04:00
Maxim Shafirov
6b23384ab9 compilation fix 2013-02-13 17:42:38 +04:00
Natalia.Ukhorskaya
524152f4a2 Move methods ofr find expressions and statements to CodeInsightUtils 2013-02-13 17:21:06 +04:00
Natalia.Ukhorskaya
09ca020780 Add surround with not 2013-02-13 17:21:05 +04:00
Natalia.Ukhorskaya
2499bb79ca Add surround with if /else 2013-02-13 17:21:04 +04:00
Natalia.Ukhorskaya
1786c2c256 Add surround with if 2013-02-13 17:21:03 +04:00
Natalia.Ukhorskaya
d772ad80f8 Add KotlinStatementSurrounderDescriptor 2013-02-13 17:21:02 +04:00
Natalia.Ukhorskaya
dca2b128aa Add KotlinExpressionSurrounderDescriptor 2013-02-13 17:21:01 +04:00
Natalia.Ukhorskaya
256733b598 find expression at offset without whitespaces 2013-02-13 17:21:00 +04:00
Natalia.Ukhorskaya
d245d5bbbb Remove unused parameter 2013-02-13 17:20:59 +04:00
Maxim Shafirov
b851c5597a compilation fix 2013-02-13 16:14:33 +04:00
Maxim Shafirov
63f88cdf65 compilation fix 2013-02-13 15:44:25 +04:00
Maxim Shafirov
a3ca0b0d0c filterNotNull cannot be called on nulls anymore 2013-02-13 15:06:33 +04:00
Andrey Breslav
4d0786a64c Build j2k against compiler jar 2013-02-13 14:22:54 +04:00
Leonid Shalupov
0a1303d118 build: no classes rename in jarjar
build: fixed proguard shrinking
2013-02-13 14:22:54 +04:00
Jack Zhou
a5cecd6048 Added quickfix for VAR_OVERRIDDEN_BY_VAL. 2013-02-13 14:22:54 +04:00
Maxim Shafirov
7231606eb2 Make sure files don't get overwritten if someone mixes generated and normal stdlib sources in one folder during build. 2013-02-13 13:59:29 +04:00
Maxim Shafirov
15446e98b8 Fix tests failing after stdlib generation refactoring 2013-02-13 12:41:12 +04:00
Maxim Shafirov
24d99eb33f adopt to broken inference 2013-02-13 12:41:12 +04:00
Maxim Shafirov
620aae28d0 Collections standard library is now generated from templates. 2013-02-13 12:41:12 +04:00
Peter Tseng
324a39d10b Add quickfix for PACKAGE_MEMBER_CANNOT_BE_PROTECTED 2013-02-13 11:54:16 +04:00
Agnieszka Paszek
b52036c549 Added quickfix for ILLEGAL_ENUM_ANNOTATIONS 2013-02-13 11:47:24 +04:00
Agnieszka Paszek
9e08087a11 Added quickfix for OPEN_MODIFIER_IN_ENUM 2013-02-13 11:47:02 +04:00
Kevin F. Chen
42b7b7e221 Added quickfix for NULLABLE_SUPERTYPE 2013-02-13 11:32:37 +04:00
Andrey Breslav
3293e08d97 Compiler API refactored:
* exec(messageCollector, arguments) introduced
* exception-catching logic moved closer to the entry point
* PrintingMessageCollector localized
2013-02-13 11:03:27 +04:00
Jack Zhou
cf87f55085 Added quickfix for VARIANCE_ON_TYPE_PARAMETER_OF_FUNCTION_OR_PROPERTY. 2013-02-13 11:03:27 +04:00
Evgeny Gerashchenko
e96d8ef475 Fixed test. 2013-02-12 19:06:44 +04:00
Jack Zhou
9692921128 Added quickfix for INCOMPATIBLE_MODIFIERS. 2013-02-12 19:03:57 +04:00
Andrey Breslav
c86f0de79f Typos fixed 2013-02-12 18:02:44 +04:00
Andrey Breslav
5cf17f089f Not using flags in NullableLazyValue, no extra objects in MemoizedFunctionToNullable 2013-02-12 18:01:30 +04:00
Andrey Breslav
4ffca364ba Formatting 2013-02-12 15:24:41 +04:00
Andrey Breslav
b04110e3a9 Explicit interfaces for memoized functions 2013-02-12 15:22:11 +04:00
Andrey Breslav
6e61ada816 NullableLazyValue and NotNullLazyValue introduced 2013-02-12 15:10:25 +04:00
Andrey Breslav
d276837833 Make LazyValue extend Computable 2013-02-12 14:48:49 +04:00
Andrey Breslav
4a17a7ef26 'storage' package created 2013-02-12 14:48:49 +04:00
Andrey Breslav
7e8a753be2 'descriptors' package created 2013-02-12 14:48:48 +04:00
Andrey Breslav
8d92b8a42a 'declarations' package created 2013-02-12 14:48:48 +04:00
Andrey Breslav
fb87a560fb KotlinCodeAnalyzer interface extracted 2013-02-12 14:48:48 +04:00
Andrey Breslav
a3667d1b28 Rename 2013-02-11 22:19:44 +04:00
Andrey Breslav
3e0ead494e Infinite recursion prevented on cyclic class hierarchies 2013-02-11 22:19:43 +04:00
Andrey Breslav
71bad95783 No lazy values stored for memoized functions with non-null values 2013-02-11 22:19:43 +04:00
Andrey Breslav
98dba29ab0 Redeclaration handling in lazy scopes 2013-02-11 22:19:43 +04:00
Andrey Breslav
fd8da79b88 Getting rid of createConcurrentCollection in favor of lazy values 2013-02-11 22:19:42 +04:00
Andrey Breslav
6f851845c6 createConcurrentMap() is no longer needed 2013-02-11 22:19:42 +04:00
Andrey Breslav
ccbd4018b1 Migrating to memoized functions and nullable lazy values 2013-02-11 22:19:34 +04:00
Andrey Breslav
7ddadd9a6c Thread-safe ScopeProvider 2013-02-11 22:15:55 +04:00
Andrey Breslav
ea46cf819f Nullable lazy values and memoized functions supported 2013-02-11 22:15:55 +04:00
Andrey Breslav
961429831c StorageManager can create thread-safe memoized functions 2013-02-11 22:15:55 +04:00
Andrey Breslav
c4ab5a852f Thread-safe lazy values introduced into FilteringClassLikeInfo 2013-02-11 22:15:54 +04:00
Andrey Breslav
8a240e82bd Thread-safe lazy values introduced into LazyClassDescriptor 2013-02-11 22:15:54 +04:00
Andrey Breslav
59b78e3628 Lazy member scopes are now thread-safe.
NOTE: in this implementation there will be exceptions from rewrites on the trace.
2013-02-11 22:15:54 +04:00
Andrey Breslav
1cac7c1a41 LazyTypeParameterDescriptor made thread-safe 2013-02-11 22:15:53 +04:00
Andrey Breslav
439624e616 Unused class deleted 2013-02-11 22:15:53 +04:00
Andrey Breslav
0cf272eda7 Double-checked locking implementation fixed 2013-02-11 22:15:53 +04:00
Andrey Breslav
c595d95ee0 Common code extracted to a method 2013-02-11 17:25:37 +04:00
Andrey Breslav
51f7110961 Common functionality moved up 2013-02-11 17:25:37 +04:00
Andrey Breslav
109c47645b Make sure that the class object class is not accessible from Kotlin 2013-02-11 16:20:32 +04:00
Andrey Breslav
766a33aaa1 Assertion fixed 2013-02-11 16:18:22 +04:00
Nikolay Krasko
b61bdcd67d Remove extension toArray() 2013-02-11 16:09:26 +04:00
Nikolay Krasko
9f1e808255 Remove dangling commas from generated tests 2013-02-11 16:09:25 +04:00
Nikolay Krasko
9dedc6d2a9 KT-1998 Strange "Overload resolution ambiguity"
#KT-1998 Fixed
2013-02-11 16:09:24 +04:00
Nikolay Krasko
54ae3afcde KT-880 Overload resolution ambiguity
#KT-880 Fixed
2013-02-11 16:09:23 +04:00
Mikhael Bogdanov
c61c8d7fa0 Compilation Exception - remove duplicated this on stack
#KT-3114 Fixed
2013-02-11 15:19:49 +04:00
Alexander Udalov
c7e512a38a Correct Android SpecialFiles
Replace all multi-file tests and tests with java with an exclusion of
these directories. Delete obsolete exclusions, add a new one
2013-02-11 03:32:56 +04:00
Alexander Udalov
620143ae5b Add test on bytecode text
Test data should be a Kotlin source file with zero or more comments e.g. of
the form: '// 1 INVOKEVIRTUAL'. The test then checks that the generated
bytecode for this file contains exactly one occurrence of the string
'INVOKEVIRTUAL'
2013-02-11 02:01:43 +04:00
Alexander Udalov
fe96a0172d Move blackBox() methods to AbstractBlackBoxCodegenTest 2013-02-11 02:01:43 +04:00
Alexander Udalov
b485c7ae26 Switch class loading logic in blackBoxWithJava tests
BoxWithJava tests now by default are loaded with the classloader which has
test's classpath in itself, as in the former ClassPathInTheSameClassLoaderTest
2013-02-11 02:01:42 +04:00
Alexander Udalov
22bf8b25b8 Autogenerate codegen multi-file tests
Based on boxMultiFile/ directory
2013-02-11 02:01:42 +04:00
Alexander Udalov
a61b3ec461 Move multi-file codegen testData to boxMultiFile/
There'll be an auto-generated test over this directory
2013-02-11 02:01:42 +04:00
Alexander Udalov
544aad390d Delete StdlibTest and StdlibTestForever
Move remaining tests to AnnotationGenTest (where they did belong to in the
first place)
2013-02-11 02:01:42 +04:00
Alexander Udalov
90d255e7da Simplify tests on not-null assertions
No need to call blackBoxFile() on a useless test data file. Also creating
environment logic is simplified
2013-02-11 02:01:41 +04:00
Alexander Udalov
30203383a4 Delete unneeded abstract test class, regenerate tests 2013-02-11 02:01:41 +04:00
Alexander Udalov
9df3c22097 Kill blackBoxFile()
If your test is supposed to use blackBoxFile(), maybe it should be placed into
box/boxWithStdlib directory
2013-02-11 02:01:41 +04:00
Alexander Udalov
31231fe18b Move JdkAnnotationsTest to boxWithStdlib 2013-02-11 02:01:41 +04:00
Alexander Udalov
f994c9924f Move FullJdk tests to boxWithStdlib 2013-02-11 02:01:41 +04:00
Alexander Udalov
d23f82177f Generate codegen blackbox tests with stdlib 2013-02-11 02:01:40 +04:00
Alexander Udalov
714708eac7 Delete generated test cases, move testData to boxWithStdlib 2013-02-11 02:01:40 +04:00
Alexander Udalov
b311255d96 Extract junit testcase, delete unneeded code 2013-02-11 02:01:40 +04:00
Alexander Udalov
8a605b3884 Codegen tests: move stdlib tests to boxWithStdlib 2013-02-11 02:01:40 +04:00
Alexander Udalov
83b93071d3 Fix over-optimized comparison with null 2013-02-11 02:01:39 +04:00
Andrey Breslav
1670831269 Test fixed after ABI version change 2013-02-10 16:06:30 +04:00
Andrey Breslav
ab79f655a1 ABI version increased due to a change in 1021ec5 "Add Intrinsics.areEqual()" 2013-02-10 15:34:55 +04:00
Svetlana Isakova
40df6eafd1 record RESOLVED_CALL to the right trace to be accessible to backend 2013-02-08 18:05:43 +04:00
Svetlana Isakova
04a6a1d4a4 make TRACE_STUB throw exceptions instead of silently being used 2013-02-08 16:10:30 +04:00
Svetlana Isakova
27d7a159b1 regenerated tests 2013-02-08 15:44:28 +04:00
Svetlana Isakova
c42c2e653b rename hasUnknownTypeParameters -> hasIncompleteTypeParameters 2013-02-08 15:10:43 +04:00
Svetlana Isakova
3014275982 return commit after merge
'Fixed UnsupportedOperationException when a namespace is used in place of an expression.'
2013-02-08 15:10:43 +04:00
Svetlana Isakova
d149218e1d refactoring after code review
do not consider error type in parameters of function type as unknown
2013-02-08 15:10:43 +04:00
Svetlana Isakova
cc94c45195 returned method equalsOrContainsAsArgument 2013-02-08 15:10:43 +04:00
Svetlana Isakova
ff4a9fdab3 rename
ResolveMode enum to {TOP_LEVEL_CALL, NESTED_CALL}
 completeValueArgumentsInference to completeNestedCallsInference
2013-02-08 15:10:43 +04:00
Svetlana Isakova
c069eedc9b small fixes after review 2013-02-08 15:10:43 +04:00
Svetlana Isakova
4f028e41be explicitly invoke callExpressionResolver with NO_EXPECTED_TYPE
for inner calls
2013-02-08 15:10:43 +04:00
Svetlana Isakova
27e6dad307 test improved 2013-02-08 15:10:43 +04:00
Svetlana Isakova
db91928984 test fixes after refactorings
expected return type for function literal cannot depend on expected type of outer function
2013-02-08 15:10:43 +04:00
Svetlana Isakova
ee0628e862 added DEFERRED_COMPUTATION_FOR_CALL
- instead of storing deferredComputationsForArguments in ResolvedCall
store it in BindingContext (in DEFERRED_COMPUTATION_FOR_CALL)
-do not repeat computation for the same argument (cache added)
2013-02-08 15:10:43 +04:00
Svetlana Isakova
f5df9d7dbf refactoring: removed unnecessary local variable 2013-02-08 15:10:43 +04:00
Svetlana Isakova
fe66161352 rename get*ExtendedTypeInfo -> get*TypeInfoForCall 2013-02-08 15:10:43 +04:00
Svetlana Isakova
33de1c31c5 check resulting type for inner call
while completeValueArgumentsInference
2013-02-08 15:10:42 +04:00
Svetlana Isakova
73816a7ba2 use 'BasicCallResolutionContext.create' instead of 'toCallResolutionContext'
from ResolutionContext
2013-02-08 15:10:42 +04:00
Svetlana Isakova
f17139ba1e refactoring: removed unnecessary flag 2013-02-08 15:10:42 +04:00
Svetlana Isakova
fe61d51c10 rename replace->create method 2013-02-08 15:10:42 +04:00
Svetlana Isakova
d418a16dd8 render not inferred return/parameter type of function literals as ???
instead of DONT_CARE / CANT_INFER
2013-02-08 15:10:42 +04:00
Svetlana Isakova
1a072e816a fixed DiagnosticMessageTest
value arguments order got lost during substitutions
2013-02-08 15:10:42 +04:00
Svetlana Isakova
d447c90b13 added tests for function literals faster resolve 2013-02-08 15:10:42 +04:00
Svetlana Isakova
3eee19578a complete inference for inner calls after resolve&inference of outer call finishes
deferredComputationsForArguments stored in ResolvedCallImpl,
'completeValueArgumentsInference' completes inference for inner calls recursively
2013-02-08 15:10:42 +04:00
Svetlana Isakova
0d0441ebd8 do not use bounds containing error types to derive result 2013-02-08 15:10:41 +04:00
Svetlana Isakova
d09c5c5e5e save explicitly 'INCOMPLETE_TYPE_INFERENCE' status 2013-02-08 15:10:41 +04:00
Svetlana Isakova
3f466e8aac added 'replaceResolveMode' to CallCandidateResolutionContext 2013-02-08 15:10:41 +04:00
Svetlana Isakova
35696f9ca0 added tracing parameter to ResolvedCallImpl 2013-02-08 15:10:41 +04:00
Svetlana Isakova
ab9781b85d extracted class TracingStrategyImpl 2013-02-08 15:10:41 +04:00
Svetlana Isakova
4f5af9ab96 added ResolveMode (NORMAL, INTERNAL) to CallResolutionContext 2013-02-08 15:10:41 +04:00
Svetlana Isakova
bb003d2b2f rename ResolveMode to ResolveArgumentsMode 2013-02-08 15:10:41 +04:00
Svetlana Isakova
09e4625931 added TypeInfoForCall containing CallCandidateResolutionContext
(to save context and complete type inference for call later)
2013-02-08 15:10:41 +04:00
Svetlana Isakova
779a79d4d2 removed unused type parameter from CallCandidateResolutionContext 2013-02-08 15:10:41 +04:00
Svetlana Isakova
3ef640039b separated addition of constraints for function literals(*) and for expected type
* = which argument types are known
  call with these function literal constraints is cached
2013-02-08 15:10:41 +04:00
Svetlana Isakova
9b2c666c1f analyze function literals only if argument types are known
(through the first phase of overload resolution)
use intercepting type mismatch trace to backtrace expected type errors
2013-02-08 15:10:41 +04:00
Svetlana Isakova
e932b4fa62 moved 'makeTraceInterceptingTypeMismatch' to ExpressionTypingUtils 2013-02-08 15:10:41 +04:00
Svetlana Isakova
ecd64e80d8 use CallExpressionResolver directly from ArgumentTypeResolver 2013-02-08 15:10:41 +04:00
Svetlana Isakova
9f28764811 do not repeat initialization of candidate call if the context is copied 2013-02-08 15:10:40 +04:00
Svetlana Isakova
e8e07ecec1 contexts moved to subpackage 2013-02-08 15:10:40 +04:00
Svetlana Isakova
0c07cb70ca BasicResolutionContext renamed to BasicCallResolutionContext 2013-02-08 15:10:40 +04:00
Svetlana Isakova
dcd358bf3a introduced common supertype for contexts (ResolutionContext) 2013-02-08 15:10:40 +04:00
Svetlana Isakova
2d9f147dbc rename ResolutionContext to CallResolutionContext
introduced ResolutionContext (without call)
2013-02-08 15:10:40 +04:00
Svetlana Isakova
87a6be6749 rename CallResolutionContext to CallCandidateResolutionContext 2013-02-08 15:10:40 +04:00
Svetlana Isakova
97e1f0ba3c added 'namespacesAllowed' flag to ResolutionContext 2013-02-08 15:10:40 +04:00
Svetlana Isakova
5cc6af0f54 moved getStaticNestedClassesScope to DescriptorUtils 2013-02-08 15:10:40 +04:00
Svetlana Isakova
170a3ad718 getQualifiedExpressionTypeInfo moved to CallExpressionResolver
CallExpressionResolver made a component
2013-02-08 15:10:40 +04:00
Svetlana Isakova
664e25d113 added CallExpressionResolver
call expression resolution logic moved there (from BasicExpressionTypingVisitor)
2013-02-08 15:10:40 +04:00
Svetlana Isakova
e739fd936e added dataFlowInfo to resolvedCall
(to use it information later without repeating 'getTypeInfo' from cache)
=> getResolvedCallForFunction and getVariableType made static
2013-02-08 15:10:40 +04:00
Svetlana Isakova
fa97770831 extracted method commitResolutionCacheData
commit resolve data after argument analysis with temporary trace
2013-02-08 15:10:40 +04:00
Svetlana Isakova
ff01fad3cd substitute upper bounds after creating all substitutions for type parameters
(otherwise it doesn't work for forward references)
2013-02-08 15:10:40 +04:00
Svetlana Isakova
8f59172f27 use declared upper bounds in type inference (not just check them)
- simple cases supported
#KT-2856 fixed
2013-02-08 15:10:39 +04:00
Svetlana Isakova
677bc55056 refactoring: changed the order of the parameters 2013-02-08 15:10:39 +04:00
Svetlana Isakova
da4f1aec1d KT-422 Tune literal typing rules so that varargs overloaded by primitive types work
#KT-422 fixed
2013-02-08 15:10:39 +04:00
Svetlana Isakova
b2823c5966 render type correctly in html for TYPE_INFERENCE_UPPER_BOUND_VIOLATED error 2013-02-08 15:10:39 +04:00
Alexander Udalov
dfc45cc21e Fix Android codegen tests 2013-02-07 22:42:17 +04:00
Evgeny Gerashchenko
d3cb61ada7 Fixed letter case in test code. 2013-02-07 22:29:36 +04:00
Evgeny Gerashchenko
54d864bc4a Simplified test a bit. 2013-02-07 22:03:31 +04:00
Evgeny Gerashchenko
b54a0dd57e Refactored multi-file quickfix test to generated tests framework. 2013-02-07 22:03:31 +04:00
Evgeny Gerashchenko
15dcab9097 Refactored single-file quickfix test to generated tests framework. 2013-02-07 22:03:31 +04:00
Evgeny Gerashchenko
d60c495995 Extracting test name from regex matcher. 2013-02-07 21:39:22 +04:00
Evgeny Gerashchenko
e65ca47d98 Regenerated tests. 2013-02-07 21:39:22 +04:00
Evgeny Gerashchenko
3cf2289687 Matching test files by regex instead of extension. 2013-02-07 21:39:22 +04:00
Evgeny Gerashchenko
1f67492bf9 Renamed class. 2013-02-07 20:32:45 +04:00
Evgeny Gerashchenko
7e4bc445b9 Renamed class. 2013-02-07 20:32:45 +04:00
Evgeny Gerashchenko
7606bb3d1b Removed unnecessary subclassing. 2013-02-07 20:32:45 +04:00
Evgeny Gerashchenko
1400efe36f EA-41429 - CCE: SpecifyTypeExplicitlyAction.invoke
Implemented custom invoke() in SpecifyTypeExplicitlyFix.
2013-02-07 20:32:45 +04:00
Evgeny Gerashchenko
375dd05773 Replaced if-check with assert. 2013-02-07 20:32:45 +04:00
Evgeny Gerashchenko
b541b14ee9 Removed test filtering in JetQuickFixTest. 2013-02-07 20:32:44 +04:00
Andrey Breslav
0234d0afc8 Test data fixed 2013-02-07 18:22:09 +04:00
max-kammerer
843991083d For namespaces with multiple files keep 'Compiled from' information empty 2013-02-07 18:00:53 +04:00
Nikolay Krasko
fa0531aeb6 Resort annotation files 2013-02-07 17:20:57 +04:00
Nikolay Krasko
d474d1582a Fix text on color configuration page 2013-02-07 17:20:56 +04:00
Andrey Breslav
0b4b87fc3a KT-3307 Compiler exception trying to call Java method
#KT-3307 Fixed
2013-02-07 16:44:13 +04:00
Natalia.Ukhorskaya
091399aa4b Android: add tests with java to excluded tests 2013-02-07 14:33:23 +04:00
Natalia.Ukhorskaya
b55b3f95f4 Fix tests: wrong test data (internal visibility shouldn't be displayed after overriding a function) 2013-02-07 13:33:06 +04:00
Natalia.Ukhorskaya
1749e3298c Method from java overridden in kotlin should have kotlin visibility 2013-02-06 21:54:22 +04:00
Natalia.Ukhorskaya
55d4599b3b Add toString methods for visibilities from java 2013-02-06 21:54:21 +04:00
Natalia.Ukhorskaya
74f05bf659 Write protected keyword overriding java package protected function 2013-02-06 21:54:20 +04:00
Natalia.Ukhorskaya
11273f3035 Implement package protected visibility 2013-02-06 21:54:19 +04:00
Natalia.Ukhorskaya
88e3b9e190 Add codegen tests for package visibility 2013-02-06 21:54:18 +04:00
Natalia.Ukhorskaya
2862d13cb1 Change tooltip message for protected static methods from java 2013-02-06 21:54:17 +04:00
Natalia.Ukhorskaya
7f28540e62 Add internal keyword overriding package(java) visibility 2013-02-06 21:54:16 +04:00
Alexander Udalov
64bc79aaac Fix safe calls codegen for nullable generic 2013-02-06 17:54:30 +04:00
Alexander Udalov
433660b2ce Fix codegen of !! for nullable generics 2013-02-06 17:54:29 +04:00
Alexander Udalov
75f09b7527 Fix codegen of as-casts for nullable generics 2013-02-06 17:54:28 +04:00
Alexander Udalov
70f67c7993 Fix elvis expression in case of nullable generic 2013-02-06 17:54:27 +04:00
Alexander Udalov
8697adb28a Fix generic data class hashCode for null
Null may come from everywhere, so we always check for it (when the property's
type is not primitive)
2013-02-06 17:54:26 +04:00
Alexander Udalov
1021ec5ff4 Add Intrinsics.areEqual()
It's more safe, short and less error-prone (especially w.r.t. nullability of
generic types)
2013-02-06 17:54:26 +04:00
max-kammerer
41b379497d revert of 59ede8b 2013-02-06 14:33:19 +04:00
max-kammerer
59ede8b979 Test for KT-2763 2013-02-06 14:15:24 +04:00
Leonid Shalupov
bf33dd4091 Merge remote-tracking branch 'remotes/origin/remote-run/shalupov' 2013-02-06 14:00:02 +04:00
Leonid Shalupov
a6468bdff1 fix tests 2013-02-06 13:16:38 +04:00
Alexander Udalov
1f4dd8cd33 Add CodegenUtil.isNullableType(), fix assertions
JetType.isNullable() is not accurate when the type denotes a type parameter:
a parameter can be not null (isNullable=false), but its upper bound can be
nullable (<T: Any?>), so null may appear in the value of such type. Therefore
it's preferred to use a special check (isNullableType()) in codegen from now on

Do not generate assertion for parameters of not-null types which have a
nullable upper bound + the same with Java method calls

Also fix Intrinsics class internal name in tests

 #KT-3313 Fixed
2013-02-05 21:52:29 +04:00
Wojciech Lopata
b6870b4bba QuickFix for PARAMETER_NAME_CHANGED_ON_OVERRIDE.
It renames method parameter to match the name from the overriden method.
2013-02-05 21:44:00 +04:00
Andrey Breslav
c296cbf6d1 Optimize super-interfaces 2013-02-05 21:34:09 +04:00
Andrey Breslav
2ae3dad92f Extract interface: PropertySetterDescriptor 2013-02-05 20:48:18 +04:00
Andrey Breslav
d8258ef9fb Extract interface: PropertyGetterDescriptor 2013-02-05 20:47:56 +04:00
Andrey Breslav
e09cba03cc Extract interface: PropertyAccessorDescriptor 2013-02-05 20:45:10 +04:00
Andrey Breslav
ffedb64ff2 KDoc tests fixed by setting kotlinHome explicitly 2013-02-05 20:32:58 +04:00
Andrey Breslav
01a24c6334 Better debugging of arguments in Maven 2013-02-05 20:32:11 +04:00
Andrey Breslav
e3cb79ce2e "--kotlinHome" command-line option 2013-02-05 20:30:32 +04:00
Jack Zhou
5ee9b2fdd1 Added quickfix for REDUNDANT_NULLABLE. 2013-02-05 20:17:29 +04:00
Jack Zhou
93e3bd930e Added quickfix for USELESS_SIMPLE_IMPORT. 2013-02-05 18:16:23 +04:00
Wojciech Lopata
3930d2ca33 Not including empty testcases in suite.
That was sometimes resulting with IDE displaying incorrect number of tests in single run.
2013-02-05 17:55:37 +04:00
Wojciech Lopata
b4c21acafd Adding 'Add open modifier to supertype' fix for FINAL_SUPERTYPE error. 2013-02-05 17:55:37 +04:00
Wojciech Lopata
fe07fb4932 Create 'refreshPath' utility function in LocalFileSystemUtils class. 2013-02-05 17:55:37 +04:00
Alexander Udalov
8eb6047972 Fix assertions generation for substituted members 2013-02-05 16:26:56 +04:00
Natalia.Ukhorskaya
4fa3909eaf Build jar for j2kConverter 2013-02-05 15:35:43 +04:00
Andrey Breslav
4b96911b37 @NotNull for parameter of substitute() 2013-02-04 21:25:18 +04:00
Andrey Breslav
21eef960b5 Extract PropertyDescriptor interface 2013-02-04 21:22:54 +04:00
max-kammerer
dbfb29fdf8 Fixed error on running kotlin-maven-plugin tests 2013-02-04 18:32:01 +04:00
Maxim Shafirov
3545f7758a Merge remote-tracking branch 'origin/master' 2013-02-04 18:04:07 +04:00
Maxim Shafirov
9f546f938d KT-3192 Drop kotlin.nullable package
#KT-3192 Fixed
2013-02-04 18:02:52 +04:00
Evgeny Gerashchenko
649cbb65c0 Reverted proguard in build. 2013-02-04 17:30:12 +04:00
Alexander Udalov
c9339c2871 Turn on generating not-null assertions by default
When compiling from IDE
2013-02-04 17:19:10 +04:00
Evgeny Gerashchenko
62bdd75c43 Added assert message. 2013-02-04 16:16:10 +04:00
Evgeny Gerashchenko
658dbda6d4 Regenerated injectors. 2013-02-04 16:16:10 +04:00
Evgeny Gerashchenko
d08466d265 Removed redundant 'out' in MutableMap.putAll 2013-02-04 16:16:10 +04:00
Evgeny Gerashchenko
c96c3c3d45 Removed resources jar from classpath. It is redundant. 2013-02-04 16:16:09 +04:00
Evgeny Gerashchenko
7f5dfd7319 Minor. 2013-02-04 16:16:09 +04:00
Evgeny Gerashchenko
ffbcdb7b49 EA-39239 - assert: ConfigureKotlinLibraryNotificationProvider.addJdkAnnotations 2013-02-04 16:16:09 +04:00
Evgeny Gerashchenko
10df80feda Minor. Extracted method. 2013-02-04 16:16:09 +04:00
Evgeny Gerashchenko
c09c85e862 Minor. Simpler code. 2013-02-04 16:16:08 +04:00
Evgeny Gerashchenko
7b71c66fd6 Fixed errors in alternative signatures. 2013-02-04 16:16:08 +04:00
Evgeny Gerashchenko
25dc5b5991 Checking redundant projections in jdk annotations. 2013-02-04 16:16:08 +04:00
Evgeny Gerashchenko
4be1e7d8d8 Checking redundant/conflicting projection kind in alt signatures. 2013-02-04 16:09:14 +04:00
Andrey Breslav
a47ff5cdb5 Update to IDEA 12.0.3 2013-02-04 15:41:20 +04:00
Andrey Breslav
ae5aeef147 Enable parameter assertions in BytecodeToolwindow 2013-02-04 15:41:19 +04:00
Alexander Udalov
4ca522bf0e Fix codegen of do-while condition
The condition of a do-while loop can use variables declared in the loop
(variables can only be declared inside a block). Previously this behaviour
caused crash because after the block was generated, all variables declared
inside that block were gone from myFrameMap

 #KT-3280 Fixed
2013-02-04 15:30:38 +04:00
Alexander Udalov
2a4f06e32d Make the exception message in JvmClassName helpful 2013-02-04 15:27:31 +04:00
Alexander Udalov
7716feee71 Fix NPE in JetPsiUtil (EA-43298) 2013-02-04 15:27:30 +04:00
Nikolay Krasko
54e5fa5256 Imports resolution tests 2013-02-04 14:23:26 +04:00
Nikolay Krasko
e69acd9198 JetPsiBuilder -> JetImportsFactory rename 2013-02-04 14:23:25 +04:00
Nikolay Krasko
a15f1c8946 Test are imported functions completed 2013-02-04 14:23:24 +04:00
Nikolay Krasko
f05de2ffc8 KT-3165 Weird stack overflow in IDE (test added) 2013-02-04 14:23:23 +04:00
Nikolay Krasko
d4e3a4f74d Tests added for checking two-phase (classes and functions) import resolution 2013-02-04 14:23:22 +04:00
Nikolay Krasko
ee227f01b9 Add test for checking ambiguity for root package and the same package 2013-02-04 14:23:21 +04:00
Nikolay Krasko
f2e78d9064 Create scope with lazy import resolve 2013-02-04 14:23:21 +04:00
Nikolay Krasko
69f699e6a1 Create enumeration LookupMode instead of using boolean onlyClasses 2013-02-04 14:23:20 +04:00
Nikolay Krasko
73785e74bc Debug names for chained scopes in lazy resolve 2013-02-04 14:23:19 +04:00
Nikolay Krasko
6141d0305a Test for ImportPath and JetImportDirective coherence 2013-02-04 14:23:18 +04:00
Nikolay Krasko
70ce304c93 Store alias name with import path 2013-02-04 14:23:17 +04:00
Nikolay Krasko
83bc8d4f21 Centralize and cache creating import directives 2013-02-04 14:23:16 +04:00
Nikolay Krasko
8b60b07cc5 Refactoring: remove warnings 2013-02-04 14:23:15 +04:00
Nikolay Krasko
2ec9e10f14 Refactoring: reuse method, remove warnings, don't process descriptors substituted to null twice 2013-02-04 14:23:15 +04:00
Nikolay Krasko
9b807a6c30 Refactoring: move AbstractScopeAdapter to scope package 2013-02-04 14:23:14 +04:00
Nikolay Krasko
c5de948cd3 Refactoring: remove warning 2013-02-04 14:23:13 +04:00
Nikolay Krasko
846d8f65e0 Refactoring: use delegation instead of subclassing 2013-02-04 14:23:12 +04:00
Andrey Breslav
deb9fce5d5 Speed up location of test classes 2013-02-01 19:31:39 +04:00
Andrey Breslav
79e27f2d90 Write vararg flag on value parameters 2013-01-31 22:05:56 +04:00
Andrey Breslav
b42777a28c Remove unused parameters 2013-01-31 22:05:56 +04:00
Evgeny Gerashchenko
e1b7126ae3 Replaced variance with projection kind. 2013-01-31 21:33:43 +04:00
Evgeny Gerashchenko
d0b18287c8 Removed redundant 'out' in MutableMap.putAll 2013-01-31 21:33:43 +04:00
Evgeny Gerashchenko
74771cb2db KT-3302 Method that implements two differing interfaces are reported as "Incompatible types in superclasses"
#KT-3302 fixed
2013-01-31 21:33:42 +04:00
Evgeny Gerashchenko
0f401d4c9d Minor. Simplified code. 2013-01-31 21:33:42 +04:00
Alexander Udalov
2e64aac788 Add regression test for KT-3132
#KT-3132 Obsolete
2013-01-31 20:59:16 +04:00
Alexander Udalov
1d8e7626a1 Regenerate ranges testData 2013-01-31 20:58:22 +04:00
Alexander Udalov
cfce055b37 Introduce fake light class for file of package
Fixes problems related to not working breakpoints (see comment at the top of
the class)

 #KT-3291 Fixed
2013-01-31 20:43:47 +04:00
Andrey Breslav
f6a8c5e886 Exit code is COMPILATION_ERROR whenever an error was reported through a message collector 2013-01-31 19:32:54 +04:00
Andrey Breslav
e31d5fd3fb "Absent classpath entry" is now a warning 2013-01-31 19:32:54 +04:00
Andrey Breslav
bbde38a6dc KT-1360 Vararg bug in front-end 2013-01-31 18:54:37 +04:00
Andrey Breslav
1fcbf1721b Got rid of repeated local variable 2013-01-31 18:46:28 +04:00
Andrey Breslav
2d2c44ca9d KT-2106 Mixed named and positional arguments should be allowed
#KT-2106 Fixed
2013-01-31 15:43:14 +04:00
Andrey Breslav
8fd59feb21 Logic refactored to a finite automaton 2013-01-31 15:43:14 +04:00
Andrey Breslav
fdde9b9c49 Methods extracted 2013-01-31 15:43:14 +04:00
Andrey Ponomarev
c25b9ff1f3 KT-2734 Wrong icon for enums in the Find class dialog
#KT-2734 Fixed
2013-01-31 15:16:14 +04:00
Andrey Ponomarev
cee8473910 KT-2153 Enum classes don't have a "K" overlay on the icon in project view
#KT-2153 Fixed
2013-01-31 15:16:12 +04:00
Svetlana Isakova
ba9c455ea1 KT-3301 Inference with several supertypes fails
#KT-3301 fixed
2013-01-30 20:29:30 +04:00
Nikolay Krasko
3c82e80745 Merge pull request #168 from ponomandr/KT-3250
KT-3250 Copyright plugin does not work on Kotlin sources
2013-01-30 08:03:34 -08:00
Evgeny Gerashchenko
07a25a7757 Removed newline after copyrights in generated injectors. 2013-01-30 19:24:16 +04:00
Evgeny Gerashchenko
2ef63035f2 Added newline after copyrights in generated tests. 2013-01-30 19:24:16 +04:00
Evgeny Gerashchenko
57e985b7f1 Generated codegen tests for ranges. 2013-01-30 19:24:15 +04:00
Evgeny Gerashchenko
21c37951d6 Removed old range test which were spread all over the place. 2013-01-30 19:23:51 +04:00
Evgeny Gerashchenko
9c83a2f85f Renamed parameters of contains() in ranges. 2013-01-30 19:23:50 +04:00
Evgeny Gerashchenko
6877722f81 Extracted progressions to separate source file. 2013-01-30 19:23:50 +04:00
Andrey Breslav
fd6cb970e4 Correctly return existing provider if it is there 2013-01-30 18:18:52 +04:00
Andrey Breslav
5eb173e8dd Protecting the trace with a lock 2013-01-30 18:02:05 +04:00
Andrey Breslav
c2822fdad7 Declaration providers and resolve session are protected by a storage manager 2013-01-30 18:02:04 +04:00
Andrey Breslav
222c237cbc Using PsiBasedClassMemberDeclarationProvider in StubDeclarationProviderFactory 2013-01-30 18:02:04 +04:00
Andrey Breslav
4cf5bc536c Using project and search scope for stub-based declaration providers
+ using indices for getAllPackages and isPackageDeclared()
2013-01-30 18:02:04 +04:00
Andrey Breslav
ae48edfb5f Unused abstraction removed 2013-01-30 18:02:04 +04:00
Andrey Breslav
9c9599d65f Unused class removed 2013-01-30 18:02:04 +04:00
Andrey Breslav
d4058a8a31 Commented code removed 2013-01-30 18:02:04 +04:00
Andrey Breslav
7404105247 Storage manager introduced
Will be used to make lazily computed data thread-safe
2013-01-30 18:02:04 +04:00
Andrey Breslav
e7ea3d9667 LazyValue renamed to avoid confusion 2013-01-30 18:02:04 +04:00
Andrey Breslav
17b4a5a15c EA-43240 - AIOOBE: ClassReader.a
Index out of bounds from ASM
2013-01-30 18:02:03 +04:00
Andrey Breslav
d633dd7bb7 EA-43239 - assert: JavaFileManagerBase.findClass
Moved the check to a post-startup activity
2013-01-30 18:01:12 +04:00
Andrey Breslav
d31e53fa59 EA-41207 - IAE: NameUtils.requireIdentifier
Test data files renamed
2013-01-30 12:28:45 +04:00
Andrey Breslav
cd56b2f401 File extension filtering cleaned up in tests 2013-01-30 12:28:45 +04:00
Evgeny Gerashchenko
58f37f38f4 Renamed NumberSequence to Progression. 2013-01-29 22:55:10 +04:00
Evgeny Gerashchenko
dd4b508213 Adapted usage of failsWith(). 2013-01-29 22:55:10 +04:00
Evgeny Gerashchenko
719ed4c795 failsWith is really checking for exception class. 2013-01-29 22:55:09 +04:00
Evgeny Gerashchenko
66ce736a81 Moved failsWith to TestJVM. 2013-01-29 22:55:09 +04:00
Evgeny Gerashchenko
63484e28e0 Renamed Iterable.contains to containsItem, to avoid puzzling.
Otherwise, you could accidentally look for Double in List<Int>, or even for Int in ShortSequence (by stupid iterating).
2013-01-29 22:55:09 +04:00
Evgeny Gerashchenko
2fd1430329 Tests for all kinds of ranges and sequences. 2013-01-29 22:55:09 +04:00
Evgeny Gerashchenko
b7c4b9e263 Added primitive contains() to float and double ranges. 2013-01-29 22:55:09 +04:00
Evgeny Gerashchenko
111dd13d39 Moved error checking of built-ins to more direct place. 2013-01-29 22:55:09 +04:00
Evgeny Gerashchenko
18d1d31042 Removed compiling builtins in ant script. 2013-01-29 22:55:09 +04:00
Evgeny Gerashchenko
6c70c6c32a Removed compiling builtins from tests. 2013-01-29 22:55:08 +04:00
Evgeny Gerashchenko
0660dfb84c Made N type parameter not Number.
Otherwise it fails with NoSuchMethodError in runtime.
2013-01-29 22:55:08 +04:00
Evgeny Gerashchenko
3eac3cc38c Removed unnecessary methods. 2013-01-29 22:55:08 +04:00
Evgeny Gerashchenko
a24bf67688 Dropped unnecessary primitive iterable traits. 2013-01-29 22:55:08 +04:00
Evgeny Gerashchenko
72b8c4b3c8 Refactored structure of ranges in JS backend. 2013-01-29 22:55:08 +04:00
Evgeny Gerashchenko
4a19cd758c Changed JS ranges test so it will fail now. 2013-01-29 22:55:08 +04:00
Evgeny Gerashchenko
88c304b85f Regenerated serialized builtins. 2013-01-29 22:55:08 +04:00
Evgeny Gerashchenko
ac7477a6c1 Reformatted. 2013-01-29 22:55:07 +04:00
Evgeny Gerashchenko
6d41697af0 Added ComparableRange. 2013-01-29 22:55:07 +04:00
Evgeny Gerashchenko
cec0389a8a Added equals, hashCode and toString to sequences. 2013-01-29 22:55:07 +04:00
Evgeny Gerashchenko
a947633bec Inlined getter calls. 2013-01-29 22:55:07 +04:00
Evgeny Gerashchenko
0539be1b1c Rearranged methods in ranges. 2013-01-29 22:55:07 +04:00
Evgeny Gerashchenko
90e474ca75 Subclassed ranges from sequence. 2013-01-29 22:55:07 +04:00
Evgeny Gerashchenko
79d3440c92 Subclassed Float/DoubleRange from iterable (for uniformity). 2013-01-29 22:55:07 +04:00
Evgeny Gerashchenko
000fc55035 Added intrinsic properties of ranges and sequences. 2013-01-29 22:55:06 +04:00
Evgeny Gerashchenko
b2e74b1473 Adapted code to new structure of ranges. 2013-01-29 22:55:06 +04:00
Evgeny Gerashchenko
9fa3e47b65 Added start and end property to generic range. 2013-01-29 22:55:05 +04:00
Evgeny Gerashchenko
0e0c048074 New structure of range classes. 2013-01-29 22:55:05 +04:00
Evgeny Gerashchenko
8c4abd4d9c Simpler toString() in ranges. 2013-01-29 22:55:05 +04:00
Evgeny Gerashchenko
0ff3589bb9 Moved *Range.step() functions to stdlib. 2013-01-29 22:55:05 +04:00
Evgeny Gerashchenko
9b866b2e12 Implemented reversed() in proper way.
- converted it into function
- return sequence values
- implemented for sequences as well
2013-01-29 22:55:05 +04:00
Evgeny Gerashchenko
0051cb9553 downTo functions return sequence instead of range now. 2013-01-29 22:55:04 +04:00
Evgeny Gerashchenko
4736b8d6e7 Introduced sequence classes. 2013-01-29 22:55:04 +04:00
Evgeny Gerashchenko
abe7ca21bf Moved primitive iterators to upper level. 2013-01-29 22:55:04 +04:00
Evgeny Gerashchenko
88a6cffb34 Simplified primitive iterators. 2013-01-29 22:55:04 +04:00
Evgeny Gerashchenko
c8a194c0a8 Dropped *Range.isReversed 2013-01-29 22:55:04 +04:00
Evgeny Gerashchenko
797b961484 Rearranged methods to follow common structure. 2013-01-29 22:55:03 +04:00
Evgeny Gerashchenko
9cd67dfc5c Removed unnecessary iteratorStart property of ranges. 2013-01-29 22:55:03 +04:00
Evgeny Gerashchenko
eb8107115d Moved IntRange.count to Ranges class. 2013-01-29 22:55:03 +04:00
Evgeny Gerashchenko
af0997a147 Removed static count() in all but IntRange. 2013-01-29 22:55:03 +04:00
Alexander Udalov
823fc14722 Regenerate tests 2013-01-29 22:46:37 +04:00
Alexander Udalov
9007a6214a Fix closure's reference to outer closure
#KT-3276 Fixed
2013-01-29 22:41:58 +04:00
Andrey Breslav
be349f6229 Migrate to IDEA 123.139 (12.0.3) 2013-01-29 20:46:14 +04:00
Alexander Udalov
bb5c65a7db Fix Android tests 2013-01-29 17:54:52 +04:00
Alexander Udalov
1eae609a35 Fix Android tests 2013-01-28 22:47:08 +04:00
Evgeny Gerashchenko
f4c91915bb Fixed tests by running super.tearDown() 2013-01-28 20:20:37 +04:00
Evgeny Gerashchenko
3acf284a4a Reverted some copyrights. 2013-01-28 19:20:39 +04:00
Evgeny Gerashchenko
52b7ee6447 Happy new year 2013! 2013-01-28 18:58:08 +04:00
Evgeny Gerashchenko
65f1a8f430 Added test with number literals passed as constants. 2013-01-28 18:29:21 +04:00
Evgeny Gerashchenko
18b5495a8c KT-1895 Make it possible to pass 1.0 as Float without explicit casting
#KT-1895 fixed
2013-01-28 18:29:21 +04:00
Alexander Udalov
0b1fe9c611 Generate black box with java codegen tests 2013-01-28 18:20:44 +04:00
Alexander Udalov
2904d1745b Remove generated black box java codegen test
Move all testData to boxWithJava/
2013-01-28 18:20:41 +04:00
Alexander Udalov
86938f57b1 Remove codegen tests with Java, move testData to boxWithJava/
There'll be a single generated test class like
BlackBoxCodegenTestGenerated
2013-01-28 18:20:37 +04:00
Alexander Udalov
10c5949199 Extract some codegen tests to black box testData 2013-01-28 18:20:33 +04:00
Alexander Udalov
f7e0b06c2f Generate black box codegen tests 2013-01-28 18:20:29 +04:00
Alexander Udalov
5313cf3bf0 Fix failing tests, copy testData
Some tests were using files that others called blackBoxFile() on. Since
those files are now moved to box/, copy them back to make the tests pass
2013-01-28 18:20:25 +04:00
Alexander Udalov
7ce62a5b64 Remove generated codegen tests, move all testData to box/
A single test file will be generated out of box/ directory
2013-01-28 18:20:21 +04:00
Alexander Udalov
41a416da60 Move blackBoxFile() testData to box/ directory
Delete all test methods (and empty test classes), since they'll be
auto-generated
2013-01-28 18:20:17 +04:00
Alexander Udalov
ecbb2f10ef NamespaceGenTest doesn't require stdlib 2013-01-28 18:20:12 +04:00
Alexander Udalov
9bf73cf4b3 Extract static functions to CodegenTestUtil
Add Nullable/NotNull annotations
2013-01-28 18:18:08 +04:00
Alexander Udalov
63aacc416f Extract classPathInTheSameClassLoader into a separate test
- class loader is now always created as if classPathInTheSameClassLoader
  = false, which was the case of every codegen test except kt2781, which
  is extracted into a separate file
- testNoClassObjectForJavaClass() is moved from StdlibTest since it has
  a custom createClassLoader() which doesn't work well in a java-interop
  case
- get rid of generateClassesInFileGetState
- several similar methods are inlined
2013-01-28 18:16:40 +04:00
Alexander Udalov
639aa9e218 Codegen tests: don't generate twice when a test fails 2013-01-25 23:06:43 +04:00
Alexander Udalov
df5b809b46 Refactor CodegenTestCase
- prohibit main(Array<String>) in favor of box(): String
- move all script-related code to ScriptGenTest
- remove unused environment-creating methods
- inline trivial methods & other minor stuff
2013-01-25 23:06:43 +04:00
Alexander Udalov
74467df3ef Sort out blackBox*() methods
- get rid of blackBox(), extract tests into files
- delete single-file usages of blackBoxMultiFile()
- inline some other blackBox methods
- suppress exception in blackBoxWithJava()
2013-01-25 23:06:42 +04:00
Alexander Udalov
c8f73cfdae Remove codegen tests out of JetNpeTest 2013-01-25 23:06:42 +04:00
Andrey Breslav
1c0cdbf142 Look up kotlin-runtime.jar through the marker class + more marker classes 2013-01-25 22:02:36 +04:00
Andrey Breslav
0187451c6f Subscribe for exitDumbMode() to update notifications
Instead of scheduling runWhenSmart(), which does not work sometimes
2013-01-25 22:02:36 +04:00
Andrey Breslav
f91d4c5497 Class renamed 2013-01-25 22:02:35 +04:00
Andrey Breslav
8e516441f1 Version-related classes moved to the appropriate package 2013-01-25 22:02:35 +04:00
Andrey Breslav
341bd3a555 Notifications about unsupported ABI versions 2013-01-25 22:02:35 +04:00
Andrey Breslav
5a09d3a6b5 Continuation added to updateRuntime() 2013-01-25 22:02:35 +04:00
Andrey Breslav
c662f51a0a A method to find local VirtualFile for Kotlin runtime library 2013-01-25 22:02:35 +04:00
Andrey Breslav
e15953b9fc Finding library roots with wrong ABI versions 2013-01-25 22:02:35 +04:00
Andrey Breslav
2ec03acd17 Library created under write action 2013-01-25 22:02:35 +04:00
Andrey Breslav
96c6e604fb Assertion message 2013-01-25 22:02:35 +04:00
Andrey Breslav
0bf6c75e49 Handle non-existent files 2013-01-25 22:02:34 +04:00
Andrey Breslav
a4d2cd5247 Assert message 2013-01-25 22:02:34 +04:00
Andrey Breslav
fb80e64e6b Common library-related logic is extracted from UI classes to a util class 2013-01-25 22:02:34 +04:00
Andrey Breslav
41dd4b29ae AbiVersionIndex added 2013-01-25 22:02:34 +04:00
Andrey Breslav
8797c3ea95 New package 'versions' created 2013-01-25 22:02:34 +04:00
Evgeny Gerashchenko
0031a633a2 KT-3277 Exception opening URLClassloader from java SDK. Obviously static class initializer doesn't have a name
EA-43194 - assert: KotlinSignatureInJavaMarkerProvider.getDescriptorForMember

 #KT-3277 fixed
2013-01-25 17:43:37 +04:00
Alexander Udalov
69ae014da3 Revert excluding kt344 in SpecialFiles 2013-01-24 23:01:35 +04:00
Alexander Udalov
aa4e69de11 Remove obsolete special files from android tests 2013-01-24 21:12:28 +04:00
Alexander Udalov
0090ce3322 Refactor codegen tests: no special box() result
box() shall always return "OK"
2013-01-24 21:12:28 +04:00
Alexander Udalov
de37f73c8d Remove tests on RTTI
It was never implemented
2013-01-24 21:12:27 +04:00
Alexander Udalov
0df71bd696 Refactor codegen tests
- initialize environment only once in setUp()
- add comments on why some tests are disabled
- modify and rename some tests
- re-enable now working tests
- extract some tests into files with box()
- remove useless 'throws' declarations and commented code
2013-01-24 21:12:27 +04:00
Alexander Udalov
99827d10a8 Rename *.jet -> *.kt in codegen tests 2013-01-24 21:12:27 +04:00
Natalia.Ukhorskaya
b0aa094cf8 Constructor for protected_static nested class should be protected 2013-01-24 20:58:39 +04:00
Andrey Breslav
20c1181ad1 Merge pull request #167 from ponomandr/master
KT-3263 Add a quick fix to make a class inner
2013-01-24 08:18:46 -08:00
Natalia.Ukhorskaya
e37cb461f6 Support visibility for protected static members
#KT-2999 Fixed
2013-01-24 18:43:37 +04:00
Nikolay Krasko
f9ae4f58b8 Fix test - read variable for reproduce KT-3273 fail condition
#KT-3273 Fixed
2013-01-24 17:10:28 +04:00
Andrey Ponomarev
d385cd0155 KT-3250 Copyright plugin does not work on Kotlin sources 2013-01-23 23:44:27 +01:00
Andrey Ponomarev
52d259bc7b KT-3263 Add a quick fix to make a class inner 2013-01-23 19:26:30 +01:00
Alexander Udalov
a0a22b7be6 Outer's superclass' method is now inaccessible from nested
Also the diagnostic error message reported the wrong nested class name: it
should be the nested class in the hierarchy which is static, not the class of
the scope where we're checking the accessibility
2013-01-23 20:18:16 +04:00
Andrey Breslav
f84d00eec9 Kotlin classes always have a signature 2013-01-23 20:12:48 +04:00
Andrey Breslav
0dc24bcd92 KT-3268 Check binary format version in the compiler 2013-01-23 20:12:48 +04:00
Andrey Breslav
2cb530a6d1 Warnings fixed, annotations added 2013-01-23 20:12:47 +04:00
Andrey Breslav
56acd57e73 KT-3267 Put binary format version into the generated class files
#KT-3267 Fixed
2013-01-23 20:12:47 +04:00
Nikolay Krasko
2e27fb80f3 KT-3273 Return type coalesces to Tuple0 in when/if nested clauses
#KT-3273 Fixed
2013-01-23 19:24:00 +04:00
Andrey Breslav
3e02764603 Supporting FqNames with spaces/comments inside them for deprecated 2013-01-23 18:58:38 +04:00
Andrey Breslav
a7531926a4 Properly compute STATIC for light classes 2013-01-23 18:54:04 +04:00
Andrey Breslav
bd3d41e7ed JetPackageDeclarationIndex removed (replaced by JetAllPackagesIndex) 2013-01-23 18:54:03 +04:00
Andrey Breslav
e1831877b7 GenerationStrategy removed 2013-01-23 18:54:03 +04:00
Vladimir Rudev
99aee736d1 KT-2723 Overridden/Implemented gutter icon for class and trait 2013-01-23 15:59:08 +04:00
Andrey Breslav
95f84459c9 Utility methods moved to a separate class 2013-01-23 13:10:35 +04:00
Andrey Breslav
5e1e6c2595 Invisible private classes are not auto-imported 2013-01-23 13:10:35 +04:00
Andrey Breslav
3e13ca3fd1 Warning suppressed 2013-01-23 13:10:35 +04:00
Andrey Breslav
dd15b0e222 Package class name computation changed 2013-01-23 13:10:35 +04:00
Andrey Breslav
1671015466 Visibility of nested light classes fixed 2013-01-23 13:10:35 +04:00
Andrey Breslav
aa39519323 Using isTopLevelDeclaration instaed of a direct instanceof check 2013-01-23 13:10:35 +04:00
Andrey Breslav
a089054b1a @NotNull added 2013-01-23 13:10:35 +04:00
Andrey Breslav
3851de11f7 Test data fixed for generic bounds 2013-01-23 13:10:35 +04:00
Andrey Breslav
fe170f383a Tests fixed for [deprecated] 2013-01-23 13:10:34 +04:00
Andrey Breslav
73f8fdb474 Package classes are final 2013-01-23 13:10:34 +04:00
Andrey Breslav
9b0092190a Test: Report all errors, not just the first one 2013-01-23 13:10:34 +04:00
Andrey Breslav
20b6eae88c Annotations are also interfaces 2013-01-23 13:10:34 +04:00
Andrey Breslav
dad59b20ba Interfaces are always abstract 2013-01-23 13:10:34 +04:00
Andrey Breslav
4549ad0a5e Kotlin does not support static nested classes so far 2013-01-23 13:10:34 +04:00
Andrey Breslav
a23a255ec1 Top-level private classes are public in Java 2013-01-23 13:10:34 +04:00
Andrey Breslav
3bbc1e342a Checking that light classes agree with their delegates 2013-01-23 13:10:34 +04:00
Andrey Breslav
4b5eaccb94 Load physical files from tests 2013-01-23 13:10:34 +04:00
Andrey Breslav
7668141f85 Base class for tests introduced 2013-01-23 13:10:34 +04:00
Andrey Breslav
1441f6d591 Enable temporarily disabled tests 2013-01-23 13:07:02 +04:00
Natalia.Ukhorskaya
db81672d23 Refactoring in android tests 2013-01-22 20:52:03 +04:00
Alexander Udalov
3b41627b9f Regenerate tests 2013-01-22 19:49:55 +04:00
Alexander Udalov
8b5607d98f Regression tests for some old EA reports
EA-35953, EA-35743
2013-01-22 19:49:14 +04:00
Alexander Udalov
ab730b7dd5 Fix CompareTo intrinsic behavior in no-dot syntax 2013-01-22 19:49:10 +04:00
Nikolay Krasko
44dcdde513 Dispose GeneratedClassLoader 2013-01-22 16:05:23 +04:00
Nikolay Krasko
a6c4a36ce5 Remove warnings 2013-01-22 15:53:37 +04:00
Nikolay Krasko
731f2d51f6 Free memory in tearDown() 2013-01-22 15:53:31 +04:00
Natalia.Ukhorskaya
126c21de96 Fix EA-42958 - ISE: FqName.parent 2013-01-22 11:39:49 +04:00
Kirill Berezin
e89a8c684f KT-3159 Disallow overriding var with different type #KT-3159 fixed 2013-01-21 15:42:39 -08:00
Michał Sapalski
e9613b95ac QuickFix for ELSE_MISPLACED_IN_WHEN. 2013-01-21 22:03:58 +04:00
Jack Zhou
8d71840255 Added QuickFix for redundant type projections. 2013-01-21 21:56:38 +04:00
Andrey Breslav
e384d4ec96 Process only those Kotlin files that sit under source/test roots 2013-01-21 09:21:03 -08:00
develar
c1772685e9 fix duplication 2013-01-21 21:17:02 +04:00
Evgeny Gerashchenko
ca4751653f ability to get text from annotations xml files 2013-01-21 21:16:51 +04:00
Evgeny Gerashchenko
5f6804b6b4 EA-43015 - assert: KotlinSignatureInJavaMarkerProvider.collectSlowLineMarkers (no member name)
Better assertion message.
2013-01-21 20:12:41 +04:00
Evgeny Gerashchenko
191d566fb8 Better assertion message. 2013-01-21 20:12:40 +04:00
Evgeny Gerashchenko
bfa20f7156 Supported constructors.
EA-43090 - assert: KotlinSignatureInJavaMarkerProvider.collectSlowLineMarkers (couldn't find descriptor)
2013-01-21 20:12:40 +04:00
Andrey Breslav
6bec3c9366 No line markers for anonymous or local class' methods
#KT-3270 fixed
2013-01-21 20:03:03 +04:00
Andrey Breslav
7362f69a62 Static methods supported 2013-01-21 20:03:02 +04:00
Andrey Breslav
10d971bc7a Extract methods 2013-01-21 20:03:02 +04:00
Natalia.Ukhorskaya
6874ab0ddc Rename parameter 2013-01-21 18:53:18 +04:00
Natalia.Ukhorskaya
9422fea0c4 Mark deprecated as a warning
#KT-3252 Fixed
2013-01-21 16:34:07 +04:00
Natalia.Ukhorskaya
d7c8655966 Refactoring in Codegen Tests 2013-01-21 13:26:06 +04:00
Jack Zhou
2f47e30a1a Fixed UnsupportedOperationException when a namespace is used in place of an expression. 2013-01-21 13:10:19 +04:00
Alexander Udalov
54e5b6d476 Regenerate tests 2013-01-21 13:10:00 +04:00
develar
5ba0177af8 jps plugin compiler path must not contains ../kotlinc/lib/kotlin-compiler.jar 2013-01-20 09:36:48 -08:00
Andrey Breslav
4d0baf3e06 No Java2Kotlin converter classes in the compiler 2013-01-19 07:13:24 -08:00
Alexander Udalov
4305a009df Add regression test for KT-2673
#KT-2673 Obsolete
2013-01-18 21:27:07 +04:00
Alexander Udalov
ffd62eb80e Refactor ClassGenTest
Initialize environment with JDK_ONLY in setUp(), allowing to quickly launch
tests without compilation of stdlib.

Remove duplicate/unneeded/commented out tests
2013-01-18 18:04:09 +04:00
Alexander Udalov
c4a3963925 Fix nested classes codegen bug
When constructing a closure, codegen in some cases incorrectly determined if
it needed to store a reference from a nested class to the outer
2013-01-18 14:59:27 +04:00
Natalia.Ukhorskaya
5c56900a09 Fix maven build: rename namespace class to package class 2013-01-18 12:59:36 +04:00
Nikolay Krasko
fb9c4b92c4 Suppress all warnings for generated test classes 2013-01-17 21:05:11 +04:00
Nikolay Krasko
6ce830e999 Add information about unsupported class for label descriptor 2013-01-17 21:05:08 +04:00
Evgeny Gerashchenko
6f2625c7eb KT-3248 Highlight Java members with invalid annotations in IDE
#KT-3248 fixed
2013-01-17 20:01:49 +04:00
Evgeny Gerashchenko
d2cddde04e Minor. Casting on higher level. 2013-01-17 19:23:39 +04:00
Evgeny Gerashchenko
7d46affd14 Fixed bug in checking for annotation writablity. 2013-01-17 19:23:39 +04:00
Evgeny Gerashchenko
0f780a84d4 KT-2808 Intention to change existing alternative Kotlin signature
#KT-2808 fixed
2013-01-17 19:23:39 +04:00
Alexander Udalov
05b482e7d5 Ignore unsupported codegen tests for Android 2013-01-17 18:44:24 +04:00
Alexander Udalov
8dff523858 Add some regression tests for obsolete issues
Regenerate tests
2013-01-17 17:38:46 +04:00
Alexander Udalov
3b43d5e874 Additional loadJava/loadKotlin tests for nested classes
#KT-1174 Fixed
2013-01-17 16:45:51 +04:00
Alexander Udalov
192a81591b Resolve qualified nested class expressions
lookupNamespaceType now returns NamespaceType of a scope not only of the
namespace found by name, but also of the classifier static classes scope found
by the same name. This allows correct resolution of expressions
"Class.Nested.member()", where Class comes from Java (previously it was
resolved into a NamespaceDescriptor with a NamespaceType).

NamespaceDescriptor.getNamespaceType() is deleted since there are no sense in
namespace's NamespaceType alone anymore.

Also some minor refactoring (referencedName param is useless)

 #KT-1174 In Progress
2013-01-16 23:11:50 +04:00
Alexander Udalov
c4b5577555 Do not report NO_CLASS_OBJECT when namespacesAllowed=true
Now with nested classes the expression "A.something" makes sense even when A
doesn't have a class object ("something" could be a nested class)

Also "A" expression now gets a NamespaceType with the scope of all static
nested classes of A

 #KT-1174 In Progress
2013-01-16 23:11:50 +04:00
Alexander Udalov
85bd41dfa5 Codegen tests for inner/nested classes
#KT-1174 In Progress
2013-01-16 23:11:49 +04:00
Alexander Udalov
cc5ba53c80 Support inner/nested classes in JVM back-end
#KT-1174 In Progress
2013-01-16 23:11:48 +04:00
Alexander Udalov
051e94b1c5 Get rid of MutableClassDescriptorLite.isStatic()
isStatic() is now precisely !isInner()
2013-01-16 23:11:48 +04:00
Alexander Udalov
b612989eb0 Remove 'inner enum' hack & fix Java inner class resolve
Inner enum was placed into the class object of the outer class. Remove the
hack from frontend, frontend.java & backend. Fix tests

 #KT-1174 In Progress
2013-01-16 23:11:47 +04:00
Alexander Udalov
cc6bd6239a Remove unused method 2013-01-16 23:11:46 +04:00
Alexander Udalov
65716431c4 DescriptorRendererImpl now writes 'inner' for inner classes
#KT-1174 In Progress
2013-01-16 23:11:45 +04:00
Alexander Udalov
0b51a6cae0 Disallow nested classes within inner & local classes
#KT-1174 In Progress
2013-01-16 23:11:45 +04:00
Alexander Udalov
a0caa88adf Report ILLEGAL_MODIFIER on inappropriate 'inner' keyword usage
#KT-1174 In Progress
2013-01-16 23:11:44 +04:00
Alexander Udalov
0a1907de11 Check all modifiers for objects
DeclarationsChecker didn't check visibility modifiers for objects
2013-01-16 23:11:43 +04:00
Alexander Udalov
7a3000ccac Forbid usage of outer's generic parameter in nested class
#KT-1174 In Progress
2013-01-16 23:11:42 +04:00
Alexander Udalov
43c37398af Labeled this & super to nested class' outer is an error
#KT-1174 In Progress
2013-01-16 23:11:42 +04:00
Alexander Udalov
5d92453532 Inaccessible outer class member is now an error
#KT-1174 In Progress
2013-01-16 23:11:41 +04:00
Alexander Udalov
e76abcb625 Add ClassDescriptor.isInner()
Implement in resolve & lazy resolve; place a stub in resolve-java

 #KT-1174 In Progress
2013-01-16 23:11:40 +04:00
Alexander Udalov
84e4611d2b Add 'inner' keyword
Support for the keyword in PSI and stubs

 #KT-1174 In Progress
2013-01-16 23:11:39 +04:00
Alexander Udalov
949f5ed834 JetSimpleNameExpression's name is not null
Modify usages accordingly
2013-01-16 23:11:39 +04:00
Alexander Udalov
173dfc4811 Fix kotlin-maven-plugin compilation 2013-01-16 23:09:17 +04:00
Alexander Udalov
e97b65801b Fix stdlib tests compilation 2013-01-16 22:18:14 +04:00
Alexander Udalov
047db78104 Fix failing build, add imports 2013-01-16 21:21:43 +04:00
Evgeny Gerashchenko
abaa450917 Moved JVM-specific String functions filter(), map(), etc to StringsJVM.kt 2013-01-16 20:32:24 +04:00
Evgeny Gerashchenko
8f78ee851b Fixed typo in comment. 2013-01-16 19:08:13 +04:00
Yuri Samsoniuk
b9e07eb645 [KT-1859] Added collection like extension methods to String. 2013-01-16 19:03:49 +04:00
Natalia.Ukhorskaya
37b12bff2e Vararg in constructor isn't loaded correctly from bytecode
#KT-3251 Fixed
2013-01-16 17:59:35 +04:00
Evgeny Gerashchenko
6574eca393 Fixed test after introducing new warning. 2013-01-16 15:58:02 +04:00
Evgeny Gerashchenko
739acbcf01 Fixed test by topologically sorting classes in OverrideResolver. 2013-01-16 15:58:02 +04:00
Andrey Breslav
44580406ec Artifact archive renamed from "kotlin-${build.number}.zip" to "kotlin-compiler-${build.number}.zip"
This makes it possible to write artifact wildcards in dependent TeamCity builds
2013-01-16 15:44:27 +04:00
Andrey Breslav
cb3a1352e4 Merge pull request #156 from crazyproger/KT-614
KT-614 Emit a warning when non-null type is checked for instance of nullable type
2013-01-16 02:12:47 -08:00
Vladimir Rudev
47f6af8e42 KT-1916 Highlight matching items when searching in Override/Implement dialog
#KT-1916 Fixed
2013-01-16 13:38:16 +04:00
Natalia.Ukhorskaya
95e05d7d97 Android: Ignore kt3238.kt in Anroid Tests 2013-01-16 12:25:09 +04:00
Vladimir Rudev
290681ceee KT-614 Emit a warning when non-null type is checked for instance of nullable type
#KT-614 Fixed
2013-01-15 23:44:20 +04:00
Natalia.Ukhorskaya
65f1efb921 Add JetPackageClass annotation 2013-01-15 19:45:07 +04:00
Natalia.Ukhorskaya
47abdcf565 Rename namespace class to {package.name}Package
Conflicts:

	compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JavaElementFinder.java
2013-01-15 19:45:06 +04:00
Natalia.Ukhorskaya
0f2fa6bade Fix completion for top level non-imported functions 2013-01-15 19:45:04 +04:00
Evgeny Gerashchenko
fe685633b0 KT-3137 Support Darcula editor scheme
#KT-3137 fixed
2013-01-15 19:41:42 +04:00
Evgeny Gerashchenko
b0e9e7b5e7 Updated to IDEA 12.0.2. 2013-01-15 19:41:42 +04:00
Evgeny Gerashchenko
21fa647983 Added load java test with deep Java-Kotlin subclassing. 2013-01-15 19:41:41 +04:00
Evgeny Gerashchenko
8d9acc2662 Manually creating environment. 2013-01-15 19:41:41 +04:00
Evgeny Gerashchenko
bbab0eebae Highlighting variable called as function. 2013-01-15 19:41:41 +04:00
Evgeny Gerashchenko
8fbc71df8a Invoke doTestWithInfos in corresponding test cases. 2013-01-15 19:41:41 +04:00
Evgeny Gerashchenko
849aaaf5d2 Reverted optimizing imports in auto-generated file. 2013-01-15 19:41:41 +04:00
Evgeny Gerashchenko
b1847698a8 Better jar names for runtime/builtins/jdk-annotations in tests. 2013-01-15 19:41:41 +04:00
Evgeny Gerashchenko
b1fd1d8301 KT-3200 wrong Kotlin signature java.util.concurrent.ThreadFactory java.lang.Thread newThread(java.lang.Runnable)
Added checking for compatibility of IDEA's and Kotlin's JDK annotations.

 #KT-3200 fixed
2013-01-15 19:41:41 +04:00
Nikolay Krasko
fa08289706 Refactoring: remove warning and use constant 2013-01-15 19:07:15 +04:00
Nikolay Krasko
303a613389 Remove unused package declaration provider 2013-01-15 19:07:10 +04:00
Nikolay Krasko
1263919e39 Test for property from top level object
#KT-3187 Fixed
2013-01-15 19:06:53 +04:00
Nikolay Krasko
d14f382db9 Collect getting psi classes in PsiClassFinder
#KT-3187 In Progress
2013-01-15 18:12:35 +04:00
Nikolay Krasko
5989bed5c7 Refactor message for property component overwrite
#KT-3187 In Progress
2013-01-15 18:12:34 +04:00
Andrey Breslav
9e45eb7326 Temporarily disable failing tests 2013-01-15 16:39:31 +04:00
Andrey Breslav
05cf9041af Tests to make sure that light classes compute the data properly 2013-01-15 15:32:06 +04:00
Andrey Breslav
8c8accad42 Returning containing file without computing the stub 2013-01-15 15:32:05 +04:00
Andrey Breslav
0ad48a3598 LightClassGenerationStrategy removed 2013-01-15 15:32:05 +04:00
Andrey Breslav
fb1f863098 Using light PsiTypeParameters instead of building a stub:
This is needed when Java resolved references to Kotlin classes: in order to resolve a reference it needs to know type parameters
2013-01-15 15:32:05 +04:00
Andrey Breslav
1a03850951 A test for K-J-K inheritance with generics 2013-01-15 15:32:04 +04:00
Andrey Breslav
d4854c22c4 A test for K-J-K inheritance 2013-01-15 15:32:04 +04:00
Andrey Breslav
eb06ac948b The case of no modifiers on a class supported in KotlinLightClassForExplicitDeclaration 2013-01-15 15:32:03 +04:00
Andrey Breslav
b039c69952 Class object members supported in PsiCodegenPredictor 2013-01-15 15:32:03 +04:00
Andrey Breslav
9d9580d4af Traces fixed in SubclassingKotlinInJavaTest 2013-01-15 15:32:03 +04:00
Andrey Breslav
7f051e38e5 toString() for KotlinLightClassForExplicitDeclaration 2013-01-15 15:32:02 +04:00
Andrey Breslav
4b4a9eb6c9 Create new trace before each resolve (to avoid writing to a trace already filled in by previous analysis) 2013-01-15 15:32:02 +04:00
Andrey Breslav
e46e77f0d3 Support internal visibility by default 2013-01-14 20:20:29 +04:00
Andrey Breslav
effaebdd26 Resolution helpers in tests fixed 2013-01-14 20:20:29 +04:00
Andrey Breslav
fe39f1ea63 NPE fixed 2013-01-14 20:20:29 +04:00
Andrey Breslav
40943fa6d2 JetLightClass removed (replaced by KotlinLightClass implementations) 2013-01-14 20:20:28 +04:00
Andrey Breslav
d9ed18dc00 Common interface for two light class implementations extracted 2013-01-14 20:20:28 +04:00
Andrey Breslav
d70a5c9233 getContainingClass() made faster for toplevel classes 2013-01-14 20:20:28 +04:00
Andrey Breslav
1170cbb7fa KotlinLightClass reads basic properties directly from PSI
(this allows for building Java stubs less frequently)
2013-01-14 20:20:27 +04:00
Andrey Breslav
6f8c9bf0d1 JetClass.isEnum() introduced 2013-01-14 20:20:27 +04:00
Andrey Breslav
1765843e1d Rename 2013-01-14 20:20:27 +04:00
Andrey Breslav
9ada4a8082 KotlinLightClassProvider does not depend on Generation Strategy 2013-01-14 20:20:26 +04:00
Andrey Breslav
6dfc923cf8 Parameter order fixed (caused assertion failure) 2013-01-14 20:20:26 +04:00
Andrey Breslav
0fc0230069 Return proper fqname for package classes 2013-01-14 20:20:26 +04:00
Andrey Breslav
1bedda7748 getContainingFile() for light classes 2013-01-14 20:20:25 +04:00
Andrey Breslav
aeca4d3feb Basic presentation-related methods for KotlinLightClass 2013-01-14 20:20:25 +04:00
Andrey Breslav
3a34ccb03e Icons for lighs classes 2013-01-14 20:20:25 +04:00
Andrey Breslav
e3ba5bf9b7 PsiJavaFileStub is not trackable 2013-01-14 20:20:24 +04:00
Andrey Breslav
4748befcfd JavaElementFinder builds new light classes 2013-01-14 20:20:24 +04:00
Andrey Breslav
fa96915a9c toString() for stub generation strategies 2013-01-14 20:20:24 +04:00
Andrey Breslav
01e92be7d2 No point in tracking files, when we are already tracking out-of-code-block-modifications 2013-01-14 20:20:24 +04:00
Andrey Breslav
92c9688caf Useless methods removed 2013-01-14 20:20:23 +04:00
Andrey Breslav
8e5ea77a72 setName() makes no sense for package classes 2013-01-14 20:20:23 +04:00
Andrey Breslav
59c94732a7 Light class support for nested classes 2013-01-14 20:20:23 +04:00
Andrey Breslav
a577ccabab Light class providers unified 2013-01-14 20:20:22 +04:00
Andrey Breslav
bf4fbe4aff Utility method moved to util class 2013-01-14 20:20:22 +04:00
Andrey Breslav
207f8e7c47 Cleanup 2013-01-14 20:20:22 +04:00
Andrey Breslav
689092da08 Nested class moved out 2013-01-14 20:20:21 +04:00
Andrey Breslav
f929a7f5a9 Cleanup 2013-01-14 20:20:21 +04:00
Andrey Breslav
69080b72af When generating light class for package, do not generate other classes 2013-01-14 20:20:21 +04:00
Andrey Breslav
a91b113cc3 GenerationStrategy is now a strategy 2013-01-14 20:20:20 +04:00
Andrey Breslav
758bebafa4 Providing icons for package classes 2013-01-14 20:20:20 +04:00
Andrey Breslav
5d4e4707ca Prototype implementation of KotlinLightClassForPackage 2013-01-14 20:20:20 +04:00
Andrey Breslav
0fddc92a64 Passing virtual file instead of whole JetLightClass 2013-01-14 20:20:19 +04:00
Andrey Breslav
034cd8844e Provide context for multiple files 2013-01-14 20:20:19 +04:00
Andrey Breslav
6dd60ac8b0 Utility method moved to util class 2013-01-14 20:20:19 +04:00
Andrey Breslav
18de2c8a1f JetCacheManager removed 2013-01-14 20:20:18 +04:00
Andrey Breslav
ac633124a1 Support .namespace classes in JetShortNamesCache 2013-01-14 20:20:18 +04:00
Andrey Breslav
74da34baf2 Cleanup 2013-01-14 20:20:18 +04:00
Andrey Breslav
8d0f8a0035 LightClasses: Searching indexes excluding library sources 2013-01-14 20:20:18 +04:00
Andrey Breslav
f29383faab Redundant 'final' removed 2013-01-14 20:20:17 +04:00
Andrey Breslav
2b1f8b843c Factory method introduced 2013-01-14 20:20:17 +04:00
Andrey Breslav
26ccb80abb Missing @NotNull and assertions added 2013-01-14 20:20:17 +04:00
Andrey Breslav
2a8ee31920 Index packages for objects, too 2013-01-14 20:20:16 +04:00
Andrey Breslav
f34dd7b1b9 Removing code that is no longer used 2013-01-14 20:20:16 +04:00
Andrey Breslav
abbaa51a91 Using indexes to find subpackages 2013-01-14 20:20:16 +04:00
Andrey Breslav
29dd3821cc Using indexes to find packages
JetLightPackage does not depend on PSI elements any more
2013-01-14 20:20:15 +04:00
Andrey Breslav
941e47503e Indexing all packages, including ones declared implicitly 2013-01-14 20:20:15 +04:00
Andrey Breslav
83075d0ad2 Using indexes for getClassNames() 2013-01-14 20:20:14 +04:00
Andrey Breslav
d437787c3d JavaElementFinder uses indexes for findClasses() 2013-01-14 20:20:14 +04:00
Andrey Breslav
66aef9a64f JetClassOrObject implements JetNamedDeclaration 2013-01-14 20:20:14 +04:00
Andrey Breslav
91a1a1420d Index classes by containing package 2013-01-14 20:20:13 +04:00
Andrey Breslav
f166ae43bf Private constructors for index classes 2013-01-14 20:20:13 +04:00
Andrey Breslav
db78db57fa Replace toString() with getFqName() 2013-01-14 20:20:13 +04:00
Andrey Breslav
4a6fd1676b Index classes refactored: keys are properly references, ensuring that a keys doesn't get confused across classes 2013-01-14 20:20:12 +04:00
Andrey Breslav
5f3fc5190f LightClassGenerationSupport helps finding class and package declarations 2013-01-14 20:20:12 +04:00
Andrey Breslav
330953782f Old hack removed 2013-01-14 20:20:12 +04:00
Andrey Breslav
4a2ff1f1d1 FQN_KEY renamed 2013-01-14 20:20:11 +04:00
Andrey Breslav
df7490d01c Index package FqNames for files 2013-01-14 20:20:11 +04:00
Andrey Breslav
e69b9af6d1 Unused parameter removed 2013-01-14 20:20:11 +04:00
Andrey Breslav
6f38388409 Unused line removed 2013-01-14 20:20:11 +04:00
Andrey Breslav
934cce75af Only allow access to declarations from under a read action (to prevent dead locks) 2013-01-14 20:20:10 +04:00
Andrey Breslav
380c8b596a The slow (synchronized) java.util.Stack replaced by com.intellij.util.containers.Stack 2013-01-14 20:20:10 +04:00
Andrey Breslav
2c3a955074 Retrieve JavaElementFinder from Project's extensions 2013-01-14 20:20:10 +04:00
Andrey Breslav
7c4d1e6b09 KotlinCacheManager and LightClassGenerationSupport services added 2013-01-14 20:20:09 +04:00
Andrey Breslav
b5aa44ae49 GenerationState is constructed with BindingContext, not full AnalyzeExhaust 2013-01-14 15:19:50 +04:00
Andrey Breslav
39b6c53ef3 Local variable renamed 2013-01-14 15:19:50 +04:00
Andrey Breslav
f64487eb8b Variable renamed 2013-01-14 15:19:50 +04:00
Andrey Breslav
6b9c6e3d95 Methods extracted/reordered 2013-01-14 15:19:50 +04:00
Andrey Breslav
f1e31341ef Methods reordered 2013-01-14 15:19:49 +04:00
Maxim Shafirov
c293fe124d Regression test for KT-3238. The issue itself is incorrect but test may be useful 2013-01-13 03:09:40 +04:00
Alexander Udalov
5eae85dff5 Fix build, remove @author tag 2013-01-11 21:50:47 +04:00
Vladimir Rudev
e4d33e386e KT-2255, KT-3032 Repair renaming in JetSimpleNameReference 2013-01-11 21:12:51 +04:00
Vladimir Rudev
2201e63031 Tests for KT-2255,KT-3032 2013-01-11 21:12:51 +04:00
Evgeny Gerashchenko
8a7548bc84 Wiped traces of JetStandardLibrary class name. 2013-01-11 18:23:05 +04:00
Evgeny Gerashchenko
ab8bdf673d Better label in Kotlin references tooltip.
#KT-2601 fixed
2013-01-11 18:23:04 +04:00
Evgeny Gerashchenko
aea5620372 Simplified code.
#KT-2601 fixed
2013-01-11 18:01:44 +04:00
Vladimir Rudev
a930ae1b4f KT-2601 Don't display "Original: null" in quick info
Added resolving within libraries if BindingContext didn't provide declaration.
If text for 'Original' is null then second row will not be displayed.

 #KT-2601 In Progress
2013-01-11 17:57:02 +04:00
Evgeny Gerashchenko
dc876e8eeb Got rid of unnecessary type parameters. 2013-01-11 17:55:54 +04:00
Evgeny Gerashchenko
085ccd7327 Got rid of MemberNavigationStrategy. 2013-01-11 17:45:25 +04:00
Evgeny Gerashchenko
6d567750d1 Got rid of methods of MemberNavigationStrategy. 2013-01-11 17:45:25 +04:00
Evgeny Gerashchenko
41fe1a55a5 Moved the rest of members matching logic to MemberMatching. 2013-01-11 17:45:25 +04:00
Evgeny Gerashchenko
897cfc534e Got rid of two methods of MemberNavigationStrategy. 2013-01-11 17:45:25 +04:00
Evgeny Gerashchenko
9120732ad3 Extracted MemberMatching utility class. 2013-01-11 16:38:08 +04:00
Evgeny Gerashchenko
8f26bcaabb Extracted NavigationStrategy and its implementations. 2013-01-11 16:35:09 +04:00
Evgeny Gerashchenko
a217ff6746 Simplified NavigationStrategy. 2013-01-11 16:33:19 +04:00
Evgeny Gerashchenko
e37f11ae53 Better method names. 2013-01-11 16:08:34 +04:00
Evgeny Gerashchenko
04c83b25d4 Added test for obsolete bug.
#KT-3186 obsolete
2013-01-11 16:08:34 +04:00
Evgeny Gerashchenko
14a033cbd4 Minor. Got rid of warnings in JetSourceNavigationHelper. 2013-01-11 16:08:33 +04:00
Evgeny Gerashchenko
27bbca7fe4 Navigate to source when functions differ only in upper bounds of type parameters. 2013-01-11 16:08:33 +04:00
Evgeny Gerashchenko
9d4447e3ae Stabler member sorting.
In case when they have same value parameter types, but different type parameter bounds.
2013-01-11 16:08:32 +04:00
Evgeny Gerashchenko
09f4705360 Modified test data to provoke resolution because of rename in imports. 2013-01-11 16:08:32 +04:00
Evgeny Gerashchenko
43fd993d6d Added test which provokes resolution because of same short name. 2013-01-11 16:08:32 +04:00
Evgeny Gerashchenko
16cad76060 Rearranged methods. 2013-01-11 16:08:32 +04:00
Evgeny Gerashchenko
5609d2506d Minor. Better method name. 2013-01-11 16:08:31 +04:00
Evgeny Gerashchenko
3760bdfee9 Replaced eager resolve with lazy when navigating to library sources. 2013-01-11 16:08:31 +04:00
Evgeny Gerashchenko
b14ca4775c Running NavigateToLibrarySourceTest with force resolve, as well. 2013-01-11 16:08:31 +04:00
Evgeny Gerashchenko
a7b703798a Added no-resolve optimization for class functions and properties. 2013-01-11 16:08:31 +04:00
Evgeny Gerashchenko
b3b885b8f9 Added no-resolve optimization for top-level functions and properties. 2013-01-11 16:08:30 +04:00
Evgeny Gerashchenko
4cea564c2f Replaced JetFunction with JetNamedFunction.
Replaced JetDeclaration with JetNamedDeclaration.
2013-01-11 16:08:30 +04:00
Evgeny Gerashchenko
9684f05e7c Annotated with @Nullable/@NotNull. 2013-01-11 16:08:30 +04:00
Evgeny Gerashchenko
5314b7a81e Simplified method. 2013-01-11 16:08:29 +04:00
Evgeny Gerashchenko
1f665e35f1 Moved extracting member scope to separate methods. 2013-01-11 16:08:29 +04:00
Evgeny Gerashchenko
f12b678234 Minor. Renamed variable. 2013-01-11 16:08:29 +04:00
Evgeny Gerashchenko
7e96501b81 Replaced some ifs with asserts. 2013-01-11 16:08:29 +04:00
Evgeny Gerashchenko
c47704ab86 Got rid of code duplication. 2013-01-11 16:08:29 +04:00
Evgeny Gerashchenko
c53450d528 Simplified JetClsNavigationPolicy. 2013-01-11 16:08:28 +04:00
Evgeny Gerashchenko
7bd87f64ac Supported navigation to source of named object and its members. 2013-01-11 16:08:28 +04:00
Evgeny Gerashchenko
e16ff27e57 Supported navigation to decompiled named object and its members. 2013-01-11 16:08:28 +04:00
Evgeny Gerashchenko
859ef8432e Removed constructor parenthesis for named objects and enum entries. 2013-01-11 16:08:28 +04:00
Evgeny Gerashchenko
a8da60414f receiverType parameter. 2013-01-11 16:08:27 +04:00
Evgeny Gerashchenko
9ee3c0de6d Renamed Matcher -> NavigationStrategy.
Extracted anonymous classes. Renamed methods.
2013-01-11 16:08:27 +04:00
Evgeny Gerashchenko
8c5e7de29d Renamed Matcher -> NavigationStrategy. Extracted anonymous classes. 2013-01-11 16:08:27 +04:00
Andrey Breslav
1a7b7db67f Unneeded lock & on-demand initialization removed 2013-01-11 14:38:04 +04:00
Andrey Breslav
f26412aae4 Utility methods moved to a utility class 2013-01-10 16:16:49 +04:00
Andrey Breslav
9d538dad8a EA-36903 - ISE: JavaTypeTransformer$.visitClassType Fixed 2013-01-10 16:16:49 +04:00
Svetlana Isakova
33a82da493 supertype of error type should be an error type, not any 2013-01-10 15:55:50 +04:00
Svetlana Isakova
142d9a090c no senseless comparison for error type 2013-01-10 15:55:50 +04:00
Alexander Udalov
4cebd3f75b Fix last if-statement in block codegen
#KT-3203 Fixed
2013-01-10 14:05:28 +04:00
Pavel V. Talanov
293b272a22 Fix for a problem where inner (or nested) classes were not analyzed in some situations
# KT-3124 Fixed
2013-01-09 18:38:58 +04:00
Pavel V. Talanov
ad848f2ebc Check for ClassKind in getClassifier() and getObjectDescriptor() implementations in java scopes
# KT-3124 fixed
2013-01-09 18:38:56 +04:00
Alexander Udalov
0fea6822c3 Fix codegen of loaded class objects
Remove useless check and todo.

 #KT-2717 Fixed
 #KT-3142 Fixed
2013-01-09 15:40:21 +04:00
Alexander Udalov
a2e453b759 Refactor CompileKotlinAgainstKotlinTest
CKAKTest is now abstract, the actual testcases are generated via GenerateTests
into CompileKotlinAgainstKotlinTestGenerated.

Also invokeMain() now invokes namespace.main instead of bbb.namespace.main.
2013-01-09 15:32:51 +04:00
Svetlana Isakova
0b53bd25bd KT-2397 Prohibit final methods in traits with no implementation
#KT-2397 fixed
2012-12-29 20:08:10 +04:00
Svetlana Isakova
9bd4ed2a8d changed case for test file 2012-12-29 20:08:10 +04:00
Svetlana Isakova
55968aabad fixed an exception from 'getConstructorReferenceExpression'
(from exception analyzer)
2012-12-29 20:08:10 +04:00
Nikolay Krasko
4d4ba52378 Class.forName can't return null 2012-12-29 19:33:41 +04:00
Nikolay Krasko
0730248fb4 KT-3193 JDK annotation for java.net.Socket.bind
#KT-3193 Fixed
2012-12-29 19:29:03 +04:00
Nikolay Krasko
48445c23ef Early support for idea trunk 2012-12-29 16:46:19 +04:00
Evgeny Gerashchenko
e03eaf6dde Removed @author javadocs from code. 2012-12-28 17:44:31 +04:00
Evgeny Gerashchenko
1de4da28fc Added test checking for @author in code. 2012-12-28 17:44:28 +04:00
Evgeny Gerashchenko
6d95bb7f70 Simplified JetCodeConformanceTest. 2012-12-28 16:42:43 +04:00
Evgeny Gerashchenko
55acb2a675 Fixed new lines issue in NamespaceComparator tests. 2012-12-28 14:45:48 +04:00
Evgeny Gerashchenko
dda15f7505 Excluded class object names from FQ name and qualified name. 2012-12-28 14:25:34 +04:00
Evgeny Gerashchenko
c041fc8fea Removed sorting of upper bounds in renderer.
Removed corresponding test.
2012-12-28 14:25:18 +04:00
Evgeny Gerashchenko
6fa36d330c Regenerated test data. 2012-12-28 14:25:18 +04:00
Evgeny Gerashchenko
28c93f2912 Not rendering "final" for top-level functions and properties. 2012-12-28 14:25:18 +04:00
Evgeny Gerashchenko
60f8c8a343 Rendering modality if it is "non-default". 2012-12-28 14:25:17 +04:00
Evgeny Gerashchenko
87b5356ef9 Rendering default value in parameter info if it is not constant, too. 2012-12-28 14:25:17 +04:00
Evgeny Gerashchenko
4eac6f0d27 Extracted LINE_SEPARATOR constant in Printer. 2012-12-27 20:47:00 +04:00
Evgeny Gerashchenko
bc9f5da47e Rendering nice unicode arrow for function types in UI. 2012-12-27 20:46:59 +04:00
Evgeny Gerashchenko
c483a7f7cd Simplified code in NamespaceComparator. 2012-12-27 20:46:59 +04:00
Evgeny Gerashchenko
c0ce15ddfb Made parameter of renderType() @NotNull. 2012-12-27 20:46:59 +04:00
Evgeny Gerashchenko
8659d14ba0 Introduced compareNamespaceWithFile() method. 2012-12-27 20:46:59 +04:00
Evgeny Gerashchenko
da7f4f3421 Escaping parameter names in "where". 2012-12-27 20:46:59 +04:00
Evgeny Gerashchenko
862a6ffbbc Moved class object case to namespace comparing test. 2012-12-27 20:46:59 +04:00
Evgeny Gerashchenko
0ce1c56999 Got rid of regexp check for java.lang.Object methods. 2012-12-27 20:46:58 +04:00
Evgeny Gerashchenko
5196a17f69 Code cleanup in NamespaceComparator. 2012-12-27 20:46:58 +04:00
Evgeny Gerashchenko
16aa79a828 Removed dead code in NamespaceComparator. 2012-12-27 20:46:58 +04:00
Evgeny Gerashchenko
6ab081d969 Regenerated test data. 2012-12-27 20:46:58 +04:00
Evgeny Gerashchenko
1f0a0b823b Comparing namespaces in serialized form. 2012-12-27 20:46:57 +04:00
Evgeny Gerashchenko
46b848857e Made printer able to avoid extra blank lines. 2012-12-27 20:46:57 +04:00
Evgeny Gerashchenko
d01193f8a3 Removed output filter from NamespaceComparator. 2012-12-27 20:46:57 +04:00
Evgeny Gerashchenko
5dec5a4c28 Regenerated all test data which uses NamespaceComparator. 2012-12-27 20:46:57 +04:00
Evgeny Gerashchenko
af3dffbed4 Using DescriptorRenderer in NamespaceComparator instead of custom serializer.
Removed zoo of *Serializer classes from NamespaceComparator.
2012-12-27 20:46:56 +04:00
Evgeny Gerashchenko
ef1ffa4bf7 Sorting upper bounds when rendering "where" to workaround failing test. 2012-12-27 20:46:56 +04:00
Evgeny Gerashchenko
20341a84e6 Sorting members instead of member strings. 2012-12-27 20:46:56 +04:00
Evgeny Gerashchenko
0df966323d Smarter members sorting. 2012-12-27 20:46:56 +04:00
Evgeny Gerashchenko
b13a99d4cd Moved MemberComparator to frontend. 2012-12-27 20:46:56 +04:00
Evgeny Gerashchenko
fdf4c431e4 Renamed MemberComparator and converted it to singleton. 2012-12-27 20:46:56 +04:00
Evgeny Gerashchenko
3cc61d070b Removed obsolete stdlib-log.txt. 2012-12-27 20:46:56 +04:00
Evgeny Gerashchenko
d9cbeadfff Simplified LazyResolveBuiltinClassesTest.
Since now builtins are resolved lazily, we need to compare it only with hardcopy.
2012-12-27 20:46:56 +04:00
Evgeny Gerashchenko
d89f00e981 Fixed missing " " before class object name. 2012-12-27 20:46:56 +04:00
Evgeny Gerashchenko
778df8b1fd Rendering annotations and visibility for class object.
Don't render modality for any object kind.
2012-12-27 20:46:55 +04:00
Evgeny Gerashchenko
63b3e59a18 Render annotation arguments. 2012-12-27 20:46:55 +04:00
Evgeny Gerashchenko
bf42e3c093 Rendering "constructor" instead of "ctor". 2012-12-27 20:46:54 +04:00
Evgeny Gerashchenko
df11628fb0 Added annotation filtering in DescriptorRenderer. 2012-12-27 20:46:54 +04:00
Evgeny Gerashchenko
a09ebcd1d1 Render class object name when verbose. 2012-12-27 20:46:54 +04:00
Evgeny Gerashchenko
93680e1233 Rendering real type for vararg parameter. 2012-12-27 20:46:54 +04:00
Evgeny Gerashchenko
3e7ce13893 Render parameter indices. 2012-12-27 20:46:54 +04:00
Evgeny Gerashchenko
dc363c8db4 Render member kind. 2012-12-27 20:46:54 +04:00
Evgeny Gerashchenko
12473576b7 Render 'override'. 2012-12-27 20:46:53 +04:00
Evgeny Gerashchenko
f596fb48fe Added 'verbose' flag to DescriptorRenderer. 2012-12-27 20:46:53 +04:00
Evgeny Gerashchenko
e95bcbcc97 Better parameters naming and order in DescriptorRendererImpl. 2012-12-27 20:46:53 +04:00
Evgeny Gerashchenko
4517113bd3 Annotated methods of DescriptorRenderer. 2012-12-27 20:46:53 +04:00
Evgeny Gerashchenko
204b9e3d2f Simplified method. 2012-12-27 20:46:53 +04:00
Evgeny Gerashchenko
08d2002277 Rendering 'where' for properties. 2012-12-27 20:46:53 +04:00
Evgeny Gerashchenko
85a18347b9 Minor. Removed 'not' from variable name. 2012-12-27 20:46:52 +04:00
Evgeny Gerashchenko
b7e4907f74 Rendering where suffix for classes. 2012-12-27 20:46:52 +04:00
Evgeny Gerashchenko
b300329e21 Rendering variance when type parameter is reified. 2012-12-27 20:46:52 +04:00
Evgeny Gerashchenko
fbaaee65e1 Fixed rendering constructor name. 2012-12-27 20:46:52 +04:00
Evgeny Gerashchenko
7beb4fe10e Rendering constructors in DescriptorRendererTest. 2012-12-27 20:46:52 +04:00
Evgeny Gerashchenko
2b83b970ed Rendering annotations in descriptor renderer. 2012-12-27 20:46:52 +04:00
Evgeny Gerashchenko
74469590b4 Simplified renderModality(). 2012-12-27 20:46:52 +04:00
Evgeny Gerashchenko
e69fe6f7d1 Extracted method rendering class name. 2012-12-27 20:46:52 +04:00
Evgeny Gerashchenko
bd16ce4634 Fixed rendering parameter default value when it is string. 2012-12-27 20:46:52 +04:00
Evgeny Gerashchenko
ad5a869a0a Rendering all class kinds in DescriptorRenderer. 2012-12-27 20:46:51 +04:00
Svetlana Isakova
22d3adc89f KT-3184 Type inference seems partially broken
#KT-3184 fixed
2012-12-27 18:45:24 +04:00
Svetlana Isakova
a6bfa1ff6c rename isFunctionType -> isFunctionOrExtensionFunctionType
added isFunctionType, isExtensionFunctionType
2012-12-27 18:40:01 +04:00
Svetlana Isakova
21f6d1630d rename local var constraintsSystem -> constraintSystem 2012-12-27 18:40:01 +04:00
Natalia.Ukhorskaya
00ef0fc0a6 JUnit4: test function annotated with 'test' annotation
#KT-3178 Fixed
2012-12-27 15:43:57 +04:00
Natalia.Ukhorskaya
e9d1171d6d Fix VerifyError for enum constructor with default arguments 2012-12-27 12:29:09 +04:00
Natalia.Ukhorskaya
beec5a843e Remove duplicate in GenerateTests 2012-12-27 12:29:07 +04:00
Natalia.Ukhorskaya
808c5abc0f Generate constructor without parameters if primary constructor has only parameters with default values
#KT-3085 Fixed
2012-12-27 12:29:06 +04:00
Natalia.Ukhorskaya
d4a8ed5ae6 Minor refactoring in tests 2012-12-27 12:29:05 +04:00
Natalia.Ukhorskaya
f0d52e63b2 Don't resolve kotlin constructors from bytecode without JetConstructorAnnotation 2012-12-27 12:29:03 +04:00
Natalia.Ukhorskaya
f4a44155d9 Extract method 2012-12-27 12:29:02 +04:00
Natalia.Ukhorskaya
538aa869b4 Constructor with default arguments for inner class
#KT-2852 Fixed
2012-12-27 12:29:01 +04:00
Nikolay Krasko
93b7e9add9 KT-1968 Double closing parentheses entered when completing unit function
#KT-1968 Fixed
2012-12-26 21:24:25 +04:00
Nikolay Krasko
9b9e338131 Publish both kotlin and kannotator plugins 2012-12-26 21:24:24 +04:00
Svetlana Isakova
70cde87052 checking subtype for invariant type with error generic argument may success 2012-12-26 18:58:57 +04:00
Svetlana Isakova
38cc3e39e4 test for obsolete KT-2741
#KT-2741 obsolete
2012-12-26 18:01:23 +04:00
Svetlana Isakova
4dc51901ba changed groupBy method signature (in standard library) 2012-12-26 17:05:08 +04:00
Svetlana Isakova
a299cec2eb KT-3174 Call resolver doesn't understand type is not-nullable after ?. safe call
#KT-3174 fixed
2012-12-26 16:43:59 +04:00
Svetlana Isakova
9b645589df KT-2838 Type inference failed on passing null as a nullable argument
#KT-2838 fixed
2012-12-26 14:38:53 +04:00
Svetlana Isakova
6208bdb6da rename (swap SUB_TYPE and SUPER_TYPE) 2012-12-26 14:18:21 +04:00
Svetlana Isakova
e6594ed5b1 KT-2883 Type inference fails due to non-Unit value returned
#KT-2883 fixed
2012-12-26 13:53:42 +04:00
Svetlana Isakova
54dffd6aad tests for obsolete tasks
#KT-3007 obsolete
 #KT-3038 obsolete
2012-12-26 13:01:48 +04:00
Svetlana Isakova
b8507c0391 refactoring: extracted methods
createValueParameterDescriptor, computeReturnType, computeUnsafeReturnType
2012-12-25 20:25:36 +04:00
Svetlana Isakova
122c2cbefb refactoring: extracted getValueParametersTypes 2012-12-25 19:46:27 +04:00
Svetlana Isakova
b0302246a0 HtmlTabledDescriptorRendererTest renamed to DiagnosticMessageTest 2012-12-25 19:12:01 +04:00
Svetlana Isakova
93fd2bf10f RENDER_COLLECTION_OF_TYPES changed 2012-12-25 19:12:01 +04:00
Svetlana Isakova
76a62d8b7d added PLACEHOLDER_FUNCTION_TYPE tests 2012-12-25 19:12:01 +04:00
Svetlana Isakova
f5e8766600 removed unused equalsOrContainsAsArgument method 2012-12-25 19:12:01 +04:00
Svetlana Isakova
4089ac68bd improved error reporting
when error type is a generic parameter
2012-12-25 19:12:01 +04:00
Svetlana Isakova
19e6b02da8 CANNOT_INFER_PARAMETER_TYPE reporting improvement 2012-12-25 19:12:01 +04:00
Svetlana Isakova
2077faa76a no ambiguity when overloading with different function type
(in incomplete resolve)
2012-12-25 19:12:01 +04:00
Svetlana Isakova
4c241b1234 refactoring: extracted method renderTypeWithoutEscape 2012-12-25 19:12:01 +04:00
Svetlana Isakova
16fa729c74 more readable rendering for special type constants 2012-12-25 19:12:01 +04:00
Svetlana Isakova
c37d7352a5 improved reporting TYPE_MISMATCH error for function literals
(introduced EXPECTED_PARAMETER_TYPE_MISMATCH, EXPECTED_RETURN_TYPE_MISMATCH, EXPECTED_PARAMETERS_NUMBER_MISMATCH
instead of reporting TYPE_MISMATCH on the whole function literal)
2012-12-25 19:12:00 +04:00
Svetlana Isakova
972b234db6 KT-3150 Kotlin m4 don't recognize function literals
#KT-3150 fixed

 added check for PLACEHOLDER_FUNCTION_TYPE to constraint system
2012-12-25 19:12:00 +04:00
Svetlana Isakova
b467638633 move constants to util
use DON_CARE instead of PLACEHOLDER_FUNCTION_PARAMETER_TYPE
2012-12-25 19:12:00 +04:00
Evgeny Gerashchenko
ce02c3e058 Removed unused code from NamespaceComparator. 2012-12-25 15:20:57 +04:00
Evgeny Gerashchenko
e3a30b10a9 Not writing fake parameters of enum constructors to generic signature. 2012-12-25 15:20:57 +04:00
Evgeny Gerashchenko
2daf9a10d0 Renamed test methods. 2012-12-20 19:26:52 +04:00
Evgeny Gerashchenko
e49459f2cd Accelerated navigation to library tests by compiling test library once. 2012-12-20 18:48:48 +04:00
Evgeny Gerashchenko
e131cc1e83 Renamed tests for navigation to library. 2012-12-20 18:48:48 +04:00
Evgeny Gerashchenko
5bdd68e502 Added navigation to source of constructor.
#KT-3168 fixed
2012-12-20 18:48:48 +04:00
Evgeny Gerashchenko
32699133cd Minor. Moved Pair class lower. 2012-12-20 18:48:48 +04:00
Evgeny Gerashchenko
9906bbef4e Navigation to decompiled primary constructor.
#KT-3168 in progress
2012-12-20 18:48:47 +04:00
Evgeny Gerashchenko
4c64ea58d5 Rendering primary constructor in decompiler.
#KT-3168 in progress
2012-12-20 18:48:47 +04:00
Evgeny Gerashchenko
9c15a04291 Pulled getUnsubstitutedPrimaryConstructor method to ClassDescriptor.
Removed ClassDescriptorFromSource. Implemented method in inheritors.
2012-12-20 18:48:47 +04:00
Evgeny Gerashchenko
5e5cd86194 Regenerated test data. 2012-12-20 18:48:47 +04:00
Evgeny Gerashchenko
1ab555a51b Checking primary flag in constructors loaded from Java. 2012-12-20 18:48:47 +04:00
Evgeny Gerashchenko
7fcbb3d563 Resolving primary flag for constructors. 2012-12-20 18:48:46 +04:00
Evgeny Gerashchenko
68d8b6b4c3 Added test with @KotlinSignature on method returning array.
#KT-2840 can't reproduce
2012-12-20 18:48:46 +04:00
Svetlana Isakova
4775329fb7 refactoring in recordInitializedVariables
(iteration over used variables can be replaced with iteration over declared variables)
2012-12-18 19:47:55 +04:00
Svetlana Isakova
a5cf54d370 do not miss repeated 'uninitialized' error for properties 2012-12-18 19:47:55 +04:00
Svetlana Isakova
a85519c3db isBackingFieldReference moved to JetPsiUtil 2012-12-18 19:47:55 +04:00
Svetlana Isakova
67d0d8b1a9 fix: val can be reassigned through backing field inside its own getter 2012-12-18 19:47:54 +04:00
Svetlana Isakova
58de1cabbc update tests according to package properties check 2012-12-18 19:47:54 +04:00
Svetlana Isakova
11bc01795f check package declaration in a file
to have the right properties initialization order
not to report errors if isDeclaredLocally (only recordInitializedVariables)
2012-12-18 19:47:54 +04:00
Svetlana Isakova
57518c1200 removed cached data for each instruction 2012-12-18 19:47:53 +04:00
Svetlana Isakova
207e161bfc made pseudocode be built on JetElement
instead of JetDeclaration
 to be able to be built on JetFile
2012-12-18 19:47:53 +04:00
Svetlana Isakova
cb87ec8bdd added 'getFiles' method to BodiesResolveContext interface 2012-12-18 19:47:53 +04:00
Svetlana Isakova
b6e2a0fb39 made JetFile implements JetElement 2012-12-18 19:47:53 +04:00
Svetlana Isakova
62f35e5e87 added LookInsideStrategy enum 2012-12-18 19:47:53 +04:00
Svetlana Isakova
0626225ea5 removed always true 'lookInside' parameter 2012-12-18 19:47:52 +04:00
Svetlana Isakova
f697098fb4 KT-2960 Perform control flow checks for package property initializers
#KT-2960 fixed
2012-12-18 19:47:52 +04:00
Svetlana Isakova
51c38d4cd3 do not store references to all copies (if it's a copy itself) 2012-12-18 19:47:52 +04:00
Svetlana Isakova
428a2d8538 rename value -> generateInstructions 2012-12-18 16:00:27 +04:00
Svetlana Isakova
dc3e324987 removed cached reversedInstructions and deadInstructions 2012-12-18 16:00:27 +04:00
Svetlana Isakova
6e8ac23689 removed allow dead collecting 2012-12-18 16:00:27 +04:00
Svetlana Isakova
8584a76750 do not need 'allow dead instructions'
after copies are collected

(instruction is dead only if all copies are dead)
2012-12-18 16:00:27 +04:00
Svetlana Isakova
d778952512 fixed bug with incorrect copy of pseudocode part
(was noticeable in doTestCopy4 example)
labels after part should be repeated as well
2012-12-18 16:00:27 +04:00
Svetlana Isakova
e15340bf3c use upper-case L in label name instead of lower-case 2012-12-18 16:00:27 +04:00
Svetlana Isakova
e91805a593 TraversalOrder enum instead of boolean flag 2012-12-18 16:00:27 +04:00
Svetlana Isakova
7a03c85549 refactoring: merge traverseNextInstructions & traverseInstructionsInReverseOrder
into one method (traverseFollowingInstructions)
2012-12-18 16:00:27 +04:00
Ioannis Tsakpinis
f5d6e8d751 KT-3141 Use iteration instead of recursion in traverseInstructionsInReverseOrder and traverseNextInstructions. 2012-12-18 16:00:26 +04:00
Svetlana Isakova
d7a60f5fed added tests for KT-2369, KT-2585 and KT-2972
KT-2369 Variable is not marked as uninitialized in 'finally' section
 #KT-2369 fixed
KT-2585 Code in try-finally is incorrectly marked as unreachable
 #KT-2585 fixed
KT-2972 Wrong "unused value" warning when finally is present
 #KT-2972 fixed
2012-12-18 16:00:26 +04:00
Svetlana Isakova
97058e628e added names for loop labels
updated control flow test data
2012-12-18 16:00:26 +04:00
Svetlana Isakova
9904f21ceb added ThrowExceptionInstruction
(to store throw expression in it)
2012-12-18 16:00:26 +04:00
Svetlana Isakova
e72cdbc1f7 added tests for 'copy' finally pseudocode part 2012-12-18 16:00:26 +04:00
Svetlana Isakova
bd31f36836 added repeat pseudocode method
repeat from startLabel to finishLabel
(logic is inside PseudocodeImpl)
2012-12-18 16:00:26 +04:00
Svetlana Isakova
93327a3e31 check uninitialized vars inside local declarations
added parameter 'includeInsideLocalDeclarations' to getDeclaredVariables
2012-12-18 16:00:26 +04:00
Svetlana Isakova
d45a4f9d27 refactoring: traverseForward and traverseBackward
instead of boolean parameter 'directOrder'
2012-12-18 16:00:26 +04:00
Svetlana Isakova
f0dea9aee4 updated test data for try-finally 2012-12-18 16:00:26 +04:00
Svetlana Isakova
ee395bee1f Reporting the same diagnostic only once for copied instructions
(depends on whether it should be reported for all or only for one of the copies)

VariableContext introduced
2012-12-18 16:00:26 +04:00
Svetlana Isakova
bb2e1c04ec updated allow dead instructions handling
Added labels collecting:
Allow dead instruction block can have several starters and
one stopper that knows all corresponding starters by labels
2012-12-18 16:00:26 +04:00
Svetlana Isakova
28f1d288cf Added optional custom names to labels in pseudocode 2012-12-18 16:00:26 +04:00
Svetlana Isakova
3ac45ecca7 store references to instruction copies
inside instruction
2012-12-18 16:00:26 +04:00
Svetlana Isakova
d92e989c6e add assert to ControlFlowTest 2012-12-18 16:00:25 +04:00
Svetlana Isakova
8a123f8722 added copy() method to Instruction 2012-12-18 16:00:25 +04:00
Svetlana Isakova
8141229744 added edge from try start to error through finally block
KT-2845 Wrong cf-analysys for variable initialization in try..finally
 #KT-2845 fixed
todo: some errors now are reported for several times (each time when analyzing finally block)
2012-12-18 16:00:25 +04:00
Svetlana Isakova
b01dc094db parameter removed from 'jumpToError' method 2012-12-18 16:00:25 +04:00
Natalia.Ukhorskaya
fcc3a4d0ab Android tests: finish all processes 2012-12-17 17:48:14 +04:00
Natalia.Ukhorskaya
1824879dd0 Add JpsTests for inheritance (J-K-J, K-J-K) 2012-12-17 17:48:06 +04:00
Evgeny Gerashchenko
9d0a4155bb Got rid of unnecessary 'div' elements in table. 2012-12-17 16:36:01 +04:00
Evgeny Gerashchenko
e9639ead91 Minor. Added static modifiers, removed unused method. 2012-12-17 16:36:01 +04:00
Evgeny Gerashchenko
520b16e065 Introduce default ValueParametersHandler. 2012-12-17 16:36:01 +04:00
Evgeny Gerashchenko
85b50aefda Simplified code in DescriptorRendererImpl. 2012-12-17 16:36:01 +04:00
Evgeny Gerashchenko
85337c3546 Arranged methods in DescriptorRendererImpl. 2012-12-17 16:36:00 +04:00
Evgeny Gerashchenko
9b05e0a540 Extracted all meaningful methods from visitor.
Inlined visitor field.
2012-12-17 16:36:00 +04:00
Evgeny Gerashchenko
2f545688eb Organized methods in DescriptorRendererImpl. 2012-12-17 16:36:00 +04:00
Evgeny Gerashchenko
d27eb680e0 Inlined hasDefaultValue(). 2012-12-17 16:36:00 +04:00
Evgeny Gerashchenko
ac24f366e2 Subclassed RenderDeclarationDescriptorVisitor from adapter
Removed redundant overrides.
2012-12-17 16:35:59 +04:00
Evgeny Gerashchenko
e04b946bf9 Got rid of subVisitor. 2012-12-17 16:35:59 +04:00
Evgeny Gerashchenko
79cf8e60b8 Introduced DescriptorRendererBuilder.
Hid constructor of DescriptorRendererImpl.
2012-12-17 16:35:59 +04:00
Evgeny Gerashchenko
1cfc5f366e Extracted DescriptorRenderer interface. 2012-12-17 16:35:59 +04:00
Evgeny Gerashchenko
b73ba148b6 Got rid of HTML subclass of DescriptorRendererImpl. 2012-12-17 16:35:58 +04:00
Evgeny Gerashchenko
7047267937 Got rid of all subclasses of DescriptorRenderer but HTML. 2012-12-17 16:35:58 +04:00
Evgeny Gerashchenko
204ba8b2f4 Typo. 2012-12-17 16:35:58 +04:00
Evgeny Gerashchenko
f5b35e39ac Removed all but default constructors of DescriptorRendererImpl. 2012-12-17 16:35:58 +04:00
Evgeny Gerashchenko
9947bff2e1 Simplified HtmlTabledDescriptorRenderer.
Got rid of suspicious subclassing with overriding protected methods: passing ValueParametersHandler instead.
2012-12-17 16:35:57 +04:00
Evgeny Gerashchenko
0f38e3f1fc Added test to settle format of HtmlTabledDescriptorRenderer. 2012-12-17 16:35:57 +04:00
Evgeny Gerashchenko
542201f4ed Added VM option to avoid problem with duplicate JDK entries. 2012-12-17 16:35:57 +04:00
Evgeny Gerashchenko
f6e9b0e234 Removed renderTypeWithShortNames from API of DescriptorRenderer. 2012-12-17 16:35:57 +04:00
Evgeny Gerashchenko
cd2e619364 Removed renderMessage from API of DescriptorRenderer. 2012-12-17 16:35:57 +04:00
Evgeny Gerashchenko
fc14d98869 Removed code for rendering tuple types. 2012-12-17 16:35:56 +04:00
Evgeny Gerashchenko
b09050bb18 Removed unused methods from DescriptorRendererImpl. 2012-12-17 16:35:56 +04:00
Evgeny Gerashchenko
8a946c6ef9 Renamed DescriptorRenderer and moved to 'renderer' package.
Moved DescriptorRendererTest to 'renderer' package, as well.
2012-12-17 16:35:56 +04:00
Evgeny Gerashchenko
b07d6d56a0 Escaping keywords used as identifiers in DescriptorRenderer.
#KT-2810 fixed
2012-12-17 16:35:55 +04:00
Evgeny Gerashchenko
f55e3ce681 Extracted method. 2012-12-17 16:35:55 +04:00
Leonid Shalupov
de1c416859 website: better resources discovery 2012-12-14 20:04:46 +04:00
Leonid Shalupov
f311f88b8d website: fix paths 2012-12-14 19:50:56 +04:00
Leonid Shalupov
b69e36331a pack website with assembly plugin 2012-12-14 19:30:46 +04:00
Leonid Shalupov
fb12605185 do website generation in pre-package step 2012-12-14 19:24:47 +04:00
Leonid Shalupov
9f0999c61e update_dependencies.xml: cache downloaded artifacts. do not use search.maven.org! 2012-12-14 18:45:52 +04:00
Leonid Shalupov
6778dda9db maven: report Kotlin Compiler version as INFO 2012-12-14 17:36:02 +04:00
Andrey Breslav
0ec4131231 KDoc compilation fixed 2012-12-14 15:28:22 +04:00
Andrey Breslav
947ab99f53 Tests fixed after default nullability for type arguments changed to NotNull 2012-12-14 15:28:22 +04:00
Andrey Breslav
d4d713050a Fix for varargs vs arrays of boxed types 2012-12-14 15:28:22 +04:00
Andrey Breslav
becd68b98d Nullability propagation with NotNull as default for type arguments 2012-12-14 15:28:22 +04:00
Andrey Breslav
3b39257f13 TypeUsage moved out of JavaTypeTransformer 2012-12-14 15:28:22 +04:00
Andrey Breslav
f925bfccd0 Changing default nullability for type arguments to NotNull 2012-12-14 15:28:21 +04:00
Andrey Breslav
f09054d1a0 Java compiler error reporting fixed 2012-12-14 15:28:21 +04:00
Andrey Breslav
4df4a91615 Report environment errors through messageCollector when available 2012-12-14 15:28:21 +04:00
Nikolay Krasko
689cff6196 KT-3157 Java void method are inserted with ; after completion
#KT-3157 Fixed
2012-12-13 21:14:53 +04:00
Nikolay Krasko
1f12658ce7 Check errors and are all actions are expected in quick fixes tests 2012-12-13 21:14:52 +04:00
Nikolay Krasko
07df3dfe85 Refactoring: extract common code to method. 2012-12-13 21:14:51 +04:00
Nikolay Krasko
1978d3522d Add ability to filter import usages 2012-12-13 21:14:51 +04:00
Nikolay Krasko
31ea793328 Update icons 2012-12-13 21:14:50 +04:00
Andrey Breslav
15328ed9c5 Make exceptions from compiler reported as is, without any wrappers visible in EA 2012-12-13 21:10:00 +04:00
Andrey Breslav
bc2a46a3da A workaround for exception caused by a jar with the same content occurring twice on the classpath 2012-12-13 18:32:24 +04:00
Evgeny Gerashchenko
820152b97c Reverted test file. 2012-12-13 17:41:02 +04:00
Evgeny Gerashchenko
b8eb0c84ff Added 'synthetic' flag for bridge method.
#KT-3155 fixed
2012-12-13 14:36:41 +04:00
Andrey Breslav
e324d3914f KT-3120 The compiler should not depend on the file directory of the libs
#KT-3120 In Progress
2012-12-12 17:37:32 +04:00
Andrey Breslav
968a57fa7c KT-3119 Invalid Kotlin type for Class.getResource
#KT-3119 Fixed
2012-12-11 13:58:56 +04:00
Evgeny Gerashchenko
34f9ae77ba Getting super methods correctly for inheritors of Collection, etc. 2012-12-10 21:43:42 +04:00
Andrey Breslav
a93596ca5e Fixing errors in Maven build 2012-12-10 21:39:04 +04:00
Evgeny Gerashchenko
fc0750b504 Renamed JdkAnnotationsSanityTest -> JdkAnnotationsValidityTest. 2012-12-10 19:13:18 +04:00
Evgeny Gerashchenko
77876f9a44 Optimized memory usage in test checking for errors in JDK annotations. 2012-12-10 19:13:18 +04:00
Evgeny Gerashchenko
feb484cccb Fixed JdkAnnotationsSanityTest. 2012-12-10 19:13:18 +04:00
Evgeny Gerashchenko
1dc928b5db Disabled error checking for if super/sub method has raw types in signature. 2012-12-10 19:13:17 +04:00
Evgeny Gerashchenko
c8aa3d9290 Removed TODO 2012-12-10 19:13:17 +04:00
Evgeny Gerashchenko
654a995a9d Fixed compilation of kdoc. 2012-12-10 19:13:17 +04:00
Andrey Breslav
32073f0987 Fixing compilation in stdlib tests 2012-12-10 17:00:05 +04:00
Andrey Breslav
a9809c2c6b A problematic package removed 2012-12-10 16:45:04 +04:00
Andrey Breslav
6141467499 Fixing tests after annotations changed 2012-12-10 16:44:41 +04:00
Alexey Sedunov
5ad7be38bc Inferred JDK annotations 2012-12-10 15:33:26 +04:00
Andrey Breslav
3e7541605e Publish kotlin-jdk-annotations.jar in Maven 2012-12-10 13:39:58 +04:00
Andrey Breslav
54ff3f73fb Clarifying details added to the error message 2012-12-07 22:06:47 +04:00
Andrey Breslav
7995013abb main() added to quickly compile runtime for tests 2012-12-07 21:54:11 +04:00
Andrey Breslav
011cdba158 Migrate to IDEA 123.72 Leda Release 2012-12-07 21:54:11 +04:00
Andrey Breslav
ebabb3b8af Error message fixed 2012-12-07 21:54:11 +04:00
Nikolay Krasko
63248ed5b6 Download idea-12 for verifying in publish 2012-12-07 15:23:03 +04:00
Nikolay Krasko
c224b6441d KT-3133 Editor suggest to specify the package when it already has specified
Do not suggest imports in imports and in qualified names
 #KT-3133 Fixed
2012-12-07 14:50:22 +04:00
Evgeny Gerashchenko
1092164684 Generating Java to Kotlin method map along with injectors. 2012-12-07 14:41:59 +04:00
Evgeny Gerashchenko
d349bca42c All methods of Printer return this (for chaining). 2012-12-07 14:41:58 +04:00
Evgeny Gerashchenko
6c6abab033 Supported propagation for Java subclass of Kotlin class. 2012-12-07 14:41:58 +04:00
Evgeny Gerashchenko
0bbc33755b Migrated CompileJavaAgainstKotlinTest to generated test framework. 2012-12-07 14:41:57 +04:00
Evgeny Gerashchenko
95c9c4c0c4 Fixed direction of substitution when checking bounds of type parameters. 2012-12-07 14:41:57 +04:00
Evgeny Gerashchenko
d7624aa7b6 Enabled assert. 2012-12-07 14:41:56 +04:00
Evgeny Gerashchenko
5e86cbe004 Checking for return type in kotlin signature if have super methods. 2012-12-07 14:41:56 +04:00
Evgeny Gerashchenko
6975691e7a Supported cases with two superclasses when they have different variances. 2012-12-07 14:41:55 +04:00
Evgeny Gerashchenko
482d7813ee Updated testData after updating mockJdk. 2012-12-07 14:07:00 +04:00
Evgeny Gerashchenko
db57ca2bf7 Minor. Useful toString in PsiMemberWrapper. 2012-12-07 14:07:00 +04:00
Andrey Breslav
74212bd2a4 Generate mockJDK from real JDK 2012-12-07 14:06:59 +04:00
Evgeny Gerashchenko
83d5b1e6a0 Supported propagation for subclass of j.u.Collection and similar classes. 2012-12-07 14:06:59 +04:00
Evgeny Gerashchenko
42fb53f488 Made some methods of JavaToKotlinClassMapBuilder protected. 2012-12-07 14:02:54 +04:00
Evgeny Gerashchenko
01b3d75374 Removing redundant projections when loading from Java. 2012-12-07 14:02:54 +04:00
Evgeny Gerashchenko
46a485da01 Supported star projection in alternative signatures. 2012-12-07 14:02:54 +04:00
Evgeny Gerashchenko
91825a404c Added test for loading Foo<?> type from Java. 2012-12-07 14:02:54 +04:00
Evgeny Gerashchenko
3d8b86040d Better output in failed test. 2012-12-07 14:02:54 +04:00
Evgeny Gerashchenko
a4a7e5818c Merged similar methods into getVarargParameterType. 2012-12-07 14:02:54 +04:00
Natalia.Ukhorskaya
a739964c74 Back-end: write correct visibility flags for private inner classes 2012-12-06 17:25:13 +04:00
Natalia.Ukhorskaya
17fa105116 Generate INVOKESPECIAL instruction for private method with default argument 2012-12-06 15:20:43 +04:00
Leonid Shalupov
f9331407a5 reverting wrong pull request 148; to be discussed 2012-12-05 21:53:34 +04:00
Andrey Breslav
2948875cad QuickFix: adding <*> for 'raw' type inside javaClass() call 2012-12-05 21:15:30 +04:00
Andrey Breslav
f0ce7ac33a Migrate to IDEA 123.67, Leda release 2012-12-05 20:21:31 +04:00
Leonid Shalupov
c5c5c7f8bb Merge pull request #148 from marschall/dont-run-on-poms
Skip Plugin Exceution for POM Projects
2012-12-05 07:21:06 -08:00
Philippe Marschall
3a9ed81915 Skip Plugin Exceution for POM Projects
It's quite common to have a multi module project with a parent project
that has POM packaging. It would be quite convenient if the
kotlin-maven-plugin could be configured there instead of in each module.
Currently this is not possible because the plugin tries to execute on
POM projects with fails.

 - skip execution on POM projects
2012-12-05 15:17:46 +01:00
Andrey Breslav
932d29e2ef A case for extending a raw Comparator 2012-12-04 22:58:20 +04:00
Evgeny Gerashchenko
aef96e93cf Using signature propagation only if function is owned by class. 2012-12-04 17:09:29 +04:00
Andrey Breslav
f220024308 Attach asm sources to idea-full 2012-12-04 14:36:12 +04:00
Andrey Breslav
3549d50225 Migrate to IDEA 123.63 2012-12-04 14:20:49 +04:00
Andrey Breslav
d9ddaf298b Download asm jars from Maven Central 2012-12-04 13:26:14 +04:00
Andrey Breslav
b3265024ab list(), set() and map() -> listOf(), setOf() and mapOf() 2012-12-03 21:39:56 +04:00
Alexander Udalov
09161d41c9 Regenerate tests 2012-12-03 18:22:15 +04:00
Andrey Breslav
5f766aa33a list(), set() and map() introduced 2012-12-03 17:23:21 +04:00
Andrey Breslav
4084416d56 Remove 'inline' 2012-12-03 17:23:21 +04:00
Andrey Breslav
6ed2d1560c Move arrayList() to the top 2012-12-03 17:23:21 +04:00
Andrey Breslav
6df5e8b73a Deprecate confusing arrayList(), hashSet() and such. Introduce arrayListOf(...) ans such 2012-12-03 17:23:20 +04:00
Nikolay Krasko
f28a4c5464 Proof test for recursion in lazy resolve when classes and properties are trying to be imported into file scope 2012-12-03 15:17:25 +04:00
Nikolay Krasko
5368e8cef3 Process imports for functioncs and properties in creating scope for file
during lazy resolve

Fix for "KT-3096 No completion in function literal" and "KT-3102 No
completion/auto-import for an extension method"

 #KT-3102 Fixed
 #KT-3096 Fixed
2012-12-03 15:17:24 +04:00
Andrey Breslav
c9921a3699 Update for IDEA 123.45 2012-12-03 14:06:46 +04:00
Andrey Breslav
08a150b09e Don't run the builder if there's no dirty files 2012-12-03 14:06:46 +04:00
Natalia.Ukhorskaya
ef52ce6b9b J2KTranslator: remove findRtJar method. Use PathUtil instead 2012-11-29 18:21:14 +04:00
Evgeny Gerashchenko
00873b6e8c Reverted loading arrays from java with 'out' projection kind as return value.
#KT-3065
2012-11-29 17:02:43 +04:00
Alexander Udalov
fd0251729b Optimize primitive comparison operators codegen
They're no longer generated via intrinsics
2012-11-28 20:58:59 +04:00
Alexander Udalov
fad9169005 Remove suspicious code from intrinsics 2012-11-28 20:17:01 +04:00
Nikolay Krasko
2dafbdc45a Ask for external annotation only while looking for nullability or kotlin signature annotation 2012-11-28 19:21:33 +04:00
Alexander Udalov
c9bdfd2f07 Generate compareTo() properly
Take into account:
1) resolved call to compareTo (instead of always calling Comparable's method)
2) types of both caller and callee, when primitive, to avoid wrong casting
(instead of always using caller's type)

 #KT-3078 Fixed
2012-11-28 17:45:38 +04:00
Alexander Udalov
0c5960922a Refactor StackValue.coerce() 2012-11-28 17:41:38 +04:00
Alexander Udalov
9eecf22e15 Booleans are no longer Comparable 2012-11-28 17:41:36 +04:00
Alexander Udalov
b23601eefe EA-40964
Don't access elements of an empty array
2012-11-28 17:41:35 +04:00
Andrey Breslav
9dd167a760 Duplicating method removed from stdlib 2012-11-28 16:05:48 +04:00
Evgeny Gerashchenko
d487f754cd Prevented copyrights from appearing in testData. 2012-11-28 15:27:57 +04:00
Evgeny Gerashchenko
a773b8426e Removed copyrights from Java test data. 2012-11-28 15:23:55 +04:00
Evgeny Gerashchenko
6aef746d30 Renamed data -> testData in integration-tests. 2012-11-28 15:20:56 +04:00
Evgeny Gerashchenko
b9b87d894a Asserting parameters in overridability assert, as well. 2012-11-28 15:08:58 +04:00
Evgeny Gerashchenko
f53f3e17c9 Fixed problems in jdk-annotations. 2012-11-28 15:08:57 +04:00
Evgeny Gerashchenko
88bf3d9298 Processing vararg flag of parameter for primitives and wrappers.
#KT-2776 fixed
2012-11-28 15:08:57 +04:00
Evgeny Gerashchenko
6375ea89a0 Supported propagation of upper bounds of method type parameters.
#KT-2776 in progress
2012-11-28 15:08:57 +04:00
Evgeny Gerashchenko
efc67f3d89 Rewritten CheckLoadVariablesTableTest to test generation framework. 2012-11-28 15:08:57 +04:00
Evgeny Gerashchenko
4252b3bca7 Invoke reportError() instead of passing function all the time
Using superFunctions field instead of passing it as parameter.
2012-11-28 15:08:57 +04:00
Evgeny Gerashchenko
e761d69e9c Changed API of SignaturesPropagationData. 2012-11-28 15:08:57 +04:00
Evgeny Gerashchenko
914db59ea0 Renamed SignaturesPropagation to SignaturesPropagationData. 2012-11-28 15:08:57 +04:00
Evgeny Gerashchenko
caad1c20a2 Substituting type parameters when checking alt signature. 2012-11-28 15:08:57 +04:00
Evgeny Gerashchenko
f4c1722a46 Extracted method creating copy of type parameters (to reuse in SignaturesPropagationData). 2012-11-28 15:08:56 +04:00
Evgeny Gerashchenko
8d7de5d063 Supported checking for changing signature in submethods.
#KT-2776 in progress
2012-11-28 15:08:56 +04:00
Evgeny Gerashchenko
dd671313c5 Supported propagation of vararg mark.
#KT-2776 in progress
2012-11-28 15:08:56 +04:00
Evgeny Gerashchenko
4df311366d Added test for propagation of projection kind.
#KT-2776 in progress
2012-11-28 15:08:56 +04:00
Evgeny Gerashchenko
795b3bfbe0 Supported propagation of mutability in parameter position.
#KT-2776 in progress
2012-11-28 15:08:56 +04:00
Evgeny Gerashchenko
a937d6be91 First converting classifier, and then process arguments. 2012-11-28 15:08:56 +04:00
Evgeny Gerashchenko
4da03f75f9 Supported simplest case of signatures propagation in value parameter position.
#KT-2776 in progress
2012-11-28 15:08:56 +04:00
Evgeny Gerashchenko
6530d48785 Passing super functions instead of method and trace to modifyReturnTypeAccordingToSuperMethods. 2012-11-28 15:08:55 +04:00
Evgeny Gerashchenko
5b6828a7ce Fixed syntax error in @KotlinSignature. 2012-11-28 15:08:55 +04:00
Andrey Breslav
304926005f Proper errors for cases like 'is Map' supported in 'when' 2012-11-27 21:15:37 +04:00
Nikolay Krasko
85f7b4069f Clean up test data after end of the test 2012-11-27 17:32:49 +04:00
Natalia.Ukhorskaya
673eba662d System property kotlin.jps.test may be null 2012-11-27 16:48:36 +04:00
Andrey Breslav
6f4afd675f A quick fix for 'Raw type in is-expression' 2012-11-27 16:47:39 +04:00
Andrey Breslav
af682d61f0 Typo fixed 2012-11-27 16:47:38 +04:00
Andrey Breslav
dff5f382ab Special diagnostics when no type arguments passed on teh right-hand side of 'is' expression
Example:

if (a is Map) // ERROR: Say 'Map<*, *>' if you don't want to pass type arguments
2012-11-27 16:47:38 +04:00
Natalia.Ukhorskaya
1378f836f5 Rename test projects for jps plugin. Do not lowercase first letter in project name 2012-11-27 15:34:36 +04:00
Andrey Breslav
f17a7df6d9 Fix <get> for old Ant 2012-11-27 15:24:00 +04:00
Alexander Udalov
b7a4349827 Remove unused scripts 2012-11-27 15:00:19 +04:00
Natalia.Ukhorskaya
74ca357502 Add tests for jps plugin 2012-11-27 14:54:18 +04:00
Natalia.Ukhorskaya
c21f52127c Change wildcard resource pattern 2012-11-27 14:49:11 +04:00
Natalia.Ukhorskaya
de45f2e8f7 Add jps test for Android 2012-11-27 14:49:10 +04:00
Alexander Udalov
8a33e1d6b2 Fix kotlinc on Cygwin
Do not convert KOTLIN_HOME back to unix format, since it's passed to Win
version of Java, which doesn't understand /cygdrive/.. paths

 #KT-3049 Fixed
2012-11-27 13:33:57 +04:00
Alexander Udalov
5e40423de3 Convert CRLF to LF in kotlinc on Windows
Cygwin wouldn't start the script with a CR in it.
.bat files are kept as is, since they are purely Win-specific
2012-11-26 22:28:10 +04:00
Alexander Udalov
3cd41b2503 Update to jline 2.9
Fixes console problems after :quit from REPL on the latest Ubuntu
2012-11-26 21:48:15 +04:00
Alexander Udalov
e97f53ce8d Don't output long comment every time in kotlinc on Windows
#KT-3048 Fixed
2012-11-26 19:37:05 +04:00
Alexander Udalov
32f30c89d0 Preserve spaces in kotlin home 2012-11-26 19:35:21 +04:00
Alexander Udalov
07ed31f90e Set executable permissions to kotlinc 2012-11-26 19:33:47 +04:00
Andrey Breslav
c07306a7f2 Full paths for old Ant 2012-11-26 18:12:41 +04:00
Alexander Udalov
8e740a3ee4 Fix .put() for some stack values
#KT-3087 Fixed
2012-11-26 16:06:47 +04:00
Andrey Breslav
bc7f2fd09b KT-2818 Show Parameters should show short type names instead of long
#KT-2818 Fixed
2012-11-26 15:25:19 +04:00
Nikolay Krasko
0207693cec Tune jline library pack
- Don't filter out properties files
- Don't filter out dlls
- Keep everything in org.fusesource.* - after processing with proguard there's a native exception on Windows 7 64bit
- Don't warn about missing dependencies from org.fusesource as jline documentation proclaims absence of any dependencies
- Remove jansi from dependencies

  #KT-3047 Fixed
2012-11-26 14:34:06 +04:00
Andrey Breslav
21b9835dc5 Proper kotlinHome in compiler messages 2012-11-24 21:39:35 +04:00
Andrey Breslav
c2f2356855 Clarifying rename 2012-11-24 15:59:17 +04:00
Andrey Breslav
e064a50728 Error renamed 2012-11-24 15:59:17 +04:00
Andrey Breslav
1f2e3d09af Remove duplicating method 2012-11-24 15:59:17 +04:00
Andrey Breslav
5ac10ee8e5 Mutability fixed in KDocConfig: the maps are mutated from Java 2012-11-24 15:59:16 +04:00
Andrey Breslav
c849a0c4e3 Redundant/conflicting projections 2012-11-24 15:59:16 +04:00
Andrey Breslav
5b93ae2d08 Variance in functions/properties removed from stdlib 2012-11-24 15:59:16 +04:00
Andrey Breslav
12fd07af08 Report an error when variance is specified for a function or property type parameter 2012-11-24 15:59:16 +04:00
Andrey Breslav
d8c9d19bd7 rename: positionModifier -> modifierPosition 2012-11-24 15:59:15 +04:00
Andrey Breslav
889ea107f6 Reflect Kotlin's declaration-site variance in Java signatures 2012-11-24 15:59:15 +04:00
Andrey Breslav
da2f886bee Redundant projections removed from code 2012-11-24 15:59:15 +04:00
Andrey Breslav
d3f9e61db7 Redundant projections removed from test data 2012-11-24 15:59:15 +04:00
Andrey Breslav
649259e715 Type substitutor logic regarding projection composition fixed 2012-11-24 15:59:15 +04:00
Andrey Breslav
7d8bde2ac6 Test data moved out of JetTypeCheckerTest 2012-11-24 14:08:43 +04:00
Andrey Breslav
94552d5524 Proper message reporting 2012-11-24 14:08:43 +04:00
Alexander Udalov
6c2b402625 Remove dangerous and unused method 2012-11-23 17:37:50 +04:00
Pavel V. Talanov
59e74e79c2 Test for KT-2619
Remove outdated check in WhenChecker

# KT-2619 fixed
2012-11-23 17:18:09 +04:00
Pavel V. Talanov
997e26d11e Test for KT-2890
# KT-2890 can't reproduce
2012-11-23 17:17:42 +04:00
Pavel V. Talanov
5fa069bebd Test for KT-2152
# KT-2152 can't reproduce
2012-11-23 17:17:03 +04:00
Andrey Breslav
3b11d5787c Migrating to IDEA 123.4 2012-11-23 12:38:54 +04:00
Alexander Udalov
9d3907ff98 When-statements & correct line numbers 2012-11-22 22:32:21 +04:00
Alexander Udalov
aa898725fc Mark line numbers on compile-time constants 2012-11-22 22:32:17 +04:00
Alexander Udalov
0f496eac21 Try-catch-finally statements & correct line numbers 2012-11-22 22:32:14 +04:00
Alexander Udalov
ca587513e3 Fix for finally before empty return 2012-11-22 22:32:10 +04:00
Alexander Udalov
99a908e8fe If-then-else statements & correct line numbers
#KT-3036 Fixed
2012-11-22 22:31:58 +04:00
Alexander Udalov
8564c20baa Fix condition generation of empty if 2012-11-22 22:31:53 +04:00
Alexander Udalov
af601b5a90 Single-branch if-statements
Single-branch if-expressions are now compiled to statements if the result is
not used

 #KT-3036 In Progress
2012-11-22 22:31:40 +04:00
Alexander Udalov
9c7724b7f9 Introduce CodegenStatementVisitor
Which will be used for generating statements (as opposed to generating
expressions always, as it is now)

Add StatementGenTest, which will check if we actually generate statements and
not expressions of type Unit, popping them off the stack later
2012-11-22 22:07:01 +04:00
Alexander Udalov
cb08d27970 Refactor LineNumberTest
Allow passing custom expected & actual line numbers instead of those before
calls to test.lineNumber()
2012-11-22 18:54:22 +04:00
Nikolay Krasko
aeb7a0f1a7 Fix signature - return List<T> instead of List<in T> 2012-11-22 18:06:00 +04:00
Andrey Breslav
4c55c484ed Sources for JPS test framework 2012-11-22 17:44:23 +04:00
Pavel V. Talanov
a7536e1ae9 Fix ClassCastException introduced in 8d501bd7f4 2012-11-21 21:05:30 +04:00
Andrey Breslav
10cedf8576 Proper dependencies for the JPS plugin 2012-11-21 20:51:50 +04:00
Natalia.Ukhorskaya
e4bb109060 Path separator fixed 2012-11-21 20:12:36 +04:00
Pavel V. Talanov
c726c95921 Hack to make tests pass
Inner classes of interfaces and inner interfaces are put in NonStaticMemberScope
2012-11-21 19:49:52 +04:00
Pavel V. Talanov
7f617de8ac Rework test for KT1119 2012-11-21 19:49:51 +04:00
Pavel V. Talanov
6017604e38 Refactor: slightly improve code in WhenChecker 2012-11-21 19:49:50 +04:00
Pavel V. Talanov
8d501bd7f4 Fix WhenChecker after enum property type change 2012-11-21 19:49:50 +04:00
Pavel V. Talanov
c39a4dc57a Change type of enum entry property
Now such properties have types corresponding to enum class not it's own enum entry classes
2012-11-21 19:49:49 +04:00
Pavel V. Talanov
c42380dc0b Make enum entry classes have private visibility and properties have public vibility
Tests for backend are broken
2012-11-21 19:49:48 +04:00
Pavel V. Talanov
9c7cb64a30 Minor refactoring: static import ModifiersChecker static utilities 2012-11-21 19:49:47 +04:00
Pavel V. Talanov
662acb58b1 Remove JavaPropertyResolver#getRealOwner() which is in fact redundant
Injectors regenerated
2012-11-21 19:49:46 +04:00
Pavel V. Talanov
3ae89dbb1d Test for resolving static members of java enum
Add clarifying note
2012-11-21 19:49:45 +04:00
Pavel V. Talanov
b5b6f58b6b Test for resolving inner classes 2012-11-21 19:49:44 +04:00
Pavel V. Talanov
737b246b01 Fix resolve of inner and nested classes in JavaDescriptorResolver 2012-11-21 19:49:44 +04:00
Pavel V. Talanov
96b48aedfc Very simple test for resolving static members of java classes 2012-11-21 19:49:43 +04:00
Pavel V. Talanov
86cc1db609 Refactor: extract superclass from AnnotationJavaDescriptorResolverTest 2012-11-21 19:49:42 +04:00
Pavel V. Talanov
613a298e82 Use the same code to resolve classifiers for JavaClassStaticMembersScope as for non static members 2012-11-21 19:46:18 +04:00
Pavel V. Talanov
0c0d4d28c8 Simplify implementation of JavaClassNonStaticMembersScope#getClassifier()
Also cache inner classes and classifiers
2012-11-21 19:46:17 +04:00
Pavel V. Talanov
4b64e312fe Refactor: move ClassDescriptorFromJvmBytecode#getConstructors() logic to JavaClassNonStaticMembersScope 2012-11-21 19:46:16 +04:00
Pavel V. Talanov
8ac63a53ad Minor change to make code green 2012-11-21 19:46:15 +04:00
Pavel V. Talanov
05cf6a407a Refactor: split implementation of JavaBaseScope#computeAllDescriptors() and make computeInnerClasses() abstract, provide implementation in subclasses 2012-11-21 19:46:14 +04:00
Pavel V. Talanov
5bbe9af4bb Minor refactor 2012-11-21 19:46:13 +04:00
Pavel V. Talanov
b6aa9b2bce Make JavaClassStaticMembersScope extend JavaClassMembersScope instead of JavaPackageScope, use JavaBaseScope instead of JavaPackageScope in JavaNamespaceResolver 2012-11-21 19:46:13 +04:00
Pavel V. Talanov
1ced967bc9 Refactor: pull getPsiElement() method Up 2012-11-21 19:46:12 +04:00
Pavel V. Talanov
32b7f64792 Refactor: extract JavaBaseScope getResolver() method 2012-11-21 19:46:11 +04:00
Pavel V. Talanov
aad4e306b2 Make JavaBaseScope#computeFunctionDescriptor() abstract and provide implementation in subclasses 2012-11-21 19:46:10 +04:00
Pavel V. Talanov
908b58878b Introduce JavaClassNonStaticMembersScope and use instead of JavaClassMembersScope 2012-11-21 19:46:09 +04:00
Pavel V. Talanov
eb155bb204 Refactor: remove useless check in PsiDeclarationProviderFactory 2012-11-21 19:46:08 +04:00
Pavel V. Talanov
da47c31a86 Introduce JavaScopeForKotlinNamespace, JavaPackageScopeWithoutMembers, JavaClassStaticMembersScope, much clearer and more explicit logic in JavaNamespaceResolver#createNamespaceScope()
These classes explicitly represent 3 types of scopes that are created for NamespaceDescriptor in JDR
2012-11-21 19:46:07 +04:00
Natalia.Ukhorskaya
ff45322d1a Add Java Source Roots to classpath
#KT-3062 Fixed
2012-11-21 19:44:29 +04:00
Andrey Breslav
3e1a5a7be1 Report exceptions from both makes to Exception Analyzer 2012-11-21 19:31:14 +04:00
Andrey Breslav
4ed07cd9ae Introducing KotlinPaths to impose some discipline on compiler/library location 2012-11-21 18:16:09 +04:00
Andrey Breslav
4ee76a6649 KT-3056 Kotlin: Cannot find kotlinc home. Make sure plugin is properly installed
#KT-3056 Fixed
2012-11-21 14:12:51 +04:00
Evgeny Gerashchenko
19e283a333 Fixed printing multiple errors in Kotlin signatures. 2012-11-21 14:00:51 +04:00
Evgeny Gerashchenko
cda953942d Added @ExpectLoadErrors annotations to test data.
Also, fixed syntax error in AddNullabilitySameJavaType.
2012-11-21 14:00:51 +04:00
Evgeny Gerashchenko
4b465afdfa Saving order of super functions in SignaturesPropagation. 2012-11-21 14:00:51 +04:00
Evgeny Gerashchenko
37cfb2fcc0 Checking errors when loading from Java in tests. 2012-11-21 14:00:51 +04:00
Svetlana Isakova
691cf52835 removed unused component dependencies 2012-11-20 19:54:55 +04:00
Svetlana Isakova
7773f713b7 extracted method usage 2012-11-20 19:54:55 +04:00
Svetlana Isakova
39450dd954 resolve function literal expression (as parameter) after resolve call
(therefore only once)
while resolve use FAKE_FUNCTION_TYPE as type
for function literal (which is a subtype/supertype for any function type)
2012-11-20 19:54:55 +04:00
Svetlana Isakova
473a969598 ArgumentTypeResolver introduce
(component used in CallResolver)
2012-11-20 19:54:54 +04:00
Svetlana Isakova
e8f9097127 do not mark error type
if the expression is resolved to namespace
 (EXPRESSION_EXPECTED_NAMESPACE_FOUND error)
2012-11-20 19:54:45 +04:00
Svetlana Isakova
d0a6f6252d fixed: DEBUG_INFO_ERROR_ELEMENT should be visible in tests 2012-11-20 19:53:03 +04:00
Svetlana Isakova
993d3a3469 added tests for resolve
(to test performance issues)
2012-11-20 17:59:20 +04:00
Evgeny Gerashchenko
837cf38e91 Temporarily disabled assert in SignaturesPropagation which fails due to bug in IDEA. 2012-11-20 17:20:02 +04:00
Evgeny Gerashchenko
8252c51ebc Extracted method checking that loaded functions override super functions correctly. 2012-11-20 17:20:02 +04:00
Evgeny Gerashchenko
60f30732ed Supported several load from Java errors per declaration. 2012-11-20 17:20:02 +04:00
Evgeny Gerashchenko
4525e05268 Throwing exception only if no loading errors happened. 2012-11-20 17:20:02 +04:00
Evgeny Gerashchenko
b09e0aa520 Added assert that we load consistent method hierarchy from Java. 2012-11-20 17:20:01 +04:00
Evgeny Gerashchenko
41f5c64607 Fixed external annotations for listIterator() of AbstractSequentialList and LinkedList.
Now they return MutableListIterator instead of read-only one.
2012-11-20 17:20:01 +04:00
Evgeny Gerashchenko
059c6d0673 Added tests for signatures propagation. 2012-11-20 17:20:01 +04:00
Evgeny Gerashchenko
7e56d6eed8 Replaced indexed for loops with foreach. 2012-11-20 17:20:00 +04:00
Evgeny Gerashchenko
1a216c22f2 Minor. Renamed getC -> getChar 2012-11-20 17:20:00 +04:00
Evgeny Gerashchenko
d37bdbc07d Saving and loading projection kind of array element type in bytecode. 2012-11-20 17:20:00 +04:00
Evgeny Gerashchenko
21e97b408c Loading java arrays as Array<out T> at method return type position, as well. 2012-11-20 16:16:47 +04:00
Evgeny Gerashchenko
d2a308964d Skipping java.util.Collection and similar classes in JdkAnnotationsSanityTest. 2012-11-20 16:16:47 +04:00
Evgeny Gerashchenko
d1f217f2df Minor. LinkedHashMap for easier output parsing. 2012-11-20 16:16:46 +04:00
Evgeny Gerashchenko
62b89655b9 Simplified calculateTypeArgumentsFromSuper and added samples in comments. 2012-11-20 16:16:46 +04:00
Evgeny Gerashchenko
f20c4dac15 Cleanup in tests. 2012-11-20 16:16:46 +04:00
Evgeny Gerashchenko
5ff718b94c Minor. Renamed variables where 'projection kind' term should be used instead of 'variance'. 2012-11-20 16:16:46 +04:00
Evgeny Gerashchenko
4a37c130df Minor. Better name for CollectionClassMapping class. 2012-11-20 16:16:46 +04:00
Evgeny Gerashchenko
f287e2b55d Minor. Various fixups after code review. 2012-11-20 16:16:46 +04:00
Evgeny Gerashchenko
94cad16d1d Moved all code relevant to signatures propagation to separate class.
#KT-2776 in progress
2012-11-20 16:16:46 +04:00
Evgeny Gerashchenko
00bed4a2a4 Added tests with two superclasses.
#KT-2776 in progress
2012-11-20 16:16:46 +04:00
Evgeny Gerashchenko
3b63e6e061 Supported variance propagation. 2012-11-20 16:16:45 +04:00
Evgeny Gerashchenko
9177080d8b Fixed loading variance from alternative signature. 2012-11-20 16:16:45 +04:00
Evgeny Gerashchenko
c5e9deb906 Reverted modification in TypeTransformingVisitor in "Renamed & moved AllInjectorsGenerator".
It was not relevant to that commit: it was squashed accidentally during interactive rebasing.
2012-11-20 16:16:45 +04:00
Evgeny Gerashchenko
044487cf37 Supported propagating read-onliness.
#KT-2776 in progress
2012-11-20 16:16:45 +04:00
Evgeny Gerashchenko
89b413b7ad Supported generic subclasses in submethods.
#KT-2776 in progress
2012-11-20 16:16:45 +04:00
Evgeny Gerashchenko
e2d213f1fd Loading functions from superclasses before current to avoid heisenbug.
Added test with two supertypes.

 #KT-2776 in progress
2012-11-20 16:16:45 +04:00
Evgeny Gerashchenko
494345ce10 Improved algorithm, added simple tests with generic types.
#KT-2776 in progress
2012-11-20 16:16:44 +04:00
Evgeny Gerashchenko
1f4d994480 Introduced simple propagation of nullability on loading Java.
#KT-2776 in progress
2012-11-20 16:16:44 +04:00
Natalia.Ukhorskaya
961fde3c8a Remove redundant abstract tests. Use AbstractCodegenTest instead 2012-11-20 14:35:58 +04:00
Natalia.Ukhorskaya
3fc2e5d20c Attempt to split long or double on the stack exception
#KT-3042 Fixed
2012-11-20 13:35:30 +04:00
Natalia.Ukhorskaya
900788a8e0 Fix javaClass property for long and double
#KT-3046 Fixed
2012-11-19 21:19:48 +04:00
Pavel V. Talanov
7bb7445c57 Fix for invoking abstract method in enum 2012-11-19 20:18:45 +04:00
Andrey Breslav
6384b7340c IDEA 122.813 is required now (API of the new make depends on the new build) 2012-11-19 18:15:20 +04:00
Tommy Hallgren
31480385c1 Prevent infinite loop when HasMap is empty and values() method is valled 2012-11-18 15:34:27 +01:00
4974 changed files with 114022 additions and 49901 deletions

15
.idea/compiler.xml generated
View File

@@ -4,20 +4,7 @@
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="?*.properties" />
<entry name="?*.xml" />
<entry name="?*.gif" />
<entry name="?*.png" />
<entry name="?*.jpeg" />
<entry name="?*.jpg" />
<entry name="?*.html" />
<entry name="?*.dtd" />
<entry name="?*.tld" />
<entry name="?*.ftl" />
<entry name="?*.jet" />
<entry name="?*.ft" />
<entry name="?*.kt" />
<entry name="?*.template" />
<entry name="!*.java" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">

View File

@@ -1,6 +1,8 @@
<component name="CopyrightManager">
<settings default="apache">
<module2copyright />
<settings default="">
<module2copyright>
<element module="all except testData" copyright="apache" />
</module2copyright>
<LanguageOptions name="Groovy">
<option name="fileTypeOverride" value="1" />
</LanguageOptions>

11
.idea/libraries/copyright_plugin.xml generated Normal file
View File

@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="copyright-plugin">
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/copyright/lib/copyright.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/copyright/src" />
</SOURCES>
</library>
</component>

View File

@@ -190,6 +190,7 @@
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/simple" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/java" />
<root url="jar://$PROJECT_DIR$/dependencies/guava-12.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/jetbrains-asm-all-4.0-src.zip!/" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/lib" recursive="false" />
</library>

20
.idea/libraries/jps.xml generated Normal file
View File

@@ -0,0 +1,20 @@
<component name="libraryTable">
<library name="jps">
<CLASSES>
<root url="file://$PROJECT_DIR$/ideaSDK/jps" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/antLayout/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/standalone-builder/src" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/jps" recursive="false" />
</library>
</component>

14
.idea/libraries/jps_test.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="jps-test">
<CLASSES>
<root url="file://$PROJECT_DIR$/ideaSDK/jps/test" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/testSrc" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/jps/test" recursive="false" />
</library>
</component>

22
.idea/misc.xml generated
View File

@@ -43,28 +43,6 @@
</set>
</option>
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
<option name="myDefaultNotNull" value="org.jetbrains.annotations.NotNull" />
<option name="myNullables">
<value>
<list size="3">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="3">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>

1
.idea/modules.xml generated
View File

@@ -24,6 +24,7 @@
<module fileurl="file://$PROJECT_DIR$/jps-plugin/jps-plugin.iml" filepath="$PROJECT_DIR$/jps-plugin/jps-plugin.iml" />
<module fileurl="file://$PROJECT_DIR$/js/js.tests/js.tests.iml" filepath="$PROJECT_DIR$/js/js.tests/js.tests.iml" />
<module fileurl="file://$PROJECT_DIR$/js/js.translator/js.translator.iml" filepath="$PROJECT_DIR$/js/js.translator/js.translator.iml" />
<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" />
<module fileurl="file://$PROJECT_DIR$/runtime/runtime.iml" filepath="$PROJECT_DIR$/runtime/runtime.iml" />
<module fileurl="file://$PROJECT_DIR$/compiler/util/util.iml" filepath="$PROJECT_DIR$/compiler/util/util.iml" />
</modules>

View File

@@ -19,7 +19,7 @@
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
@@ -28,6 +28,9 @@
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Profile ">
<option name="myExternalizedOptions" value="&#10;additional-options2=onexit\=snapshot&#10;" />
</RunnerSettings>
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="IDEA" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=450m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin" />
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=450m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/ideaSDK/bin" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Didea.ProcessCanceledException=disabled" />
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Didea.ProcessCanceledException=disabled" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/ideaSDK/bin" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />

View File

@@ -0,0 +1,31 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="KAnnotator Jps Plugin Test" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="kannotator-jps-plugin-test" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="PACKAGE_NAME" value="org.jetbrains.jet.jps.build.kannotator" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
</component>

3
.idea/scopes/all_except_testData.xml generated Normal file
View File

@@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="all except testData" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*" />
</component>

View File

@@ -10,6 +10,25 @@
<excludeFolder url="file://$MODULE_DIR$/ideaSDK/config" />
<excludeFolder url="file://$MODULE_DIR$/ideaSDK/system" />
<excludeFolder url="file://$MODULE_DIR$/ideaSDK/system-idea" />
<excludeFolder url="file://$MODULE_DIR$/libraries/.idea" />
<excludeFolder url="file://$MODULE_DIR$/libraries/docs/apidoc/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/docs/website/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/examples/browser-example/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/examples/js-example/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/examples/kotlin-java-example/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/kotlin-jdbc/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/kotlin-swing/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/kunit/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/.idea" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kdoc-maven-plugin/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kdoc/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-js-library/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-js-tests-junit/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-js-tests/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-maven-plugin/local-repo" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-maven-plugin/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-stdlib-gen/target" />
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/runtime/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

View File

@@ -1,32 +0,0 @@
#!/bin/sh -e
die() {
echo "$@" >&2
exit 1
}
root=`cd $(dirname $0)/..; pwd`
ideaRoot=
for d in $root/ideaSDK /Applications/Nika-*.app; do
if [ -d "$d/lib" ]; then
ideaRoot="$d"
break
fi
done
test -n "$ideaRoot" || die "Idea root not found"
classpath="$root/out/production/cli"
classpath="$classpath:$root/out/production/backend:$root/out/production/frontend:$root/out/production/frontend.java:$root/out/production/jet.as.java.psi:$root/out/production/util"
classpath="$classpath:$root/out/production/stdlib:$root/out/production/runtime"
classpath="$classpath:$root/lib/*:$ideaRoot/lib/*:$ideaRoot/lib/rt/*"
classpath="$classpath:$root/dependencies/jline-2.6.jar"
exec java $JAVA_OPTS \
-ea \
-classpath "$classpath" \
org.jetbrains.jet.cli.jvm.K2JVMCompiler \
"$@"
# vim: set ts=4 sw=4 et:

View File

@@ -1,64 +0,0 @@
#!/bin/bash
DEPLOY_SETTINGS=~/.kotlin-deploy-settings.xml
BUILD=$1
[ -z "$BUILD" ] && {
echo "Usage: ./publish-maven-artifacts BUILD"
echo " where BUILD is like 0.1.XXXX"
exit 1
}
[ ! -f "$DEPLOY_SETTINGS" ] && {
echo "Maven deploy settings are not found at $DEPLOY_SETTINGS"
exit 1
}
[ ! -f "update_dependencies.xml" -o ! -f "Kotlin.iml" ] && {
echo "Run this script from Kotlin checkout root"
exit 1
}
for cmd in java javac ant mvn git; do
command -v $cmd >/dev/null 2>&1 || {
echo "$cmd must available in \$PATH"
exit 1
}
done
(javac -version 2>&1 | fgrep -q 1.6.) || {
echo "javac must report report 1.6.X version"
exit 1
}
uncommitted=`git status --porcelain -uno`
[ -n "$uncommitted" ] && {
echo "Uncommited changes detected, commit them and run this script again"
echo "$uncommitted"
exit 1
}
LOG=/tmp/kotlin-build-`date +%Y%m%d-%H%M%S`.log
echo "*** Writing build log to $LOG"
(
export MAVEN_OPTS="-Xms512m -Xmx1024M -XX:PermSize=256m -XX:MaxPermSize=512m"
export ANT_OPTS="-Xms512m -Xmx1024M -XX:PermSize=256m -XX:MaxPermSize=512m"
set -x -e
rm -rfv ~/.m2/repository/org/jetbrains/kotlin
rm -rf /tmp/kotlin-dependencies
git clean -f -d -x
git reset --hard
ant -f update_dependencies.xml
ant -f build.xml -Dbuild.number=$BUILD dist
cd libraries
mvn versions:set -DnewVersion=$BUILD
mvn package -PnoTest -DskipTests
find . -name target -type d -prune -print -exec rm -rf {} \;
mvn -s "$DEPLOY_SETTINGS" -PnoTest -DskipTests deploy
echo "*** Successfully uploaded version $BUILD to maven repository"
) 2>&1 | tee "$LOG"

View File

@@ -1,7 +0,0 @@
#!/bin/sh -e
cd $(dirname $0)/..
exec java -classpath 'dist/classes/tests:compiler/frontend/src:dist/classes/runtime:dist/classes/compiler:lib/*:ideaSDL/core/*:ideaSDK/lib/*' "$@"
# vim: set ts=4 sw=4 et ft=sh:

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -25,6 +25,8 @@ import org.jetbrains.jet.cli.common.messages.MessageCollectorPlainTextToStream;
import org.jetbrains.jet.cli.jvm.compiler.*;
import org.jetbrains.jet.config.CommonConfigurationKeys;
import org.jetbrains.jet.config.CompilerConfiguration;
import org.jetbrains.jet.utils.KotlinPaths;
import org.jetbrains.jet.utils.KotlinPathsFromHomeDir;
import org.jetbrains.jet.utils.PathUtil;
import java.io.File;
@@ -62,14 +64,15 @@ public class BytecodeCompiler {
}
private CompilerConfiguration createConfiguration(String stdlib, String[] classpath, String[] sourceRoots) {
KotlinPaths paths = getKotlinPathsForAntTask();
CompilerConfiguration configuration = new CompilerConfiguration();
configuration.add(CLASSPATH_KEY, PathUtil.findRtJar());
if ((stdlib != null) && (stdlib.trim().length() > 0)) {
configuration.add(CLASSPATH_KEY, new File(stdlib));
}
else {
File path = PathUtil.getDefaultRuntimePath();
if (path != null) {
File path = paths.getRuntimePath();
if (path.exists()) {
configuration.add(CLASSPATH_KEY, path);
}
}
@@ -78,8 +81,8 @@ public class BytecodeCompiler {
configuration.add(CLASSPATH_KEY, new File(path));
}
}
File jdkAnnotationsPath = PathUtil.getJdkAnnotationsPath();
if (jdkAnnotationsPath != null) {
File jdkAnnotationsPath = paths.getJdkAnnotationsPath();
if (jdkAnnotationsPath.exists()) {
configuration.add(ANNOTATIONS_PATH_KEY, jdkAnnotationsPath);
}
@@ -91,7 +94,6 @@ public class BytecodeCompiler {
return configuration;
}
/**
* Retrieves compilation error message.
*
@@ -172,7 +174,7 @@ public class BytecodeCompiler {
@Nullable String stdlib,
@Nullable String[] classpath) {
try {
List<Module> modules = CompileEnvironmentUtil.loadModuleScript(module, MessageCollectorPlainTextToStream.PLAIN_TEXT_TO_SYSTEM_ERR);
List<Module> modules = CompileEnvironmentUtil.loadModuleScript(getKotlinPathsForAntTask(), module, MessageCollectorPlainTextToStream.PLAIN_TEXT_TO_SYSTEM_ERR);
List<String> sourcesRoots = new ArrayList<String>();
for (Module m : modules) {
sourcesRoots.addAll(m.getSourceFiles());
@@ -196,4 +198,9 @@ public class BytecodeCompiler {
public void setCompilerPlugins(List<CompilerPlugin> compilerPlugins) {
this.compilerPlugins = compilerPlugins;
}
private static KotlinPaths getKotlinPathsForAntTask() {
return new KotlinPathsFromHomeDir(PathUtil.getJarPathForClass(BytecodeCompiler.class).getParentFile().getParentFile());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.

356
build.xml
View File

@@ -9,18 +9,12 @@
<property name="output" value="${basedir}/${output.relative}"/>
<property name="kotlin-home" value="${output}/kotlinc"/>
<property name="build.number" value="snapshot"/>
<property name="output.name" value="kotlin-${build.number}"/>
<property name="output.name" value="kotlin-compiler-${build.number}"/>
<property name="idea.sdk" value="${basedir}/ideaSDK"/>
<path id="classpath">
<fileset dir="${idea.sdk}" includes="core/*.jar"/>
<!--
Work around this problem: https://gist.github.com/1c4a7d51b61ec81d581b
Somebody please fix it properly or delete this comment if this is OK
-->
<pathelement path="${idea.sdk}/lib/resources_en.jar"/>
<fileset dir="${basedir}/lib" includes="**/*.jar"/>
<fileset dir="${basedir}/dependencies" includes="jline.jar"/>
<fileset dir="${basedir}/dependencies" includes="jansi.jar"/>
@@ -35,7 +29,7 @@
<include name="compiler/cli/src"/>
<include name="compiler/cli/cli-common/src"/>
<include name="compiler/util/src"/>
<include name="j2k/src"/>
<!--<include name="j2k/src"/>-->
<include name="compiler/jet.as.java.psi/src"/>
<include name="runtime/src"/>
@@ -64,13 +58,14 @@
<target name="init" depends="clean">
<mkdir dir="${kotlin-home}"/>
<mkdir dir="${kotlin-home}/lib"/>
<mkdir dir="${kotlin-home}/lib/alt"/>
<mkdir dir="${kotlin-home}/lib/tools"/>
</target>
<target name="prepareDist">
<copy todir="${kotlin-home}/bin">
<fileset dir="${basedir}/compiler/cli/bin"/>
</copy>
<fixcrlf srcdir="${kotlin-home}/bin" excludes="**/*.bat" eol="unix"/>
<copy todir="${kotlin-home}/license">
<fileset dir="${basedir}/license"/>
@@ -81,51 +76,59 @@
<chmod dir="${kotlin-home}/bin" includes="*" perm="755"/>
</target>
<target name="injectorsGenerator">
<cleandir dir="${output}/classes/injectorsGenerator"/>
<javac destdir="${output}/classes/injectorsGenerator" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<target name="compileGenerators">
<cleandir dir="${output}/classes/generators"/>
<javac destdir="${output}/classes/generators" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<src path="injector-generator/src"/>
<src path="generators/org/jetbrains/jet/generators/injectors"/>
<src path="generators/org/jetbrains/jet/generators/jvm"/>
<src refid="compilerSources.path"/>
<classpath refid="classpath"/>
</javac>
<copy todir="${output}/classes/generators">
<fileset dir="compiler/frontend/src" includes="**/*.jet"/>
</copy>
</target>
<target name="generateInjectors" depends="injectorsGenerator">
<target name="invokeGenerators" depends="compileGenerators">
<java classname="org.jetbrains.jet.generators.injectors.GenerateInjectors" failonerror="true">
<classpath refid="classpath"/>
<classpath path="${output}/classes/injectorsGenerator"/>
<classpath path="${output}/classes/generators"/>
</java>
<java classname="org.jetbrains.jet.generators.jvm.GenerateJavaToKotlinMethodMap" failonerror="true">
<classpath refid="classpath"/>
<classpath path="${output}/classes/generators"/>
</java>
</target>
<target name="compilerSources">
<jar jarfile="${output}/kotlin-compiler-sources.jar">
<!-- TODO How to convert it from pathset or dirset ? -->
<fileset dir="compiler/frontend/src"/>
<fileset dir="compiler/frontend.java/src"/>
<fileset dir="compiler/backend/src"/>
<fileset dir="compiler/cli/src"/>
<fileset dir="j2k/src"/>
<fileset dir="compiler/util/src"/>
<fileset dir="compiler/jet.as.java.psi/src"/>
<fileset dir="runtime/src"/>
<fileset dir="js/js.translator/src"/>
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
<manifest>
<attribute name="Built-By" value="JetBrains"/>
<attribute name="Implementation-Vendor" value="JetBrains"/>
<attribute name="Implementation-Title" value="Kotlin Compiler Sources"/>
<attribute name="Implementation-Version" value="${build.number}"/>
</manifest>
</jar>
<if>
<istrue value="${generate.javadoc}"/>
<then>
<jar jarfile="${output}/kotlin-compiler-sources.jar">
<!-- TODO How to convert it from pathset or dirset ? -->
<fileset dir="compiler/frontend/src"/>
<fileset dir="compiler/frontend.java/src"/>
<fileset dir="compiler/backend/src"/>
<fileset dir="compiler/cli/src"/>
<fileset dir="j2k/src"/>
<fileset dir="compiler/util/src"/>
<fileset dir="compiler/jet.as.java.psi/src"/>
<fileset dir="runtime/src"/>
<fileset dir="js/js.translator/src"/>
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
<manifest>
<attribute name="Built-By" value="JetBrains"/>
<attribute name="Implementation-Vendor" value="JetBrains"/>
<attribute name="Implementation-Title" value="Kotlin Compiler Sources"/>
<attribute name="Implementation-Version" value="${build.number}"/>
</manifest>
</jar>
<delete dir="${output}/kotlin-compiler-javadoc" failonerror="false" />
<delete dir="${output}/kotlin-compiler-javadoc" failonerror="false"/>
<javadoc destdir="${output}/kotlin-compiler-javadoc"
sourcepathref="compilerSources.path"
classpathref="classpath"
@@ -144,62 +147,73 @@
</manifest>
</jar>
</then>
<else>
<jar jarfile="${output}/kotlin-compiler-javadoc.jar">
<manifest>
<attribute name="Built-By" value="JetBrains"/>
<attribute name="Implementation-Vendor" value="JetBrains"/>
<attribute name="Implementation-Title" value="Kotlin Compiler Javadoc"/>
<attribute name="Implementation-Version" value="${build.number}"/>
</manifest>
</jar>
</else>
</if>
</target>
<target name="jslib">
<jar jarfile="${kotlin-home}/lib/kotlin-jslib.jar">
<fileset dir="${basedir}/js/js.libraries/src">
<include name="core/**"/>
<include name="jquery/**"/>
<include name="dom/**"/>
<include name="html5/**"/>
<include name="stdlib/TuplesCode.kt"/>
</fileset>
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
</jar>
<java classname="com.google.javascript.jscomp.CommandLineRunner" failonerror="true">
<classpath>
<pathelement location="${basedir}\js\js.tests\testLib\closure-compiler.jar"/>
</classpath>
<arg value="--formatting"/>
<arg value="PRETTY_PRINT"/>
<arg value="--language_in"/>
<arg value="ECMASCRIPT5_STRICT"/>
<arg value="--compilation_level"/>
<arg value="SIMPLE_OPTIMIZATIONS"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib_ecma5.js"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib.js"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/maps.js"/>
<arg value="--js_output_file"/>
<arg value="${kotlin-home}/lib/kotlinEcma5.js"/>
</java>
<java classname="com.google.javascript.jscomp.CommandLineRunner" failonerror="true">
<classpath>
<pathelement location="${basedir}/js/js.tests/testLib/closure-compiler.jar"/>
</classpath>
<arg value="--formatting"/>
<arg value="PRETTY_PRINT"/>
<arg value="--language_in"/>
<arg value="ECMASCRIPT3"/>
<arg value="--compilation_level"/>
<arg value="SIMPLE_OPTIMIZATIONS"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib_ecma3.js"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib.js"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/maps.js"/>
<arg value="--js_output_file"/>
<arg value="${kotlin-home}/lib/kotlinEcma3.js"/>
</java>
</target>
<target name="jslib">
<jar jarfile="${kotlin-home}/lib/kotlin-jslib.jar">
<fileset dir="${basedir}/js/js.libraries/src">
<include name="core/**"/>
<include name="jquery/**"/>
<include name="dom/**"/>
<include name="html5/**"/>
<include name="stdlib/TuplesCode.kt"/>
</fileset>
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
</jar>
<java classname="com.google.javascript.jscomp.CommandLineRunner" failonerror="true">
<classpath>
<pathelement location="${basedir}\js\js.tests\testLib\closure-compiler.jar"/>
</classpath>
<arg value="--formatting"/>
<arg value="PRETTY_PRINT"/>
<arg value="--language_in"/>
<arg value="ECMASCRIPT5_STRICT"/>
<arg value="--compilation_level"/>
<arg value="SIMPLE_OPTIMIZATIONS"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib_ecma5.js"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib.js"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/maps.js"/>
<arg value="--js_output_file"/>
<arg value="${kotlin-home}/lib/kotlinEcma5.js"/>
</java>
<java classname="com.google.javascript.jscomp.CommandLineRunner" failonerror="true">
<classpath>
<pathelement location="${basedir}/js/js.tests/testLib/closure-compiler.jar"/>
</classpath>
<arg value="--formatting"/>
<arg value="PRETTY_PRINT"/>
<arg value="--language_in"/>
<arg value="ECMASCRIPT3"/>
<arg value="--compilation_level"/>
<arg value="SIMPLE_OPTIMIZATIONS"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib_ecma3.js"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib.js"/>
<arg value="--js"/>
<arg value="${basedir}/js/js.translator/testFiles/maps.js"/>
<arg value="--js_output_file"/>
<arg value="${kotlin-home}/lib/kotlinEcma3.js"/>
</java>
</target>
<target name="compiler">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${basedir}/dependencies/jarjar.jar"/>
<taskdef resource="proguard/ant/task.properties" classpath="${basedir}/dependencies/proguard.jar"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${basedir}/dependencies/ant-contrib.jar"/>
@@ -209,54 +223,18 @@
<classpath refid="classpath"/>
</javac>
<!-- JarJar Kotlin compiler & dependencies -->
<jarjar jarfile="${output}/kotlin-compiler-jarjar.jar">
<jar jarfile="${output}/kotlin-compiler-before-shrink.jar">
<fileset dir="${output}/classes/compiler"/>
<fileset dir="${basedir}/compiler/frontend/src" includes="jet/**"/>
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
<zipgroupfileset dir="${basedir}/ideaSDK/core" includes="*.jar"/>
<zipgroupfileset dir="${basedir}/ideaSDK/core" includes="*.jar" excludes="util.jar"/>
<zipgroupfileset dir="${basedir}/ideaSDK/lib" includes="jna-utils.jar"/>
<zipgroupfileset dir="${basedir}/ideaSDK/lib" includes="oromatcher.jar"/>
<zipgroupfileset dir="${basedir}/js/js.translator/lib" includes="*.jar"/>
<zipgroupfileset dir="${basedir}/dependencies" includes="jline.jar"/>
<zipgroupfileset dir="${basedir}/dependencies" includes="jansi.jar"/>
<zipgroupfileset dir="${basedir}/dependencies" includes="jetbrains-asm-util-4.0.jar"/>
<zipgroupfileset dir="${basedir}/dependencies" includes="jetbrains-asm-analysis-4.0.jar"/>
<zap pattern="com.thoughtworks.xstream.converters.extended.ISO8601*"/>
<zap pattern="com.thoughtworks.xstream.converters.reflection.CGLIBEnhancedConverter*"/>
<zap pattern="com.thoughtworks.xstream.io.xml.Dom4J*"/>
<zap pattern="com.thoughtworks.xstream.io.xml.Xom*"/>
<zap pattern="com.thoughtworks.xstream.mapper.CGLIBMapper*"/>
<zap pattern="org.apache.log4j.jmx.Agent"/>
<zap pattern="org.apache.log4j.net.JMS*"/>
<zap pattern="org.apache.log4j.net.SMTP*"/>
<zap pattern="org.apache.log4j.or.jms.MessageRenderer"/>
<zap pattern="org.jdom.xpath.Jaxen*"/>
<zap pattern="org.mozilla.javascript.xml.impl.xmlbeans.**"/>
<rule pattern="com.intellij.**" result="org.jetbrains.jet.internal.com.intellij.@1"/>
<rule pattern="com.sun.jna.**" result="org.jetbrains.jet.internal.com.sun.jna.@1"/>
<rule pattern="org.apache.log4j.**" result="org.jetbrains.jet.internal.org.apache.log4j.@1"/>
<rule pattern="org.jdom.**" result="org.jetbrains.jet.internal.org.jdom.@1"/>
<rule pattern="JDOMAbout**" result="org.jetbrains.jet.internal.org.jdom.JDOMAbout@1"/>
<rule pattern="org.intellij.lang.annotations.**" result="org.jetbrains.jet.internal.org.intellij.lang.annotations.@1"/>
<rule pattern="com.google.**" result="org.jetbrains.jet.internal.com.google.@1"/>
<rule pattern="org.objectweb.asm.**" result="org.jetbrains.jet.internal.org.objectweb.asm.@1"/>
<rule pattern="com.sampullara.cli.**" result="org.jetbrains.jet.internal.com.sampullara.cli.@1"/>
<rule pattern="org.picocontainer.**" result="org.jetbrains.jet.internal.org.picocontainer.@1"/>
<rule pattern="gnu.trove.**" result="org.jetbrains.jet.internal.gnu.trove.@1"/>
<rule pattern="javax.inject.**" result="org.jetbrains.jet.internal.javax.inject.@1"/>
<rule pattern="com.thoughtworks.xstream.**" result="org.jetbrains.jet.internal.com.thoughtworks.xstream.@1"/>
<rule pattern="org.json.**" result="org.jetbrains.jet.internal.org.json.@1"/>
<rule pattern="org.mozilla.**" result="org.jetbrains.jet.internal.org.mozilla.@1"/>
<rule pattern="org.xmlpull.**" result="org.jetbrains.jet.internal.org.xmlpull.@1"/>
<rule pattern="org.kohsuke.args4j.**" result="org.jetbrains.jet.internal.org.kohsuke.args4j.@1"/>
<manifest>
<attribute name="Built-By" value="JetBrains"/>
@@ -266,7 +244,7 @@
<attribute name="Main-Class" value="org.jetbrains.jet.cli.jvm.K2JVMCompiler"/>
</manifest>
</jarjar>
</jar>
<delete file="${kotlin-home}/lib/kotlin-compiler.jar" failonerror="false"/>
@@ -274,39 +252,41 @@
<isfalse value="${shrink}"/>
<then>
<copy file="${output}/kotlin-compiler-jarjar.jar"
<copy file="${output}/kotlin-compiler-before-shrink.jar"
tofile="${kotlin-home}/lib/kotlin-compiler.jar"/>
</then>
<else>
<cleandir dir="${output}/kotlin-compiler.exploded"/>
<unzip src="${output}/kotlin-compiler-jarjar.jar" dest="${output}/kotlin-compiler.exploded"/>
<!-- Clean JarJar result -->
<jar jarfile="${output}/kotlin-compiler-before-proguard.jar"
manifest="${output}/kotlin-compiler.exploded/META-INF/MANIFEST.MF">
<fileset dir="${output}/kotlin-compiler.exploded">
<include name="**/*.class"/>
<include name="**/*.jet"/>
<include name="**/*.kt"/>
<include name="META-INF/services/**"/>
<include name="messages/**"/>
</fileset>
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
</jar>
<delete dir="${output}/kotlin-compiler.exploded"/>
<available property="rtjar" value="${java.home}/lib/rt.jar" file="${java.home}/lib/rt.jar"/>
<available property="rtjar" value="${java.home}/../Classes/classes.jar" file="${java.home}/../Classes/classes.jar"/>
<proguard><![CDATA[
-injars '${output}/kotlin-compiler-before-proguard.jar'
-injars '${output}/kotlin-compiler-before-shrink.jar'(
!com/thoughtworks/xstream/converters/extended/ISO8601**,
!com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter**,
!com/thoughtworks/xstream/io/xml/Dom4J**,
!com/thoughtworks/xstream/io/xml/Xom**,
!com/thoughtworks/xstream/io/xml/Wstx**,
!com/thoughtworks/xstream/io/xml/KXml2**,
!com/thoughtworks/xstream/io/xml/BEAStax**,
!com/thoughtworks/xstream/io/json/Jettison**,
!com/thoughtworks/xstream/mapper/CGLIBMapper**,
!org/apache/log4j/jmx/Agent*,
!org/apache/log4j/net/JMS*,
!org/apache/log4j/net/SMTP*,
!org/apache/log4j/or/jms/MessageRenderer*,
!org/jdom/xpath/Jaxen*,
!org/mozilla/javascript/xml/impl/xmlbeans/**,
!META-INF/maven**,
**.class,**.properties,**.jet,**.kt,
META-INF/services/**,META-INF/native/**,META-INF/MANIFEST.MF,
messages/**)
-outjars '${kotlin-home}/lib/kotlin-compiler.jar'
-dontwarn org.jetbrains.jet.internal.com.intellij.util.**
-dontwarn org.jetbrains.jet.internal.com.intellij.codeInsight.**
-dontwarn org.jetbrains.jet.internal.com.thoughtworks.xstream.**
-dontwarn com.intellij.util.ui.IsRetina*
-dontwarn com.intellij.util.RetinaImage*
-dontwarn org.fusesource.**
-libraryjars '${rtjar}'
@@ -314,9 +294,8 @@
-dontoptimize
-dontobfuscate
-keepclasseswithmembers public class * {
public static void main(java.lang.String[]);
}
-keep class org.fusesource.** { *; }
-keep class org.jdom.input.JAXPParserFactory { *; }
-keep class org.jetbrains.annotations.** {
public protected *;
@@ -334,27 +313,12 @@
public protected *;
}
-keepclasseswithmembers class * { void start(); }
-keep class com.intellij.psi.** {
public protected *;
}
-keepclasseswithmembers class * { void stop(); }
-keepclasseswithmembers class * { void dispose(); }
-keepclasseswithmembers class * { ** getFileSystem(); }
-keepclasseswithmembers class * { ** isVarArgs(); }
-keepclasseswithmembers class * { ** getApplication(); }
-keepclasseswithmembers class * { ** finalizeReferent(); }
-keepclasseswithmembers class * { ** newBuilder(); }
-keepclasseswithmembers class * { ** startFinalizer(java.lang.Class,java.lang.Object); }
-keepclasseswithmembers class * { ** executeOnPooledThread(java.lang.Runnable); }
-keepclasseswithmembers class * { ** getUserData(java.lang.String); }
-keepclasseswithmembers class * { int getBooleanAttributes(java.io.File); }
-keepclasseswithmembers class * { ** project(); }
-keepclasseswithmembers class * { ** TYPE; }
-keepclasseswithmembers class * { ** ourInstance; }
-keepclasseswithmembers class * { <init>(kotlinc.internal.com.intellij.lang.ASTNode); }
# for kdoc
-keep class com.intellij.openapi.util.TextRange { *; }
-keepclassmembers enum * {
public static **[] values();
@@ -364,6 +328,9 @@
-keepclassmembers class * {
** toString();
** hashCode();
void start();
void stop();
void dispose();
}
]]></proguard>
</else>
@@ -458,30 +425,33 @@
</jar>
</target>
<target name="lang">
<cleandir dir="${output}/classes/lang"/>
<java classname="org.jetbrains.jet.cli.jvm.K2JVMCompiler" failonerror="true">
<classpath>
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
</classpath>
<arg value="-src"/>
<arg value="${basedir}/compiler/frontend/src"/>
<arg value="-output"/>
<arg value="${output}/classes/lang"/>
<arg value="-noStdlib"/>
<arg value="-builtins"/>
</java>
<target name="j2kConverter">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${basedir}/dependencies/ant-contrib.jar"/>
<!-- Not used yet -->
<!--
<jar destfile="${kotlin-home}/lib/lang.jar">
<fileset dir="${output}/classes/lang"/>
<cleandir dir="${output}/classes/j2k"/>
<javac destdir="${output}/classes/j2k" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<src path="${basedir}/j2k/src"/>
<classpath path="${kotlin-home}/lib/kotlin-compiler.jar"/>
</javac>
<jar jarfile="${kotlin-home}/lib/tools/j2k.jar">
<fileset dir="${output}/classes/j2k" includes="org/jetbrains/jet/j2k/**"/>
<manifest>
<attribute name="Built-By" value="JetBrains"/>
<attribute name="Implementation-Vendor" value="JetBrains"/>
<attribute name="Implementation-Title" value="Java to Kotlin Converter"/>
<attribute name="Implementation-Version" value="${build.number}"/>
<attribute name="Main-Class" value="org.jetbrains.jet.j2k.JavaToKotlinTranslator"/>
</manifest>
</jar>
-->
</target>
<target name="dist"
depends="init,prepareDist,injectorsGenerator,generateInjectors,compiler,compilerSources,antTools,jdkAnnotations,runtime,lang,jslib"/>
depends="init,prepareDist,compileGenerators,invokeGenerators,compiler,compilerSources,antTools,jdkAnnotations,runtime,jslib,j2kConverter"/>
<target name="zip" depends="dist">
<zip destfile="${output}/${output.name}.zip">
@@ -491,4 +461,4 @@
</target>
</project>
<!-- vim: set ts=4 sw=4 et nowrap: -->
<!-- vim: set ts=4 sw=4 et nowrap: -->

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/assets" />
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/libs" />
<option name="USE_CUSTOM_APK_RESOURCE_FOLDER" value="false" />
<option name="CUSTOM_APK_RESOURCE_FOLDER" value="" />
<option name="USE_CUSTOM_COMPILER_MANIFEST" value="false" />
<option name="CUSTOM_COMPILER_MANIFEST" value="" />
<option name="APK_PATH" value="" />
<option name="LIBRARY_PROJECT" value="false" />
<option name="RUN_PROCESS_RESOURCES_MAVEN_TASK" value="true" />
<option name="GENERATE_UNSIGNED_APK" value="false" />
<option name="CUSTOM_DEBUG_KEYSTORE_PATH" value="" />
<option name="PACK_TEST_CODE" value="false" />
<option name="RUN_PROGUARD" value="false" />
<option name="PROGUARD_CFG_PATH" value="/proguard-project.txt" />
<resOverlayFolders>
<path>/res-overlay</path>
</resOverlayFolders>
<includeSystemProguardFile>true</includeSystemProguardFile>
<includeAssetsFromLibraries>false</includeAssetsFromLibraries>
<additionalNativeLibs />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="Android 2.3.3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<excludeFromCompile>
<directory url="file://$PROJECT_DIR$/gen" includeSubdirectories="true" />
</excludeFromCompile>
</component>
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/android-module.iml" filepath="$PROJECT_DIR$/android_module.iml" />
</modules>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="Android_SDK" project-jdk-type="Android SDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
# Project target.
target=android-10
target=android-16

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">android1</string>
</resources>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -21,16 +21,14 @@ import junit.framework.TestCase;
import java.lang.String;
import java.lang.reflect.Method;
/**
* @author Natalia.Ukhorskaya
*/
public class AbstractCodegenTestCaseOnAndroid extends TestCase {
protected void invokeBoxMethod(String filePath, String expectedResult) throws Exception {
try {
Class clazz;
clazz = Class.forName(filePath.replaceAll("\\\\|-|\\.|/", "_") + ".namespace");
String packageName = filePath.replaceAll("\\\\|-|\\.|/", "_");
clazz = Class.forName(packageName + "." + getPackageClassName(packageName));
Method method;
method = clazz.getMethod("box");
assertEquals(expectedResult, method.invoke(null));
@@ -39,4 +37,8 @@ public class AbstractCodegenTestCaseOnAndroid extends TestCase {
throw new RuntimeException("File: " + filePath, e);
}
}
public static String getPackageClassName(String packageName) {
return Character.toUpperCase(packageName.charAt(0)) + packageName.substring(1, packageName.length()) + "Package";
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -14,14 +14,14 @@
* limitations under the License.
*/
package test;
package org.jetbrains.jet.compiler.android;
import awt.Frame;
import android.app.Activity;
import android.os.Bundle;
public class JFrame extends Frame {
public JFrame() {
public class MyActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
System.out.println(R.string.app_name);
}
protected String accessibleContext = null;
}
}

View File

@@ -14,6 +14,7 @@
<orderEntry type="module" module-name="frontend.java" />
<orderEntry type="module" module-name="frontend" />
<orderEntry type="module" module-name="backend" />
<orderEntry type="library" name="jps-test" level="project" />
</component>
</module>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -20,6 +20,7 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.io.FileUtil;
import junit.framework.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.compiler.ant.AntRunner;
import org.jetbrains.jet.compiler.download.SDKDownloader;
@@ -32,9 +33,6 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author Natalia.Ukhorskaya
*/
public class CodegenTestsOnAndroidRunner {
private static final Pattern ERROR_IN_TEST_OUTPUT_PATTERN =
@@ -56,20 +54,19 @@ public class CodegenTestsOnAndroidRunner {
TestSuite suite = new TestSuite("MySuite");
String resultOutput = runTests();
if (resultOutput == null) return suite;
// Test name -> stackTrace
final Map<String, String> resultMap = parseOutputForFailedTests(resultOutput);
final Statistics statistics;
// If map is empty => there are no failed tests
if (resultMap.isEmpty()) {
// Clear tmp folder where we run android tests
FileUtil.delete(new File(pathManager.getTmpFolder()));
statistics = parseOutputForTestsNumberIfTestsPassed(resultOutput);
}
else {
statistics = parseOutputForTestsNumberIfThereIsFailedTests(resultOutput);
for (final Map.Entry<String, String> entry : resultMap.entrySet()) {
suite.addTest(new TestCase("run") {
@@ -85,7 +82,7 @@ public class CodegenTestsOnAndroidRunner {
});
}
}
Assert.assertNotNull("Cannot parse number of failed tests from final line", statistics);
Assert.assertEquals("Number of stackTraces != failed tests on the final line", resultMap.size(),
statistics.failed + statistics.errors);
@@ -125,7 +122,7 @@ public class CodegenTestsOnAndroidRunner {
[exec] ...............
[exec] Error in testKt529:
*/
private Map<String, String> parseOutputForFailedTests(String output) {
private Map<String, String> parseOutputForFailedTests(@NotNull String output) {
Map<String, String> result = new HashMap<String, String>();
StringBuilder builder = new StringBuilder();
String failedTestNamePrefix = " Error in ";
@@ -171,6 +168,7 @@ public class CodegenTestsOnAndroidRunner {
}
@Nullable
public String runTests() {
ApplicationManager.setApplication(null, new Disposable() {
@Override
@@ -193,23 +191,31 @@ public class CodegenTestsOnAndroidRunner {
antRunner.packLibraries();
emulator.createEmulator();
emulator.startEmulator();
try {
emulator.waitEmulatorStart();
antRunner.cleanOutput();
antRunner.compileSources();
antRunner.installApplicationOnEmulator();
return antRunner.runTestsOnEmulator();
}
finally {
emulator.createEmulator();
emulator.startEmulator();
try {
emulator.waitEmulatorStart();
antRunner.cleanOutput();
antRunner.compileSources();
antRunner.installApplicationOnEmulator();
return antRunner.runTestsOnEmulator();
}
catch (RuntimeException e) {
e.printStackTrace();
throw e;
}
finally {
emulator.stopEmulator();
}
catch (Throwable t) {
System.err.println("Exception during stopping emulator:");
t.printStackTrace();
}
}
catch (RuntimeException e) {
e.printStackTrace();
throw e;
}
finally {
emulator.finishEmulatorProcesses();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -25,9 +25,6 @@ import org.jetbrains.jet.compiler.run.result.RunResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author Natalia.Ukhorskaya
*/
public class OutputUtils {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -18,9 +18,6 @@ package org.jetbrains.jet.compiler;
import java.io.File;
/**
* @author Natalia.Ukhorskaya
*/
public class PathManager {

View File

@@ -0,0 +1,41 @@
/*
* Copyright 2010-2013 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.jet.compiler;
import java.lang.InterruptedException;
import java.lang.RuntimeException;
import java.lang.Thread;
public class ThreadUtils {
public static void wait(Thread thread, int seconds) {
try {
thread.wait(seconds * 1000);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
public static void sleep(int seconds) {
try {
Thread.sleep(seconds * 1000);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -20,15 +20,13 @@ import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.jet.compiler.OutputUtils;
import org.jetbrains.jet.compiler.PathManager;
import org.jetbrains.jet.compiler.ThreadUtils;
import org.jetbrains.jet.compiler.run.RunUtils;
import org.jetbrains.jet.compiler.run.result.RunResult;
import java.util.ArrayList;
import java.util.List;
/**
* @author Natalia.Ukhorskaya
*/
public class AntRunner {
private final List<String> listOfAntCommands;
@@ -71,7 +69,9 @@ public class AntRunner {
return;
}
else {
System.out.println(resultOutput);
if (result.getStatus()) {
System.out.println(resultOutput);
}
}
OutputUtils.checkResult(result);
}
@@ -86,14 +86,9 @@ public class AntRunner {
private static boolean isInstallSuccessful(String output) {
if (output.contains("Is the system running?")) {
try {
System.out.println("Device not ready. Waiting for 20 sec.");
Thread.sleep(20000);
return false;
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
System.out.println("Device not ready. Waiting for 20 sec.");
ThreadUtils.sleep(20);
return false;
}
return true;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -27,12 +27,10 @@ import java.net.URLConnection;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**
* @author Natalia.Ukhorskaya
*/
public class SDKDownloader {
private final String platformZipPath;
private final String systemImages;
private final String platformToolsZipPath;
private final String toolsZipPath;
private final String antZipPath;
@@ -42,25 +40,30 @@ public class SDKDownloader {
public SDKDownloader(PathManager pathManager) {
this.pathManager = pathManager;
platformZipPath = pathManager.getRootForDownload() + "/platforms.zip";
systemImages = pathManager.getRootForDownload() + "/system-images.zip";
platformToolsZipPath = pathManager.getRootForDownload() + "/platform-tools.zip";
toolsZipPath = pathManager.getRootForDownload() + "/tools.zip";
antZipPath = pathManager.getRootForDownload() + "/apache-ant-1.8.0.zip";
}
public void downloadPlatform() {
download("https://dl-ssl.google.com/android/repository/android-2.3.3_r02-linux.zip", platformZipPath); //Same for all platforms
download("http://dl-ssl.google.com/android/repository/android-16_r04.zip", platformZipPath); //Same for all platforms
}
private void downloadAbi() {
download("http://dl.google.com/android/repository/sysimg_armv7a-16_r03.zip", systemImages); //Same for all platforms
}
public void downloadPlatformTools() {
String downloadURL;
if (SystemInfo.isWindows) {
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r11-windows.zip";
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r16-windows.zip";
}
else if (SystemInfo.isMac) {
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r11-macosx.zip";
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r16-macosx.zip";
}
else if (SystemInfo.isUnix) {
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r11-linux.zip";
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r16-linux.zip";
}
else {
throw new IllegalStateException("Your operating system doesn't supported yet.");
@@ -71,13 +74,13 @@ public class SDKDownloader {
public void downloadTools() {
String downloadURL;
if (SystemInfo.isWindows) {
downloadURL = "http://dl.google.com/android/repository/tools_r19-windows.zip";
downloadURL = "http://dl.google.com/android/repository/tools_r16-windows.zip";
}
else if (SystemInfo.isMac) {
downloadURL = "http://dl.google.com/android/repository/tools_r19-macosx.zip";
downloadURL = "http://dl.google.com/android/repository/tools_r16-macosx.zip";
}
else if (SystemInfo.isUnix) {
downloadURL = "http://dl.google.com/android/repository/tools_r19-linux.zip";
downloadURL = "http://dl.google.com/android/repository/tools_r16-linux.zip";
}
else {
throw new IllegalStateException("Your operating system doesn't supported yet.");
@@ -91,13 +94,16 @@ public class SDKDownloader {
public void downloadAll() {
downloadTools();
downloadAbi();
downloadPlatform();
downloadPlatformTools();
downloadAnt();
}
public void unzipAll() {
unzip(platformZipPath, pathManager.getPlatformFolderInAndroidSdk());
unzip(systemImages, pathManager.getAndroidSdkRoot() + "/system-images/android-16/");
unzip(platformToolsZipPath, pathManager.getAndroidSdkRoot());
unzip(toolsZipPath, pathManager.getAndroidSdkRoot());
unzip(antZipPath, pathManager.getDependenciesRoot());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -19,8 +19,10 @@ package org.jetbrains.jet.compiler.emulator;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.compiler.OutputUtils;
import org.jetbrains.jet.compiler.PathManager;
import org.jetbrains.jet.compiler.ThreadUtils;
import org.jetbrains.jet.compiler.run.RunUtils;
import org.jetbrains.jet.compiler.run.result.RunResult;
@@ -28,15 +30,11 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author Natalia.Ukhorskaya
*/
public class Emulator {
private final static Pattern EMULATOR_PATTERN = Pattern.compile("emulator-([0-9])*");
private final PathManager pathManager;
public Emulator(PathManager pathManager) {
@@ -86,34 +84,50 @@ public class Emulator {
return commandLine;
}
@Nullable
private GeneralCommandLine getStopCommand() {
GeneralCommandLine commandLine = new GeneralCommandLine();
if (SystemInfo.isWindows) {
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath("taskkill");
commandLine.addParameter("/F");
commandLine.addParameter("/IM");
commandLine.addParameter("emulator-arm.exe");
return commandLine;
}
else {
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/adb");
commandLine.addParameter("emu");
commandLine.addParameter("kill");
}
return commandLine;
return null;
}
public void createEmulator() {
System.out.println("Creating emulator...");
OutputUtils.checkResult(RunUtils.execute(getCreateCommand(), "no"));
OutputUtils.checkResult(RunUtils.execute(new RunUtils.RunSettings(getCreateCommand(), "no", true, null, false)));
}
public void startServer() {
GeneralCommandLine commandLine = new GeneralCommandLine();
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
commandLine.addParameter("start-server");
System.out.println("Start adb server...");
OutputUtils.checkResult(RunUtils.execute(commandLine));
}
public void startEmulator() {
startServer();
System.out.println("Starting emulator...");
stopRedundantEmulators(pathManager);
OutputUtils.checkResult(RunUtils.executeOnSeparateThread(getStartCommand(), false));
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(getStartCommand(), null, false, "START: ", true));
printLog();
}
public void printLog() {
GeneralCommandLine commandLine = new GeneralCommandLine();
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
commandLine.addParameter("logcat");
commandLine.addParameter("-v");
commandLine.addParameter("time");
commandLine.addParameter("*:I");
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(commandLine, null, false, "LOGCAT: ", true));
}
public void waitEmulatorStart() {
System.out.println("Waiting for emulator start...");
@@ -122,46 +136,53 @@ public class Emulator {
public void stopEmulator() {
System.out.println("Stopping emulator...");
OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
System.out.println("Stopping adb...");
OutputUtils.checkResult(RunUtils.execute(getStopCommandForAdb()));
if (SystemInfo.isUnix) {
finishProcess("emulator-arm");
finishProcess("adb");
stopDdmsProcess();
if (SystemInfo.isWindows) {
OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
}
finishProcess("emulator-arm");
}
//Only for Unix
private void stopDdmsProcess() {
GeneralCommandLine listOfEmulatorProcess = new GeneralCommandLine();
listOfEmulatorProcess.setExePath("sh");
listOfEmulatorProcess.addParameter("-c");
listOfEmulatorProcess.addParameter("ps aux | grep emulator");
RunResult runResult = RunUtils.execute(listOfEmulatorProcess);
OutputUtils.checkResult(runResult);
String pidFromPsCommand = OutputUtils.getPidFromPsCommand(runResult.getOutput());
if (pidFromPsCommand != null) {
GeneralCommandLine killCommand = new GeneralCommandLine();
killCommand.setExePath("kill");
killCommand.addParameter(pidFromPsCommand);
OutputUtils.checkResult(RunUtils.execute(killCommand));
if (SystemInfo.isUnix) {
GeneralCommandLine listOfEmulatorProcess = new GeneralCommandLine();
listOfEmulatorProcess.setExePath("sh");
listOfEmulatorProcess.addParameter("-c");
listOfEmulatorProcess.addParameter("ps aux | grep emulator");
RunResult runResult = RunUtils.execute(listOfEmulatorProcess);
OutputUtils.checkResult(runResult);
String pidFromPsCommand = OutputUtils.getPidFromPsCommand(runResult.getOutput());
if (pidFromPsCommand != null) {
GeneralCommandLine killCommand = new GeneralCommandLine();
killCommand.setExePath("kill");
killCommand.addParameter(pidFromPsCommand);
RunUtils.execute(killCommand);
}
}
}
public void finishEmulatorProcesses() {
System.out.println("Stopping adb...");
OutputUtils.checkResult(RunUtils.execute(getStopCommandForAdb()));
finishProcess("adb");
stopDdmsProcess();
}
//Only for Unix
private void finishProcess(String processName) {
GeneralCommandLine pidOfProcess = new GeneralCommandLine();
pidOfProcess.setExePath("pidof");
pidOfProcess.addParameter(processName);
RunResult runResult = RunUtils.execute(pidOfProcess);
String processIdsStr = runResult.getOutput().substring(("pidof " + processName).length());
List<String> processIds = StringUtil.getWordsIn(processIdsStr);
for (String pid : processIds) {
GeneralCommandLine killCommand = new GeneralCommandLine();
killCommand.setExePath("kill");
killCommand.addParameter(pid);
OutputUtils.checkResult(RunUtils.execute(killCommand));
if (SystemInfo.isUnix) {
GeneralCommandLine pidOfProcess = new GeneralCommandLine();
pidOfProcess.setExePath("pidof");
pidOfProcess.addParameter(processName);
RunResult runResult = RunUtils.execute(pidOfProcess);
String processIdsStr = runResult.getOutput().substring(("pidof " + processName).length());
List<String> processIds = StringUtil.getWordsIn(processIdsStr);
for (String pid : processIds) {
GeneralCommandLine killCommand = new GeneralCommandLine();
killCommand.setExePath("kill");
killCommand.addParameter(pid);
RunUtils.execute(killCommand);
}
}
}
@@ -202,5 +223,4 @@ public class Emulator {
}
OutputUtils.checkResult(RunUtils.execute(commandLineForListOfDevices));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -20,9 +20,6 @@ import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.jet.compiler.PathManager;
/**
* @author Natalia.Ukhorskaya
*/
public class PermissionManager {
private PermissionManager() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -23,11 +23,13 @@ import com.intellij.execution.process.OSProcessHandler;
import com.intellij.execution.process.ProcessAdapter;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.compiler.OutputUtils;
import org.jetbrains.jet.compiler.ThreadUtils;
import org.jetbrains.jet.compiler.run.result.RunResult;
import java.io.Closeable;
@@ -35,60 +37,81 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* @author Natalia.Ukhorskaya
*/
public class RunUtils {
private RunUtils() {
}
public static RunResult execute(final GeneralCommandLine commandLine) {
return run(commandLine, null);
public static class RunSettings {
public final GeneralCommandLine commandLine;
public final String input;
public final boolean waitForEnd;
public final String outputPrefix;
public final boolean printOutputAtAppearance;
public RunSettings(
GeneralCommandLine commandLine,
@Nullable String input,
boolean waitForEnd,
@Nullable String outputPrefix,
boolean printOutputAtAppearance
) {
this.commandLine = commandLine;
this.input = input;
this.waitForEnd = waitForEnd;
this.outputPrefix = outputPrefix;
this.printOutputAtAppearance = printOutputAtAppearance;
}
public RunSettings(GeneralCommandLine commandLine) {
this.commandLine = commandLine;
this.input = null;
this.waitForEnd = true;
this.outputPrefix = null;
this.printOutputAtAppearance = false;
}
@Override
public String toString() {
return "commandLine=" + commandLine.getCommandLineString() + " " +
"input=" + input + " " +
"waitForEnd=" + waitForEnd + " " +
"outputPrefix=" + outputPrefix + " " +
"printOutputAtAppearance=" + printOutputAtAppearance + " ";
}
}
public static RunResult execute(final GeneralCommandLine commandLine, @Nullable String input) {
return run(commandLine, input);
public static RunResult execute(@NotNull GeneralCommandLine commandLine) {
return run(new RunSettings(commandLine));
}
public static RunResult executeOnSeparateThread(final GeneralCommandLine commandLine, boolean waitForEnd) {
return executeOnSeparateThread(commandLine, waitForEnd, null);
public static RunResult execute(@NotNull RunSettings settings) {
assert settings.waitForEnd == true : "Use executeOnSeparateThread() instead";
return run(settings);
}
public static RunResult executeOnSeparateThread(final GeneralCommandLine commandLine,
boolean waitForEnd,
@Nullable final String input) {
final Ref<RunResult> resultRef = new Ref<RunResult>();
public static void executeOnSeparateThread(@NotNull final RunSettings settings) {
assert settings.waitForEnd == false : "Use execute() instead";
Thread t = new Thread(new Runnable() {
@Override
public void run() {
resultRef.set(RunUtils.run(commandLine, input));
RunUtils.run(settings);
}
});
t.start();
if (waitForEnd) {
try {
t.wait(300000);
return resultRef.get();
}
catch (InterruptedException e) {
new RunResult(false, getStackTrace(e));
}
}
return new RunResult(true, "OK");
}
private static RunResult run(final GeneralCommandLine commandLine, @Nullable final String input) {
private static RunResult run(final RunSettings settings) {
System.out.println("RUN COMMAND: " + settings);
final StringBuilder stdOut = new StringBuilder();
final StringBuilder stdErr = new StringBuilder();
final OSProcessHandler handler;
try {
handler = new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString(), Charsets.UTF_8);
if (input != null) {
handler.getProcessInput().write(input.getBytes());
handler = new OSProcessHandler(settings.commandLine.createProcess(), settings.commandLine.getCommandLineString(), Charsets.UTF_8);
if (settings.input != null) {
handler.getProcessInput().write(settings.input.getBytes());
}
close(handler.getProcessInput());
}
@@ -99,38 +122,56 @@ public class RunUtils {
return new RunResult(false, getStackTrace(e));
}
final ProcessAdapter listener = new ProcessAdapter() {
handler.addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(final ProcessEvent event, final Key outputType) {
public void processTerminated(ProcessEvent event) {
System.out.println("TERMINATED: " + settings.commandLine);
super.processTerminated(event);
}
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
String str = event.getText();
if (outputType == ProcessOutputTypes.STDOUT || outputType == ProcessOutputTypes.SYSTEM) {
stdOut.append(str);
if (!commandLine.getCommandLineString().contains("install")) {
System.out.print(str);
}
appendToContent(stdOut, str);
}
else if (outputType == ProcessOutputTypes.STDERR) {
stdErr.append(str);
System.err.print(str);
appendToContent(stdErr, str);
}
}
};
handler.addProcessListener(listener);
private synchronized void appendToContent(StringBuilder content, String line) {
if (settings.printOutputAtAppearance) {
System.out.println(getPrefixString() + StringUtil.trimTrailing(line));
System.out.flush();
}
else {
content.append(getPrefixString());
content.append(StringUtil.trimTrailing(line));
content.append("\n");
}
}
private String getPrefixString() {
return (settings.outputPrefix != null) ? settings.outputPrefix + " " : "";
}
});
handler.startNotify();
try {
handler.waitFor(300000);
}
catch (ProcessCanceledException e) {
return new RunResult(false, getStackTrace(e));
}
if (settings.waitForEnd) {
handler.waitFor(400000);
if (!handler.isProcessTerminated()) {
return new RunResult(false, "Timeout exception: execution was terminated after 5 min.");
if (!handler.isProcessTerminated()) {
System.out.println("Output before handler.isProcessTerminated() " + settings.commandLine);
System.out.println(stdOut);
System.err.println(stdErr);
return new RunResult(false, "Timeout exception: execution was terminated after ~7 min.");
}
}
else {
handler.waitFor();
}
handler.removeProcessListener(listener);
int exitCode = handler.getProcess().exitValue();
@@ -142,6 +183,9 @@ public class RunUtils {
if (OutputUtils.isBuildFailed(output)) {
return new RunResult(false, output);
}
if (!settings.commandLine.getCommandLineString().contains("install")) {
System.out.print(output);
}
return new RunResult(true, output);
}
}
@@ -174,5 +218,5 @@ public class RunUtils {
}
return writer.toString();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -16,9 +16,6 @@
package org.jetbrains.jet.compiler.run.result;
/**
* @author Natalia.Ukhorskaya
*/
public class RunResult {
private final boolean status;

View File

@@ -0,0 +1,60 @@
/*
* Copyright 2010-2013 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.jet.compiler.android;
import org.jetbrains.jps.builders.JpsBuildTestCase;
import java.io.File;
import java.io.IOException;
public class AndroidJpsBuildTestCase extends JpsBuildTestCase {
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();
rebuildAll();
makeAll().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,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -19,35 +19,43 @@ package org.jetbrains.jet.compiler.android;
import com.google.common.io.Files;
import com.intellij.openapi.util.io.FileUtil;
import junit.framework.TestSuite;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.compiler.CodegenTestsOnAndroidRunner;
import org.jetbrains.jet.compiler.PathManager;
import java.io.File;
/**
* @author Natalia.Ukhorskaya
*/
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 {
File tmpFolder = Files.createTempDir();
System.out.println("Created temporary folder for running android tests: " + tmpFolder.getAbsolutePath());
File rootFolder = new File("");
PathManager pathManager = new PathManager(rootFolder.getAbsolutePath(), tmpFolder.getAbsolutePath());
PathManager pathManager = getPathManager();
FileUtil.copyDir(new File(pathManager.getAndroidModuleRoot()), new File(pathManager.getTmpFolder()));
try {
CodegenTestsOnAndroidGenerator.generate(pathManager);
}
catch(Throwable e) {
FileUtil.delete(new File(pathManager.getTmpFolder()));
throw new RuntimeException(e);
}
CodegenTestsOnAndroidGenerator.generate(pathManager);
System.out.println("Run tests on android...");
return CodegenTestsOnAndroidRunner.getTestSuite(pathManager);
TestSuite suite = CodegenTestsOnAndroidRunner.getTestSuite(pathManager);
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()));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -21,7 +21,6 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.UsefulTestCase;
import junit.framework.Assert;
import org.jetbrains.jet.CompileCompilerDependenciesTest;
import org.jetbrains.jet.ConfigurationKind;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.TestJdkKind;
@@ -37,14 +36,10 @@ import org.jetbrains.jet.utils.Printer;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author Natalia.Ukhorskaya
*/
public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
@@ -57,8 +52,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
private JetCoreEnvironment environmentWithMockJdk = JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable, ConfigurationKind.JDK_AND_ANNOTATIONS);
private JetCoreEnvironment environmentWithFullJdk = JetTestUtils.createEnvironmentWithFullJdk(myTestRootDisposable);
private JetCoreEnvironment environmentWithFullJdkAndJUnit;
private final Pattern packagePattern = Pattern.compile("package (.*)");
private final List<String> generatedTestNames = Lists.newArrayList();
@@ -69,16 +63,6 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
private CodegenTestsOnAndroidGenerator(PathManager pathManager) {
this.pathManager = pathManager;
File junitJar = new File("libraries/lib/junit-4.9.jar");
if (!junitJar.exists()) {
throw new AssertionError();
}
environmentWithFullJdkAndJUnit = new JetCoreEnvironment(myTestRootDisposable, CompileCompilerDependenciesTest.compilerConfigurationForTests(
ConfigurationKind.ALL, TestJdkKind.FULL_JDK, JetTestUtils.getAnnotationsJar(), junitJar));
}
private void generateOutputFiles() throws Throwable {
@@ -135,8 +119,6 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
Assert.assertNotNull("Folder with testData is empty: " + dir.getAbsolutePath(), files);
Set<String> excludedFiles = SpecialFiles.getExcludedFiles();
Set<String> filesCompiledWithoutStdLib = SpecialFiles.getFilesCompiledWithoutStdLib();
Set<String> filesCompiledWithJUnit = SpecialFiles.getFilesCompiledWithJUnit();
Map<String, String> filesWithSpecialResult = SpecialFiles.getFilesWithSpecialResult();
for (File file : files) {
if (excludedFiles.contains(file.getName())) {
continue;
@@ -155,21 +137,11 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
if (filesCompiledWithoutStdLib.contains(file.getName())) {
factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithMockJdk);
}
else if (filesCompiledWithJUnit.contains(file.getName())) {
factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithFullJdkAndJUnit);
}
else {
factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithFullJdk);
}
String specialResult = filesWithSpecialResult.get(file.getName());
if (specialResult != null) {
generateTestMethodWithExpectedResult(p, generatedTestName, StringUtil.escapeStringCharacters(file.getPath()),
specialResult);
}
else {
generateTestMethod(p, generatedTestName, StringUtil.escapeStringCharacters(file.getPath()));
}
generateTestMethod(p, generatedTestName, StringUtil.escapeStringCharacters(file.getPath()));
File outputDir = new File(pathManager.getOutputForCompiledFiles());
if (!outputDir.exists()) {
outputDir.mkdirs();
@@ -208,19 +180,15 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
}
}
private static void generateTestMethodWithExpectedResult(Printer p, String testName, String namespace, String expectedResult) {
private static void generateTestMethod(Printer p, String testName, String namespace) {
p.println("public void test" + testName + "() throws Exception {");
p.pushIndent();
p.println("invokeBoxMethod(\"" + namespace + "\", \"" + expectedResult + "\");");
p.println("invokeBoxMethod(\"" + namespace + "\", \"OK\");");
p.popIndent();
p.println("}");
p.println();
}
private static void generateTestMethod(Printer p, String testName, String namespace) {
generateTestMethodWithExpectedResult(p, testName, namespace, "OK");
}
private String generateTestName(String fileName) {
String result = FileUtil.getNameWithoutExtension(StringUtil.capitalize(fileName));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -16,34 +16,21 @@
package org.jetbrains.jet.compiler.android;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import java.util.Map;
import java.util.Set;
/**
* @author Natalia.Ukhorskaya
*/
public class SpecialFiles {
private static final Set<String> excludedFiles = Sets.newHashSet();
private static final Set<String> filesCompiledWithoutStdLib = Sets.newHashSet();
private static final Set<String> filesCompiledWithJUnit = Sets.newHashSet();
private static final Map<String, String> filesWithSpecialResult = Maps.newHashMap();
static {
fillExcludedFiles();
fillFilesCompiledWithoutStdLib();
fillFilesCompiledWithJUnit();
fillFilesWithSpecialResult();
}
public static Set<String> getFilesCompiledWithJUnit() {
return filesCompiledWithJUnit;
}
public static Set<String> getExcludedFiles() {
return excludedFiles;
}
@@ -52,82 +39,39 @@ public class SpecialFiles {
return filesCompiledWithoutStdLib;
}
public static Map<String, String> getFilesWithSpecialResult() {
return filesWithSpecialResult;
}
private static void fillFilesWithSpecialResult() {
filesWithSpecialResult.put("kt2398.kt", "OKKO");
}
private static void fillFilesCompiledWithJUnit() {
filesCompiledWithJUnit.add("kt2334.kt");
}
private static void fillFilesCompiledWithoutStdLib() {
filesCompiledWithoutStdLib.add("kt1980.kt");
filesCompiledWithoutStdLib.add("kt1953_class.kt"); // Exception in code
filesCompiledWithoutStdLib.add("basicmethodSuperClass.jet"); // Exception in code
filesCompiledWithoutStdLib.add("kt503.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt504.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt772.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt773.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt796_797.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt950.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("basicmethodSuperClass.kt"); // Exception in code
filesCompiledWithoutStdLib.add("kt503.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt504.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt772.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt773.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt796_797.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt950.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
filesCompiledWithoutStdLib.add("kt2395.kt"); // With MOCK_JDK
}
private static void fillExcludedFiles() {
excludedFiles.add("kt2781.kt"); // Must compile Java files before
excludedFiles.add("simpleJavaInnerEnum.kt"); // Must compile Java files before
excludedFiles.add("referencesStaticInnerClassMethod.kt"); // Must compile Java files before
excludedFiles.add("referencesStaticInnerClassMethodL2.kt"); // Must compile Java files before
excludedFiles.add("simpleJavaEnum.kt"); // Must compile Java files before
excludedFiles.add("simpleJavaEnumWithFunction.kt"); // Must compile Java files before
excludedFiles.add("simpleJavaEnumWithStaticImport.kt"); // Must compile Java files before
excludedFiles.add("removeInIterator.kt"); // Must compile Java files before
excludedFiles.add("namespaceQualifiedMethod.jet"); // Cannot change package name
excludedFiles.add("kt1482_2279.kt"); // Cannot change package name
excludedFiles.add("kt1482.kt"); // Cannot change package name
excludedFiles.add("importFromClassObject.jet"); // Cannot find usages in Codegen tests
excludedFiles.add("withtypeparams.jet"); // Cannot find usages in Codegen tests
excludedFiles.add("kt1113.kt"); // Commented
excludedFiles.add("kt326.jet"); // Commented
excludedFiles.add("kt694.jet"); // Commented
excludedFiles.add("kt285.jet"); // Commented
excludedFiles.add("kt857.jet"); // Commented
excludedFiles.add("kt1120.kt"); // Commented
excludedFiles.add("boxWithJava"); // Must compile Java files before
excludedFiles.add("boxMultiFile"); // MultiFileTest not supported yet
excludedFiles.add("kt3238.kt"); // Reflection
excludedFiles.add("kt1482_2279.kt"); // Reflection
excludedFiles.add("nestedInPackage.kt"); // Cannot change package name
excludedFiles.add("importNestedClass.kt"); // Cannot change package name
excludedFiles.add("namespaceQualifiedMethod.kt"); // Cannot change package name
excludedFiles.add("kt326.kt"); // Commented
excludedFiles.add("kt1213.kt"); // Commented
excludedFiles.add("kt882.jet"); // Commented
excludedFiles.add("kt789.jet"); // Commented
excludedFiles.add("enum.kt"); // Commented
excludedFiles.add("withclosure.kt"); // Commented
excludedFiles.add("isTypeParameter.jet"); // Commented
excludedFiles.add("nullability.jet"); // Commented
excludedFiles.add("genericFunction.jet"); // Commented
excludedFiles.add("forwardTypeParameter.jet"); // Commented
excludedFiles.add("kt259.jet"); // Commented
excludedFiles.add("classObjectMethod.jet"); // Commented
excludedFiles.add("inRangeConditionsInWhen.jet"); // Commented
excludedFiles.add("kt1592.kt"); // Codegen don't execute blackBoxFile() on it
excludedFiles.add("box.kt"); // MultiFileTest not supported yet
excludedFiles.add("kt2060_1.kt"); // MultiFileTest not supported yet
excludedFiles.add("kt2257_1.kt"); // MultiFileTest not supported yet
excludedFiles.add("kt1528_1.kt"); // MultiFileTest not supported yet
excludedFiles.add("thisPackage.kt"); // MultiFileTest not supported yet
excludedFiles.add("kt684.kt"); // StackOverflow with StringBuilder (escape())
excludedFiles.add("kt684.jet"); // StackOverflow with StringBuilder (escape())
excludedFiles.add("kt344.jet"); // Bug KT-2251
excludedFiles.add("kt529.kt"); // Bug
excludedFiles.add("kt344.kt"); // Bug
excludedFiles.add("noClassObjectForJavaClass.kt");
excludedFiles.add("doGenerateAssertions.kt"); // Multi-file + Java
excludedFiles.add("doNotGenerateAssertions.kt"); // Multi-file + Java
excludedFiles.add("doGenerateParamAssertions.kt"); // Java
excludedFiles.add("comparisonWithNullCallsFun.kt"); // java.lang.NoClassDefFoundError: jet.Nothing
}
private SpecialFiles() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -18,6 +18,7 @@ package org.jetbrains.jet.codegen;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.name.Name;
@@ -25,9 +26,6 @@ import java.util.Collections;
import static org.jetbrains.jet.lang.descriptors.ReceiverParameterDescriptor.NO_RECEIVER_PARAMETER;
/**
* @author alex.tkachman
*/
public class AccessorForFunctionDescriptor extends SimpleFunctionDescriptorImpl {
public AccessorForFunctionDescriptor(DeclarationDescriptor descriptor, DeclarationDescriptor containingDeclaration, int index) {
super(containingDeclaration, Collections.<AnnotationDescriptor>emptyList(),

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -18,16 +18,17 @@ package org.jetbrains.jet.codegen;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.PropertyDescriptorImpl;
import org.jetbrains.jet.lang.descriptors.impl.PropertyGetterDescriptorImpl;
import org.jetbrains.jet.lang.descriptors.impl.PropertySetterDescriptorImpl;
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.types.JetType;
import java.util.Collections;
/**
* @author alex.tkachman
*/
public class AccessorForPropertyDescriptor extends PropertyDescriptor {
public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl {
public AccessorForPropertyDescriptor(PropertyDescriptor pd, DeclarationDescriptor containingDeclaration, int index) {
super(containingDeclaration, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibilities.PUBLIC,
pd.isVar(), Name.identifier(pd.getName() + "$b$" + index),
@@ -38,7 +39,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptor {
initialize(new Getter(this), new Setter(this));
}
public static class Getter extends PropertyGetterDescriptor {
public static class Getter extends PropertyGetterDescriptorImpl {
public Getter(AccessorForPropertyDescriptor property) {
super(property, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibilities.PUBLIC,
false,
@@ -47,7 +48,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptor {
}
}
public static class Setter extends PropertySetterDescriptor {
public static class Setter extends PropertySetterDescriptorImpl {
public Setter(AccessorForPropertyDescriptor property) {
super(property, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibilities.PUBLIC,
false,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -43,9 +43,6 @@ import java.util.Map;
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDeclaration;
/**
* @author alex.tkachman
*/
public abstract class AnnotationCodegen {
private final JetTypeMapper typeMapper;
private final BindingContext bindingContext;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -31,6 +31,7 @@ import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.codegen.state.JetTypeMapper;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver;
@@ -46,12 +47,10 @@ import java.util.Set;
import static org.jetbrains.asm4.Opcodes.*;
import static org.jetbrains.jet.codegen.CodegenUtil.isInterface;
import static org.jetbrains.jet.codegen.CodegenUtil.isNullableType;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isClassObject;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.JAVA_STRING_TYPE;
/**
* @author alex.tkachman
*/
public class AsmUtil {
private static final Set<ClassDescriptor> PRIMITIVE_NUMBER_CLASSES = Sets.newHashSet(
KotlinBuiltIns.getInstance().getByte(),
@@ -70,6 +69,8 @@ public class AsmUtil {
private static final Map<Visibility, Integer> visibilityToAccessFlag = ImmutableMap.<Visibility, Integer>builder()
.put(Visibilities.PRIVATE, ACC_PRIVATE)
.put(Visibilities.PROTECTED, ACC_PROTECTED)
.put(JavaDescriptorResolver.PROTECTED_STATIC_VISIBILITY, ACC_PROTECTED)
.put(JavaDescriptorResolver.PROTECTED_AND_PACKAGE, ACC_PROTECTED)
.put(Visibilities.PUBLIC, ACC_PUBLIC)
.put(Visibilities.INTERNAL, ACC_PUBLIC)
.put(Visibilities.LOCAL, NO_FLAG_LOCAL)
@@ -130,6 +131,51 @@ public class AsmUtil {
}
}
public static boolean isAbstract(FunctionDescriptor functionDescriptor, OwnerKind kind) {
return (functionDescriptor.getModality() == Modality.ABSTRACT
|| isInterface(functionDescriptor.getContainingDeclaration()))
&& !isStatic(kind)
&& kind != OwnerKind.TRAIT_IMPL;
}
public static boolean isStatic(OwnerKind kind) {
return kind == OwnerKind.NAMESPACE || kind instanceof OwnerKind.StaticDelegateKind;
}
public static int getMethodAsmFlags(FunctionDescriptor functionDescriptor, OwnerKind kind) {
boolean isStatic = isStatic(kind);
boolean isAbstract = isAbstract(functionDescriptor, kind);
int flags = getCommonCallableFlags(functionDescriptor);
if (functionDescriptor.getModality() == Modality.FINAL) {
DeclarationDescriptor containingDeclaration = functionDescriptor.getContainingDeclaration();
if (!(containingDeclaration instanceof ClassDescriptor) ||
((ClassDescriptor) containingDeclaration).getKind() != ClassKind.TRAIT) {
flags |= ACC_FINAL;
}
}
if (isStatic || kind == OwnerKind.TRAIT_IMPL) {
flags |= ACC_STATIC;
}
if (isAbstract) flags |= ACC_ABSTRACT;
return flags;
}
public static int getConstructorAsmFlags(FunctionDescriptor functionDescriptor) {
return getCommonCallableFlags(functionDescriptor);
}
private static int getCommonCallableFlags(FunctionDescriptor functionDescriptor) {
int flags = getVisibilityAccessFlag(functionDescriptor);
flags |= getVarargsFlag(functionDescriptor);
flags |= getDeprecatedAccessFlag(functionDescriptor);
return flags;
}
//TODO: move mapping logic to front-end java
public static int getVisibilityAccessFlag(@NotNull MemberDescriptor descriptor) {
Integer specialCase = specialCaseVisibility(descriptor);
@@ -143,6 +189,20 @@ public class AsmUtil {
return defaultMapping;
}
/*
Use this method to get visibility flag for class to define it in byte code (v.defineClass method).
For other cases use getVisibilityAccessFlag(MemberDescriptor descriptor)
Classes in byte code should be public or package private
*/
public static int getVisibilityAccessFlagForClass(ClassDescriptor descriptor) {
if (DescriptorUtils.isTopLevelDeclaration(descriptor) ||
descriptor.getVisibility() == Visibilities.PUBLIC ||
descriptor.getVisibility() == Visibilities.INTERNAL) {
return ACC_PUBLIC;
}
return NO_FLAG_PACKAGE_PRIVATE;
}
public static int getModalityAccessFlag(@NotNull MemberDescriptor descriptor) {
switch (descriptor.getModality()) {
case ABSTRACT: return ACC_ABSTRACT;
@@ -164,6 +224,15 @@ public class AsmUtil {
return 0;
}
private static int getVarargsFlag(FunctionDescriptor functionDescriptor) {
if (!functionDescriptor.getValueParameters().isEmpty()
&& functionDescriptor.getValueParameters().get(functionDescriptor.getValueParameters().size() - 1)
.getVarargElementType() != null) {
return ACC_VARARGS;
}
return 0;
}
@Nullable
private static Integer specialCaseVisibility(@NotNull MemberDescriptor memberDescriptor) {
DeclarationDescriptor containingDeclaration = memberDescriptor.getContainingDeclaration();
@@ -193,7 +262,7 @@ public class AsmUtil {
return ACC_PROTECTED;
}
}
if (containingDeclaration instanceof NamespaceDescriptor) {
if (DescriptorUtils.isTopLevelDeclaration(memberDescriptor)) {
return ACC_PUBLIC;
}
return null;
@@ -224,7 +293,7 @@ public class AsmUtil {
public static void genClosureFields(CalculatedClosure closure, ClassBuilder v, JetTypeMapper typeMapper) {
final ClassifierDescriptor captureThis = closure.getCaptureThis();
final int access = ACC_PUBLIC | ACC_SYNTHETIC | ACC_FINAL;
final int access = NO_FLAG_PACKAGE_PRIVATE | ACC_SYNTHETIC | ACC_FINAL;
if (captureThis != null) {
v.newField(null, access, CAPTURED_THIS_FIELD, typeMapper.mapType(captureThis).getDescriptor(), null,
null);
@@ -243,10 +312,18 @@ public class AsmUtil {
}
public static void genInitSingletonField(Type classAsmType, InstructionAdapter iv) {
iv.anew(classAsmType);
genInitSingletonField(classAsmType, JvmAbi.INSTANCE_FIELD, classAsmType, iv);
}
public static void genInitSingletonField(FieldInfo info, InstructionAdapter iv) {
genInitSingletonField(info.getOwnerType(), info.getFieldName(), info.getFieldType(), iv);
}
public static void genInitSingletonField(Type fieldOwnerType, String fieldName, Type fieldAsmType, InstructionAdapter iv) {
iv.anew(fieldAsmType);
iv.dup();
iv.invokespecial(classAsmType.getInternalName(), "<init>", "()V");
iv.putstatic(classAsmType.getInternalName(), JvmAbi.INSTANCE_FIELD, classAsmType.getDescriptor());
iv.invokespecial(fieldAsmType.getInternalName(), "<init>", "()V");
iv.putstatic(fieldOwnerType.getInternalName(), fieldName, fieldAsmType.getDescriptor());
}
public static void genStringBuilderConstructor(InstructionAdapter v) {
@@ -311,75 +388,6 @@ public class AsmUtil {
mv.visitInsn(L2I);
}
static StackValue compareExpressionsOnStack(InstructionAdapter v, IElementType opToken, Type operandType) {
if (operandType.getSort() == Type.OBJECT) {
v.invokeinterface("java/lang/Comparable", "compareTo", "(Ljava/lang/Object;)I");
v.iconst(0);
operandType = Type.INT_TYPE;
}
return StackValue.cmp(opToken, operandType);
}
static StackValue genNullSafeEquals(
InstructionAdapter v,
IElementType opToken,
boolean leftNullable,
boolean rightNullable
) {
if (!leftNullable) {
v.invokevirtual("java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
if (opToken == JetTokens.EXCLEQ) {
genInvertBoolean(v);
}
}
else {
if (rightNullable) {
v.dup2(); // left right left right
Label rightNull = new Label();
v.ifnull(rightNull);
Label leftNull = new Label();
v.ifnull(leftNull);
v.invokevirtual("java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
if (opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ) {
genInvertBoolean(v);
}
Label end = new Label();
v.goTo(end);
v.mark(rightNull);
// left right left
Label bothNull = new Label();
v.ifnull(bothNull);
v.mark(leftNull);
v.pop2();
v.iconst(opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ ? 1 : 0);
v.goTo(end);
v.mark(bothNull);
v.pop2();
v.iconst(opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ ? 0 : 1);
v.mark(end);
}
else {
v.dup2(); // left right left right
v.pop();
Label leftNull = new Label();
v.ifnull(leftNull);
v.invokevirtual("java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
if (opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ) {
genInvertBoolean(v);
}
Label end = new Label();
v.goTo(end);
// left right
v.mark(leftNull);
v.pop2();
v.iconst(opToken == JetTokens.EXCLEQ ? 1 : 0);
v.mark(end);
}
}
return StackValue.onStack(Type.BOOLEAN_TYPE);
}
static void genInvertBoolean(InstructionAdapter v) {
v.iconst(1);
v.xor(Type.INT_TYPE);
@@ -389,19 +397,23 @@ public class AsmUtil {
InstructionAdapter v,
IElementType opToken,
Type leftType,
Type rightType,
boolean leftNullable,
boolean rightNullable
Type rightType
) {
if ((isNumberPrimitive(leftType) || leftType.getSort() == Type.BOOLEAN) && leftType == rightType) {
return compareExpressionsOnStack(v, opToken, leftType);
return StackValue.cmp(opToken, leftType);
}
else {
if (opToken == JetTokens.EQEQEQ || opToken == JetTokens.EXCLEQEQEQ) {
return StackValue.cmp(opToken, leftType);
}
else {
return genNullSafeEquals(v, opToken, leftNullable, rightNullable);
v.invokestatic("jet/runtime/Intrinsics", "areEqual", "(Ljava/lang/Object;Ljava/lang/Object;)Z");
if (opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ) {
genInvertBoolean(v);
}
return StackValue.onStack(Type.BOOLEAN_TYPE);
}
}
}
@@ -443,6 +455,24 @@ public class AsmUtil {
genMethodThrow(mv, STUB_EXCEPTION, STUB_EXCEPTION_MESSAGE);
}
public static void swap(InstructionAdapter v, Type stackTop, Type afterTop) {
if (stackTop.getSize() == 1) {
if (afterTop.getSize() == 1) {
v.swap();
} else {
v.dupX2();
v.pop();
}
} else {
if (afterTop.getSize() == 1) {
v.dup2X1();
} else {
v.dup2X2();
}
v.pop2();
}
}
public static void genNotNullAssertionsForParameters(
@NotNull InstructionAdapter v,
@NotNull GenerationState state,
@@ -456,7 +486,7 @@ public class AsmUtil {
for (ValueParameterDescriptor parameter : descriptor.getValueParameters()) {
JetType type = parameter.getReturnType();
if (type == null || type.isNullable()) continue;
if (type == null || isNullableType(type)) continue;
int index = frameMap.getIndex(parameter);
Type asmType = state.getTypeMapper().mapReturnType(type);
@@ -495,10 +525,10 @@ public class AsmUtil {
) {
if (!state.isGenerateNotNullAssertions()) return;
if (!Boolean.TRUE.equals(state.getBindingContext().get(BindingContext.IS_DECLARED_IN_JAVA, descriptor))) return;
if (!isDeclaredInJava(descriptor, state.getBindingContext())) return;
JetType type = descriptor.getReturnType();
if (type == null || type.isNullable()) return;
if (type == null || isNullableType(type)) return;
Type asmType = state.getTypeMapper().mapReturnType(type);
if (asmType.getSort() == Type.OBJECT || asmType.getSort() == Type.ARRAY) {
@@ -508,4 +538,48 @@ public class AsmUtil {
v.invokestatic("jet/runtime/Intrinsics", assertMethodToCall, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V");
}
}
private static boolean isDeclaredInJava(@NotNull CallableDescriptor callableDescriptor, @NotNull BindingContext context) {
CallableDescriptor descriptor = callableDescriptor;
while (true) {
if (Boolean.TRUE.equals(context.get(BindingContext.IS_DECLARED_IN_JAVA, descriptor))) {
return true;
}
CallableDescriptor original = descriptor.getOriginal();
if (descriptor == original) break;
descriptor = original;
}
return false;
}
public static void pushDefaultValueOnStack(@NotNull Type type, @NotNull InstructionAdapter v) {
if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
v.aconst(null);
}
else {
pushDefaultPrimitiveValueOnStack(type, v);
}
}
public static void pushDefaultPrimitiveValueOnStack(@NotNull Type type, @NotNull InstructionAdapter v) {
if (type.getSort() == Type.FLOAT) {
v.fconst(0);
}
else if (type.getSort() == Type.DOUBLE) {
v.dconst(0);
}
else if (type.getSort() == Type.LONG) {
v.lconst(0);
}
else {
v.iconst(0);
}
}
public static Type comparisonOperandType(Type left, Type right) {
if (left == Type.DOUBLE_TYPE || right == Type.DOUBLE_TYPE) return Type.DOUBLE_TYPE;
if (left == Type.FLOAT_TYPE || right == Type.FLOAT_TYPE) return Type.FLOAT_TYPE;
if (left == Type.LONG_TYPE || right == Type.LONG_TYPE) return Type.LONG_TYPE;
return Type.INT_TYPE;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -20,9 +20,6 @@ package org.jetbrains.jet.codegen;
* Marks if backend's JetTypeMapper should map built-in types to Java types (e.g., jet.String into java.lang.String).
* Disabling is needed for compiling builtins: we want types to be jet.* instead of java.util* to make it possible to load
* builtins without JDK.
*
* @author Evgeny Gerashchenko
* @since 7/5/12
*/
public enum BuiltinToJavaTypesMapping {
ENABLED,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -16,8 +16,5 @@
package org.jetbrains.jet.codegen;
/**
* @author yole
*/
public interface Callable {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -32,10 +32,6 @@ import java.util.List;
import static org.jetbrains.asm4.Opcodes.INVOKESPECIAL;
import static org.jetbrains.asm4.Opcodes.INVOKESTATIC;
/**
* @author yole
* @author alex.tkacman
*/
public class CallableMethod implements Callable {
@NotNull
private final JvmClassName owner;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -35,10 +35,6 @@ import java.util.List;
import static org.jetbrains.asm4.Opcodes.*;
import static org.jetbrains.jet.codegen.AsmUtil.*;
/**
* @author max
* @author yole
*/
public abstract class ClassBodyCodegen extends MemberCodegen {
protected final JetClassOrObject myClass;
protected final OwnerKind kind;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/*
* @author max
*/
package org.jetbrains.jet.codegen;
import com.intellij.psi.PsiElement;
@@ -81,7 +78,7 @@ public abstract class ClassBuilder {
String superName,
String[] interfaces
) {
getVisitor().visit(version, access & ~Opcodes.ACC_STATIC, name, signature, superName, interfaces);
getVisitor().visit(version, access, name, signature, superName, interfaces);
}
public void visitSource(String name, @Nullable String debug) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -23,9 +23,6 @@ import org.jetbrains.asm4.util.TraceClassVisitor;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* @author Stepan Koltsov
*/
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
public class ClassBuilderFactories {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -18,9 +18,6 @@ package org.jetbrains.jet.codegen;
import org.jetbrains.annotations.NotNull;
/**
* @author max
*/
public interface ClassBuilderFactory {
@NotNull
ClassBuilderMode getClassBuilderMode();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -16,9 +16,6 @@
package org.jetbrains.jet.codegen;
/**
* @author Stepan Koltsov
*/
public enum ClassBuilderMode {
/**
* Full function bodies

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -21,9 +21,6 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author Stepan Koltsov
*/
public abstract class ClassBuilderOnDemand {
private ClassBuilder classBuilder;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -25,6 +25,7 @@ import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.codegen.state.GenerationStateAware;
import org.jetbrains.jet.codegen.state.JetTypeMapperMode;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.SubModuleDescriptor;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.name.FqName;
@@ -34,10 +35,6 @@ import java.util.*;
import static org.jetbrains.jet.codegen.AsmUtil.isPrimitive;
/**
* @author max
* @author alex.tkachman
*/
public final class ClassFileFactory extends GenerationStateAware {
@NotNull private ClassBuilderFactory builderFactory;
@@ -118,13 +115,25 @@ public final class ClassFileFactory extends GenerationStateAware {
);
}
};
codegen = new NamespaceCodegen(onDemand, fqName, state, files);
codegen = new NamespaceCodegen(onDemand, getSubModule(files), fqName, state, files);
ns2codegen.put(fqName, codegen);
}
return codegen;
}
private SubModuleDescriptor getSubModule(Collection<JetFile> files) {
assert !files.isEmpty() : "Don't generate namespaces from no files";
SubModuleDescriptor subModule = state.getModuleSourcesManager().getSubModuleForFile(files.iterator().next());
for (JetFile file : files) {
SubModuleDescriptor fileSubModule = state.getModuleSourcesManager().getSubModuleForFile(file);
assert fileSubModule.equals(subModule)
: "Attempt to generate namespace from files originating from different sub-modules: " +
fileSubModule + " != " + subModule;
}
return subModule;
}
public ClassBuilder forClassImplementation(ClassDescriptor aClass, PsiFile sourceFile) {
Type type = state.getTypeMapper().mapType(aClass.getDefaultType(), JetTypeMapperMode.IMPL);
if (isPrimitive(type)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -14,10 +14,6 @@
* limitations under the License.
*/
/*
* @author max
* @author alex.tkachman
*/
package org.jetbrains.jet.codegen;
import com.intellij.openapi.util.Pair;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -18,9 +18,6 @@ package org.jetbrains.jet.codegen;
import org.jetbrains.asm4.commons.InstructionAdapter;
/**
* @author yole
*/
public interface CodeChunk {
void generate(InstructionAdapter v);
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright 2010-2013 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.jet.codegen;
import org.jetbrains.jet.lang.psi.*;
public class CodegenStatementVisitor extends JetVisitor<StackValue, StackValue> {
private final ExpressionCodegen codegen;
public CodegenStatementVisitor(ExpressionCodegen codegen) {
this.codegen = codegen;
}
@Override
public StackValue visitJetElement(JetElement element, StackValue receiver) {
return element.accept(codegen, receiver);
}
@Override
public StackValue visitIfExpression(JetIfExpression expression, StackValue receiver) {
return codegen.generateIfExpression(expression, true);
}
@Override
public StackValue visitTryExpression(JetTryExpression expression, StackValue data) {
return codegen.generateTryExpression(expression, true);
}
@Override
public StackValue visitWhenExpression(JetWhenExpression expression, StackValue data) {
return codegen.generateWhenExpression(expression, true);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -17,7 +17,9 @@
package org.jetbrains.jet.codegen;
import com.google.common.collect.ImmutableList;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.PsiElement;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Stack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -29,6 +31,8 @@ import org.jetbrains.jet.codegen.signature.JvmMethodParameterKind;
import org.jetbrains.jet.codegen.signature.JvmMethodSignature;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
import org.jetbrains.jet.lang.psi.JetClassObject;
import org.jetbrains.jet.lang.psi.JetClassOrObject;
import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
@@ -39,16 +43,14 @@ import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.TypeUtils;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import java.util.*;
import static org.jetbrains.jet.lang.descriptors.Modality.ABSTRACT;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
/**
* @author abreslav
* @author alex.tkachman
*/
public class CodegenUtil {
private CodegenUtil() {
@@ -267,4 +269,31 @@ public class CodegenUtil {
(context.getParentContext() instanceof NamespaceContext && context.getParentContext().getContextDescriptor() == containingDeclaration))
&& context.getContextKind() != OwnerKind.TRAIT_IMPL);
}
public static boolean hasAbstractMembers(@NotNull ClassDescriptor classDescriptor) {
return ContainerUtil.exists(classDescriptor.getDefaultType().getMemberScope().getAllDescriptors(),
new Condition<DeclarationDescriptor>() {
@Override
public boolean value(DeclarationDescriptor declaration) {
if (!(declaration instanceof MemberDescriptor)) {
return false;
}
return ((MemberDescriptor) declaration).getModality() == ABSTRACT;
}
});
}
/**
* A work-around of the generic nullability problem in the type checker
* @return true if a value of this type can be null
*/
public static boolean isNullableType(@NotNull JetType type) {
if (type.isNullable()) {
return true;
}
if (type.getConstructor().getDeclarationDescriptor() instanceof TypeParameterDescriptor) {
return TypeUtils.hasNullableSuperType(type);
}
return false;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -16,9 +16,6 @@
package org.jetbrains.jet.codegen;
/**
* @author abreslav
*/
public interface CompilationErrorHandler {
CompilationErrorHandler THROW_EXCEPTION = new CompilationErrorHandler() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -23,10 +23,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
/**
* @author alex.tkachman
* @author abreslav
*/
public class CompilationException extends RuntimeException {
private final PsiElement element;
@@ -64,6 +60,7 @@ public class CompilationException extends RuntimeException {
message.append("Cause: ").append(causeMessage == null ? cause.toString() : causeMessage).append("\n");
}
message.append("File being compiled and position: ").append(DiagnosticUtils.atLocation(element)).append("\n");
message.append("PsiElement: ").append(element.getText()).append("\n");
message.append("The root cause was thrown at: ").append(where());
return message.toString();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -28,10 +28,6 @@ import java.util.List;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
/**
* @author yole
* @author alex.tkachman
*/
public class ConstructorFrameMap extends FrameMap {
private int myOuterThisIndex = -1;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2010-2013 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.jet.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.asm4.Type;
import org.jetbrains.jet.codegen.state.JetTypeMapper;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.ClassKind;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
public class FieldInfo {
private final Type fieldType;
private final Type ownerType;
private final String fieldName;
private FieldInfo(@NotNull Type ownerType, @NotNull Type fieldType, @NotNull String fieldName) {
this.ownerType = ownerType;
this.fieldType = fieldType;
this.fieldName = fieldName;
}
@NotNull
public Type getFieldType() {
return fieldType;
}
@NotNull
public Type getOwnerType() {
return ownerType;
}
@NotNull
public String getOwnerInternalName() {
return ownerType.getInternalName();
}
@NotNull
public String getFieldName() {
return fieldName;
}
@NotNull
public static FieldInfo createForSingleton(@NotNull ClassDescriptor fieldClassDescriptor, @NotNull JetTypeMapper typeMapper) {
ClassKind kind = fieldClassDescriptor.getKind();
if (kind != ClassKind.OBJECT && kind != ClassKind.CLASS_OBJECT && kind != ClassKind.ENUM_ENTRY) {
throw new UnsupportedOperationException();
}
Type fieldType = typeMapper.mapType(fieldClassDescriptor.getDefaultType());
ClassDescriptor ownerDescriptor = kind == ClassKind.OBJECT
? fieldClassDescriptor: DescriptorUtils.getParentOfType(fieldClassDescriptor, ClassDescriptor.class);
assert ownerDescriptor != null;
Type ownerType = typeMapper.mapType(ownerDescriptor.getDefaultType());
String fieldName = kind == ClassKind.ENUM_ENTRY
? fieldClassDescriptor.getName().getName()
: fieldClassDescriptor.getKind() == ClassKind.CLASS_OBJECT ? JvmAbi.CLASS_OBJECT_FIELD : JvmAbi.INSTANCE_FIELD;
return new FieldInfo(ownerType, fieldType, fieldName);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -27,9 +27,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* @author max
*/
public class FrameMap {
private final TObjectIntHashMap<DeclarationDescriptor> myVarIndex = new TObjectIntHashMap<DeclarationDescriptor>();
private final TObjectIntHashMap<DeclarationDescriptor> myVarSizes = new TObjectIntHashMap<DeclarationDescriptor>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -25,6 +25,7 @@ import org.jetbrains.asm4.MethodVisitor;
import org.jetbrains.asm4.Type;
import org.jetbrains.asm4.commons.InstructionAdapter;
import org.jetbrains.asm4.commons.Method;
import org.jetbrains.jet.codegen.binding.CodegenBinding;
import org.jetbrains.jet.codegen.context.CodegenContext;
import org.jetbrains.jet.codegen.context.MethodContext;
import org.jetbrains.jet.codegen.signature.JvmMethodParameterSignature;
@@ -46,7 +47,6 @@ import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
import org.jetbrains.jet.lang.resolve.java.kt.DescriptorKindUtils;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import java.util.*;
@@ -58,11 +58,6 @@ import static org.jetbrains.jet.lang.resolve.BindingContextUtils.callableDescrip
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDeclaration;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
/**
* @author max
* @author yole
* @author alex.tkachman
*/
public class FunctionCodegen extends GenerationStateAware {
private final CodegenContext owner;
private final ClassBuilder v;
@@ -342,50 +337,6 @@ public class FunctionCodegen extends GenerationStateAware {
iv.areturn(asmMethod.getReturnType());
}
private static boolean isAbstract(FunctionDescriptor functionDescriptor, OwnerKind kind) {
return (functionDescriptor.getModality() == Modality.ABSTRACT
|| isInterface(functionDescriptor.getContainingDeclaration())
)
&& !isStatic(kind)
&& kind != OwnerKind.TRAIT_IMPL;
}
public static int getMethodAsmFlags(FunctionDescriptor functionDescriptor, OwnerKind kind) {
boolean isStatic = isStatic(kind);
boolean isAbstract = isAbstract(functionDescriptor, kind);
int flags = getVisibilityAccessFlag(functionDescriptor);
if (!functionDescriptor.getValueParameters().isEmpty()
&& functionDescriptor.getValueParameters().get(functionDescriptor.getValueParameters().size() - 1)
.getVarargElementType() != null) {
flags |= ACC_VARARGS;
}
if (functionDescriptor.getModality() == Modality.FINAL) {
DeclarationDescriptor containingDeclaration = functionDescriptor.getContainingDeclaration();
if (!(containingDeclaration instanceof ClassDescriptor) ||
((ClassDescriptor) containingDeclaration).getKind() != ClassKind.TRAIT) {
flags |= ACC_FINAL;
}
}
if (isStatic || kind == OwnerKind.TRAIT_IMPL) {
flags |= ACC_STATIC;
}
if (isAbstract) flags |= ACC_ABSTRACT;
if (KotlinBuiltIns.getInstance().isDeprecated(functionDescriptor)) {
flags |= ACC_DEPRECATED;
}
return flags;
}
private static boolean isStatic(OwnerKind kind) {
return kind == OwnerKind.NAMESPACE || kind instanceof OwnerKind.StaticDelegateKind;
}
public static void genJetAnnotations(
@NotNull GenerationState state,
@NotNull FunctionDescriptor functionDescriptor,
@@ -449,6 +400,7 @@ public class FunctionCodegen extends GenerationStateAware {
JetValueParameterAnnotationWriter av = JetValueParameterAnnotationWriter.visitParameterAnnotation(mv, i + start);
av.writeName(parameterDescriptor.getName().getName());
av.writeHasDefaultValue(parameterDescriptor.declaresDefaultValue());
av.writeVararg(parameterDescriptor.getVarargElementType() != null);
if (kotlinParameterTypes.get(i) != null) {
av.writeType(kotlinParameterTypes.get(i + start).getKotlinSignature());
}
@@ -528,6 +480,46 @@ public class FunctionCodegen extends GenerationStateAware {
}
}
static void generateConstructorWithoutParametersIfNeeded(
@NotNull GenerationState state,
@NotNull CallableMethod method,
@NotNull ConstructorDescriptor constructorDescriptor,
@NotNull ClassBuilder classBuilder
) {
if (!isDefaultConstructorNeeded(state.getBindingContext(), constructorDescriptor)) {
return;
}
int flags = getVisibilityAccessFlag(constructorDescriptor);
MethodVisitor mv = classBuilder.newMethod(null, flags, "<init>", "()V", null, null);
if (state.getClassBuilderMode() == ClassBuilderMode.SIGNATURES) {
return;
}
else if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) {
genStubCode(mv);
}
else if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
InstructionAdapter v = new InstructionAdapter(mv);
mv.visitCode();
JvmClassName ownerInternalName = method.getOwner();
Method jvmSignature = method.getSignature().getAsmMethod();
v.load(0, ownerInternalName.getAsmType()); // Load this on stack
int mask = 0;
for (ValueParameterDescriptor parameterDescriptor : constructorDescriptor.getValueParameters()) {
Type paramType = state.getTypeMapper().mapType(parameterDescriptor.getType());
pushDefaultValueOnStack(paramType, v);
mask |= (1 << parameterDescriptor.getIndex());
}
v.iconst(mask);
String desc = jvmSignature.getDescriptor().replace(")", "I)");
v.invokespecial(ownerInternalName.getInternalName(), "<init>", desc);
v.areturn(Type.VOID_TYPE);
endVisit(mv, "default constructor for " + ownerInternalName.getInternalName(), null);
}
}
static void generateDefaultIfNeeded(
MethodContext owner,
GenerationState state,
@@ -551,6 +543,10 @@ public class FunctionCodegen extends GenerationStateAware {
ReceiverParameterDescriptor receiverParameter = functionDescriptor.getReceiverParameter();
boolean hasReceiver = receiverParameter != null;
// Has outer in local variables (constructor for inner class)
boolean hasOuter = functionDescriptor instanceof ConstructorDescriptor &&
CodegenBinding.canHaveOuter(state.getBindingContext(), ((ConstructorDescriptor) functionDescriptor).getContainingDeclaration());
boolean isStatic = isStatic(kind);
if (kind == OwnerKind.TRAIT_IMPL) {
@@ -561,7 +557,7 @@ public class FunctionCodegen extends GenerationStateAware {
int flags = ACC_PUBLIC | ACC_SYNTHETIC; // TODO.
JvmClassName ownerInternalName;
if (contextClass instanceof NamespaceDescriptor) {
if (DescriptorUtils.isTopLevelDeclaration(owner.getContextDescriptor())) {
ownerInternalName = NamespaceCodegen.getJVMClassNameForKotlinNs(DescriptorUtils.getFQName(contextClass).toSafe());
}
else {
@@ -583,7 +579,7 @@ public class FunctionCodegen extends GenerationStateAware {
genStubCode(mv);
}
else if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
generateDefaultImpl(owner, state, jvmSignature, functionDescriptor, kind, receiverParameter, hasReceiver, isStatic,
generateDefaultImpl(owner, state, jvmSignature, functionDescriptor, kind, receiverParameter, hasReceiver, hasOuter, isStatic,
ownerInternalName,
isConstructor, mv, iv, loadStrategy);
}
@@ -596,7 +592,7 @@ public class FunctionCodegen extends GenerationStateAware {
FunctionDescriptor functionDescriptor,
OwnerKind kind,
ReceiverParameterDescriptor receiverParameter,
boolean hasReceiver,
boolean hasReceiver, boolean hasOuter,
boolean aStatic,
JvmClassName ownerInternalName,
boolean constructor,
@@ -606,55 +602,53 @@ public class FunctionCodegen extends GenerationStateAware {
) {
mv.visitCode();
boolean isEnumConstructor = functionDescriptor instanceof ConstructorDescriptor &&
DescriptorUtils.isEnumClass(functionDescriptor.getContainingDeclaration());
FrameMap frameMap = owner.prepareFrame(state.getTypeMapper());
if (kind instanceof OwnerKind.StaticDelegateKind) {
frameMap.leaveTemp(OBJECT_TYPE);
}
if (hasOuter) {
frameMap.enterTemp(OBJECT_TYPE);
}
if (isEnumConstructor) {
frameMap.enterTemp(OBJECT_TYPE);
frameMap.enterTemp(Type.INT_TYPE);
}
ExpressionCodegen codegen = new ExpressionCodegen(mv, frameMap, jvmSignature.getReturnType(), owner, state);
int var = 0;
if (!aStatic) {
var++;
}
Type receiverType;
Type receiverType = null;
if (hasReceiver) {
receiverType = state.getTypeMapper().mapType(receiverParameter.getType());
var += receiverType.getSize();
}
else {
receiverType = Type.DOUBLE_TYPE;
}
final int extraInLocalVariablesTable = getSizeOfExplicitArgumentsInLocalVariablesTable(aStatic, hasOuter, isEnumConstructor, receiverType);
final int countOfExtraVarsInMethodArgs = getCountOfExplicitArgumentsInMethodArguments(hasOuter, hasReceiver, isEnumConstructor);
Type[] argTypes = jvmSignature.getArgumentTypes();
List<ValueParameterDescriptor> paramDescrs = functionDescriptor.getValueParameters();
int paramSizeInLocalVariablesTable = 0;
for (int i = 0; i < paramDescrs.size(); i++) {
Type argType = argTypes[i + (hasReceiver ? 1 : 0)];
Type argType = argTypes[i + countOfExtraVarsInMethodArgs];
int size = argType.getSize();
frameMap.enter(paramDescrs.get(i), argType);
var += size;
paramSizeInLocalVariablesTable += size;
}
int maskIndex = var;
final int maskIndex = extraInLocalVariablesTable + paramSizeInLocalVariablesTable;
var = 0;
if (!aStatic) {
mv.visitVarInsn(ALOAD, var++);
}
if (hasReceiver) {
iv.load(var, receiverType);
var += receiverType.getSize();
}
int extra = hasReceiver ? 1 : 0;
loadExplicitArgumentsOnStack(iv, OBJECT_TYPE, receiverType, ownerInternalName.getAsmType(), aStatic, hasOuter, isEnumConstructor);
int indexInLocalVariablesTable = extraInLocalVariablesTable;
for (int index = 0; index < paramDescrs.size(); index++) {
ValueParameterDescriptor parameterDescriptor = paramDescrs.get(index);
Type t = argTypes[extra + index];
Type t = argTypes[countOfExtraVarsInMethodArgs + index];
if (frameMap.getIndex(parameterDescriptor) < 0) {
frameMap.enter(parameterDescriptor, t);
@@ -675,8 +669,8 @@ public class FunctionCodegen extends GenerationStateAware {
iv.mark(loadArg);
}
iv.load(var, t);
var += t.getSize();
iv.load(indexInLocalVariablesTable, t);
indexInLocalVariablesTable += t.getSize();
}
final String internalName = ownerInternalName.getInternalName();
@@ -687,7 +681,7 @@ public class FunctionCodegen extends GenerationStateAware {
iv.invokeinterface(internalName, jvmSignatureName, jvmSignatureDescriptor);
}
else {
if (!constructor) {
if (!constructor && functionDescriptor.getVisibility() != Visibilities.PRIVATE) {
iv.invokevirtual(internalName, jvmSignatureName, jvmSignatureDescriptor);
}
else {
@@ -705,6 +699,54 @@ public class FunctionCodegen extends GenerationStateAware {
mv.visitEnd();
}
private static int getSizeOfExplicitArgumentsInLocalVariablesTable(
boolean isStatic,
boolean hasOuter,
boolean isEnumConstructor,
@Nullable Type receiverType
) {
int result = 0;
if (!isStatic) result++;
if (receiverType != null) result += receiverType.getSize();
if (hasOuter) result++;
if (isEnumConstructor) result += 2;
return result;
}
private static int getCountOfExplicitArgumentsInMethodArguments(
boolean hasOuter,
boolean hasReceiver,
boolean isEnumConstructor
) {
int result = 0;
if (hasReceiver) result++;
if (hasOuter) result++;
if (isEnumConstructor) result += 2;
return result;
}
private static void loadExplicitArgumentsOnStack(@NotNull InstructionAdapter iv,
@NotNull Type ownerType, @Nullable Type receiverType, @NotNull Type outerType,
boolean isStatic, boolean hasOuter, boolean isEnumConstructor) {
int var = 0;
if (!isStatic) {
iv.load(var++, ownerType);
}
if (hasOuter) {
iv.load(var++, outerType);
}
if (isEnumConstructor) {
iv.load(var++, OBJECT_TYPE);
iv.load(var++, Type.INT_TYPE);
}
if (receiverType != null) {
iv.load(var, receiverType);
}
}
private static boolean isDefaultNeeded(FunctionDescriptor functionDescriptor) {
boolean needed = false;
if (functionDescriptor != null) {
@@ -718,6 +760,24 @@ public class FunctionCodegen extends GenerationStateAware {
return needed;
}
private static boolean isDefaultConstructorNeeded(@NotNull BindingContext context, @NotNull ConstructorDescriptor constructorDescriptor) {
ClassDescriptor classDescriptor = constructorDescriptor.getContainingDeclaration();
if (CodegenBinding.canHaveOuter(context, classDescriptor)) return false;
if (classDescriptor.getVisibility() == Visibilities.PRIVATE ||
constructorDescriptor.getVisibility() == Visibilities.PRIVATE) return false;
if (constructorDescriptor.getValueParameters().isEmpty()) return false;
for (ValueParameterDescriptor parameterDescriptor : constructorDescriptor.getValueParameters()) {
if (!parameterDescriptor.declaresDefaultValue()) {
return false;
}
}
return true;
}
private static boolean differentMethods(Method method, Method overridden) {
if (!method.getReturnType().equals(overridden.getReturnType())) {
return true;
@@ -743,7 +803,7 @@ public class FunctionCodegen extends GenerationStateAware {
FunctionDescriptor functionDescriptor,
Method overridden
) {
int flags = ACC_PUBLIC | ACC_BRIDGE; // TODO.
int flags = ACC_PUBLIC | ACC_BRIDGE | ACC_SYNTHETIC; // TODO.
final MethodVisitor mv = v.newMethod(null, flags, jvmSignature.getName(), overridden.getDescriptor(), null, null);
if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -21,10 +21,6 @@ import org.jetbrains.annotations.NotNull;
import java.net.URL;
import java.net.URLClassLoader;
/**
* @author yole
* @author alex.tkachman
*/
public class GeneratedClassLoader extends URLClassLoader {
private ClassFileFactory state;
@@ -33,8 +29,9 @@ public class GeneratedClassLoader extends URLClassLoader {
this.state = state;
}
@NotNull
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
protected Class<?> findClass(@NotNull String name) throws ClassNotFoundException {
String file = name.replace('.', '/') + ".class";
if (state.files().contains(file)) {
byte[] bytes = state.asBytes(file);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -21,10 +21,7 @@ import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.util.Pair;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.asm4.AnnotationVisitor;
import org.jetbrains.asm4.Label;
import org.jetbrains.asm4.MethodVisitor;
import org.jetbrains.asm4.Type;
import org.jetbrains.asm4.*;
import org.jetbrains.asm4.commons.InstructionAdapter;
import org.jetbrains.asm4.commons.Method;
import org.jetbrains.jet.codegen.binding.CalculatedClosure;
@@ -41,16 +38,12 @@ import org.jetbrains.jet.codegen.state.JetTypeMapper;
import org.jetbrains.jet.codegen.state.JetTypeMapperMode;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.OverridingUtil;
import org.jetbrains.jet.lang.resolve.*;
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
import org.jetbrains.jet.lang.resolve.java.*;
import org.jetbrains.jet.lang.resolve.java.kt.DescriptorKindUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
@@ -66,11 +59,6 @@ import static org.jetbrains.jet.lang.resolve.BindingContextUtils.callableDescrip
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.JAVA_STRING_TYPE;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
/**
* @author max
* @author yole
* @author alex.tkachman
*/
public class ImplementationBodyCodegen extends ClassBodyCodegen {
private static final String VALUES = "$VALUES";
private JetDelegationSpecifier superCall;
@@ -112,7 +100,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
isAnnotation = true;
signature.getInterfaces().add("java/lang/annotation/Annotation");
}
else if (jetClass.hasModifier(JetTokens.ENUM_KEYWORD)) {
else if (jetClass.isEnum()) {
isAbstract = hasAbstractMembers(descriptor);
isEnum = true;
}
@@ -123,6 +112,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
if (!jetClass.hasModifier(JetTokens.OPEN_KEYWORD) && !isAbstract) {
isFinal = true;
}
isStatic = !jetClass.isInner();
}
else {
isStatic = myClass.getParent() instanceof JetClassObject;
@@ -130,7 +120,21 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
int access = 0;
access |= ACC_PUBLIC;
if (state.getClassBuilderMode() == ClassBuilderMode.SIGNATURES && !DescriptorUtils.isTopLevelDeclaration(descriptor)) {
// ClassBuilderMode.SIGNATURES means we are generating light classes & looking at a nested or inner class
// Light class generation is implemented so that Cls-classes only read bare code of classes,
// without knowing whether these classes are inner or not (see ClassStubBuilder.EMPTY_STRATEGY)
// Thus we must write full accessibility flags on inner classes in this mode
access |= getVisibilityAccessFlag(descriptor);
// Same for STATIC
if (isStatic) {
access |= ACC_STATIC;
}
}
else {
access |= getVisibilityAccessFlagForClass(descriptor);
}
if (isAbstract) {
access |= ACC_ABSTRACT;
}
@@ -143,9 +147,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
if (isFinal) {
access |= ACC_FINAL;
}
if (isStatic) {
access |= ACC_STATIC;
}
if (isAnnotation) {
access |= ACC_ANNOTATION;
}
@@ -182,43 +183,74 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
private void writeOuterClass() {
ClassDescriptor container = getContainingClassDescriptor(descriptor);
//JVMS7: A class must have an EnclosingMethod attribute if and only if it is a local class or an anonymous class.
DeclarationDescriptor parentDescriptor = descriptor.getContainingDeclaration();
boolean isObjectLiteral = descriptor.getName().isSpecial() && descriptor.getKind() == ClassKind.OBJECT;
boolean isLocalOrAnonymousClass = isObjectLiteral ||
!(DescriptorUtils.isTopLevelDeclaration(descriptor) || parentDescriptor instanceof ClassDescriptor);
if (isLocalOrAnonymousClass) {
String outerClassName = getOuterClassName(descriptor, typeMapper, bindingContext, state);
FunctionDescriptor function = DescriptorUtils.getParentOfType(descriptor, FunctionDescriptor.class);
//Function descriptor could be null only for object literal in package namespace
assert (!isObjectLiteral && function != null) || isObjectLiteral:
"Function descriptor should be present: " + descriptor.getName();
Name functionName = function != null ? function.getName() : null;
v.visitOuterClass(outerClassName,
functionName != null ? functionName.getName() : null,
functionName != null ? typeMapper.mapSignature(functionName, function).getAsmMethod().getDescriptor() : null);
}
}
@NotNull
public static String getOuterClassName(
@NotNull ClassDescriptor classDescriptor,
@NotNull JetTypeMapper typeMapper,
@NotNull BindingContext bindingContext,
@NotNull GenerationState state
) {
ClassDescriptor container = DescriptorUtils.getParentOfType(classDescriptor, ClassDescriptor.class);
if (container != null) {
v.visitOuterClass(typeMapper.mapType(container.getDefaultType(), JetTypeMapperMode.IMPL).getInternalName(), null, null);
return typeMapper.mapType(container.getDefaultType(), JetTypeMapperMode.IMPL).getInternalName();
}
else {
PackageFragmentDescriptor packageFragmentDescriptor = DescriptorUtils.getParentOfType(classDescriptor, PackageFragmentDescriptor.class);
assert packageFragmentDescriptor != null : "Namespace descriptor should be present: " + classDescriptor.getName();
FqName namespaceQN = packageFragmentDescriptor.getFqName();
JetFile containingFile = BindingContextUtils.getContainingFile(bindingContext, classDescriptor);
ModuleSourcesManager sourcesManager = state.getModuleSourcesManager();
ModuleDescriptor module = sourcesManager.getSubModuleForFile(containingFile).getContainingDeclaration();
boolean isMultiFile = CodegenBinding.isMultiFileNamespace(sourcesManager, module, namespaceQN);
return isMultiFile
? NamespaceCodegen.getNamespacePartInternalName(containingFile)
: NamespaceCodegen.getJVMClassNameForKotlinNs(namespaceQN).getInternalName();
}
}
private void writeInnerClasses() {
// Inner enums are moved by frontend to a class object of outer class, but we want them to be inner for the outer class itself
// (to avoid publicly visible names like A$ClassObject$$B), so they are handled specially in this method
for (ClassDescriptor innerClass : getInnerClassesAndObjects(descriptor)) {
// If it's an inner enum inside a class object, don't write it
// (instead write it to inner classes of this class object's containing class)
if (!isEnumMovedToClassObject(innerClass)) {
writeInnerClass(innerClass, false);
}
writeInnerClass(innerClass);
}
ClassDescriptor classObjectDescriptor = descriptor.getClassObjectDescriptor();
if (classObjectDescriptor != null) {
// Process all enums here which were moved to our class object
for (ClassDescriptor innerClass : getInnerClassesAndObjects(classObjectDescriptor)) {
if (isEnumMovedToClassObject(innerClass)) {
writeInnerClass(innerClass, true);
}
}
int innerClassAccess = ACC_PUBLIC | ACC_FINAL | ACC_STATIC;
int innerClassAccess = getVisibilityAccessFlag(classObjectDescriptor) | ACC_FINAL | ACC_STATIC;
v.visitInnerClass(classAsmType.getInternalName() + JvmAbi.CLASS_OBJECT_SUFFIX, classAsmType.getInternalName(),
JvmAbi.CLASS_OBJECT_CLASS_NAME,
innerClassAccess);
}
}
private void writeInnerClass(ClassDescriptor innerClass, boolean isStatic) {
private void writeInnerClass(ClassDescriptor innerClass) {
// TODO: proper access
int innerClassAccess = ACC_PUBLIC;
int innerClassAccess = getVisibilityAccessFlag(innerClass);
if (innerClass.getModality() == Modality.FINAL) {
innerClassAccess |= ACC_FINAL;
}
@@ -233,7 +265,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
innerClassAccess |= ACC_ENUM;
}
if (isStatic) {
if (!innerClass.isInner()) {
innerClassAccess |= ACC_STATIC;
}
@@ -243,32 +275,20 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
v.visitInnerClass(innerClassInternalName, outerClassInternalName, innerClass.getName().getName(), innerClassAccess);
}
private boolean isEnumMovedToClassObject(ClassDescriptor innerClass) {
// Checks if this is enum, moved to class object by frontend
return Boolean.TRUE.equals(bindingContext.get(BindingContext.IS_ENUM_MOVED_TO_CLASS_OBJECT, innerClass));
}
private void writeClassSignatureIfNeeded(JvmClassSignature signature) {
if (signature.getKotlinGenericSignature() != null || descriptor.getVisibility() != Visibilities.PUBLIC) {
AnnotationVisitor annotationVisitor = v.newAnnotation(JvmStdlibNames.JET_CLASS.getDescriptor(), true);
annotationVisitor.visit(JvmStdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature());
int flags = getFlagsForVisibility(descriptor.getVisibility()) | getFlagsForClassKind(descriptor);
if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flags) {
annotationVisitor.visit(JvmStdlibNames.JET_FLAGS_FIELD, flags);
}
annotationVisitor.visitEnd();
AnnotationVisitor annotationVisitor = v.newAnnotation(JvmStdlibNames.JET_CLASS.getDescriptor(), true);
annotationVisitor.visit(JvmStdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature());
int flags = getFlagsForVisibility(descriptor.getVisibility()) | getFlagsForClassKind(descriptor);
if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flags) {
annotationVisitor.visit(JvmStdlibNames.JET_FLAGS_FIELD, flags);
}
}
annotationVisitor.visit(JvmStdlibNames.ABI_VERSION_NAME, JvmAbi.VERSION);
annotationVisitor.visitEnd();
@Nullable
private static ClassDescriptor getContainingClassDescriptor(ClassDescriptor decl) {
DeclarationDescriptor container = decl.getContainingDeclaration();
while (container != null && !(container instanceof NamespaceDescriptor)) {
if (container instanceof ClassDescriptor) return (ClassDescriptor) container;
container = container.getContainingDeclaration();
if (descriptor.getKind() == ClassKind.CLASS_OBJECT) {
AnnotationVisitor classObjectVisitor = v.newAnnotation(JvmStdlibNames.JET_CLASS_OBJECT.getDescriptor(), true);
classObjectVisitor.visitEnd();
}
return null;
}
private JvmClassSignature signature() {
@@ -320,7 +340,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
signatureVisitor.writeSupersEnd();
return new JvmClassSignature(jvmName(), superClassAsmType.getInternalName(), superInterfaces, signatureVisitor.makeJavaString(),
return new JvmClassSignature(jvmName(), superClassAsmType.getInternalName(), superInterfaces, signatureVisitor.makeJavaGenericSignature(),
signatureVisitor.makeKotlinClassSignature());
}
@@ -477,8 +497,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
iv.store(2, AsmTypeConstants.OBJECT_TYPE);
for (PropertyDescriptor propertyDescriptor : properties) {
final JetType type = propertyDescriptor.getType();
final Type asmType = typeMapper.mapType(type);
Type asmType = typeMapper.mapType(propertyDescriptor.getType());
genPropertyOnStack(iv, propertyDescriptor, 0);
genPropertyOnStack(iv, propertyDescriptor, 2);
@@ -493,8 +512,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
}
else {
final StackValue value =
genEqualsForExpressionsOnStack(iv, JetTokens.EQEQ, asmType, asmType, type.isNullable(), type.isNullable());
StackValue value = genEqualsForExpressionsOnStack(iv, JetTokens.EQEQ, asmType, asmType);
value.put(Type.BOOLEAN_TYPE, iv);
}
@@ -527,14 +545,14 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
genPropertyOnStack(iv, propertyDescriptor, 0);
Label ifNull = null;
if (propertyDescriptor.getType().isNullable()) {
Type asmType = typeMapper.mapType(propertyDescriptor.getType());
if (!isPrimitive(asmType)) {
ifNull = new Label();
iv.dup();
iv.ifnull(ifNull);
}
genHashCode(mv, iv, typeMapper.mapType(propertyDescriptor.getType()));
genHashCode(mv, iv, asmType);
if (ifNull != null) {
Label end = new Label();
@@ -632,7 +650,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
final String desc = "()" + componentType.getDescriptor();
MethodVisitor mv = v.newMethod(myClass,
FunctionCodegen.getMethodAsmFlags(function, OwnerKind.IMPLEMENTATION),
AsmUtil.getMethodAsmFlags(function, OwnerKind.IMPLEMENTATION),
function.getName().getName(),
desc,
null, null);
@@ -657,7 +675,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
JvmMethodSignature methodSignature = typeMapper.mapSignature(function.getName(), function);
final String methodDesc = methodSignature.getAsmMethod().getDescriptor();
MethodVisitor mv = v.newMethod(myClass, FunctionCodegen.getMethodAsmFlags(function, OwnerKind.IMPLEMENTATION),
MethodVisitor mv = v.newMethod(myClass, AsmUtil.getMethodAsmFlags(function, OwnerKind.IMPLEMENTATION),
function.getName().getName(), methodDesc,
null, null);
@@ -900,14 +918,22 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
private void generateFieldForSingleton() {
if (!(isNonLiteralObject(myClass) || descriptor.getKind() == ClassKind.CLASS_OBJECT)) return;
boolean hasClassObject = descriptor.getClassObjectDescriptor() != null;
boolean isEnumClass = DescriptorUtils.isEnumClass(descriptor);
v.newField(myClass, ACC_PUBLIC | ACC_STATIC | ACC_FINAL, JvmAbi.INSTANCE_FIELD, classAsmType.getDescriptor(), null, null);
if (!(isNonLiteralObject(myClass) || hasClassObject) || isEnumClass) return;
ClassDescriptor fieldTypeDescriptor = hasClassObject ? descriptor.getClassObjectDescriptor() : descriptor;
assert fieldTypeDescriptor != null;
final FieldInfo info = FieldInfo.createForSingleton(fieldTypeDescriptor, typeMapper);
JetClassOrObject original = hasClassObject ? ((JetClass)myClass).getClassObject().getObjectDeclaration() : myClass;
v.newField(original, ACC_PUBLIC | ACC_STATIC | ACC_FINAL, info.getFieldName(), info.getFieldType().getDescriptor(), null, null);
staticInitializerChunks.add(new CodeChunk() {
@Override
public void generate(InstructionAdapter iv) {
genInitSingletonField(classAsmType, iv);
genInitSingletonField(info, iv);
}
});
}
@@ -934,30 +960,34 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
final JvmMethodSignature constructorMethod = callableMethod.getSignature();
assert constructorDescriptor != null;
int flags = getVisibilityAccessFlag(constructorDescriptor);
int flags = getConstructorAsmFlags(constructorDescriptor);
final MethodVisitor mv = v.newMethod(myClass, flags, constructorMethod.getName(), constructorMethod.getAsmMethod().getDescriptor(),
constructorMethod.getGenericsSignature(), null);
if (state.getClassBuilderMode() == ClassBuilderMode.SIGNATURES) return;
if (state.getClassBuilderMode() != ClassBuilderMode.SIGNATURES) {
AnnotationVisitor jetConstructorVisitor = mv.visitAnnotation(JvmStdlibNames.JET_CONSTRUCTOR.getDescriptor(), true);
AnnotationVisitor jetConstructorVisitor = mv.visitAnnotation(JvmStdlibNames.JET_CONSTRUCTOR.getDescriptor(), true);
int flagsValue = getFlagsForVisibility(constructorDescriptor.getVisibility());
if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flagsValue) {
jetConstructorVisitor.visit(JvmStdlibNames.JET_FLAGS_FIELD, flagsValue);
int flagsValue = getFlagsForVisibility(constructorDescriptor.getVisibility());
if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flagsValue) {
jetConstructorVisitor.visit(JvmStdlibNames.JET_FLAGS_FIELD, flagsValue);
}
jetConstructorVisitor.visitEnd();
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(constructorDescriptor);
writeParameterAnnotations(constructorDescriptor, constructorMethod, hasCapturedThis, mv);
if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) {
genStubCode(mv);
return;
}
generatePrimaryConstructorImpl(constructorDescriptor, constructorContext, constructorMethod, callableMethod, hasCapturedThis,
closure, mv);
}
jetConstructorVisitor.visitEnd();
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(constructorDescriptor);
writeParameterAnnotations(constructorDescriptor, constructorMethod, hasCapturedThis, mv);
if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) {
genStubCode(mv);
return;
}
generatePrimaryConstructorImpl(constructorDescriptor, constructorContext, constructorMethod, callableMethod, hasCapturedThis, closure, mv);
FunctionCodegen.generateConstructorWithoutParametersIfNeeded(state, callableMethod, constructorDescriptor, v);
}
private void generatePrimaryConstructorImpl(
@@ -1008,7 +1038,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
if (captureReceiver != null) {
iv.load(0, OBJECT_TYPE);
final Type asmType = typeMapper.mapType(captureReceiver.getDefaultType(), JetTypeMapperMode.IMPL);
iv.load(1, asmType);
iv.load(k, asmType);
iv.putfield(internalName, CAPTURED_RECEIVER_FIELD, asmType.getDescriptor());
k += asmType.getSize();
}
@@ -1114,6 +1144,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
JetValueParameterAnnotationWriter.visitParameterAnnotation(mv, i);
jetValueParameterAnnotation.writeName(valueParameter.getName().getName());
jetValueParameterAnnotation.writeHasDefaultValue(valueParameter.declaresDefaultValue());
jetValueParameterAnnotation.writeVararg(valueParameter.getVarargElementType() != null);
jetValueParameterAnnotation.writeType(constructorMethod.getKotlinParameterType(i));
jetValueParameterAnnotation.visitEnd();
++i;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -14,13 +14,12 @@
* limitations under the License.
*/
package org.jetbrains.jet.codegen.state;
package org.jetbrains.jet.codegen;
import com.intellij.openapi.util.Pair;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.codegen.CompilationErrorHandler;
import org.jetbrains.jet.codegen.NamespaceCodegen;
import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetPsiUtil;
@@ -35,25 +34,11 @@ import java.util.Map;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.registerClassNameForScript;
/**
* @author alex.tkachman
*/
public class GenerationStrategy {
public static final GenerationStrategy STANDARD = new GenerationStrategy();
protected GenerationStrategy () {
}
public void generateNamespace(GenerationState state,
FqName fqName,
Collection<JetFile> jetFiles,
CompilationErrorHandler errorHandler
public class KotlinCodegenFacade {
public static void compileCorrectFiles(
@NotNull GenerationState state,
@NotNull CompilationErrorHandler errorHandler
) {
NamespaceCodegen codegen = state.getFactory().forNamespace(fqName, jetFiles);
codegen.generate(errorHandler, state.getProgress());
}
public final void compileCorrectFiles(GenerationState state, @NotNull CompilationErrorHandler errorHandler) {
for (JetFile file : state.getFiles()) {
if (file.isScript()) {
String name = ScriptNameUtil.classNameForScript(file);
@@ -77,4 +62,16 @@ public class GenerationStrategy {
generateNamespace(state, entry.getKey(), entry.getValue(), errorHandler);
}
}
public static void generateNamespace(
@NotNull GenerationState state,
@NotNull FqName fqName,
@NotNull Collection<JetFile> jetFiles,
@NotNull CompilationErrorHandler errorHandler
) {
NamespaceCodegen codegen = state.getFactory().forNamespace(fqName, jetFiles);
codegen.generate(errorHandler);
}
private KotlinCodegenFacade() {}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -30,9 +30,6 @@ import java.util.Map;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.enumEntryNeedSubclass;
/**
* @author alex.tkachman
*/
public class MemberCodegen extends GenerationStateAware {
public MemberCodegen(@NotNull GenerationState state) {
super(state);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -22,39 +22,41 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.asm4.AnnotationVisitor;
import org.jetbrains.asm4.MethodVisitor;
import org.jetbrains.asm4.Type;
import org.jetbrains.asm4.commons.InstructionAdapter;
import org.jetbrains.jet.codegen.binding.CodegenBinding;
import org.jetbrains.jet.codegen.context.CodegenContext;
import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
import org.jetbrains.jet.lang.descriptors.PackageViewDescriptor;
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
import org.jetbrains.jet.lang.descriptors.SubModuleDescriptor;
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.codegen.state.Progress;
import java.io.File;
import java.util.Collection;
import static org.jetbrains.asm4.Opcodes.*;
/**
* @author max
*/
public class NamespaceCodegen extends MemberCodegen {
@NotNull
private final ClassBuilderOnDemand v;
@NotNull private final FqName name;
private final SubModuleDescriptor subModule;
private final Collection<JetFile> files;
public NamespaceCodegen(
@NotNull ClassBuilderOnDemand v,
@NotNull SubModuleDescriptor subModule,
@NotNull final FqName fqName,
GenerationState state,
Collection<JetFile> namespaceFiles
@@ -63,35 +65,43 @@ public class NamespaceCodegen extends MemberCodegen {
checkAllFilesHaveSameNamespace(namespaceFiles);
this.v = v;
this.subModule = subModule;
name = fqName;
this.files = namespaceFiles;
final PsiFile sourceFile = namespaceFiles.iterator().next().getContainingFile();
final PsiFile sourceFile = namespaceFiles.size() == 1 ? namespaceFiles.iterator().next().getContainingFile() : null;
v.addOptionalDeclaration(new ClassBuilderOnDemand.ClassBuilderCallback() {
@Override
public void doSomething(@NotNull ClassBuilder v) {
v.defineClass(sourceFile, V1_6,
ACC_PUBLIC/*|ACC_SUPER*/,
ACC_PUBLIC | ACC_FINAL,
getJVMClassNameForKotlinNs(fqName).getInternalName(),
null,
//"jet/lang/Namespace",
"java/lang/Object",
new String[0]
);
// TODO figure something out for a namespace that spans multiple files
v.visitSource(sourceFile.getName(), null);
//We don't generate any source information for namespace with multiple files
if (sourceFile != null) {
v.visitSource(sourceFile.getName(), null);
}
}
});
}
public void generate(CompilationErrorHandler errorHandler, final Progress progress) {
boolean multiFile = CodegenBinding.isMultiFileNamespace(state.getBindingContext(), name);
public void generate(CompilationErrorHandler errorHandler) {
boolean multiFile = CodegenBinding.isMultiFileNamespace(state.getModuleSourcesManager(), subModule.getContainingDeclaration(), name);
if (shouldGenerateNSClass(files)) {
AnnotationVisitor packageClassAnnotation = v.getClassBuilder().newAnnotation(JvmStdlibNames.JET_PACKAGE_CLASS.getDescriptor(), true);
packageClassAnnotation.visit(JvmStdlibNames.ABI_VERSION_NAME, JvmAbi.VERSION);
packageClassAnnotation.visitEnd();
}
for (JetFile file : files) {
VirtualFile vFile = file.getVirtualFile();
try {
final String path = vFile != null ? vFile.getPath() : "no_virtual_file/" + file.getName();
generate(file, multiFile);
}
catch (ProcessCanceledException e) {
@@ -115,7 +125,8 @@ public class NamespaceCodegen extends MemberCodegen {
}
private void generate(JetFile file, boolean multiFile) {
NamespaceDescriptor descriptor = state.getBindingContext().get(BindingContext.FILE_TO_NAMESPACE, file);
PackageViewDescriptor descriptor = subModule.getPackageView(JetPsiUtil.getFQName(file));
assert descriptor != null : "No namespace found for file " + file + " declared package: " + file.getPackageName();
for (JetDeclaration declaration : file.getDeclarations()) {
if (declaration instanceof JetProperty) {
final CodegenContext context = CodegenContext.STATIC.intoNamespace(descriptor);
@@ -128,8 +139,9 @@ public class NamespaceCodegen extends MemberCodegen {
}
}
else if (declaration instanceof JetClassOrObject) {
final CodegenContext context = CodegenContext.STATIC.intoNamespace(descriptor);
genClassOrObject(context, (JetClassOrObject) declaration);
if (state.isGenerateDeclaredClasses()) {
generateClassOrObject(descriptor, (JetClassOrObject) declaration);
}
}
else if (declaration instanceof JetScript) {
state.getScriptCodegen().generate((JetScript) declaration);
@@ -145,12 +157,13 @@ public class NamespaceCodegen extends MemberCodegen {
}
if (k > 0) {
String namespaceInternalName = JvmClassName.byFqNameWithoutInnerClasses(name.child(Name.identifier(JvmAbi.PACKAGE_CLASS))).getInternalName();
String namespaceInternalName = JvmClassName.byFqNameWithoutInnerClasses(
PackageClassUtils.getPackageClassFqName(name)).getInternalName();
String className = getMultiFileNamespaceInternalName(namespaceInternalName, file);
ClassBuilder builder = state.getFactory().forNamespacepart(className, file);
builder.defineClass(file, V1_6,
ACC_PUBLIC/*|ACC_SUPER*/,
ACC_PUBLIC | ACC_FINAL,
className,
null,
//"jet/lang/Namespace",
@@ -179,6 +192,11 @@ public class NamespaceCodegen extends MemberCodegen {
}
}
public void generateClassOrObject(@NotNull PackageViewDescriptor descriptor, @NotNull JetClassOrObject classOrObject) {
CodegenContext context = CodegenContext.STATIC.intoNamespace(descriptor);
genClassOrObject(context, classOrObject);
}
/**
* @param namespaceFiles all files should have same package name
* @return
@@ -269,11 +287,12 @@ public class NamespaceCodegen extends MemberCodegen {
@NotNull
public static JvmClassName getJVMClassNameForKotlinNs(@NotNull FqName fqName) {
String packageClassName = PackageClassUtils.getPackageClassName(fqName);
if (fqName.isRoot()) {
return JvmClassName.byInternalName(JvmAbi.PACKAGE_CLASS);
return JvmClassName.byInternalName(packageClassName);
}
return JvmClassName.byFqNameWithoutInnerClasses(fqName.child(Name.identifier(JvmAbi.PACKAGE_CLASS)));
return JvmClassName.byFqNameWithoutInnerClasses(fqName.child(Name.identifier(packageClassName)));
}
@NotNull

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -16,9 +16,6 @@
package org.jetbrains.jet.codegen;
/**
* @author max
*/
public class OwnerKind {
private final String name;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -46,10 +46,6 @@ import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDec
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isExternallyAccessible;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
/**
* @author max
* @author alex.tkachman
*/
public class PropertyCodegen extends GenerationStateAware {
private final FunctionCodegen functionCodegen;
private final ClassBuilder v;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -22,32 +22,39 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.lang.types.lang.PrimitiveType;
import java.util.List;
import static org.jetbrains.jet.codegen.AsmUtil.isPrimitiveNumberClassDescriptor;
/**
* @author abreslav
*/
public class RangeCodegenUtil {
private static final ImmutableMap<String, JetType> RANGE_TO_ELEMENT_TYPE = ImmutableMap.<String, JetType>builder()
.put("ByteRange", KotlinBuiltIns.getInstance().getByteType())
.put("ShortRange", KotlinBuiltIns.getInstance().getShortType())
.put("IntRange", KotlinBuiltIns.getInstance().getIntType())
.put("LongRange", KotlinBuiltIns.getInstance().getLongType())
.put("FloatRange", KotlinBuiltIns.getInstance().getFloatType())
.put("DoubleRange", KotlinBuiltIns.getInstance().getDoubleType())
.put("CharRange", KotlinBuiltIns.getInstance().getCharType())
.build();
private static final ImmutableMap<FqName, PrimitiveType> RANGE_TO_ELEMENT_TYPE;
private static final ImmutableMap<FqName, PrimitiveType> PROGRESSION_TO_ELEMENT_TYPE;
static {
ImmutableMap.Builder<FqName, PrimitiveType> rangeBuilder = ImmutableMap.builder();
ImmutableMap.Builder<FqName, PrimitiveType> progressionBuilder = ImmutableMap.builder();
for (PrimitiveType primitiveType : PrimitiveType.values()) {
rangeBuilder.put(primitiveType.getRangeClassName(), primitiveType);
progressionBuilder.put(primitiveType.getProgressionClassName(), primitiveType);
}
RANGE_TO_ELEMENT_TYPE = rangeBuilder.build();
PROGRESSION_TO_ELEMENT_TYPE = progressionBuilder.build();
}
private RangeCodegenUtil() {}
public static boolean isIntRange(JetType rangeType) {
return !rangeType.isNullable()
&& KotlinBuiltIns.getInstance().getIntType().equals(getPrimitiveRangeElementType(rangeType));
public static boolean isRange(JetType rangeType) {
return !rangeType.isNullable() && getPrimitiveRangeElementType(rangeType) != null;
}
public static boolean isProgression(JetType rangeType) {
return !rangeType.isNullable() && getPrimitiveProgressionElementType(rangeType) != null;
}
@Nullable
@@ -81,14 +88,27 @@ public class RangeCodegenUtil {
}
@Nullable
public static JetType getPrimitiveRangeElementType(JetType rangeType) {
ClassifierDescriptor declarationDescriptor = rangeType.getConstructor().getDeclarationDescriptor();
private static PrimitiveType getPrimitiveRangeElementType(JetType rangeType) {
return getPrimitiveRangeOrProgressionElementType(rangeType, RANGE_TO_ELEMENT_TYPE);
}
@Nullable
private static PrimitiveType getPrimitiveProgressionElementType(JetType rangeType) {
return getPrimitiveRangeOrProgressionElementType(rangeType, PROGRESSION_TO_ELEMENT_TYPE);
}
@Nullable
private static PrimitiveType getPrimitiveRangeOrProgressionElementType(
@NotNull JetType rangeOrProgression,
@NotNull ImmutableMap<FqName, PrimitiveType> map
) {
ClassifierDescriptor declarationDescriptor = rangeOrProgression.getConstructor().getDeclarationDescriptor();
assert declarationDescriptor != null;
if (declarationDescriptor != KotlinBuiltIns.getInstance().getBuiltInsScope().getClassifier(declarationDescriptor.getName())) {
// Must be a standard library class
return null;
}
return RANGE_TO_ELEMENT_TYPE.get(declarationDescriptor.getName().getName());
return map.get(DescriptorUtils.getFQName(declarationDescriptor).toSafe());
}
public static boolean isOptimizableRangeTo(CallableDescriptor rangeTo) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -27,7 +27,6 @@ import org.jetbrains.jet.codegen.context.CodegenContext;
import org.jetbrains.jet.codegen.context.ScriptContext;
import org.jetbrains.jet.codegen.signature.JvmMethodSignature;
import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.codegen.state.GenerationStrategy;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
@@ -44,9 +43,6 @@ import static org.jetbrains.asm4.Opcodes.*;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.*;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
/**
* @author Stepan Koltsov
*/
public class ScriptCodegen extends MemberCodegen {
@NotNull
@@ -254,7 +250,7 @@ public class ScriptCodegen extends MemberCodegen {
registerClassNameForScript(state.getBindingTrace(), script, className);
state.beforeCompile();
GenerationStrategy.STANDARD.generateNamespace(
KotlinCodegenFacade.generateNamespace(
state,
JetPsiUtil.getFQName((JetFile) script.getContainingFile()),
Collections.singleton((JetFile) script.getContainingFile()),

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -23,14 +23,12 @@ import org.jetbrains.asm4.Label;
import org.jetbrains.asm4.Type;
import org.jetbrains.asm4.commons.InstructionAdapter;
import org.jetbrains.asm4.commons.Method;
import org.jetbrains.jet.codegen.binding.CodegenBinding;
import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethod;
import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.codegen.state.JetTypeMapper;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.JetExpression;
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.java.JvmPrimitiveType;
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
@@ -42,10 +40,6 @@ import static org.jetbrains.asm4.Opcodes.*;
import static org.jetbrains.jet.codegen.AsmUtil.*;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.*;
/**
* @author yole
* @author alex.tkachman
*/
public abstract class StackValue {
@NotNull
public final Type type;
@@ -134,7 +128,8 @@ public abstract class StackValue {
return new CollectionElement(type, getter, setter, codegen, state);
}
public static StackValue field(Type type, JvmClassName owner, String name, boolean isStatic) {
@NotNull
public static StackValue field(@NotNull Type type, @NotNull JvmClassName owner, @NotNull String name, boolean isStatic) {
return new Field(type, owner, name, isStatic);
}
@@ -235,42 +230,35 @@ public abstract class StackValue {
public static void coerce(Type fromType, Type toType, InstructionAdapter v) {
if (toType.equals(fromType)) return;
if (toType.getSort() == Type.VOID && fromType.getSort() != Type.VOID) {
if (toType.getSort() == Type.VOID) {
pop(fromType, v);
}
else if (toType.getSort() != Type.VOID && fromType.getSort() == Type.VOID) {
else if (fromType.getSort() == Type.VOID) {
if (toType.getSort() == Type.OBJECT) {
putTuple0Instance(v);
}
else if (toType == Type.LONG_TYPE) {
v.lconst(0);
}
else if (toType == Type.FLOAT_TYPE) {
v.fconst(0);
}
else if (toType == Type.DOUBLE_TYPE) {
v.dconst(0);
}
else {
v.iconst(0);
pushDefaultPrimitiveValueOnStack(toType, v);
}
}
else if (toType.equals(JET_TUPLE0_TYPE) && !fromType.equals(JET_TUPLE0_TYPE)) {
else if (toType.equals(JET_TUPLE0_TYPE)) {
pop(fromType, v);
putTuple0Instance(v);
}
else if (toType.getSort() == Type.OBJECT && fromType.equals(OBJECT_TYPE) || toType.getSort() == Type.ARRAY) {
else if (toType.getSort() == Type.ARRAY) {
v.checkcast(toType);
}
else if (toType.getSort() == Type.OBJECT) {
if (fromType.getSort() == Type.OBJECT && !toType.equals(OBJECT_TYPE)) {
v.checkcast(toType);
if (fromType.getSort() == Type.OBJECT || fromType.getSort() == Type.ARRAY) {
if (!toType.equals(OBJECT_TYPE)) {
v.checkcast(toType);
}
}
else {
box(fromType, toType, v);
}
}
else if (fromType.getSort() == Type.OBJECT && toType.getSort() <= Type.DOUBLE) {
else if (fromType.getSort() == Type.OBJECT) {
if (toType.getSort() == Type.BOOLEAN) {
coerce(fromType, JvmPrimitiveType.BOOLEAN.getWrapper().getAsmType(), v);
}
@@ -351,20 +339,8 @@ public abstract class StackValue {
}
public static StackValue singleton(ClassDescriptor classDescriptor, JetTypeMapper typeMapper) {
final Type type = typeMapper.mapType(classDescriptor.getDefaultType());
final ClassKind kind = classDescriptor.getKind();
if (kind == ClassKind.CLASS_OBJECT || kind == ClassKind.OBJECT) {
return field(type, JvmClassName.byInternalName(type.getInternalName()), JvmAbi.INSTANCE_FIELD, true);
}
else if (kind == ClassKind.ENUM_ENTRY) {
final JvmClassName owner = typeMapper.getBindingContext()
.get(CodegenBinding.FQN, classDescriptor.getContainingDeclaration().getContainingDeclaration());
return field(type, owner, classDescriptor.getName().getName(), true);
}
else {
throw new UnsupportedOperationException();
}
FieldInfo info = FieldInfo.createForSingleton(classDescriptor, typeMapper);
return field(info.getFieldType(), JvmClassName.byInternalName(info.getOwnerInternalName()), info.getFieldName(), true);
}
private static class None extends StackValue {
@@ -488,20 +464,8 @@ public abstract class StackValue {
@Override
public void put(Type type, InstructionAdapter v) {
if (type == Type.VOID_TYPE) {
return;
}
if (type.equals(JET_TUPLE0_TYPE)) {
putTuple0Instance(v);
return;
}
if (type != Type.BOOLEAN_TYPE && !type.equals(OBJECT_TYPE) && !type.equals(getType(Boolean.class))) {
throw new UnsupportedOperationException("don't know how to put a compare as a non-boolean type " + type);
}
putAsBoolean(v);
if (type != Type.BOOLEAN_TYPE) {
box(Type.BOOLEAN_TYPE, type, v);
}
coerceTo(type, v);
}
@Override
@@ -580,17 +544,8 @@ public abstract class StackValue {
@Override
public void put(Type type, InstructionAdapter v) {
if (type == Type.VOID_TYPE) {
myOperand.put(type, v); // the operand will remove itself from the stack if needed
return;
}
if (type != Type.BOOLEAN_TYPE && !type.equals(OBJECT_TYPE) && !type.equals(getType(Boolean.class))) {
throw new UnsupportedOperationException("don't know how to put a compare as a non-boolean type");
}
putAsBoolean(v);
if (type != Type.BOOLEAN_TYPE) {
box(Type.BOOLEAN_TYPE, type, v);
}
coerceTo(type, v);
}
@Override
@@ -1062,7 +1017,7 @@ public abstract class StackValue {
public void store(Type topOfStackType, InstructionAdapter v) {
coerceFrom(topOfStackType, v);
v.load(index, OBJECT_TYPE);
v.swap();
AsmUtil.swap(v, sharedTypeForType(this.type), topOfStackType);
Type refType = refType(this.type);
Type sharedType = sharedTypeForType(this.type);
v.visitFieldInsn(PUTFIELD, sharedType.getInternalName(), "ref", refType.getDescriptor());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -19,9 +19,6 @@ package org.jetbrains.jet.codegen.binding;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.resolve.BindingContext;
/**
* @author alex.tkachman
*/
public class BindingContextAware {
@NotNull protected final BindingContext bindingContext;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -19,9 +19,6 @@ package org.jetbrains.jet.codegen.binding;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.resolve.BindingTrace;
/**
* @author alex.tkachman
*/
public class BindingTraceAware extends BindingContextAware {
@NotNull protected final BindingTrace bindingTrace;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -29,9 +29,6 @@ import org.jetbrains.jet.lang.psi.JetDelegatorToSuperCall;
import java.util.List;
import java.util.Map;
/**
* @author alex.tkachman
*/
public interface CalculatedClosure {
@Nullable

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -19,11 +19,15 @@ package org.jetbrains.jet.codegen.binding;
import com.intellij.util.containers.Stack;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.ClassDescriptorImpl;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
@@ -36,9 +40,6 @@ import static org.jetbrains.jet.codegen.CodegenUtil.peekFromStack;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.*;
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
/**
* @author alex.tkachman
*/
class CodegenAnnotatingVisitor extends JetVisitorVoid {
private final Map<String, Integer> anonymousSubclassesCount = new HashMap<String, Integer>();
@@ -67,7 +68,9 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
Collections.singleton((funDescriptor.getReceiverParameter() != null
? KotlinBuiltIns.getInstance().getExtensionFunction(arity)
: KotlinBuiltIns.getInstance().getFunction(arity)).getDefaultType()), JetScope.EMPTY,
Collections.<ConstructorDescriptor>emptySet(), null);
Collections.<ConstructorDescriptor>emptySet(),
null,
false);
assert PsiCodegenPredictor.checkPredictedClassNameForFun(bindingContext, funDescriptor, classDescriptor);
bindingTrace.record(CLASS_FOR_FUNCTION, funDescriptor, classDescriptor);
@@ -195,8 +198,8 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
private String getName(ClassDescriptor classDescriptor) {
String base = peekFromStack(nameStack);
return classDescriptor.getContainingDeclaration() instanceof NamespaceDescriptor ? base.isEmpty() ? classDescriptor.getName()
.getName() : base + '/' + classDescriptor.getName() : base + '$' + classDescriptor.getName();
return DescriptorUtils.isTopLevelDeclaration(classDescriptor) ? base.isEmpty() ? classDescriptor.getName()
.getName() : base + '/' + classDescriptor.getName() : base + '$' + classDescriptor.getName();
}
@Override
@@ -256,13 +259,15 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
super.visitNamedFunction(function);
nameStack.pop();
}
else if (containingDeclaration instanceof NamespaceDescriptor) {
else if (DescriptorUtils.isTopLevelDeclaration(functionDescriptor)) {
String peek = peekFromStack(nameStack);
FqName qualifiedName = ((PackageFragmentDescriptor) containingDeclaration).getFqName();
String packageClassName = PackageClassUtils.getPackageClassName(qualifiedName);
if (peek.isEmpty()) {
peek = JvmAbi.PACKAGE_CLASS;
peek = packageClassName;
}
else {
peek += "/" + JvmAbi.PACKAGE_CLASS;
peek += "/" + packageClassName;
}
nameStack.push(peek + '$' + function.getName());
super.visitNamedFunction(function);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -16,15 +16,19 @@
package org.jetbrains.jet.codegen.binding;
import com.google.common.collect.Lists;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.ClassDescriptorImpl;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.ModuleSourcesManager;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.name.FqName;
@@ -41,9 +45,6 @@ import static org.jetbrains.jet.codegen.CodegenUtil.isInterface;
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDeclaration;
/**
* @author alex.tkachman
*/
public class CodegenBinding {
public static final WritableSlice<ClassDescriptor, MutableClosure> CLOSURE = Slices.createSimpleSlice();
@@ -58,9 +59,9 @@ public class CodegenBinding {
private CodegenBinding() {
}
public static void initTrace(BindingTrace bindingTrace, Collection<JetFile> files) {
public static void initTrace(@NotNull ModuleSourcesManager moduleManager, @NotNull BindingTrace bindingTrace, @NotNull Collection<JetFile> files) {
CodegenAnnotatingVisitor visitor = new CodegenAnnotatingVisitor(bindingTrace);
for (JetFile file : allFilesInNamespaces(bindingTrace.getBindingContext(), files)) {
for (JetFile file : allFilesInNamespaces(moduleManager, files)) {
file.accept(visitor);
}
}
@@ -127,7 +128,8 @@ public class CodegenBinding {
Collections.singletonList(KotlinBuiltIns.getInstance().getAnyType()),
JetScope.EMPTY,
Collections.<ConstructorDescriptor>emptySet(),
null);
null,
false);
recordClosure(bindingTrace, null, classDescriptor, null, className, false);
@@ -135,18 +137,26 @@ public class CodegenBinding {
bindingTrace.record(CLASS_FOR_FUNCTION, scriptDescriptor, classDescriptor);
}
private static boolean canHaveOuter(BindingContext bindingContext, @NotNull ClassDescriptor classDescriptor) {
final ClassKind kind = classDescriptor.getKind();
public static boolean canHaveOuter(BindingContext bindingContext, @NotNull ClassDescriptor classDescriptor) {
if (isSingleton(bindingContext, classDescriptor)) {
return false;
}
if (kind == ClassKind.ENUM_CLASS) {
ClassDescriptor enclosing = enclosingClassDescriptor(bindingContext, classDescriptor);
if (enclosing == null) {
return false;
}
final ClassDescriptor enclosing = enclosingClassDescriptor(bindingContext, classDescriptor);
return enclosing != null && !isSingleton(bindingContext, enclosing);
ClassKind kind = classDescriptor.getKind();
if (kind == ClassKind.CLASS) {
return classDescriptor.isInner() || !(classDescriptor.getContainingDeclaration() instanceof ClassDescriptor);
}
else if (kind == ClassKind.OBJECT) {
return !isSingleton(bindingContext, enclosing);
}
else {
return false;
}
}
public static boolean isSingleton(BindingContext bindingContext, @NotNull ClassDescriptor classDescriptor) {
@@ -208,25 +218,27 @@ public class CodegenBinding {
registerClassNameForScript(bindingTrace, descriptor, className);
}
@NotNull public static Collection<JetFile> allFilesInNamespaces(BindingContext bindingContext, Collection<JetFile> files) {
@NotNull
public static Collection<JetFile> allFilesInNamespaces(@NotNull ModuleSourcesManager moduleManager, @NotNull Collection<JetFile> files) {
// todo: we use Set and add given files but ignoring other scripts because something non-clear kept in binding
// for scripts especially in case of REPL
final HashSet<FqName> names = new HashSet<FqName>();
for (JetFile file : files) {
if (!file.isScript()) {
names.add(JetPsiUtil.getFQName(file));
}
}
final HashSet<JetFile> answer = new HashSet<JetFile>();
Set<JetFile> answer = new HashSet<JetFile>();
answer.addAll(files);
for (FqName name : names) {
final NamespaceDescriptor namespaceDescriptor = bindingContext.get(BindingContext.FQNAME_TO_NAMESPACE_DESCRIPTOR, name);
final Collection<JetFile> jetFiles = bindingContext.get(NAMESPACE_TO_FILES, namespaceDescriptor);
if (jetFiles != null)
answer.addAll(jetFiles);
for (JetFile file : files) {
if (file.isScript()) continue;
FqName fqName = JetPsiUtil.getFQName(file);
ModuleDescriptor module = moduleManager.getSubModuleForFile(file).getContainingDeclaration();
Collection<JetFile> filesByPackage = getPackageFragmentSources(moduleManager, module, fqName);
assert filesByPackage.contains(file) : "Inconsistent behavior of module manager: " +
"file " + file + " does not belong to " +
"its package " + fqName + " in " +
"its module " + module;
answer.addAll(filesByPackage);
}
List<JetFile> sortedAnswer = new ArrayList<JetFile>(answer);
@@ -247,10 +259,27 @@ public class CodegenBinding {
return sortedAnswer;
}
public static boolean isMultiFileNamespace(BindingContext bindingContext, FqName fqName) {
final NamespaceDescriptor namespaceDescriptor = bindingContext.get(BindingContext.FQNAME_TO_NAMESPACE_DESCRIPTOR, fqName);
final Collection<JetFile> jetFiles = bindingContext.get(NAMESPACE_TO_FILES, namespaceDescriptor);
return jetFiles != null && jetFiles.size() > 1;
@NotNull
private static Collection<JetFile> getPackageFragmentSources(
@NotNull ModuleSourcesManager moduleManager,
@NotNull ModuleDescriptor module,
@NotNull FqName packageFqName
) {
Collection<JetFile> result = Lists.newArrayList();
for (SubModuleDescriptor subModule : module.getSubModules()) {
Collection<PackageFragmentDescriptor> fragments = subModule.getPackageFragmentProvider().getPackageFragments(packageFqName);
for (PackageFragmentDescriptor fragment : fragments) {
result.addAll(moduleManager.getPackageFragmentSources(fragment));
}
}
return result;
}
public static boolean isMultiFileNamespace(@NotNull ModuleSourcesManager moduleSourcesManager, @NotNull ModuleDescriptor module, @NotNull FqName fqName) {
return getPackageFragmentSources(moduleSourcesManager, module, fqName).size() > 1;
}
public static boolean isObjectLiteral(BindingContext bindingContext, ClassDescriptor declaration) {
@@ -334,17 +363,17 @@ public class CodegenBinding {
}
}
DeclarationDescriptor container = descriptor.getContainingDeclaration();
if (container == null) {
throw new IllegalStateException("descriptor has no container: " + descriptor);
}
DeclarationDescriptor container = DescriptorUtils.getParentInPackageViewHierarchy(descriptor);
Name name = descriptor.getName();
if (container instanceof PackageViewDescriptor && DescriptorUtils.isRootNamespace((PackageViewDescriptor) container)) {
return name.getIdentifier();
}
String baseName = getJvmInternalName(bindingTrace, container).getInternalName();
if (!baseName.isEmpty()) {
return baseName + (container instanceof NamespaceDescriptor ? "/" : "$") + name.getIdentifier();
return baseName + (DescriptorUtils.isTopLevelDeclaration(descriptor) ? "/" : "$") + name.getIdentifier();
}
return name.getIdentifier();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -29,9 +29,6 @@ import org.jetbrains.jet.lang.psi.JetDelegatorToSuperCall;
import java.util.*;
/**
* @author alex.tkachman
*/
public final class MutableClosure implements CalculatedClosure {
private final JetDelegatorToSuperCall superCall;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -25,12 +25,10 @@ import org.jetbrains.jet.codegen.NamespaceCodegen;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.resolve.DelegatingBindingTrace;
import org.jetbrains.jet.lang.resolve.*;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.util.slicedmap.WritableSlice;
@@ -79,6 +77,11 @@ public final class PsiCodegenPredictor {
// TODO: Method won't give correct class name for traits implementations
JetDeclaration parentDeclaration = PsiTreeUtil.getParentOfType(declaration, JetDeclaration.class);
if (parentDeclaration instanceof JetClassObject) {
assert declaration instanceof JetObjectDeclaration : "Only object declarations can be children of JetClassObject: " + declaration;
return getPredefinedJvmClassName(parentDeclaration);
}
JvmClassName parentClassName = parentDeclaration != null ?
getPredefinedJvmClassName(parentDeclaration) :
getPredefinedJvmClassName((JetFile) declaration.getContainingFile(), false);
@@ -139,9 +142,10 @@ public final class PsiCodegenPredictor {
private static JvmClassName addPackageClass(JvmClassName packageName) {
FqName name = packageName.getFqName();
String packageClassName = PackageClassUtils.getPackageClassName(name);
return name.isRoot() ?
JvmClassName.byFqNameWithoutInnerClasses(JvmAbi.PACKAGE_CLASS) :
JvmClassName.byInternalName(packageName.getInternalName() + "/" + JvmAbi.PACKAGE_CLASS);
JvmClassName.byFqNameWithoutInnerClasses(packageClassName) :
JvmClassName.byInternalName(packageName.getInternalName() + "/" + packageClassName);
}
public static boolean checkPredictedClassNameForFun(
@@ -200,6 +204,7 @@ public final class PsiCodegenPredictor {
@Nullable
public static JetFile getFileForCodegenNamedClass(
@NotNull BindingContext context,
@NotNull ModuleSourcesManager moduleSourcesManager,
@NotNull List<JetFile> allNamespaceFiles,
@NotNull final JvmClassName className
) {
@@ -217,7 +222,7 @@ public final class PsiCodegenPredictor {
}
};
CodegenBinding.initTrace(trace, allNamespaceFiles);
CodegenBinding.initTrace(moduleSourcesManager, trace, allNamespaceFiles);
return resultingDescriptor.isNull() ? null
: BindingContextUtils.getContainingFile(trace.getBindingContext(), resultingDescriptor.get());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -22,9 +22,6 @@ import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.CLOSURE;
/**
* @author alex.tkachman
*/
public class AnonymousClassContext extends CodegenContext {
public AnonymousClassContext(
JetTypeMapper typeMapper,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -22,9 +22,6 @@ import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.CLOSURE;
/**
* @author alex.tkachman
*/
public class ClassContext extends CodegenContext {
public ClassContext(
JetTypeMapper typeMapper,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -25,9 +25,6 @@ import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.CLOSURE;
/**
* @author alex.tkachman
*/
class ClosureContext extends CodegenContext {
private final ClassDescriptor classDescriptor;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -26,20 +26,16 @@ import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.codegen.state.JetTypeMapper;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.ConstructorDescriptorImpl;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static org.jetbrains.jet.codegen.AsmUtil.CAPTURED_THIS_FIELD;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.CLASS_FOR_FUNCTION;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.FQN;
import static org.jetbrains.jet.codegen.binding.CodegenBinding.*;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
/*
* @author max
* @author alex.tkachman
*/
public abstract class CodegenContext {
public static final CodegenContext STATIC = new RootContext();
@@ -94,7 +90,7 @@ public abstract class CodegenContext {
while (true) {
assert c != null;
DeclarationDescriptor contextDescriptor = c.getContextDescriptor();
if (!(contextDescriptor instanceof ClassDescriptor) && !(contextDescriptor instanceof NamespaceDescriptor)) {
if (!(contextDescriptor instanceof ClassDescriptor) && !(contextDescriptor instanceof PackageViewDescriptor)) {
c = c.getParentContext();
}
else {
@@ -139,11 +135,11 @@ public abstract class CodegenContext {
return contextKind;
}
public CodegenContext intoNamespace(NamespaceDescriptor descriptor) {
public CodegenContext intoNamespace(@NotNull PackageViewDescriptor descriptor) {
return new NamespaceContext(descriptor, this, OwnerKind.NAMESPACE);
}
public CodegenContext intoNamespacePart(String delegateTo, NamespaceDescriptor descriptor) {
public CodegenContext intoNamespacePart(String delegateTo, PackageViewDescriptor descriptor) {
return new NamespaceContext(descriptor, this, new OwnerKind.StaticDelegateKind(delegateTo));
}
@@ -269,12 +265,12 @@ public abstract class CodegenContext {
}
protected void initOuterExpression(JetTypeMapper typeMapper, ClassDescriptor classDescriptor) {
final ClassDescriptor enclosingClass = getEnclosingClass();
outerExpression = enclosingClass != null
? StackValue
.field(typeMapper.mapType(enclosingClass), CodegenBinding.getJvmInternalName(typeMapper.getBindingTrace(), classDescriptor),
CAPTURED_THIS_FIELD,
false)
ClassDescriptor enclosingClass = getEnclosingClass();
outerExpression = enclosingClass != null && canHaveOuter(typeMapper.getBindingContext(), classDescriptor)
? StackValue.field(typeMapper.mapType(enclosingClass),
CodegenBinding.getJvmInternalName(typeMapper.getBindingTrace(), classDescriptor),
CAPTURED_THIS_FIELD,
false)
: null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -23,9 +23,6 @@ import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
/**
* @author alex.tkachman
*/
public class ConstructorContext extends MethodContext {
private static final StackValue local1 = StackValue.local(1, OBJECT_TYPE);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/*
* @author max
*/
package org.jetbrains.jet.codegen.context;
import org.jetbrains.asm4.Type;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -31,9 +31,6 @@ import static org.jetbrains.jet.codegen.binding.CodegenBinding.classNameForAnony
import static org.jetbrains.jet.codegen.binding.CodegenBinding.isLocalNamedFun;
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.callableDescriptorToDeclaration;
/**
* @author alex.tkachman
*/
public interface LocalLookup {
boolean lookupLocal(DeclarationDescriptor descriptor);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -26,9 +26,6 @@ import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
import org.jetbrains.jet.lang.descriptors.PropertyAccessorDescriptor;
/**
* @author alex.tkachman
*/
public class MethodContext extends CodegenContext {
public MethodContext(
@NotNull FunctionDescriptor contextType,
@@ -44,7 +41,7 @@ public class MethodContext extends CodegenContext {
@Override
public StackValue lookupInContext(DeclarationDescriptor d, @Nullable StackValue result, GenerationState state, boolean ignoreNoOuter) {
if (getContextDescriptor() == d) {
return StackValue.local(0, AsmTypeConstants.OBJECT_TYPE);
return result != null ? result : StackValue.local(0, AsmTypeConstants.OBJECT_TYPE);
}
//noinspection ConstantConditions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -18,13 +18,10 @@ package org.jetbrains.jet.codegen.context;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.codegen.OwnerKind;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
import org.jetbrains.jet.lang.descriptors.PackageViewDescriptor;
/**
* @author alex.tkachman
*/
public class NamespaceContext extends CodegenContext {
public NamespaceContext(NamespaceDescriptor contextDescriptor, CodegenContext parent, @NotNull OwnerKind kind) {
public NamespaceContext(@NotNull PackageViewDescriptor contextDescriptor, CodegenContext parent, @NotNull OwnerKind kind) {
super(contextDescriptor, kind, parent, null, null, null);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -26,9 +26,6 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor;
import java.util.List;
/**
* @author alex.tkachman
*/
class RootContext extends CodegenContext {
public RootContext() {
super(new FakeDescriptor(), OwnerKind.NAMESPACE, null, null, null, null);
@@ -57,7 +54,7 @@ class RootContext extends CodegenContext {
}
@Override
public DeclarationDescriptor substitute(TypeSubstitutor substitutor) {
public DeclarationDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
throw new IllegalStateException();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -23,9 +23,6 @@ import org.jetbrains.jet.codegen.binding.MutableClosure;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
/**
* @author alex.tkachman
*/
public class ScriptContext extends CodegenContext {
@NotNull
private final ScriptDescriptor scriptDescriptor;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
* Copyright 2010-2013 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.
@@ -30,9 +30,6 @@ import java.util.List;
import static org.jetbrains.jet.codegen.AsmUtil.correctElementType;
/**
* @author alex.tkachman
*/
public class ArrayGet implements IntrinsicMethod {
@Override
public StackValue generate(

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