Commit Graph

2877 Commits

Author SHA1 Message Date
Alexander Udalov d5e47a61ad Extract JavaMemberResolver out of JDR
JavaDescriptorResolver had a lot of methods which were used only in Java*Scope.
This is not good because JDR is a facade class that everyone uses from outside
and it's not required to find methods/fields/...
This logic is now extracted to JavaMemberResolver, which is passed to a scope
and is used to resolve its members ('members' here means classes, namespaces,
functions, properties, constructors)
2013-09-04 21:55:05 +04:00
Alexander Udalov 5eb82ae45b Extract signature checking logic into an interface
Combine JavaMethodSignatureUtil and RawTypesCheck utility classes into a new
PsiBasedMethodSignatureChecker
2013-09-04 21:55:05 +04:00
Alexander Udalov e93c573898 Create JavaSignatureFormatter, a wrapper over PsiFormatUtil 2013-09-04 21:55:05 +04:00
Alexander Udalov 94a99d33ea Get rid of trace in JavaSupertypeResolver
The only place where it was used was INCOMPLETE_HIERARCHY report, which didn't
work at all (added TODO about it)
2013-09-04 21:55:05 +04:00
Alexander Udalov af2c03ad70 Get rid of trace in JavaClassResolver and JavaNamespaceResolver
Create TraceBasedErrorReporter which reports ABI errors to the trace
2013-09-04 21:55:05 +04:00
Alexander Udalov ab0224ef5c Minor, KotlinClassFileHeader now exposes a FqName 2013-09-04 21:55:05 +04:00
Alexander Udalov adc5f251ef Add source descriptors lookup to JavaResolverCache
Use JavaResolverCache instead of BindingTrace in JavaClassResolver and
JavaNamespaceResolver
2013-09-04 21:55:05 +04:00
Alexander Udalov 640b05cfe9 Extract enum method utilities from DescriptorResolver
Create overloaded versions which accept JetType as a parameter to use them in
JDR where there's no deferred types
2013-09-04 21:55:05 +04:00
Alexander Udalov d34a6d85e7 Remove BindingTrace from Java function and property resolvers
Extract FakeOverrideVisibilityResolver which invokes OverrideResolver with the
trace
2013-09-04 21:55:04 +04:00
Alexander Udalov 480ef9ea66 Create JavaResolverCache
An abstraction over BindingTrace which will be used in JDR
2013-09-04 21:55:04 +04:00
Alexander Udalov 760e4002cf Extract interface out of ExternalSignatureResolver 2013-09-04 21:55:04 +04:00
Alexander Udalov 16d63f6109 Create PropagatedMethodSignature nested class
Should be an abstraction over SignaturesPropagationData
2013-09-04 21:55:04 +04:00
Alexander Udalov 1cc4b42756 Use ExternalSignatureResolver to resolve field signatures 2013-09-04 21:55:04 +04:00
Alexander Udalov be3d835203 Refactor alternative method signatures
Create ExternalSignatureResolver which can resolve propagated and alternative
signatures, use it in JavaFunctionResolver and JavaConstructorResolver.

Move JavaValueParameterResolver.ValueParameters to SignaturesPropagationData,
since elsewhere it always had receiverType = null
2013-09-04 21:55:04 +04:00
Alexander Udalov 45346071a3 Minor, encapsulate logic 2013-09-04 21:55:04 +04:00
Alexander Udalov 517567fd24 Get rid of SAM_CONSTRUCTOR_TO_INTERFACE
use SamConstructorDescriptor instead
2013-09-04 21:55:04 +04:00
Alexander Udalov 4a620dfcbb Get rid of SAM_ADAPTER_FUNCTION_TO_ORIGINAL
Use SAM adapters hierarchy instead
2013-09-04 21:55:04 +04:00
Alexander Udalov f76942fd19 Get rid of JavaBindingContext.IS_DECLARED_IN_JAVA
Create specialized Java descriptor classes instead
2013-09-04 21:55:03 +04:00
Alexander Udalov 70c7fbc6d1 Refactor override resolution in JDR
Unify the code between JavaFunctionResolver and JavaPropertyResolver
2013-09-04 21:55:03 +04:00
Alexander Udalov 520f812030 getContainingClass() is never null for methods and fields 2013-09-04 21:55:03 +04:00
Alexander Udalov 4e1fb7e0eb Add JavaValueParameter.isVararg() 2013-09-04 21:55:03 +04:00
Alexander Udalov be5ba7fa0d Migrate PropagationHeuristics from PSI to JavaElement
Aside from refactorings, minor changes in logic are made:
- to find out if a type of a value parameter is vararg ('ellipsis type'), we
  now check if the method is vararg and the parameter is its last parameter
  (instead of 'instanceof PsiEllipsisType')
- 'visitedSuperclasses' is now a Set: this better reflects what it's supposed
  to represent. Also result check of the 'add()' method on a List was useless
2013-09-04 21:55:03 +04:00
Alexander Udalov 2c4c1d7cc6 hashCode, equals, toString for JavaElement 2013-09-04 21:55:03 +04:00
Alexander Udalov 34a552abfc Migrate the rest of resolvers from PSI to JavaElement
JavaMethodSignatureUtil needs to be handled specially later
2013-09-04 21:55:03 +04:00
Alexander Udalov f1892372eb Move and rename JDR.ValueParameterDescriptors 2013-09-04 21:55:02 +04:00
Alexander Udalov cc45cf2a4e Rename JavaSignatureResolver to TypeParameterResolver
Also rename 'parameterResolver' field to 'valueParameterResolver'
2013-09-04 21:55:02 +04:00
Alexander Udalov 944d1fc59e Refactor JavaSignatureResolver
Now it has the only method returning Initializer, an object which can be told
to initialize resolved descriptors later, or to obtain these descriptors.
Delete useless methods, combine the remaining ones
2013-09-04 21:55:02 +04:00
Alexander Udalov a1f3a56c25 Refactor TypeVariableResolver
Delete 'context' field which was used only for debugging
2013-09-04 21:55:02 +04:00
Alexander Udalov 04516376c0 Migrate SAMUtils from PSI to JavaElement
- create JavaTypeSubstitutor as a mirror for PsiSubstitutor
- copy-paste MethodSignatureUtil.areSignaturesErasureEqual() and migrate it to
  JavaTypeSubstitutor
- use a pair of method and substitutor instead of
  'MethodSignatureBackedByPsiMethod'
- add JavaClass.getDefaultType() which goes into JavaPsiFacade and creates an
  unsubstituted PsiClassType for the class
- green code

The only PSI usage left is TypeConversionUtil.erasure(), which needs to be
copied and migrated somehow
2013-09-04 21:55:02 +04:00
Alexander Udalov a3d9d4fe66 Move classes around in java-specific parts of compiler
- move JetClsMethod and JetJavaMirrorMarker to 'jetAsJava' package
- move JetClsMethodImpl out of 'wrappers' packages
- move TypeVariableResolver to 'resolver' package, make it package-local
- move MembersCache and NamedMembers to 'scope', make the former package-local
2013-09-04 21:55:02 +04:00
Alexander Udalov c18615f704 Rename JavaCompileTimeConstResolver to AnnotationArgumentResolver 2013-09-04 21:55:02 +04:00
Alexander Udalov f98a949fdd Migrate JavaAnnotationResolver from PSI to JavaElement
Create a bunch of annotation argument classes, which serve as wrappers over
PsiAnnotationMemberValue class, but also have a Name
2013-09-04 21:55:02 +04:00
Alexander Udalov 7b945c2313 Migrate JavaTypeTransformer from PsiType to JavaType
Add more wrapper methods to JavaClassifierType.

