
com.googlecode.jpattern.org.cojen.classfile.attribute.StackMapTableAttr Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jpattern-cojen Show documentation
Show all versions of jpattern-cojen Show documentation
This is a copy of the good Cojen project from http://cojen.sourceforge.net/ with package name changed
The newest version!
/*
* Copyright 2008-2010 Brian S O'Neill
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.googlecode.jpattern.org.cojen.classfile.attribute;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.googlecode.jpattern.org.cojen.classfile.Attribute;
import com.googlecode.jpattern.org.cojen.classfile.ConstantPool;
import com.googlecode.jpattern.org.cojen.classfile.MethodInfo;
import com.googlecode.jpattern.org.cojen.classfile.TypeDesc;
import com.googlecode.jpattern.org.cojen.classfile.constant.ConstantClassInfo;
/**
*
*
* @author Brian S O'Neill
*/
public class StackMapTableAttr extends Attribute {
private final InitialFrame mInitialFrame;
private int mSize;
private int mLength;
public StackMapTableAttr(ConstantPool cp, String name, int length, DataInput din)
throws IOException
{
super(cp, name);
int size = din.readUnsignedShort();
List frames = new ArrayList(size);
InitialFrame first = new InitialFrame();
StackMapFrame last = first;
for (int i=0; i")) {
infos[0] = UninitThisVariableInfo.THE;
} else {
infos[0] = VerificationTypeInfo.forType(cp, info.getClassFile().getType());
}
offset = 1;
}
for (int i=0; i";
}
}
private static class IntegerVariableInfo extends VerificationTypeInfo {
static final IntegerVariableInfo THE = new IntegerVariableInfo();
private IntegerVariableInfo() {
}
public TypeDesc getType() {
return TypeDesc.INT;
}
public void writeTo(DataOutput dout) throws IOException {
dout.writeByte(1);
}
}
private static class FloatVariableInfo extends VerificationTypeInfo {
static final FloatVariableInfo THE = new FloatVariableInfo();
private FloatVariableInfo() {
}
public TypeDesc getType() {
return TypeDesc.FLOAT;
}
public void writeTo(DataOutput dout) throws IOException {
dout.writeByte(2);
}
}
private static class LongVariableInfo extends VerificationTypeInfo {
static final LongVariableInfo THE = new LongVariableInfo();
private LongVariableInfo() {
}
public TypeDesc getType() {
return TypeDesc.LONG;
}
public void writeTo(DataOutput dout) throws IOException {
dout.writeByte(4);
}
}
private static class DoubleVariableInfo extends VerificationTypeInfo {
static final DoubleVariableInfo THE = new DoubleVariableInfo();
private DoubleVariableInfo() {
}
public TypeDesc getType() {
return TypeDesc.DOUBLE;
}
public void writeTo(DataOutput dout) throws IOException {
dout.writeByte(3);
}
}
private static class NullVariableInfo extends VerificationTypeInfo {
static final NullVariableInfo THE = new NullVariableInfo();
private NullVariableInfo() {
}
public TypeDesc getType() {
return null;
}
public void writeTo(DataOutput dout) throws IOException {
dout.writeByte(5);
}
@Override
public String toString() {
return "";
}
}
private static class UninitThisVariableInfo extends VerificationTypeInfo {
static final UninitThisVariableInfo THE = new UninitThisVariableInfo();
private UninitThisVariableInfo() {
}
public TypeDesc getType() {
return null;
}
@Override
public boolean isThis() {
return true;
}
@Override
public boolean isUninitialized() {
return true;
}
public void writeTo(DataOutput dout) throws IOException {
dout.writeByte(6);
}
@Override
public String toString() {
return "";
}
}
private static class ObjectVariableInfo extends VerificationTypeInfo {
private final ConstantClassInfo mClassInfo;
ObjectVariableInfo(ConstantPool cp, DataInput din) throws IOException {
mClassInfo = (ConstantClassInfo) cp.getConstant(din.readUnsignedShort());
}
ObjectVariableInfo(ConstantPool cp, TypeDesc desc) {
mClassInfo = cp.addConstantClass(desc);
}
@Override
public int getLength() {
return 3;
}
public TypeDesc getType() {
return mClassInfo.getType();
}
public void writeTo(DataOutput dout) throws IOException {
dout.writeByte(7);
dout.writeShort(mClassInfo.getIndex());
}
}
private static class UninitVariableInfo extends VerificationTypeInfo {
private final int mOffset;
UninitVariableInfo(ConstantPool cp, DataInput din) throws IOException {
mOffset = din.readUnsignedShort();
}
@Override
public int getLength() {
return 3;
}
public TypeDesc getType() {
return null;
}
@Override
public boolean isUninitialized() {
return true;
}
public void writeTo(DataOutput dout) throws IOException {
dout.writeByte(8);
dout.writeShort(mOffset);
}
@Override
public String toString() {
return "";
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy