private void checkModifiersAndAnnotationsInPackageDirective(JetFile file) { JetPackageDirective packageDirective = file.getPackageDirective(); if (packageDirective == null) return; JetModifierList modifierList = packageDirective.getModifierList(); if (modifierList == null) return; for (JetAnnotationEntry annotationEntry : modifierList.getAnnotationEntries()) { JetConstructorCalleeExpression calleeExpression = annotationEntry.getCalleeExpression(); if (calleeExpression != null) { JetReferenceExpression reference = calleeExpression.getConstructorReferenceExpression(); if (reference != null) { trace.report(UNRESOLVED_REFERENCE.on(reference, reference)); } } } AnnotationTargetChecker.INSTANCE$.check(packageDirective, trace); ModifiersChecker.reportIllegalModifiers( modifierList, Arrays.asList(JetTokens.MODIFIER_KEYWORDS_ARRAY), trace); }
private static void storeResolutionResult( @NotNull Collection<DeclarationDescriptor> descriptors, @NotNull Collection<DeclarationDescriptor> canBeImportedDescriptors, @NotNull JetSimpleNameExpression referenceExpression, @NotNull Collection<JetScope> possibleResolutionScopes, @NotNull BindingTrace trace, @NotNull JetScope scopeToCheckVisibility) { assert canBeImportedDescriptors.size() <= descriptors.size(); assert !possibleResolutionScopes.isEmpty(); // todo completion here needs all possible resolution scopes, if there are many JetScope resolutionScope = possibleResolutionScopes.iterator().next(); // A special case - will fill all trace information if (resolveClassPackageAmbiguity( canBeImportedDescriptors, referenceExpression, resolutionScope, trace, scopeToCheckVisibility)) { return; } // Simple case of no descriptors if (descriptors.isEmpty()) { trace.record(BindingContext.RESOLUTION_SCOPE, referenceExpression, resolutionScope); trace.report(UNRESOLVED_REFERENCE.on(referenceExpression, referenceExpression)); return; } // Decide if expression has resolved reference DeclarationDescriptor descriptor = null; if (descriptors.size() == 1) { descriptor = descriptors.iterator().next(); assert canBeImportedDescriptors.size() <= 1; } else if (canBeImportedDescriptors.size() == 1) { descriptor = canBeImportedDescriptors.iterator().next(); } if (descriptor != null) { trace.record( BindingContext.REFERENCE_TARGET, referenceExpression, descriptors.iterator().next()); trace.record(BindingContext.RESOLUTION_SCOPE, referenceExpression, resolutionScope); if (descriptor instanceof DeclarationDescriptorWithVisibility) { checkVisibility( (DeclarationDescriptorWithVisibility) descriptor, trace, referenceExpression, scopeToCheckVisibility); } } // Check for more information and additional errors if (canBeImportedDescriptors.isEmpty()) { assert descriptors.size() >= 1; trace.report(CANNOT_BE_IMPORTED.on(referenceExpression, descriptors.iterator().next())); return; } if (canBeImportedDescriptors.size() > 1) { trace.record(BindingContext.AMBIGUOUS_REFERENCE_TARGET, referenceExpression, descriptors); } }