Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ public class ConstantObj extends Obj {
private final ReferenceLiteral value;

ConstantObj(ReferenceLiteral value) {
super(value.getType());
this.value = value;
}

@Override
public Type getType() {
return value.getType();
}

@Override
public ReferenceLiteral getAllocation() {
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public class MergedObj extends Obj {

private final String name;

private final Type type;

/**
* Set of objects represented by this merged object.
*/
Expand All @@ -51,7 +49,7 @@ public class MergedObj extends Obj {
private Obj representative;

public MergedObj(Type type, String name) {
this.type = type;
super(type);
this.name = name;
}

Expand All @@ -71,11 +69,6 @@ public Set<Obj> getAllocation() {
return representedObjs;
}

@Override
public Type getType() {
return type;
}

@Override
public Optional<JMethod> getContainerMethod() {
return representative != null ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@ public class MockObj extends Obj {

private final Object alloc;

private final Type type;

private final JMethod container;

private final boolean isFunctional;

public MockObj(Descriptor desc, Object alloc, Type type,
JMethod container, boolean isFunctional) {
super(type);
this.desc = desc;
this.alloc = alloc;
this.type = type;
this.container = container;
this.isFunctional = isFunctional;
}
Expand All @@ -57,11 +55,6 @@ public Descriptor getDescriptor() {
return desc;
}

@Override
public Type getType() {
return type;
}

@Override
public Object getAllocation() {
return alloc;
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/pascal/taie/analysis/pta/core/heap/NewObj.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import pascal.taie.ir.stmt.New;
import pascal.taie.language.classes.JMethod;
import pascal.taie.language.type.ReferenceType;
import pascal.taie.language.type.Type;

import java.util.Optional;
Expand All @@ -37,14 +36,10 @@ public class NewObj extends Obj {
private final New allocSite;

NewObj(New allocSite) {
super(allocSite.getRValue().getType());
this.allocSite = allocSite;
}

@Override
public ReferenceType getType() {
return allocSite.getRValue().getType();
}

@Override
public New getAllocation() {
return allocSite;
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/pascal/taie/analysis/pta/core/heap/Obj.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@
*/
public abstract class Obj implements Indexable {

protected final Type type;

private int index = -1;

protected Obj(Type type) {
this.type = type;
}

void setIndex(int index) {
if (this.index != -1) {
throw new IllegalStateException("index already set");
Expand Down Expand Up @@ -65,7 +71,9 @@ public boolean isFunctional() {
/**
* @return the type of the object.
*/
public abstract Type getType();
public Type getType() {
return type;
}

/**
* @return the allocation of the object.
Expand Down
Loading