Inline the utility method adjustTypeUsageWithMutabilityAnnotations to the two
places where it was used. Also add JavaAnnotationOwner and change signature of
JavaAnnotationResolver to take JavaAnnotationOwner, not PSI
2013-09-04 21:55:01 +04:00
Alexander Udalov 732378d837 Rename JavaClassType to JavaClassifierType 2013-09-04 21:55:01 +04:00
Alexander Udalov c1d40f1e15 Introduce JavaClassifier
JavaClassifier is a common type for JavaClass and JavaTypeParameter. In almost
all of the places JavaClass remains to be JavaClass, except for the resolution
result of JavaClassType, which can be a type parameter. Add an assertion that
JavaClass is created only for a class and not for a type parameter. Delete
different creations of JavaClass in 'idea' (where there can be a type
parameter) by changing the interface of util functions.

Delete JavaModifierListOwnerImpl, extract its methods into JavaElementUtil and
use these implementations for every JavaModifierListOwner

Continue refactoring JavaTypeTransformer to work with JavaType, not PsiType
2013-09-04 21:55:01 +04:00
Alexander Udalov 787d8a5234 Refactor JavaTypeTransformer and ValueParameterResolver
Use an instanceof-chain on a JavaType instance instead of PsiTypeVisitor in
TypeTransformer. Add a special method to handle vararg types, use it in
ValueParameterResolver
2013-09-04 21:55:01 +04:00
Alexander Udalov f669771b7e Introduce JavaType and subclasses
Use JavaType instead of PsiType whenever possible.

In this commit the logic of checking whether a loaded parameter is a vararg
changed: instead of checking if the corresponding PsiType is PsiEllipsisType we
now check if the containing method has the ACC_VARARG modifier
2013-09-04 21:55:01 +04:00
Alexander Udalov 998e598846 Refactor JavaConstructorResolver
Extract methods, fix warnings, use JavaClass/JavaMethod instead of Psi
2013-09-04 21:55:01 +04:00
Alexander Udalov 62868421cf Minor, green code & move type transformer to "resolver/" 2013-09-04 21:55:01 +04:00
Alexander Udalov 78f9cb7203 Get rid of PsiMemberWrapper
Continue migration, use the new Java* classes instead everywhere
2013-09-04 21:55:01 +04:00
Alexander Udalov 245b9d1ab1 Minor, change method parameter from String to JvmClassName 2013-09-04 21:55:00 +04:00
Alexander Udalov 55af245867 Migrate JavaClassResolver from PSI to JavaClass
Several places are still left and need special handling.  The overall behavior
of the resolver should not change in this commit (except for maybe different
small operations like creating names, fq-names, ...)
2013-09-04 21:55:00 +04:00
Alexander Udalov de54f7d732 JavaClass, JavaPackage, JavaAnnotation
Create dumb wrappers over PSI elements, will be used for loading descriptors
from JVM reflection later (instead of PSI)
2013-09-04 21:55:00 +04:00
Alexander Udalov eaacff4566 Remove RuntimeHandleClassesMode
There were two usages of RuntimeHandleClassesMode.REPORT_ERROR: first in tests,
where it never occurred, second in JavaClassResolver, where it's now inlined
2013-09-04 21:55:00 +04:00
Alexander Udalov 4eb9f28312 Remove useless PsiClass parameter
It was used only for a debug message and an assertion that never happened
2013-09-04 21:55:00 +04:00
Alexander Udalov cc81d12b55 Remove useless methods from PsiClassFinder
Their only implementations called methods on a parameter + a utility. Move the
utility to DescriptorResolverUtils
2013-09-04 21:55:00 +04:00
Alexander Udalov 175a598e6d Delete JavaBaseScope.getPsiElement() 2013-09-04 21:55:00 +04:00
Alexander Udalov d84ab4423f Support enums as annotation arguments in deserialized Kotlin descriptors 2013-08-29 16:48:09 +04:00
Alexander Udalov de062274e9 Extract getEnumEntriesScope utility method 2013-08-29 16:48:09 +04:00
Pavel V. Talanov e0c9328969 Remove unused DependencyClassByQualifiedNameResolver#resolveNamespace 2013-08-26 22:15:08 +04:00