/** Same as {@link #compare(IQualifiedNameProvider, Type, Type)}, but for several types. */ /* package */ static <T extends Type> int compareTypes(IQualifiedNameProvider fqnProvider, Iterable<T> tvs1, Iterable<T> tvs2) { final Iterator<T> iter1 = tvs1.iterator(); final Iterator<T> iter2 = tvs2.iterator(); while (iter1.hasNext() && iter2.hasNext()) { final int c = compare(fqnProvider, iter1.next(), iter2.next()); if (c != 0) { return c; } } if (iter1.hasNext()) { return 1; } if (iter2.hasNext()) { return -1; } return 0; }
/** Same as {@link #compare(IQualifiedNameProvider, TypeArgument, TypeArgument)}, but for several type arguments. */ /* package */ static <T extends TypeArgument> int compareTypeArguments(IQualifiedNameProvider fqnProvider, Iterable<T> tvs1, Iterable<T> tvs2) { final Iterator<T> iter1 = tvs1.iterator(); final Iterator<T> iter2 = tvs2.iterator(); while (iter1.hasNext() && iter2.hasNext()) { final int c = compare(fqnProvider, iter1.next(), iter2.next()); if (c != 0) { return c; } } if (iter1.hasNext()) { return 1; } if (iter2.hasNext()) { return -1; } return 0; }
private static int compareFormalParameters(IQualifiedNameProvider fqnProvider, Iterable<TFormalParameter> fpars1, Iterable<TFormalParameter> fpars2) { final Iterator<TFormalParameter> iter1 = fpars1.iterator(); final Iterator<TFormalParameter> iter2 = fpars2.iterator(); while (iter1.hasNext() && iter2.hasNext()) { final int c = compareFormalParameters(fqnProvider, iter1.next(), iter2.next()); if (c != 0) { return c; } } if (iter1.hasNext()) { return 1; } if (iter2.hasNext()) { return -1; } return 0; }
protected boolean createEObjectDescriptions(IQualifiedNameProvider qualifiedNameProvider, boolean isNsURI, EObject eObject, IAcceptor<IEObjectDescription> acceptor) { try { QualifiedName qualifiedName = qualifiedNameProvider.getFullyQualifiedName(eObject); if (qualifiedName != null) { Map<String, String> userData = Maps.newHashMapWithExpectedSize(1); userData.put(NS_URI_INDEX_ENTRY, Boolean.toString(isNsURI)); IEObjectDescription description = EObjectDescription.create(qualifiedName, eObject, userData); acceptor.accept(description); return true; } } catch (Exception exc) { LOG.error(exc.getMessage(), exc); } return false; }
@Override protected void configure() { this.<Resource.Factory>bind(Resource.Factory.class).to(JavaResource.Factory.class); this.<IResourceValidator>bind(IResourceValidator.class).toInstance(IResourceValidator.NULL); this.<IGenerator>bind(IGenerator.class).to(IGenerator.NullGenerator.class); this.<IEncodingProvider>bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class); this.<IResourceServiceProvider>bind(IResourceServiceProvider.class).to(JavaResourceServiceProvider.class); this.<IContainer.Manager>bind(IContainer.Manager.class).to(SimpleResourceDescriptionsBasedContainerManager.class); this.<IResourceDescription.Manager>bind(IResourceDescription.Manager.class).to(JavaResourceDescriptionManager.class); this.<IQualifiedNameProvider>bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class); this.<String>bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("java"); this.<String>bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.java.Java"); this.<IJvmTypeProvider.Factory>bind(IJvmTypeProvider.Factory.class).to(ClasspathTypeProviderFactory.class); this.<ClassLoader>bind(ClassLoader.class).toInstance(JavaSourceLanguageRuntimeModule.class.getClassLoader()); this.<IReferableElementsUnloader>bind(IReferableElementsUnloader.class).to(IReferableElementsUnloader.GenericUnloader.class); final IResourceDescriptionsProvider _function = (ResourceSet it) -> { return ChunkedResourceDescriptions.findInEmfObject(it); }; this.<IResourceDescriptionsProvider>bind(IResourceDescriptionsProvider.class).toInstance(_function); }
@Before public void setUp() throws Exception { EObject copy = EcoreUtil.copy(EcorePackage.eINSTANCE); resource = new ResourceImpl(); resource.getContents().add(copy); IQualifiedNameProvider nameProvider = new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { if (obj instanceof ENamedElement) return QualifiedName.create(((ENamedElement) obj).getName()); return null; } }; DefaultResourceDescriptionStrategy descriptionStrategy = new DefaultResourceDescriptionStrategy(); descriptionStrategy.setQualifiedNameProvider(nameProvider); resourceDescription = new DefaultResourceDescription(resource, descriptionStrategy) { @Override public Iterable<QualifiedName> getImportedNames() { return importedNames; } }; manager = new DefaultResourceDescriptionManager(); importedNames = Collections.emptySet(); }
@Before public void setUp() throws Exception { resourceSet = new ResourceSetImpl(); IQualifiedNameProvider qualifiedNameProvider = new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { return QualifiedName.create(((ENamedElement) obj).getName()); } @Override public QualifiedName apply(EObject from) { return QualifiedName.create(((ENamedElement) from).getName()); } }; resourceDescriptionManager = new DefaultResourceDescriptionManager(); resourceDescriptionManager.setCache(IResourceScopeCache.NullImpl.INSTANCE); DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy(); strategy.setQualifiedNameProvider(qualifiedNameProvider); resourceDescriptionManager.setStrategy(strategy); resDescs = new ResourceSetBasedResourceDescriptions(); resDescs.setContext(resourceSet); resDescs.setRegistry(this); container = new ResourceDescriptionsBasedContainer(resDescs); }
@Test public void testGetExportedObject_1() throws Exception { strategy.setQualifiedNameProvider(new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { if (obj instanceof EPackage) return QualifiedName.create(((EPackage) obj).getName()); return null; } }); Iterable<IEObjectDescription> iterable = description.getExportedObjects(); ArrayList<IEObjectDescription> list = Lists.newArrayList(iterable); assertEquals(1, list.size()); assertEquals(pack.getName(), list.get(0).getName().toString()); assertEquals(pack, list.get(0).getEObjectOrProxy()); }
@Test public void testGetExportedObject_2() throws Exception { strategy.setQualifiedNameProvider(new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { if (obj instanceof EClassifier) return QualifiedName.create(((EClassifier) obj).getName()); return null; } }); Iterable<IEObjectDescription> iterable = description.getExportedObjects(); ArrayList<IEObjectDescription> list = Lists.newArrayList(iterable); assertEquals(2, list.size()); assertEquals(eClass.getName(), list.get(0).getName().toString()); assertEquals(eClass, list.get(0).getEObjectOrProxy()); assertEquals(dtype.getName(), list.get(1).getName().toString()); assertEquals(dtype, list.get(1).getEObjectOrProxy()); }
/** {@inheritDoc} */ @Override public boolean createEObjectDescriptions(final EObject from, final IAcceptor<IEObjectDescription> acceptor) { final IQualifiedNameProvider nameProvider = getQualifiedNameProvider(); if (nameProvider == null) { return false; } try { return doCreateEObjectDescriptions(from, acceptor); // CHECKSTYLE:OFF (IllegalCatch) } catch (final Exception e) { // We need to catch arbitrary exceptions here, otherwise building may fail spectacularly; // and the cause may be very hard to find (likely some bug in an export specification). // CHECKSTYLE:ON LOGGER.error(MessageFormat.format(Messages.AbstractSdkResourceDescription_OBJECT_DESCRIPTION_FAILURE, EObjectUtil.getLocationString(from)), e); } return true; }
@Override protected void doUpdateExtension(final CheckCatalog catalog, final IPluginExtension extension, final Iterable<IPluginElement> elements) throws CoreException { final IQualifiedNameProvider nameProvider = getFromServiceProvider(IQualifiedNameProvider.class, catalog); // Get current marker help element context IDs for this catalog List<String> catalogContextIds = Lists.newArrayList(); for (final Check check : catalog.getAllChecks()) { catalogContextIds.add(getQualifiedContextId(extension, check)); } // Remove elements of this catalog for (IPluginElement e : elements) { if (e.getAttribute(CONTEXT_ID_ATTRIBUTE_TAG) != null) { String contextId = e.getAttribute(CONTEXT_ID_ATTRIBUTE_TAG).getValue(); if (isCatalogContextId(nameProvider.apply(catalog), EcoreUtil.getURI(catalog), extension, contextId)) { extension.remove(e); } } } // Add new elements Iterable<? extends IPluginObject> updatedElements = getElements(catalog, extension); for (IPluginObject object : updatedElements) { extension.add(object); } }
@Override public void configure(Binder binder) { binder.bind(IResourceValidator.class).to(SCTResourceValidatorImpl.class); binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("sct"); binder.bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class); binder.bind(IQualifiedNameProvider.class).to(StextNameProvider.class); binder.bind(org.eclipse.jface.viewers.ILabelProvider.class) .annotatedWith(org.eclipse.xtext.ui.resource.ResourceServiceDescriptionLabelProvider.class) .to(DefaultDescriptionLabelProvider.class); binder.bind(IDefaultResourceDescriptionStrategy.class).to(SCTResourceDescriptionStrategy.class); binder.bind(MarkerCreator.class).to(SCTMarkerCreator.class); binder.bind(MarkerTypeProvider.class).to(SCTMarkerTypeProvider.class); binder.bind(IDiagnosticConverter.class).to(SCTDiagnosticConverterImpl.class); binder.bind(IURIEditorOpener.class).annotatedWith(LanguageSpecific.class).to(SCTFileEditorOpener.class); binder.bind(IMarkerContributor.class).to(TaskMarkerContributor.class); binder.bind(ITaskFinder.class).to(DomainSpecificTaskFinder.class); binder.bind(TaskMarkerCreator.class).to(SCTTaskMarkerCreator.class); binder.bind(TaskMarkerTypeProvider.class).to(SCTTaskMarkerTypeProvider.class); }
private void registerGuiceBindingsRt() { new GuiceModuleAccess.BindingFactory() .addTypeToType(typeRef(IQualifiedNameProvider.class), typeRef(CommonQualifiedNameProvider.class)) .addTypeToType(typeRef(IAlternativeNameProvider.class), typeRef(CommonQualifiedNameProvider.class)) .addConfiguredBinding("IScopeProviderDelegate", new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation target) { target.append("binder.bind("); target.append(typeRef(IScopeProvider.class)); target.append(".class).annotatedWith("); target.append(typeRef(Names.class)); target.append(".named("); target.append(typeRef(AbstractDeclarativeScopeProvider.class)); target.append(".NAMED_DELEGATE)).to("); target.append(typeRef(CooperateImportedNamespaceAwareLocalScopeProvider.class)); target.append(".class);"); } }).contributeTo(getLanguage().getRuntimeGenModule()); }
/** * Create an empty instance that will accept EObjects to keep information that is reusable. */ public Data(IQualifiedNameProvider qualifiedNameProvider) { this.qualifiedNameProvider = qualifiedNameProvider; this.valueStrings = Sets.newHashSet(); this.applicableTypes = Sets.newHashSet(); this.typesOrModulesToFind = Sets.newTreeSet(); }
/** WARNING: fqnProvider may be <code>null</code>, but then the lower/greater info will be unreliable! */ /* package */ static int compare(IQualifiedNameProvider fqnProvider, Type t1, Type t2) { if (t1 == t2) { return 0; } if (t1 == null) { return -1; } if (t2 == null) { return 1; } if (fqnProvider != null) { // standard behavior relying on a fqnProvider final QualifiedName name1 = fqnProvider.getFullyQualifiedName(t1); final QualifiedName name2 = fqnProvider.getFullyQualifiedName(t2); if (name1 == null && name2 == null) { // since we know t1!=null && t2!=null, this means t1 and t2 are types without a FQN (i.e. for which // fqnProvider returns null), e.g. type variables, and since we know t1!=t2 (from above) we must // report a difference here! return 1; } if (name1 == null) { return -1; } if (name2 == null) { return 1; } return name1.compareTo(name2); } else { // fall-back behavior if fqnProvider not available return 1; // note: we already know t1!=t2 } }
private static int compareFormalParameters(IQualifiedNameProvider fqnProvider, TFormalParameter p1, TFormalParameter p2) { if (p1 == p2) { return 0; } if (p1 == null) { return -1; } if (p2 == null) { return 1; } int c; // name c = compareComparables(p1.getName(), p2.getName()); if (c != 0) { return c; } // type c = compare(fqnProvider, p1.getTypeRef(), p2.getTypeRef()); if (c != 0) { return c; } // optional c = Boolean.compare(p1.isOptional(), p2.isOptional()); if (c != 0) { return c; } // variadic c = Boolean.compare(p1.isVariadic(), p2.isVariadic()); if (c != 0) { return c; } return 0; }
/** * Returns the matching (internal) name of the polyfill matching the given classifier. There are no polyfills of * polyfills, so the returned name is independent from the polyfill flag of the given classifier. */ public static QualifiedName getPolyfillFQN(TClassifier tClassifier, IQualifiedNameProvider qualifiedNameProvider) { QualifiedName prefix = qualifiedNameProvider.getFullyQualifiedName(EcoreUtil.getRootContainer(tClassifier)); if ("n4ts".equals(tClassifier.eResource().getURI().fileExtension())) { // } instanceof TObjectPrototype) { prefix = append(prefix, GLOBAL_NAMESPACE_SEGMENT); // TODO this has to be removed, instead, also n4ts files should use "#" as global namespace segment } prefix = append(prefix, POLYFILL_SEGMENT); return append(prefix, tClassifier.getName()); }
/** * Static case: Returns the matching (internal) name of the polyfill matching the given classifier. There are no * polyfills of polyfills, so the returned name is independent from the polyfill flag of the given classifier. */ public static QualifiedName getStaticPolyfillFQN(TClassifier tClassifier, IQualifiedNameProvider qualifiedNameProvider) { QualifiedName prefix = qualifiedNameProvider.getFullyQualifiedName(EcoreUtil.getRootContainer(tClassifier)); // if ("n4ts".equals(tClassifier.eResource().getURI().fileExtension())) { // } instanceof TObjectPrototype) { // prefix = append(prefix, GLOBAL_NAMESPACE_SEGMENT); // // TODO this has to be removed, instead, also n4ts files should use "#" as global namespace segment // } prefix = prepend(MODULE_POLYFILL_SEGMENT, prefix); prefix = append(prefix, POLYFILL_SEGMENT); return append(prefix, tClassifier.getName()); }
/** * Creates a new description for the given resource. */ public N4JSResourceDescription(N4JSCrossReferenceComputer crossReferenceComputer, TypeHelper typeHelper, IQualifiedNameProvider qualifiedNameProvider, Resource resource, N4JSResourceDescriptionStrategy strategy, IResourceScopeCache cache) { super(resource, strategy, cache); this.crossReferenceComputer = crossReferenceComputer; this.qualifiedNameProvider = qualifiedNameProvider; this.typeHelper = typeHelper; this.strategy = strategy; }
public TypeSystemAwareScope(IScope parent, ITypeSystem typeSystemAccess, IQualifiedNameProvider qualifiedNameProvider, EClass eClass) { super(parent, false); this.typeSystem = typeSystemAccess; this.qualifiedNameProvider = qualifiedNameProvider; this.eClass = eClass; }
public ImportedNamespaceAwareLocalScopeProvider(IGlobalScopeProvider globalScopeProvider, IQualifiedNameProvider qualifiedNameProvider, IQualifiedNameConverter qualifiedNameConverter, ICaseInsensitivityHelper caseInsensitivityHelper) { super(globalScopeProvider, caseInsensitivityHelper); this.qualifiedNameProvider = qualifiedNameProvider; this.qualifiedNameConverter = qualifiedNameConverter; }
@Override public void generate() { new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IQualifiedNameProvider.class), TypeReference.typeRef(DefaultDeclarativeQualifiedNameProvider.class)).contributeTo(this.getLanguage().getRuntimeGenModule()); new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher"), TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.FQNPrefixMatcher")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultDependentElementsCalculator")).contributeTo(this.getLanguage().getEclipsePluginGenModule()); new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher"), TypeReference.typeRef("org.eclipse.xtext.ide.editor.contentassist.FQNPrefixMatcher")).contributeTo(this.getLanguage().getIdeGenModule()); }
protected IResourceDescription createResourceDescription(Resource testResource) { DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy(); strategy.setQualifiedNameProvider(new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { String name = SimpleAttributeResolver.NAME_RESOLVER.apply(obj); return (name != null) ? QualifiedName.create(name) : null; } }); IResourceDescription resourceDescription = new DefaultResourceDescription(testResource, strategy); return resourceDescription; }
@Before public void setUp() throws Exception { resource = new XMLResourceImpl(); resource.setURI(URI.createURI("foo:/test")); nameProvider = new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { if (obj instanceof ENamedElement) return QualifiedName.create(((ENamedElement) obj).getName()); return null; } }; strategy = new DefaultResourceDescriptionStrategy(); strategy.setQualifiedNameProvider(nameProvider); description = new DefaultResourceDescription(resource, strategy); EcoreFactory f = EcoreFactory.eINSTANCE; pack = f.createEPackage(); pack.setName("MyPackage"); eClass = f.createEClass(); eClass.setName("MyEClass"); dtype = f.createEDataType(); dtype.setName("MyDatatype"); pack.getEClassifiers().add(eClass); pack.getEClassifiers().add(dtype); resource.getContents().add(pack); }
protected IResourceDescription createResourceDescription(Resource testResource) { DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy(); strategy.setQualifiedNameProvider(new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { String name = SimpleAttributeResolver.NAME_RESOLVER.apply(obj); return (name != null) ? QualifiedName.create(name) : null; } }); strategy.setLazyURIEncoder(new LazyURIEncoder()); IResourceDescription resourceDescription = new DefaultResourceDescription(testResource, strategy); return resourceDescription; }
/** {@inheritDoc} */ @Override public Set<Binding> getGuiceBindingsRt(final Grammar grammar) { final BindFactory bindFactory = new BindFactory(); final String namingPrefix = GrammarUtil.getNamespace(grammar) + ".naming." + GrammarUtil.getName(grammar); //$NON-NLS-1$ final String resourcePrefix = GrammarUtil.getNamespace(grammar) + ".resource." + GrammarUtil.getName(grammar); //$NON-NLS-1$ ExportModel m = getModel(grammar); if (m != null) { bindFactory.addTypeToType(IQualifiedNameProvider.class.getName(), namingPrefix + "ExportedNamesProvider"); //$NON-NLS-1$ if (!m.getInterfaces().isEmpty()) { bindFactory.addTypeToType(IFingerprintComputer.class.getName(), resourcePrefix + "FingerprintComputer"); //$NON-NLS-1$ } if (!m.getExports().isEmpty()) { bindFactory.addTypeToType(IDefaultResourceDescriptionStrategy.class.getName(), resourcePrefix + "ResourceDescriptionStrategy"); //$NON-NLS-1$ } if (Iterables.any(m.getExports(), new Predicate<Export>() { @Override public boolean apply(final Export input) { return input.isFingerprint() && input.getFragmentAttribute() != null; } })) { bindFactory.addTypeToType(IFragmentProvider.class.getName(), resourcePrefix + "FragmentProvider"); } } bindFactory.addTypeToType(IResourceDescription.Manager.class.getName(), resourcePrefix + "ResourceDescriptionManager"); //$NON-NLS-1$ return bindFactory.getBindings(); }
@Override protected Iterable<IEObjectDescription> getAllLocalElements() { loadDefinitions(); if (loadedModel == null) { return ImmutableList.of(); } XtextResource resource = (XtextResource) loadedModel.eResource(); IQualifiedNameProvider nameProvider = resource.getResourceServiceProvider().get(IQualifiedNameProvider.class); return Scopes.scopedElementsFor(ImmutableList.of(loadedModel), nameProvider); }
@Override public void removeExtensionFromPluginBase(final IPluginModelBase base, final IPluginExtension extension, final CheckCatalog catalog, final ExtensionType type) throws CoreException { final IQualifiedNameProvider nameProvider = getFromServiceProvider(IQualifiedNameProvider.class, catalog); if (extension.getChildCount() == Iterables.size(getElements(nameProvider.apply(catalog), catalog.eResource().getURI(), extension))) { // remove whole extension, all existing marker elements belong to this catalog base.getPluginBase().remove(extension); } else { // only remove elements of this catalog, other catalogs have marker elements for (IPluginElement e : getElements(nameProvider.apply(catalog), catalog.eResource().getURI(), extension)) { extension.remove(e); } } }
@Before public void setup() { Module m = new Module(){ @Override public void configure(Binder binder) { binder.bind(INamingService.class).to(DefaultNamingService.class); binder.bind(IQualifiedNameProvider.class).to(SGraphNameProvider.class); binder.bind(ITypeSystem.class).toInstance(GenericTypeSystem.getInstance()); binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class); } }; Injector injector = Guice.createInjector(m); injector.injectMembers(this); }
public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() { return DefaultDeclarativeQualifiedNameProvider.class; }
/** * Public for testing purpose */ public void setQualifiedNameProvider(IQualifiedNameProvider qualifiedNameProvider) { this.qualifiedNameProvider = qualifiedNameProvider; }
private static int compareFunctionTypeExprOrRefs(IQualifiedNameProvider fqnProvider, FunctionTypeExprOrRef f1, FunctionTypeExprOrRef f2) { if (f1 == f2) { return 0; } if (f1 == null) { return -1; } if (f2 == null) { return 1; } // note: we do *not* require f1.eClass() == f2.eClass() int c; // name (if any) c = compareComparables(getFunctionName(f1), getFunctionName(f2)); if (c != 0) { return c; } // declared this type c = compare(fqnProvider, f1.getDeclaredThisType(), f2.getDeclaredThisType()); if (c != 0) { return c; } // type parameters c = compareTypes(fqnProvider, f1.getTypeVars(), f2.getTypeVars()); if (c != 0) { return c; } // return type c = compare(fqnProvider, f1.getReturnTypeRef(), f2.getReturnTypeRef()); if (c != 0) { return c; } // fpars c = compareFormalParameters(fqnProvider, f1.getFpars(), f2.getFpars()); if (c != 0) { return c; } return 0; }
private static int compareMembers(IQualifiedNameProvider fqnProvider, TStructMember m1, TStructMember m2) { if (m1 == m2) { return 0; } if (m1 == null) { return -1; } if (m2 == null) { return 1; } int c; // EClass c = compareEClasses(m1.eClass(), m2.eClass()); if (c != 0) { return c; } // access modifier c = compareComparables(m1.getMemberAccessModifier(), m2.getMemberAccessModifier()); if (c != 0) { return c; } // name c = compareComparables(m1.getName(), m2.getName()); if (c != 0) { return c; } // type (in case of field/getter/setter) or return type (in case of method) c = compare(fqnProvider, getMemberTypeRef(m1), getMemberTypeRef(m2)); // for methods: will check // the // return type if (c != 0) { return c; } // fpars (in case of method) if (m1 instanceof TStructMethod) { final TStructMethod method1 = (TStructMethod) m1; final TStructMethod method2 = (TStructMethod) m2; c = compareFormalParameters(fqnProvider, method1.getFpars(), method2.getFpars()); if (c != 0) { return c; } } return 0; }
public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() { return SimpleNameProvider.class; }
@Override public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() { return N4JSQualifiedNameProvider.class; }