Forum Discussion

Stalsy's avatar
3 years ago

Error when referencing

I'm trying to write some code to process One-Time-Passwords using APIs. I have to read the SMSs as a Stream so I "import" but I get a compilation error "unable to resolve class".

If I "import java.util.*" then the compilation error moves to line 14 where I define the Stream: "unable to resolve class Stream @ line 14, column 1. def private Stream getMessages() { ^"

Java docs say that has been around since java 1.8

Code sample:

import com.twilio.*

import java.util.*;

import com.twilio.*

import com.twilio.base.*

import javax.jms.Message;

//import java.util.*; //uncommented gives error at line 14 -see below

import //compile error: "unable to resolve class" ;

def public static String getMessage() {

return getMessages().filter(m -> m.getDirection().compareTo(Message.Direction.INBOUND) == 0)

.filter(m -> m.getTo().equals("+61999999")).map(Message::getBody).findFirst()

.orElseThrow(IllegalStateException::new); }


def private Stream getMessages() {            //line 14

ResourceSet messages = Message.reader(SID).read();




String SID="xxxxxx..."

String AUTH_TOKEN= "yyyyyy...."