liquid-java / liquid-java/latte
Access this.root.value error
Open
Nobody has claimed this yet.
bug
- Dominant language
- Java
- Stars
- 3
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Error when accessing this.root.value.
@Unique Node test(@Borrowed Node n){
Object value1 = n.value;
Object value2 = this.root.value;
if (value1.equals(value2)) {
return n;
} else {
return null;
}
}
Error:
Local variable value2 = this.root.value has assignment with null symbolic value
Let's try to fix it.
Full example to test:
package examples;
import specification.Borrowed;
import specification.Free;
import specification.Unique;
public class MyStackTest {
@Unique Node root;
public MyStackTest(@Free Node root) {
this.root = root;
}
@Unique Node test(@Borrowed Node n){
Object value1 = n.value;
Object value2 = this.root.value;
if (value1.equals(value2)) {
return n;
} else {
return null;
}
}
}
/**
* Node class for the stack example
* Uses @Unique annotations to specify that the value and next fields are unique
* in the scope of the Node class
* @author catarina gamboa
*
*/
class Node {
@Unique Object value;
@Unique Node next;
/**
* Constructor for the Node class using @Free value and next nodes
* @param value
* @param next
*/
public Node (@Free Object value, @Free Node next) {
this.value = value;
this.next = next;
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported error with the full MyStackTest and Node example in the issue, focusing on analysis of this.root.value. Trace why that access receives a null symbolic value; done when the example no longer reports the assignment error and the existing value comparison remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100