Date.format() no signature of method

@Keyword
public String generateEmail () {
	Date today = new Date();
	String todaysDate = today.format('YYYYMMdd');
	String nowTime = today.format('HHmmss');
	String email = ((('ua-' + todaysDate) + 'T') + nowTime) + '@mailinator.com';
	return email;
}

I use the above code in two different projects. In the first project, everything works as expected. In the second project(which was made more recently), Katalon does not recognize either .format() method, as shown by the runtime error. The entire class was copied from the working project. I also tried using the following code and it produced the same issue on the .format() methods, as suggested in Katalon Studio 7.9 rc - Bug in Date().format(<String>).

@Keyword
public String generateEmail () {
	Date today = new Date();
	SimpleDateFormat date = new SimpleDateFormat('YYYYMMdd');
	SimpleDateFormat time = new Date('HHmmss');
	String email = ((('ua-' + date.format(today)) + 'T') + time.format(today)) + '@mailinator.com';
	return email;
}

org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: com.MyKeywords.Date.format() is applicable for argument types: (java.lang.String) values: [YYYYMMdd]
Possible solutions: getAt(java.lang.String), print(java.io.PrintWriter), print(java.lang.Object)
at com.MyKeywords.Email.invokeMethod(Email.groovy)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
at Given_NoAccount_BookAPartyAsIntended.run(Given_NoAccount_BookAPartyAsIntended:98)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:369)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:339)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:331)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:248)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1626466343503.run(TempTestCase1626466343503.groovy:25)
Caused by: groovy.lang.MissingMethodException: No signature of method: com.MyKeywords.Date.format() is applicable for argument types: (java.lang.String) values: [YYYYMMdd]
Possible solutions: getAt(java.lang.String), print(java.io.PrintWriter), print(java.lang.Object)
at com.MyKeywords.Email.generateEmail(Email.groovy:10)
… 14 more

You need to ensure you import the necessary resource file: How to add days & years to current date

You have probably noticed already that on the first line you correctly create a new SimpleDateFormat object, however, on the second line you aren’t. Fix that and then review @Dave_Evers link.

This message proves that you have a class com.MyKeywords.Date. This naming is horrible. You should never name your class as Date because it will confuse people.

When you write in a Test Case,

new Date('HHmmss')

You may expect to get an instance of com.MyKeyword.Date class, but others (@Dave_Evers, @grylion54, and I) would think you want to create an instance of java.util.Date. But the constructor signature Date(String s) was deprecated years ago, and would not work. So they would get confused.

If I were you, I would rename your class to be unique; for example, rename com.MyKeywords.Date to my.keywords.MyWonderfulDate.

I would advise you; you should no longer use java.util.Date and SimpleDateFormat class. These are decades old and poorly designed.

Java 8 introduced new (but already 7 years old) Date/Time API to replace the classic Date and Calendar API.

Java 8 Date/Time (java.time.LocalDateTime and java.time.format.DateTimeFormatter) is far better than the classic. No reason to continue using classics ( java.util.Date and java.text.SimpleDateFormat).

See the following article to learn the new API:

https://www.baeldung.com/java-8-date-time-intro