question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clashes of variable when using => in ECLIPSE

See original GitHub issue

Describe the bug A clear and concise description of what the bug is.

image

See the entity in the emission of the event, should NOT be the one in the agent, but seems ECLIPSE is thinking it is that one rather the data in the event class.

Error is in the IDE and even in CLI:

[ERROR] Failed to execute goal io.sarl.maven:sarl-maven-plugin:0.11.0:compile (default-compile) on project agtcity-sarl-base: Assignment to final variable [/home/ssardina/git/soft/agents/MAC-AgtCity/2018-rmit/agtcity-sarl-base.git/src/main/sarl/au/edu/rmit/agtgrp/agtcity/sarl/agents/dummy/SuperSingleAgent.sarl:245] -> [Help 1]

Expected behavior

No error should be given.

System configuration: – SARL version: 0.11.0 – SARL compiler: 0.11.0

    • [] Eclipse compiler without Maven
    • Eclipse compiler with Maven
    • [X ] Maven compiler on the command line
    • sarlc compiler – Java JDK version (with the manufacturer name): 1.8 – Operating System:
    • Linux 64bits
    • Windows 64bits
    • MacOS 64bits

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gallandarakhneorgcommented, Feb 14, 2021

You’re right. For who will be interested about the base reason, the compiler searches for a variable of name v following the steps:

  1. if a local variable named v is accessible, it is used;
  2. if an attribute for it, i.e. it.v, it is used;
  3. if an attribute for this, i.e. this.v, it is used;
  4. if a variable v is statically imported, it is used.
1reaction
gallandarakhneorgcommented, Feb 13, 2021

I assume that the event E_MoveRandomly contains the declaration of a field named entity.

A quick fix should be: new E_MoveRandomly => [this.entity = entityName].

Read more comments on GitHub >

github_iconTop Results From Across the Web

Epsilon » [Patch] Clash between "default" variables ... - Eclipse
into some problems when running my EuGENia fix scripts for the Ecore ... "default" has now become a keyword, and there is a...
Read more >
Does Eclipse have a way to detect variable name collisions ...
In Eclipse 3.5 you can find it here: Window > Preferences > Java > Compiler > Errors/Warnings > Name shadowing and conflicts.
Read more >
Activiti User Guide
Activiti runs on a JDK higher than or equal to version 7. Go to Oracle Java SE downloads and click on button "Download...
Read more >
Eclipse Git Tutorial - Vogella.com
This view shows you the Git repositories you can work with in Eclipse and allows you to add existing repositories to Eclipse, create...
Read more >
Migrate from Eclipse to IntelliJ IDEA - JetBrains
Windows management in IntelliJ IDEA is slightly different from Eclipse. You can't open several windows with one project, but you can detach any ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found