Я пытаюсь построить проект и получаю сообщение об ошибке ниже.Я проверил jar-файл, из которого импортируется AsyncMessage, и этот класс является конкретным, а не абстрактным.
flex.messaging.messages.AsyncMessage is abstract; cannot be instantiated
[javac] AsyncMessage msg = new AsyncMessage();
[javac] ^
Ниже приведен полный класс AsyncMessage, который я нашел в flex-jar, на который ссылаются.
package flex.messaging.messages;
import flex.messaging.log.Log;
import flex.messaging.util.UUIDUtils;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
public class AsyncMessage
extends AbstractMessage
implements SmallMessage
{
private static final long serialVersionUID = -3549535089417916783L;
public static final String SUBTOPIC_HEADER_NAME = "DSSubtopic";
private static byte CORRELATION_ID_FLAG = 1;
private static byte CORRELATION_ID_BYTES_FLAG = 2;
protected String correlationId;
protected byte[] correlationIdBytes;
public String getCorrelationId()
{
return this.correlationId;
}
public void setCorrelationId(String correlationId)
{
this.correlationId = correlationId;
}
public Message getSmallMessage()
{
if (getClass() == AsyncMessage.class) {
return new AsyncMessageExt(this);
}
return null;
}
public void readExternal(ObjectInput input)
throws IOException, ClassNotFoundException
{
super.readExternal(input);
short[] flagsArray = readFlags(input);
for (int i = 0; i < flagsArray.length; i++)
{
short flags = flagsArray[i];
short reservedPosition = 0;
if (i == 0)
{
if ((flags & CORRELATION_ID_FLAG) != 0) {
this.correlationId = ((String)input.readObject());
}
if ((flags & CORRELATION_ID_BYTES_FLAG) != 0)
{
this.correlationIdBytes = ((byte[])input.readObject());
this.correlationId = UUIDUtils.fromByteArray(this.correlationIdBytes);
}
reservedPosition = 2;
}
if (flags >> reservedPosition != 0) {
for (short j = reservedPosition; j < 6; j = (short)(j + 1)) {
if ((flags >> j & 0x1) != 0) {
input.readObject();
}
}
}
}
}
public void writeExternal(ObjectOutput output)
throws IOException
{
super.writeExternal(output);
if (this.correlationIdBytes == null) {
this.correlationIdBytes = UUIDUtils.toByteArray(this.correlationId);
}
short flags = 0;
if ((this.correlationId != null) && (this.correlationIdBytes == null)) {
flags = (short)(flags | CORRELATION_ID_FLAG);
}
if (this.correlationIdBytes != null) {
flags = (short)(flags | CORRELATION_ID_BYTES_FLAG);
}
output.writeByte(flags);
if ((this.correlationId != null) && (this.correlationIdBytes == null)) {
output.writeObject(this.correlationId);
}
if (this.correlationIdBytes != null) {
output.writeObject(this.correlationIdBytes);
}
}
protected String toStringFields(int indentLevel)
{
String sep = getFieldSeparator(indentLevel);
String s = sep + "clientId = " + (Log.isExcludedProperty("clientId") ? "** [Value Suppressed] **" : this.clientId);
s = s + sep + "correlationId = " + (Log.isExcludedProperty("correlationId") ? "** [Value Suppressed] **" : this.correlationId);
s = s + sep + "destination = " + (Log.isExcludedProperty("destination") ? "** [Value Suppressed] **" : this.destination);
s = s + sep + "messageId = " + (Log.isExcludedProperty("messageId") ? "** [Value Suppressed] **" : this.messageId);
s = s + sep + "timestamp = " + (Log.isExcludedProperty("timestamp") ? "** [Value Suppressed] **" : String.valueOf(this.timestamp));
s = s + sep + "timeToLive = " + (Log.isExcludedProperty("timeToLive") ? "** [Value Suppressed] **" : String.valueOf(this.timeToLive));
s = s + sep + "body = " + (Log.isExcludedProperty("body") ? "** [Value Suppressed] **" : bodyToString(this.body, indentLevel));
s = s + super.toStringFields(indentLevel);
return s;
}
}
Все еще не уверен, почему компилятор Java выдает эту ошибку.Я использую Java версии 1.6 и Ant версии 1.7 при сборке.Пожалуйста, проверьте, если я что-то упустил.Спасибо