Skip to content

javassist-3.19 fails with elephant brain #90

@varuniy

Description

@varuniy

Description

When running Randoop with ELEPHANT_BRAIN enabled on javassist-3.19, Randoop generates test sequences that cast abstract types to internal implementation classes. These casts fail during test execution when the runtime type differs from the type observed during test generation.

Environment Setup

  1. Clone and setup the test environment:
git clone git@github.com:randoop/grt-testing.git
cd grt-testing/scripts
  1. Install prerequisites (per scripts/prerequisites.md):
make
make randoop-from-source
./get-all-subject-src.sh

Reproduction Steps

  1. From the scripts directory, run:
./mutation-randoop.sh -t 60 -o info.csv -f ELEPHANT_BRAIN javassist-3.19

Behavior

Randoop fails with:

createAndClassifySequences threw an exception
java.lang.ClassCastException: Cannot cast javassist.bytecode.annotation.ByteMemberValue to javassist.bytecode.annotation.ShortMemberValue
        at java.lang.Class.cast(Class.java:3369)
        at randoop.operation.UncheckedCast.execute(UncheckedCast.java:41)
        at randoop.operation.TypedOperation.execute(TypedOperation.java:403)
        at randoop.sequence.Statement.execute(Statement.java:164)
        at randoop.sequence.ExecutableSequence.executeStatement(ExecutableSequence.java:559)
        at randoop.sequence.ExecutableSequence.execute(ExecutableSequence.java:330)
        at randoop.sequence.ExecutableSequence.execute(ExecutableSequence.java:259)
        at randoop.generation.ForwardGenerator.step(ForwardGenerator.java:246)
        at randoop.generation.AbstractGenerator.createAndClassifySequences(AbstractGenerator.java:308)
        at randoop.main.GenTests.handle(GenTests.java:582)
        at randoop.main.Main.nonStaticMain(Main.java:69)
        at randoop.main.Main.main(Main.java:31)

and additionally prints:

Randoop failed.
Last sequence under execution: 
javassist.bytecode.ClassFile classFile6 = new javassist.bytecode.ClassFile(false, "(BBSSB)", "*top*");
int int7 = classFile6.getAccessFlags();
javassist.util.proxy.FactoryHelper.writeFile(classFile6, "RuntimeVisibleAnnotations");
javassist.bytecode.ConstPool constPool10 = classFile6.getConstPool();
javassist.bytecode.annotation.EnumMemberValue enumMemberValue11 = new javassist.bytecode.annotation.EnumMemberValue(0, 58, constPool10);
javassist.bytecode.annotation.Annotation annotation12 = new javassist.bytecode.annotation.Annotation("EnclosingMethod", constPool10);
java.io.OutputStream outputStream14 = null;
javassist.bytecode.ClassFile classFile18 = new javassist.bytecode.ClassFile(false, "(BBSSB)", "*top*");
int int19 = classFile18.getAccessFlags();
javassist.util.proxy.FactoryHelper.writeFile(classFile18, "RuntimeVisibleAnnotations");
javassist.bytecode.ConstPool constPool22 = classFile18.getConstPool();
javassist.bytecode.annotation.TypeAnnotationsWriter typeAnnotationsWriter23 = new javassist.bytecode.annotation.TypeAnnotationsWriter(outputStream14, constPool22);
javassist.CtClass ctClass24 = javassist.CtClass.shortType;
@SuppressWarnings("unchecked")
javassist.CtPrimitiveType ctPrimitiveType25 = (javassist.CtPrimitiveType)ctClass24;
javassist.CtBehavior ctBehavior26 = ctClass24.getEnclosingBehavior();
@SuppressWarnings("unchecked")
javassist.CtPrimitiveType ctPrimitiveType27 = (javassist.CtPrimitiveType)ctClass24;
java.lang.String str28 = ctPrimitiveType27.toString();
javassist.CtMethod[] ctMethodArray29 = ctPrimitiveType27.getMethods();
javassist.bytecode.annotation.MemberValue memberValue30 = javassist.bytecode.annotation.Annotation.createMemberValue(constPool22, (javassist.CtClass) ctPrimitiveType27);
@SuppressWarnings("unchecked")
javassist.bytecode.annotation.ShortMemberValue shortMemberValue31 = (javassist.bytecode.annotation.ShortMemberValue)memberValue30;
annotation12.addMemberValue(73, memberValue30);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions