Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion src/main/java/amidst/clazz/real/RealClassBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import amidst.clazz.real.RealClassConstant.RealClassConstantType;
import amidst.documentation.Immutable;

/**
* See https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.8
*/
@Immutable
public class RealClassBuilder {
public RealClass construct(String realClassName, byte[] classData) throws RealClassCreationException {
Expand Down Expand Up @@ -139,8 +142,14 @@ private RealClassConstant<?> readConstant(
return readAnotherReference(stream, type);
case RealClassConstantType.NAME_AND_TYPE_DESCRIPTOR:
return readAnotherReference(stream, type);
case RealClassConstantType.METHOD_HANDLE:
return readMethodHandle(stream, type);
case RealClassConstantType.METHOD_TYPE:
return readMethodType(stream, type);
case RealClassConstantType.INVOKE_DYNAMIC:
return readInvokeDynamic(stream, type);
default:
return null;
throw new IOException("unknown constant type: " + type);
}
}

Expand Down Expand Up @@ -203,6 +212,26 @@ private RealClassConstant<ReferenceIndex> readAnotherReference(DataInputStream s
return new RealClassConstant<>(type, value);
}

private RealClassConstant<Void> readMethodHandle(DataInputStream stream, byte type) throws IOException {
stream.readByte();
stream.readUnsignedShort();
// return a dummy
return new RealClassConstant<Void>(type, null);
}

private RealClassConstant<Void> readMethodType(DataInputStream stream, byte type) throws IOException {
stream.readUnsignedShort();
// return a dummy
return new RealClassConstant<Void>(type, null);
}

private RealClassConstant<Void> readInvokeDynamic(DataInputStream stream, byte type) throws IOException {
stream.readUnsignedShort();
stream.readUnsignedShort();
// return a dummy
return new RealClassConstant<Void>(type, null);
}

private int readAccessFlags(DataInputStream stream) throws IOException {
return stream.readUnsignedShort();
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/amidst/clazz/real/RealClassConstant.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public static enum RealClassConstantType {
public static final int METHOD_REFERENCE = 10;
public static final int INTERFACE_METHOD_REFERENCE = 11;
public static final int NAME_AND_TYPE_DESCRIPTOR = 12;
public static final int METHOD_HANDLE = 15;
public static final int METHOD_TYPE = 16;
public static final int INVOKE_DYNAMIC = 18;

public static boolean isQIncreasing(byte type) {
return type == LONG || type == DOUBLE;
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/amidst/clazz/real/RealClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.zip.ZipFile;

import amidst.documentation.Immutable;
import amidst.logging.AmidstLogger;

@Immutable
public enum RealClasses {
Expand Down Expand Up @@ -72,8 +71,6 @@ private static RealClass readRealClass(String realClassName, BufferedInputStream
theStream.read(classData);
return REAL_CLASS_BUILDER.construct(realClassName, classData);
}
} catch (RealClassCreationException e) {
AmidstLogger.warn(e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public enum RecognisedVersion {
// TODO: Remove these versions before V1_0?
// TODO: stronghold reset on V1_9pre4?
UNKNOWN,
_1_12_pre3 ("1.12-pre3", "ujrjoxmsrw[Lom;pj[J[[Jpf"), // matches the launcher version id: 1.12-pre3
_1_12_pre7 ("1.12-pre7", "ujrjoxmsrw[Lom;pj[J[[Jpf"), // matches the launcher version id: 1.12-pre7 1.12-pre6 1.12-pre5 1.12-pre4 1.12-pre3
_1_12_pre2 ("1.12-pre2", "uhrhovmqru[Lok;ph[J[[Jpd"), // matches the launcher version id: 1.12-pre2
_1_12_pre1 ("1.12-pre1", "ugrgoumprt[Loj;pg[J[[Jpc"), // matches the launcher version id: 1.12-pre1
_17w18b ("17w18b", "tyqyommirl[Lob;oy[J[[Jou"), // matches the launcher version id: 17w18b
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/amidst/mojangapi/version_manifest.json

Large diffs are not rendered by default.