diff --git a/core/opentaint-dataflow-core/opentaint-jvm-dataflow/src/main/kotlin/org/opentaint/dataflow/jvm/ap/ifds/JIRFactTypeChecker.kt b/core/opentaint-dataflow-core/opentaint-jvm-dataflow/src/main/kotlin/org/opentaint/dataflow/jvm/ap/ifds/JIRFactTypeChecker.kt index fe2a05424..1ecd49583 100644 --- a/core/opentaint-dataflow-core/opentaint-jvm-dataflow/src/main/kotlin/org/opentaint/dataflow/jvm/ap/ifds/JIRFactTypeChecker.kt +++ b/core/opentaint-dataflow-core/opentaint-jvm-dataflow/src/main/kotlin/org/opentaint/dataflow/jvm/ap/ifds/JIRFactTypeChecker.kt @@ -2,6 +2,7 @@ package org.opentaint.dataflow.jvm.ap.ifds import it.unimi.dsi.fastutil.longs.LongLongImmutablePair import it.unimi.dsi.fastutil.longs.LongLongPair +import kotlinx.coroutines.runBlocking import org.opentaint.dataflow.ap.ifds.AccessPathBase import org.opentaint.dataflow.ap.ifds.Accessor import org.opentaint.dataflow.ap.ifds.AnyAccessor @@ -33,12 +34,14 @@ import org.opentaint.ir.api.jvm.JIRType import org.opentaint.ir.api.jvm.JIRTypeVariable import org.opentaint.ir.api.jvm.JIRUnboundWildcard import org.opentaint.ir.api.jvm.cfg.JIRCallExpr +import org.opentaint.ir.api.jvm.ext.findClass import org.opentaint.ir.api.jvm.ext.ifArrayGetElementType import org.opentaint.ir.api.jvm.ext.isAssignable import org.opentaint.ir.api.jvm.ext.isSubClassOf import org.opentaint.ir.api.jvm.ext.objectType import org.opentaint.ir.api.jvm.ext.unboxIfNeeded import org.opentaint.ir.impl.features.classpaths.JIRUnknownType +import org.opentaint.ir.impl.features.hierarchyExt import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.LongAdder @@ -122,8 +125,18 @@ class JIRFactTypeChecker(private val cp: JIRClasspath) : FactTypeChecker { } } - is TypeInfoAccessor -> return FilterResult.Accept - TypeInfoGroupAccessor -> return FilterResult.Accept + is TypeInfoAccessor -> { + val lambdaType = cp.typeOf(cp.findClass(accessor.typeName)) + return if (lambdaType.isAssignable(actualType)) { + FilterResult.Accept + } else { + FilterResult.Reject + } + } + + TypeInfoGroupAccessor -> return FilterResult.FilterNext( + AccessorFilter(actualType, isLocalCheck) + ) } } diff --git a/core/opentaint-dataflow-core/opentaint-jvm-dataflow/src/main/kotlin/org/opentaint/dataflow/jvm/ap/ifds/LambdaAnonymousClassFeature.kt b/core/opentaint-dataflow-core/opentaint-jvm-dataflow/src/main/kotlin/org/opentaint/dataflow/jvm/ap/ifds/LambdaAnonymousClassFeature.kt index f2d1383bc..f8f66e0a1 100644 --- a/core/opentaint-dataflow-core/opentaint-jvm-dataflow/src/main/kotlin/org/opentaint/dataflow/jvm/ap/ifds/LambdaAnonymousClassFeature.kt +++ b/core/opentaint-dataflow-core/opentaint-jvm-dataflow/src/main/kotlin/org/opentaint/dataflow/jvm/ap/ifds/LambdaAnonymousClassFeature.kt @@ -53,6 +53,7 @@ import org.opentaint.ir.impl.features.classpaths.virtual.JIRVirtualParameter import org.opentaint.ir.impl.types.JIRClassTypeImpl import org.opentaint.ir.impl.types.JIRTypedFieldImpl import org.opentaint.ir.impl.types.substition.JIRSubstitutorImpl +import org.opentaint.jvm.util.name import java.util.Objects import java.util.concurrent.ConcurrentHashMap @@ -108,7 +109,10 @@ class LambdaAnonymousClassFeature : JIRClasspathExtFeature { } val fields = lambda.callSiteArgTypes.mapIndexed { fieldIdx, fieldType -> - val typeName = fieldType.typeName.typeName() + val typeName = when (fieldType) { + is JIRClassType -> fieldType.name + else -> fieldType.typeName + }.typeName() val field = JIRLambdaField(name = "lambdaCSArg$${fieldIdx}", type = typeName) .also { it.bind(lambdaClass) }