Fixed a bug causing a StackOverflowException on packet construction.
Dieser Commit ist enthalten in:
Ursprung
d5028b584d
Commit
69a5675161
@ -67,6 +67,16 @@ public abstract class CompiledStructureModifier<TField> extends StructureModifie
|
|||||||
else
|
else
|
||||||
return (TField) result;
|
return (TField) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the given field index using reflection.
|
||||||
|
* @param index - index of field.
|
||||||
|
* @return Resulting value.
|
||||||
|
* @throws FieldAccessException The field doesn't exist, or it cannot be accessed under the current security contraints.
|
||||||
|
*/
|
||||||
|
protected Object readReflected(int index) throws FieldAccessException {
|
||||||
|
return super.read(index);
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract Object readGenerated(int fieldIndex) throws FieldAccessException;
|
protected abstract Object readGenerated(int fieldIndex) throws FieldAccessException;
|
||||||
|
|
||||||
@ -78,6 +88,17 @@ public abstract class CompiledStructureModifier<TField> extends StructureModifie
|
|||||||
return writeGenerated(index, value);
|
return writeGenerated(index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the given field using reflection.
|
||||||
|
* @param index - index of field.
|
||||||
|
* @param value - new value.
|
||||||
|
* @throws FieldAccessException The field doesn't exist, or it cannot be accessed under the current security contraints.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected void writeReflected(int index, Object value) throws FieldAccessException {
|
||||||
|
super.write(index, (TField) value);
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract StructureModifier<TField> writeGenerated(int index, Object value) throws FieldAccessException;
|
protected abstract StructureModifier<TField> writeGenerated(int index, Object value) throws FieldAccessException;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -335,8 +335,7 @@ public final class StructureCompiler {
|
|||||||
mv.visitVarInsn(Opcodes.ALOAD, 0);
|
mv.visitVarInsn(Opcodes.ALOAD, 0);
|
||||||
mv.visitVarInsn(Opcodes.ILOAD, 1);
|
mv.visitVarInsn(Opcodes.ILOAD, 1);
|
||||||
mv.visitVarInsn(Opcodes.ALOAD, 2);
|
mv.visitVarInsn(Opcodes.ALOAD, 2);
|
||||||
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, COMPILED_CLASS, "write", "(ILjava/lang/Object;)L" + SUPER_CLASS + ";");
|
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, COMPILED_CLASS, "writeReflected", "(ILjava/lang/Object;)V;");
|
||||||
mv.visitInsn(Opcodes.POP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mv.visitJumpInsn(Opcodes.GOTO, returnLabel);
|
mv.visitJumpInsn(Opcodes.GOTO, returnLabel);
|
||||||
@ -408,7 +407,7 @@ public final class StructureCompiler {
|
|||||||
// We have to use reflection for private and protected fields.
|
// We have to use reflection for private and protected fields.
|
||||||
mv.visitVarInsn(Opcodes.ALOAD, 0);
|
mv.visitVarInsn(Opcodes.ALOAD, 0);
|
||||||
mv.visitVarInsn(Opcodes.ILOAD, 1);
|
mv.visitVarInsn(Opcodes.ILOAD, 1);
|
||||||
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, COMPILED_CLASS, "read", "(I)Ljava/lang/Object;");
|
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, COMPILED_CLASS, "readReflected", "(I)Ljava/lang/Object;");
|
||||||
}
|
}
|
||||||
|
|
||||||
mv.visitInsn(Opcodes.ARETURN);
|
mv.visitInsn(Opcodes.ARETURN);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren