Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: java.lang.IllegalStateException: Failed to apply sootup.java.core.interceptors.TypeAssigner #1058

Open
sdlisilong opened this issue Sep 11, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sdlisilong
Copy link

What happened?

sootup version: 1.3.0
jdk:1.8

method source:

package com.democlass;

import java.util.StringJoiner;

/**
 * @date 2024/7/8
 */
public class TestA {

    public Integer add(int i, int j) {
        StringJoiner stringJoiner = new StringJoiner(", ", "{", "}");

        return i+j;
    }

}

When encountering the StringJoiner class, an error occurs

Version

Latest release (e.g. via Maven)

Relevant log output

Exception in thread "main" java.lang.IllegalStateException: Failed to apply sootup.java.core.interceptors.TypeAssigner@365c30cc to <com.democlass.TestA: java.lang.Integer add(int,int)>
	at sootup.java.bytecode.frontend.AsmMethodSource.resolveBody(AsmMethodSource.java:240)
	at sootup.core.model.SootMethod.lazyBodyInitializer(SootMethod.java:98)
	at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:181)
	at sootup.core.model.SootMethod.getBody(SootMethod.java:177)
	at com.sootup.TestAAnalysis.analysis(TestAAnalysis.java:79)
	at com.sootup.TestAAnalysis.main(TestAAnalysis.java:62)
Caused by: java.lang.ClassCastException: sootup.core.jimple.common.constant.StringConstant cannot be cast to sootup.core.jimple.basic.Local
	at sootup.java.core.interceptors.typeresolving.TypePromotionVisitor.visit(TypePromotionVisitor.java:76)
	at sootup.java.core.interceptors.typeresolving.TypeChecker.handleInvokeExpr(TypeChecker.java:300)
	at sootup.java.core.interceptors.typeresolving.TypeChecker.caseInvokeStmt(TypeChecker.java:77)
	at sootup.core.jimple.common.stmt.JInvokeStmt.accept(JInvokeStmt.java:73)
	at sootup.core.jimple.common.stmt.JInvokeStmt.accept(JInvokeStmt.java:34)
	at sootup.java.core.interceptors.typeresolving.TypePromotionVisitor.getPromotedTyping(TypePromotionVisitor.java:47)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at sootup.java.core.interceptors.typeresolving.TypeResolver.resolve(TypeResolver.java:81)
	at sootup.java.core.interceptors.TypeAssigner.interceptBody(TypeAssigner.java:42)
	at sootup.java.bytecode.frontend.AsmMethodSource.resolveBody(AsmMethodSource.java:234)
	... 5 more
@sdlisilong sdlisilong added the bug Something isn't working label Sep 11, 2024
@stschott
Copy link
Collaborator

Try to use the current develop version. This bug should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants