im trying to define a simple function in drools :
function void difference(List<String> fileOld, List<String> fileNew)
{
ArrayList<String> add = new ArrayList<String>(fileNew);
add.removeAll(fileOld);
System.out.println("files Added: " + add);
ArrayList<String> remove = new ArrayList<String>(fileOld);
remove.removeAll(fileNew);
System.out.println("files Removed: " + remove);
}
but it says Unable to resolve type List while building function. java.lang.ClassNotFoundException: Unable to find class 'List' ] Cannot make a static reference to the non-static method getFileOld() from the type FileData Cannot make a static reference to the non-static method getFileNew() from the type FileData
My rules are:
rule "files are equal"
when
FileData(fileOld == fileNew)
then
System.out.println("files are equal");
end
rule "files not equal"
when
not FileData(fileOld == fileNew)
then
System.out.println("files are not equal");
difference(FileData.getFileOld(),FileData.getFileNew());
end
fileOld and fileNew are the list of filenames in a folder at two different instances. im trying to find the difference between fileOld and fileNew and display the list of files added/deleted.
Unable to find class 'List' ] Cannot make a static reference to the non-static method getFileOld() from the type FileData Cannot make a static reference to the non-static method getFileNew() from the type FileData
From above statements in your question , it seems you are accessing nonstatic methods by FileData (I think its a class).If methods are nonstatic then you cant access your methods lisk this
Classname.nonstatic_method (not-allowed)
Classname.static_method (allowed)
Try your code by making your both methods static. OR make object of FileData and then access nonstatic methods