Commit Graph

2162 Commits

Author SHA1 Message Date
Alexander Udalov ad068ed4ac Do not call findKotlinClass when loading class annotations
The main change is in AbstractBinaryClassAnnotationAndConstantLoader, where we
no longer perform unnecessary IO operations for classes which are already
loaded to memory
2016-04-14 21:08:36 +03:00
Alexander Udalov 2ab68d53fa J2K KotlinJvmBinaryClass & AnnotationAndConstantLoader: convert 2016-04-14 21:08:36 +03:00
Alexander Udalov 8ace253559 Minor, remove paragraph symbols from comments
This character seems to cause problems on some build agents
2016-04-11 16:11:25 +03:00
Dmitry Petrov db58ebc4b2 KT-11410: Class hierarchy for parts/facade of multi-file class.
Preserve static initialization semantics for parts by introducing a special "clinit trigger" class.
Insert "static initialization trigger" call to every method of a part class, remove this call on inline.
Always mangle names for private functions in multifile class parts to avoid resolution clashes on inheritance.

NB in codegen tests initializers for all non-const vals are wrapped in 'run { ... }',
so that the initializer is not a constant expression, and some static initialization code should be generated.
2016-04-01 10:13:22 +03:00
Pavel V. Talanov d7dc122298 KT-11721 Wrong "Typechecker has run into recursive problem" on calling kotlin get function as synthetic property
#KT-11721 Fixed
2016-03-31 19:33:04 +03:00
Denis Zharkov 1511a03027 Fix SAM adapters substitution
Approximate sourceFunction types if it's needed

 #KT-11696 Fixed
2016-03-31 14:52:12 +03:00
Denis Zharkov bc1b34a989 Add additional visibility check for synthetic extensions
Use extension receiver as dispatch one, because it is effectively dispatch
(after some desugaring)
2016-03-31 14:51:57 +03:00
Denis Zharkov 182b349492 Clarify Visibility.isVisible contract for null as receiverValue
See comment
2016-03-31 14:51:57 +03:00
Alexander Udalov 8316953259 Fix double quotes in diagnostic messages
For diagnostics without any parameters, the given text is simply rendered as a
String, so no symbols should be escaped.

For diagnostics with parameters, the format in java.text.MessageFormat is used,
so one single quote is erased and two single quotes become one single quote in
the rendered text.
2016-03-30 21:41:43 +03:00
Alexander Udalov a8bebeb48d Load annotations of const properties from multifile classes
Rework backing field generation logic in PropertyCodegen to switch the
ClassBuilder instance for a multifile part to that of the corresponding facade
class. This became needed because multifile parts, and their metadata, are
generated _before_ the multifile facade class and otherwise we would never
record that there's a synthetic '$annotations' method for a const val and would
not write that to the protobuf message for the property.

See also bad83200

 #KT-10892 Fixed
2016-03-28 21:11:14 +03:00
Alexander Udalov d62535c388 Minor, drop unnecessary workaround of obsolete issue 2016-03-28 14:14:56 +03:00
Alexander Udalov e915e1548c Fix multiple 'unresolved java classifier' errors
Use the same component (NotFoundClasses) as in loading of compiled Kotlin
symbols.

Some tests were changed to avoid a diagnostic that is now reported when a
non-found class is encountered in a signature (e.g. staticMethod.1.java where
JDK seems to be not configured)

 #KT-10493 Fixed
 #KT-10820 Fixed
 #KT-11368 Fixed
2016-03-28 14:13:59 +03:00
Alexander Udalov db5e00bcc0 Report error if some deserialized classes are missing in dependencies
Technically we often can compile code which uses missing classes (as long as
nothing is called on them) but it seems better to let the user know something's
wrong in their setup before the error manifests itself at runtime. Also the
Java compiler does the same

 #KT-4328 Fixed
