I am trying to call a method of my selfmade "Filter" class, but the Compiler can not find the method.
It is a little bit tricky, because I write my code in Eclipse where everything seems to be fine. But I have to copy my code into another Software and compile it there as well. This Compiler on the other hand can not find my method.
I assume that the Eclipse Compiler maybe "allows" more errors of which I am not even aware of. The other Compiler however struggles with them.
Here is what the "other" Compiler prints as error code:
C:\Program Files\Enomic\enomic-server\data\rules\testcompileboehmch\CodeTest.java:77: error: cannot find symbol filt.setHasRemoved(true);
symbol: method setHasRemoved(boolean)
location: variable filt of type tms.Filter
I have no idea why my class is incorrect. As said above in eclipse everything works fine.
The CodeTest Class(cut down to the important part):
package tms;
import tms.Filter;
import java.util.*;
Filter filt = new Filter();
filt.setHasRemoved(true);//cannot be found
My Filter class:
package tms;
import java.util.ArrayList;
import java.util.List;
public class Filter {
private List<Object> remainingList;
private List<Object> removedList;
private Object typ;
private boolean hasRemoved;
public Filter()
{
this.remainingList = new ArrayList<Object>();
this.removedList = new ArrayList<Object>();
this.typ = new Object();
this.hasRemoved = false;
}
public Filter(List<Object> remaining, List<Object> removed, Object typ, boolean hasRemoved)
{
this.remainingList = new ArrayList<>();
if(remaining != null)
{
this.remainingList.addAll(remaining);
}
this.removedList = new ArrayList<>();
if(removed != null)
{
this.removedList.addAll(removed);
}
this.typ = typ;
this.hasRemoved = hasRemoved;
}
//Set-Methoden
public void setRemainingList(List<Object> list)
{
this.remainingList.clear();
this.remainingList.addAll(list);
}
public void setRemovedList(List<Object> list)
{
this.removedList.clear();
this.removedList.addAll(list);
}
public void setTyp(Object val)
{
this.typ = val;
}
public void setHasRemoved(boolean val)
{
this.hasRemoved = val;
}
//Get-Methoden
public List<Object> getRemainingList()
{
return this.remainingList;
}
public List<Object> getRemovedList()
{
return this.removedList;
}
public Object getTyp()
{
return this.typ;
}
public boolean getHasRemoved()
{
return this.hasRemoved;
}
}
I really do not know why this doesn't work. Is there any mistake I can't see?