code
stringlengths
73
34.1k
label
stringclasses
1 value
@SuppressWarnings("static-method") protected String getGeneratedMemberAccessor(MemberDescription description) { return "get" //$NON-NLS-1$ + Strings.toFirstUpper(description.getElementDescription().getElementType().getSimpleName()) + "()"; //$NON-NLS-1$ }
java
protected Binding bindAnnotatedWith(TypeReference bind, TypeReference annotatedWith, TypeReference to, String functionName) { final StringConcatenationClient client = new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation builder) { builder.append("binder.bind("); /...
java
protected Binding bindAnnotatedWithNameToInstance(TypeReference bind, String name, String to, String functionName) { String tmpName = Strings.emptyIfNull(name); if (tmpName.startsWith(REFERENCE_PREFIX)) { tmpName = tmpName.substring(REFERENCE_PREFIX.length()).trim(); } else { tmpName = "\"" + tmpName + "...
java
protected Binding bindToInstance(TypeReference bind, String functionName, String instanceExpression, boolean isSingleton, boolean isEager) { final BindKey type; final BindValue value; if (!Strings.isEmpty(functionName) && functionName.startsWith(CONFIGURE_PREFIX)) { final String fname = functionName.substri...
java
public void add(Binding binding, boolean override) { final Set<Binding> moduleBindings = this.module.get().getBindings(); final Binding otherBinding = findBinding(moduleBindings, binding); if (!override) { if (otherBinding != null) { throw new IllegalArgumentException(MessageFormat.format( "Forbidden...
java
public void contributeToModule() { final GuiceModuleAccess module = this.module.get(); if (!this.removableBindings.isEmpty()) { // Ok, we are broking the Java secutiry manager. // But it's for having something working! try { final Field field = module.getClass().getDeclaredField("bindings"); //$NON-NLS...
java
public Binding toBinding(BindingElement element) { final TypeReference typeReference = typeRef(element.getBind()); final String annotatedWith = element.getAnnotatedWith(); final String annotatedWithName = element.getAnnotatedWithName(); if (!Strings.isEmpty(annotatedWith)) { final TypeReference annotationTyp...
java
protected void enableNature(IProject project) { final IFile pom = project.getFile(IMavenConstants.POM_FILE_NAME); final Job job; if (pom.exists()) { job = createJobForMavenProject(project); } else { job = createJobForJavaProject(project); } if (job != null) { job.schedule(); } }
java
@SuppressWarnings("static-method") protected Job createJobForMavenProject(IProject project) { return new Job(Messages.EnableSarlMavenNatureAction_0) { @Override protected IStatus run(IProgressMonitor monitor) { final SubMonitor mon = SubMonitor.convert(monitor, 3); try { // The project should be ...
java
@SuppressWarnings("static-method") protected Job createJobForJavaProject(IProject project) { return new Job(Messages.EnableSarlMavenNatureAction_0) { @Override protected IStatus run(IProgressMonitor monitor) { final SubMonitor mon = SubMonitor.convert(monitor, 3); // Force the project configuration to...
java
protected void fireAgentSpawnedOutsideAgent(UUID spawningAgent, AgentContext context, Class<? extends Agent> agentClazz, List<Agent> agents, Object... initializationParameters) { // Notify the listeners on the spawn events (not restricted to a single agent) for (final SpawnServiceListener l : this.globalListener...
java
protected void fireAgentSpawnedInAgent(UUID spawningAgent, AgentContext context, Agent agent, Object... initializationParameters) { // Notify the listeners on the lifecycle events inside // the just spawned agent. // Usually, only BICs and the AgentLifeCycleSupport in // io.janusproject.kernel.bic.StandardBuilt...
java
public SynchronizedSet<UUID> getAgents() { final Object mutex = getAgentRepositoryMutex(); synchronized (mutex) { return Collections3.synchronizedSet(this.agents.keySet(), mutex); } }
java
Agent getAgent(UUID id) { assert id != null; synchronized (getAgentRepositoryMutex()) { return this.agents.get(id); } }
java
@SuppressWarnings("static-method") public boolean canKillAgent(Agent agent) { try { final AgentContext ac = BuiltinCapacityUtil.getContextIn(agent); if (ac != null) { final SynchronizedSet<UUID> participants = ac.getDefaultSpace().getParticipants(); if (participants != null) { synchronized (partic...
java
@SuppressWarnings({"checkstyle:npathcomplexity"}) protected void fireAgentDestroyed(Agent agent) { final ListenerCollection<SpawnServiceListener> list; synchronized (getAgentLifecycleListenerMutex()) { list = this.agentLifecycleListeners.get(agent.getID()); } final SpawnServiceListener[] ilisteners; if (l...
java
protected void initFields() { final IEclipsePreferences prefs = SARLEclipsePlugin.getDefault().getPreferences(); this.trackerLogin.setText(prefs.get(PREFERENCE_LOGIN, "")); //$NON-NLS-1$ }
java
protected void updatePageStatus() { final boolean ok; if (Strings.isEmpty(this.titleField.getText())) { ok = false; setMessage(Messages.IssueInformationPage_5, IMessageProvider.ERROR); } else if (Strings.isEmpty(this.trackerLogin.getText())) { ok = false; setMessage(Messages.IssueInformationPage_6, IM...
java
public boolean performFinish() { final IEclipsePreferences prefs = SARLEclipsePlugin.getDefault().getPreferences(); final String login = this.trackerLogin.getText(); if (Strings.isEmpty(login)) { prefs.remove(PREFERENCE_LOGIN); } else { prefs.put(PREFERENCE_LOGIN, login); } try { prefs.sync(); r...
java
@Pure public String format(String sarlCode, ResourceSet resourceSet) { try { final URI createURI = URI.createURI("synthetic://to-be-formatted." + this.fileExtension); //$NON-NLS-1$ final Resource res = this.resourceFactory.createResource(createURI); if (res instanceof XtextResource) { final XtextResourc...
java
@SuppressWarnings("static-method") public Boolean toBooleanPrimitiveWrapperConstant(XExpression expression) { if (expression instanceof XBooleanLiteral) { return ((XBooleanLiteral) expression).isIsTrue() ? Boolean.TRUE : Boolean.FALSE; } if (expression instanceof XMemberFeatureCall) { final XMemberFeatureC...
java
@Pure public boolean isFrom(UUID entityId) { final Address iSource = getSource(); return (entityId != null) && (iSource != null) && entityId.equals(iSource.getUUID()); }
java
protected void generateClosureDefinition(XClosure closure, IAppendable it, IExtraLanguageGeneratorContext context) { if (!it.hasName(closure)) { final LightweightTypeReference closureType0 = getExpectedType(closure); LightweightTypeReference closureType = closureType0; if (closureType0.isFunctionType()) { ...
java
protected void generateAnonymousClassDefinition(AnonymousClass anonClass, IAppendable it, IExtraLanguageGeneratorContext context) { if (!it.hasName(anonClass) && it instanceof PyAppendable) { final LightweightTypeReference jvmAnonType = getExpectedType(anonClass); final String anonName = it.declareSyntheticVari...
java
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:booleanexpressioncomplexity", "checkstyle:npathcomplexity"}) public static String toDefaultValue(JvmTypeReference type) { final String id = type.getIdentifier(); if (!"void".equals(id)) { //$NON-NLS-1$ if (Strings.equal(Boolean.class.getName(),...
java
protected PyFeatureCallGenerator newFeatureCallGenerator(IExtraLanguageGeneratorContext context, IAppendable it) { return new PyFeatureCallGenerator(context, (ExtraLanguageAppendable) it); }
java
protected String readSarlEclipseSetting(String sourceDirectory) { if (this.propertiesFileLocation != null) { final File file = new File(this.propertiesFileLocation); if (file.canRead()) { final Properties sarlSettings = new Properties(); try (FileInputStream stream = new FileInputStream(file)) { sa...
java
protected List<File> getClassPath() throws MojoExecutionException { if (this.bufferedClasspath == null) { final Set<String> classPath = new LinkedHashSet<>(); final MavenProject project = getProject(); classPath.add(project.getBuild().getSourceDirectory()); try { classPath.addAll(project.getCompileCla...
java
protected boolean executeExportOperation(IJarExportRunnable op, IStatus wizardPageStatus) { try { getContainer().run(true, true, op); } catch (InterruptedException e) { return false; } catch (InvocationTargetException ex) { if (ex.getTargetException() != null) { ExceptionHandler.handle(ex, getShell()...
java
public void init(IWorkbench workbench, JarPackageData jarPackage) { Assert.isNotNull(workbench); Assert.isNotNull(jarPackage); fJarPackage= jarPackage; setInitializeFromJarPackage(true); setWindowTitle(FatJarPackagerMessages.JarPackageWizard_windowTitle); setDefaultPageImageDescriptor(JavaPluginImages.DESC_...
java
protected Image convertToImage(Object imageDescription) { if (imageDescription instanceof Image) { return (Image) imageDescription; } else if (imageDescription instanceof ImageDescriptor) { return this.imageHelper.getImage((ImageDescriptor) imageDescription); } else if (imageDescription instanceof String) {...
java
@SuppressWarnings("static-method") protected int getIssueAdornment(XtendMember element) { final ICompositeNode node = NodeModelUtils.getNode(element); if (node == null) { return 0; } // Error markers are more important than warning markers. // Order of checks: // - parser error (from the resource) or se...
java
@SuppressWarnings("static-method") public IJavaElement getSelectedResource(IStructuredSelection selection) { IJavaElement elem = null; if (selection != null && !selection.isEmpty()) { final Object object = selection.getFirstElement(); if (object instanceof IAdaptable) { final IAdaptable adaptable = (IAda...
java
@Pure public String getBasePackage() { final Grammar grammar = getGrammar(); final String basePackage = this.naming.getRuntimeBasePackage(grammar); return basePackage + ".services"; //$NON-NLS-1$ }
java
protected static Iterable<Keyword> getAllKeywords(Grammar grammar) { final Map<String, Keyword> keywords = new HashMap<>(); final List<ParserRule> rules = GrammarUtil.allParserRules(grammar); for (final ParserRule parserRule : rules) { final List<Keyword> list = typeSelect(eAllContentsAsList(parserRule), Keywo...
java
protected StringConcatenationClient generateKeyword(final String keyword, final String comment, Map<String, String> getters) { final String fieldName = keyword.toUpperCase().replaceAll("[^a-zA-Z0-9_]+", "_"); //$NON-NLS-1$ //$NON-NLS-2$ final String methodName = Strings.toFirstUpper(keyword.replaceAll("[^a-zA-Z0-9_...
java
protected StringConcatenationClient generateKeyword(final Keyword keyword, final String comment, Map<String, String> getters) { try { final String methodName = getIdentifier(keyword); final String accessor = GrammarKeywordAccessFragment2.this.grammarAccessExtensions.gaAccessor(keyword); if (!Strings.isEmp...
java
@SuppressWarnings("static-method") protected String protectCommentKeyword(String keyword) { if ("*/".equals(keyword)) { //$NON-NLS-1$ return "* /"; //$NON-NLS-1$ } if ("/*".equals(keyword)) { //$NON-NLS-1$ return "/ *"; //$NON-NLS-1$ } if ("//".equals(keyword)) { //$NON-NLS-1$ return "/ /"; //$NON-N...
java
@SuppressWarnings({"checkstyle:npathcomplexity", "checkstyle:cyclomaticcomplexity"}) protected boolean isIgnorableCallToFeature(ILinkingCandidate candidate) { final JvmIdentifiableElement feature = candidate.getFeature(); // // @Deprecated // if (feature instanceof JvmOperation) { JvmAnnotationTarget targ...
java
protected void _computeTypes(SarlBreakExpression object, ITypeComputationState state) { final LightweightTypeReference primitiveVoid = getPrimitiveVoid(state); state.acceptActualType(primitiveVoid); }
java
protected void _computeTypes(SarlAssertExpression object, ITypeComputationState state) { state.withExpectation(getTypeForName(Boolean.class, state)).computeTypes(object.getCondition()); }
java
@SuppressWarnings("checkstyle:nestedifdepth") protected void _computeTypes(SarlCastedExpression cast, ITypeComputationState state) { if (state instanceof AbstractTypeComputationState) { final JvmTypeReference type = cast.getType(); if (type != null) { state.withNonVoidExpectation().computeTypes(cast.getTar...
java
@SuppressWarnings("unchecked") protected void fireEntryRemoved(K key, V value) { if (this.listeners != null) { for (final DMapListener<? super K, ? super V> listener : this.listeners.getListeners(DMapListener.class)) { listener.entryRemoved(key, value); } } }
java
@SuppressWarnings("unchecked") protected void fireEntryUpdated(K key, V value) { for (final DMapListener<? super K, ? super V> listener : this.listeners.getListeners(DMapListener.class)) { listener.entryUpdated(key, value); } }
java
@SuppressWarnings("unchecked") protected void fireCleared(boolean localClearing) { for (final DMapListener<? super K, ? super V> listener : this.listeners.getListeners(DMapListener.class)) { listener.mapCleared(localClearing); } }
java
protected Xpp3Dom createSREConfiguration() throws MojoExecutionException, MojoFailureException { final Xpp3Dom xmlConfiguration = new Xpp3Dom("configuration"); //$NON-NLS-1$ final Xpp3Dom xmlArchive = new Xpp3Dom("archive"); //$NON-NLS-1$ xmlConfiguration.addChild(xmlArchive); final String mainClass = getMainC...
java
private void runInitializationStage(Event event) { // Immediate synchronous dispatching of Initialize event try { setOwnerState(OwnerState.INITIALIZING); try { this.eventDispatcher.immediateDispatch(event); } finally { setOwnerState(OwnerState.ALIVE); } this.agentAsEventListener.fireEnqueuedE...
java
private void runDestructionStage(Event event) { // Immediate synchronous dispatching of Destroy event try { setOwnerState(OwnerState.DYING); try { this.eventDispatcher.immediateDispatch(event); } finally { setOwnerState(OwnerState.DEAD); } } catch (Exception e) { // Log the exception fin...
java
protected boolean isCapacityMethodCall(JvmOperation feature) { if (feature != null) { final JvmDeclaredType container = feature.getDeclaringType(); if (container instanceof JvmGenericType) { return this.inheritanceHelper.isSarlCapacity((JvmGenericType) container); } } return false; }
java
protected void completeJavaTypes(ContentAssistContext context, ITypesProposalProvider.Filter filter, ICompletionProposalAcceptor acceptor) { completeJavaTypes(context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, true, getQualifiedNameValueConverter(), filter, acceptor); }
java
protected void completeSarlEvents(boolean allowEventType, boolean isExtensionFilter, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { if (isSarlProposalEnabled()) { completeSubJavaTypes(Event.class, allowEventType, context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, ...
java
protected void completeSarlCapacities(boolean allowCapacityType, boolean isExtensionFilter, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { if (isSarlProposalEnabled()) { completeSubJavaTypes(Capacity.class, allowCapacityType, context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFE...
java
protected void completeSarlAgents(boolean allowAgentType, boolean isExtensionFilter, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { if (isSarlProposalEnabled()) { completeSubJavaTypes(Agent.class, allowAgentType, context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, ...
java
protected void completeSarlBehaviors(boolean allowBehaviorType, boolean isExtensionFilter, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { if (isSarlProposalEnabled()) { completeSubJavaTypes(Behavior.class, allowBehaviorType, context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFER...
java
protected void completeSarlSkills(boolean allowSkillType, boolean isExtensionFilter, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { if (isSarlProposalEnabled()) { completeSubJavaTypes(Skill.class, allowSkillType, context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, ...
java
protected void completeExceptions(boolean allowExceptionType, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { if (isSarlProposalEnabled()) { completeSubJavaTypes(Exception.class, allowExceptionType, context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, getQualifi...
java
protected void completeSubJavaTypes(Class<?> superType, boolean allowSuperTypeItself, ContentAssistContext context, EReference reference, IValueConverter<String> valueConverter, final ITypesProposalProvider.Filter filter, ICompletionProposalAcceptor acceptor) { assert superType != null; final INode lastComple...
java
protected String getExpectedPackageName(EObject model) { final URI fileURI = model.eResource().getURI(); for (final Pair<IStorage, IProject> storage: this.storage2UriMapper.getStorages(fileURI)) { if (storage.getFirst() instanceof IFile) { final IPath fileWorkspacePath = storage.getFirst().getFullPath(); ...
java
protected void completeExtends(EObject model, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { if (isSarlProposalEnabled()) { if (model instanceof SarlAgent) { completeSarlAgents(false, true, context, acceptor); } else if (model instanceof SarlBehavior) { completeSarlBehaviors(fa...
java
protected void _createChildren(DocumentRootNode parentNode, SarlScript modelElement) { if (!Strings.isNullOrEmpty(modelElement.getPackage())) { // Create the node for the package declaration. createEStructuralFeatureNode( parentNode, modelElement, XtendPackage.Literals.XTEND_FILE__PACKAGE, this.i...
java
@SuppressWarnings("checkstyle:cyclomaticcomplexity") protected void _createNode(DocumentRootNode parentNode, XtendTypeDeclaration modelElement) { // // The text region is set to the model element, not to the model element's name as in the // default implementation of createStructuralFeatureNode(). // The text ...
java
protected Image _image(XtendMember modelElement) { final Image img = super._image(modelElement); return this.diagnoticDecorator.decorateImage(img, modelElement); }
java
public IFormalParameterBuilder addParameter(String name) { IFormalParameterBuilder builder = this.parameterProvider.get(); builder.eInit(this.sarlConstructor, name, getTypeResolutionContext()); return builder; }
java
@SuppressWarnings("static-method") protected boolean isValidResource(IResource resource) { return resource.isAccessible() && !resource.isHidden() && !resource.isPhantom() && !resource.isDerived(); }
java
public ElementDescription searchAndSelect(boolean showEmptySelectionError, Object... scope) { try { final List<ElementDescription> elements = findElements(scope, PlatformUI.getWorkbench().getProgressService()); ElementDescription element = null; if (elements == null || elements.isEmpty()) { if (showEmpty...
java
private ElementDescription chooseElement(List<ElementDescription> elements) { final ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider()); dialog.setElements(elements.toArray()); dialog.setTitle(MessageFormat.format(Messages.AbstractSarlScriptInteractiveSelector_3...
java
public String getValidationDescription() { final JvmOperation feature = getOperation(); String message = null; if (!getDeclaredTypeParameters().isEmpty()) { message = MessageFormat.format(Messages.CastOperatorLinkingCandidate_0, getFeatureTypeParametersAsString(true), feature.getSimpleName(), ge...
java
private JvmAnnotationReference annotationClassRef(Class<? extends Annotation> type, List<? extends JvmTypeReference> values) { try { final JvmAnnotationReference annot = this._annotationTypesBuilder.annotationRef(type); final JvmTypeAnnotationValue annotationValue = this.services.getTypesFactory().createJvmT...
java
protected void initializeLocalTypes(GenerationContext context, JvmFeature feature, XExpression expression) { if (expression != null) { int localTypeIndex = context.getLocalTypeIndex(); final TreeIterator<EObject> iterator = EcoreUtil2.getAllNonDerivedContents(expression, true); final String nameStub = "__" +...
java
protected void setBody(JvmExecutable executable, Procedure1<ITreeAppendable> expression) { this.typeBuilder.setBody(executable, expression); }
java
protected final synchronized GenerationContext openContext(EObject sarlObject, JvmDeclaredType type, final Iterable<Class<? extends XtendMember>> supportedMemberTypes) { assert type != null; assert supportedMemberTypes != null; this.sarlSignatureProvider.clear(type); final GenerationContext context = new Gen...
java
protected final void closeContext(GenerationContext context) { boolean runPostElements = false; GenerationContext selectedContext = null; synchronized (this) { final Iterator<GenerationContext> iterator = this.bufferedContexes.iterator(); while (selectedContext == null && iterator.hasNext()) { final Gen...
java
protected final synchronized GenerationContext getContext(JvmIdentifiableElement type) { for (final GenerationContext candidate : this.bufferedContexes) { if (Objects.equal(candidate.getTypeIdentifier(), type.getIdentifier())) { return candidate; } } throw new GenerationContextNotFoundInternalError(type...
java
protected void appendDefaultConstructors(XtendTypeDeclaration source, JvmGenericType target) { final GenerationContext context = getContext(target); if (!context.hasConstructor()) { // Special case: if a value was not set, we cannot create implicit constructors // in order to have the issue message "The blan...
java
protected void initialize(SarlSkill source, JvmGenericType inferredJvmType) { // Issue #356: do not generate if the skill has no name. assert source != null; assert inferredJvmType != null; if (Strings.isNullOrEmpty(source.getName())) { return; } // Create the generation context that is used by the other...
java
protected void initialize(SarlCapacity source, JvmGenericType inferredJvmType) { // Issue #356: do not generate if the capacity has no name. assert source != null; assert inferredJvmType != null; if (Strings.isNullOrEmpty(source.getName())) { return; } // Create the generation context that is used by the...
java
@SuppressWarnings("static-method") protected void initialize(SarlSpace source, JvmGenericType inferredJvmType) { // Issue #356: do not generate if the space has no name. assert source != null; assert inferredJvmType != null; if (Strings.isNullOrEmpty(source.getName())) { return; } }
java
@Override protected void transform(XtendField source, JvmGenericType container) { super.transform(source, container); // Override the visibility final JvmField field = (JvmField) this.sarlAssociations.getPrimaryJvmElement(source); setVisibility(field, source); final GenerationContext context = getContext(co...
java
protected void appendAOPMembers( JvmGenericType featureContainerType, XtendTypeDeclaration container, GenerationContext context) { Utils.populateInheritanceContext( featureContainerType, context.getInheritedFinalOperations(), context.getInheritedOverridableOperations(), null, context.get...
java
private static StringConcatenationClient toStringConcatenation(final String... javaCodeLines) { return new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation builder) { for (final String line : javaCodeLines) { builder.append(line); ...
java
protected void appendConstrainedImplements( GenerationContext context, JvmGenericType owner, Class<?> defaultJvmType, Class<? extends XtendTypeDeclaration> defaultSarlType, List<? extends JvmParameterizedTypeReference> implementedtypes) { boolean explicitType = false; for (final JvmParameterizedTypeRefe...
java
protected void appendEventGuardEvaluators(JvmGenericType container) { final GenerationContext context = getContext(container); if (context != null) { final Collection<Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>>> allEvaluators = context.getGuardEvaluationCodes(); if (allEvaluat...
java
protected void appendSerialNumber(GenerationContext context, XtendTypeDeclaration source, JvmGenericType target) { if (!isAppendSerialNumbersEnable(context)) { return; } for (final JvmField field : target.getDeclaredFields()) { if (SERIAL_FIELD_NAME.equals(field.getSimpleName())) { return; } } f...
java
protected void appendSerialNumberIfSerializable(GenerationContext context, XtendTypeDeclaration source, JvmGenericType target) { if (!target.isInterface() && this.inheritanceHelper.isSubTypeOf(target, Serializable.class, null)) { appendSerialNumber(context, source, target); } }
java
protected void appendCloneFunction(GenerationContext context, XtendTypeDeclaration source, JvmGenericType target) { if (!isAppendCloneFunctionsEnable(context)) { return; } for (final JvmOperation operation : target.getDeclaredOperations()) { if (CLONE_FUNCTION_NAME.equals(operation.getSimpleName())) { r...
java
protected void appendSARLSpecificationVersion(GenerationContext context, XtendTypeDeclaration source, JvmDeclaredType target) { addAnnotationSafe(target, SarlSpecification.class, SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING); }
java
protected void appendSARLElementType(XtendTypeDeclaration source, JvmDeclaredType target) { addAnnotationSafe(target, SarlElementType.class, source.eClass().getClassifierID()); }
java
protected JvmTypeReference skipTypeParameters(JvmTypeReference type, Notifier context) { final LightweightTypeReference ltr = Utils.toLightweightTypeReference(type, this.services); return ltr.getRawTypeReference().toJavaCompliantTypeReference(); }
java
@SuppressWarnings("static-method") protected void translateAnnotationsTo(List<JvmAnnotationReference> annotations, JvmAnnotationTarget target, Class<?>... exceptions) { final Set<String> excepts = new HashSet<>(); for (final Class<?> type : exceptions) { excepts.add(type.getName()); } final List<JvmAnnot...
java
@SuppressWarnings("static-method") protected List<JvmTypeParameter> getTypeParametersFor(XtendTypeDeclaration type) { if (type instanceof XtendClass) { return ((XtendClass) type).getTypeParameters(); } if (type instanceof XtendInterface) { return ((XtendInterface) type).getTypeParameters(); } return Co...
java
protected JvmTypeReference cloneWithTypeParametersAndProxies(JvmTypeReference type, JvmExecutable forExecutable) { // Ensure that the executable is inside a container. Otherwise, the cloning function will fail. assert forExecutable.getDeclaringType() != null; // Get the type parameter mapping that is a consequenc...
java
protected JvmTypeReference cloneWithProxiesFromOtherResource(JvmTypeReference type, JvmOperation target) { if (type == null) { return this._typeReferenceBuilder.typeRef(Void.TYPE); } // Do not clone inferred types because they are not yet resolved and it is located within the current resource. if (InferredTy...
java
@SuppressWarnings("checkstyle:npathcomplexity") protected void copyNonStaticPublicJvmOperations(JvmGenericType source, JvmGenericType target, Set<ActionPrototype> createdActions, Procedure2<? super JvmOperation, ? super ITreeAppendable> bodyBuilder) { final Iterable<JvmOperation> operations = Iterables.transform(...
java
protected JvmTypeReference inferFunctionReturnType(XExpression body) { XExpression expr = body; boolean stop = false; while (!stop && expr instanceof XBlockExpression) { final XBlockExpression block = (XBlockExpression) expr; switch (block.getExpressions().size()) { case 0: expr = null; break; ...
java
protected JvmTypeReference inferFunctionReturnType(XtendFunction source, JvmOperation target, JvmOperation overriddenOperation) { // The return type is explicitly given if (source.getReturnType() != null) { return ensureValidType(source.eResource(), source.getReturnType()); } // An super operation was detec...
java
@SuppressWarnings("checkstyle:npathcomplexity") public void setFrom(SARLConfiguration config) { if (this.input == null) { this.input = config.getInput(); } if (this.output == null) { this.output = config.getOutput(); } if (this.binOutput == null) { this.binOutput = config.getBinOutput(); } if (t...
java
@SuppressWarnings({"static-method", "checkstyle:npathcomplexity"}) @Provides @Singleton public SarlBatchCompiler provideSarlBatchCompiler( Injector injector, Provider<SarlConfig> config, Provider<SARLBootClasspathProvider> defaultBootClasspath, Provider<IssueMessageFormatter> issueMessageFormater, Provider<...
java
@SuppressWarnings("static-method") protected Visibility applyMinMaxVisibility(Visibility visibility, MutableFieldDeclaration it, TransformationContext context) { if (context.findTypeGlobally(Agent.class).isAssignableFrom(it.getDeclaringType())) { if (visibility.compareTo(Visibility.PROTECTED) > 0) { return Vi...
java
public static <RT, T> ReflectMethod<RT, T> of(Class<RT> receiverType, Class<T> returnType, String methodName) { return new ReflectMethod<>(receiverType, returnType, methodName); }
java
public T invoke(RT receiver, Object... arguments) { assert receiver != null; final Method method; synchronized (this) { if (this.method == null) { this.method = getMethod(receiver, arguments); method = this.method; } else { method = this.method; } } try { return this.returnType.cast(me...
java