2016-03-28 14:13:59 +03:00
Alexander Udalov 3944d56ac2 Minor, remove unnecessary type parameter in CallChecker#check 2016-03-28 14:13:59 +03:00
Nikolay Krasko 00239914fa Minor: refactoring 2016-03-25 14:10:41 +03:00
Ilya Gorbunov 1ae0040ca3 Minor: make variables initialized in defineClass lateinit instead of nullable. 2016-03-21 18:37:27 +03:00
Natalia Ukhorskaya 589d7007fc Skip additional visibility check for java classes in debug mode 2016-03-18 15:19:03 +03:00
Alexander Udalov 0fd8bec2ef Convert Java model to Kotlin, put in several files
Also move JavaPropertyInitializerEvaluator to ../components/
2016-03-18 14:48:58 +03:00
Alexander Udalov 0d74fc2290 Minor cleanup in Java model: fix warnings, remove unused 2016-03-18 14:48:57 +03:00
Alexander Udalov 0a54464420 Minor, JavaClass#getOriginKind -> isKotlinLightClass 2016-03-18 14:48:56 +03:00
Alexander Udalov 0ba0e2b10d Delete JavaTypeSubstitutorImpl, use PsiSubstitutor in JavaClassImpl
Also delete related tests
2016-03-18 14:48:56 +03:00
Alexander Udalov 291c713d8b Cleanup JavaElement model from methods used only in substitutor
Downcast everything used in JavaTypeSubstitutorImpl to *Impl, remove methods
from interfaces, inline/move some of them
2016-03-18 14:48:55 +03:00
Alexander Udalov 26bf0dca13 Remove interface JavaTypeSubstitutor, use implementation
After 151e55b JavaTypeSubstitutor is only used from inside PSI-based
implementation of Java structure
2016-03-18 14:48:55 +03:00
Denis Zharkov 26081bf817 Support loading Java annotations with TYPE_PARAMETER target 2016-03-16 20:23:01 +03:00
Denis Zharkov 78c9dffe00 Refine return type of MemberScope.getContributedFunctions 2016-03-16 20:22:58 +03:00
Alexander Udalov 4f77b02a58 Rename 'ins' -> 'Ins' in BuiltinsPackageFragment and related classes 2016-03-14 20:41:46 +03:00
Alexander Udalov 11409ec6cf Move some function type utilities from descriptors to frontend 2016-03-14 19:45:09 +03:00
Alexander Udalov 2ce661af98 Rename KotlinBuiltIns.getFunctionType -> createFunctionType, move to functionTypes.kt 2016-03-14 19:24:06 +03:00
Mikhail Glukhikh f76efb68f2 Strictfp on a class is now a warning #KT-11109 Fixed 2016-03-12 13:17:11 +03:00
Denis Zharkov 151e55b2fa Use descriptors for building SAM constructors
It helps to get rid of semantics duplicating and fixes known bugs

- SOE in OnlyAbstractMethodFinder.find
- type enhancement for SAM constructors

 #KT-11287 Fixed
 #KT-11322 Fixed
 EA-77989 Fixed
2016-03-10 16:49:00 +03:00
Alexander Udalov bab127ad33 Remove some legacy codegen tests, move some to generated 2016-03-09 10:25:38 +03:00
Alexander Udalov 4553afbd0c Make PropertyAccessorDescriptor#hasBody a front-end utility 2016-03-03 16:08:18 +03:00
Denis Zharkov 56a2561ab9 Extract JvmMethodGenericSignature from JvmMethodSignature 2016-03-02 13:38:46 +03:00
Denis Zharkov 7bd8fa0b48 Optimize signature propagation
Do not collect super function with trivial signature
2016-03-02 13:38:46 +03:00
Denis Zharkov d66b9a08dd Do not map generic signature if it's unnecessary 2016-03-02 13:38:46 +03:00
Denis Zharkov 3652cd9c18 Optimize top level class searching in LazyJavaPackageScope
Do not try to search something, that is known not to exist
2016-03-02 13:38:46 +03:00
Pavel V. Talanov b399bbffd7 Improve JvmConflictingDeclarations diagnostics rendering 2016-02-26 14:45:08 +03:00
Pavel V. Talanov ced5a6c917 Introduce RenderingContext and add as parameter to DiagnosticParameterRenderer#render
RenderingContext holds data about the whole diagnostics allowing to adjust rendering of its parameters
2016-02-26 14:45:04 +03:00
Pavel V. Talanov 4f18b3da53 Rename: Renderer -> DiagnosticParameterRenderer and move it out of descriptors module
DescriptorRenderer is no longer a renderer
DescriptorRenderers should not be used to render diagnostic parameters explicitly
2016-02-26 14:45:02 +03:00
Pavel V. Talanov 77f74a929a Revert 06215ca932
It led to parameter names missing in parameter info and completion for compiled java code used from kotlin
See KT-11039
2016-02-26 14:05:47 +03:00
Stanislav Erokhin 6591f8a2ab Minor. removed unused method from AdditionalTypeChecker. 2016-02-24 19:33:06 +03:00
Stanislav Erokhin 24829ee3ac Minor. rename 2016-02-24 19:33:06 +03:00
Stanislav Erokhin 665e13e4ec Remove obsolete code about warnings for expressions which can be null in java(has @Nullable annotation in java) and in kotlin not marked nullable.
After introducing flexible types and signature enhancement there is no more such expressions.
2016-02-24 19:33:05 +03:00
Alexander Udalov 1a5a077bd6 Replace map + filterNotNull -> mapNotNull in project 2016-02-20 19:05:30 +03:00
Natalia Ukhorskaya 42927bb078 Make function delegated to sam adapter synthetic 2016-02-17 15:08:53 +03:00
Denis Zharkov 961b72682a Drop unnecessary call to substituted 'overriddenDescriptors' 2016-02-16 12:01:13 +03:00
Denis Zharkov 44148107ae Optimize SamAdapterOverridabilityCondition
Do not calculate it for non-static members,
because SAM adapters only exist in static scope now
2016-02-16 12:01:13 +03:00
Denis Zharkov 9f22b17918 Optimize external overridability conditions
- Skip ones that can lead only to success after first success
- And vice versa
2016-02-16 12:01:13 +03:00
Denis Zharkov 1b4b8ab5db Memoize 'JavaTypeClassifierImpl.isRaw' result 2016-02-16 12:01:12 +03:00
Pavel V. Talanov 1800e5a7db Remove some usages of Name.guess (and rename this utility to discourage new usages) 2016-02-15 13:32:42 +03:00